@Test public void testGetVolume() throws InterruptedException { server.enqueue(new MockResponse().setBody(stringFromResource("/server/volume.json"))); Volume volume = serverApi().getVolume("datacenter-id", "server-id", "volume-id"); assertEquals(volume.properties().name(), "Storage"); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters/datacenter-id/servers/server-id/volumes/volume-id"); }
@Test public void testAttachVolume() throws InterruptedException { server.enqueue(new MockResponse().setBody(stringFromResource("/server/volume.json"))); Volume volume = serverApi() .attachVolume( Server.Request.attachVolumeBuilder() .dataCenterId("datacenter-id") .serverId("server-id") .volumeId("volume-id") .build()); assertEquals(volume.properties().name(), "Storage"); assertEquals(server.getRequestCount(), 1); assertSent( server, "POST", "/datacenters/datacenter-id/servers/server-id/volumes", "{\"id\": \"volume-id\"}"); }