mirror of https://github.com/apache/jclouds.git
Added unit test for getVolume
This commit is contained in:
parent
7a2c6c6edd
commit
2fe71a4ea2
|
@ -25,6 +25,7 @@ import com.google.inject.TypeLiteral;
|
||||||
import org.jclouds.cloudstack.options.ListVolumesOptions;
|
import org.jclouds.cloudstack.options.ListVolumesOptions;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
|
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
|
||||||
|
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
|
||||||
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
|
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
|
||||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
@ -55,6 +56,22 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testGetVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = VolumeAsyncClient.class.getMethod("getVolume", long.class);
|
||||||
|
HttpRequest httpRequest = processor.createRequest(method, 111L);
|
||||||
|
|
||||||
|
assertRequestLineEquals(httpRequest,
|
||||||
|
"GET http://localhost:8080/client/api?response=json&command=listVolumes&id=111 HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);
|
||||||
|
|
||||||
|
checkFilters(httpRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VolumeAsyncClient.class.getMethod("createVolumeFromSnapshotInZone", String.class, long.class,
|
Method method = VolumeAsyncClient.class.getMethod("createVolumeFromSnapshotInZone", String.class, long.class,
|
||||||
long.class);
|
long.class);
|
||||||
|
@ -119,10 +136,10 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
||||||
|
|
||||||
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VolumeAsyncClient.class.getMethod("deleteVolume", long.class);
|
Method method = VolumeAsyncClient.class.getMethod("deleteVolume", long.class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "jclouds-volume");
|
HttpRequest httpRequest = processor.createRequest(method, 111L);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest,
|
||||||
"GET http://localhost:8080/client/api?response=json&command=deleteVolume&id=jclouds-volume HTTP/1.1");
|
"GET http://localhost:8080/client/api?response=json&command=deleteVolume&id=111 HTTP/1.1");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
|
Loading…
Reference in New Issue