}
}
@Test
public void testCreateAndListEBSBackedImage() throws Exception {
Snapshot snapshot = createSnapshot();
// List of images before...
int sizeBefore = client.describeImagesInRegion(regionId).size();
// Register a new image...
ebsBackedImageId = client.registerUnixImageBackedByEbsInRegion(regionId, ebsBackedImageName, snapshot.getId(),
addNewBlockDevice("/dev/sda2", "myvirtual", 1).withDescription("adrian"));
imagesToDeregister.add(ebsBackedImageId);
final Image ebsBackedImage = getOnlyElement(client.describeImagesInRegion(regionId, imageIds(ebsBackedImageId)));
assertEquals(ebsBackedImage.getName(), ebsBackedImageName);
assertEquals(ebsBackedImage.getImageType(), ImageType.MACHINE);
assertEquals(ebsBackedImage.getRootDeviceType(), RootDeviceType.EBS);
assertEquals(ebsBackedImage.getRootDeviceName(), "/dev/sda1");
assertEquals(ebsBackedImage.getDescription(), "adrian");
assertEquals(
ebsBackedImage.getEbsBlockDevices().entrySet(),
ImmutableMap.of("/dev/sda1", new Image.EbsBlockDevice(snapshot.getId(), snapshot.getVolumeSize(), true),
"/dev/sda2", new Image.EbsBlockDevice(null, 1, false)).entrySet());
// List of images after - should be one larger than before
int after = client.describeImagesInRegion(regionId).size();
assertEquals(after, sizeBefore + 1);