Package org.jclouds.ec2.domain

Examples of org.jclouds.ec2.domain.Image


   }

   @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

            .<String, Location> of("az-1.region-a.geo-1", region));

   @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);
      ImageInRegionToImage converter = new ImageInRegionToImage(NovaComputeServiceContextModule.toPortableImageStatus,
               constant(operatingSystem), locationIndex);

      ImageInRegion novaImageInRegionToConvert = new ImageInRegion(novaImageToConvert, "az-1.region-a.geo-1");

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

      assertEquals(convertedImage.getId(), novaImageInRegionToConvert.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);
      ImageInRegionToImage converter = new ImageInRegionToImage(NovaComputeServiceContextModule.toPortableImageStatus,
               constant(operatingSystem), locationIndex);
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

   @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

TOP

Related Classes of org.jclouds.ec2.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.