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

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


   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

         Thread.sleep(30000);
      }

      blockUntilServerInState(testServerId, serverApi, Status.ACTIVE);

      Image backupImage = imageApi.get(backupImageId);
      assertEquals(backupImage.getId(), backupImageId);
   }
View Full Code Here

public class ImageToOperatingSystemTest {

   @Test(dataProvider = "getOsFamilyValues")
   public void testOsFamilyValues(OsFamily family) {

      Image imageToConvert = Image.builder().id("id-" + family.name()).name(family.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(), family);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), null);
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

   @Test
   public void testWindowsServer2008R2x64() {
      String name = "Windows Server 2008 R2 x64";

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

      Map<OsFamily, Map<String, String>> osFamilyMap = Maps.newHashMap();
      osFamilyMap.put(OsFamily.WINDOWS, ImmutableMap.of("Server 2008 R2", "Server-2008-R2"));

      ImageToOperatingSystem converter = new ImageToOperatingSystem(osFamilyMap);

      OperatingSystem convertedOs = converter.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.WINDOWS);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), "Server-2008-R2");
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

   @Test
   public void testWindows98x86() {
      String name = "Windows 98 x86";

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

      Map<OsFamily, Map<String, String>> osFamilyMap = Maps.newHashMap();
      osFamilyMap.put(OsFamily.WINDOWS, ImmutableMap.of("98", "98"));

      ImageToOperatingSystem converter = new ImageToOperatingSystem(osFamilyMap);

      OperatingSystem convertedOs = converter.apply(imageToConvert);

      assertEquals(convertedOs.getName(), imageToConvert.getName());
      assertEquals(convertedOs.getFamily(), OsFamily.WINDOWS);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), "98");
      assertEquals(convertedOs.getArch(), null);
      assertFalse(convertedOs.is64Bit());
   }
View Full Code Here

   @Test
   public void testRHEL() {
      String name = "Red Hat 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.RHEL);
      assertEquals(convertedOs.getDescription(), imageToConvert.getName());
      assertEquals(convertedOs.getVersion(), null);
      assertEquals(convertedOs.getArch(), null);
      assertTrue(convertedOs.is64Bit());
   }
View Full Code Here

TOP

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

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.