use of org.openstack4j.model.image.v2.ContainerFormat in project openstack4j by ContainX.
the class ImageV2Tests method testCreateImage.
public void testCreateImage() throws IOException {
respondWith(IMAGE_JSON);
String id = "8a2ea42d-06b5-42c2-a54d-97105420f2bb";
String name = "amphora-x64-haproxy";
ContainerFormat cf = ContainerFormat.BARE;
DiskFormat df = DiskFormat.QCOW2;
Long mindisk = 0L;
Long minram = 0L;
Image.ImageVisibility vis = Image.ImageVisibility.PUBLIC;
String key1 = "test-key1";
String key2 = "test-key2";
String key3 = "id";
String value1 = "test-value1";
String value2 = "test-value2";
String value3 = "test-value3";
Image im = Builders.imageV2().id(id).name(name).containerFormat(cf).diskFormat(df).minDisk(mindisk).minRam(minram).visibility(vis).additionalProperty(key1, value1).additionalProperty(key2, value2).additionalProperty(key3, value3).build();
Image image = osv3().imagesV2().create(im);
assertNotNull(image);
assertEquals(image.getId(), id);
assertEquals(image.getName(), name);
assertEquals(image.getContainerFormat(), cf);
assertEquals(image.getDiskFormat(), df);
assertEquals(image.getVisibility(), vis);
assertEquals(image.getMinDisk(), mindisk);
assertEquals(image.getMinRam(), minram);
assertEquals(image.getAdditionalPropertyValue(key1), value1);
assertEquals(image.getAdditionalPropertyValue(key2), value2);
assertNull(image.getAdditionalPropertyValue(key3));
}
Aggregations