fixed VolumeAsyncClientTest

This commit is contained in:
Adrian Cole 2011-11-15 14:41:24 +02:00
parent 9455d146a5
commit 0b9cb6238d
1 changed files with 14 additions and 16 deletions

View File

@ -31,7 +31,7 @@ import org.testng.annotations.Test;
/** /**
* Tests behavior of {@code EventAsyncClient} * Tests behavior of {@code EventAsyncClient}
* *
* @author Vijay Kiran * @author Vijay Kiran
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during // NOTE:without testName, this will not call @Before* and fail w/NPE during
@ -58,12 +58,13 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
} }
public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException { public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException {
Method method = VolumeAsyncClient.class.getMethod("createVolumeWithSnapshot", String.class, long.class); Method method = VolumeAsyncClient.class.getMethod("createVolumeFromSnapshotInZone", String.class, long.class,
HttpRequest httpRequest = processor.createRequest(method, prefix + "-jclouds-volume", 999L); long.class);
HttpRequest httpRequest = processor.createRequest(method, prefix + "-jclouds-volume", 999L, 111l);
assertRequestLineEquals(httpRequest, assertRequestLineEquals(
"GET http://localhost:8080/client/api?response=json&command=createVolume&name=" httpRequest,
+ prefix + "-jclouds-volume&snapshotid=999 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=createVolume&name=adriancole-jclouds-volume&zoneid=111&snapshotid=999 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
@ -73,14 +74,14 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
} }
public void testCreateVolumeFromDiskOffering() throws SecurityException, NoSuchMethodException, IOException { public void testCreateVolumeFromDiskOffering() throws SecurityException, NoSuchMethodException, IOException {
Method method = VolumeAsyncClient.class.getMethod("createVolumeFromDiskOfferingInZone", Method method = VolumeAsyncClient.class.getMethod("createVolumeFromDiskOfferingInZone", String.class, long.class,
String.class, long.class, long.class); long.class);
HttpRequest httpRequest = processor.createRequest(method, prefix + "-jclouds-volume", 999L, 111L); HttpRequest httpRequest = processor.createRequest(method, prefix + "-jclouds-volume", 999L, 111L);
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=createVolume&name=" "GET http://localhost:8080/client/api?response=json&command=createVolume&name=" + prefix
+ prefix + "-jclouds-volume&zoneid=111&diskofferingid=999 HTTP/1.1"); + "-jclouds-volume&zoneid=111&diskofferingid=999 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
@ -89,10 +90,8 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
} }
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException { public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
Method method = VolumeAsyncClient.class.getMethod("attachVolume", Method method = VolumeAsyncClient.class.getMethod("attachVolume", long.class, long.class);
long.class, long.class);
HttpRequest httpRequest = processor.createRequest(method, 111L, 999L); HttpRequest httpRequest = processor.createRequest(method, 111L, 999L);
@ -126,8 +125,8 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
HttpRequest httpRequest = processor.createRequest(method, prefix + "-jclouds-volume"); HttpRequest httpRequest = processor.createRequest(method, prefix + "-jclouds-volume");
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=deleteVolume&id=" "GET http://localhost:8080/client/api?response=json&command=deleteVolume&id=" + prefix
+ prefix + "-jclouds-volume HTTP/1.1"); + "-jclouds-volume HTTP/1.1");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
@ -136,7 +135,6 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
} }
@Override @Override
protected TypeLiteral<RestAnnotationProcessor<VolumeAsyncClient>> createTypeLiteral() { protected TypeLiteral<RestAnnotationProcessor<VolumeAsyncClient>> createTypeLiteral() {
return new TypeLiteral<RestAnnotationProcessor<VolumeAsyncClient>>() { return new TypeLiteral<RestAnnotationProcessor<VolumeAsyncClient>>() {