fixed broken unit test

This commit is contained in:
Adrian Cole 2011-12-12 17:46:39 -08:00
parent 9b311472da
commit c10d585052
1 changed files with 8 additions and 10 deletions

View File

@ -18,19 +18,17 @@
*/ */
package org.jclouds.cloudstack.features; package org.jclouds.cloudstack.features;
import org.jclouds.cloudstack.options.ListAccountsOptions; import java.lang.reflect.Method;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed; import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.inject.TypeLiteral; import com.google.inject.TypeLiteral;
import java.io.IOException;
import java.lang.reflect.Method;
/** /**
* Tests behavior of {@code DomainAccountAsyncClient} * Tests behavior of {@code DomainAccountAsyncClient}
* *
@ -40,11 +38,11 @@ import java.lang.reflect.Method;
public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<DomainAccountAsyncClient> { public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<DomainAccountAsyncClient> {
public void testEnableAccount() throws Exception { public void testEnableAccount() throws Exception {
Method method = DomainAccountAsyncClient.class.getMethod("enableAccount", long.class, long.class); Method method = DomainAccountAsyncClient.class.getMethod("enableAccount", String.class, long.class);
HttpRequest httpRequest = processor.createRequest(method, 1L, 2L); HttpRequest httpRequest = processor.createRequest(method, "goo", 2L);
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=enableAccount&account=1&domainid=2 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=enableAccount&account=goo&domainid=2 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);
@ -56,7 +54,7 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
} }
public void testDisableAccount() throws Exception { public void testDisableAccount() throws Exception {
Method method = DomainAccountAsyncClient.class.getMethod("disableAccount", long.class, long.class, boolean.class); Method method = DomainAccountAsyncClient.class.getMethod("disableAccount", String.class, long.class, boolean.class);
HttpRequest httpRequest = processor.createRequest(method, 1L, 2L, true); HttpRequest httpRequest = processor.createRequest(method, 1L, 2L, true);
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
@ -64,7 +62,7 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class); assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
assertSaxResponseParserClassEquals(method, null); assertSaxResponseParserClassEquals(method, null);
assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class); assertExceptionParserClassEquals(method, ReturnNullOnNotFoundOr404.class);