Examples of ImageBuilder


Examples of org.jclouds.compute.domain.ImageBuilder

      Set<org.jclouds.compute.domain.Image> result = convertImages("/greenqloud_images.xml");
      assertEquals(result.size(), 9);

      assertEquals(
            Iterables.get(result, 0).toString(),
            new ImageBuilder()
                  .operatingSystem(
                        OperatingSystem.builder().family(OsFamily.UBUNTU).version("10.04")
                              .description("Ubuntu Server 10.04 (64-bit)").is64Bit(true)
                              .arch("paravirtual").build())
                  .description("Ubuntu Server 10.04 (64-bit)")
                  .name("Ubuntu Server 10.04.3")
                  .defaultCredentials(LoginCredentials.builder().user("root").build())
                  .id("us-east-1/qmi-4e5b842f")
                  .providerId("qmi-4e5b842f")
                  .location(defaultLocation)
                  .userMetadata(
                        ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                              "paravirtual", "hypervisor", "xen"))
                  .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());
      assertEquals(Iterables.get(result, 0).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);

      assertEquals(
            Iterables.get(result, 1).toString(),
            new ImageBuilder()
                  .operatingSystem(
                        OperatingSystem.builder().family(OsFamily.UBUNTU).version("11.10")
                              .description("Ubuntu Server 11.10 (64-bit)").is64Bit(true)
                              .arch("paravirtual").build())
                  .description("Ubuntu Server 11.10 (64-bit)")
                  .name("Ubuntu Server 11.10")
                  .defaultCredentials(LoginCredentials.builder().user("root").build())
                  .id("us-east-1/qmi-9ac92558")
                  .providerId("qmi-9ac92558")
                  .location(defaultLocation)
                  .userMetadata(
                        ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                              "paravirtual", "hypervisor", "xen"))
                  .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());
      assertEquals(Iterables.get(result, 1).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);
     
      assertEquals(
               Iterables.get(result, 2).toString(),
               new ImageBuilder()
                  .operatingSystem(
                        OperatingSystem.builder().family(OsFamily.CENTOS).version("5.5")
                              .description("CentOS 5.5 Server 64-bit").is64Bit(true)
                              .arch("paravirtual").build())
                  .description("CentOS 5.5 Server 64-bit")
                  .name("CentOS 5.5 Server")
                  .defaultCredentials(LoginCredentials.builder().user("root").build())
                  .id("us-east-1/qmi-33a467aa")
                  .providerId("qmi-33a467aa")
                  .location(defaultLocation)
                  .userMetadata(
                        ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                              "paravirtual", "hypervisor", "xen"))
                  .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());              
         assertEquals(Iterables.get(result, 2).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);
        
         assertEquals(
                  Iterables.get(result, 3).toString(),
                  new ImageBuilder()
                     .operatingSystem(
                           OperatingSystem.builder().family(OsFamily.DEBIAN).version("6.0")
                                 .description("Debian 6.0 (64-bit)").is64Bit(true)
                                 .arch("paravirtual").build())
                     .description("Debian 6.0 (64-bit)")
                     .name("Debian 6.0")
                     .defaultCredentials(LoginCredentials.builder().user("root").build())
                     .id("us-east-1/qmi-f2a9d2ba")
                     .providerId("qmi-f2a9d2ba")
                     .location(defaultLocation)
                     .userMetadata(
                           ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                                 "paravirtual", "hypervisor", "xen"))
                     .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());              
         assertEquals(Iterables.get(result, 3).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);        

         assertEquals(
                  Iterables.get(result, 4).toString(),
                  new ImageBuilder()
                     .operatingSystem(
                           OperatingSystem.builder().family(OsFamily.CENTOS).version("6.0")
                                 .description("CentOS 6.0 (64-bit)").is64Bit(true)
                                 .arch("paravirtual").build())
                     .description("CentOS 6.0 (64-bit)")
                     .name("CentOS 6.0")
                     .defaultCredentials(LoginCredentials.builder().user("root").build())
                     .id("us-east-1/qmi-96f82145")
                     .providerId("qmi-96f82145")
                     .location(defaultLocation)
                     .userMetadata(
                           ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                                 "paravirtual", "hypervisor", "xen"))
                     .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());              
            assertEquals(Iterables.get(result, 4).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);        

            assertEquals(
                     Iterables.get(result, 5).toString(),
                     new ImageBuilder()
                        .operatingSystem(
                              OperatingSystem.builder().family(OsFamily.CENTOS).version("6.0")
                                    .description("CentOS 6.0 GUI (64-bit)").is64Bit(true)
                                    .arch("paravirtual").build())
                        .description("CentOS 6.0 GUI (64-bit)")
                        .name("CentOS 6.0 GUI")
                        .defaultCredentials(LoginCredentials.builder().user("root").build())
                        .id("us-east-1/qmi-42e877f6")
                        .providerId("qmi-42e877f6")
                        .location(defaultLocation)
                        .userMetadata(
                              ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                                    "paravirtual", "hypervisor", "xen"))
                        .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());              
            assertEquals(Iterables.get(result, 5).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);     

            assertEquals(
                     Iterables.get(result, 6).toString(),
                     new ImageBuilder()
                           .operatingSystem(
                                 OperatingSystem.builder().family(OsFamily.UBUNTU).version("11.04")
                                       .description("Ubuntu Server 11.04 (64-bit)").is64Bit(true)
                                       .arch("paravirtual").build())
                           .description("Ubuntu Server 11.04 (64-bit)")
                           .name("Ubuntu Server 11.04")
                           .defaultCredentials(LoginCredentials.builder().user("root").build())
                           .id("us-east-1/qmi-eed8cea7")
                           .providerId("qmi-eed8cea7")
                           .location(defaultLocation)
                           .userMetadata(
                                 ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                                       "paravirtual", "hypervisor", "xen"))
                           .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());
            assertEquals(Iterables.get(result, 6).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);

            assertEquals(
                     Iterables.get(result, 7).toString(),
                     new ImageBuilder()
                        .operatingSystem(
                              // fedora is not in the image version map, yet
                              OperatingSystem.builder().family(OsFamily.FEDORA).version("")
                                    .description("Fedora 16 Server").is64Bit(false)
                                    .arch("paravirtual").build())
                        .description("Fedora 16 Server")
                        .name("Fedora 16 Server")
                        .defaultCredentials(LoginCredentials.builder().user("root").build())
                        .id("us-east-1/qmi-fa4bdae0")
                        .providerId("qmi-fa4bdae0")
                        .location(defaultLocation)
                        .userMetadata(
                              ImmutableMap.of("owner", "admin", "rootDeviceType", "ebs", "virtualizationType",
                                    "paravirtual", "hypervisor", "xen"))
                        .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString());              
            assertEquals(Iterables.get(result, 7).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE);     
          
            assertEquals(
                     Iterables.get(result, 8).toString(),
                     new ImageBuilder()
                        .operatingSystem(
                              OperatingSystem.builder().family(OsFamily.CENTOS).version("5.6")
                                    .description("CentOS 5.6 Server GUI 64-bit").is64Bit(true)
                                    .arch("paravirtual").build())
                        .description("CentOS 5.6 Server GUI 64-bit")
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   @Test
   public void testWhenNoHardwareOrImageMatchImageIdIsStillSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/FOOOOOOOO").providerId("FOOOOOOOO").location(zone)
            .build();
      Image existingImage = new ImageBuilder().id("us-sw-1/FOOOOOOOO")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();

      checkHardwareAndImageStatus(null, existingHardware, "us-sw-1/sdc:sdc:centos-5.7:1.2.1", null, existingImage);
   }
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   @Test
   public void testWhenHardwareAndImageMatchHardwareOperatingSystemAndImageIdAreSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/Small 1GB").providerId("Small 1GB").ram(1024)
            .volume(new VolumeImpl(Float.valueOf(61440), true, true)).location(zone).build();
      Image existingImage = new ImageBuilder().id("us-sw-1/sdc:sdc:centos-5.7:1.2.1")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("sdc:sdc:centos-5.7:1.2.1").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

      checkHardwareAndImageStatus(existingHardware, existingHardware, existingImage.getId(),
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   public Image apply(DatasetInDatacenter datasetInDatacenter) {
      Location location = locationIndex.get().get(datasetInDatacenter.getDatacenter());
      checkState(location != null, "location %s not in locationIndex: %s", datasetInDatacenter.getDatacenter(),
            locationIndex.get());
      Dataset dataset = datasetInDatacenter.get();
      return new ImageBuilder()
            .id(datasetInDatacenter.slashEncode())
            // note that it is urn that is the expected value!
            .providerId(dataset.getUrn())
            .name(dataset.getName())
            .operatingSystem(imageToOs.apply(dataset))
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

public class GoogleComputeEngineImageToImage implements Function<Image, org.jclouds.compute.domain.Image> {


   @Override
   public org.jclouds.compute.domain.Image apply(Image image) {
      ImageBuilder builder = new ImageBuilder()
              .id(image.getName())
              .name(image.getName())
              .providerId(image.getId())
              .description(image.getDescription().orNull())
              .status(Status.AVAILABLE)
              .location(GOOGLE_PROVIDER_LOCATION)
              .uri(image.getSelfLink());

      List<String> splits = Lists.newArrayList(image.getName().split("-"));
      OperatingSystem.Builder osBuilder = defaultOperatingSystem(image);
      if (splits == null || splits.size() == 0 || splits.size() < 3) {
         return builder.operatingSystem(osBuilder.build()).build();
      }

      OsFamily family = OsFamily.fromValue(splits.get(0));
      if (family != OsFamily.UNRECOGNIZED) {
         osBuilder.family(family);
      }

      String version = on(".").join(limit(skip(splits, 1), splits.size() - 2));
      osBuilder.version(version);

      builder.version(getLast(splits));
      return builder.operatingSystem(osBuilder.build()).build();
   }
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   @Test
   public void testWhenNoHardwareOrImageMatchServerScopedIdsImageIdIsStillSet() {

      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/FOOOOOOOO").providerId("FOOOOOOOO")
            .location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/FOOOOOOOO")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();

      checkHardwareAndImageStatus(null, existingHardware, "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54",
            null, existingImage);
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   @Test
   public void testWhenNoHardwareAndImageMatchServerScopedIdsHardwareOperatingSystemAndImageIdAreSet() {

      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

      checkHardwareAndImageStatus(existingHardware, existingHardware, existingImage.getId(),
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

      String instanceId = parts[1];

      String imageId = ec2Client.getAMIServices().createImageInRegion(region, cloneTemplate.getName(), instanceId,
            CreateImageOptions.NONE);

      final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
            .location(find(locations.get(), idEquals(region)))
            .id(region + "/" + imageId)
            .providerId(imageId)
            .description(cloneTemplate.getName())
            .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

      this.toPortableImageStatus=toPortableImageStatus;
      this.imageToOs = imageToOs;
   }
  
   public Image apply(org.jclouds.cloudservers.domain.Image from) {
      ImageBuilder builder = new ImageBuilder();
      builder.ids(from.getId() + "");
      builder.name(from.getName());
      builder.description(from.getName());
      builder.version(from.getUpdated().getTime() + "");
      builder.operatingSystem(imageToOs.apply(from));
      builder.status(toPortableImageStatus.get(from.getStatus()));
      Image image = builder.build();
      return image;
   }
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

      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
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.