Package org.jclouds.openstack.glance.v1_0.features

Examples of org.jclouds.openstack.glance.v1_0.features.ImageApi


         details = imageApi.upload(details.getId(), imageData, UpdateImageOptions.Builder.name("jclouds-live-res-test2"), UpdateImageOptions.Builder.minDisk(10));
         assertEquals(details.getName(), "jclouds-live-res-test2");
         assertEquals(details.getSize().get().longValue(), imageData.getRawContent().length());
         assertEquals(details.getMinDisk(), 10);

         Image fromListing = Iterables.getOnlyElement(imageApi.list(ListImageOptions.Builder.name("jclouds-live-res-test2").limit(2).containerFormat(ContainerFormat.BARE)));
         assertEquals(fromListing.getId(), details.getId());
         assertEquals(fromListing.getSize(), details.getSize());

         assertEquals(Iterables.getOnlyElement(imageApi.listInDetail(ListImageOptions.Builder.name("jclouds-live-res-test2"))), details);

         assertTrue(imageApi.delete(details.getId()));
View Full Code Here


        
         details = imageApi.update(details.getId(), UpdateImageOptions.Builder.name("jclouds-live-test2"), UpdateImageOptions.Builder.minDisk(10));
         assertEquals(details.getName(), "jclouds-live-test2");
         assertEquals(details.getMinDisk(), 10);
        
         Image fromListing = imageApi.list(
                  ListImageOptions.Builder.containerFormat(ContainerFormat.BARE).name("jclouds-live-test2").limit(2))
                  .get(0);
         assertEquals(fromListing.getId(), details.getId());
         assertEquals(fromListing.getSize(), details.getSize());

         assertEquals(Iterables.getOnlyElement(imageApi.listInDetail(ListImageOptions.Builder.name("jclouds-live-test2"))), details);

         assertTrue(imageApi.delete(details.getId()));
        
View Full Code Here

         details = imageApi.upload(details.getId(), imageData, UpdateImageOptions.Builder.name("jclouds-live-res-test2"), UpdateImageOptions.Builder.minDisk(10));
         assertEquals(details.getName(), "jclouds-live-res-test2");
         assertEquals(details.getSize().get().longValue(), imageData.getRawContent().length());
         assertEquals(details.getMinDisk(), 10);

         Image fromListing = Iterables.getOnlyElement(imageApi.list(ListImageOptions.Builder.name("jclouds-live-res-test2").limit(2).containerFormat(ContainerFormat.BARE)));
         assertEquals(fromListing.getId(), details.getId());
         assertEquals(fromListing.getSize(), details.getSize());

         assertEquals(Iterables.getOnlyElement(imageApi.listInDetail(ListImageOptions.Builder.name("jclouds-live-res-test2"))), details);

         assertTrue(imageApi.delete(details.getId()));
View Full Code Here

         ImageApi imageApi = api.getImageApiForZone(zoneId);
         Set<? extends ImageDetails> response = imageApi.listInDetail().concat().toSet();
         assert null != response;
         for (ImageDetails image : response) {
            checkImage(image);
            ImageDetails newDetails = imageApi.get(image.getId());
            checkImageDetails(newDetails);
            checkImageDetailsEqual(image, newDetails);
         }
      }
   }
View Full Code Here

   @Test
   public void testCreateUpdateAndDeleteImage() {
      StringPayload imageData = new StringPayload("This isn't really an image!");
      for (String zoneId : api.getConfiguredZones()) {
         ImageApi imageApi = api.getImageApiForZone(zoneId);
         ImageDetails details = imageApi.create("jclouds-live-test", imageData, diskFormat(DiskFormat.RAW), containerFormat(ContainerFormat.BARE));
         assertEquals(details.getName(), "jclouds-live-test");
         assertEquals(details.getSize().get().longValue(), imageData.getRawContent().length());
        
         details = imageApi.update(details.getId(), UpdateImageOptions.Builder.name("jclouds-live-test2"), UpdateImageOptions.Builder.minDisk(10));
         assertEquals(details.getName(), "jclouds-live-test2");
         assertEquals(details.getMinDisk(), 10);
        
         Image fromListing = imageApi.list(
                  ListImageOptions.Builder.containerFormat(ContainerFormat.BARE).name("jclouds-live-test2").limit(2))
                  .get(0);
         assertEquals(fromListing.getId(), details.getId());
         assertEquals(fromListing.getSize(), details.getSize());

         assertEquals(Iterables.getOnlyElement(imageApi.listInDetail(ListImageOptions.Builder.name("jclouds-live-test2"))), details);

         assertTrue(imageApi.delete(details.getId()));
        
         assertTrue(imageApi.list(ListImageOptions.Builder.name("jclouds-live-test2")).isEmpty());
      }
   }
View Full Code Here

   @Test
   public void testReserveUploadAndDeleteImage() {
      StringPayload imageData = new StringPayload("This isn't an image!");
      for (String zoneId : api.getConfiguredZones()) {
         ImageApi imageApi = api.getImageApiForZone(zoneId);
         ImageDetails details = imageApi.reserve("jclouds-live-res-test", diskFormat(DiskFormat.RAW), containerFormat(ContainerFormat.BARE));
         assertEquals(details.getName(), "jclouds-live-res-test");
         details = imageApi.upload(details.getId(), imageData, UpdateImageOptions.Builder.name("jclouds-live-res-test2"), UpdateImageOptions.Builder.minDisk(10));
         assertEquals(details.getName(), "jclouds-live-res-test2");
         assertEquals(details.getSize().get().longValue(), imageData.getRawContent().length());
         assertEquals(details.getMinDisk(), 10);

         Image fromListing = Iterables.getOnlyElement(imageApi.list(ListImageOptions.Builder.name("jclouds-live-res-test2").limit(2).containerFormat(ContainerFormat.BARE)));
         assertEquals(fromListing.getId(), details.getId());
         assertEquals(fromListing.getSize(), details.getSize());

         assertEquals(Iterables.getOnlyElement(imageApi.listInDetail(ListImageOptions.Builder.name("jclouds-live-res-test2"))), details);

         assertTrue(imageApi.delete(details.getId()));

         assertTrue(imageApi.list(ListImageOptions.Builder.name("jclouds-live-res-test2")).isEmpty());
      }
   }
View Full Code Here

         ImageApi imageApi = api.getImageApiForZone(zoneId);
         Set<? extends ImageDetails> response = imageApi.listInDetail().concat().toSet();
         assert null != response;
         for (ImageDetails image : response) {
            checkImage(image);
            ImageDetails newDetails = imageApi.get(image.getId());
            checkImageDetails(newDetails);
            checkImageDetailsEqual(image, newDetails);
         }
      }
   }
View Full Code Here

   @Test
   public void testCreateUpdateAndDeleteImage() {
      StringPayload imageData = new StringPayload("This isn't really an image!");
      for (String zoneId : api.getConfiguredZones()) {
         ImageApi imageApi = api.getImageApiForZone(zoneId);
         ImageDetails details = imageApi.create("jclouds-live-test", imageData, diskFormat(DiskFormat.RAW), containerFormat(ContainerFormat.BARE));
         assertEquals(details.getName(), "jclouds-live-test");
         assertEquals(details.getSize().get().longValue(), imageData.getRawContent().length());
        
         details = imageApi.update(details.getId(), UpdateImageOptions.Builder.name("jclouds-live-test2"), UpdateImageOptions.Builder.minDisk(10));
         assertEquals(details.getName(), "jclouds-live-test2");
         assertEquals(details.getMinDisk(), 10);
        
         Image fromListing = imageApi.list(
                  ListImageOptions.Builder.containerFormat(ContainerFormat.BARE).name("jclouds-live-test2").limit(2))
                  .get(0);
         assertEquals(fromListing.getId(), details.getId());
         assertEquals(fromListing.getSize(), details.getSize());

         assertEquals(Iterables.getOnlyElement(imageApi.listInDetail(ListImageOptions.Builder.name("jclouds-live-test2"))), details);

         assertTrue(imageApi.delete(details.getId()));
        
         assertTrue(imageApi.list(ListImageOptions.Builder.name("jclouds-live-test2")).isEmpty());
      }
   }
View Full Code Here

   @Test
   public void testReserveUploadAndDeleteImage() {
      StringPayload imageData = new StringPayload("This isn't an image!");
      for (String zoneId : api.getConfiguredZones()) {
         ImageApi imageApi = api.getImageApiForZone(zoneId);
         ImageDetails details = imageApi.reserve("jclouds-live-res-test", diskFormat(DiskFormat.RAW), containerFormat(ContainerFormat.BARE));
         assertEquals(details.getName(), "jclouds-live-res-test");
         details = imageApi.upload(details.getId(), imageData, UpdateImageOptions.Builder.name("jclouds-live-res-test2"), UpdateImageOptions.Builder.minDisk(10));
         assertEquals(details.getName(), "jclouds-live-res-test2");
         assertEquals(details.getSize().get().longValue(), imageData.getRawContent().length());
         assertEquals(details.getMinDisk(), 10);

         Image fromListing = Iterables.getOnlyElement(imageApi.list(ListImageOptions.Builder.name("jclouds-live-res-test2").limit(2).containerFormat(ContainerFormat.BARE)));
         assertEquals(fromListing.getId(), details.getId());
         assertEquals(fromListing.getSize(), details.getSize());

         assertEquals(Iterables.getOnlyElement(imageApi.listInDetail(ListImageOptions.Builder.name("jclouds-live-res-test2"))), details);

         assertTrue(imageApi.delete(details.getId()));

         assertTrue(imageApi.list(ListImageOptions.Builder.name("jclouds-live-res-test2")).isEmpty());
      }
   }
View Full Code Here

      }

      @Override
      protected Function<Object, IterableWithMarker<ImageDetails>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.isPresent() ? arg0.get().toString() : null;
         final ImageApi imageApi = api.getImageApiForZone(zone);
         return new Function<Object, IterableWithMarker<ImageDetails>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<ImageDetails> apply(Object input) {
               return IterableWithMarker.class.cast(imageApi.listInDetail(marker(input.toString())));
            }

            @Override
            public String toString() {
               return "listInDetail()";
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.glance.v1_0.features.ImageApi

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.