Examples of JoyentCloudTemplateOptions


Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

   public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
         Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {

      Template mutableTemplate = template.clone();

      JoyentCloudTemplateOptions templateOptions = JoyentCloudTemplateOptions.class.cast(mutableTemplate.getOptions());

      assert template.getOptions().equals(templateOptions) : "options didn't clone properly";

      templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);

      String datacenter = mutableTemplate.getLocation().getId();
     
      if (!templateOptions.shouldGenerateKey().isPresent())
         templateOptions.generateKey(defaultToAutogenerateKeys);

      if (templateOptions.shouldGenerateKey().get()) {
         KeyAndPrivateKey keyPair = keyCache.getUnchecked(DatacenterAndName.fromDatacenterAndName(datacenter, namingConvention.create()
               .sharedNameForGroup(group)));
         // in order to delete the key later
         keyCache.asMap().put(DatacenterAndName.fromDatacenterAndName(datacenter, keyPair.getKey().getName()), keyPair);
         templateOptions.overrideLoginPrivateKey(keyPair.getPrivateKey());
      }
      checkArgument(templateOptions.getRunScript() == null || templateOptions.getLoginPrivateKey() != null,
            "when specifying runScript, you must either set overrideLoginPrivateKey, or generateKey(true)");
      return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

   public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
         Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {

      Template mutableTemplate = template.clone();

      JoyentCloudTemplateOptions templateOptions = JoyentCloudTemplateOptions.class.cast(mutableTemplate.getOptions());

      assert template.getOptions().equals(templateOptions) : "options didn't clone properly";

      templateOptions.userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, group);

      String datacenter = mutableTemplate.getLocation().getId();
     
      if (!templateOptions.shouldGenerateKey().isPresent())
         templateOptions.generateKey(defaultToAutogenerateKeys);

      if (templateOptions.shouldGenerateKey().get()) {
         KeyAndPrivateKey keyPair = keyCache.getUnchecked(DatacenterAndName.fromDatacenterAndName(datacenter, namingConvention.create()
               .sharedNameForGroup(group)));
         // in order to delete the key later
         keyCache.asMap().put(DatacenterAndName.fromDatacenterAndName(datacenter, keyPair.getKey().getName()), keyPair);
         templateOptions.overrideLoginPrivateKey(keyPair.getPrivateKey());
      }
      checkArgument(templateOptions.getRunScript() == null || templateOptions.getLoginPrivateKey() != null,
            "when specifying runScript, you must either set overrideLoginPrivateKey, or generateKey(true)");
      return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

   public Map<?, ListenableFuture<Void>> execute(String group, int count, Template template, Set<NodeMetadata> goodNodes,
         Map<NodeMetadata, Exception> badNodes, Multimap<NodeMetadata, CustomizationResponse> customizationResponses) {

      Template mutableTemplate = template.clone();

      JoyentCloudTemplateOptions templateOptions = JoyentCloudTemplateOptions.class.cast(mutableTemplate.getOptions());

      assert template.getOptions().equals(templateOptions) : "options didn't clone properly";

      String datacenter = mutableTemplate.getLocation().getId();
     
      if (!templateOptions.shouldGenerateKey().isPresent())
         templateOptions.generateKey(defaultToAutogenerateKeys);

      if (templateOptions.shouldGenerateKey().get()) {
         KeyAndPrivateKey keyPair = keyCache.getUnchecked(DatacenterAndName.fromDatacenterAndName(datacenter, namingConvention.create()
               .sharedNameForGroup(group)));
         // in order to delete the key later
         keyCache.asMap().put(DatacenterAndName.fromDatacenterAndName(datacenter, keyPair.getKey().getName()), keyPair);
         templateOptions.overrideLoginPrivateKey(keyPair.getPrivateKey());
      }
      checkArgument(templateOptions.getRunScript() == null || templateOptions.getLoginPrivateKey() != null,
            "when specifying runScript, you must either set overrideLoginPrivateKey, or generateKey(true)");
      return super.execute(group, count, mutableTemplate, goodNodes, badNodes, customizationResponses);
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

*/
@Test(testName = "JoyentCloudTemplateOptionsTest")
public class JoyentCloudTemplateOptionsTest {

   public void testAs() {
      TemplateOptions options = new JoyentCloudTemplateOptions();
      assertEquals(options.as(JoyentCloudTemplateOptions.class), options);
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

      assertEquals(options.as(JoyentCloudTemplateOptions.class), options);
   }

   @Test
   public void testGenerateKeyDefault() {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
      assert !options.shouldGenerateKey().isPresent();
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

      assert !options.shouldGenerateKey().isPresent();
   }

   @Test
   public void testGenerateKey() {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions().generateKey(true);
      assert options.shouldGenerateKey().get();
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

      assert options.shouldGenerateKey().get();
   }

   @Test
   public void testGenerateKeyStatic() {
      JoyentCloudTemplateOptions options = generateKey(true);
      assert options.shouldGenerateKey().get();
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

   }

   // superclass tests
   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testinstallPrivateKeyBadFormat() {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
      options.installPrivateKey("whompy");
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

      options.installPrivateKey("whompy");
   }

   @Test
   public void testinstallPrivateKey() throws IOException {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
      options.installPrivateKey("-----BEGIN RSA PRIVATE KEY-----");
      assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
   }

Examples of org.jclouds.joyent.cloudapi.v6_5.compute.options.JoyentCloudTemplateOptions

      assertEquals(options.getPrivateKey(), "-----BEGIN RSA PRIVATE KEY-----");
   }

   @Test
   public void testNullinstallPrivateKey() {
      JoyentCloudTemplateOptions options = new JoyentCloudTemplateOptions();
      assertEquals(options.getPrivateKey(), null);
   }
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.