Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Template


            .build();

      Injector forKeyPair = requestsSendResponses(requestResponseMap);

      String privKey = Strings2.toStringAndClose(getClass().getResourceAsStream("/test"));
      Template template = forKeyPair.getInstance(TemplateBuilder.class)
         .osFamily(OsFamily.CENTOS)
         .locationId("2")
         .build();
      template.getOptions().as(CloudStackTemplateOptions.class).keyPair("mykeypair")
         .setupStaticNat(false)
         .overrideLoginPrivateKey(privKey);

      CloudStackComputeServiceAdapter adapter = forKeyPair.getInstance(CloudStackComputeServiceAdapter.class);
View Full Code Here


    *
    * 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());
   }
View Full Code Here

      assertEquals(m2_xlarge().build().getId(), template.getHardware().getId());
   }

   @Test
   public void testTemplateChoiceForInstanceByCChardwareId() throws Exception {
      Template template = newTemplateBuilder().fastest().build();

      assert template != null : "The returned template was null, but it should have a value.";
      assert CC1_4XLARGE.equals(template.getHardware()) : format(
               "Incorrect image determined by the template. Expected: %s. Found: %s.", CC1_4XLARGE.getId(), template
                        .getHardware().getId());
   }
View Full Code Here

    *
    * 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");
   }
View Full Code Here

    *
    * 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());
   }
View Full Code Here

                        .getHardware().getId());
   }

   @Test
   public void testTemplateChoiceForInstanceByImageId() throws Exception {
      Template template = newTemplateBuilder().imageId("us-east-1/cc-image").build();

      assert template != null : "The returned template was null, but it should have a value.";
      assertEquals(template.getImage().getId(), "us-east-1/cc-image");
   }
View Full Code Here

     
      // weird compilation error means have to declare extra generics for call to build() - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818
      Supplier<LoadingCache<RegionAndName, ? extends Image>> imageCache = Suppliers.<LoadingCache<RegionAndName, ? extends Image>> ofInstance(
               CacheBuilder.newBuilder().<RegionAndName,Image>build(CacheLoader.from(Functions.forMap(imageMap))));

      Template template = newTemplateBuilder(images, imageCache).imageId("us-east-1/cc-image").build();

      assert template != null : "The returned template was null, but it should have a value.";
      assertEquals(template.getImage().getId(), "us-east-1/cc-image");
   }
View Full Code Here

public abstract class EC2TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
  
   @Test
   public void testTemplateBuilderCanUseImageIdWithoutFetchingAllImages() throws Exception {
      Template defaultTemplate = view.getComputeService().templateBuilder().build();
      String defaultImageId = defaultTemplate.getImage().getId();
      String defaultImageProviderId = defaultTemplate.getImage().getProviderId();

      ComputeServiceContext context = null;
      try {
         // Track http commands
         final List<HttpCommand> commandsInvoked = Lists.newArrayList();
         context = createView(
               setupProperties(),
               ImmutableSet.<Module> of(new Log4JLoggingModule(),
                     TrackingJavaUrlHttpCommandExecutorService.newTrackingModule(commandsInvoked)));
        
         Template template = context.getComputeService().templateBuilder().imageId(defaultImageId)
                  .build();
         assertEquals(template.getImage(), defaultTemplate.getImage());

         Collection<HttpCommand> filteredCommandsInvoked = Collections2.filter(commandsInvoked, new Predicate<HttpCommand>() {
            private final Collection<Method> ignored = ImmutableSet.of(
                     AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeRegions", DescribeRegionsOptions[].class),
                     AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeAvailabilityZonesInRegion", String.class, DescribeAvailabilityZonesOptions[].class));
View Full Code Here

   @Test
   public void testWindowsAdminWorks() throws Exception {
      String group = "winadm";
      // Spin up a new node. Make sure to open the RDP port 3389
      Template template = view.getComputeService().templateBuilder().from(windowsTemplate).options(inboundPorts(3389))
               .build();
      try {
         NodeMetadata node = Iterables.getOnlyElement(view.getComputeService().createNodesInGroup(group, 1, template));
         assertEquals(node.getCredentials().getUser(), "Administrator");
         assertFalse(Strings.isNullOrEmpty(node.getCredentials().getPassword()));
View Full Code Here

      assertEquals(template.getImage().getOperatingSystem().getArch(), "paravirtual");
   }

   @Test
   public void testDefaultTemplateBuilder() throws IOException {
      Template defaultTemplate = view.getComputeService().templateBuilder().build();
      assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "pv-2012.09.rc-1");
      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
      assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
      assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getArch(), "paravirtual");
   }
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.