@Test public void testAs() { TemplateOptions options = new GoGridTemplateOptions(); assertEquals(options.as(GoGridTemplateOptions.class), options); } }
@Test public void testAs() { TemplateOptions options = new SoftLayerTemplateOptions(); assertEquals(options.as(SoftLayerTemplateOptions.class), options); }
@Test public void testSecurityGroupIdsStatic() { TemplateOptions options = securityGroupIds(ImmutableSet.of("3")); assertEquals(options.as(CloudStackTemplateOptions.class).getSecurityGroupIds(), ImmutableSet.of("3")); }
@Test public void testDefaultSecurityGroupIds() { TemplateOptions options = new CloudStackTemplateOptions(); assertEquals(options.as(CloudStackTemplateOptions.class).getSecurityGroupIds(), ImmutableSet.of()); }
@Test public void testDefaultNetworkIds() { TemplateOptions options = new CloudStackTemplateOptions(); assertEquals(options.as(CloudStackTemplateOptions.class).getNetworkIds(), ImmutableSet.of()); }
@Test public void testSetupStaticNatStatic() { TemplateOptions options = setupStaticNat(false); assertFalse(options.as(CloudStackTemplateOptions.class) .shouldSetupStaticNat()); }
@Test public void testDefaultip() { TemplateOptions options = new GleSYSTemplateOptions(); assertEquals(options.as(GleSYSTemplateOptions.class).getIp(), "any"); }
@Test public void testipStatic() { TemplateOptions options = ip("1.1.1.1"); assertEquals(options.as(GleSYSTemplateOptions.class).getIp(), "1.1.1.1"); }
@Test public void testDefaultDomainName() { TemplateOptions options = new SoftLayerTemplateOptions(); assertEquals(options.as(SoftLayerTemplateOptions.class).getDomainName(), "jclouds.org"); }
@Test public void testDefaultTranferGB() { TemplateOptions options = new GleSYSTemplateOptions(); assertEquals(options.as(GleSYSTemplateOptions.class).getTransferGB(), 50); }
@Test public void testIpOnDefaultNetworkStatic() { TemplateOptions options = ipOnDefaultNetwork("10.0.0.1"); assertEquals(options.as(CloudStackTemplateOptions.class).getIpOnDefaultNetwork(), "10.0.0.1"); }
@Test public void testSetupStaticNatDefaultsTrue() { TemplateOptions options = new CloudStackTemplateOptions(); assertTrue(options.as(CloudStackTemplateOptions.class) .shouldSetupStaticNat()); }
@Test public void testRootPasswordStatic() { TemplateOptions options = rootPassword("secret"); assertEquals(options.as(GleSYSTemplateOptions.class).getRootPassword(), "secret"); }
@Test public void testSecurityGroupIds() { TemplateOptions options = new CloudStackTemplateOptions().securityGroupIds(ImmutableSet.of("3")); assertEquals(options.as(CloudStackTemplateOptions.class).getSecurityGroupIds(), ImmutableSet.of("3")); }
@Test public void testNetworkId() { TemplateOptions options = new CloudStackTemplateOptions().networkId("3"); assertEquals(options.as(CloudStackTemplateOptions.class).getNetworkIds(), ImmutableSet.of("3")); }
@Test public void testIpsToNetwork() { Map<String, String> ipsToNetworks = Maps.newHashMap(); ipsToNetworks.put("10.0.0.1", "5"); TemplateOptions options = new CloudStackTemplateOptions().ipsToNetworks(ipsToNetworks); assertEquals(options.as(CloudStackTemplateOptions.class) .getIpsToNetworks().get("10.0.0.1"), "5"); }
@Test public void testSetupStaticNat() { TemplateOptions options = new CloudStackTemplateOptions().setupStaticNat(false); assertFalse(options.as(CloudStackTemplateOptions.class) .shouldSetupStaticNat()); }
@Test public void testIpOnDefaultNetwork() { TemplateOptions options = new CloudStackTemplateOptions().ipOnDefaultNetwork("10.0.0.1"); assertEquals(options.as(CloudStackTemplateOptions.class).getIpOnDefaultNetwork(), "10.0.0.1"); }
@Test public void testTransferGB() { TemplateOptions options = new GleSYSTemplateOptions().transferGB(75); assertEquals(options.as(GleSYSTemplateOptions.class).getTransferGB(), 75); }
@Override public Map<?, ListenableFuture<Void>> execute(String tag, int count, Template template, Set<NodeMetadata> goodNodes, Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) { assert template.getLocation().getParent().getScope() == LocationScope.REGION : "template location should have a parent of org, which should be mapped to region: " + template.getLocation(); String orgId = template.getLocation().getParent().getId(); assert orgId.startsWith("http") : "parent id should be a rest url: " + template.getLocation().getParent(); createNewKeyPairUnlessUserSpecifiedOtherwise.execute(URI.create(orgId), tag, template.getImage() .getDefaultCredentials().identity, template.getOptions().as(TerremarkVCloudTemplateOptions.class)); return super.execute(tag, count, template, goodNodes, badNodes, customizationResponses); } }