mirror of https://github.com/apache/jclouds.git
dependent changes on tests and internal classes
This commit is contained in:
parent
d38ae1420d
commit
2480481835
|
@ -37,7 +37,9 @@ import org.jclouds.reflect.Invocation;
|
|||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -59,10 +61,12 @@ public class AtmosBlobRequestSigner implements BlobRequestSigner {
|
|||
this.processor = checkNotNull(processor, "processor");
|
||||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2ObjectGetOptions = checkNotNull(blob2ObjectGetOptions, "blob2ObjectGetOptions");
|
||||
this.getMethod = Invokable.from(AtmosAsyncClient.class.getMethod("readFile", String.class, GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(AtmosAsyncClient.class.getMethod("deletePath", String.class));
|
||||
this.createMethod = Invokable.from(AtmosAsyncClient.class.getMethod("createFile", String.class,
|
||||
AtmosObject.class, PutOptions[].class));
|
||||
this.getMethod = Invokable.from(TypeToken.of(AtmosAsyncClient.class),
|
||||
AtmosAsyncClient.class.getMethod("readFile", String.class, GetOptions[].class));
|
||||
this.deleteMethod = Invokable.from(TypeToken.of(AtmosAsyncClient.class),
|
||||
AtmosAsyncClient.class.getMethod("deletePath", String.class));
|
||||
this.createMethod = Invokable.from(TypeToken.of(AtmosAsyncClient.class),
|
||||
AtmosAsyncClient.class.getMethod("createFile", String.class, AtmosObject.class, PutOptions[].class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,14 +47,15 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
|
@ -70,7 +71,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testListDirectories() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("listDirectories", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\n");
|
||||
|
@ -85,7 +86,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testListDirectory() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("listDirectory", String.class, ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/directory/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\n");
|
||||
|
@ -100,7 +101,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testListDirectoriesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("listDirectories", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(new ListOptions().limit(1).token("asda")));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(new ListOptions().limit(1).token("asda")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\nx-emc-limit: 1\nx-emc-token: asda\n");
|
||||
|
@ -115,7 +116,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testListDirectoryOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("listDirectory", String.class, ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory", new ListOptions().limit(1).token("asda")));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory", new ListOptions().limit(1).token("asda")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/directory/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": text/xml\nx-emc-limit: 1\nx-emc-token: asda\n");
|
||||
|
@ -130,7 +131,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testCreateDirectory() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("createDirectory", String.class, PutOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
|
||||
|
@ -145,7 +146,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testCreateDirectoryOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("createDirectory", String.class, PutOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", PutOptions.Builder.publicRead()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", PutOptions.Builder.publicRead()));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT
|
||||
|
@ -162,7 +163,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
public void testCreateFile() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("createFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
|
||||
|
@ -179,7 +180,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
public void testCreateFileOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("createFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
|
||||
|
@ -197,7 +198,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
public void testUpdateFile() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("updateFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
|
||||
|
@ -214,7 +215,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
public void testUpdateFileOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("updateFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://accesspoint.atmosonline.com/rest/namespace/dir/hello HTTP/1.1");
|
||||
|
@ -231,7 +232,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testReadFile() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("readFile", String.class, GetOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
|
||||
|
@ -246,7 +247,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testGetSystemMetadata() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("getSystemMetadata", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
|
||||
|
@ -261,7 +262,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testDeletePath() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("deletePath", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
|
||||
|
@ -276,7 +277,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
|
||||
public void testIsPublic() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("isPublic", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": */*\n");
|
||||
|
|
|
@ -62,13 +62,14 @@ import org.jclouds.openstack.filters.AuthenticateRequest;
|
|||
import org.jclouds.openstack.keystone.v1_1.config.AuthenticationServiceModule.GetAuth;
|
||||
import org.jclouds.openstack.keystone.v1_1.domain.Auth;
|
||||
import org.jclouds.openstack.keystone.v1_1.parse.ParseAuthTest;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
|
@ -85,7 +86,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testCreateServer() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -103,7 +104,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testCreateServerWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withSharedIpGroup(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withSharedIpGroup(2)));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -121,7 +122,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testCreateServerWithFile() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class));
|
||||
HttpRequest request = processor
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withFile("/etc/jclouds", "foo".getBytes())));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
|
||||
|
@ -142,7 +143,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testCreateServerWithMetadata() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
|
||||
withMetadata(ImmutableMap.of("foo", "bar"))));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
|
||||
|
@ -163,7 +164,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
UnknownHostException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
|
||||
withSharedIpGroup(2).withSharedIp("127.0.0.1")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
|
||||
|
@ -182,7 +183,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testDeleteImage() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteImage", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/2 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -197,7 +198,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testLimits() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getLimits"));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/limits?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -212,7 +213,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListServers() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listServers", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -229,7 +230,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListServersOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listServers", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
|
||||
|
@ -245,7 +246,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListServersDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listServers", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/detail?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -260,7 +261,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testGetServer() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getServer", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -275,7 +276,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListFlavors() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -290,7 +291,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListFlavorsOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
|
||||
|
@ -306,7 +307,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListFlavorsDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/detail?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -321,7 +322,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListFlavorsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
|
||||
|
@ -337,7 +338,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testGetFlavor() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getFlavor", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/flavors/2?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -352,7 +353,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListImages() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -367,7 +368,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListImagesDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/detail?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -382,7 +383,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListImagesOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
|
||||
|
@ -398,7 +399,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListImagesDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
|
||||
|
@ -414,7 +415,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testGetImage() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getImage", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images/2?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -429,7 +430,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testDeleteServer() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteServer", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -445,7 +446,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testShareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("shareIp", String.class, int.class, int.class,
|
||||
boolean.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -463,7 +464,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testShareIpConfig() throws IOException, SecurityException, NoSuchMethodException, UnknownHostException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("shareIp", String.class, int.class, int.class,
|
||||
boolean.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, true));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, true));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -481,7 +482,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testUnshareIpNoConfig() throws IOException, SecurityException, NoSuchMethodException,
|
||||
UnknownHostException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("unshareIp", String.class, int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("127.0.0.1", 2, 3, false));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public/127.0.0.1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -497,7 +498,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testReplaceBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("replaceBackupSchedule", int.class, BackupSchedule.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, BackupSchedule.builder().weekly(WeeklyBackup.MONDAY)
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, BackupSchedule.builder().weekly(WeeklyBackup.MONDAY)
|
||||
.daily(DailyBackup.H_0800_1000).enabled(true).build()));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule HTTP/1.1");
|
||||
|
@ -516,7 +517,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testDeleteBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteBackupSchedule", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -532,7 +533,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testChangeAdminPass() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("changeAdminPass", int.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -548,7 +549,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testChangeServerName() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("renameServer", int.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, "foo"));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -564,7 +565,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListSharedIpGroups() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -579,7 +580,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListSharedIpGroupsOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
|
||||
|
@ -595,7 +596,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListSharedIpGroupsDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails()));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/detail?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -610,7 +611,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListSharedIpGroupsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/detail?format=json&changes-since=10000&limit=1&offset=2 HTTP/1.1");
|
||||
|
@ -626,7 +627,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testGetSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getSharedIpGroup", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/2?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -642,7 +643,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testCreateSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createSharedIpGroup", String.class,
|
||||
CreateSharedIpGroupOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -659,7 +660,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testCreateSharedIpGroupWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createSharedIpGroup", String.class,
|
||||
CreateSharedIpGroupOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", withServer(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", withServer(2)));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -675,7 +676,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testDeleteSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteSharedIpGroup", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://lon.servers.api.rackspacecloud.com/v1.0/10001786/shared_ip_groups/2 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -690,7 +691,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListAddresses() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getAddresses", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -705,7 +706,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListPublicAddresses() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listPublicAddresses", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/public?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -720,7 +721,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListPrivateAddresses() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listPrivateAddresses", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/ips/private?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -735,7 +736,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testListBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getBackupSchedule", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/backup_schedule?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -750,7 +751,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testCreateImageWithIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createImageFromServer", String.class, int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/images?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/json\n");
|
||||
|
@ -768,7 +769,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testRebuildServer() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("rebuildServer", int.class,
|
||||
RebuildServerOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/3/action?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -784,7 +785,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
public void testRebuildServerWithImage() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("rebuildServer", int.class,
|
||||
RebuildServerOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3, withImage(2)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(3, withImage(2)));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/3/action?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -799,7 +800,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testReboot() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("rebootServer", int.class, RebootType.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, RebootType.HARD));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, RebootType.HARD));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -814,7 +815,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testResize() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("resizeServer", int.class, int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, 3));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, 3));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -830,7 +831,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testConfirmResize() throws IOException, IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("confirmResizeServer", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -845,7 +846,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testRevertResize() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("revertResizeServer", int.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://lon.servers.api.rackspacecloud.com/v1.0/10001786/servers/2/action?format=json HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.cloudsigma;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.cloudsigma.domain.Drive;
|
||||
import org.jclouds.cloudsigma.domain.DriveData;
|
||||
import org.jclouds.cloudsigma.domain.DriveInfo;
|
||||
|
|
|
@ -33,11 +33,11 @@ import org.jclouds.cloudsigma.domain.ServerMetrics;
|
|||
import org.jclouds.cloudsigma.functions.BaseDriveToMap;
|
||||
import org.jclouds.cloudsigma.functions.DriveDataToMap;
|
||||
import org.jclouds.cloudsigma.functions.MapToDevices;
|
||||
import org.jclouds.cloudsigma.functions.MapToDevices.DeviceToId;
|
||||
import org.jclouds.cloudsigma.functions.MapToDriveMetrics;
|
||||
import org.jclouds.cloudsigma.functions.MapToNICs;
|
||||
import org.jclouds.cloudsigma.functions.MapToServerMetrics;
|
||||
import org.jclouds.cloudsigma.functions.ServerToMap;
|
||||
import org.jclouds.cloudsigma.functions.MapToDevices.DeviceToId;
|
||||
import org.jclouds.cloudsigma.handlers.CloudSigmaErrorHandler;
|
||||
import org.jclouds.http.HttpErrorHandler;
|
||||
import org.jclouds.http.annotation.ClientError;
|
||||
|
|
|
@ -31,8 +31,8 @@ import org.jclouds.cloudsigma.domain.SCSIDevice;
|
|||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudsigma.util;
|
||||
|
||||
import org.jclouds.cloudsigma.CloudSigmaClient;
|
||||
import org.jclouds.cloudsigma.domain.IDEDevice;
|
||||
import org.jclouds.cloudsigma.domain.Model;
|
||||
import org.jclouds.cloudsigma.domain.NIC;
|
||||
|
|
|
@ -46,12 +46,13 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.filters.BasicAuthentication;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code CloudSigmaAsyncClient}
|
||||
|
@ -64,7 +65,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testGetProfileInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getProfileInfo"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/profile/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -80,7 +81,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListStandardDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStandardDrives"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -95,7 +96,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListStandardCds() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStandardCds"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/cd/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -110,7 +111,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListStandardImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStandardImages"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/img/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -125,7 +126,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listDriveInfo"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -140,7 +141,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testGetDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getDriveInfo", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -156,7 +157,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testCreateDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createDrive", Drive.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
new CreateDriveRequest.Builder().name("foo").use(ImmutableList.of("production", "candy")).size(10000l)
|
||||
.build()));
|
||||
|
||||
|
@ -175,7 +176,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
public void testCloneDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("cloneDrive", String.class, String.class,
|
||||
CloneDriveOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/drives/sourceid/clone HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -192,7 +193,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
public void testCloneDriveOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("cloneDrive", String.class, String.class,
|
||||
CloneDriveOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname",
|
||||
new CloneDriveOptions().size(1024l)));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/drives/sourceid/clone HTTP/1.1");
|
||||
|
@ -209,7 +210,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testSetDriveData() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("setDriveData", String.class, DriveData.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", new DriveData.Builder().name("foo").size(10000l)
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", new DriveData.Builder().name("foo").size(10000l)
|
||||
.use(ImmutableList.of("production", "candy")).build()));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/drives/100/set HTTP/1.1");
|
||||
|
@ -226,15 +227,15 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listServers"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
// now make sure request filters apply by replaying
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
|
@ -253,7 +254,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listServerInfo"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -268,7 +269,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testGetServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getServerInfo", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -284,7 +285,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createServer", Server.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(BindServerToPlainTextStringTest.SERVER));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/create HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -300,7 +301,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testSetServerConfiguration() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("setServerConfiguration", String.class, Server.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", BindServerToPlainTextStringTest.SERVER));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/100/set HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -316,7 +317,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testDestroyServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -332,7 +333,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testStartServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("startServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/start HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -348,7 +349,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testStopServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("stopServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/stop HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -364,7 +365,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testShutdownServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("shutdownServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/shutdown HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -380,7 +381,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testResetServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("resetServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/reset HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -396,15 +397,15 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listDrives"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
// now make sure request filters apply by replaying
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
|
@ -423,7 +424,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testDestroyDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyDrive", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -439,15 +440,15 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListVLANs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listVLANs"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
// now make sure request filters apply by replaying
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
|
@ -466,7 +467,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListVLANInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listVLANInfo"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -481,7 +482,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testGetVLANInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getVLANInfo", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -497,7 +498,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testCreateVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createVLAN", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("poohbear"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("poohbear"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/create HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -513,7 +514,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testRenameVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("renameVLAN", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "poohbear"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "poohbear"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/100/set HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -529,7 +530,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testDestroyVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyVLAN", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -545,15 +546,15 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListStaticIPs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStaticIPs"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
// now make sure request filters apply by replaying
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
|
@ -572,7 +573,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testListStaticIPInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStaticIPInfo"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -587,7 +588,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testGetStaticIPInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getStaticIPInfo", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -603,7 +604,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testCreateStaticIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createStaticIP"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/ip/create HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -619,7 +620,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
|
||||
public void testDestroyStaticIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyStaticIP", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
|
|
@ -27,13 +27,13 @@ import java.util.Map;
|
|||
|
||||
import org.jclouds.cloudsigma.options.CloneDriveOptions;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Guice;
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,13 +25,13 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListAccountsOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AccountAsyncClient}
|
||||
|
@ -45,7 +45,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
|
|||
|
||||
public void testListAccounts() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AccountAsyncClient.class.getMethod("listAccounts", ListAccountsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listAccounts&listAll=true HTTP/1.1");
|
||||
|
@ -62,7 +62,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
|
|||
|
||||
public void testListAccountsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AccountAsyncClient.class.getMethod("listAccounts", ListAccountsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListAccountsOptions.Builder.accountInDomain("jclouds", "123")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -80,7 +80,7 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
|
|||
|
||||
public void testGetAccount() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AccountAsyncClient.class.getMethod("getAccount", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("3"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("3"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listAccounts&listAll=true&id=3 HTTP/1.1");
|
||||
|
|
|
@ -28,15 +28,15 @@ import org.jclouds.cloudstack.options.AssociateIPAddressOptions;
|
|||
import org.jclouds.cloudstack.options.ListPublicIPAddressesOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AddressAsyncClient}
|
||||
|
@ -49,7 +49,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<AddressAsyncClient> {
|
||||
public void testListPublicIPAddresses() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AddressAsyncClient.class.getMethod("listPublicIPAddresses", ListPublicIPAddressesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listPublicIpAddresses&listAll=true HTTP/1.1");
|
||||
|
@ -66,7 +66,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
|
|||
|
||||
public void testListPublicIPAddressesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AddressAsyncClient.class.getMethod("listPublicIPAddresses", ListPublicIPAddressesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListPublicIPAddressesOptions.Builder.accountInDomain("adrian", "6").usesVirtualNetwork(true)));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -85,7 +85,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
|
|||
|
||||
public void testGetPublicIPAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AddressAsyncClient.class.getMethod("getPublicIPAddress", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listPublicIpAddresses&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -104,7 +104,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
|
|||
public void testAssociateIPAddressInZone() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AddressAsyncClient.class.getMethod("associateIPAddressInZone", String.class,
|
||||
AssociateIPAddressOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=associateIpAddress&zoneid=6 HTTP/1.1");
|
||||
|
@ -121,7 +121,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
|
|||
|
||||
public void testDisassociateIPAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AddressAsyncClient.class.getMethod("disassociateIPAddress", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=disassociateIpAddress&id=5 HTTP/1.1");
|
||||
|
|
|
@ -26,11 +26,11 @@ import org.jclouds.cloudstack.functions.ParseAsyncJobFromHttpResponse;
|
|||
import org.jclouds.cloudstack.functions.ParseAsyncJobsFromHttpResponse;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListAsyncJobsOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AsyncJobAsyncClient}
|
||||
|
@ -44,7 +44,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
|
|||
|
||||
public void testGetAsyncJob() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AsyncJobAsyncClient.class.getMethod("getAsyncJob", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=queryAsyncJobResult&jobid=11 HTTP/1.1");
|
||||
|
@ -61,7 +61,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
|
|||
|
||||
public void testListAsyncJobs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AsyncJobAsyncClient.class.getMethod("listAsyncJobs", ListAsyncJobsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listAsyncJobs&listAll=true HTTP/1.1");
|
||||
|
@ -78,7 +78,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
|
|||
|
||||
public void testListAsyncJobsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AsyncJobAsyncClient.class.getMethod("listAsyncJobs", ListAsyncJobsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListAsyncJobsOptions.Builder.accountInDomain("adrian", "5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -22,12 +22,12 @@ import java.io.IOException;
|
|||
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code ConfigurationAsyncClient}
|
||||
|
@ -41,7 +41,7 @@ public class ConfigurationAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testListCapabilities() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ConfigurationAsyncClient.class.getMethod("listCapabilities"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&listAll=true&command=listCapabilities HTTP/1.1");
|
||||
|
|
|
@ -20,13 +20,13 @@ package org.jclouds.cloudstack.features;
|
|||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code DomainAccountAsyncClient}
|
||||
|
@ -38,7 +38,7 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testEnableAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(DomainAccountAsyncClient.class.getMethod("enableAccount", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo", "2"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo", "2"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=enableAccount&account=goo&domainid=2 HTTP/1.1");
|
||||
|
@ -54,7 +54,7 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testDisableAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(DomainAccountAsyncClient.class.getMethod("disableAccount", String.class, String.class, boolean.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("1", "2", true));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("1", "2", true));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=disableAccount&account=1&domainid=2&lock=true HTTP/1.1");
|
||||
|
|
|
@ -24,12 +24,12 @@ import org.jclouds.cloudstack.domain.ResourceLimit;
|
|||
import org.jclouds.cloudstack.domain.ResourceLimit.ResourceType;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code DomainLimitAsyncClient}
|
||||
|
@ -41,7 +41,7 @@ public class DomainLimitAsyncClientTest extends BaseCloudStackAsyncClientTest<Do
|
|||
|
||||
public void testUpdateResourceLimit() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(DomainLimitAsyncClient.class.getMethod("updateResourceLimit", ResourceLimit.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ResourceLimit.builder().resourceType(ResourceType.SNAPSHOT).account("foo").domainId("100").max(101).build()));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
|
|
@ -24,12 +24,12 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListEventsOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code EventAsyncClient}
|
||||
|
@ -43,7 +43,7 @@ public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsy
|
|||
|
||||
public void testListEventTypes() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(EventAsyncClient.class.getMethod("listEventTypes"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&listAll=true&command=listEventTypes HTTP/1.1");
|
||||
|
@ -59,7 +59,7 @@ public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsy
|
|||
|
||||
public void testListEvents() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(EventAsyncClient.class.getMethod("listEvents", ListEventsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&listAll=true&command=listEvents HTTP/1.1");
|
||||
|
@ -76,7 +76,7 @@ public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsy
|
|||
|
||||
public void testEventsListOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(EventAsyncClient.class.getMethod("listEvents", ListEventsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListEventsOptions.Builder.account("jclouds")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListEventsOptions.Builder.account("jclouds")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&listAll=true&command=listEvents&account=jclouds HTTP/1.1");
|
||||
|
|
|
@ -26,14 +26,14 @@ import org.jclouds.cloudstack.domain.PortForwardingRule;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListPortForwardingRulesOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code FirewallAsyncClient}
|
||||
|
@ -47,7 +47,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
|
|||
public void testListPortForwardingRules() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncClient.class.getMethod("listPortForwardingRules",
|
||||
ListPortForwardingRulesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listPortForwardingRules&listAll=true HTTP/1.1");
|
||||
|
@ -65,7 +65,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
|
|||
public void testListPortForwardingRulesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncClient.class.getMethod("listPortForwardingRules",
|
||||
ListPortForwardingRulesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListPortForwardingRulesOptions.Builder.ipAddressId("3")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListPortForwardingRulesOptions.Builder.ipAddressId("3")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listPortForwardingRules&listAll=true&ipaddressid=3 HTTP/1.1");
|
||||
|
@ -84,7 +84,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncClient.class.getMethod("createPortForwardingRuleForVirtualMachine", String.class,
|
||||
PortForwardingRule.Protocol.class, int.class, String.class, int.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("6", PortForwardingRule.Protocol.TCP, 22, "7", 22));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("6", PortForwardingRule.Protocol.TCP, 22, "7", 22));
|
||||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
|
@ -102,7 +102,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
|
|||
|
||||
public void testDeletePortForwardingRule() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncClient.class.getMethod("deletePortForwardingRule", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deletePortForwardingRule&id=5 HTTP/1.1");
|
||||
|
|
|
@ -26,10 +26,11 @@ import org.jclouds.cloudstack.options.UpdateAccountOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalAccountAsyncClient}
|
||||
|
@ -54,7 +55,7 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
public void testCreateAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAccountAsyncClient.class.getMethod("createAccount", String.class, Account.Type.class,
|
||||
String.class, String.class, String.class, String.class, CreateAccountOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("user", Account.Type.USER, "email@example.com",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("user", Account.Type.USER, "email@example.com",
|
||||
"FirstName", "LastName", "hashed-password"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, create.getRequestLine());
|
||||
|
@ -80,7 +81,7 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
public void testUpdateAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAccountAsyncClient.class.getMethod("updateAccount", String.class, String.class,
|
||||
String.class, UpdateAccountOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("account", 42L, "new-account-name"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("account", 42L, "new-account-name"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, update.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -95,7 +96,7 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testDeleteAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAccountAsyncClient.class.getMethod("deleteAccount", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteAccount&id=42 HTTP/1.1");
|
||||
|
|
|
@ -23,12 +23,12 @@ import java.io.IOException;
|
|||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListAlertsOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalAlertsAsyncClient}
|
||||
|
@ -42,7 +42,7 @@ public class GlobalAlertAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
|
||||
public void testListAlerts() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAlertAsyncClient.class.getMethod("listAlerts", ListAlertsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listAlerts&listAll=true HTTP/1.1");
|
||||
|
@ -59,7 +59,7 @@ public class GlobalAlertAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
|
||||
public void testListAlertsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAlertAsyncClient.class.getMethod("listAlerts", ListAlertsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListAlertsOptions.Builder.id("42").keyword("jclouds").type("TEMPLATE")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListAlertsOptions.Builder.id("42").keyword("jclouds").type("TEMPLATE")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listAlerts&listAll=true&id=42&keyword=jclouds&type=TEMPLATE HTTP/1.1");
|
||||
|
|
|
@ -24,12 +24,12 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.domain.Capacity;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListCapacityOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalCapacityAsyncClient}
|
||||
|
@ -43,7 +43,7 @@ public class GlobalCapacityAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testListCapacity() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalCapacityAsyncClient.class.getMethod("listCapacity", ListCapacityOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listCapacity&listAll=true HTTP/1.1");
|
||||
|
@ -59,7 +59,7 @@ public class GlobalCapacityAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testListCapacityOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalCapacityAsyncClient.class.getMethod("listCapacity", ListCapacityOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListCapacityOptions.Builder.hostId("3").keyword("fred").podId("4").type(Capacity.Type.CPU_ALLOCATED_MHZ).zoneId("6")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListCapacityOptions.Builder.hostId("3").keyword("fred").podId("4").type(Capacity.Type.CPU_ALLOCATED_MHZ).zoneId("6")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listCapacity&listAll=true&hostid=3&keyword=fred&podid=4&type=1&zoneid=6 HTTP/1.1");
|
||||
|
|
|
@ -21,12 +21,12 @@ package org.jclouds.cloudstack.features;
|
|||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListHostsOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalHostAsyncClient}
|
||||
|
@ -38,7 +38,7 @@ public class GlobalHostAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
|
|||
|
||||
public void testListHosts() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalHostAsyncClient.class.getMethod("listHosts", ListHostsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listHosts&listAll=true HTTP/1.1");
|
||||
|
|
|
@ -28,10 +28,11 @@ import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalOfferingAsyncClient}
|
||||
|
@ -54,7 +55,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testCreateServiceOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("createServiceOffering",
|
||||
String.class, String.class, int.class, int.class, int.class, CreateServiceOfferingOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText", 1, 2, 3));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText", 1, 2, 3));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createServiceOffering.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -70,7 +71,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testUpdateServiceOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("updateServiceOffering",
|
||||
String.class, UpdateServiceOfferingOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateServiceOffering&id=1 HTTP/1.1");
|
||||
|
@ -86,7 +87,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testDeleteServiceOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("deleteServiceOffering", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteServiceOffering&id=1 HTTP/1.1");
|
||||
|
@ -103,7 +104,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testCreateDiskOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("createDiskOffering",
|
||||
String.class, String.class, CreateDiskOfferingOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createDiskOffering&name=name&displaytext=displayText HTTP/1.1");
|
||||
|
@ -120,7 +121,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testUpdateDiskOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("updateDiskOffering",
|
||||
String.class, UpdateDiskOfferingOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateDiskOffering&id=1 HTTP/1.1");
|
||||
|
@ -136,7 +137,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testDeleteDiskOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("deleteDiskOffering", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteDiskOffering&id=1 HTTP/1.1");
|
||||
|
@ -153,7 +154,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testUpdateNetworkOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("updateNetworkOffering",
|
||||
String.class, UpdateNetworkOfferingOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateNetworkOffering&id=1 HTTP/1.1");
|
||||
|
|
|
@ -21,12 +21,12 @@ package org.jclouds.cloudstack.features;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListStoragePoolsOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalStoragePoolAsyncClient}
|
||||
|
@ -38,7 +38,7 @@ public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientT
|
|||
|
||||
public void testListStoragePools() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalStoragePoolAsyncClient.class.getMethod("listStoragePools", ListStoragePoolsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listStoragePools&listAll=true HTTP/1.1");
|
||||
|
@ -54,7 +54,7 @@ public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientT
|
|||
|
||||
public void testListStoragePoolsOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalStoragePoolAsyncClient.class.getMethod("listStoragePools", ListStoragePoolsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListStoragePoolsOptions.Builder.clusterId("3").id("4").ipAddress("192.168.42.42").keyword("fred").name("bob").path("/mnt/store42").podId("4").zoneId("5")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListStoragePoolsOptions.Builder.clusterId("3").id("4").ipAddress("192.168.42.42").keyword("fred").name("bob").path("/mnt/store42").podId("4").zoneId("5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listStoragePools&listAll=true&clusterid=3&id=4&ipaddress=192.168.42.42&keyword=fred&name=bob&path=/mnt/store42&podid=4&zoneid=5 HTTP/1.1");
|
||||
|
|
|
@ -25,12 +25,12 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
|
||||
import org.jclouds.cloudstack.options.ListUsageRecordsOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalUsageAsyncClient}
|
||||
|
@ -51,7 +51,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("generateUsageRecords",
|
||||
Date.class, Date.class, GenerateUsageRecordsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=generateUsageRecords&startdate=2012-01-01&enddate=2012-01-31 HTTP/1.1");
|
||||
|
@ -76,7 +76,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("generateUsageRecords",
|
||||
Date.class, Date.class, GenerateUsageRecordsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, GenerateUsageRecordsOptions.Builder.domainId("42")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, GenerateUsageRecordsOptions.Builder.domainId("42")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=generateUsageRecords&startdate=2012-01-01&enddate=2012-01-31&domainid=42 HTTP/1.1");
|
||||
|
@ -101,7 +101,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("listUsageRecords",
|
||||
Date.class, Date.class, ListUsageRecordsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listUsageRecords&listAll=true&startdate=2012-01-01&enddate=2012-01-31 HTTP/1.1");
|
||||
|
@ -126,7 +126,7 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("listUsageRecords",
|
||||
Date.class, Date.class, ListUsageRecordsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, ListUsageRecordsOptions.Builder.accountInDomain("fred", "42").accountId("41").keyword("bob")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, ListUsageRecordsOptions.Builder.accountInDomain("fred", "42").accountId("41").keyword("bob")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listUsageRecords&listAll=true&startdate=2012-01-01&enddate=2012-01-31&account=fred&domainid=42&accountid=41&keyword=bob HTTP/1.1");
|
||||
|
|
|
@ -25,10 +25,11 @@ import org.jclouds.cloudstack.options.UpdateUserOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GlobalUserAsyncClient}
|
||||
|
@ -50,7 +51,7 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
|
|||
public void testCreateAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUserAsyncClient.class.getMethod("createUser", String.class, String.class,
|
||||
String.class, String.class, String.class, String.class, CreateUserOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("user", "account", "email@example.com",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("user", "account", "email@example.com",
|
||||
"hashed-password", "FirstName", "LastName"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createUser.getRequestLine());
|
||||
|
@ -66,7 +67,7 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
|
|||
|
||||
public void testUpdateUser() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUserAsyncClient.class.getMethod("updateUser", String.class, UpdateUserOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateUser&id=42 HTTP/1.1");
|
||||
|
@ -82,7 +83,7 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
|
|||
|
||||
public void testDeleteUser() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUserAsyncClient.class.getMethod("deleteUser", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteUser&id=42 HTTP/1.1");
|
||||
|
|
|
@ -27,13 +27,13 @@ import org.jclouds.cloudstack.functions.ParseIdToNameFromHttpResponse;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListOSTypesOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code GuestOSAsyncClient}
|
||||
|
@ -47,7 +47,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
|
|||
|
||||
public void testGetOSCategory() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GuestOSAsyncClient.class.getMethod("getOSCategory", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listOsCategories&listAll=true&id=11 HTTP/1.1");
|
||||
|
@ -64,7 +64,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
|
|||
|
||||
public void testListOSCategories() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GuestOSAsyncClient.class.getMethod("listOSCategories"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listOsCategories&listAll=true HTTP/1.1");
|
||||
|
@ -81,7 +81,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
|
|||
|
||||
public void testGetOSType() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GuestOSAsyncClient.class.getMethod("getOSType", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listOsTypes&listAll=true&id=11 HTTP/1.1");
|
||||
|
@ -99,7 +99,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
|
|||
|
||||
public void testListOSTypes() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GuestOSAsyncClient.class.getMethod("listOSTypes", ListOSTypesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listOsTypes&listAll=true HTTP/1.1");
|
||||
|
@ -116,7 +116,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
|
|||
|
||||
public void testListOSTypesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GuestOSAsyncClient.class.getMethod("listOSTypes", ListOSTypesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListOSTypesOptions.Builder.OSCategoryId("11")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListOSTypesOptions.Builder.OSCategoryId("11")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listOsTypes&listAll=true&oscategoryid=11 HTTP/1.1");
|
||||
|
|
|
@ -23,11 +23,11 @@ import java.io.IOException;
|
|||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code HypervisorAsyncClient}
|
||||
|
@ -41,7 +41,7 @@ public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<Hyp
|
|||
|
||||
public void testListHypervisors() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(HypervisorAsyncClient.class.getMethod("listHypervisors"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listHypervisors&listAll=true HTTP/1.1");
|
||||
|
@ -58,7 +58,7 @@ public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<Hyp
|
|||
|
||||
public void testListHypervisorsInZon() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(HypervisorAsyncClient.class.getMethod("listHypervisorsInZone", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listHypervisors&listAll=true&zoneid=11 HTTP/1.1");
|
||||
|
|
|
@ -31,11 +31,12 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.Invokable;
|
||||
/**
|
||||
* Tests the behaviour of ISOAsyncClient.
|
||||
*
|
||||
|
@ -48,7 +49,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testAttachISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("attachISO", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("3", "5"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("3", "5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=attachIso&id=3&virtualmachineid=5 HTTP/1.1");
|
||||
|
@ -64,7 +65,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testDetachISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("detachISO", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=detachIso&virtualmachineid=3 HTTP/1.1");
|
||||
|
@ -80,7 +81,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testUpdateISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("updateISO", String.class, UpdateISOOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateIso&id=3 HTTP/1.1");
|
||||
|
@ -96,7 +97,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testUpdateISOOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("updateISO", String.class, UpdateISOOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, UpdateISOOptions.Builder.bootable(true).displayText("robert").format("format").name("bob").osTypeId("9").passwordEnabled(true)));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, UpdateISOOptions.Builder.bootable(true).displayText("robert").format("format").name("bob").osTypeId("9").passwordEnabled(true)));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateIso&id=3&bootable=true&displaytext=robert&format=format&name=bob&ostypeid=9&passwordenabled=true HTTP/1.1");
|
||||
|
@ -112,7 +113,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testDeleteISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("deleteISO", String.class, DeleteISOOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteIso&id=3 HTTP/1.1");
|
||||
|
@ -128,7 +129,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testDeleteISOOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("deleteISO", String.class, DeleteISOOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, DeleteISOOptions.Builder.zoneId("5")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, DeleteISOOptions.Builder.zoneId("5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteIso&id=3&zoneid=5 HTTP/1.1");
|
||||
|
@ -153,7 +154,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testCopyISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("copyISO", String.class, String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, 5, 7));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, 5, 7));
|
||||
|
||||
assertRequestLineEquals(httpRequest, copyIso.getRequestLine());
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
@ -167,7 +168,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testUpdateISOPermissions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("updateISOPermissions", String.class, UpdateISOPermissionsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateIsoPermissions&id=3 HTTP/1.1");
|
||||
|
@ -183,7 +184,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testUpdateISOPermissionsOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("updateISOPermissions", String.class, UpdateISOPermissionsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, UpdateISOPermissionsOptions.Builder.accounts(ImmutableSet.<String>of("fred", "bob")).isExtractable(true).isFeatured(true).isPublic(true).operation(PermissionOperation.add)));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, UpdateISOPermissionsOptions.Builder.accounts(ImmutableSet.<String>of("fred", "bob")).isExtractable(true).isFeatured(true).isPublic(true).operation(PermissionOperation.add)));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateIsoPermissions&id=3&accounts=fred,bob&isextractable=true&isfeatured=true&ispublic=true&op=add HTTP/1.1");
|
||||
|
@ -199,7 +200,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testListISOPermissions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("listISOPermissions", String.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listIsoPermissions&listAll=true&id=3 HTTP/1.1");
|
||||
|
@ -215,7 +216,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testListISOPermissionsOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("listISOPermissions", String.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, AccountInDomainOptions.Builder.accountInDomain("fred", "5")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, AccountInDomainOptions.Builder.accountInDomain("fred", "5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listIsoPermissions&listAll=true&id=3&account=fred&domainid=5 HTTP/1.1");
|
||||
|
@ -240,7 +241,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testExtractISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractIso.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -265,7 +266,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
|
||||
public void testExtractISOOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractISOOptions.Builder.url("http://example.com/")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractISOOptions.Builder.url("http://example.com/")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractIsoOptions.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
|
|
@ -23,12 +23,12 @@ import java.io.IOException;
|
|||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListResourceLimitsOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code LimitAsyncClient}
|
||||
|
@ -40,7 +40,7 @@ public class LimitAsyncClientTest extends BaseCloudStackAsyncClientTest<LimitAsy
|
|||
|
||||
public void testListResourceLimits() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LimitAsyncClient.class.getMethod("listResourceLimits", ListResourceLimitsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listResourceLimits&listAll=true HTTP/1.1");
|
||||
|
@ -57,7 +57,7 @@ public class LimitAsyncClientTest extends BaseCloudStackAsyncClientTest<LimitAsy
|
|||
|
||||
public void testListResourceLimitsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LimitAsyncClient.class.getMethod("listResourceLimits", ListResourceLimitsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListResourceLimitsOptions.Builder.account("jclouds" , "23")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListResourceLimitsOptions.Builder.account("jclouds" , "23")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listResourceLimits&listAll=true&account=jclouds&domainid=23 HTTP/1.1");
|
||||
|
|
|
@ -30,10 +30,11 @@ import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions;
|
|||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code LoadBalancerAsyncClient}
|
||||
|
@ -47,7 +48,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
public void testListLoadBalancerRules() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("listLoadBalancerRules",
|
||||
ListLoadBalancerRulesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listLoadBalancerRules&listAll=true HTTP/1.1");
|
||||
|
@ -65,7 +66,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
public void testListLoadBalancerRulesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("listLoadBalancerRules",
|
||||
ListLoadBalancerRulesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListLoadBalancerRulesOptions.Builder.publicIPId("3")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListLoadBalancerRulesOptions.Builder.publicIPId("3")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listLoadBalancerRules&listAll=true&publicipid=3 HTTP/1.1");
|
||||
|
@ -93,7 +94,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
public void testCreateLoadBalancerRuleForPublicIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("createLoadBalancerRuleForPublicIP", String.class,
|
||||
Algorithm.class, String.class, int.class, int.class, CreateLoadBalancerRuleOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6, Algorithm.LEASTCONN, "tcp", 22, 22));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6, Algorithm.LEASTCONN, "tcp", 22, 22));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createLoadBalancerRule.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -109,7 +110,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
|
||||
public void testUpdateLoadBalancerRule() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("updateLoadBalancerRule", String.class, UpdateLoadBalancerRuleOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateLoadBalancerRule&id=5 HTTP/1.1");
|
||||
|
@ -125,7 +126,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
|
||||
public void testDeleteLoadBalancerRule() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("deleteLoadBalancerRule", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteLoadBalancerRule&id=5 HTTP/1.1");
|
||||
|
@ -144,7 +145,7 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("listVirtualMachinesAssignedToLoadBalancerRule",
|
||||
String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listLoadBalancerRuleInstances&listAll=true&id=5 HTTP/1.1");
|
||||
|
|
|
@ -30,10 +30,11 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code NATAsyncClient}
|
||||
|
@ -46,7 +47,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncClient> {
|
||||
public void testListIPForwardingRules() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("listIPForwardingRules", ListIPForwardingRulesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listIpForwardingRules&listAll=true HTTP/1.1");
|
||||
|
@ -63,7 +64,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testListIPForwardingRulesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("listIPForwardingRules", ListIPForwardingRulesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListIPForwardingRulesOptions.Builder.virtualMachineId("3")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -81,7 +82,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testGetIPForwardingRule() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("getIPForwardingRule", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listIpForwardingRules&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -107,7 +108,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7, "tcp", 22));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7, "tcp", 22));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createIpForwardingRule.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -134,7 +135,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7, "tcp", 22,
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7, "tcp", 22,
|
||||
CreateIPForwardingRuleOptions.Builder.endPort(22)));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createIpForwardingRuleOptions.getRequestLine());
|
||||
|
@ -151,7 +152,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testEnableStaticNATForVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("enableStaticNATForVirtualMachine", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, 6));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, 6));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=enableStaticNat&virtualmachineid=5&ipaddressid=6 HTTP/1.1");
|
||||
|
@ -168,7 +169,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testDisableStaticNATOnPublicIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("disableStaticNATOnPublicIP", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=disableStaticNat&ipaddressid=5 HTTP/1.1");
|
||||
|
@ -185,7 +186,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testDeleteIPForwardingRule() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("deleteIPForwardingRule", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteIpForwardingRule&id=5 HTTP/1.1");
|
||||
|
|
|
@ -30,11 +30,12 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code NetworkAsyncClient}
|
||||
|
@ -47,7 +48,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<NetworkAsyncClient> {
|
||||
public void testListNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("listNetworks", ListNetworksOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listNetworks&listAll=true HTTP/1.1");
|
||||
|
@ -64,7 +65,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
|||
|
||||
public void testListNetworksOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("listNetworks", ListNetworksOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListNetworksOptions.Builder.type(NetworkType.ADVANCED)
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListNetworksOptions.Builder.type(NetworkType.ADVANCED)
|
||||
.domainId("6").id("5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -82,7 +83,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
|||
|
||||
public void testGetNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("getNetwork", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("id"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("id"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listNetworks&listAll=true&id=id HTTP/1.1");
|
||||
|
@ -110,7 +111,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
|||
public void testCreateNetworkInZone() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("createNetworkInZone", String.class, String.class, String.class,
|
||||
String.class, CreateNetworkOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createNetwork.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -139,7 +140,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
|||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("createNetworkInZone", String.class, String.class, String.class,
|
||||
String.class, CreateNetworkOptions[].class));
|
||||
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely", CreateNetworkOptions.Builder
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely", CreateNetworkOptions.Builder
|
||||
.netmask("255.255.255.0").domainId("6")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createNetworkOptions.getRequestLine());
|
||||
|
@ -156,7 +157,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
|||
|
||||
public void testDeleteNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("deleteNetwork", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteNetwork&id=5 HTTP/1.1");
|
||||
|
|
|
@ -29,13 +29,13 @@ import org.jclouds.cloudstack.options.ListDiskOfferingsOptions;
|
|||
import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions;
|
||||
import org.jclouds.cloudstack.options.ListServiceOfferingsOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code OfferingAsyncClient}
|
||||
|
@ -48,7 +48,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<OfferingAsyncClient> {
|
||||
public void testListDiskOfferings() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listDiskOfferings", ListDiskOfferingsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listDiskOfferings&listAll=true HTTP/1.1");
|
||||
|
@ -65,7 +65,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testListDiskOfferingsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listDiskOfferings", ListDiskOfferingsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListDiskOfferingsOptions.Builder.domainId("6").id("5")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListDiskOfferingsOptions.Builder.domainId("6").id("5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listDiskOfferings&listAll=true&domainid=6&id=5 HTTP/1.1");
|
||||
|
@ -82,7 +82,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testGetDiskOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("getDiskOffering", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listDiskOfferings&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -100,7 +100,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testListNetworkOfferings() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listNetworkOfferings", ListNetworkOfferingsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listNetworkOfferings&listAll=true HTTP/1.1");
|
||||
|
@ -117,7 +117,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testListNetworkOfferingsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listNetworkOfferings", ListNetworkOfferingsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListNetworkOfferingsOptions.Builder.availability(DEFAULT).isShared(true).id("6")));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -136,7 +136,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testGetNetworkOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("getNetworkOffering", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listNetworkOfferings&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -154,7 +154,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testListServiceOfferings() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listServiceOfferings", ListServiceOfferingsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listServiceOfferings&listAll=true HTTP/1.1");
|
||||
|
@ -171,7 +171,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testListServiceOfferingsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listServiceOfferings", ListServiceOfferingsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListServiceOfferingsOptions.Builder.virtualMachineId("4")
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListServiceOfferingsOptions.Builder.virtualMachineId("4")
|
||||
.domainId("5").id("6")));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -190,7 +190,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
|
||||
public void testGetServiceOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("getServiceOffering", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listServiceOfferings&listAll=true&id=5 HTTP/1.1");
|
||||
|
|
|
@ -32,14 +32,14 @@ import org.jclouds.cloudstack.options.ListSSHKeyPairsOptions;
|
|||
import org.jclouds.crypto.SshKeys;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code SSHKeyPairAsyncClient}
|
||||
|
@ -51,7 +51,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
|
||||
public void testListSSHKeyPairs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("listSSHKeyPairs", ListSSHKeyPairsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&listAll=true HTTP/1.1");
|
||||
|
@ -68,7 +68,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
|
||||
public void testListSSHKeyPairsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("listSSHKeyPairs", ListSSHKeyPairsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSSHKeyPairsOptions.Builder.name("jclouds")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSSHKeyPairsOptions.Builder.name("jclouds")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&listAll=true&name=jclouds HTTP/1.1");
|
||||
|
@ -85,7 +85,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
|
||||
public void testGetSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("getSSHKeyPair", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSSHKeyPairs&listAll=true&name=jclouds-keypair HTTP/1.1");
|
||||
|
@ -104,7 +104,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
public void testRegisterSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("registerSSHKeyPair", String.class, String.class));
|
||||
String publicKey = URLEncoder.encode(SshKeys.generate().get("public"), "UTF-8");
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair", publicKey));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair", publicKey));
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=registerSSHKeyPair&name=jclouds-keypair&publickey="
|
||||
+ publicKey
|
||||
|
@ -123,7 +123,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
|
||||
public void testDeleteSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("deleteSSHKeyPair", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteSSHKeyPair&name=jclouds-keypair HTTP/1.1");
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
|
@ -38,7 +40,6 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code SecurityGroupAsyncClient}
|
||||
|
@ -52,7 +53,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testListSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("listSecurityGroups", ListSecurityGroupsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSecurityGroups&listAll=true HTTP/1.1");
|
||||
|
@ -69,7 +70,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testListSecurityGroupsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("listSecurityGroups", ListSecurityGroupsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSecurityGroupsOptions.Builder.virtualMachineId("4")
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSecurityGroupsOptions.Builder.virtualMachineId("4")
|
||||
.domainId("5").id("6")));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -88,7 +89,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testGetSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("getSecurityGroup", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSecurityGroups&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -106,7 +107,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("createSecurityGroup", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createSecurityGroup&name=goo HTTP/1.1");
|
||||
|
@ -134,7 +135,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
public void testAuthorizeIngressPortsToCIDRs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToCIDRs", String.class,
|
||||
String.class, int.class, int.class, Iterable.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, "tcp", 22, 22,
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, "tcp", 22, 22,
|
||||
ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress3.getRequestLine());
|
||||
|
@ -167,7 +168,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
public void testAuthorizeIngressPortsToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToSecurityGroups", String.class,
|
||||
String.class, int.class, int.class, Multimap.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, "tcp", 22, 22,
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, "tcp", 22, 22,
|
||||
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress4.getRequestLine());
|
||||
|
@ -195,7 +196,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
public void testAuthorizeIngressICMPToCIDRs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToCIDRs", String.class , int.class,
|
||||
int.class, Iterable.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, 22, 22, ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, 22, 22, ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress1.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -227,7 +228,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
public void testAuthorizeIngressICMPToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToSecurityGroups", String.class,
|
||||
int.class, int.class, Multimap.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, 22, 22,
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, 22, 22,
|
||||
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress2.getRequestLine());
|
||||
|
@ -245,7 +246,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
public void testRevokeIngressRule() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("revokeIngressRule", String.class,
|
||||
AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5,
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5,
|
||||
AccountInDomainOptions.Builder.accountInDomain("adrian", "1")));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -264,7 +265,7 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
|
||||
public void testDeleteSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("deleteSecurityGroup", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteSecurityGroup&id=5 HTTP/1.1");
|
||||
|
|
|
@ -34,12 +34,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests the behaviour of SnapshotAsyncClient.
|
||||
|
@ -54,7 +55,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testCreateSnapshot() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("createSnapshot", String.class, CreateSnapshotOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createSnapshot&volumeid=5 HTTP/1.1");
|
||||
|
@ -70,7 +71,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testCreateSnapshotOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("createSnapshot", String.class, CreateSnapshotOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, CreateSnapshotOptions.Builder.accountInDomain("acc", "7").policyId("9")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, CreateSnapshotOptions.Builder.accountInDomain("acc", "7").policyId("9")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createSnapshot&volumeid=5&account=acc&domainid=7&policyid=9 HTTP/1.1");
|
||||
|
@ -86,7 +87,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testListSnapshots() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("listSnapshots", ListSnapshotsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSnapshots&listAll=true HTTP/1.1");
|
||||
|
@ -102,7 +103,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testGetSnapshot() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("getSnapshot", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSnapshots&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -119,7 +120,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testListSnapshotsOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("listSnapshots", ListSnapshotsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSnapshotsOptions.Builder.accountInDomain("acc", "7").id("5").interval(Snapshot.Interval.MONTHLY).isRecursive(true).keyword("fred").name("fred's snapshot").snapshotType(Snapshot.Type.RECURRING).volumeId("11")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSnapshotsOptions.Builder.accountInDomain("acc", "7").id("5").interval(Snapshot.Interval.MONTHLY).isRecursive(true).keyword("fred").name("fred's snapshot").snapshotType(Snapshot.Type.RECURRING).volumeId("11")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSnapshots&listAll=true&account=acc&domainid=7&id=5&intervaltype=MONTHLY&isrecursive=true&keyword=fred&name=fred%27s%20snapshot&snapshottype=RECURRING&volumeid=11 HTTP/1.1");
|
||||
|
@ -135,7 +136,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testDeleteSnapshot() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("deleteSnapshot", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(14));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(14));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteSnapshot&id=14 HTTP/1.1");
|
||||
|
@ -161,7 +162,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testCreateSnapshotPolicy() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("createSnapshotPolicy", SnapshotPolicySchedule.class, String.class, String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(SnapshotPolicySchedules.monthly(5, 6, 7), 10, "UTC", 12));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(SnapshotPolicySchedules.monthly(5, 6, 7), 10, "UTC", 12));
|
||||
|
||||
assertRequestLineEquals(httpRequest,extractIso.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -176,7 +177,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testDeleteSnapshotPolicy() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("deleteSnapshotPolicy", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteSnapshotPolicies&id=7 HTTP/1.1");
|
||||
|
@ -193,7 +194,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
public void testDeleteSnapshotPolicies() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("deleteSnapshotPolicies", Iterable.class));
|
||||
Iterable<String> ids = ImmutableSet.of("3", "5", "7");
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ids));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ids));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteSnapshotPolicies&ids=3,5,7 HTTP/1.1");
|
||||
|
@ -209,7 +210,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testListSnapshotPolicies() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("listSnapshotPolicies", String.class, ListSnapshotPoliciesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(10));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(10));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSnapshotPolicies&listAll=true&volumeid=10 HTTP/1.1");
|
||||
|
@ -225,7 +226,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
|
||||
public void testListSnapshotPoliciesOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("listSnapshotPolicies", String.class, ListSnapshotPoliciesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(10, ListSnapshotPoliciesOptions.Builder.accountInDomain("fred", "4").keyword("bob")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(10, ListSnapshotPoliciesOptions.Builder.accountInDomain("fred", "4").keyword("bob")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listSnapshotPolicies&listAll=true&volumeid=10&account=fred&domainid=4&keyword=bob HTTP/1.1");
|
||||
|
|
|
@ -41,12 +41,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TemplateAsyncClient}
|
||||
|
@ -60,7 +61,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testCreateTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("createTemplate", TemplateMetadata.class, CreateTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build()));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build()));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=createTemplate&name=thename&ostypeid=10&displaytext=description HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -75,7 +76,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testCreateTemplateOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("createTemplate", TemplateMetadata.class, CreateTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), CreateTemplateOptions.Builder.bits(32).isFeatured(true).isPublic(true).passwordEnabled(true).requiresHVM(true).snapshotId("11").volumeId("12")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), CreateTemplateOptions.Builder.bits(32).isFeatured(true).isPublic(true).passwordEnabled(true).requiresHVM(true).snapshotId("11").volumeId("12")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=createTemplate&bits=32&isfeatured=true&ispublic=true&passwordenabled=true&requireshvm=true&snapshotid=11&volumeid=12&name=thename&ostypeid=10&displaytext=description HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -102,7 +103,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testRegisterTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), Template.Format.QCOW2, "xen", "http://example.com/", 20));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), Template.Format.QCOW2, "xen", "http://example.com/", 20));
|
||||
|
||||
assertRequestLineEquals(httpRequest, registerTemplate.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -138,7 +139,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testRegisterTemplateOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), Template.Format.QCOW2, "xen", "http://example.com/", 20,
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), Template.Format.QCOW2, "xen", "http://example.com/", 20,
|
||||
RegisterTemplateOptions.Builder.accountInDomain("mydomain", "3").bits(32).checksum("ABC").isExtractable(true).isFeatured(true).isPublic(true).passwordEnabled(true).requiresHVM(true)));
|
||||
|
||||
assertRequestLineEquals(httpRequest, registerTemplateOptions.getRequestLine());
|
||||
|
@ -154,7 +155,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testUpdateTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("updateTemplate", String.class, UpdateTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=updateTemplate&id=17 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -169,7 +170,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testUpdateTemplateOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("updateTemplate", String.class, UpdateTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, UpdateTemplateOptions.Builder.bootable(true).displayText("description").format(Template.Format.VHD).name("thename").osTypeId("12").passwordEnabled(true)));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, UpdateTemplateOptions.Builder.bootable(true).displayText("description").format(Template.Format.VHD).name("thename").osTypeId("12").passwordEnabled(true)));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=updateTemplate&id=17&bootable=true&displaytext=description&format=VHD&name=thename&ostypeid=12&passwordenabled=true HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -192,7 +193,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testCopyTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("copyTemplateToZone", String.class, String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, 18, 19));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, 18, 19));
|
||||
|
||||
assertRequestLineEquals(httpRequest,copyTemplate.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -207,7 +208,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testDeleteTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("deleteTemplate", String.class, DeleteTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=deleteTemplate&id=17 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -222,7 +223,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testDeleteTemplateOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("deleteTemplate", String.class, DeleteTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, DeleteTemplateOptions.Builder.zoneId("8")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, DeleteTemplateOptions.Builder.zoneId("8")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=deleteTemplate&id=17&zoneid=8 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -237,7 +238,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testListTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("listTemplates"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listTemplates&listAll=true&templatefilter=executable HTTP/1.1");
|
||||
|
@ -254,7 +255,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testListTemplatesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("listTemplates", ListTemplatesOptions.class));
|
||||
HttpRequest httpRequest = processor
|
||||
GeneratedHttpRequest httpRequest = processor
|
||||
.createRequest(
|
||||
method, ImmutableList.<Object> of(
|
||||
ListTemplatesOptions.Builder.accountInDomain("adrian", "6").hypervisor("xen")
|
||||
|
@ -276,7 +277,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testGetTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("getTemplateInZone", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, 1));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, 1));
|
||||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
|
@ -295,7 +296,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testUpdateTemplatePermissions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("updateTemplatePermissions", String.class, UpdateTemplatePermissionsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=updateTemplatePermissions&id=17 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "");
|
||||
|
@ -310,7 +311,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testUpdateTemplatePermissionsOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("updateTemplatePermissions", String.class, UpdateTemplatePermissionsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, UpdateTemplatePermissionsOptions.Builder.accounts(ImmutableSet.of("5", "6")).isExtractable(true).isFeatured(true).isPublic(true).op(UpdateTemplatePermissionsOptions.Operation.add)));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, UpdateTemplatePermissionsOptions.Builder.accounts(ImmutableSet.of("5", "6")).isExtractable(true).isFeatured(true).isPublic(true).op(UpdateTemplatePermissionsOptions.Operation.add)));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=updateTemplatePermissions&id=17&accounts=5,6&isextractable=true&isfeatured=true&ispublic=true&op=add HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "");
|
||||
|
@ -325,7 +326,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testListTemplatePermissions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("listTemplatePermissions", String.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=listTemplatePermissions&listAll=true&id=17 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -340,7 +341,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testListTemplatePermissionsOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("listTemplatePermissions", String.class, AccountInDomainOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, AccountInDomainOptions.Builder.accountInDomain("fred", "8")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, AccountInDomainOptions.Builder.accountInDomain("fred", "8")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=listTemplatePermissions&listAll=true&id=17&account=fred&domainid=8 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -363,7 +364,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testExtractTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractTemplate.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -387,7 +388,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
|
||||
public void testExtractTemplateOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractTemplateOptions.Builder.url("http://example.com/")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractTemplateOptions.Builder.url("http://example.com/")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractTemplateOptions.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
|
|
@ -29,14 +29,14 @@ import org.jclouds.cloudstack.options.ListVMGroupsOptions;
|
|||
import org.jclouds.cloudstack.options.UpdateVMGroupOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VMGroupAsyncClient}
|
||||
|
@ -50,7 +50,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
|
|||
|
||||
public void testListVMGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("listInstanceGroups", ListVMGroupsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listInstanceGroups&listAll=true HTTP/1.1");
|
||||
|
@ -67,7 +67,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
|
|||
|
||||
public void testListVMGroupsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("listInstanceGroups", ListVMGroupsOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListVMGroupsOptions.Builder.account("fred")
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListVMGroupsOptions.Builder.account("fred")
|
||||
.domainId("5").id("6")));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -86,7 +86,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
|
|||
|
||||
public void testGetVMGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("getInstanceGroup", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listInstanceGroups&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -104,7 +104,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
|
|||
|
||||
public void testCreateVMGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("createInstanceGroup", String.class, CreateVMGroupOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createInstanceGroup&name=goo HTTP/1.1");
|
||||
|
@ -121,7 +121,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
|
|||
|
||||
public void testCreateVMGroupOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("createInstanceGroup", String.class, CreateVMGroupOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo", CreateVMGroupOptions.Builder.account("foo").domainId("42")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo", CreateVMGroupOptions.Builder.account("foo").domainId("42")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=createInstanceGroup&name=goo&account=foo&domainid=42 HTTP/1.1");
|
||||
|
@ -138,7 +138,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
|
|||
|
||||
public void testUpdateVMGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("updateInstanceGroup", String.class, UpdateVMGroupOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, UpdateVMGroupOptions.Builder.name("fred")));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, UpdateVMGroupOptions.Builder.name("fred")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateInstanceGroup&id=5&name=fred HTTP/1.1");
|
||||
|
@ -155,7 +155,7 @@ public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGrou
|
|||
|
||||
public void testDeleteVMGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("deleteInstanceGroup", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteInstanceGroup&id=5 HTTP/1.1");
|
||||
|
|
|
@ -31,11 +31,12 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VirtualMachineAsyncClient}
|
||||
|
@ -49,7 +50,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("listVirtualMachines",
|
||||
ListVirtualMachinesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listVirtualMachines&listAll=true HTTP/1.1");
|
||||
|
@ -67,7 +68,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testListVirtualMachinesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("listVirtualMachines",
|
||||
ListVirtualMachinesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListVirtualMachinesOptions.Builder.accountInDomain("adrian", "6").usesVirtualNetwork(true)));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -86,7 +87,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testGetVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("getVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listVirtualMachines&listAll=true&id=5 HTTP/1.1");
|
||||
|
@ -113,7 +114,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testDeployVirtualMachineInZone() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("deployVirtualMachineInZone", String.class, String.class,
|
||||
String.class, DeployVirtualMachineOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6, 4, 5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6, 4, 5));
|
||||
|
||||
assertRequestLineEquals(httpRequest, deployVirtualMachine.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -129,7 +130,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testRebootVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("rebootVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=rebootVirtualMachine&id=5 HTTP/1.1");
|
||||
|
@ -146,7 +147,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testStartVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("startVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=startVirtualMachine&id=5 HTTP/1.1");
|
||||
|
@ -163,7 +164,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testStopVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("stopVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=stopVirtualMachine&id=5 HTTP/1.1");
|
||||
|
@ -180,7 +181,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testResetPasswordForVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("resetPasswordForVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=resetPasswordForVirtualMachine&id=5 HTTP/1.1");
|
||||
|
@ -197,7 +198,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testChangeServiceForVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("changeServiceForVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=changeServiceForVirtualMachine&id=5 HTTP/1.1");
|
||||
|
@ -214,7 +215,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testUpdateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("updateVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=updateVirtualMachine&id=5 HTTP/1.1");
|
||||
|
@ -231,7 +232,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
|
||||
public void testDestroyVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("destroyVirtualMachine", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=destroyVirtualMachine&id=5 HTTP/1.1");
|
||||
|
@ -249,7 +250,7 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
public void testAssignVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("assignVirtualMachine", String.class,
|
||||
AssignVirtualMachineOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("abcd",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("abcd",
|
||||
AssignVirtualMachineOptions.Builder.accountInDomain("adrian", "6")));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
|
|
@ -26,10 +26,11 @@ import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListVolumesOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code EventAsyncClient}
|
||||
|
@ -43,7 +44,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
|
||||
public void testListVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("listVolumes", ListVolumesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listVolumes&listAll=true HTTP/1.1");
|
||||
|
@ -59,7 +60,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
|
||||
public void testGetVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("getVolume", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listVolumes&listAll=true&id=111 HTTP/1.1");
|
||||
|
@ -84,7 +85,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("createVolumeFromSnapshotInZone", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-volume", 999L, 111l));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-volume", 999L, 111l));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createVolumeFromSnapshot.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -107,7 +108,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("createVolumeFromDiskOfferingInZone", String.class, String.class,
|
||||
String.class));
|
||||
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-volume", 999L, 111L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-volume", 999L, 111L));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createVolumeFromDiskOffering.getRequestLine());
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||
|
@ -121,7 +122,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("attachVolume", String.class, String.class));
|
||||
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L, 999L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L, 999L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=attachVolume&id=111&virtualmachineid=999 HTTP/1.1");
|
||||
|
@ -136,7 +137,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("detachVolume", String.class));
|
||||
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=detachVolume&id=111 HTTP/1.1");
|
||||
|
@ -150,7 +151,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
|
||||
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("deleteVolume", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=deleteVolume&id=111 HTTP/1.1");
|
||||
|
|
|
@ -25,14 +25,14 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListZonesOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code ZoneAsyncClient}
|
||||
|
@ -45,7 +45,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsyncClient> {
|
||||
public void testListZones() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ZoneAsyncClient.class.getMethod("listZones", ListZonesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listZones&listAll=true HTTP/1.1");
|
||||
|
@ -53,8 +53,8 @@ public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsync
|
|||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
// now make sure request filters apply by replaying
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(
|
||||
httpRequest,
|
||||
|
@ -72,7 +72,7 @@ public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsync
|
|||
|
||||
public void testListZonesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ZoneAsyncClient.class.getMethod("listZones", ListZonesOptions[].class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListZonesOptions.Builder.available(true).domainId("5")
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListZonesOptions.Builder.available(true).domainId("5")
|
||||
.id("6")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -90,7 +90,7 @@ public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsync
|
|||
|
||||
public void testGetZone() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ZoneAsyncClient.class.getMethod("getZone", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
"GET http://localhost:8080/client/api?response=json&command=listZones&listAll=true&id=6 HTTP/1.1");
|
||||
|
|
|
@ -34,11 +34,12 @@ import org.jclouds.ec2.xml.PermissionHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AMIAsyncClient}
|
||||
|
@ -65,9 +66,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -98,10 +99,10 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId", new CreateImageOptions()
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId", new CreateImageOptions()
|
||||
.withDescription("description").noReboot()));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -129,9 +130,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -164,10 +165,10 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||
"1", "2")));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -195,9 +196,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
|
||||
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -227,9 +228,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -259,10 +260,10 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest", new RegisterImageOptions()
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest", new RegisterImageOptions()
|
||||
.withDescription("description")));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -294,9 +295,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -335,11 +336,11 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId",
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId",
|
||||
new RegisterImageBackedByEbsOptions().withDescription("description").addBlockDeviceFromSnapshot(
|
||||
"/dev/device", null, "snapshot").addNewBlockDevice("/dev/newdevice", "newblock", 100)));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -369,9 +370,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -400,9 +401,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
|
||||
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -436,10 +437,10 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -473,10 +474,10 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -505,9 +506,9 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -29,12 +29,12 @@ import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions;
|
|||
import org.jclouds.ec2.options.DescribeRegionsOptions;
|
||||
import org.jclouds.ec2.xml.DescribeAvailabilityZonesResponseHandler;
|
||||
import org.jclouds.ec2.xml.DescribeRegionsResponseHandler;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AvailabilityZoneAndRegionAsyncClient}
|
||||
|
@ -49,7 +49,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
public void testDescribeAvailabilityZones() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeAvailabilityZonesInRegion",
|
||||
String.class, DescribeAvailabilityZonesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(Region.US_WEST_1));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(Region.US_WEST_1));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-west-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-west-1.amazonaws.com\n");
|
||||
|
@ -66,7 +66,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
public void testDescribeAvailabilityZonesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeAvailabilityZonesInRegion",
|
||||
String.class, DescribeAvailabilityZonesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("us-east-1", availabilityZones("us-east-1a", "us-east-1b")));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("us-east-1", availabilityZones("us-east-1a", "us-east-1b")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -84,7 +84,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
public void testDescribeRegions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeRegions",
|
||||
DescribeRegionsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -101,7 +101,7 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
public void testDescribeRegionsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeRegions",
|
||||
DescribeRegionsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(regions(Region.US_EAST_1, Region.US_WEST_1)));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(regions(Region.US_EAST_1, Region.US_WEST_1)));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -36,11 +36,12 @@ import org.jclouds.ec2.xml.SnapshotHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code ElasticBlockStoreAsyncClient}
|
||||
|
@ -53,7 +54,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
|
||||
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("deleteVolumeInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -81,9 +82,9 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -100,7 +101,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testDescribeVolumesArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -131,9 +132,9 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("attachVolumeInRegion", String.class, String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", "instanceId", "/device"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", "instanceId", "/device"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -163,9 +164,9 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
||||
boolean.class, DetachVolumeOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", false));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", false));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -197,10 +198,10 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
||||
boolean.class, DetachVolumeOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", true, fromInstance("instanceId").fromDevice(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", true, fromInstance("instanceId").fromDevice(
|
||||
"/device")));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -217,7 +218,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testCreateSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("createSnapshotInRegion", String.class,
|
||||
String.class, CreateSnapshotOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -234,7 +235,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testCreateSnapshotOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("createSnapshotInRegion", String.class,
|
||||
String.class, CreateSnapshotOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId", CreateSnapshotOptions.Builder
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId", CreateSnapshotOptions.Builder
|
||||
.withDescription("description")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -253,7 +254,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testDescribeSnapshots() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion", String.class,
|
||||
DescribeSnapshotsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -270,7 +271,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testDescribeSnapshotsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("describeSnapshotsInRegion", String.class,
|
||||
DescribeSnapshotsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ownedBy("o1", "o2").restorableBy("r1", "r2")
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ownedBy("o1", "o2").restorableBy("r1", "r2")
|
||||
.snapshotIds("s1", "s2")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -290,7 +291,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testGetCreateVolumePermissionForSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("getCreateVolumePermissionForSnapshotInRegion",
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -326,10 +327,10 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("addCreateVolumePermissionsToSnapshotInRegion",
|
||||
String.class, Iterable.class, Iterable.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "snapshotId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -364,10 +365,10 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("removeCreateVolumePermissionsFromSnapshotInRegion",
|
||||
String.class, Iterable.class, Iterable.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "snapshotId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -385,7 +386,7 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("resetCreateVolumePermissionsOnSnapshotInRegion",
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -26,10 +26,11 @@ import org.jclouds.ec2.xml.DescribeAddressesResponseHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code ElasticIPAddressAsyncClient}
|
||||
|
@ -43,7 +44,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
|||
public void testDisassociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticIPAddressAsyncClient.class.getMethod("disassociateAddressInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -73,9 +74,9 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
|||
public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticIPAddressAsyncClient.class.getMethod("associateAddressInRegion", String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1", "me"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1", "me"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -91,7 +92,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
|||
|
||||
public void testReleaseAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticIPAddressAsyncClient.class.getMethod("releaseAddressInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -108,7 +109,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
|||
public void testDescribeAddresses() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticIPAddressAsyncClient.class.getMethod("describeAddressesInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -124,7 +125,7 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
|||
|
||||
public void testAllocateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticIPAddressAsyncClient.class.getMethod("allocateAddressInRegion", String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -39,12 +39,13 @@ import org.jclouds.ec2.xml.UnencodeStringValueHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code InstanceAsyncClient}
|
||||
|
@ -56,7 +57,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyncClient> {
|
||||
public void testDescribeInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("describeInstancesInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -72,7 +73,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testDescribeInstancesArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("describeInstancesInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -89,7 +90,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testTerminateInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("terminateInstancesInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -106,7 +107,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testRunInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("runInstancesInRegion", String.class, String.class,
|
||||
String.class, int.class, int.class, RunInstancesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null, "ami-voo", 1, 1));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null, "ami-voo", 1, 1));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -128,7 +129,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testRunInstancesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("runInstancesInRegion", String.class, String.class,
|
||||
String.class, int.class, int.class, RunInstancesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("eu-west-1", "eu-west-1a", "ami-voo",
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("eu-west-1", "eu-west-1a", "ami-voo",
|
||||
1, 5, new RunInstancesOptions().withKernelId("kernelId").withSecurityGroups("group1", "group2")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.eu-west-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -155,7 +156,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testStopInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("stopInstancesInRegion", String.class, boolean.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, true, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, true, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -171,7 +172,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testRebootInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("rebootInstancesInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -187,7 +188,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testStartInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("startInstancesInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -203,7 +204,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testGetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getUserDataForInstanceInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -221,7 +222,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testGetRootDeviceNameForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getRootDeviceNameForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -238,7 +239,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testGetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getRamdiskForInstanceInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -257,7 +258,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("isApiTerminationDisabledForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -274,7 +275,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testGetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getKernelForInstanceInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -291,7 +292,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testGetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getInstanceTypeForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -310,7 +311,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -330,7 +331,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getBlockDeviceMappingForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -362,9 +363,9 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", String.class, String.class,
|
||||
byte[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test".getBytes()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test".getBytes()));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -395,9 +396,9 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -428,9 +429,9 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -462,9 +463,9 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setApiTerminationDisabledForInstanceInRegion", String.class,
|
||||
String.class, boolean.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", true));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", true));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -495,9 +496,9 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceType.C1_MEDIUM));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceType.C1_MEDIUM));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -529,9 +530,9 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class, InstanceInitiatedShutdownBehavior.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceInitiatedShutdownBehavior.TERMINATE));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceInitiatedShutdownBehavior.TERMINATE));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -552,7 +553,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
||||
mapping.put("/dev/sda1", new BlockDevice("vol-test1", true));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -574,7 +575,7 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testGetConsoleOutputForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getConsoleOutputForInstanceInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -22,13 +22,13 @@ import java.io.IOException;
|
|||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.ec2.xml.DescribeKeyPairsResponseHandler;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code KeyPairAsyncClient}
|
||||
|
@ -41,7 +41,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
|
|||
|
||||
public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(KeyPairAsyncClient.class.getMethod("deleteKeyPairInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -57,7 +57,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
|
|||
|
||||
public void testDescribeKeyPairs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(KeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -73,7 +73,7 @@ public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncC
|
|||
|
||||
public void testDescribeKeyPairsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(KeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -28,10 +28,11 @@ import org.jclouds.ec2.xml.DescribeSecurityGroupsResponseHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code SecurityGroupAsyncClient}
|
||||
|
@ -45,7 +46,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testDeleteSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("deleteSecurityGroupInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -75,9 +76,9 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion", String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "description"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "description"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -94,7 +95,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testDescribeSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -111,7 +112,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testDescribeSecurityGroupsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -128,7 +129,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testAuthorizeSecurityGroupIngressGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("authorizeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, UserIdGroupPair.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", new UserIdGroupPair("sourceUser",
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", new UserIdGroupPair("sourceUser",
|
||||
"sourceGroup")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -164,9 +165,9 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testAuthorizeSecurityGroupIngressCidr() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("authorizeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, IpProtocol.class, int.class, int.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertPayloadEquals(request, authorizeSecurityGroupIngressCidr.getPayload().getRawContent().toString(),
|
||||
|
@ -182,7 +183,7 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testRevokeSecurityGroupIngressGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("revokeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, UserIdGroupPair.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", new UserIdGroupPair("sourceUser",
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", new UserIdGroupPair("sourceUser",
|
||||
"sourceGroup")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -218,9 +219,9 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
public void testRevokeSecurityGroupIngressCidr() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("revokeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, IpProtocol.class, int.class, int.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -26,10 +26,11 @@ import org.jclouds.ec2.xml.BundleTaskHandler;
|
|||
import org.jclouds.ec2.xml.DescribeBundleTasksResponseHandler;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code WindowsAsyncClient}
|
||||
|
@ -59,7 +60,7 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
public void testBundleInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(WindowsAsyncClient.class.getMethod("bundleInstanceInRegion", String.class, String.class,
|
||||
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class));
|
||||
HttpRequest request = processor
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(
|
||||
method,
|
||||
Lists.<Object> newArrayList(
|
||||
|
@ -69,7 +70,7 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
"my-bucket",
|
||||
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -103,7 +104,7 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
public void testBundleInstanceInRegionOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(WindowsAsyncClient.class.getMethod("bundleInstanceInRegion", String.class, String.class,
|
||||
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class));
|
||||
HttpRequest request = processor
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(
|
||||
method,
|
||||
Lists.<Object> newArrayList(
|
||||
|
@ -114,7 +115,7 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}",
|
||||
BundleInstanceS3StorageOptions.Builder.bucketOwnedBy("10QMXFEV71ZS32XQFTR2")));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -130,7 +131,7 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
|
||||
public void testDescribeBundleTasks() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(WindowsAsyncClient.class.getMethod("describeBundleTasksInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -146,7 +147,7 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
|
||||
public void testDescribeBundleTasksArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(WindowsAsyncClient.class.getMethod("describeBundleTasksInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -45,12 +45,13 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code ElasticStackAsyncClient}
|
||||
|
@ -62,15 +63,15 @@ import com.google.common.reflect.Invokable;
|
|||
public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStackAsyncClient> {
|
||||
public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listServers"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
// now make sure request filters apply by replaying
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
|
@ -89,7 +90,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testListServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listServerInfo"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -104,7 +105,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testGetServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("getServerInfo", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -120,7 +121,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testCreateAndStartServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("createAndStartServer", Server.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/create HTTP/1.1");
|
||||
|
@ -137,7 +138,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("createServer", Server.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/create/stopped HTTP/1.1");
|
||||
|
@ -154,7 +155,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testSetServerConfiguration() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("setServerConfiguration", String.class, Server.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/100/set HTTP/1.1");
|
||||
|
@ -171,7 +172,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testDestroyServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("destroyServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -187,7 +188,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testStartServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("startServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/start HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -203,7 +204,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testStopServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("stopServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/stop HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -219,7 +220,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testShutdownServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("shutdownServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/shutdown HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -235,7 +236,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testResetServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("resetServer", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/reset HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -251,15 +252,15 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testListDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listDrives"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/list HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
assertPayloadEquals(httpRequest, null, null, false);
|
||||
|
||||
// now make sure request filters apply by replaying
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
httpRequest = (GeneratedHttpRequest) Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/list HTTP/1.1");
|
||||
// for example, using basic authentication, we should get "only one"
|
||||
|
@ -278,7 +279,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testListDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listDriveInfo"));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -293,7 +294,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testGetDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("getDriveInfo", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/uuid/info HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -309,7 +310,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testCreateDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("createDrive", Drive.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
new CreateDriveRequest.Builder().name("foo").size(10000l).build()));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/create HTTP/1.1");
|
||||
|
@ -326,7 +327,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testSetDriveData() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("setDriveData", String.class, DriveData.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
new DriveData.Builder().name("foo").size(10000l).tags(ImmutableList.of("production", "candy")).build()));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/set HTTP/1.1");
|
||||
|
@ -343,7 +344,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testDestroyDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("destroyDrive", String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/uuid/destroy HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -359,7 +360,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testImageDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("imageDrive", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/200/image/100 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: text/plain\n");
|
||||
|
@ -376,7 +377,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
public void testImageDriveWithConversion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("imageDrive", String.class, String.class,
|
||||
ImageConversionType.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200",
|
||||
ImageConversionType.GUNZIP));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/200/image/100/gunzip HTTP/1.1");
|
||||
|
@ -393,7 +394,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testReadDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("readDrive", String.class, long.class, long.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", 1024, 2048));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", 1024, 2048));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/read/1024/2048 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/octet-stream\n");
|
||||
|
@ -408,7 +409,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testWriteDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("writeDrive", String.class, Payload.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
Payloads.newStringPayload("foo")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/write HTTP/1.1");
|
||||
|
@ -424,7 +425,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
|
||||
public void testWriteDriveOffset() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("writeDrive", String.class, Payload.class, long.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
Payloads.newStringPayload("foo"), 2048));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/100/write/2048 HTTP/1.1");
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Provides;
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.jclouds.blobstore.functions.BlobToHttpGetOptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
import org.jclouds.s3.S3AsyncClient;
|
||||
import org.jclouds.s3.blobstore.functions.BlobToObject;
|
||||
|
@ -37,7 +38,6 @@ import org.jclouds.s3.domain.S3Object;
|
|||
import org.jclouds.s3.options.PutObjectOptions;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
/**
|
||||
|
@ -53,21 +53,19 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
private final Invokable<?, ?> getMethod;
|
||||
private final Invokable<?, ?> deleteMethod;
|
||||
private final Invokable<?, ?> createMethod;
|
||||
private final Class<T> interfaceType;
|
||||
|
||||
@Inject
|
||||
public S3BlobRequestSigner(RestAnnotationProcessor processor, BlobToObject blobToObject,
|
||||
BlobToHttpGetOptions blob2HttpGetOptions, Class<T> interfaceType) throws SecurityException,
|
||||
NoSuchMethodException {
|
||||
this.processor = checkNotNull(processor, "processor");
|
||||
this.interfaceType = checkNotNull(interfaceType, "interfaceType");
|
||||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
|
||||
this.getMethod = TypeToken.of(interfaceType).method(
|
||||
this.getMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("getObject", String.class, String.class, GetOptions[].class));
|
||||
this.deleteMethod = TypeToken.of(interfaceType).method(
|
||||
this.deleteMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("deleteObject", String.class, String.class));
|
||||
this.createMethod = TypeToken.of(interfaceType).method(
|
||||
this.createMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("putObject", String.class, S3Object.class, PutObjectOptions[].class));
|
||||
}
|
||||
|
||||
|
@ -75,7 +73,7 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
public HttpRequest signGetBlob(String container, String name) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, getMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create( getMethod,
|
||||
ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
|
@ -88,7 +86,7 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
public HttpRequest signPutBlob(String container, Blob blob) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(blob, "blob");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, createMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create( createMethod,
|
||||
ImmutableList.<Object> of(container, blobToObject.apply(blob)))));
|
||||
}
|
||||
|
||||
|
@ -101,7 +99,7 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
public HttpRequest signRemoveBlob(String container, String name) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, deleteMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create( deleteMethod,
|
||||
ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
|
@ -109,7 +107,7 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
public HttpRequest signGetBlob(String container, String name, org.jclouds.blobstore.options.GetOptions options) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, getMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create( getMethod,
|
||||
ImmutableList.of(container, name, blob2HttpGetOptions.apply(checkNotNull(options, "options"))))));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,13 +31,14 @@ import org.jclouds.blobstore.BlobStoreFallbacks.ThrowContainerNotFoundOn404;
|
|||
import org.jclouds.blobstore.BlobStoreFallbacks.ThrowKeyNotFoundOn404;
|
||||
import org.jclouds.blobstore.binders.BindBlobToMultipartFormTest;
|
||||
import org.jclouds.date.TimeStamp;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseETagHeader;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.s3.S3Fallbacks.TrueOn404OrNotFoundFalseOnIllegalState;
|
||||
import org.jclouds.s3.config.S3RestClientModule;
|
||||
import org.jclouds.s3.domain.AccessControlList;
|
||||
|
@ -70,7 +71,6 @@ import com.google.common.base.Supplier;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
|
@ -94,13 +94,13 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testGetBucketLocation() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketLocation", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?location HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
assertPayloadEquals(request, null, null, false);
|
||||
|
||||
request = filter.filter(request);
|
||||
request = (GeneratedHttpRequest) filter.filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?location HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request,
|
||||
|
@ -117,7 +117,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testGetBucketPayer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketPayer", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?requestPayment HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -132,7 +132,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testSetBucketPayerOwner() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("setBucketPayer", String.class, Payer.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.BUCKET_OWNER));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.BUCKET_OWNER));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -148,7 +148,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testSetBucketPayerRequester() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("setBucketPayer", String.class, Payer.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.REQUESTER));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.REQUESTER));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -165,7 +165,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
public void testListBucket() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("listBucket", String.class,
|
||||
ListBucketOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -180,7 +180,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testBucketExists() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("bucketExists", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?max-keys=0 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -206,7 +206,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("copyObject", String.class, String.class, String.class,
|
||||
String.class, CopyObjectOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationbucket",
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationbucket",
|
||||
"destinationObject"));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://destinationbucket." + url + "/destinationObject HTTP/1.1");
|
||||
|
@ -223,7 +223,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testDeleteBucketIfEmpty() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("deleteBucketIfEmpty", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://bucket." + url + "/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -238,7 +238,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testDeleteObject() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("deleteObject", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://bucket." + url + "/object HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -254,7 +254,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
public void testGetBucketACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketACL", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?acl HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -270,7 +270,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
public void testGetObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getObject", String.class, String.class, GetOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/object HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -286,7 +286,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
public void testGetObjectACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getObjectACL", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/object?acl HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -302,7 +302,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
public void testObjectExists() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("objectExists", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://bucket." + url + "/object HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -318,7 +318,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
public void testHeadObject() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("headObject", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://bucket." + url + "/object HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -333,7 +333,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testListOwnedBuckets() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("listOwnedBuckets"));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://" + url + "/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: " + url + "\n");
|
||||
|
@ -353,7 +353,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testPutBucketACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("putBucketACL", String.class, AccessControlList.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", AccessControlList.fromCannedAccessPolicy(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", AccessControlList.fromCannedAccessPolicy(
|
||||
CannedAccessPolicy.PRIVATE, "1234")));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/?acl HTTP/1.1");
|
||||
|
@ -376,7 +376,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
IllegalArgumentException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class,
|
||||
PutBucketOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -394,7 +394,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class
|
||||
.getMethod("putObject", String.class, S3Object.class, PutObjectOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", blobToS3Object
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", blobToS3Object
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/hello HTTP/1.1");
|
||||
|
@ -411,7 +411,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
public void testPutObjectACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class
|
||||
.getMethod("putObjectACL", String.class, String.class, AccessControlList.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "key", AccessControlList.fromCannedAccessPolicy(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "key", AccessControlList.fromCannedAccessPolicy(
|
||||
CannedAccessPolicy.PRIVATE, "1234")));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/key?acl HTTP/1.1");
|
||||
|
@ -432,7 +432,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testGetBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketLogging", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?logging HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -447,7 +447,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testDisableBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("disableBucketLogging", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: bucket." + url + "\n");
|
||||
|
@ -463,7 +463,7 @@ public class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3AsyncClien
|
|||
|
||||
public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("enableBucketLogging", String.class, BucketLogging.class));
|
||||
HttpRequest request = processor
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(method, ImmutableList.<Object> of("bucket", new BucketLogging("mylogs", "access_log-", ImmutableSet
|
||||
.<Grant> of(new Grant(new EmailAddressGrantee("adrian@jclouds.org"), Permission.FULL_CONTROL)))));
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.jclouds.s3.internal.BaseS3AsyncClientTest;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BindAsHostPrefixIfConfigured}
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.testng.annotations.DataProvider;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BindAsHostPrefixIfConfigured}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.SortedSetMultimap;
|
||||
import com.google.common.collect.TreeMultimap;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code RequestAuthorizeSignature}
|
||||
|
@ -87,7 +87,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
|
|||
|
||||
@Test
|
||||
void testAppendBucketNameHostHeader() throws SecurityException, NoSuchMethodException {
|
||||
HttpRequest request = processor.createRequest(
|
||||
GeneratedHttpRequest request = processor.createRequest(
|
||||
Invokable.from(S3AsyncClient.class.getMethod("getBucketLocation", String.class)),
|
||||
ImmutableList.<Object> of("bucket"));
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
@ -144,7 +144,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
|
|||
|
||||
@Test
|
||||
void testAppendBucketNameURIHost() throws SecurityException, NoSuchMethodException {
|
||||
HttpRequest request = processor.createRequest(
|
||||
GeneratedHttpRequest request = processor.createRequest(
|
||||
Invokable.from(S3AsyncClient.class.getMethod("getBucketLocation", String.class)),
|
||||
ImmutableList.<Object> of("bucket"));
|
||||
assertEquals(request.getEndpoint().getHost(), "bucket.s3.amazonaws.com");
|
||||
|
|
|
@ -46,6 +46,8 @@ import org.jclouds.openstack.swift.TemporaryUrlKey;
|
|||
import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
|
||||
import org.jclouds.openstack.swift.domain.SwiftObject;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.rest.internal.RestAnnotationProcessor;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
|
@ -53,7 +55,6 @@ import com.google.common.base.Throwables;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.io.ByteProcessor;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
|
@ -75,7 +76,6 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
private final Invokable<?, ?> getMethod;
|
||||
private final Invokable<?, ?> deleteMethod;
|
||||
private final Invokable<?, ?> createMethod;
|
||||
private final Class<T> interfaceType;
|
||||
|
||||
/**
|
||||
* create a signer for this subtype of swift
|
||||
|
@ -89,7 +89,6 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
@TemporaryUrlKey Supplier<String> temporaryUrlKeySupplier, RestAnnotationProcessor processor,
|
||||
Class<T> interfaceType) throws SecurityException, NoSuchMethodException {
|
||||
this.processor = checkNotNull(processor, "processor");
|
||||
this.interfaceType = checkNotNull(interfaceType, "interfaceType");
|
||||
this.crypto = checkNotNull(crypto, "crypto");
|
||||
|
||||
this.unixEpochTimestampProvider = checkNotNull(unixEpochTimestampProvider, "unixEpochTimestampProvider");
|
||||
|
@ -98,11 +97,11 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
|
||||
|
||||
this.getMethod = TypeToken.of(interfaceType).method(
|
||||
this.getMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("getObject", String.class, String.class, GetOptions[].class));
|
||||
this.deleteMethod = TypeToken.of(interfaceType).method(
|
||||
this.deleteMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("removeObject", String.class, String.class));
|
||||
this.createMethod = TypeToken.of(interfaceType).method(
|
||||
this.createMethod = Invokable.from(TypeToken.of(interfaceType),
|
||||
interfaceType.getMethod("putObject", String.class, SwiftObject.class));
|
||||
}
|
||||
|
||||
|
@ -110,7 +109,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
public HttpRequest signGetBlob(String container, String name) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, getMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create(getMethod,
|
||||
ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
|
@ -118,7 +117,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
public HttpRequest signGetBlob(String container, String name, long timeInSeconds) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
HttpRequest request = processor.apply(Invocation.create(interfaceType, getMethod,
|
||||
GeneratedHttpRequest request = processor.apply(Invocation.create(getMethod,
|
||||
ImmutableList.<Object> of(container, name)));
|
||||
return cleanRequest(signForTemporaryAccess(request, timeInSeconds));
|
||||
}
|
||||
|
@ -127,7 +126,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
public HttpRequest signGetBlob(String container, String name, org.jclouds.blobstore.options.GetOptions options) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, getMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create(getMethod,
|
||||
ImmutableList.of(container, name, blob2HttpGetOptions.apply(checkNotNull(options, "options"))))));
|
||||
}
|
||||
|
||||
|
@ -135,7 +134,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
public HttpRequest signPutBlob(String container, Blob blob) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(blob, "blob");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, createMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create(createMethod,
|
||||
ImmutableList.<Object> of(container, blobToObject.apply(blob)))));
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
public HttpRequest signPutBlob(String container, Blob blob, long timeInSeconds) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(blob, "blob");
|
||||
HttpRequest request = processor.apply(Invocation.create(interfaceType, createMethod,
|
||||
GeneratedHttpRequest request = processor.apply(Invocation.create(createMethod,
|
||||
ImmutableList.<Object> of(container, blobToObject.apply(blob))));
|
||||
return cleanRequest(signForTemporaryAccess(request, timeInSeconds));
|
||||
}
|
||||
|
@ -152,7 +151,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
public HttpRequest signRemoveBlob(String container, String name) {
|
||||
checkNotNull(container, "container");
|
||||
checkNotNull(name, "name");
|
||||
return cleanRequest(processor.apply(Invocation.create(interfaceType, deleteMethod,
|
||||
return cleanRequest(processor.apply(Invocation.create(deleteMethod,
|
||||
ImmutableList.<Object> of(container, name))));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.nnsoft.guice.rocoto.Rocoto;
|
|||
import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
|
|
@ -26,12 +26,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.xml.SupportedVersionsHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudVersionsAsyncClient}
|
||||
|
@ -44,7 +45,7 @@ public class VCloudVersionsAsyncClientTest extends BaseAsyncClientTest<VCloudVer
|
|||
|
||||
public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VCloudVersionsAsyncClient.class.getMethod("getSupportedVersions"));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
|
|
@ -22,8 +22,9 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
import org.jclouds.vcloud.xml.CatalogHandler;
|
||||
|
@ -31,7 +32,6 @@ import org.jclouds.vcloud.xml.CatalogItemHandler;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code CatalogAsyncClient}
|
||||
|
@ -45,7 +45,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
|
||||
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CatalogAsyncClient.class.getMethod("getCatalog", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
|
||||
|
@ -61,7 +61,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
|
||||
public void testCatalogInOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CatalogAsyncClient.class.getMethod("findCatalogInOrgNamed", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
|
||||
|
@ -76,7 +76,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
|
||||
public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CatalogAsyncClient.class.getMethod("getCatalogItem", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
|
||||
|
@ -93,7 +93,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CatalogAsyncClient.class.getMethod("findCatalogItemInOrgCatalogNamed", String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "item"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "item"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
|
||||
|
@ -110,7 +110,7 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CatalogAsyncClient.class.getMethod("addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
|
||||
URI.class, String.class, CatalogItemOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("http://fooentity"), URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("http://fooentity"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), "myname", CatalogItemOptions.Builder
|
||||
.description("mydescription")));
|
||||
|
||||
|
|
|
@ -22,14 +22,14 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.OrgNetworkHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code NetworkAsyncClient}
|
||||
|
@ -43,7 +43,7 @@ public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest<NetworkAsy
|
|||
|
||||
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("getNetwork", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/2")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
|
||||
|
@ -60,7 +60,7 @@ public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest<NetworkAsy
|
|||
public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("findNetworkInOrgVDCNamed", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
|
||||
|
|
|
@ -23,15 +23,15 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.OrgHandler;
|
||||
import org.jclouds.vcloud.xml.OrgListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code OrgAsyncClient}
|
||||
|
@ -45,7 +45,7 @@ public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient
|
|||
|
||||
public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OrgAsyncClient.class.getMethod("listOrgs"));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.orgList+xml\n");
|
||||
|
@ -60,7 +60,7 @@ public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient
|
|||
|
||||
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OrgAsyncClient.class.getMethod("getOrg", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
||||
|
@ -76,7 +76,7 @@ public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient
|
|||
|
||||
public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OrgAsyncClient.class.getMethod("findOrgNamed", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
|
||||
|
|
|
@ -22,16 +22,16 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
import org.jclouds.vcloud.xml.TasksListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code TaskAsyncClient}
|
||||
|
@ -45,7 +45,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClie
|
|||
|
||||
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TaskAsyncClient.class.getMethod("getTasksList", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
||||
|
@ -61,7 +61,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClie
|
|||
|
||||
public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TaskAsyncClient.class.getMethod("findTasksListInOrgNamed", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
|
||||
|
@ -76,7 +76,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClie
|
|||
|
||||
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TaskAsyncClient.class.getMethod("getTask", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
|
||||
|
@ -92,7 +92,7 @@ public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClie
|
|||
|
||||
public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TaskAsyncClient.class.getMethod("cancelTask", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
|
||||
|
|
|
@ -23,9 +23,10 @@ import java.net.URI;
|
|||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.options.CloneVAppOptions;
|
||||
|
@ -34,7 +35,6 @@ import org.jclouds.vcloud.xml.VAppHandler;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VAppAsyncClient}
|
||||
|
@ -49,7 +49,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapp"));
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
public void testCopyVAppToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
|
||||
.deploy().powerOn().description("The description of the new vApp")));
|
||||
|
@ -90,7 +90,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
public void testMoveVAppToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("moveVAppToVDCAndRename", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
|
||||
.deploy().powerOn().description("The description of the new vApp")));
|
||||
|
@ -110,7 +110,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("deployVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
||||
|
@ -127,7 +127,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testDeployAndPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("deployAndPowerOnVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
||||
|
@ -144,7 +144,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("getVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
||||
|
@ -160,7 +160,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testRebootVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("rebootVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -177,7 +177,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("undeployVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -195,7 +195,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testUndeployAndSaveStateOfVAppSaveState() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("undeployAndSaveStateOfVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -214,7 +214,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("deleteVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
|
||||
|
@ -230,7 +230,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("powerOnVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -247,7 +247,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("powerOffVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -264,7 +264,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("resetVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -281,7 +281,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("suspendVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -298,7 +298,7 @@ public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClie
|
|||
|
||||
public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("shutdownVApp", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
|
|
@ -24,9 +24,10 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.ovf.xml.EnvelopeHandler;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.network.FenceMode;
|
||||
import org.jclouds.vcloud.domain.network.NetworkConfig;
|
||||
|
@ -40,7 +41,6 @@ import org.jclouds.vcloud.xml.VAppTemplateHandler;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VAppTemplateAsyncClient}
|
||||
|
@ -56,7 +56,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
URI.class, URI.class, InstantiateVAppTemplateOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("my-vapp", URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("my-vapp", URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/3"),
|
||||
addNetworkConfig(new NetworkConfig("aloha", URI
|
||||
|
@ -89,7 +89,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
public void testcopyVAppTemplateToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/4181"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapptemplate"));
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
public void testcopyVAppTemplateToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
|
||||
new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
|
||||
|
@ -130,7 +130,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
public void testmoveVAppTemplateToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("moveVAppTemplateToVDCAndRename", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/201"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server",
|
||||
new CloneVAppTemplateOptions().description("The description of the new vAppTemplate")));
|
||||
|
@ -151,7 +151,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
public void testcaptureVAppAsTemplateInVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
URI.class, CaptureVAppOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), "my-template", URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
|
||||
|
||||
|
@ -172,7 +172,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
public void testcaptureVAppAsTemplateInVDCOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
URI.class, CaptureVAppOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), "my-template", URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), new CaptureVAppOptions()
|
||||
.withDescription("The description of the new vApp Template")));
|
||||
|
@ -193,7 +193,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
public void testFindVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("findVAppTemplateInOrgCatalogNamed", String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "template"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "template"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vAppTemplate+xml\n");
|
||||
|
@ -208,7 +208,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
|
||||
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("getVAppTemplate", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2 HTTP/1.1");
|
||||
|
@ -224,7 +224,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
|
||||
public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("getOvfEnvelopeForVAppTemplate", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2/ovf HTTP/1.1");
|
||||
|
|
|
@ -23,15 +23,15 @@ import java.net.URI;
|
|||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.VDCHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VDCAsyncClient}
|
||||
|
@ -57,7 +57,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient
|
|||
|
||||
public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "vdc"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "vdc"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
|
||||
|
@ -72,7 +72,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient
|
|||
|
||||
public void testFindVDCInOrgNamedNullOrgAndVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vdc+xml\n");
|
||||
|
@ -87,7 +87,7 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient
|
|||
|
||||
public void testGetVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VDCAsyncClient.class.getMethod("getVDC", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vdc/1 HTTP/1.1");
|
||||
|
|
|
@ -22,10 +22,11 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.ReturnInputStream;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
|
@ -36,7 +37,6 @@ import org.testng.annotations.DataProvider;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VmAsyncClient}
|
||||
|
@ -50,7 +50,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("getScreenThumbnailForVm", URI.class));
|
||||
HttpRequest request = processor
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(method, ImmutableList.<Object> of(URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
assertRequestLineEquals(request, "GET http://vcloud.example.com/api/v1.0/vApp/vm-12/screen HTTP/1.1");
|
||||
|
@ -71,7 +71,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
GuestCustomizationSection guest = new GuestCustomizationSection(URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12/guestCustomizationSection"));
|
||||
guest.setCustomizationScript("cat > /tmp/foo.txt<<EOF\nI love candy\nEOF");
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(guest, URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(guest, URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -89,7 +89,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testUpdateCPUCountOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("updateCPUCountOfVm", int.class, URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -107,7 +107,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testUpdateMemoryMBOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("updateMemoryMBOfVm", int.class, URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(512, URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(512, URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -125,7 +125,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testDeployVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("deployVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
||||
|
@ -142,7 +142,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testDeployAndPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("deployAndPowerOnVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
|
||||
|
@ -159,7 +159,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testGetVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("getVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vm/1")));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vm/1 HTTP/1.1");
|
||||
|
@ -175,7 +175,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testRebootVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("rebootVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -192,7 +192,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testUndeployVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("undeployVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -210,7 +210,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testUndeployAndSaveStateOfVmSaveState() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("undeployAndSaveStateOfVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -229,7 +229,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testPowerOnVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("powerOnVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -246,7 +246,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testPowerOffVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("powerOffVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -263,7 +263,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testResetVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("resetVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -280,7 +280,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testSuspendVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("suspendVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -297,7 +297,7 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
public void testShutdownVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("shutdownVm", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.nnsoft.guice.rocoto.Rocoto;
|
|||
import org.nnsoft.guice.rocoto.configuration.ConfigurationModule;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
|
|
@ -30,14 +30,15 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.endpoints.VCloudLogin;
|
||||
import org.jclouds.vcloud.functions.ParseLoginResponseFromHeaders;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Provides;
|
||||
|
@ -53,7 +54,7 @@ public class VCloudLoginAsyncClientTest extends BaseAsyncClientTest<VCloudLoginA
|
|||
|
||||
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VCloudLoginAsyncClient.class.getMethod("login"));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.orgList+xml\n");
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BlobStoreUtils}
|
||||
|
|
|
@ -26,12 +26,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.IntegrationTestAsyncClient;
|
||||
import org.jclouds.http.IntegrationTestClient;
|
||||
import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.AnonymousRestApiMetadata;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code OpenStackAuthAsyncClient}
|
||||
|
@ -44,7 +45,7 @@ public class OpenStackAuthAsyncClientTest extends BaseAsyncClientTest<OpenStackA
|
|||
|
||||
public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OpenStackAuthAsyncClient.class.getMethod("authenticate", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Auth-Key: bar\nX-Auth-User: foo\n");
|
||||
|
@ -58,7 +59,7 @@ public class OpenStackAuthAsyncClientTest extends BaseAsyncClientTest<OpenStackA
|
|||
|
||||
public void testAuthenticateStorage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OpenStackAuthAsyncClient.class.getMethod("authenticateStorage", String.class, String.class));
|
||||
HttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: */*\nHost: localhost:8080\nX-Storage-Pass: bar\nX-Storage-User: foo\n");
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jclouds.reflect.Invocation;
|
|||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
public class BasePayloadTest {
|
||||
|
||||
|
|
|
@ -30,14 +30,15 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin;
|
||||
import org.jclouds.trmk.vcloud_0_8.functions.ParseLoginResponseFromHeaders;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.Provides;
|
||||
|
@ -54,7 +55,7 @@ public class TerremarkVCloudLoginAsyncClientTest extends BaseAsyncClientTest<Ter
|
|||
|
||||
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TerremarkVCloudLoginAsyncClient.class.getMethod("login"));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, HttpHeaders.ACCEPT + ": application/vnd.vmware.vcloud.orgList+xml\n");
|
||||
|
|
|
@ -26,12 +26,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.trmk.vcloud_0_8.xml.SupportedVersionsHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudVersionsAsyncClient}
|
||||
|
@ -44,7 +45,7 @@ public class TerremarkVCloudVersionsAsyncClientTest extends BaseAsyncClientTest<
|
|||
|
||||
public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TerremarkVCloudVersionsAsyncClient.class.getMethod("getSupportedVersions"));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.model.rest.RESTLink;
|
||||
import com.abiquo.model.transport.SingleResourceTransportDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindToPath} binder.
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.server.core.cloud.VirtualDatacenterDto;
|
||||
import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindMoveVolumeToPath} binder.
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.abiquo.server.core.cloud.VirtualMachineDto;
|
|||
import com.abiquo.server.core.infrastructure.network.VLANNetworkDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindNetworkConfigurationRefToPayload} binder.
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.model.rest.RESTLink;
|
||||
import com.abiquo.server.core.infrastructure.DatacenterDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link BindSupportedDevicesLinkToPath} class.
|
||||
|
|
|
@ -36,7 +36,7 @@ import com.abiquo.server.core.enterprise.RoleDto;
|
|||
import com.abiquo.server.core.enterprise.RolesDto;
|
||||
import com.abiquo.server.core.enterprise.UserDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code AdminAsyncApi}
|
||||
|
|
|
@ -77,7 +77,7 @@ import com.abiquo.server.core.infrastructure.storage.TiersDto;
|
|||
import com.abiquo.server.core.infrastructure.storage.VolumeManagementDto;
|
||||
import com.abiquo.server.core.infrastructure.storage.VolumesManagementDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code CloudAsyncApi}
|
||||
|
|
|
@ -41,7 +41,7 @@ import com.abiquo.server.core.config.SystemPropertyDto;
|
|||
import com.abiquo.server.core.enterprise.PrivilegeDto;
|
||||
import com.abiquo.server.core.enterprise.PrivilegesDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code AdminAsyncApi}.
|
||||
|
|
|
@ -53,7 +53,7 @@ import com.abiquo.server.core.infrastructure.DatacentersDto;
|
|||
import com.abiquo.server.core.infrastructure.MachinesDto;
|
||||
import com.abiquo.server.core.infrastructure.network.VLANNetworksDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code EnterpriseAsyncApi}
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.abiquo.server.core.event.EventsDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code EventAsyncApi}
|
||||
|
|
|
@ -89,7 +89,7 @@ import com.abiquo.server.core.infrastructure.storage.StoragePoolsDto;
|
|||
import com.abiquo.server.core.infrastructure.storage.TierDto;
|
||||
import com.abiquo.server.core.infrastructure.storage.TiersDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code InfrastructureAsyncApi}
|
||||
|
|
|
@ -42,7 +42,7 @@ import com.abiquo.server.core.pricing.PricingTemplatesDto;
|
|||
import com.abiquo.server.core.pricing.PricingTierDto;
|
||||
import com.abiquo.server.core.pricing.PricingTiersDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code PricingAsyncApi}.
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.abiquo.model.transport.SingleResourceTransportDto;
|
|||
import com.abiquo.server.core.task.TaskDto;
|
||||
import com.abiquo.server.core.task.TasksDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code TaskAsyncApi}
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.abiquo.server.core.appslibrary.VirtualMachineTemplateDto;
|
|||
import com.abiquo.server.core.appslibrary.VirtualMachineTemplatePersistentDto;
|
||||
import com.abiquo.server.core.appslibrary.VirtualMachineTemplatesDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code VirtualMachineTemplateAsyncApi}
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.testng.annotations.Test;
|
|||
import com.abiquo.model.rest.RESTLink;
|
||||
import com.abiquo.server.core.infrastructure.DatacentersDto;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code AbiquoHttpAsyncApi}.
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.google.common.base.Joiner;
|
|||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Ticker;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.name.Named;
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class BuildTokenRequest implements Function<GeneratedHttpRequest, TokenRe
|
|||
|
||||
protected String getOAuthScopes(GeneratedHttpRequest request) {
|
||||
Invokable<?, ?> invokable = request.getInvocation().getInvokable();
|
||||
Class<?> interfaceType = request.getInvocation().getInterfaceType();
|
||||
Class<?> interfaceType = invokable.getEnclosingType().getRawType();
|
||||
|
||||
OAuthScopes classScopes = interfaceType.getAnnotation(OAuthScopes.class);
|
||||
OAuthScopes methodScopes = invokable.getAnnotation(OAuthScopes.class);
|
||||
|
|
|
@ -22,8 +22,9 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.savvis.vpdc.options.GetVMOptions;
|
||||
import org.jclouds.savvis.vpdc.xml.FirewallServiceHandler;
|
||||
import org.jclouds.savvis.vpdc.xml.NetworkHandler;
|
||||
|
@ -35,7 +36,6 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code BrowsingAsyncApi}
|
||||
|
@ -47,7 +47,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getOrg", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://api.savvis.net/vpdc/v1.0/org/11 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -62,7 +62,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testOrgNull() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getOrg", String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://api.savvis.net/vpdc/v1.0/org/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -77,7 +77,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getVDCInOrg", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://api.savvis.net/vpdc/v1.0/org/11/vdc/22 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -92,7 +92,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testVDCWhenOrgNull() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getVDCInOrg", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "22"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "22"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://api.savvis.net/vpdc/v1.0/org/1/vdc/22 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -107,7 +107,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getNetworkInVDC", String.class, String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "VM-Tier01"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "VM-Tier01"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/network/VM-Tier01 HTTP/1.1");
|
||||
|
@ -123,7 +123,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testNetworkWhenOrgNull() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getNetworkInVDC", String.class, String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "22", "VM-Tier01"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "22", "VM-Tier01"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://api.savvis.net/vpdc/v1.0/org/1/vdc/22/network/VM-Tier01 HTTP/1.1");
|
||||
|
@ -140,7 +140,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
public void testVMVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getVMInVDC", String.class, String.class, String.class,
|
||||
GetVMOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/33 HTTP/1.1");
|
||||
|
@ -156,7 +156,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testVM() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getVM", URI.class, GetVMOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/33")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -174,7 +174,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
public void testVMWithPowerState() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getVMInVDC", String.class, String.class, String.class,
|
||||
GetVMOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "VM-Tier01", GetVMOptions.Builder
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "VM-Tier01", GetVMOptions.Builder
|
||||
.withPowerState()));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -192,7 +192,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
public void testVMWhenOrgNull() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getVMInVDC", String.class, String.class, String.class,
|
||||
GetVMOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "22", "VM-Tier01"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "22", "VM-Tier01"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://api.savvis.net/vpdc/v1.0/org/1/vdc/22/vApp/VM-Tier01 HTTP/1.1");
|
||||
|
@ -208,7 +208,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("getTask", String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("1"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://api.savvis.net/vpdc/v1.0/task/1 HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "");
|
||||
|
@ -223,7 +223,7 @@ public class BrowsingAsyncApiTest extends BaseVPDCAsyncApiTest<BrowsingAsyncApi>
|
|||
|
||||
public void testListFirewallRules() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(BrowsingAsyncApi.class.getMethod("listFirewallRules", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"GET https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/FirewallService HTTP/1.1");
|
||||
|
|
|
@ -21,15 +21,15 @@ package org.jclouds.savvis.vpdc.features;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.savvis.vpdc.domain.FirewallRule;
|
||||
import org.jclouds.savvis.vpdc.xml.TaskHandler;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code FirewallAsyncApi}
|
||||
|
@ -42,7 +42,7 @@ public class FirewallAsyncApiTest extends BaseVPDCAsyncApiTest<FirewallAsyncApi>
|
|||
public void testAddFirewallRule() throws NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncApi.class.getMethod("addFirewallRule", String.class, String.class,
|
||||
FirewallRule.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", FirewallRule.builder().firewallType(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", FirewallRule.builder().firewallType(
|
||||
"SERVER_TIER_FIREWALL").isEnabled(true).source("internet").destination("VM Tier01").port("22").protocol(
|
||||
"Tcp").policy("allow").description("Server Tier Firewall Rule").isLogged(false).build()));
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class FirewallAsyncApiTest extends BaseVPDCAsyncApiTest<FirewallAsyncApi>
|
|||
public void testDeleteFirewallRule() throws NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncApi.class.getMethod("deleteFirewallRule", String.class, String.class,
|
||||
FirewallRule.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", FirewallRule.builder().firewallType(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", FirewallRule.builder().firewallType(
|
||||
"SERVER_TIER_FIREWALL").isEnabled(true).source("internet").destination("VM Tier01").port("22").protocol(
|
||||
"Tcp").policy("allow").description("Server Tier Firewall Rule").isLogged(false).build()));
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.savvis.vpdc.xml.TaskHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests annotation parsing of {@code ServiceManagementAsyncApi}
|
||||
|
@ -41,7 +41,7 @@ public class ServiceManagementAsyncApiTest extends BaseVPDCAsyncApiTest<ServiceM
|
|||
public void testPowerOnVMVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ServiceManagementAsyncApi.class.getMethod("powerOnVMInVDC", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/33/action/powerOn HTTP/1.1");
|
||||
|
@ -57,7 +57,7 @@ public class ServiceManagementAsyncApiTest extends BaseVPDCAsyncApiTest<ServiceM
|
|||
|
||||
public void testPowerOnVM() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ServiceManagementAsyncApi.class.getMethod("powerOnVM", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/33")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -75,7 +75,7 @@ public class ServiceManagementAsyncApiTest extends BaseVPDCAsyncApiTest<ServiceM
|
|||
public void testPowerOffVMVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ServiceManagementAsyncApi.class.getMethod("powerOffVMInVDC", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/33/action/powerOff HTTP/1.1");
|
||||
|
@ -91,7 +91,7 @@ public class ServiceManagementAsyncApiTest extends BaseVPDCAsyncApiTest<ServiceM
|
|||
|
||||
public void testPowerOffVM() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ServiceManagementAsyncApi.class.getMethod("powerOffVM", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/33")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
|
|
@ -26,8 +26,9 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.cim.OSType;
|
||||
import org.jclouds.compute.domain.CIMOperatingSystem;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.savvis.vpdc.domain.VMSpec;
|
||||
import org.jclouds.savvis.vpdc.xml.TaskHandler;
|
||||
import org.jclouds.savvis.vpdc.xml.TasksListHandler;
|
||||
|
@ -38,7 +39,6 @@ import com.google.common.base.Predicate;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Key;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
});
|
||||
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/rest/api/v0.8/org/11/vdc/22"), VMSpec.builder().name(
|
||||
"DemoHost-1").networkTierName("VM Tier01").operatingSystem(os).build()));
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
});
|
||||
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", VMSpec.builder().operatingSystem(os).name(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", VMSpec.builder().operatingSystem(os).name(
|
||||
"DemoHost-1").networkTierName("VM Tier01").build()));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/ HTTP/1.1");
|
||||
|
@ -110,7 +110,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
public void testCaptureVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMAsyncApi.class.getMethod("captureVApp", String.class, String.class, URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("100000.0", "2736", URI.create("https://api.savvis.net/vpdc/v1.0/org/100000.0/vdc/2736/vApp/1001")));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("100000.0", "2736", URI.create("https://api.savvis.net/vpdc/v1.0/org/100000.0/vdc/2736/vApp/1001")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://api.savvis.net/vpdc/v1.0/org/100000.0/vdc/2736/action/captureVApp HTTP/1.1");
|
||||
|
@ -126,7 +126,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
public void testCloneVApp() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMAsyncApi.class.getMethod("cloneVApp", URI.class, String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("https://api.savvis.net/vpdc/v1.0/org/100000.0/vdc/2736/vApp/1001"), "clonedvm", "VM Tier01"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("https://api.savvis.net/vpdc/v1.0/org/100000.0/vdc/2736/vApp/1001"), "clonedvm", "VM Tier01"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"POST https://api.savvis.net/vpdc/v1.0/org/100000.0/vdc/2736/vApp/1001/action/cloneVApp HTTP/1.1");
|
||||
|
@ -153,7 +153,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
});
|
||||
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/rest/api/v0.8/org/11/vdc/22"), ImmutableSet.of(VMSpec
|
||||
.builder().name("Test VM").networkTierName("VM Tier01").operatingSystem(os).build())));
|
||||
|
||||
|
@ -184,7 +184,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
});
|
||||
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", ImmutableSet.of(VMSpec.builder()
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", ImmutableSet.of(VMSpec.builder()
|
||||
.operatingSystem(os).name("Test VM").networkTierName("VM Tier01").build())));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/ HTTP/1.1");
|
||||
|
@ -201,7 +201,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
public void testRemoveVMFromVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMAsyncApi.class.getMethod("removeVMFromVDC", String.class, String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("11", "22", "33"));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
"DELETE https://api.savvis.net/vpdc/v1.0/org/11/vdc/22/vApp/33 HTTP/1.1");
|
||||
|
@ -217,7 +217,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
public void testRemoveVM() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMAsyncApi.class.getMethod("removeVM", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/rest/api/v0.8/org/11/vdc/22/vApp/33")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -234,7 +234,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
public void testPowerOffVM() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMAsyncApi.class.getMethod("powerOffVM", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/rest/api/v0.8/org/11/vdc/22/vApp/33")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -251,7 +251,7 @@ public class VMAsyncApiTest extends BaseVPDCAsyncApiTest<VMAsyncApi> {
|
|||
|
||||
public void testPowerOnVM() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMAsyncApi.class.getMethod("powerOnVM", URI.class));
|
||||
HttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://api.savvis.net/rest/api/v0.8/org/11/vdc/22/vApp/33")));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.jclouds.rest.internal.GeneratedHttpRequest;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -35,11 +35,12 @@ import org.jclouds.ec2.xml.PermissionHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AWSAMIAsyncClient}
|
||||
|
@ -69,9 +70,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -102,10 +103,10 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId", new CreateImageOptions()
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId", new CreateImageOptions()
|
||||
.withDescription("description").noReboot()));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -133,9 +134,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -168,10 +169,10 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||
"1", "2")));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -199,9 +200,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
|
||||
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -231,9 +232,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -263,10 +264,10 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest", new RegisterImageOptions()
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest", new RegisterImageOptions()
|
||||
.withDescription("description")));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -298,9 +299,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -339,11 +340,11 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId",
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId",
|
||||
new RegisterImageBackedByEbsOptions().withDescription("description").addBlockDeviceFromSnapshot(
|
||||
"/dev/device", null, "snapshot").addNewBlockDevice("/dev/newdevice", "newblock", 100)));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -373,9 +374,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -404,9 +405,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
|
||||
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -440,10 +441,10 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -477,10 +478,10 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -509,9 +510,9 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -526,7 +527,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
|
||||
public void testGetProductCodesForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("getProductCodesForImageInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -544,7 +545,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testAddProductCodesToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("addProductCodesToImageInRegion", String.class, Iterable.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("code1", "code2"), "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("code1", "code2"), "imageId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -563,7 +564,7 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
|||
public void testRemoveProductCodesFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSAMIAsyncClient.class.getMethod("removeProductCodesFromImageInRegion", String.class,
|
||||
Iterable.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("code1", "code2"), "imageId"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("code1", "code2"), "imageId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -39,11 +39,12 @@ import org.jclouds.ec2.xml.UnencodeStringValueHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AWSInstanceAsyncClient}
|
||||
|
@ -56,7 +57,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSInstanceAsyncClient> {
|
||||
public void testDescribeInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("describeInstancesInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -72,7 +73,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
|
||||
public void testDescribeInstancesArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("describeInstancesInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -88,7 +89,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
|
||||
public void testTerminateInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("terminateInstancesInRegion", String.class, String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -105,7 +106,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testRunInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("runInstancesInRegion", String.class, String.class,
|
||||
String.class, int.class, int.class, RunInstancesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null, "ami-voo", 1, 1));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, null, "ami-voo", 1, 1));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -121,7 +122,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testRunInstancesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("runInstancesInRegion", String.class, String.class,
|
||||
String.class, int.class, int.class, RunInstancesOptions[].class));
|
||||
HttpRequest request = processor.createRequest(
|
||||
GeneratedHttpRequest request = processor.createRequest(
|
||||
method,
|
||||
Lists.<Object> newArrayList("us-east-1",
|
||||
"us-east-1a",
|
||||
|
@ -147,7 +148,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testStopInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("stopInstancesInRegion", String.class, boolean.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, true, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, true, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -164,7 +165,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testRebootInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("rebootInstancesInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -181,7 +182,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testStartInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("startInstancesInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -198,7 +199,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testGetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("getUserDataForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -216,7 +217,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testGetRootDeviceNameForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("getRootDeviceNameForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -234,7 +235,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testGetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("getRamdiskForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -253,7 +254,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("isApiTerminationDisabledForInstanceInRegion",
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -271,7 +272,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testGetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class
|
||||
.getMethod("getKernelForInstanceInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -288,7 +289,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testGetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("getInstanceTypeForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -307,7 +308,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("getInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -327,7 +328,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("getBlockDeviceMappingForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -359,9 +360,9 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", String.class, String.class,
|
||||
byte[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test".getBytes()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test".getBytes()));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -392,9 +393,9 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -425,9 +426,9 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -459,9 +460,9 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("setApiTerminationDisabledForInstanceInRegion", String.class,
|
||||
String.class, boolean.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", true));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", true));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -492,9 +493,9 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceType.C1_MEDIUM));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceType.C1_MEDIUM));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -526,9 +527,9 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSInstanceAsyncClient.class.getMethod("setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class, InstanceInitiatedShutdownBehavior.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceInitiatedShutdownBehavior.TERMINATE));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceInitiatedShutdownBehavior.TERMINATE));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -549,7 +550,7 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
|||
|
||||
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
||||
mapping.put("/dev/sda1", new BlockDevice("vol-test1", true));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", mapping));
|
||||
|
||||
filter.filter(request);
|
||||
|
||||
|
|
|
@ -26,10 +26,11 @@ import org.jclouds.ec2.xml.KeyPairResponseHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AWSKeyPairAsyncClient}
|
||||
|
@ -42,7 +43,7 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
|||
|
||||
public void testCreateKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSKeyPairAsyncClient.class.getMethod("createKeyPairInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -72,9 +73,9 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
|||
public void testImportKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSKeyPairAsyncClient.class.getMethod("importKeyPairInRegion", String.class, String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey", "ssh-rsa AA"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey", "ssh-rsa AA"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -90,7 +91,7 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
|||
|
||||
public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSKeyPairAsyncClient.class.getMethod("deleteKeyPairInRegion", String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -107,7 +108,7 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
|||
public void testDescribeKeyPairs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSKeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -124,7 +125,7 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
|||
public void testDescribeKeyPairsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSKeyPairAsyncClient.class.getMethod("describeKeyPairsInRegion", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
|
@ -29,11 +29,12 @@ import org.jclouds.ec2.xml.DescribeSecurityGroupsResponseHandler;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AWSSecurityGroupAsyncClient}
|
||||
|
@ -51,7 +52,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testDeleteSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("deleteSecurityGroupInRegionById", String.class,
|
||||
String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -68,7 +69,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testDescribeSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegionById", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -85,7 +86,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testDescribeSecurityGroupsArgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("describeSecurityGroupsInRegionById", String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -115,9 +116,9 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion", String.class,
|
||||
String.class, String.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "description"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "description"));
|
||||
|
||||
request = request.getFilters().get(0).filter(request);
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -134,7 +135,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testAuthorizeSecurityGroupIpPermission() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("authorizeSecurityGroupIngressInRegion",
|
||||
String.class, String.class, IpPermission.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpPermissions.permitAnyProtocol()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpPermissions.permitAnyProtocol()));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -153,7 +154,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testAuthorizeSecurityGroupIpPermissions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("authorizeSecurityGroupIngressInRegion",
|
||||
String.class, String.class, Iterable.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", ImmutableSet.<IpPermission> of(IpPermissions
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", ImmutableSet.<IpPermission> of(IpPermissions
|
||||
.permit(IpProtocol.TCP).originatingFromCidrBlock("1.1.1.1/32"), IpPermissions.permitICMP().type(8).andCode(0)
|
||||
.originatingFromSecurityGroupId("groupId"))));
|
||||
|
||||
|
@ -174,7 +175,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testRevokeSecurityGroupIpPermission() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("revokeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, IpPermission.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpPermissions.permitAnyProtocol()));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpPermissions.permitAnyProtocol()));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
@ -193,7 +194,7 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
|||
public void testRevokeSecurityGroupIpPermissions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AWSSecurityGroupAsyncClient.class.getMethod("revokeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, Iterable.class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", ImmutableSet.<IpPermission> of(IpPermissions
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", ImmutableSet.<IpPermission> of(IpPermissions
|
||||
.permit(IpProtocol.TCP).originatingFromCidrBlock("1.1.1.1/32"), IpPermissions.permitICMP().type(8).andCode(0)
|
||||
.originatingFromSecurityGroupId("groupId"))));
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ package org.jclouds.aws.ec2.services;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.aws.ec2.xml.MonitoringStateHandler;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code MonitoringAsyncClient}
|
||||
|
@ -40,7 +40,7 @@ public class MonitoringAsyncClientTest extends BaseAWSEC2AsyncClientTest<Monitor
|
|||
public void testUnmonitorInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(MonitoringAsyncClient.class.getMethod("unmonitorInstancesInRegion", String.class, String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "instance1", "instance2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "instance1", "instance2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
String payload = "Action=UnmonitorInstances&InstanceId.0=instance1&InstanceId.1=instance2";
|
||||
|
@ -57,7 +57,7 @@ public class MonitoringAsyncClientTest extends BaseAWSEC2AsyncClientTest<Monitor
|
|||
public void testMonitorInstances() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(MonitoringAsyncClient.class.getMethod("monitorInstancesInRegion", String.class, String.class,
|
||||
String[].class));
|
||||
HttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "instance1", "instance2"));
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "instance1", "instance2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue