Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Template


   }

   @Test
   public void testAmazonLinuxInstanceStore() throws IOException {

      Template defaultTemplate = view.getComputeService().templateBuilder().osFamily(OsFamily.AMZN_LINUX)
            .imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).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"), "instance-store");
      assertEquals(defaultTemplate.getLocation().getId(), "us-east-1");
      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
      assertEquals(defaultTemplate.getImage().getOperatingSystem().getArch(), "paravirtual");
   }
View Full Code Here


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

   @Test
   public void testFastestTemplateBuilder() throws IOException {
      Template fastestTemplate = view.getComputeService().templateBuilder().fastest().osFamily(OsFamily.AMZN_LINUX)
            .build();
      assert (fastestTemplate.getImage().getProviderId().startsWith("ami-")) : fastestTemplate;
      assertEquals(fastestTemplate.getHardware().getProviderId(), InstanceType.CC2_8XLARGE);
      assertEquals(fastestTemplate.getImage().getOperatingSystem().getVersion(), "2011.09.2");
      assertEquals(fastestTemplate.getImage().getOperatingSystem().is64Bit(), true);
      assertEquals(fastestTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
      assertEquals(fastestTemplate.getImage().getUserMetadata().get("rootDeviceType"), "ebs");
      assertEquals(fastestTemplate.getLocation().getId(), "us-east-1");
      assertEquals(getCores(fastestTemplate.getHardware()), 16.0d);
      assertEquals(fastestTemplate.getImage().getOperatingSystem().getArch(), "hvm");
   }
View Full Code Here

   }

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

         context = createView(overrides, setupModules());

         assertEquals(context.getComputeService().listImages().size(), 0);

         Template template = context.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build();
         System.out.println(template.getHardware());
         assert (template.getImage().getProviderId().startsWith("ami-")) : template;
         assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4");
         assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
         assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
         assertEquals(template.getImage().getVersion(), "4.4.10");
         assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
         assertEquals(template.getLocation().getId(), "us-east-1");
         assertEquals(getCores(template.getHardware()), 1.0d);
         assertEquals(template.getHardware().getId(), "m1.small");

         // ensure we cache the new image for next time
         assertEquals(context.getComputeService().listImages().size(), 1);

      } finally {
View Full Code Here

         context = createView(overrides, setupModules());

         assertEquals(context.getComputeService().listImages().size(), 0);

         Template template = context.getComputeService().templateBuilder().imageId("us-east-1/ami-ccb35ea5").build();
         System.out.println(template.getHardware());
         assert (template.getImage().getProviderId().startsWith("ami-")) : template;
         assertEquals(template.getImage().getOperatingSystem().getVersion(), "5.4");
         assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
         assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
         assertEquals(template.getImage().getVersion(), "4.4.10");
         assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
         assertEquals(template.getLocation().getId(), "us-east-1");
         assertEquals(getCores(template.getHardware()), 1.0d);
         assertEquals(template.getHardware().getId(), "m1.small");

         // ensure we cache the new image for next time
         assertEquals(context.getComputeService().listImages().size(), 1);

      } finally {
View Full Code Here

         assertOnlyOneRegionQueriedForAvailabilityZone(commandsInvoked);

         assert context.getComputeService().listImages().size() < this.view.getComputeService().listImages().size();

         Template template = context.getComputeService().templateBuilder().imageId("eu-west-1/ami-a33b06d7").build();
         assert (template.getImage().getProviderId().startsWith("ami-")) : template;
         assertEquals(template.getImage().getOperatingSystem().getVersion(), "2011.09.2");
         assertEquals(template.getImage().getOperatingSystem().is64Bit(), true);
         assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.AMZN_LINUX);
         assertEquals(template.getImage().getVersion(), "2011.09.2");
         assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
         assertEquals(template.getLocation().getId(), "eu-west-1");
         assertEquals(getCores(template.getHardware()), 1.0d);
         assertEquals(template.getHardware().getId(), "m1.small");

      } finally {
         if (context != null)
            context.close();
      }
View Full Code Here

   @Test
   public void testTemplateBuilderCanUseImageIdFromNonDefaultOwner() {
      // This is the id of a public image, not owned by one of the four default
      // owners
      String imageId = "us-east-1/ami-44d02f2d";
      Template defaultTemplate = view.getComputeService().templateBuilder().imageId(imageId)
            .imageMatches(EC2ImagePredicates.rootDeviceType(RootDeviceType.INSTANCE_STORE)).build();
      assert (defaultTemplate.getImage().getProviderId().startsWith("ami-")) : defaultTemplate;
      assertEquals(defaultTemplate.getImage().getId(), imageId);
   }
View Full Code Here

    }

    TemplateBuilder templateBuilder = computeService.templateBuilder().from(
        instanceTemplate.getTemplate() != null ? instanceTemplate.getTemplate() :
        clusterSpec.getTemplate());
    Template template = templateBuilder.build();
    template.getOptions().runScript(bootstrap);
    return setSpotInstancePriceIfSpecified(
      computeService.getContext(), clusterSpec, template, instanceTemplate
    );
  }
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_MACHINE_TYPES_REQUEST, LIST_MACHINE_TYPES_RESPONSE)
              .put(LIST_CENTRAL1B_MACHINE_TYPES_REQUEST, LIST_CENTRAL1B_MACHINE_TYPES_RESPONSE)
              .build();

      ComputeService client = requestsSendResponses(requestResponseMap);
      Template template = client.templateBuilder().build();
      Hardware defaultSize = client.templateBuilder().build().getHardware();

      Hardware smallest = client.templateBuilder().smallest().build().getHardware();
      assertEquals(defaultSize, smallest);

      Hardware fastest = client.templateBuilder().fastest().build().getHardware();
      assertNotNull(fastest);

      assertEquals(client.listHardwareProfiles().size(), 5);

      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.