Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.ImageBuilder


        ReviseParsedImage rpi = new AWSEC2ReviseParsedImage(osVersionMap);

        Image from = newImage("amazon", "Windows-2008R2-SP1-English-Base-2012.01.12");
        OperatingSystem.Builder osBuilder = OperatingSystem.builder().description("test");
        ImageBuilder builder = new ImageBuilder().id("1").operatingSystem(osBuilder.build()).status(
                 org.jclouds.compute.domain.Image.Status.AVAILABLE).description("test");
        OsFamily family = OsFamily.WINDOWS;

        rpi.reviseParsedImage(from, builder, family, osBuilder);
        OperatingSystem os = osBuilder.build();
        assertEquals(os.getFamily(), OsFamily.WINDOWS);
        assertEquals(os.getVersion(), "2008");
        assertEquals(builder.build().getVersion(), "2012.01.12");
    }
View Full Code Here


      Set<org.jclouds.compute.domain.Image> result = convertImages("/alestic_canonical.xml");

      assertEquals(
            Iterables.get(result, 0),
            new ImageBuilder()
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04")
                              .description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml")
                              .is64Bit(false).build())
                  .description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml")
                  .defaultCredentials(LoginCredentials.builder().user("ubuntu").build()).id("us-east-1/ami-7e28ca17")
                  .providerId("ami-7e28ca17").location(defaultLocation).version("20091130")
                  .userMetadata(ImmutableMap.of(
                     "owner", "099720109477",
                     "rootDeviceType", "instance-store",
                     "virtualizationType", "paravirtual",
                     "hypervisor", "xen"))
                  .status(org.jclouds.compute.domain.Image.Status.AVAILABLE)
                  .backendStatus("available")
                  .build());
      assertEquals(Iterables.get(result, 0).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);

      assertEquals(
            Iterables.get(result, 4),
            new ImageBuilder()
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04")
                              .description("alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml").is64Bit(false)
                              .build()).description("alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml")
                  .defaultCredentials(LoginCredentials.builder().user("ubuntu").build()).id("us-east-1/ami-c0fa1ea9")
                  .providerId("ami-c0fa1ea9").location(defaultLocation).version("20080905")
                  .userMetadata(ImmutableMap.of("owner", "063491364108", "rootDeviceType", "instance-store"))
                  .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build());
      assertEquals(Iterables.get(result, 4).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);

      assertEquals(
            Iterables.get(result, 6),
            new ImageBuilder()
                  .name("ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827")
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("10.04")
                              .description("099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827")
                              .is64Bit(false).build())
View Full Code Here

      Set<org.jclouds.compute.domain.Image> result = convertImages("/vostok.xml");

      assertEquals(
            Iterables.get(result, 0),
            new ImageBuilder()
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("")
                              .description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml")
                              .is64Bit(false).build())
                  .description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml")
View Full Code Here

      Set<org.jclouds.compute.domain.Image> result = convertImages("/describe_images_cc.xml");

      assertEquals(
            Iterables.get(result, 0),
            new ImageBuilder()
                  .name("EC2 CentOS 5.4 HVM AMI")
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("hvm").version("5.4")
                              .description("amazon/EC2 CentOS 5.4 HVM AMI").is64Bit(true).build())
                  .description("EC2 CentOS 5.4 HVM AMI")
View Full Code Here

      Set<org.jclouds.compute.domain.Image> result = convertImages("/rightscale_images.xml");

      assertEquals(
            Iterables.get(result, 0),
            new ImageBuilder()
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("paravirtual").version("5.4")
                              .description("rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml").is64Bit(true)
                              .build()).description("rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml")
                  .defaultCredentials(LoginCredentials.builder().user("root").build()).id("us-east-1/ami-ccb35ea5")
View Full Code Here

      Set<org.jclouds.compute.domain.Image> result = convertImages("/amzn_images.xml");

      assertEquals(
            Iterables.get(result, 0),
            new ImageBuilder()
                  .name("amzn-ami-0.9.7-beta.i386-ebs")
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.AMZN_LINUX).arch("paravirtual")
                              .version("0.9.7-beta").description("137112412989/amzn-ami-0.9.7-beta.i386-ebs")
                              .is64Bit(false).build()).description("Amazon")
                  .defaultCredentials(LoginCredentials.builder().user("ec2-user").build()).id("us-east-1/ami-82e4b5c7")
                  .providerId("ami-82e4b5c7").location(defaultLocation).version("0.9.7-beta")
                  .userMetadata(ImmutableMap.of(
                     "owner", "137112412989",
                     "rootDeviceType", "ebs",
                     "virtualizationType", "paravirtual",
                     "hypervisor", "xen"))
                  .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).build());
      assertEquals(Iterables.get(result, 0).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);

      assertEquals(
            Iterables.get(result, 3),
            new ImageBuilder()
                  .name("amzn-ami-0.9.7-beta.x86_64-S3")
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.AMZN_LINUX).arch("paravirtual")
                              .version("0.9.7-beta")
                              .description("amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true)
View Full Code Here

   @Override
   public Image apply(VAppTemplate from) {
      checkNotNull(from, "VAppTemplate");
      Envelope ovf = templateToEnvelope.apply(from);

      ImageBuilder builder = new ImageBuilder();
      builder.ids(from.getHref().toASCIIString());
      builder.uri(from.getHref());
      builder.name(from.getName());
      if (from.getVDC() != null) {
         builder.location(findLocationForResource.apply(from.getVDC()));
      } else {
         // otherwise, it could be in a public catalog, which is not assigned to a VDC
      }
      builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
      builder.operatingSystem(CIMOperatingSystem.toComputeOs(ovf));
      builder.status(toPortableImageStatus.get(from.getStatus()));
      return builder.build();
   }
View Full Code Here

      int id = 1;
      for (boolean is64Bit : new boolean[] { true, false })
         for (Entry<OsFamily, Map<String, String>> osVersions : this.osToVersionMap.entrySet()) {
            for (String version : ImmutableSet.copyOf(osVersions.getValue().values())) {
               String desc = String.format("stub %s %s", osVersions.getKey(), is64Bit);
               images.add(new ImageBuilder().ids(id++ + "").name(osVersions.getKey().name()).location(location.get())
                     .operatingSystem(new OperatingSystem(osVersions.getKey(), desc, version, null, desc, is64Bit))
                     .description(desc).status(Image.Status.AVAILABLE).build());
            }
         }
      return images.build();
View Full Code Here

      Set<? extends Image> currentImages = compute.listImages();
      assertEquals(compute.listImages().size(), 1);
      Image onlyImage = Iterables.get(currentImages, 0);
     
     
      Image expectedImage = new ImageBuilder()
               .ids(ENDPOINT + "/v1.0/vAppTemplate/" + templateId)
               .uri(URI.create(ENDPOINT + "/v1.0/vAppTemplate/" + templateId))
               .name("UbuntuServer-x64-2GB")
               .operatingSystem(new CIMOperatingSystem(OSType.UBUNTU_64, "", null, "Ubuntu Linux (64-bit)"))
               // TODO: this looks like a bug, as it says network interfaces
View Full Code Here

public class CloudServersImageToImageTest {

   @Test
   public void test() {
      Image toTest = convertImage();
      assertEquals(toTest, new ImageBuilder().name("CentOS 5.2").operatingSystem(
               new OperatingSystem.Builder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2").is64Bit(
                        true).build()).description("CentOS 5.2").ids("2").status(Image.Status.PENDING).version(
               "1286712000000").build());
      assertEquals(toTest.getStatus(), Image.Status.PENDING);
   }
View Full Code Here

TOP

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

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.