Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Template


      return backendComputeService.get().getContext();
   }

   protected Set<? extends NodeMetadata> addToPool(int number) {
      try {
         Template template = backendTemplate.get().clone();
         template.getOptions().runScript(initialCredentialsBuilder.build());
         return backendComputeService.get().createNodesInGroup(poolGroupName, number, template);
      } catch (RunNodesException e) {
         throw Throwables.propagate(e);
      }
   }
View Full Code Here


      });
   }

   @Test
   public void testDefaultTemplateBuilder() throws IOException {
      Template defaultTemplate = view.getComputeService().templateBuilder().build();
      assert (defaultTemplate.getImage().getProviderId().startsWith("qmi-")) : defaultTemplate;
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
      assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
      assertEquals(defaultTemplate.getHardware().getId(), "t1.nano");
      assertEquals(defaultTemplate.getLocation().getId(), "is-1");
      assertEquals(defaultTemplate.getLocation().getScope(), LocationScope.REGION);
      assertEquals(AWSUtils.getRegionFromLocationOrNull(defaultTemplate.getLocation()), "is-1");
      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
   }
View Full Code Here

   @Override
   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()) {
View Full Code Here

      };
   }

   @Override
   public void testDefaultTemplateBuilder() throws IOException {
      Template defaultTemplate = view.getComputeService().templateBuilder().build();
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5");
      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.RHEL);
      assertEquals(defaultTemplate.getLocation().getScope(), LocationScope.NETWORK);
      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
   }
View Full Code Here

      });
   }

   @Test
   public void testTemplateBuilderSmartOS() throws IOException {
      Template smartTemplate = view.getComputeService().templateBuilder().osFamily(SMARTOS).build();
      assertEquals(smartTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(smartTemplate.getImage().getOperatingSystem().getVersion(), "1.6.3");
      assertEquals(smartTemplate.getImage().getOperatingSystem().getFamily(), SMARTOS);
      assertEquals(smartTemplate.getImage().getName(), "smartos");
      assertEquals(smartTemplate.getImage().getDefaultCredentials().getUser(), "root");
      assertEquals(smartTemplate.getLocation().getId(), "us-east-1");
      assertEquals(smartTemplate.getImage().getLocation().getId(), "us-east-1");
      assertEquals(smartTemplate.getHardware().getLocation().getId(), "us-east-1");
   }
View Full Code Here

      super.setupContext();
      view.utils().injector().injectMembers(this);
     
      // try and get a master from the cache, this will initialize the config/download isos and
      // prepare everything IF a master is not available, subsequent calls should be pretty fast
      Template template = view.getComputeService().templateBuilder().build();
      checkNotNull(mastersCache.apply(template.getImage()));

      masterName = VIRTUALBOX_IMAGE_PREFIX + template.getImage().getId();
      isosDir = workingDir + File.separator + "isos";

      hostVersion = Iterables.get(Splitter.on('-').split(view.utils().injector().getInstance(Key.get(String.class, BuildVersion.class))), 0);
      operatingSystemIso = String.format("%s/%s.iso", isosDir, template.getImage().getName());
      guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion);
      keystrokeSequence = "";
      try {
         keystrokeSequence = Strings2.toStringAndClose(getClass().getResourceAsStream("/default-keystroke-sequence"));
      } catch (IOException e) {
View Full Code Here

   }

   @Test
   @Override
   public void testDefaultTemplateBuilder() {
      Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "12.04");
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), UBUNTU);
      assertEquals(defaultTemplate.getImage().getName(), "ubuntu-12.04");
      assertEquals(defaultTemplate.getImage().getDefaultCredentials().getUser(), "root");
      assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
      assertEquals(defaultTemplate.getImage().getLocation().getId(), "us-east-1");
      assertEquals(defaultTemplate.getHardware().getLocation().getId(), "us-east-1");
   }
View Full Code Here

      provider = "smartos-ssh";
   }

   @Test
   public void testTemplateBuilder() {
      Template defaultTemplate = client.templateBuilder().build();
      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.3");
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
      assertEquals(defaultTemplate.getLocation().getId(), "1");
      assertEquals(getCores(defaultTemplate.getHardware()), 0.5d);
   }
View Full Code Here

      properties.setProperty("oauth.identity", "MOMMA");
      properties.setProperty("oauth.credential", "MiA");

      ComputeService client = requestsSendResponses(ImmutableMap.<HttpRequest, HttpResponse>of(), createModule(),
              properties);
      Template template = client.templateBuilder().build();
      Template toMatch = client.templateBuilder().imageId(template.getImage().getId()).build();
      assertEquals(toMatch.getImage(), template.getImage());
   }
View Full Code Here

              .put(LIST_GOOGLE_IMAGES_REQUEST, LIST_GOOGLE_IMAGES_RESPONSE)
              .put(LIST_MACHINE_TYPES_REQUEST, LIST_MACHINE_TYPES_RESPONSE)
              .build();

      ComputeService client = requestsSendResponses(requestResponseMap);
      Template template = client.templateBuilder().build();
      Template toMatch = client.templateBuilder().imageId(template.getImage().getId()).build();
      assertEquals(toMatch.getImage(), template.getImage());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.Template

Copyright © 2018 www.massapicom. 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.