@Test public void testGetCdrom() throws InterruptedException { server.enqueue(new MockResponse().setBody(stringFromResource("/server/cdrom.json"))); Image cdrom = serverApi().getCdrom("datacenter-id", "server-id", "cdrom-id"); assertEquals(cdrom.properties().name(), "ubuntu-15.10-server-amd64.iso"); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters/datacenter-id/servers/server-id/cdroms/cdrom-id"); }
@Override public Provisionable getImage(String id) { // try search images logger.trace("<< searching for image with id=%s", id); Image image = api.imageApi().getImage(id); if (image != null) { logger.trace(">> found image [%s].", image.properties().name()); return image; } // try search snapshots logger.trace("<< not found from images. searching for snapshot with id=%s", id); Snapshot snapshot = api.snapshotApi().get(id); if (snapshot != null) { logger.trace(">> found snapshot [%s]", snapshot.properties().name()); return snapshot; } throw new ResourceNotFoundException("No image/snapshot with id '" + id + "' was found"); }