@see
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()));
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()));
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()));
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()));
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);
}
}
}
@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());
}
}
@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());
}
}
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);
}
}
}
@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());
}
}
@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());
}
}
Related Classes of org.jclouds.openstack.glance.v1_0.options.UpdateImageOptions$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.