Package org.jclouds.openstack.glance.v1_0.domain

Examples of org.jclouds.openstack.glance.v1_0.domain.Image$Builder


   @Test
   public void testOEL() {
      String name = "Oracle EL";

      Image imageToConvert = Image.builder().id("id-" + name).name(name).build();

      ImageToOperatingSystem converter = new ImageToOperatingSystem(
            new HashMap<OsFamily, Map<String, String>>());

      OperatingSystem convertedOs = converter.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.OEL);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), null);
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here


   @Test
   public void testTryStackOneric() {
     
      String name = "oneiric-server-cloudimg-amd64";

      Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
     
      OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), "11.10");
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

   @Test
   public void testTryStackNatty() {
     
      String name = "natty-server-cloudimg-amd64";

      Image imageToConvert = Image.builder().id("id-" + name).name(name).build();
     
      OperatingSystem convertedOs = converterForUbuntu.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.UBUNTU);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), "11.04");
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

   public void testGetImageById() throws Exception {
      for (String zoneId : api.getConfiguredZones()) {
         ImageApi imageApi = api.getImageApiForZone(zoneId);
         Set<? extends Image> response = imageApi.listInDetail().concat().toSet();
         for (Image image : response) {
            Image details = imageApi.get(image.getId());
            assertNotNull(details);
            assertEquals(details.getId(), image.getId());
            assertEquals(details.getName(), image.getName());
            assertEquals(details.getLinks(), image.getLinks());
            assertEquals(details.getCreated(), image.getCreated());
            assertEquals(details.getMinDisk(), image.getMinDisk());
            assertEquals(details.getMinRam(), image.getMinRam());
            assertEquals(details.getProgress(), image.getProgress());
            assertEquals(details.getStatus(), image.getStatus());
            assertEquals(details.getServer(), image.getServer());
            assertEquals(details.getTenantId(), image.getTenantId());
            assertEquals(details.getUpdated(), image.getUpdated());
            assertEquals(details.getUserId(), image.getUserId());
         }
      }
   }
View Full Code Here

            .<String, Location> of("az-1.region-a.geo-1", zone));
  
   @Test
   public void testConversionWhereLocationFound() {
      UUID id = UUID.randomUUID();
      Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).status(Image.Status.DELETED).build();
      OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
               "My Test OS", true);
      ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
               constant(operatingSystem), locationIndex);

      ImageInZone novaImageInZoneToConvert = new ImageInZone(novaImageToConvert, "az-1.region-a.geo-1");

      org.jclouds.compute.domain.Image convertedImage = converter.apply(novaImageInZoneToConvert);

      assertEquals(convertedImage.getId(), novaImageInZoneToConvert.slashEncode());
      assertEquals(convertedImage.getProviderId(), novaImageToConvert.getId());
      assertEquals(convertedImage.getLocation(), locationIndex.get().get("az-1.region-a.geo-1"));

      assertEquals(convertedImage.getName(), novaImageToConvert.getName());
      assertEquals(convertedImage.getStatus(), org.jclouds.compute.domain.Image.Status.DELETED);
      assertEquals(convertedImage.getOperatingSystem(), operatingSystem);
   }
View Full Code Here

   }

   @Test(expectedExceptions = IllegalStateException.class)
   public void testConversionWhereLocationNotFound() {
      UUID id = UUID.randomUUID();
      Image novaImageToConvert = Image.builder().id(id.toString()).name("Test Image " + id).build();
      OperatingSystem operatingSystem = new OperatingSystem(OsFamily.UBUNTU, "My Test OS", "My Test Version", "x86",
               "My Test OS", true);
      ImageInZoneToImage converter = new ImageInZoneToImage(NovaComputeServiceContextModule.toPortableImageStatus,
               constant(operatingSystem), locationIndex);
View Full Code Here

   }

   @Override
   public ImageInZone getImage(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      Image image = novaApi.getImageApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
      return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
   }
View Full Code Here

   }

   @Override
   public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family,
            OperatingSystem.Builder osBuilder) {
      Image image = Image.builder().id(from.getId()).name(from.getName()).build();
      OperatingSystem os = imageToOs.apply(image);
      osBuilder.description(os.getDescription());
      osBuilder.family(os.getFamily());
      osBuilder.name(os.getName());
      osBuilder.is64Bit(os.is64Bit());
View Full Code Here

   }

   @Override
   public ImageInRegion getImage(String id) {
      RegionAndId regionAndId = RegionAndId.fromSlashEncoded(id);
      Image image = novaApi.getImageApi(regionAndId.getRegion()).get(regionAndId.getId());
      return image == null ? null : new ImageInRegion(image, regionAndId.getRegion());
   }
View Full Code Here

   public void testGetImageById() throws Exception {
      for (String regionId : api.getConfiguredRegions()) {
         ImageApi imageApi = api.getImageApi(regionId);
         Set<? extends Image> response = imageApi.listInDetail().concat().toSet();
         for (Image image : response) {
            Image details = imageApi.get(image.getId());
            assertNotNull(details);
            assertEquals(details.getId(), image.getId());
            assertEquals(details.getName(), image.getName());
            assertEquals(details.getLinks(), image.getLinks());
            assertEquals(details.getCreated(), image.getCreated());
            assertEquals(details.getMinDisk(), image.getMinDisk());
            assertEquals(details.getMinRam(), image.getMinRam());
            assertEquals(details.getProgress(), image.getProgress());
            assertEquals(details.getStatus(), image.getStatus());
            assertEquals(details.getServer(), image.getServer());
            assertEquals(details.getTenantId(), image.getTenantId());
            assertEquals(details.getUpdated(), image.getUpdated());
            assertEquals(details.getUserId(), image.getUserId());
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.glance.v1_0.domain.Image$Builder

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.