public TemplateBuilder apply(TemplateBuilder b) { return b.os64Bit(is64bit); }}); return (T)this;
@Override protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { return template.osFamily(UBUNTU).os64Bit(true); }
@Override protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { String provider = injector.getInstance(Key.get(String.class, Provider.class)); if ("ec2".equals(provider)) return template.osFamily(AMZN_LINUX).os64Bit(true); else if ("nova".equals(provider)) return super.provideTemplate(injector, template); else return template.osFamily(CENTOS); }
public void testParse_os64Bit() { TemplateBuilderSpec spec = parse("os64Bit=true"); assertNull(spec.hardwareId); assertNull(spec.minCores); assertNull(spec.minRam); assertNull(spec.minDisk); assertNull(spec.hypervisorMatches); assertNull(spec.imageId); assertNull(spec.imageNameMatches); assertNull(spec.osVersionMatches); assertEquals(spec.os64Bit.booleanValue(), true); assertNull(spec.osArchMatches); assertNull(spec.osDescriptionMatches); assertNull(spec.loginUser); assertNull(spec.authenticateSudo); assertNull(spec.locationId); assertTemplateBuilderEquivalence(templateBuilders.get().os64Bit(true), templateBuilders.get().from(spec)); }
public void testParse_os64Bit() { TemplateBuilderSpec spec = parse("os64Bit=true"); assertNull(spec.hardwareId); assertNull(spec.minCores); assertNull(spec.minRam); assertNull(spec.minDisk); assertNull(spec.hypervisorMatches); assertNull(spec.imageId); assertNull(spec.imageNameMatches); assertNull(spec.osVersionMatches); assertEquals(spec.os64Bit.booleanValue(), true); assertNull(spec.osArchMatches); assertNull(spec.osDescriptionMatches); assertNull(spec.loginUser); assertNull(spec.authenticateSudo); assertNull(spec.locationId); assertNull(spec.forceCacheReload); assertTemplateBuilderEquivalence(templateBuilders.get().os64Bit(true), templateBuilders.get().from(spec)); }
@Test(dataProvider = "osNotSupported", expectedExceptions = NoSuchElementException.class) public void testTemplateBuilderCannotFind(OsFamilyVersion64Bit matrix) throws InterruptedException { TemplateBuilder builder = view.getComputeService().templateBuilder().osFamily(matrix.family) .os64Bit(matrix.is64Bit); if (!matrix.version.equals("")) builder.osVersionMatches("^" + matrix.version + "$"); builder.build(); }
/** * The default template if none is provided. */ @Provides @Named("DEFAULT") protected TemplateBuilder provideTemplateOptionallyFromProperties(Injector injector, TemplateBuilder template, @Provider String provider, ValueOfConfigurationKeyOrNull config) { String templateString = config.apply(provider + ".template"); if (templateString == null) templateString = config.apply(TEMPLATE); if (templateString != null) { template.from(templateString); } else { template.osFamily(UBUNTU).osVersionMatches("1[012].[01][04]").os64Bit(true); } String imageId = config.apply(provider + ".image-id"); if (imageId == null) imageId = config.apply(IMAGE_ID); if (imageId != null) template.imageId(imageId); return template; }
/** * The default template if none is provided. */ @Provides @Named("DEFAULT") protected TemplateBuilder provideTemplateOptionallyFromProperties(Injector injector, TemplateBuilder template, @Provider String provider, ValueOfConfigurationKeyOrNull config) { String templateString = config.apply(provider + ".template"); if (templateString == null) templateString = config.apply(TEMPLATE); if (templateString != null) { template.from(templateString); } else { template.osFamily(UBUNTU).osVersionMatches("1[012].[01][04]").os64Bit(true); } String imageId = config.apply(provider + ".image-id"); if (imageId == null) imageId = config.apply(IMAGE_ID); if (imageId != null) template.imageId(imageId); return template; }
/** * The default template if none is provided. */ @Provides @Named("DEFAULT") protected final TemplateBuilder provideTemplateOptionallyFromProperties(Injector injector, TemplateBuilder template, @Provider String provider, ValueOfConfigurationKeyOrNull config) { String templateString = config.apply(provider + ".template"); if (templateString == null) templateString = config.apply(TEMPLATE); if (templateString != null) { template.from(templateString); } else { template.osFamily(UBUNTU).osVersionMatches("1[012].[01][04]").os64Bit(true); } String imageId = config.apply(provider + ".image-id"); if (imageId == null) imageId = config.apply(IMAGE_ID); if (imageId != null) template.imageId(imageId); return template; }
/** * The default template if none is provided. */ @Provides @Named("DEFAULT") protected final TemplateBuilder provideTemplateOptionallyFromProperties(Injector injector, TemplateBuilder template, @Provider String provider, ValueOfConfigurationKeyOrNull config) { String templateString = config.apply(provider + ".template"); if (templateString == null) templateString = config.apply(TEMPLATE); if (templateString != null) { template.from(templateString); } else { template.osFamily(UBUNTU).osVersionMatches("1[012].[01][04]").os64Bit(true); } String imageId = config.apply(provider + ".image-id"); if (imageId == null) imageId = config.apply(IMAGE_ID); if (imageId != null) template.imageId(imageId); return template; }
@Test(dataProvider = "osSupported") public void testTemplateBuilderCanFind(OsFamilyVersion64Bit matrix) throws InterruptedException { TemplateBuilder builder = view.getComputeService().templateBuilder().osFamily(matrix.family) .os64Bit(matrix.is64Bit); if (!matrix.version.equals("")) builder.osVersionMatches("^" + matrix.version + "$"); Template template = builder.build(); if (!matrix.version.equals("")) assertEquals(template.getImage().getOperatingSystem().getVersion(), matrix.version); assertEquals(template.getImage().getOperatingSystem().is64Bit(), matrix.is64Bit); assertEquals(template.getImage().getOperatingSystem().getFamily(), matrix.family); }
/** * Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based * on physical attributes (# of cores, ram, etc). * * Expected size: CC1_4XLARGE */ @Test public void testTemplateChoiceForInstanceByAttributes() throws Exception { Template template = newTemplateBuilder().os64Bit(true).minRam(17510).minCores(6.5).smallest().locationId( "us-east-1").build(); assert template != null : "The returned template was null, but it should have a value."; assertEquals(template.getHardware().getId(), "cc1.4xlarge"); }
/** * Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based * on {@link org.jclouds.compute.domain.Hardware} from {@link EC2Hardware}. * * Expected size: m2.xlarge */ @Test public void testTemplateChoiceForInstanceByhardwareId() throws Exception { Template template = newTemplateBuilder().os64Bit(true).hardwareId("m2.xlarge").locationId("us-east-1").build(); assert template != null : "The returned template was null, but it should have a value."; // assert m2_xlarge().build().equals(template.getHardware()) : format( // "Incorrect image determined by the template. Expected: %s. Found: %s.", "m2.xlarge", // String.valueOf(template.getHardware())); assertEquals(m2_xlarge().build().getId(), template.getHardware().getId()); }
@Test public void testTemplateBuilderMicro() throws IOException { Template microTemplate = view.getComputeService().templateBuilder().hardwareId(InstanceType.T1_MICRO) .osFamily(OsFamily.UBUNTU).osVersionMatches("10.10").os64Bit(true).build(); assert microTemplate.getImage().getProviderId().startsWith("ami-") : microTemplate; assertEquals(microTemplate.getImage().getOperatingSystem().getVersion(), "10.10"); assertEquals(microTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(microTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); assertEquals(microTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs"); assertEquals(microTemplate.getLocation().getId(), "us-east-1"); assertEquals(getCores(microTemplate.getHardware()), 1.0d); assertEquals(microTemplate.getImage().getOperatingSystem().getArch(), "paravirtual"); }
/** * Negative test version of {@link #testTemplateChoiceForInstanceByAttributes}. * * Verifies that {@link TemplateBuilderImpl} would not choose the insufficient size of the * instance, based on physical attributes (# of cores, ram, etc). * * Expected size: anything but m2.xlarge */ @Test public void testNegativeTemplateChoiceForInstanceByAttributes() throws Exception { Template template = newTemplateBuilder().os64Bit(true).minRam(17510).minCores(6.7).smallest().locationId( "us-east-1").build(); assert template != null : "The returned template was null, but it should have a value."; assert !m2_xlarge().build().equals(template.getHardware()) : format( "Incorrect image determined by the template. Expected: not %s. Found: %s.", "m2.xlarge", template .getHardware().getId()); }
/** * Negative test version of {@link #testTemplateChoiceForInstanceByAttributes}. * * Verifies that {@link TemplateBuilderImpl} would not choose the insufficient size of the * instance, based on physical attributes (# of cores, ram, etc). * * Expected size: anything but m2.xlarge */ @Test public void testNegativeTemplateChoiceForInstanceByAttributes() throws Exception { Template template = newTemplateBuilder().os64Bit(true).minRam(17510).minCores(6.7).smallest().locationId( "us-east-1").build(); assert template != null : "The returned template was null, but it should have a value."; assert !m2_xlarge().build().equals(template.getHardware()) : format( "Incorrect image determined by the template. Expected: not %s. Found: %s.", "m2.xlarge", template .getHardware().getId()); }
/** * Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based * on {@link org.jclouds.compute.domain.Hardware} from {@link EC2Hardware}. * * Expected size: m2.xlarge */ @Test public void testTemplateChoiceForInstanceByHardwareId() throws Exception { Template template = newTemplateBuilder().os64Bit(true).hardwareId("m2.xlarge").locationId("us-east-1").build(); assert template != null : "The returned template was null, but it should have a value."; // assert m2_xlarge().build().equals(template.getHardware()) : format( // "Incorrect image determined by the template. Expected: %s. Found: %s.", "m2.xlarge", // String.valueOf(template.getHardware())); assertEquals(template.getHardware().getId(), m2_xlarge().build().getId()); }
/** * Verifies that {@link TemplateBuilderImpl} would choose the correct size of the instance, based * on physical attributes (# of cores, ram, etc). * * Expected size: CC1_4XLARGE */ @Test public void testTemplateChoiceForInstanceByAttributes() throws Exception { Template template = newTemplateBuilder().os64Bit(true).minRam(17510).minCores(6.5).smallest().locationId( "us-east-1").build(); assert template != null : "The returned template was null, but it should have a value."; assertEquals(template.getHardware().getId(), m2_4xlarge().build().getId()); }
builder.os64Bit(os64Bit);
.hypervisorMatches("OpenVZ").osVersionMatches("1[10].[10][04]").os64Bit(true);