mirror of https://github.com/apache/jclouds.git
Merge pull request #1203 from jclouds/centralize-invokable
Centralize invokable
This commit is contained in:
commit
c395d90928
|
@ -17,12 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.atmos;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
|
||||
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -88,7 +87,7 @@ public class AtmosApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.4.0")
|
||||
.defaultEndpoint("https://accesspoint.atmosonline.com")
|
||||
.defaultProperties(AtmosApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(BlobStoreContext.class))
|
||||
.view(typeToken(BlobStoreContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(AtmosRestClientModule.class, AtmosBlobStoreContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.atmos.blobstore;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.blobstore.util.BlobStoreUtils.cleanRequest;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -59,10 +60,9 @@ 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 = method(AtmosAsyncClient.class, "readFile", String.class, GetOptions[].class);
|
||||
this.deleteMethod = method(AtmosAsyncClient.class, "deletePath", String.class);
|
||||
this.createMethod = method(AtmosAsyncClient.class, "createFile", String.class, AtmosObject.class, PutOptions[].class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.atmos;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -47,7 +48,6 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseURIFromListOrLocationHeaderIf20x;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.options.GetOptions;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
@ -56,8 +56,8 @@ 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;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code AtmosAsyncClient}
|
||||
*
|
||||
|
@ -70,7 +70,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
private BlobToObject blobToObject;
|
||||
|
||||
public void testListDirectories() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("listDirectories", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectories", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace HTTP/1.1");
|
||||
|
@ -85,7 +85,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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectory", String.class, ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("directory"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/directory/ HTTP/1.1");
|
||||
|
@ -100,7 +100,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
}
|
||||
|
||||
public void testListDirectoriesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("listDirectories", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectories", ListOptions[].class);
|
||||
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");
|
||||
|
@ -115,7 +115,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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "listDirectory", String.class, ListOptions[].class);
|
||||
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");
|
||||
|
@ -130,7 +130,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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "createDirectory", String.class, PutOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://accesspoint.atmosonline.com/rest/namespace/dir/ HTTP/1.1");
|
||||
|
@ -145,7 +145,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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "createDirectory", String.class, PutOptions[].class);
|
||||
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");
|
||||
|
@ -161,8 +161,8 @@ 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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "createFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
|
||||
|
||||
|
@ -178,8 +178,8 @@ 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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "createFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
|
||||
|
||||
|
@ -196,8 +196,8 @@ 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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "updateFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
|
||||
|
||||
|
@ -213,8 +213,8 @@ 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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "updateFile", String.class, AtmosObject.class,
|
||||
PutOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir", blobToObject
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB), PutOptions.Builder.publicRead()));
|
||||
|
||||
|
@ -231,7 +231,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));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "readFile", String.class, GetOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
|
@ -246,7 +246,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
}
|
||||
|
||||
public void testGetSystemMetadata() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("getSystemMetadata", String.class));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "getSystemMetadata", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
|
@ -261,7 +261,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
}
|
||||
|
||||
public void testDeletePath() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("deletePath", String.class));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "deletePath", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
|
@ -276,7 +276,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
}
|
||||
|
||||
public void testIsPublic() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("isPublic", String.class));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "isPublic", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("dir/file"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://accesspoint.atmosonline.com/rest/namespace/dir/file HTTP/1.1");
|
||||
|
@ -291,7 +291,7 @@ public class AtmosAsyncClientTest extends BaseAsyncClientTest<AtmosAsyncClient>
|
|||
}
|
||||
|
||||
public void testNewObject() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AtmosAsyncClient.class.getMethod("newObject"));
|
||||
Invokable<?, ?> method = method(AtmosAsyncClient.class, "newObject");
|
||||
assertEquals(method.getReturnType().getRawType(), AtmosObject.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudfiles.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
@ -50,7 +50,7 @@ import com.google.inject.Scopes;
|
|||
@ConfiguresRestClient
|
||||
public class CloudFilesRestClientModule extends SwiftRestClientModule<CloudFilesClient, CloudFilesAsyncClient> {
|
||||
public CloudFilesRestClientModule() {
|
||||
super(typeTokenOf(CloudFilesClient.class), typeTokenOf(CloudFilesAsyncClient.class), ImmutableMap
|
||||
super(typeToken(CloudFilesClient.class), typeToken(CloudFilesAsyncClient.class), ImmutableMap
|
||||
.<Class<?>, Class<?>> of());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.jclouds.cloudservers;
|
|||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -80,7 +80,7 @@ public class CloudServersApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.0")
|
||||
.defaultEndpoint("https://auth.api.rackspacecloud.com")
|
||||
.defaultProperties(CloudServersApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(ComputeServiceContext.class))
|
||||
.view(typeToken(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudServersRestClientModule.class, CloudServersComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import static org.jclouds.cloudservers.options.ListOptions.Builder.changesSince;
|
|||
import static org.jclouds.cloudservers.options.ListOptions.Builder.withDetails;
|
||||
import static org.jclouds.cloudservers.options.RebuildServerOptions.Builder.withImage;
|
||||
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -62,7 +63,6 @@ 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 com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.ConfiguresRestClient;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
@ -70,9 +70,9 @@ 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;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code CloudServersAsyncClient}
|
||||
*
|
||||
|
@ -84,8 +84,8 @@ import com.google.inject.Provides;
|
|||
public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServersAsyncClient> {
|
||||
|
||||
public void testCreateServer() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class);
|
||||
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");
|
||||
|
@ -102,8 +102,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class);
|
||||
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");
|
||||
|
@ -120,8 +120,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class);
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1, withFile("/etc/jclouds", "foo".getBytes())));
|
||||
|
||||
|
@ -141,8 +141,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
|
||||
withMetadata(ImmutableMap.of("foo", "bar"))));
|
||||
|
||||
|
@ -162,8 +162,8 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
|
||||
public void testCreateServerWithIpGroupAndSharedIp() throws IOException, SecurityException, NoSuchMethodException,
|
||||
UnknownHostException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createServer", String.class, int.class, int.class,
|
||||
CreateServerOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("ralphie", 2, 1,
|
||||
withSharedIpGroup(2).withSharedIp("127.0.0.1")));
|
||||
|
||||
|
@ -182,7 +182,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testDeleteImage() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteImage", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteImage", int.class);
|
||||
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");
|
||||
|
@ -197,7 +197,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testLimits() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getLimits"));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getLimits");
|
||||
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");
|
||||
|
@ -212,7 +212,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListServers() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listServers", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listServers", ListOptions[].class);
|
||||
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");
|
||||
|
@ -229,7 +229,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
Date now = new Date(10000000l);
|
||||
|
||||
public void testListServersOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listServers", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listServers", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -245,7 +245,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListServersDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listServers", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listServers", ListOptions[].class);
|
||||
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");
|
||||
|
@ -260,7 +260,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testGetServer() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getServer", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getServer", int.class);
|
||||
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");
|
||||
|
@ -275,7 +275,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListFlavors() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
|
||||
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");
|
||||
|
@ -290,7 +290,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListFlavorsOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -306,7 +306,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListFlavorsDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
|
||||
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");
|
||||
|
@ -321,7 +321,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListFlavorsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listFlavors", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listFlavors", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -337,7 +337,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testGetFlavor() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getFlavor", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getFlavor", int.class);
|
||||
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");
|
||||
|
@ -352,7 +352,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListImages() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
|
||||
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");
|
||||
|
@ -367,7 +367,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListImagesDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
|
||||
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");
|
||||
|
@ -382,7 +382,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListImagesOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -398,7 +398,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListImagesDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listImages", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listImages", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -414,7 +414,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testGetImage() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getImage", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getImage", int.class);
|
||||
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");
|
||||
|
@ -429,7 +429,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testDeleteServer() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteServer", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteServer", int.class);
|
||||
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");
|
||||
|
@ -444,8 +444,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "shareIp", String.class, int.class, int.class,
|
||||
boolean.class);
|
||||
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");
|
||||
|
@ -462,8 +462,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "shareIp", String.class, int.class, int.class,
|
||||
boolean.class);
|
||||
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");
|
||||
|
@ -481,7 +481,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "unshareIp", String.class, int.class);
|
||||
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");
|
||||
|
@ -497,7 +497,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "replaceBackupSchedule", int.class, BackupSchedule.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, BackupSchedule.builder().weekly(WeeklyBackup.MONDAY)
|
||||
.daily(DailyBackup.H_0800_1000).enabled(true).build()));
|
||||
|
||||
|
@ -516,7 +516,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testDeleteBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteBackupSchedule", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteBackupSchedule", int.class);
|
||||
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");
|
||||
|
@ -532,7 +532,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "changeAdminPass", int.class, String.class);
|
||||
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");
|
||||
|
@ -548,7 +548,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "renameServer", int.class, String.class);
|
||||
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");
|
||||
|
@ -564,7 +564,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListSharedIpGroups() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
|
||||
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");
|
||||
|
@ -579,7 +579,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListSharedIpGroupsOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -595,7 +595,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListSharedIpGroupsDetail() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
|
||||
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");
|
||||
|
@ -610,7 +610,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListSharedIpGroupsDetailOptions() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listSharedIpGroups", ListOptions[].class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listSharedIpGroups", ListOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(withDetails().changesSince(now).maxResults(1).startAt(2)));
|
||||
|
||||
assertRequestLineEquals(request,
|
||||
|
@ -626,7 +626,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testGetSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getSharedIpGroup", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getSharedIpGroup", int.class);
|
||||
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");
|
||||
|
@ -641,8 +641,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createSharedIpGroup", String.class,
|
||||
CreateSharedIpGroupOptions[].class);
|
||||
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");
|
||||
|
@ -658,8 +658,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createSharedIpGroup", String.class,
|
||||
CreateSharedIpGroupOptions[].class);
|
||||
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");
|
||||
|
@ -675,7 +675,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testDeleteSharedIpGroup() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("deleteSharedIpGroup", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "deleteSharedIpGroup", int.class);
|
||||
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");
|
||||
|
@ -690,7 +690,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListAddresses() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getAddresses", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getAddresses", int.class);
|
||||
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");
|
||||
|
@ -705,7 +705,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListPublicAddresses() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listPublicAddresses", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listPublicAddresses", int.class);
|
||||
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");
|
||||
|
@ -720,7 +720,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListPrivateAddresses() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("listPrivateAddresses", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "listPrivateAddresses", int.class);
|
||||
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");
|
||||
|
@ -735,7 +735,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testListBackupSchedule() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("getBackupSchedule", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "getBackupSchedule", int.class);
|
||||
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");
|
||||
|
@ -750,7 +750,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "createImageFromServer", String.class, int.class);
|
||||
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");
|
||||
|
@ -767,8 +767,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "rebuildServer", int.class,
|
||||
RebuildServerOptions[].class);
|
||||
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");
|
||||
|
@ -783,8 +783,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "rebuildServer", int.class,
|
||||
RebuildServerOptions[].class);
|
||||
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");
|
||||
|
@ -799,7 +799,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "rebootServer", int.class, RebootType.class);
|
||||
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");
|
||||
|
@ -814,7 +814,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "resizeServer", int.class, int.class);
|
||||
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");
|
||||
|
@ -830,7 +830,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));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "confirmResizeServer", int.class);
|
||||
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");
|
||||
|
@ -845,7 +845,7 @@ public class CloudServersAsyncClientTest extends BaseAsyncClientTest<CloudServer
|
|||
}
|
||||
|
||||
public void testRevertResize() throws IOException, SecurityException, NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudServersAsyncClient.class.getMethod("revertResizeServer", int.class));
|
||||
Invokable<?, ?> method = method(CloudServersAsyncClient.class, "revertResizeServer", int.class);
|
||||
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");
|
||||
|
|
|
@ -17,12 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.cloudsigma;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.cloudsigma.reference.CloudSigmaConstants.PROPERTY_VNC_PASSWORD;
|
||||
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -87,7 +86,7 @@ public class CloudSigmaApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.0")
|
||||
.defaultEndpoint("https://api.cloudsigma.com")
|
||||
.defaultProperties(CloudSigmaApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(ComputeServiceContext.class))
|
||||
.view(typeToken(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(CloudSigmaRestClientModule.class, CloudSigmaComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudsigma;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -46,14 +47,13 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.filters.BasicAuthentication;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import com.google.common.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 +64,7 @@ import com.google.common.collect.Iterables;
|
|||
public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsyncClient> {
|
||||
|
||||
public void testGetProfileInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getProfileInfo"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getProfileInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/profile/info HTTP/1.1");
|
||||
|
@ -80,7 +80,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStandardDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStandardDrives"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStandardDrives");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/list HTTP/1.1");
|
||||
|
@ -95,7 +95,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStandardCds() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStandardCds"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStandardCds");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/cd/list HTTP/1.1");
|
||||
|
@ -110,7 +110,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStandardImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStandardImages"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStandardImages");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/standard/img/list HTTP/1.1");
|
||||
|
@ -125,7 +125,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listDriveInfo"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listDriveInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/info HTTP/1.1");
|
||||
|
@ -140,7 +140,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getDriveInfo", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getDriveInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/info HTTP/1.1");
|
||||
|
@ -156,7 +156,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createDrive", Drive.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createDrive", Drive.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
new CreateDriveRequest.Builder().name("foo").use(ImmutableList.of("production", "candy")).size(10000l)
|
||||
.build()));
|
||||
|
@ -174,8 +174,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "cloneDrive", String.class, String.class,
|
||||
CloneDriveOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/drives/sourceid/clone HTTP/1.1");
|
||||
|
@ -191,8 +191,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "cloneDrive", String.class, String.class,
|
||||
CloneDriveOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("sourceid", "newname",
|
||||
new CloneDriveOptions().size(1024l)));
|
||||
|
||||
|
@ -209,7 +209,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));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "setDriveData", String.class, DriveData.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", new DriveData.Builder().name("foo").size(10000l)
|
||||
.use(ImmutableList.of("production", "candy")).build()));
|
||||
|
||||
|
@ -226,7 +226,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listServers"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listServers");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/list HTTP/1.1");
|
||||
|
@ -253,7 +253,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listServerInfo"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listServerInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/info HTTP/1.1");
|
||||
|
@ -268,7 +268,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getServerInfo", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getServerInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/info HTTP/1.1");
|
||||
|
@ -284,7 +284,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createServer", Server.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createServer", Server.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/create HTTP/1.1");
|
||||
|
@ -300,7 +300,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));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "setServerConfiguration", String.class, Server.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/100/set HTTP/1.1");
|
||||
|
@ -316,7 +316,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyServer", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/servers/uuid/destroy HTTP/1.1");
|
||||
|
@ -332,7 +332,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testStartServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("startServer", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "startServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/start HTTP/1.1");
|
||||
|
@ -348,7 +348,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testStopServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("stopServer", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "stopServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/stop HTTP/1.1");
|
||||
|
@ -364,7 +364,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testShutdownServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("shutdownServer", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "shutdownServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/shutdown HTTP/1.1");
|
||||
|
@ -380,7 +380,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testResetServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("resetServer", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "resetServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/servers/uuid/reset HTTP/1.1");
|
||||
|
@ -396,7 +396,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listDrives"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listDrives");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/list HTTP/1.1");
|
||||
|
@ -423,7 +423,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyDrive", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyDrive", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/drives/uuid/destroy HTTP/1.1");
|
||||
|
@ -439,7 +439,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListVLANs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listVLANs"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listVLANs");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/list HTTP/1.1");
|
||||
|
@ -466,7 +466,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListVLANInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listVLANInfo"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listVLANInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/info HTTP/1.1");
|
||||
|
@ -481,7 +481,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetVLANInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getVLANInfo", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getVLANInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/info HTTP/1.1");
|
||||
|
@ -497,7 +497,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createVLAN", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createVLAN", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("poohbear"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/create HTTP/1.1");
|
||||
|
@ -513,7 +513,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));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "renameVLAN", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "poohbear"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/vlan/100/set HTTP/1.1");
|
||||
|
@ -529,7 +529,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyVLAN() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyVLAN", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyVLAN", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/vlan/uuid/destroy HTTP/1.1");
|
||||
|
@ -545,7 +545,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStaticIPs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStaticIPs"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStaticIPs");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/list HTTP/1.1");
|
||||
|
@ -572,7 +572,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testListStaticIPInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("listStaticIPInfo"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "listStaticIPInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/info HTTP/1.1");
|
||||
|
@ -587,7 +587,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testGetStaticIPInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("getStaticIPInfo", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "getStaticIPInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/info HTTP/1.1");
|
||||
|
@ -603,7 +603,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testCreateStaticIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("createStaticIP"));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "createStaticIP");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api.cloudsigma.com/resources/ip/create HTTP/1.1");
|
||||
|
@ -619,7 +619,7 @@ public class CloudSigmaAsyncClientTest extends BaseAsyncClientTest<CloudSigmaAsy
|
|||
}
|
||||
|
||||
public void testDestroyStaticIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CloudSigmaAsyncClient.class.getMethod("destroyStaticIP", String.class));
|
||||
Invokable<?, ?> method = method(CloudSigmaAsyncClient.class, "destroyStaticIP", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api.cloudsigma.com/resources/ip/uuid/destroy HTTP/1.1");
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudsigma.binders;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -27,7 +28,6 @@ import java.util.Map;
|
|||
|
||||
import org.jclouds.cloudsigma.options.CloneDriveOptions;
|
||||
import org.jclouds.reflect.Invocation;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -35,7 +35,6 @@ import com.google.common.base.Throwables;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.Guice;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
|
@ -64,13 +63,11 @@ public class BindCloneDriveOptionsToPlainTextStringTest {
|
|||
|
||||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
Invocation invocation = Invocation.create(method(String.class, "toString"), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,9 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.cloudstack;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -35,7 +34,6 @@ import org.jclouds.rest.internal.BaseRestApiMetadata;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Implementation of {@link ApiMetadata} for Citrix/Apache CloudStack api.
|
||||
*
|
||||
|
@ -81,7 +79,7 @@ public class CloudStackApiMetadata extends BaseRestApiMetadata {
|
|||
.documentation(URI.create("http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html"))
|
||||
.defaultEndpoint("http://localhost:8080/client/api")
|
||||
.version("2.2")
|
||||
.view(typeTokenOf(CloudStackContext.class))
|
||||
.view(typeToken(CloudStackContext.class))
|
||||
.defaultProperties(CloudStackApiMetadata.defaultProperties())
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>> builder()
|
||||
.add(CloudStackParserModule.class)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -26,12 +27,12 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.ListAccountsOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
|
@ -44,7 +45,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<AccountAsyncClient> {
|
||||
|
||||
public void testListAccounts() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AccountAsyncClient.class.getMethod("listAccounts", ListAccountsOptions[].class));
|
||||
Invokable<?, ?> method = method(AccountAsyncClient.class, "listAccounts", ListAccountsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -61,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));
|
||||
Invokable<?, ?> method = method(AccountAsyncClient.class, "listAccounts", ListAccountsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListAccountsOptions.Builder.accountInDomain("jclouds", "123")));
|
||||
|
||||
|
@ -79,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));
|
||||
Invokable<?, ?> method = method(AccountAsyncClient.class, "getAccount", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("3"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -31,13 +33,12 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -48,7 +49,7 @@ import com.google.common.collect.ImmutableList;
|
|||
@Test(groups = "unit", testName = "AddressAsyncClientTest")
|
||||
public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<AddressAsyncClient> {
|
||||
public void testListPublicIPAddresses() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AddressAsyncClient.class.getMethod("listPublicIPAddresses", ListPublicIPAddressesOptions[].class));
|
||||
Invokable<?, ?> method = method(AddressAsyncClient.class, "listPublicIPAddresses", ListPublicIPAddressesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -65,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));
|
||||
Invokable<?, ?> method = method(AddressAsyncClient.class, "listPublicIPAddresses", ListPublicIPAddressesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListPublicIPAddressesOptions.Builder.accountInDomain("adrian", "6").usesVirtualNetwork(true)));
|
||||
|
||||
|
@ -84,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));
|
||||
Invokable<?, ?> method = method(AddressAsyncClient.class, "getPublicIPAddress", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -102,8 +103,8 @@ 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));
|
||||
Invokable<?, ?> method = method(AddressAsyncClient.class, "associateIPAddressInZone", String.class,
|
||||
AssociateIPAddressOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -120,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));
|
||||
Invokable<?, ?> method = method(AddressAsyncClient.class, "disassociateIPAddress", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -26,11 +28,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 com.google.common.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}
|
||||
|
@ -43,7 +45,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<AsyncJobAsyncClient> {
|
||||
|
||||
public void testGetAsyncJob() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AsyncJobAsyncClient.class.getMethod("getAsyncJob", String.class));
|
||||
Invokable<?, ?> method = method(AsyncJobAsyncClient.class, "getAsyncJob", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -60,7 +62,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
|
|||
}
|
||||
|
||||
public void testListAsyncJobs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AsyncJobAsyncClient.class.getMethod("listAsyncJobs", ListAsyncJobsOptions[].class));
|
||||
Invokable<?, ?> method = method(AsyncJobAsyncClient.class, "listAsyncJobs", ListAsyncJobsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -77,7 +79,7 @@ public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<Async
|
|||
}
|
||||
|
||||
public void testListAsyncJobsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AsyncJobAsyncClient.class.getMethod("listAsyncJobs", ListAsyncJobsOptions[].class));
|
||||
Invokable<?, ?> method = method(AsyncJobAsyncClient.class, "listAsyncJobs", ListAsyncJobsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListAsyncJobsOptions.Builder.accountInDomain("adrian", "5")));
|
||||
|
||||
|
|
|
@ -18,17 +18,18 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -40,7 +41,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class ConfigurationAsyncClientTest extends BaseCloudStackAsyncClientTest<ConfigurationAsyncClient> {
|
||||
|
||||
public void testListCapabilities() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ConfigurationAsyncClient.class.getMethod("listCapabilities"));
|
||||
Invokable<?, ?> method = method(ConfigurationAsyncClient.class, "listCapabilities");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,16 +18,17 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -37,7 +38,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<DomainAccountAsyncClient> {
|
||||
|
||||
public void testEnableAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(DomainAccountAsyncClient.class.getMethod("enableAccount", String.class, String.class));
|
||||
Invokable<?, ?> method = method(DomainAccountAsyncClient.class, "enableAccount", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo", "2"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -53,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));
|
||||
Invokable<?, ?> method = method(DomainAccountAsyncClient.class, "disableAccount", String.class, String.class, boolean.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("1", "2", true));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.cloudstack.domain.ResourceLimit;
|
||||
|
@ -25,12 +27,11 @@ import org.jclouds.cloudstack.domain.ResourceLimit.ResourceType;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -40,7 +41,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class DomainLimitAsyncClientTest extends BaseCloudStackAsyncClientTest<DomainLimitAsyncClient> {
|
||||
|
||||
public void testUpdateResourceLimit() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(DomainLimitAsyncClient.class.getMethod("updateResourceLimit", ResourceLimit.class));
|
||||
Invokable<?, ?> method = method(DomainLimitAsyncClient.class, "updateResourceLimit", ResourceLimit.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ResourceLimit.builder().resourceType(ResourceType.SNAPSHOT).account("foo").domainId("100").max(101).build()));
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -25,12 +27,11 @@ import org.jclouds.cloudstack.functions.ParseEventTypesFromHttpResponse;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListEventsOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -42,7 +43,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class EventAsyncClientTest extends BaseCloudStackAsyncClientTest<EventAsyncClient> {
|
||||
|
||||
public void testListEventTypes() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(EventAsyncClient.class.getMethod("listEventTypes"));
|
||||
Invokable<?, ?> method = method(EventAsyncClient.class, "listEventTypes");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -58,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));
|
||||
Invokable<?, ?> method = method(EventAsyncClient.class, "listEvents", ListEventsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -75,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));
|
||||
Invokable<?, ?> method = method(EventAsyncClient.class, "listEvents", ListEventsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListEventsOptions.Builder.account("jclouds")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -29,12 +31,11 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -45,8 +46,8 @@ import com.google.common.collect.ImmutableList;
|
|||
@Test(groups = "unit", testName = "FirewallAsyncClientTest")
|
||||
public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<FirewallAsyncClient> {
|
||||
public void testListPortForwardingRules() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncClient.class.getMethod("listPortForwardingRules",
|
||||
ListPortForwardingRulesOptions[].class));
|
||||
Invokable<?, ?> method = method(FirewallAsyncClient.class, "listPortForwardingRules",
|
||||
ListPortForwardingRulesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -63,8 +64,8 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
|
|||
}
|
||||
|
||||
public void testListPortForwardingRulesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncClient.class.getMethod("listPortForwardingRules",
|
||||
ListPortForwardingRulesOptions[].class));
|
||||
Invokable<?, ?> method = method(FirewallAsyncClient.class, "listPortForwardingRules",
|
||||
ListPortForwardingRulesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListPortForwardingRulesOptions.Builder.ipAddressId("3")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -82,8 +83,8 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
|
|||
|
||||
public void testCreatePortForwardingRuleForVirtualMachine() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(FirewallAsyncClient.class.getMethod("createPortForwardingRuleForVirtualMachine", String.class,
|
||||
PortForwardingRule.Protocol.class, int.class, String.class, int.class));
|
||||
Invokable<?, ?> method = method(FirewallAsyncClient.class, "createPortForwardingRuleForVirtualMachine", String.class,
|
||||
PortForwardingRule.Protocol.class, int.class, String.class, int.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("6", PortForwardingRule.Protocol.TCP, 22, "7", 22));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -101,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));
|
||||
Invokable<?, ?> method = method(FirewallAsyncClient.class, "deletePortForwardingRule", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.domain.Account;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
|
@ -26,12 +28,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 com.google.common.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}
|
||||
*
|
||||
|
@ -53,8 +54,8 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
.build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(GlobalAccountAsyncClient.class, "createAccount", String.class, Account.Type.class,
|
||||
String.class, String.class, String.class, String.class, CreateAccountOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("user", Account.Type.USER, "email@example.com",
|
||||
"FirstName", "LastName", "hashed-password"));
|
||||
|
||||
|
@ -79,8 +80,8 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
.build();
|
||||
|
||||
public void testUpdateAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAccountAsyncClient.class.getMethod("updateAccount", String.class, String.class,
|
||||
String.class, UpdateAccountOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalAccountAsyncClient.class, "updateAccount", String.class, String.class,
|
||||
String.class, UpdateAccountOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("account", 42L, "new-account-name"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, update.getRequestLine());
|
||||
|
@ -95,7 +96,7 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
}
|
||||
|
||||
public void testDeleteAccount() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAccountAsyncClient.class.getMethod("deleteAccount", String.class));
|
||||
Invokable<?, ?> method = method(GlobalAccountAsyncClient.class, "deleteAccount", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,18 +18,19 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
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.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -41,7 +42,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class GlobalAlertAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalAlertAsyncClient> {
|
||||
|
||||
public void testListAlerts() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalAlertAsyncClient.class.getMethod("listAlerts", ListAlertsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalAlertAsyncClient.class, "listAlerts", ListAlertsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -58,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));
|
||||
Invokable<?, ?> method = method(GlobalAlertAsyncClient.class, "listAlerts", ListAlertsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListAlertsOptions.Builder.id("42").keyword("jclouds").type("TEMPLATE")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -25,12 +27,11 @@ import org.jclouds.cloudstack.domain.Capacity;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListCapacityOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -42,7 +43,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class GlobalCapacityAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalCapacityAsyncClient> {
|
||||
|
||||
public void testListCapacity() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalCapacityAsyncClient.class.getMethod("listCapacity", ListCapacityOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalCapacityAsyncClient.class, "listCapacity", ListCapacityOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -58,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));
|
||||
Invokable<?, ?> method = method(GlobalCapacityAsyncClient.class, "listCapacity", ListCapacityOptions[].class);
|
||||
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,
|
||||
|
|
|
@ -18,16 +18,17 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListHostsOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -37,7 +38,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class GlobalHostAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalHostAsyncClient> {
|
||||
|
||||
public void testListHosts() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalHostAsyncClient.class.getMethod("listHosts", ListHostsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalHostAsyncClient.class, "listHosts", ListHostsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
|
@ -28,11 +29,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 com.google.common.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}
|
||||
|
@ -53,8 +54,8 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
.addQueryParam("memory", "3").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "createServiceOffering",
|
||||
String.class, String.class, int.class, int.class, int.class, CreateServiceOfferingOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText", 1, 2, 3));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createServiceOffering.getRequestLine());
|
||||
|
@ -69,8 +70,8 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testUpdateServiceOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("updateServiceOffering",
|
||||
String.class, UpdateServiceOfferingOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "updateServiceOffering",
|
||||
String.class, UpdateServiceOfferingOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -86,7 +87,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testDeleteServiceOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("deleteServiceOffering", String.class));
|
||||
Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "deleteServiceOffering", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -102,8 +103,8 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testCreateDiskOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("createDiskOffering",
|
||||
String.class, String.class, CreateDiskOfferingOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "createDiskOffering",
|
||||
String.class, String.class, CreateDiskOfferingOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -119,8 +120,8 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testUpdateDiskOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("updateDiskOffering",
|
||||
String.class, UpdateDiskOfferingOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "updateDiskOffering",
|
||||
String.class, UpdateDiskOfferingOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -136,7 +137,7 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testDeleteDiskOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("deleteDiskOffering", String.class));
|
||||
Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "deleteDiskOffering", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -152,8 +153,8 @@ public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testUpdateNetworkOffering() throws Exception {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalOfferingAsyncClient.class.getMethod("updateNetworkOffering",
|
||||
String.class, UpdateNetworkOfferingOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "updateNetworkOffering",
|
||||
String.class, UpdateNetworkOfferingOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,16 +18,17 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListStoragePoolsOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -37,7 +38,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalStoragePoolAsyncClient> {
|
||||
|
||||
public void testListStoragePools() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalStoragePoolAsyncClient.class.getMethod("listStoragePools", ListStoragePoolsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalStoragePoolAsyncClient.class, "listStoragePools", ListStoragePoolsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -53,7 +54,7 @@ public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientT
|
|||
}
|
||||
|
||||
public void testListStoragePoolsOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(GlobalStoragePoolAsyncClient.class.getMethod("listStoragePools", ListStoragePoolsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalStoragePoolAsyncClient.class, "listStoragePools", ListStoragePoolsOptions[].class);
|
||||
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,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -26,12 +28,11 @@ import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
|
|||
import org.jclouds.cloudstack.options.ListUsageRecordsOptions;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -49,8 +50,8 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
c.set(Calendar.DAY_OF_MONTH, 31);
|
||||
Date end = c.getTime();
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("generateUsageRecords",
|
||||
Date.class, Date.class, GenerateUsageRecordsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "generateUsageRecords",
|
||||
Date.class, Date.class, GenerateUsageRecordsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -74,8 +75,8 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
c.set(Calendar.DAY_OF_MONTH, 31);
|
||||
Date end = c.getTime();
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("generateUsageRecords",
|
||||
Date.class, Date.class, GenerateUsageRecordsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "generateUsageRecords",
|
||||
Date.class, Date.class, GenerateUsageRecordsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, GenerateUsageRecordsOptions.Builder.domainId("42")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -99,8 +100,8 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
c.set(Calendar.DAY_OF_MONTH, 31);
|
||||
Date end = c.getTime();
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("listUsageRecords",
|
||||
Date.class, Date.class, ListUsageRecordsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "listUsageRecords",
|
||||
Date.class, Date.class, ListUsageRecordsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -124,8 +125,8 @@ public class GlobalUsageAsyncClientTest extends BaseCloudStackAsyncClientTest<Gl
|
|||
c.set(Calendar.DAY_OF_MONTH, 31);
|
||||
Date end = c.getTime();
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(GlobalUsageAsyncClient.class.getMethod("listUsageRecords",
|
||||
Date.class, Date.class, ListUsageRecordsOptions[].class));
|
||||
Invokable<?, ?> method = method(GlobalUsageAsyncClient.class, "listUsageRecords",
|
||||
Date.class, Date.class, ListUsageRecordsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(start, end, ListUsageRecordsOptions.Builder.accountInDomain("fred", "42").accountId("41").keyword("bob")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.CreateUserOptions;
|
||||
|
@ -25,12 +27,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 com.google.common.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}
|
||||
*/
|
||||
|
@ -49,8 +50,8 @@ public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<Glo
|
|||
.addQueryParam("lastname", "LastName").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(GlobalUserAsyncClient.class, "createUser", String.class, String.class,
|
||||
String.class, String.class, String.class, String.class, CreateUserOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("user", "account", "email@example.com",
|
||||
"hashed-password", "FirstName", "LastName"));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(GlobalUserAsyncClient.class, "updateUser", String.class, UpdateUserOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(GlobalUserAsyncClient.class, "deleteUser", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(42L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -28,13 +30,12 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.ListOSTypesOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -46,7 +47,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestOSAsyncClient> {
|
||||
|
||||
public void testGetOSCategory() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GuestOSAsyncClient.class.getMethod("getOSCategory", String.class));
|
||||
Invokable<?, ?> method = method(GuestOSAsyncClient.class, "getOSCategory", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -63,7 +64,7 @@ public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestO
|
|||
}
|
||||
|
||||
public void testListOSCategories() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(GuestOSAsyncClient.class.getMethod("listOSCategories"));
|
||||
Invokable<?, ?> method = method(GuestOSAsyncClient.class, "listOSCategories");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -80,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));
|
||||
Invokable<?, ?> method = method(GuestOSAsyncClient.class, "getOSType", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11l));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -98,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));
|
||||
Invokable<?, ?> method = method(GuestOSAsyncClient.class, "listOSTypes", ListOSTypesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -115,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));
|
||||
Invokable<?, ?> method = method(GuestOSAsyncClient.class, "listOSTypes", ListOSTypesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListOSTypesOptions.Builder.OSCategoryId("11")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,17 +18,18 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.cloudstack.functions.ParseNamesFromHttpResponse;
|
||||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -40,7 +41,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<HypervisorAsyncClient> {
|
||||
|
||||
public void testListHypervisors() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(HypervisorAsyncClient.class.getMethod("listHypervisors"));
|
||||
Invokable<?, ?> method = method(HypervisorAsyncClient.class, "listHypervisors");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -57,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));
|
||||
Invokable<?, ?> method = method(HypervisorAsyncClient.class, "listHypervisorsInZone", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(11));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.cloudstack.domain.ExtractMode;
|
||||
import org.jclouds.cloudstack.domain.PermissionOperation;
|
||||
|
@ -48,7 +49,7 @@ import com.google.common.reflect.Invokable;
|
|||
public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncClient> {
|
||||
|
||||
public void testAttachISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("attachISO", String.class, String.class));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "attachISO", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("3", "5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "detachISO", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "updateISO", String.class, UpdateISOOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "updateISO", String.class, UpdateISOOptions[].class);
|
||||
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,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "deleteISO", String.class, DeleteISOOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "deleteISO", String.class, DeleteISOOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, DeleteISOOptions.Builder.zoneId("5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -153,7 +154,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
.build();
|
||||
|
||||
public void testCopyISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("copyISO", String.class, String.class, String.class));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "copyISO", String.class, String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, 5, 7));
|
||||
|
||||
assertRequestLineEquals(httpRequest, copyIso.getRequestLine());
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "updateISOPermissions", String.class, UpdateISOPermissionsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "updateISOPermissions", String.class, UpdateISOPermissionsOptions[].class);
|
||||
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,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "listISOPermissions", String.class, AccountInDomainOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "listISOPermissions", String.class, AccountInDomainOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, AccountInDomainOptions.Builder.accountInDomain("fred", "5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -240,7 +241,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
.build();
|
||||
|
||||
public void testExtractISO() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractIso.getRequestLine());
|
||||
|
@ -265,7 +266,7 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
|||
.build();
|
||||
|
||||
public void testExtractISOOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class));
|
||||
Invokable<?, ?> method = method(ISOAsyncClient.class, "extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractISOOptions.Builder.url("http://example.com/")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractIsoOptions.getRequestLine());
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -24,11 +25,11 @@ import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListResourceLimitsOptions;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
|
@ -39,7 +40,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class LimitAsyncClientTest extends BaseCloudStackAsyncClientTest<LimitAsyncClient> {
|
||||
|
||||
public void testListResourceLimits() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LimitAsyncClient.class.getMethod("listResourceLimits", ListResourceLimitsOptions[].class));
|
||||
Invokable<?, ?> method = method(LimitAsyncClient.class, "listResourceLimits", ListResourceLimitsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -56,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));
|
||||
Invokable<?, ?> method = method(LimitAsyncClient.class, "listResourceLimits", ListResourceLimitsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListResourceLimitsOptions.Builder.account("jclouds" , "23")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -30,12 +32,11 @@ import org.jclouds.cloudstack.options.UpdateLoadBalancerRuleOptions;
|
|||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -46,8 +47,8 @@ import com.google.common.collect.ImmutableList;
|
|||
@Test(groups = "unit", testName = "LoadBalancerAsyncClientTest")
|
||||
public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<LoadBalancerAsyncClient> {
|
||||
public void testListLoadBalancerRules() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("listLoadBalancerRules",
|
||||
ListLoadBalancerRulesOptions[].class));
|
||||
Invokable<?, ?> method = method(LoadBalancerAsyncClient.class, "listLoadBalancerRules",
|
||||
ListLoadBalancerRulesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -64,8 +65,8 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
}
|
||||
|
||||
public void testListLoadBalancerRulesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("listLoadBalancerRules",
|
||||
ListLoadBalancerRulesOptions[].class));
|
||||
Invokable<?, ?> method = method(LoadBalancerAsyncClient.class, "listLoadBalancerRules",
|
||||
ListLoadBalancerRulesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListLoadBalancerRulesOptions.Builder.publicIPId("3")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -92,8 +93,8 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
.addQueryParam("publicport", "22").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(LoadBalancerAsyncClient.class, "createLoadBalancerRuleForPublicIP", String.class,
|
||||
Algorithm.class, String.class, int.class, int.class, CreateLoadBalancerRuleOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6, Algorithm.LEASTCONN, "tcp", 22, 22));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createLoadBalancerRule.getRequestLine());
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(LoadBalancerAsyncClient.class, "updateLoadBalancerRule", String.class, UpdateLoadBalancerRuleOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(LoadBalancerAsyncClient.class, "deleteLoadBalancerRule", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -143,8 +144,8 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
|||
|
||||
public void testListVirtualMachinesAssignedToLoadBalancerRule() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(LoadBalancerAsyncClient.class.getMethod("listVirtualMachinesAssignedToLoadBalancerRule",
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(LoadBalancerAsyncClient.class, "listVirtualMachinesAssignedToLoadBalancerRule",
|
||||
String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -30,12 +32,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 com.google.common.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.collect.ImmutableList;
|
|||
@Test(groups = "unit", testName = "NATAsyncClientTest")
|
||||
public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncClient> {
|
||||
public void testListIPForwardingRules() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("listIPForwardingRules", ListIPForwardingRulesOptions[].class));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "listIPForwardingRules", ListIPForwardingRulesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "listIPForwardingRules", ListIPForwardingRulesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListIPForwardingRulesOptions.Builder.virtualMachineId("3")));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "getIPForwardingRule", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -106,8 +107,8 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testCreateIPForwardingRuleForVirtualMachine() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "createIPForwardingRule", String.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7, "tcp", 22));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createIpForwardingRule.getRequestLine());
|
||||
|
@ -133,8 +134,8 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
|||
|
||||
public void testCreateIPForwardingRuleForVirtualMachineOptions() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "createIPForwardingRule", String.class, String.class, int.class,
|
||||
CreateIPForwardingRuleOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7, "tcp", 22,
|
||||
CreateIPForwardingRuleOptions.Builder.endPort(22)));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "enableStaticNATForVirtualMachine", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, 6));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "disableStaticNATOnPublicIP", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NATAsyncClient.class, "deleteIPForwardingRule", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -30,13 +32,12 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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.collect.ImmutableList;
|
|||
@Test(groups = "unit", testName = "NetworkAsyncClientTest")
|
||||
public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<NetworkAsyncClient> {
|
||||
public void testListNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("listNetworks", ListNetworksOptions[].class));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "listNetworks", ListNetworksOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "listNetworks", ListNetworksOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListNetworksOptions.Builder.type(NetworkType.ADVANCED)
|
||||
.domainId("6").id("5")));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "getNetwork", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("id"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -109,8 +110,8 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
|||
.addQueryParam("displaytext", "lovely").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "createNetworkInZone", String.class, String.class, String.class,
|
||||
String.class, CreateNetworkOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createNetwork.getRequestLine());
|
||||
|
@ -137,8 +138,8 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
|||
.addQueryParam("domainid", "6").build();
|
||||
|
||||
public void testCreateNetworkInZoneOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("createNetworkInZone", String.class, String.class, String.class,
|
||||
String.class, CreateNetworkOptions[].class));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "createNetworkInZone", String.class, String.class, String.class,
|
||||
String.class, CreateNetworkOptions[].class);
|
||||
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1, 2, "named", "lovely", CreateNetworkOptions.Builder
|
||||
.netmask("255.255.255.0").domainId("6")));
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "deleteNetwork", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.DEFAULT;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -30,13 +31,12 @@ import org.jclouds.cloudstack.options.ListNetworkOfferingsOptions;
|
|||
import org.jclouds.cloudstack.options.ListServiceOfferingsOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -47,7 +47,7 @@ import com.google.common.collect.ImmutableList;
|
|||
@Test(groups = "unit", testName = "OfferingAsyncClientTest")
|
||||
public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<OfferingAsyncClient> {
|
||||
public void testListDiskOfferings() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listDiskOfferings", ListDiskOfferingsOptions[].class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "listDiskOfferings", ListDiskOfferingsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -64,7 +64,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testListDiskOfferingsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listDiskOfferings", ListDiskOfferingsOptions[].class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "listDiskOfferings", ListDiskOfferingsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListDiskOfferingsOptions.Builder.domainId("6").id("5")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -81,7 +81,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testGetDiskOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("getDiskOffering", String.class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "getDiskOffering", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -99,7 +99,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testListNetworkOfferings() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listNetworkOfferings", ListNetworkOfferingsOptions[].class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "listNetworkOfferings", ListNetworkOfferingsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -116,7 +116,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testListNetworkOfferingsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listNetworkOfferings", ListNetworkOfferingsOptions[].class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "listNetworkOfferings", ListNetworkOfferingsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListNetworkOfferingsOptions.Builder.availability(DEFAULT).isShared(true).id("6")));
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testGetNetworkOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("getNetworkOffering", String.class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "getNetworkOffering", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -153,7 +153,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testListServiceOfferings() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listServiceOfferings", ListServiceOfferingsOptions[].class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "listServiceOfferings", ListServiceOfferingsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -170,7 +170,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testListServiceOfferingsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("listServiceOfferings", ListServiceOfferingsOptions[].class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "listServiceOfferings", ListServiceOfferingsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListServiceOfferingsOptions.Builder.virtualMachineId("4")
|
||||
.domainId("5").id("6")));
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<Offer
|
|||
}
|
||||
|
||||
public void testGetServiceOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OfferingAsyncClient.class.getMethod("getServiceOffering", String.class));
|
||||
Invokable<?, ?> method = method(OfferingAsyncClient.class, "getServiceOffering", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("5"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -33,14 +34,13 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.ssh.SshKeys;
|
||||
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}
|
||||
*
|
||||
|
@ -50,7 +50,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSHKeyPairAsyncClient> {
|
||||
|
||||
public void testListSSHKeyPairs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("listSSHKeyPairs", ListSSHKeyPairsOptions[].class));
|
||||
Invokable<?, ?> method = method(SSHKeyPairAsyncClient.class, "listSSHKeyPairs", ListSSHKeyPairsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -67,7 +67,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
}
|
||||
|
||||
public void testListSSHKeyPairsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("listSSHKeyPairs", ListSSHKeyPairsOptions[].class));
|
||||
Invokable<?, ?> method = method(SSHKeyPairAsyncClient.class, "listSSHKeyPairs", ListSSHKeyPairsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSSHKeyPairsOptions.Builder.name("jclouds")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -84,7 +84,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
}
|
||||
|
||||
public void testGetSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("getSSHKeyPair", String.class));
|
||||
Invokable<?, ?> method = method(SSHKeyPairAsyncClient.class, "getSSHKeyPair", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -102,7 +102,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));
|
||||
Invokable<?, ?> method = method(SSHKeyPairAsyncClient.class, "registerSSHKeyPair", String.class, String.class);
|
||||
String publicKey = URLEncoder.encode(SshKeys.generate().get("public"), "UTF-8");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair", publicKey));
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -122,7 +122,7 @@ public class SSHKeyPairAsyncClientTest extends BaseCloudStackAsyncClientTest<SSH
|
|||
|
||||
|
||||
public void testDeleteSSHKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SSHKeyPairAsyncClient.class.getMethod("deleteSSHKeyPair", String.class));
|
||||
Invokable<?, ?> method = method(SSHKeyPairAsyncClient.class, "deleteSSHKeyPair", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-keypair"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -31,7 +33,6 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -40,7 +41,7 @@ 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 @@ import com.google.common.collect.Multimap;
|
|||
public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<SecurityGroupAsyncClient> {
|
||||
|
||||
public void testListSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("listSecurityGroups", ListSecurityGroupsOptions[].class));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "listSecurityGroups", ListSecurityGroupsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "listSecurityGroups", ListSecurityGroupsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListSecurityGroupsOptions.Builder.virtualMachineId("4")
|
||||
.domainId("5").id("6")));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "getSecurityGroup", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "createSecurityGroup", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -133,8 +134,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
.addQueryParam("cidrlist", "1.1.1.1/24,1.2.2.2/16").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "authorizeIngressPortsToCIDRs", String.class,
|
||||
String.class, int.class, int.class, Iterable.class, AccountInDomainOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, "tcp", 22, 22,
|
||||
ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16")));
|
||||
|
||||
|
@ -166,8 +167,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
.addQueryParam("usersecuritygrouplist%5B2%5D.group", "group1").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "authorizeIngressPortsToSecurityGroups", String.class,
|
||||
String.class, int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, "tcp", 22, 22,
|
||||
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1")));
|
||||
|
||||
|
@ -194,8 +195,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
.addQueryParam("cidrlist", "1.1.1.1/24,1.2.2.2/16").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "authorizeIngressICMPToCIDRs", String.class , int.class,
|
||||
int.class, Iterable.class, AccountInDomainOptions[].class);
|
||||
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());
|
||||
|
@ -226,8 +227,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
.addQueryParam("usersecuritygrouplist%5B2%5D.group", "group1").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "authorizeIngressICMPToSecurityGroups", String.class,
|
||||
int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(2, 22, 22,
|
||||
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1")));
|
||||
|
||||
|
@ -244,8 +245,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
|||
}
|
||||
|
||||
public void testRevokeIngressRule() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("revokeIngressRule", String.class,
|
||||
AccountInDomainOptions[].class));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "revokeIngressRule", String.class,
|
||||
AccountInDomainOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5,
|
||||
AccountInDomainOptions.Builder.accountInDomain("adrian", "1")));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "deleteSecurityGroup", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
|
@ -34,14 +36,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 com.google.common.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 @@ import com.google.common.collect.ImmutableSet;
|
|||
public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<SnapshotAsyncClient> {
|
||||
|
||||
public void testCreateSnapshot() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("createSnapshot", String.class, CreateSnapshotOptions[].class));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "createSnapshot", String.class, CreateSnapshotOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "createSnapshot", String.class, CreateSnapshotOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, CreateSnapshotOptions.Builder.accountInDomain("acc", "7").policyId("9")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "listSnapshots", ListSnapshotsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "getSnapshot", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "listSnapshots", ListSnapshotsOptions[].class);
|
||||
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,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "deleteSnapshot", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(14));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -161,7 +162,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
.addQueryParam("schedule", "07%3A06%3A05").build();
|
||||
|
||||
public void testCreateSnapshotPolicy() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("createSnapshotPolicy", SnapshotPolicySchedule.class, String.class, String.class, String.class));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "createSnapshotPolicy", SnapshotPolicySchedule.class, String.class, String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(SnapshotPolicySchedules.monthly(5, 6, 7), 10, "UTC", 12));
|
||||
|
||||
assertRequestLineEquals(httpRequest,extractIso.getRequestLine());
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "deleteSnapshotPolicy", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(7));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -192,7 +193,7 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
|||
}
|
||||
|
||||
public void testDeleteSnapshotPolicies() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(SnapshotAsyncClient.class.getMethod("deleteSnapshotPolicies", Iterable.class));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "deleteSnapshotPolicies", Iterable.class);
|
||||
Iterable<String> ids = ImmutableSet.of("3", "5", "7");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ids));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "listSnapshotPolicies", String.class, ListSnapshotPoliciesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(10));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(SnapshotAsyncClient.class, "listSnapshotPolicies", String.class, ListSnapshotPoliciesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(10, ListSnapshotPoliciesOptions.Builder.accountInDomain("fred", "4").keyword("bob")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -41,14 +43,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 com.google.common.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 @@ import com.google.common.collect.ImmutableSet;
|
|||
public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<TemplateAsyncClient> {
|
||||
|
||||
public void testCreateTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("createTemplate", TemplateMetadata.class, CreateTemplateOptions[].class));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "createTemplate", TemplateMetadata.class, CreateTemplateOptions[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "createTemplate", TemplateMetadata.class, CreateTemplateOptions[].class);
|
||||
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");
|
||||
|
@ -102,7 +103,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
.addQueryParam("displaytext", "description").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class);
|
||||
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());
|
||||
|
@ -138,7 +139,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
.addQueryParam("displaytext", "description").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class);
|
||||
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)));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "updateTemplate", String.class, UpdateTemplateOptions[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "updateTemplate", String.class, UpdateTemplateOptions[].class);
|
||||
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");
|
||||
|
@ -192,7 +193,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
.addQueryParam("destzoneid", "19").build();
|
||||
|
||||
public void testCopyTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("copyTemplateToZone", String.class, String.class, String.class));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "copyTemplateToZone", String.class, String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(17, 18, 19));
|
||||
|
||||
assertRequestLineEquals(httpRequest,copyTemplate.getRequestLine());
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "deleteTemplate", String.class, DeleteTemplateOptions[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "deleteTemplate", String.class, DeleteTemplateOptions[].class);
|
||||
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");
|
||||
|
@ -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"));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "listTemplates");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "listTemplates", ListTemplatesOptions.class);
|
||||
GeneratedHttpRequest httpRequest = processor
|
||||
.createRequest(
|
||||
method, ImmutableList.<Object> of(
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "getTemplateInZone", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, 1));
|
||||
|
||||
assertRequestLineEquals(
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "updateTemplatePermissions", String.class, UpdateTemplatePermissionsOptions[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "updateTemplatePermissions", String.class, UpdateTemplatePermissionsOptions[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "listTemplatePermissions", String.class, AccountInDomainOptions[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "listTemplatePermissions", String.class, AccountInDomainOptions[].class);
|
||||
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");
|
||||
|
@ -363,7 +364,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
.addQueryParam("zoneid", "5").build();
|
||||
|
||||
public void testExtractTemplate() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractTemplate.getRequestLine());
|
||||
|
@ -387,7 +388,7 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
|||
.addQueryParam("url", "http%3A//example.com/").build();
|
||||
|
||||
public void testExtractTemplateOptions() throws NoSuchMethodException {
|
||||
Invokable<?, ?> method = Invokable.from(TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class));
|
||||
Invokable<?, ?> method = method(TemplateAsyncClient.class, "extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractTemplateOptions.Builder.url("http://example.com/")));
|
||||
|
||||
assertRequestLineEquals(httpRequest, extractTemplateOptions.getRequestLine());
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -31,13 +33,12 @@ import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
|||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -49,7 +50,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class VMGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<VMGroupAsyncClient> {
|
||||
|
||||
public void testListVMGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VMGroupAsyncClient.class.getMethod("listInstanceGroups", ListVMGroupsOptions[].class));
|
||||
Invokable<?, ?> method = method(VMGroupAsyncClient.class, "listInstanceGroups", ListVMGroupsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -66,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));
|
||||
Invokable<?, ?> method = method(VMGroupAsyncClient.class, "listInstanceGroups", ListVMGroupsOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListVMGroupsOptions.Builder.account("fred")
|
||||
.domainId("5").id("6")));
|
||||
|
||||
|
@ -85,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));
|
||||
Invokable<?, ?> method = method(VMGroupAsyncClient.class, "getInstanceGroup", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -103,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));
|
||||
Invokable<?, ?> method = method(VMGroupAsyncClient.class, "createInstanceGroup", String.class, CreateVMGroupOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo"));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -120,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));
|
||||
Invokable<?, ?> method = method(VMGroupAsyncClient.class, "createInstanceGroup", String.class, CreateVMGroupOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("goo", CreateVMGroupOptions.Builder.account("foo").domainId("42")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -137,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));
|
||||
Invokable<?, ?> method = method(VMGroupAsyncClient.class, "updateInstanceGroup", String.class, UpdateVMGroupOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5, UpdateVMGroupOptions.Builder.name("fred")));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -154,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));
|
||||
Invokable<?, ?> method = method(VMGroupAsyncClient.class, "deleteInstanceGroup", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -31,13 +33,12 @@ import org.jclouds.functions.IdentityFunction;
|
|||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import org.jclouds.http.functions.UnwrapOnlyJsonValue;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -48,8 +49,8 @@ import com.google.common.collect.ImmutableList;
|
|||
@Test(groups = "unit", testName = "VirtualMachineAsyncClientTest")
|
||||
public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest<VirtualMachineAsyncClient> {
|
||||
public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("listVirtualMachines",
|
||||
ListVirtualMachinesOptions[].class));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "listVirtualMachines",
|
||||
ListVirtualMachinesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -66,8 +67,8 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testListVirtualMachinesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("listVirtualMachines",
|
||||
ListVirtualMachinesOptions[].class));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "listVirtualMachines",
|
||||
ListVirtualMachinesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
ListVirtualMachinesOptions.Builder.accountInDomain("adrian", "6").usesVirtualNetwork(true)));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "getVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -112,8 +113,8 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
.addQueryParam("templateid", "5").build();
|
||||
|
||||
public void testDeployVirtualMachineInZone() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("deployVirtualMachineInZone", String.class, String.class,
|
||||
String.class, DeployVirtualMachineOptions[].class));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "deployVirtualMachineInZone", String.class, String.class,
|
||||
String.class, DeployVirtualMachineOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6, 4, 5));
|
||||
|
||||
assertRequestLineEquals(httpRequest, deployVirtualMachine.getRequestLine());
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "rebootVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "startVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "stopVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "resetPasswordForVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "changeServiceForVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "updateVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "destroyVirtualMachine", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(5));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -248,8 +249,8 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
|||
}
|
||||
|
||||
public void testAssignVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VirtualMachineAsyncClient.class.getMethod("assignVirtualMachine", String.class,
|
||||
AssignVirtualMachineOptions[].class));
|
||||
Invokable<?, ?> method = method(VirtualMachineAsyncClient.class, "assignVirtualMachine", String.class,
|
||||
AssignVirtualMachineOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("abcd",
|
||||
AssignVirtualMachineOptions.Builder.accountInDomain("adrian", "6")));
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -26,12 +28,11 @@ import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
|||
import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
||||
import org.jclouds.cloudstack.options.ListVolumesOptions;
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import com.google.common.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 @@ import com.google.common.collect.ImmutableList;
|
|||
public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeAsyncClient> {
|
||||
|
||||
public void testListVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("listVolumes", ListVolumesOptions[].class));
|
||||
Invokable<?, ?> method = method(VolumeAsyncClient.class, "listVolumes", ListVolumesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VolumeAsyncClient.class, "getVolume", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -83,8 +84,8 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
.addQueryParam("zoneid", "111").build();
|
||||
|
||||
public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("createVolumeFromSnapshotInZone", String.class, String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(VolumeAsyncClient.class, "createVolumeFromSnapshotInZone", String.class, String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-volume", 999L, 111l));
|
||||
|
||||
assertRequestLineEquals(httpRequest, createVolumeFromSnapshot.getRequestLine());
|
||||
|
@ -105,8 +106,8 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
.addQueryParam("zoneid", "111").build();
|
||||
|
||||
public void testCreateVolumeFromDiskOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("createVolumeFromDiskOfferingInZone", String.class, String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(VolumeAsyncClient.class, "createVolumeFromDiskOfferingInZone", String.class, String.class,
|
||||
String.class);
|
||||
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("jclouds-volume", 999L, 111L));
|
||||
|
||||
|
@ -120,7 +121,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));
|
||||
Invokable<?, ?> method = method(VolumeAsyncClient.class, "attachVolume", String.class, String.class);
|
||||
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L, 999L));
|
||||
|
||||
|
@ -135,7 +136,7 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
|||
}
|
||||
|
||||
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VolumeAsyncClient.class.getMethod("detachVolume", String.class));
|
||||
Invokable<?, ?> method = method(VolumeAsyncClient.class, "detachVolume", String.class);
|
||||
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(VolumeAsyncClient.class, "deleteVolume", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(111L));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.cloudstack.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -26,14 +28,13 @@ import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
|
|||
import org.jclouds.cloudstack.options.ListZonesOptions;
|
||||
import org.jclouds.functions.IdentityFunction;
|
||||
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -44,7 +45,7 @@ import com.google.common.collect.Iterables;
|
|||
@Test(groups = "unit", testName = "ZoneAsyncClientTest")
|
||||
public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsyncClient> {
|
||||
public void testListZones() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ZoneAsyncClient.class.getMethod("listZones", ListZonesOptions[].class));
|
||||
Invokable<?, ?> method = method(ZoneAsyncClient.class, "listZones", ListZonesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
@ -71,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));
|
||||
Invokable<?, ?> method = method(ZoneAsyncClient.class, "listZones", ListZonesOptions[].class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListZonesOptions.Builder.available(true).domainId("5")
|
||||
.id("6")));
|
||||
|
||||
|
@ -89,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));
|
||||
Invokable<?, ?> method = method(ZoneAsyncClient.class, "getZone", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(6));
|
||||
|
||||
assertRequestLineEquals(httpRequest,
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.jclouds.cloudstack.internal;
|
|||
import static com.google.common.collect.Iterables.filter;
|
||||
import static com.google.common.collect.Iterables.get;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.jclouds.util.Predicates2.retry;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte
|
|||
|
||||
@Override
|
||||
protected TypeToken<CloudStackContext> viewType() {
|
||||
return typeTokenOf(CloudStackContext.class);
|
||||
return typeToken(CloudStackContext.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.cloudwatch.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class CloudWatchRestClientModule extends FormSigningRestClientModule<Clou
|
|||
.build();
|
||||
|
||||
public CloudWatchRestClientModule() {
|
||||
super(typeTokenOf(CloudWatchApi.class), typeTokenOf(CloudWatchAsyncApi.class), DELEGATE_MAP);
|
||||
super(typeToken(CloudWatchApi.class), typeToken(CloudWatchAsyncApi.class), DELEGATE_MAP);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.ec2.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class EC2RestClientModule<S extends EC2Api, A extends EC2AsyncApi> extend
|
|||
@SuppressWarnings("unchecked")
|
||||
public EC2RestClientModule() {
|
||||
// retaining top-level type of EC2Client vs EC2Api until we migrate all functionality up
|
||||
super(TypeToken.class.cast(typeTokenOf(EC2Client.class)), TypeToken.class.cast(typeTokenOf(EC2AsyncClient.class)), DELEGATE_MAP);
|
||||
super(TypeToken.class.cast(typeToken(EC2Client.class)), TypeToken.class.cast(typeToken(EC2AsyncClient.class)), DELEGATE_MAP);
|
||||
}
|
||||
|
||||
protected EC2RestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.ec2.services;
|
||||
|
||||
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.executableBy;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -34,13 +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 com.google.common.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}
|
||||
*
|
||||
|
@ -64,8 +64,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -97,8 +97,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "createImageInRegion", String.class, String.class, String.class,
|
||||
CreateImageOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "instanceId", new CreateImageOptions()
|
||||
.withDescription("description").noReboot()));
|
||||
|
||||
|
@ -128,8 +128,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -163,8 +163,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "describeImagesInRegion", String.class,
|
||||
DescribeImagesOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||
"1", "2")));
|
||||
|
||||
|
@ -195,7 +195,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "deregisterImageInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -226,8 +226,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -258,8 +258,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerImageFromManifestInRegion", String.class, String.class,
|
||||
String.class, RegisterImageOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "pathToManifest", new RegisterImageOptions()
|
||||
.withDescription("description")));
|
||||
|
||||
|
@ -293,8 +293,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageName", "snapshotId"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -334,8 +334,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "registerUnixImageBackedByEbsInRegion", String.class,
|
||||
String.class, String.class, RegisterImageBackedByEbsOptions[].class);
|
||||
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)));
|
||||
|
@ -368,8 +368,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "getBlockDeviceMappingsForImageInRegion", String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -400,7 +400,7 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", String.class, String.class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "getLaunchPermissionForImageInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -435,8 +435,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "addLaunchPermissionsToImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "imageId"));
|
||||
|
||||
|
@ -472,8 +472,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "removeLaunchPermissionsFromImageInRegion", String.class,
|
||||
Iterable.class, Iterable.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "imageId"));
|
||||
|
||||
|
@ -504,8 +504,8 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(AMIAsyncClient.class, "resetLaunchPermissionsOnImageInRegion", String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "imageId"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.ec2.services;
|
|||
|
||||
import static org.jclouds.ec2.options.DescribeAvailabilityZonesOptions.Builder.availabilityZones;
|
||||
import static org.jclouds.ec2.options.DescribeRegionsOptions.Builder.regions;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -30,12 +31,11 @@ import org.jclouds.ec2.options.DescribeRegionsOptions;
|
|||
import org.jclouds.ec2.xml.DescribeAvailabilityZonesResponseHandler;
|
||||
import org.jclouds.ec2.xml.DescribeRegionsResponseHandler;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -47,8 +47,8 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
BaseEC2AsyncClientTest<AvailabilityZoneAndRegionAsyncClient> {
|
||||
|
||||
public void testDescribeAvailabilityZones() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeAvailabilityZonesInRegion",
|
||||
String.class, DescribeAvailabilityZonesOptions[].class));
|
||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeAvailabilityZonesInRegion",
|
||||
String.class, DescribeAvailabilityZonesOptions[].class);
|
||||
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");
|
||||
|
@ -64,8 +64,8 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
}
|
||||
|
||||
public void testDescribeAvailabilityZonesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeAvailabilityZonesInRegion",
|
||||
String.class, DescribeAvailabilityZonesOptions[].class));
|
||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeAvailabilityZonesInRegion",
|
||||
String.class, DescribeAvailabilityZonesOptions[].class);
|
||||
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");
|
||||
|
@ -82,8 +82,8 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
}
|
||||
|
||||
public void testDescribeRegions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeRegions",
|
||||
DescribeRegionsOptions[].class));
|
||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeRegions",
|
||||
DescribeRegionsOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -99,8 +99,8 @@ public class AvailabilityZoneAndRegionAsyncClientTest extends
|
|||
}
|
||||
|
||||
public void testDescribeRegionsOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(AvailabilityZoneAndRegionAsyncClient.class.getMethod("describeRegions",
|
||||
DescribeRegionsOptions[].class));
|
||||
Invokable<?, ?> method = method(AvailabilityZoneAndRegionAsyncClient.class, "describeRegions",
|
||||
DescribeRegionsOptions[].class);
|
||||
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");
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.jclouds.ec2.services;
|
|||
|
||||
import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.ownedBy;
|
||||
import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.fromInstance;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -36,13 +37,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 com.google.common.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 +53,7 @@ import com.google.common.collect.Lists;
|
|||
public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<ElasticBlockStoreAsyncClient> {
|
||||
|
||||
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("deleteVolumeInRegion", String.class, String.class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "deleteVolumeInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -80,8 +80,8 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", String.class,
|
||||
String[].class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeVolumesInRegion", String.class,
|
||||
String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -99,8 +99,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeVolumesInRegion", String.class,
|
||||
String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -130,8 +130,8 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("attachVolumeInRegion", String.class, String.class,
|
||||
String.class, String.class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "attachVolumeInRegion", String.class, String.class,
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", "instanceId", "/device"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -162,8 +162,8 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
||||
boolean.class, DetachVolumeOptions[].class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "detachVolumeInRegion", String.class, String.class,
|
||||
boolean.class, DetachVolumeOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", false));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -196,8 +196,8 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
||||
boolean.class, DetachVolumeOptions[].class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "detachVolumeInRegion", String.class, String.class,
|
||||
boolean.class, DetachVolumeOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "id", true, fromInstance("instanceId").fromDevice(
|
||||
"/device")));
|
||||
|
||||
|
@ -216,8 +216,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "createSnapshotInRegion", String.class,
|
||||
String.class, CreateSnapshotOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -233,8 +233,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "createSnapshotInRegion", String.class,
|
||||
String.class, CreateSnapshotOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "volumeId", CreateSnapshotOptions.Builder
|
||||
.withDescription("description")));
|
||||
|
||||
|
@ -252,8 +252,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeSnapshotsInRegion", String.class,
|
||||
DescribeSnapshotsOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -269,8 +269,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "describeSnapshotsInRegion", String.class,
|
||||
DescribeSnapshotsOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ownedBy("o1", "o2").restorableBy("r1", "r2")
|
||||
.snapshotIds("s1", "s2")));
|
||||
|
||||
|
@ -289,8 +289,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "getCreateVolumePermissionForSnapshotInRegion",
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -325,8 +325,8 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("addCreateVolumePermissionsToSnapshotInRegion",
|
||||
String.class, Iterable.class, Iterable.class, String.class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "addCreateVolumePermissionsToSnapshotInRegion",
|
||||
String.class, Iterable.class, Iterable.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "snapshotId"));
|
||||
|
||||
|
@ -363,8 +363,8 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
|
||||
public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("removeCreateVolumePermissionsFromSnapshotInRegion",
|
||||
String.class, Iterable.class, Iterable.class, String.class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "removeCreateVolumePermissionsFromSnapshotInRegion",
|
||||
String.class, Iterable.class, Iterable.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||
.of("all"), "snapshotId"));
|
||||
|
||||
|
@ -384,8 +384,8 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
|||
|
||||
public void testResetCreateVolumePermissionsOnSnapshot() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticBlockStoreAsyncClient.class.getMethod("resetCreateVolumePermissionsOnSnapshotInRegion",
|
||||
String.class, String.class));
|
||||
Invokable<?, ?> method = method(ElasticBlockStoreAsyncClient.class, "resetCreateVolumePermissionsOnSnapshotInRegion",
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "snapshotId"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.ec2.services;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -26,12 +28,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 com.google.common.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}
|
||||
*
|
||||
|
@ -42,8 +43,8 @@ import com.google.common.collect.Lists;
|
|||
public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<ElasticIPAddressAsyncClient> {
|
||||
|
||||
public void testDisassociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticIPAddressAsyncClient.class.getMethod("disassociateAddressInRegion", String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "disassociateAddressInRegion", String.class,
|
||||
String.class);
|
||||
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");
|
||||
|
@ -72,8 +73,8 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticIPAddressAsyncClient.class.getMethod("associateAddressInRegion", String.class,
|
||||
String.class, String.class));
|
||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "associateAddressInRegion", String.class,
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "127.0.0.1", "me"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "releaseAddressInRegion", String.class, String.class);
|
||||
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");
|
||||
|
@ -107,8 +108,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "describeAddressesInRegion", String.class,
|
||||
String[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(ElasticIPAddressAsyncClient.class, "allocateAddressInRegion", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.ec2.services;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -39,14 +41,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 com.google.common.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.collect.Maps;
|
|||
@Test(groups = "unit", testName = "InstanceAsyncClientTest")
|
||||
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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "describeInstancesInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "describeInstancesInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -88,8 +89,8 @@ 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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "terminateInstancesInRegion", String.class,
|
||||
String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -105,8 +106,8 @@ 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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "runInstancesInRegion", String.class, String.class,
|
||||
String.class, int.class, int.class, RunInstancesOptions[].class);
|
||||
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");
|
||||
|
@ -127,8 +128,8 @@ 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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "runInstancesInRegion", String.class, String.class,
|
||||
String.class, int.class, int.class, RunInstancesOptions[].class);
|
||||
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")));
|
||||
|
||||
|
@ -154,8 +155,8 @@ 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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "stopInstancesInRegion", String.class, boolean.class,
|
||||
String[].class);
|
||||
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");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "rebootInstancesInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "startInstancesInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getUserDataForInstanceInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -220,8 +221,8 @@ 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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getRootDeviceNameForInstanceInRegion", String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getRamdiskForInstanceInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -256,8 +257,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testGetDisableApiTerminationForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("isApiTerminationDisabledForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "isApiTerminationDisabledForInstanceInRegion", String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getKernelForInstanceInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -290,8 +291,8 @@ 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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getInstanceTypeForInstanceInRegion", String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -309,8 +310,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testGetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
||||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -329,8 +330,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testGetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("getBlockDeviceMappingForInstanceInRegion", String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getBlockDeviceMappingForInstanceInRegion", String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -361,8 +362,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", String.class, String.class,
|
||||
byte[].class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setUserDataForInstanceInRegion", String.class, String.class,
|
||||
byte[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test".getBytes()));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -394,8 +395,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", String.class, String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setRamdiskForInstanceInRegion", String.class, String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -427,8 +428,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", String.class, String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setKernelForInstanceInRegion", String.class, String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "test"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -461,8 +462,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setApiTerminationDisabledForInstanceInRegion", String.class,
|
||||
String.class, boolean.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setApiTerminationDisabledForInstanceInRegion", String.class,
|
||||
String.class, boolean.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", true));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -494,8 +495,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", String.class,
|
||||
String.class, String.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setInstanceTypeForInstanceInRegion", String.class,
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceType.C1_MEDIUM));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -528,8 +529,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
||||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class, InstanceInitiatedShutdownBehavior.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||
String.class, String.class, InstanceInitiatedShutdownBehavior.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", InstanceInitiatedShutdownBehavior.TERMINATE));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -548,8 +549,8 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
|||
|
||||
public void testSetBlockDeviceMappingForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(InstanceAsyncClient.class.getMethod("setBlockDeviceMappingForInstanceInRegion", String.class,
|
||||
String.class, Map.class));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "setBlockDeviceMappingForInstanceInRegion", String.class,
|
||||
String.class, Map.class);
|
||||
|
||||
Map<String, BlockDevice> mapping = Maps.newLinkedHashMap();
|
||||
mapping.put("/dev/sda1", new BlockDevice("vol-test1", true));
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(InstanceAsyncClient.class, "getConsoleOutputForInstanceInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
|
|
@ -18,18 +18,19 @@
|
|||
*/
|
||||
package org.jclouds.ec2.services;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
import org.jclouds.ec2.xml.DescribeKeyPairsResponseHandler;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -40,7 +41,7 @@ import com.google.common.collect.Lists;
|
|||
public class KeyPairAsyncClientTest extends BaseEC2AsyncClientTest<KeyPairAsyncClient> {
|
||||
|
||||
public void testDeleteKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(KeyPairAsyncClient.class.getMethod("deleteKeyPairInRegion", String.class, String.class));
|
||||
Invokable<?, ?> method = method(KeyPairAsyncClient.class, "deleteKeyPairInRegion", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "mykey"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -56,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));
|
||||
Invokable<?, ?> method = method(KeyPairAsyncClient.class, "describeKeyPairsInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -72,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));
|
||||
Invokable<?, ?> method = method(KeyPairAsyncClient.class, "describeKeyPairsInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.ec2.services;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -28,12 +30,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 com.google.common.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}
|
||||
*
|
||||
|
@ -44,8 +45,8 @@ import com.google.common.collect.Lists;
|
|||
public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<SecurityGroupAsyncClient> {
|
||||
|
||||
public void testDeleteSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("deleteSecurityGroupInRegion", String.class,
|
||||
String.class));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "deleteSecurityGroupInRegion", String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -74,8 +75,8 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(SecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion", String.class,
|
||||
String.class, String.class));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "createSecurityGroupInRegion", String.class,
|
||||
String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "name", "description"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -93,8 +94,8 @@ 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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "describeSecurityGroupsInRegion", String.class,
|
||||
String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -110,8 +111,8 @@ 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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "describeSecurityGroupsInRegion", String.class,
|
||||
String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -127,8 +128,8 @@ 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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "authorizeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, UserIdGroupPair.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", new UserIdGroupPair("sourceUser",
|
||||
"sourceGroup")));
|
||||
|
||||
|
@ -163,8 +164,8 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "authorizeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, IpProtocol.class, int.class, int.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
@ -181,8 +182,8 @@ 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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "revokeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, UserIdGroupPair.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", new UserIdGroupPair("sourceUser",
|
||||
"sourceGroup")));
|
||||
|
||||
|
@ -217,8 +218,8 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(SecurityGroupAsyncClient.class, "revokeSecurityGroupIngressInRegion", String.class,
|
||||
String.class, IpProtocol.class, int.class, int.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0"));
|
||||
|
||||
request = (GeneratedHttpRequest) request.getFilters().get(0).filter(request);
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.ec2.services;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||
|
@ -26,12 +28,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 com.google.common.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}
|
||||
*
|
||||
|
@ -58,8 +59,8 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(WindowsAsyncClient.class, "bundleInstanceInRegion", String.class, String.class,
|
||||
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class);
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(
|
||||
method,
|
||||
|
@ -102,8 +103,8 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
|||
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||
|
||||
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));
|
||||
Invokable<?, ?> method = method(WindowsAsyncClient.class, "bundleInstanceInRegion", String.class, String.class,
|
||||
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class);
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(
|
||||
method,
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(WindowsAsyncClient.class, "describeBundleTasksInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(WindowsAsyncClient.class, "describeBundleTasksInRegion", String.class, String[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList(null, "1", "2"));
|
||||
|
||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.jclouds.elasticstack;
|
|||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.elasticstack.reference.ElasticStackConstants.PROPERTY_VNC_PASSWORD;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -87,7 +87,7 @@ public class ElasticStackApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.0")
|
||||
.defaultEndpoint("https://api-lon-p.elastichosts.com")
|
||||
.defaultProperties(ElasticStackApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(ComputeServiceContext.class))
|
||||
.view(typeToken(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(ElasticStackRestClientModule.class, ElasticStackComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.elasticstack;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -45,14 +46,13 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.io.Payload;
|
||||
import org.jclouds.io.Payloads;
|
||||
import com.google.common.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,7 +62,7 @@ import com.google.common.collect.Iterables;
|
|||
@Test(groups = "unit", testName = "ElasticStackAsyncClientTest")
|
||||
public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStackAsyncClient> {
|
||||
public void testListServers() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listServers"));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listServers");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/list HTTP/1.1");
|
||||
|
@ -89,7 +89,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testListServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listServerInfo"));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listServerInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/info HTTP/1.1");
|
||||
|
@ -104,7 +104,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testGetServerInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("getServerInfo", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "getServerInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/servers/uuid/info HTTP/1.1");
|
||||
|
@ -120,7 +120,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testCreateAndStartServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("createAndStartServer", Server.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "createAndStartServer", Server.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testCreateServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("createServer", Server.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "createServer", Server.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
|
@ -154,7 +154,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));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "setServerConfiguration", String.class, Server.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
BindServerToPlainTextStringTest.SERVER));
|
||||
|
||||
|
@ -171,7 +171,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testDestroyServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("destroyServer", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "destroyServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/destroy HTTP/1.1");
|
||||
|
@ -187,7 +187,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testStartServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("startServer", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "startServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/start HTTP/1.1");
|
||||
|
@ -203,7 +203,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testStopServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("stopServer", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "stopServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/stop HTTP/1.1");
|
||||
|
@ -219,7 +219,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testShutdownServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("shutdownServer", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "shutdownServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/shutdown HTTP/1.1");
|
||||
|
@ -235,7 +235,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testResetServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("resetServer", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "resetServer", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/servers/uuid/reset HTTP/1.1");
|
||||
|
@ -251,7 +251,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testListDrives() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listDrives"));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listDrives");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/list HTTP/1.1");
|
||||
|
@ -278,7 +278,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testListDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("listDriveInfo"));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "listDriveInfo");
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/info HTTP/1.1");
|
||||
|
@ -293,7 +293,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testGetDriveInfo() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("getDriveInfo", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "getDriveInfo", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET https://api-lon-p.elastichosts.com/drives/uuid/info HTTP/1.1");
|
||||
|
@ -309,7 +309,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testCreateDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("createDrive", Drive.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "createDrive", Drive.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(
|
||||
new CreateDriveRequest.Builder().name("foo").size(10000l).build()));
|
||||
|
||||
|
@ -326,7 +326,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));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "setDriveData", String.class, DriveData.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
new DriveData.Builder().name("foo").size(10000l).tags(ImmutableList.of("production", "candy")).build()));
|
||||
|
||||
|
@ -343,7 +343,7 @@ public class ElasticStackAsyncClientTest extends BaseAsyncClientTest<ElasticStac
|
|||
}
|
||||
|
||||
public void testDestroyDrive() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(ElasticStackAsyncClient.class.getMethod("destroyDrive", String.class));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "destroyDrive", String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("uuid"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "POST https://api-lon-p.elastichosts.com/drives/uuid/destroy HTTP/1.1");
|
||||
|
@ -359,7 +359,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));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "imageDrive", String.class, String.class);
|
||||
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");
|
||||
|
@ -375,8 +375,8 @@ 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));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "imageDrive", String.class, String.class,
|
||||
ImageConversionType.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100", "200",
|
||||
ImageConversionType.GUNZIP));
|
||||
|
||||
|
@ -393,7 +393,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));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "readDrive", String.class, long.class, long.class);
|
||||
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");
|
||||
|
@ -408,7 +408,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));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "writeDrive", String.class, Payload.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
Payloads.newStringPayload("foo")));
|
||||
|
||||
|
@ -424,7 +424,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));
|
||||
Invokable<?, ?> method = method(ElasticStackAsyncClient.class, "writeDrive", String.class, Payload.class, long.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("100",
|
||||
Payloads.newStringPayload("foo"), 2048));
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.openstack.cinder.v1.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
@ -68,7 +68,7 @@ public class CinderRestClientModule<S extends CinderApi, A extends CinderAsyncAp
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public CinderRestClientModule() {
|
||||
super(TypeToken.class.cast(typeTokenOf(CinderApi.class)), TypeToken.class.cast(typeTokenOf(CinderAsyncApi.class)), DELEGATE_MAP);
|
||||
super(TypeToken.class.cast(typeToken(CinderApi.class)), TypeToken.class.cast(typeToken(CinderAsyncApi.class)), DELEGATE_MAP);
|
||||
}
|
||||
|
||||
protected CinderRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType, Map<Class<?>, Class<?>> sync2Async) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.openstack.keystone.v2_0.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.jclouds.util.Suppliers2.getLastValueInMap;
|
||||
|
||||
import java.net.URI;
|
||||
|
@ -91,7 +91,7 @@ public class KeystoneRestClientModule<S extends KeystoneApi, A extends KeystoneA
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public KeystoneRestClientModule() {
|
||||
super(TypeToken.class.cast(typeTokenOf(KeystoneApi.class)), TypeToken.class.cast(typeTokenOf(KeystoneAsyncApi.class)), DELEGATE_MAP);
|
||||
super(TypeToken.class.cast(typeToken(KeystoneApi.class)), TypeToken.class.cast(typeToken(KeystoneAsyncApi.class)), DELEGATE_MAP);
|
||||
}
|
||||
|
||||
protected KeystoneRestClientModule(TypeToken<S> syncApiType, TypeToken<A> asyncApiType, Map<Class<?>, Class<?>> sync2Async) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.jclouds.openstack.v2_0.functions;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
@ -24,7 +25,6 @@ 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 com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Provides;
|
||||
|
@ -66,15 +66,13 @@ public class PresentWhenExtensionAnnotationNamespaceEqualsAnyNamespaceInExtensio
|
|||
}
|
||||
|
||||
InvocationSuccess getFloatingIPExtension(List<Object> args) throws SecurityException, NoSuchMethodException {
|
||||
return InvocationSuccess.create(Invocation.create(
|
||||
Invokable.from(NovaAsyncApi.class.getDeclaredMethod("getFloatingIPExtensionForZone", String.class)),
|
||||
args), "foo");
|
||||
return InvocationSuccess.create(
|
||||
Invocation.create(method(NovaAsyncApi.class, "getFloatingIPExtensionForZone", String.class), args), "foo");
|
||||
}
|
||||
|
||||
InvocationSuccess getKeyPairExtension(List<Object> args) throws SecurityException, NoSuchMethodException {
|
||||
return InvocationSuccess.create(Invocation.create(
|
||||
Invokable.from(NovaAsyncApi.class.getDeclaredMethod("getKeyPairExtensionForZone", String.class)),
|
||||
args), "foo");
|
||||
return InvocationSuccess.create(
|
||||
Invocation.create(method(NovaAsyncApi.class, "getKeyPairExtensionForZone", String.class), args), "foo");
|
||||
}
|
||||
|
||||
public void testPresentWhenExtensionsIncludeNamespaceFromAnnotationAbsentWhenNot() throws SecurityException, NoSuchMethodException {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.openstack.nova.ec2.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class NovaEC2RestClientModule extends EC2RestClientModule<NovaEC2Client,
|
|||
.build();
|
||||
|
||||
public NovaEC2RestClientModule() {
|
||||
super(typeTokenOf(NovaEC2Client.class), typeTokenOf(NovaEC2AsyncClient.class), DELEGATE_MAP);
|
||||
super(typeToken(NovaEC2Client.class), typeToken(NovaEC2AsyncClient.class), DELEGATE_MAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,7 @@ import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERV
|
|||
import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_ALLOCATE_FLOATING_IPS;
|
||||
import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.AUTO_GENERATE_KEYPAIRS;
|
||||
import static org.jclouds.openstack.nova.v2_0.config.NovaProperties.TIMEOUT_SECURITYGROUP_PRESENT;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -98,7 +98,7 @@ public class NovaApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.1")
|
||||
.defaultEndpoint("http://localhost:5000/v2.0/")
|
||||
.defaultProperties(NovaApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(ComputeServiceContext.class))
|
||||
.view(typeToken(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
|
||||
.add(KeystoneAuthenticationModule.class)
|
||||
.add(ZoneModule.class)
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v2_0.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
@ -121,7 +120,7 @@ public class NovaRestClientModule<S extends NovaApi, A extends NovaAsyncApi> ext
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public NovaRestClientModule() {
|
||||
super(TypeToken.class.cast(typeTokenOf(NovaApi.class)), TypeToken.class.cast(typeTokenOf(NovaAsyncApi.class)), DELEGATE_MAP);
|
||||
super(TypeToken.class.cast(typeToken(NovaApi.class)), TypeToken.class.cast(typeToken(NovaAsyncApi.class)), DELEGATE_MAP);
|
||||
}
|
||||
|
||||
protected NovaRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
|
||||
|
|
|
@ -17,12 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.rackspace.cloudloadbalancers;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
|
||||
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -86,7 +85,7 @@ public class CloudLoadBalancersApiMetadata extends BaseRestApiMetadata {
|
|||
.version("1.0")
|
||||
.defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/")
|
||||
.defaultProperties(CloudLoadBalancersApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(LoadBalancerServiceContext.class))
|
||||
.view(typeToken(LoadBalancerServiceContext.class))
|
||||
.defaultModules(
|
||||
ImmutableSet.<Class<? extends Module>> of(
|
||||
CloudIdentityAuthenticationModule.class,
|
||||
|
|
|
@ -27,7 +27,7 @@ import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
|
|||
import static org.jclouds.blobstore.reference.BlobStoreConstants.DIRECTORY_SUFFIX_FOLDER;
|
||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_BLOBSTORE_DIRECTORY_SUFFIX;
|
||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_SERVICE_PATH;
|
||||
import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_VIRTUAL_HOST_BUCKETS;
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class S3ApiMetadata extends BaseRestApiMetadata {
|
|||
.version(S3AsyncClient.VERSION)
|
||||
.defaultProperties(S3ApiMetadata.defaultProperties())
|
||||
.context(CONTEXT_TOKEN)
|
||||
.view(typeTokenOf(S3BlobStoreContext.class))
|
||||
.view(typeToken(S3BlobStoreContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(S3RestClientModule.class, S3BlobStoreContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.s3.blobstore;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.blobstore.util.BlobStoreUtils.cleanRequest;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -39,7 +39,6 @@ import org.jclouds.s3.options.PutObjectOptions;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -62,12 +61,9 @@ public class S3BlobRequestSigner<T extends S3AsyncClient> implements BlobRequest
|
|||
this.processor = checkNotNull(processor, "processor");
|
||||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
|
||||
TypeToken<T> interfaceType = typeTokenOf(interfaceClass);
|
||||
this.getMethod = interfaceType.method(interfaceClass.getMethod("getObject", String.class, String.class,
|
||||
GetOptions[].class));
|
||||
this.deleteMethod = interfaceType.method(interfaceClass.getMethod("deleteObject", String.class, String.class));
|
||||
this.createMethod = interfaceType.method(interfaceClass.getMethod("putObject", String.class, S3Object.class,
|
||||
PutObjectOptions[].class));
|
||||
this.getMethod = method(interfaceClass, "getObject", String.class, String.class, GetOptions[].class);
|
||||
this.deleteMethod = method(interfaceClass, "deleteObject", String.class, String.class);
|
||||
this.createMethod = method(interfaceClass, "putObject", String.class, S3Object.class, PutObjectOptions[].class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.s3.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Set;
|
||||
|
@ -77,7 +76,7 @@ public class S3RestClientModule<S extends S3Client, A extends S3AsyncClient> ext
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public S3RestClientModule() {
|
||||
this(TypeToken.class.cast(typeTokenOf(S3Client.class)), TypeToken.class.cast(typeTokenOf(S3AsyncClient.class)));
|
||||
this(TypeToken.class.cast(typeToken(S3Client.class)), TypeToken.class.cast(typeToken(S3AsyncClient.class)));
|
||||
}
|
||||
|
||||
protected S3RestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.s3;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -72,7 +73,6 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code S3AsyncClient}
|
||||
*
|
||||
|
@ -85,15 +85,15 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
protected String url = "s3.amazonaws.com";
|
||||
|
||||
public void testAllRegions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class,
|
||||
PutBucketOptions[].class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "putBucketInRegion", String.class, String.class,
|
||||
PutBucketOptions[].class);
|
||||
for (String region : Region.DEFAULT_S3) {
|
||||
processor.createRequest(method, ImmutableList.<Object> of(region, "bucket-" + region));
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetBucketLocation() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketLocation", String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketLocation", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?location HTTP/1.1");
|
||||
|
@ -116,7 +116,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testGetBucketPayer() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketPayer", String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketPayer", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?requestPayment HTTP/1.1");
|
||||
|
@ -131,7 +131,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testSetBucketPayerOwner() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("setBucketPayer", String.class, Payer.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "setBucketPayer", String.class, Payer.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.BUCKET_OWNER));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
|
||||
|
@ -147,7 +147,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testSetBucketPayerRequester() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("setBucketPayer", String.class, Payer.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "setBucketPayer", String.class, Payer.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", Payer.REQUESTER));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/?requestPayment HTTP/1.1");
|
||||
|
@ -163,8 +163,8 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testListBucket() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("listBucket", String.class,
|
||||
ListBucketOptions[].class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "listBucket", String.class,
|
||||
ListBucketOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/ HTTP/1.1");
|
||||
|
@ -179,7 +179,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testBucketExists() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("bucketExists", String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "bucketExists", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?max-keys=0 HTTP/1.1");
|
||||
|
@ -196,16 +196,16 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testCopyObjectInvalidName() throws ArrayIndexOutOfBoundsException, SecurityException,
|
||||
IllegalArgumentException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("copyObject", String.class, String.class, String.class,
|
||||
String.class, CopyObjectOptions[].class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "copyObject", String.class, String.class, String.class,
|
||||
String.class, CopyObjectOptions[].class);
|
||||
processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationBucket", "destinationObject"));
|
||||
|
||||
}
|
||||
|
||||
public void testCopyObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("copyObject", String.class, String.class, String.class,
|
||||
String.class, CopyObjectOptions[].class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "copyObject", String.class, String.class, String.class,
|
||||
String.class, CopyObjectOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("sourceBucket", "sourceObject", "destinationbucket",
|
||||
"destinationObject"));
|
||||
|
||||
|
@ -222,7 +222,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testDeleteBucketIfEmpty() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("deleteBucketIfEmpty", String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "deleteBucketIfEmpty", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://bucket." + url + "/ HTTP/1.1");
|
||||
|
@ -237,7 +237,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testDeleteObject() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("deleteObject", String.class, String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "deleteObject", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE https://bucket." + url + "/object HTTP/1.1");
|
||||
|
@ -253,7 +253,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
|
||||
public void testGetBucketACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketACL", String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketACL", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?acl HTTP/1.1");
|
||||
|
@ -269,7 +269,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
|
||||
public void testGetObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getObject", String.class, String.class, GetOptions[].class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "getObject", String.class, String.class, GetOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/object HTTP/1.1");
|
||||
|
@ -285,7 +285,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
|
||||
public void testGetObjectACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getObjectACL", String.class, String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "getObjectACL", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/object?acl HTTP/1.1");
|
||||
|
@ -301,7 +301,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
|
||||
public void testObjectExists() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("objectExists", String.class, String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "objectExists", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://bucket." + url + "/object HTTP/1.1");
|
||||
|
@ -317,7 +317,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
|
||||
public void testHeadObject() throws SecurityException, NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("headObject", String.class, String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "headObject", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "object"));
|
||||
|
||||
assertRequestLineEquals(request, "HEAD https://bucket." + url + "/object HTTP/1.1");
|
||||
|
@ -332,7 +332,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testListOwnedBuckets() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("listOwnedBuckets"));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "listOwnedBuckets");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://" + url + "/ HTTP/1.1");
|
||||
|
@ -347,12 +347,12 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testNewS3Object() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("newS3Object"));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "newS3Object");
|
||||
assertEquals(method.getReturnType().getRawType(), S3Object.class);
|
||||
}
|
||||
|
||||
public void testPutBucketACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("putBucketACL", String.class, AccessControlList.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "putBucketACL", String.class, AccessControlList.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", AccessControlList.fromCannedAccessPolicy(
|
||||
CannedAccessPolicy.PRIVATE, "1234")));
|
||||
|
||||
|
@ -374,8 +374,8 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
|
||||
public void testPutBucketDefault() throws ArrayIndexOutOfBoundsException, SecurityException,
|
||||
IllegalArgumentException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("putBucketInRegion", String.class, String.class,
|
||||
PutBucketOptions[].class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "putBucketInRegion", String.class, String.class,
|
||||
PutBucketOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, Lists.<Object> newArrayList((String) null, "bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/ HTTP/1.1");
|
||||
|
@ -392,8 +392,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
public void testPutObject() throws ArrayIndexOutOfBoundsException, SecurityException, IllegalArgumentException,
|
||||
NoSuchMethodException, IOException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class
|
||||
.getMethod("putObject", String.class, S3Object.class, PutObjectOptions[].class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "putObject", String.class, S3Object.class, PutObjectOptions[].class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", blobToS3Object
|
||||
.apply(BindBlobToMultipartFormTest.TEST_BLOB)));
|
||||
|
||||
|
@ -409,8 +408,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testPutObjectACL() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class
|
||||
.getMethod("putObjectACL", String.class, String.class, AccessControlList.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "putObjectACL", String.class, String.class, AccessControlList.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket", "key", AccessControlList.fromCannedAccessPolicy(
|
||||
CannedAccessPolicy.PRIVATE, "1234")));
|
||||
|
||||
|
@ -431,7 +429,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testGetBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("getBucketLogging", String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "getBucketLogging", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://bucket." + url + "/?logging HTTP/1.1");
|
||||
|
@ -446,7 +444,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testDisableBucketLogging() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("disableBucketLogging", String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "disableBucketLogging", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("bucket"));
|
||||
|
||||
assertRequestLineEquals(request, "PUT https://bucket." + url + "/?logging HTTP/1.1");
|
||||
|
@ -462,7 +460,7 @@ public abstract class S3AsyncClientTest<T extends S3AsyncClient> extends BaseS3A
|
|||
}
|
||||
|
||||
public void testEnableBucketLoggingOwner() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("enableBucketLogging", String.class, BucketLogging.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "enableBucketLogging", String.class, BucketLogging.class);
|
||||
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)))));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.s3.binders;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_VIRTUAL_HOST_BUCKETS;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -42,7 +42,7 @@ public class BindAsHostPrefixIfConfiguredNoPathTest extends BaseS3AsyncClientTes
|
|||
|
||||
public void testBucketWithHostnameStyle() throws IOException, SecurityException, NoSuchMethodException {
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("deleteObject", String.class, String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "deleteObject", String.class, String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("testbucket.example.com", "test.jpg"));
|
||||
assertRequestLineEquals(request, "DELETE https://s3.amazonaws.com/testbucket.example.com/test.jpg HTTP/1.1");
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.s3.binders;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_SERVICE_PATH;
|
||||
import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_VIRTUAL_HOST_BUCKETS;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
@ -33,7 +34,6 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BindAsHostPrefixIfConfigured}
|
||||
*
|
||||
|
@ -61,7 +61,7 @@ public class BindAsHostPrefixIfConfiguredTest extends BaseS3AsyncClientTest<S3As
|
|||
request = binder.bindToRequest(request, "testbucket.example.com");
|
||||
assertEquals(request.getRequestLine(), "GET http://euc/services/Walrus/testbucket.example.com HTTP/1.1");
|
||||
|
||||
Invokable<?, ?> method = Invokable.from(S3AsyncClient.class.getMethod("deleteObject", String.class, String.class));
|
||||
Invokable<?, ?> method = method(S3AsyncClient.class, "deleteObject", String.class, String.class);
|
||||
request = processor.createRequest(method, ImmutableList.<Object> of("testbucket.example.com", "test.jpg"));
|
||||
|
||||
assertRequestLineEquals(request, "DELETE http://euc/services/Walrus/testbucket.example.com/test.jpg HTTP/1.1");
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.s3.fallbacks;
|
||||
|
||||
import static com.google.common.util.concurrent.Futures.getUnchecked;
|
||||
import static org.easymock.EasyMock.createMock;
|
||||
import static org.easymock.EasyMock.expect;
|
||||
import static org.easymock.EasyMock.replay;
|
||||
import static org.easymock.EasyMock.verify;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
||||
import org.jclouds.aws.AWSResponseException;
|
||||
|
@ -35,7 +35,6 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -51,8 +50,8 @@ public class FalseIfBucketAlreadyOwnedByYouOrOperationAbortedWhenBucketExistsTes
|
|||
.method("PUT")
|
||||
.endpoint("https://adriancole-blobstore113.s3.amazonaws.com/")
|
||||
.invocation(
|
||||
Invocation.create(Invokable.from(S3Client.class.getMethod("putBucketInRegion", String.class,
|
||||
String.class, PutBucketOptions[].class)), Lists.<Object> newArrayList(null, "bucket"))).build();
|
||||
Invocation.create(method(S3Client.class, "putBucketInRegion", String.class,
|
||||
String.class, PutBucketOptions[].class), Lists.<Object> newArrayList(null, "bucket"))).build();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.s3.filters;
|
||||
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
@ -41,8 +42,6 @@ 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;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code RequestAuthorizeSignature}
|
||||
*
|
||||
|
@ -88,7 +87,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
|
|||
@Test
|
||||
void testAppendBucketNameHostHeader() throws SecurityException, NoSuchMethodException {
|
||||
GeneratedHttpRequest request = processor.createRequest(
|
||||
Invokable.from(S3AsyncClient.class.getMethod("getBucketLocation", String.class)),
|
||||
method(S3AsyncClient.class, "getBucketLocation", String.class),
|
||||
ImmutableList.<Object> of("bucket"));
|
||||
StringBuilder builder = new StringBuilder();
|
||||
filter.appendBucketName(request, builder);
|
||||
|
@ -105,7 +104,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
|
|||
|
||||
private GeneratedHttpRequest putBucketAcl() throws NoSuchMethodException {
|
||||
return processor.createRequest(
|
||||
Invokable.from(S3AsyncClient.class.getMethod("putBucketACL", String.class, AccessControlList.class)),
|
||||
method(S3AsyncClient.class, "putBucketACL", String.class, AccessControlList.class),
|
||||
ImmutableList.<Object> of("bucket",
|
||||
AccessControlList.fromCannedAccessPolicy(CannedAccessPolicy.PRIVATE, "1234")));
|
||||
}
|
||||
|
@ -121,7 +120,7 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
|
|||
}
|
||||
|
||||
private GeneratedHttpRequest listOwnedBuckets() throws NoSuchMethodException {
|
||||
return processor.createRequest(Invokable.from(S3AsyncClient.class.getMethod("listOwnedBuckets")),
|
||||
return processor.createRequest(method(S3AsyncClient.class, "listOwnedBuckets"),
|
||||
ImmutableList.of());
|
||||
}
|
||||
|
||||
|
@ -138,14 +137,14 @@ public class RequestAuthorizeSignatureTest extends BaseS3AsyncClientTest<S3Async
|
|||
private HttpRequest putObject() throws NoSuchMethodException {
|
||||
S3Object object = blobToS3Object.apply(BindBlobToMultipartFormTest.TEST_BLOB);
|
||||
object.getMetadata().getUserMetadata().put("Adrian", "foo");
|
||||
return processor.createRequest(Invokable.from(S3AsyncClient.class.getMethod("putObject", String.class,
|
||||
S3Object.class, PutObjectOptions[].class)), ImmutableList.<Object> of("bucket", object));
|
||||
return processor.createRequest(method(S3AsyncClient.class, "putObject", String.class,
|
||||
S3Object.class, PutObjectOptions[].class), ImmutableList.<Object> of("bucket", object));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAppendBucketNameURIHost() throws SecurityException, NoSuchMethodException {
|
||||
GeneratedHttpRequest request = processor.createRequest(
|
||||
Invokable.from(S3AsyncClient.class.getMethod("getBucketLocation", String.class)),
|
||||
method(S3AsyncClient.class, "getBucketLocation", String.class),
|
||||
ImmutableList.<Object> of("bucket"));
|
||||
assertEquals(request.getEndpoint().getHost(), "bucket.s3.amazonaws.com");
|
||||
}
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.sqs.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -56,7 +57,7 @@ public class SQSRestClientModule extends FormSigningRestClientModule<SQSApi, SQS
|
|||
.build();
|
||||
|
||||
public SQSRestClientModule() {
|
||||
super(typeTokenOf(SQSApi.class), typeTokenOf(SQSAsyncApi.class), DELEGATE_MAP);
|
||||
super(typeToken(SQSApi.class), typeToken(SQSAsyncApi.class), DELEGATE_MAP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
|
|||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.blobstore.reference.BlobStoreConstants.PROPERTY_USER_METADATA_PREFIX;
|
||||
import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
@ -92,7 +92,7 @@ public class SwiftApiMetadata extends BaseRestApiMetadata {
|
|||
.documentation(URI.create("http://api.openstack.org/"))
|
||||
.version("1.0")
|
||||
.defaultProperties(SwiftApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(BlobStoreContext.class))
|
||||
.view(typeToken(BlobStoreContext.class))
|
||||
.context(CONTEXT_TOKEN)
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
|
||||
.add(StorageEndpointModule.class)
|
||||
|
|
|
@ -25,7 +25,7 @@ import static com.google.common.io.BaseEncoding.base16;
|
|||
import static com.google.common.io.ByteStreams.readBytes;
|
||||
import static org.jclouds.blobstore.util.BlobStoreUtils.cleanRequest;
|
||||
import static org.jclouds.crypto.Macs.asByteProcessor;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.jclouds.util.Strings2.toInputStream;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -56,9 +56,7 @@ 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;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
|
@ -89,7 +87,7 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
protected SwiftBlobSigner(BlobToObject blobToObject, BlobToHttpGetOptions blob2HttpGetOptions, Crypto crypto,
|
||||
@TimeStamp Provider<Long> unixEpochTimestampProvider,
|
||||
@TemporaryUrlKey Supplier<String> temporaryUrlKeySupplier, RestAnnotationProcessor processor,
|
||||
TypeLiteral<T> interfaceType) throws SecurityException, NoSuchMethodException {
|
||||
Class<T> ownerType) throws SecurityException, NoSuchMethodException {
|
||||
this.processor = checkNotNull(processor, "processor");
|
||||
this.crypto = checkNotNull(crypto, "crypto");
|
||||
|
||||
|
@ -98,14 +96,9 @@ public class SwiftBlobSigner<T extends CommonSwiftAsyncClient> implements BlobRe
|
|||
|
||||
this.blobToObject = checkNotNull(blobToObject, "blobToObject");
|
||||
this.blob2HttpGetOptions = checkNotNull(blob2HttpGetOptions, "blob2HttpGetOptions");
|
||||
|
||||
TypeToken<?> owner = typeTokenOf(interfaceType.getType());
|
||||
this.getMethod = owner.method(interfaceType.getRawType().getMethod("getObject", String.class, String.class,
|
||||
GetOptions[].class));
|
||||
this.deleteMethod = owner
|
||||
.method(interfaceType.getRawType().getMethod("removeObject", String.class, String.class));
|
||||
this.createMethod = owner.method(interfaceType.getRawType().getMethod("putObject", String.class,
|
||||
SwiftObject.class));
|
||||
this.getMethod = method(ownerType, "getObject", String.class, String.class, GetOptions[].class);
|
||||
this.deleteMethod = method(ownerType, "removeObject", String.class, String.class);
|
||||
this.createMethod = method(ownerType, "putObject", String.class, SwiftObject.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.jclouds.openstack.swift.config;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
|
||||
import org.jclouds.openstack.swift.CommonSwiftClient;
|
||||
|
@ -19,7 +19,7 @@ import com.google.inject.Scopes;
|
|||
public class SwiftKeystoneRestClientModule extends SwiftRestClientModule<SwiftKeystoneClient, SwiftKeystoneAsyncClient> {
|
||||
|
||||
public SwiftKeystoneRestClientModule() {
|
||||
super(typeTokenOf(SwiftKeystoneClient.class), typeTokenOf(SwiftKeystoneAsyncClient.class), ImmutableMap
|
||||
super(typeToken(SwiftKeystoneClient.class), typeToken(SwiftKeystoneAsyncClient.class), ImmutableMap
|
||||
.<Class<?>, Class<?>> of());
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.swift.config;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.jclouds.util.Suppliers2.getLastValueInMap;
|
||||
|
||||
import java.net.URI;
|
||||
|
@ -63,8 +63,8 @@ public class SwiftRestClientModule<S extends CommonSwiftClient, A extends Common
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public SwiftRestClientModule() {
|
||||
this(TypeToken.class.cast(typeTokenOf(SwiftClient.class)), TypeToken.class.cast(TypeToken
|
||||
.of(SwiftAsyncClient.class)), ImmutableMap.<Class<?>, Class<?>> of());
|
||||
this(TypeToken.class.cast(typeToken(SwiftClient.class)), TypeToken.class.cast(typeToken(SwiftAsyncClient.class)),
|
||||
ImmutableMap.<Class<?>, Class<?>> of());
|
||||
}
|
||||
|
||||
protected SwiftRestClientModule(TypeToken<S> syncClientType, TypeToken<A> asyncClientType,
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.openstack.swift.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -31,7 +33,6 @@ 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 com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -45,13 +46,11 @@ public class BasePayloadTest {
|
|||
|
||||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
Invocation invocation = Invocation.create(method(String.class, "toString"), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,12 +17,11 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.MINUTES;
|
||||
import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL;
|
||||
import static org.jclouds.Constants.PROPERTY_TIMEOUTS_PREFIX;
|
||||
import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED;
|
||||
import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_VERSION_SCHEMA;
|
||||
|
@ -102,7 +101,7 @@ public class VCloudApiMetadata extends BaseRestApiMetadata {
|
|||
.documentation(URI.create("http://www.vmware.com/support/pubs/vcd_pubs.html"))
|
||||
.version("1.0")
|
||||
.defaultProperties(VCloudApiMetadata.defaultProperties())
|
||||
.view(typeTokenOf(ComputeServiceContext.class))
|
||||
.view(typeToken(ComputeServiceContext.class))
|
||||
.defaultModules(ImmutableSet.<Class<? extends Module>>of(VCloudRestClientModule.class, VCloudComputeServiceContextModule.class));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -26,13 +26,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import com.google.common.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 +44,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class VCloudVersionsAsyncClientTest extends BaseAsyncClientTest<VCloudVersionsAsyncClient> {
|
||||
|
||||
public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VCloudVersionsAsyncClient.class.getMethod("getSupportedVersions"));
|
||||
Invokable<?, ?> method = method(VCloudVersionsAsyncClient.class, "getSupportedVersions");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
|
||||
|
|
|
@ -18,12 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.options.CatalogItemOptions;
|
||||
|
@ -32,7 +33,7 @@ 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}
|
||||
*
|
||||
|
@ -44,7 +45,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsyncClient> {
|
||||
|
||||
public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CatalogAsyncClient.class.getMethod("getCatalog", URI.class));
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "getCatalog", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1")));
|
||||
|
||||
|
@ -60,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));
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "findCatalogInOrgNamed", String.class, String.class);
|
||||
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");
|
||||
|
@ -75,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));
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "getCatalogItem", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2")));
|
||||
|
||||
|
@ -91,8 +92,8 @@ 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));
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "findCatalogItemInOrgCatalogNamed", String.class,
|
||||
String.class, String.class);
|
||||
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");
|
||||
|
@ -108,8 +109,8 @@ public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsy
|
|||
|
||||
public void testAddVAppTemplateOrMediaImageToCatalogAndNameItem() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(CatalogAsyncClient.class.getMethod("addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
|
||||
URI.class, String.class, CatalogItemOptions[].class));
|
||||
Invokable<?, ?> method = method(CatalogAsyncClient.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
|
||||
URI.class, String.class, CatalogItemOptions[].class);
|
||||
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")));
|
||||
|
|
|
@ -18,19 +18,20 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import com.google.common.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}
|
||||
*
|
||||
|
@ -42,7 +43,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest<NetworkAsyncClient> {
|
||||
|
||||
public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(NetworkAsyncClient.class.getMethod("getNetwork", URI.class));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "getNetwork", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/network/2")));
|
||||
|
||||
|
@ -58,8 +59,8 @@ 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));
|
||||
Invokable<?, ?> method = method(NetworkAsyncClient.class, "findNetworkInOrgVDCNamed", String.class, String.class,
|
||||
String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
|
||||
|
|
|
@ -18,13 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.OrgHandler;
|
||||
|
@ -32,7 +33,7 @@ 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}
|
||||
*
|
||||
|
@ -44,7 +45,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient> {
|
||||
|
||||
public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OrgAsyncClient.class.getMethod("listOrgs"));
|
||||
Invokable<?, ?> method = method(OrgAsyncClient.class, "listOrgs");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
|
||||
|
@ -59,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));
|
||||
Invokable<?, ?> method = method(OrgAsyncClient.class, "getOrg", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
|
||||
|
||||
|
@ -75,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));
|
||||
Invokable<?, ?> method = method(OrgAsyncClient.class, "findOrgNamed", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
|
||||
|
|
|
@ -18,13 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.TaskHandler;
|
||||
|
@ -32,7 +33,7 @@ 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}
|
||||
*
|
||||
|
@ -44,7 +45,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClient> {
|
||||
|
||||
public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TaskAsyncClient.class.getMethod("getTasksList", URI.class));
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "getTasksList", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")));
|
||||
|
||||
|
@ -60,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));
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "findTasksListInOrgNamed", String.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
|
||||
|
||||
assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
|
||||
|
@ -75,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));
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "getTask", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
|
||||
|
||||
|
@ -91,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));
|
||||
Invokable<?, ?> method = method(TaskAsyncClient.class, "cancelTask", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -25,7 +27,6 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
|
@ -35,7 +36,7 @@ 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}
|
||||
*
|
||||
|
@ -47,8 +48,8 @@ import com.google.common.collect.ImmutableList;
|
|||
public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClient> {
|
||||
|
||||
public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppAsyncClient.class.getMethod("copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
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"));
|
||||
|
@ -67,8 +68,8 @@ 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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
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()
|
||||
|
@ -88,8 +89,8 @@ 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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class,
|
||||
CloneVAppOptions[].class);
|
||||
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()
|
||||
|
@ -109,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "deployVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -126,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "deployAndPowerOnVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -143,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "getVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -159,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "rebootVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -176,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "undeployVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -194,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "undeployAndSaveStateOfVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -213,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "deleteVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -229,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "powerOnVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -246,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "powerOffVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -263,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "resetVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -280,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "suspendVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -297,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));
|
||||
Invokable<?, ?> method = method(VAppAsyncClient.class, "shutdownVApp", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.jclouds.vcloud.options.InstantiateVAppTemplateOptions.Builder.addNetworkConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -26,7 +27,6 @@ import java.net.URI;
|
|||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.ovf.xml.EnvelopeHandler;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.network.FenceMode;
|
||||
|
@ -41,7 +41,7 @@ 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}
|
||||
*
|
||||
|
@ -54,8 +54,8 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
|
||||
public void testCreateVAppInVDCByInstantiatingTemplate() throws SecurityException, NoSuchMethodException,
|
||||
IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
URI.class, URI.class, InstantiateVAppTemplateOptions[].class));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
|
||||
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"),
|
||||
|
@ -79,16 +79,16 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
@Test(expectedExceptions = IllegalArgumentException.class)
|
||||
public void testCreateVAppInVDCByInstantiatingTemplateOptionsIllegalName() throws SecurityException,
|
||||
NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
URI.class, URI.class, InstantiateVAppTemplateOptions[].class));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "createVAppInVDCByInstantiatingTemplate", String.class,
|
||||
URI.class, URI.class, InstantiateVAppTemplateOptions[].class);
|
||||
processor.createRequest(method, ImmutableList.<Object> of("CentOS 01", URI.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), addNetworkConfig(new NetworkConfig(null,
|
||||
URI.create("https://vcenterprise.bluelock.com/api/v1.0/network/1991"), null))));
|
||||
}
|
||||
|
||||
public void testcopyVAppTemplateToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class);
|
||||
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"));
|
||||
|
@ -107,8 +107,8 @@ 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));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "copyVAppTemplateToVDCAndName", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class);
|
||||
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",
|
||||
|
@ -128,8 +128,8 @@ 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));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "moveVAppTemplateToVDCAndRename", URI.class, URI.class,
|
||||
String.class, CloneVAppTemplateOptions[].class);
|
||||
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",
|
||||
|
@ -149,8 +149,8 @@ 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));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
URI.class, CaptureVAppOptions[].class);
|
||||
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")));
|
||||
|
@ -170,8 +170,8 @@ 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));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "captureVAppAsTemplateInVDC", URI.class, String.class,
|
||||
URI.class, CaptureVAppOptions[].class);
|
||||
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()
|
||||
|
@ -191,8 +191,8 @@ 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));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "findVAppTemplateInOrgCatalogNamed", String.class,
|
||||
String.class, String.class);
|
||||
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");
|
||||
|
@ -207,7 +207,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testVAppTemplateURI() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("getVAppTemplate", URI.class));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "getVAppTemplate", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
|
||||
|
||||
|
@ -223,7 +223,7 @@ public class VAppTemplateAsyncClientTest extends BaseVCloudAsyncClientTest<VAppT
|
|||
}
|
||||
|
||||
public void testGetOvfEnvelopeForVAppTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VAppTemplateAsyncClient.class.getMethod("getOvfEnvelopeForVAppTemplate", URI.class));
|
||||
Invokable<?, ?> method = method(VAppTemplateAsyncClient.class, "getOvfEnvelopeForVAppTemplate", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vAppTemplate/2")));
|
||||
|
||||
|
|
|
@ -18,13 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
|
||||
import org.jclouds.vcloud.xml.VDCHandler;
|
||||
|
@ -32,7 +33,7 @@ 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}
|
||||
*
|
||||
|
@ -45,18 +46,18 @@ public class VDCAsyncClientTest extends BaseVCloudAsyncClientTest<VDCAsyncClient
|
|||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testFindVDCInOrgNamedBadVDC() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class));
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
processor.createRequest(method, ImmutableList.<Object> of("org", "vdc1"));
|
||||
}
|
||||
|
||||
@Test(expectedExceptions = NoSuchElementException.class)
|
||||
public void testFindVDCInOrgNamedBadOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class));
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
processor.createRequest(method, ImmutableList.<Object> of("org1", "vdc"));
|
||||
}
|
||||
|
||||
public void testFindVDCInOrgNamedNullOrg() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VDCAsyncClient.class.getMethod("findVDCInOrgNamed", String.class, String.class));
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
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");
|
||||
|
@ -71,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));
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "findVDCInOrgNamed", String.class, String.class);
|
||||
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");
|
||||
|
@ -86,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));
|
||||
Invokable<?, ?> method = method(VDCAsyncClient.class, "getVDC", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1")));
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.features;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
|
||||
|
@ -25,7 +27,6 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||
import org.jclouds.http.functions.ReturnInputStream;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.util.Strings2;
|
||||
import org.jclouds.vcloud.domain.GuestCustomizationSection;
|
||||
|
@ -37,7 +38,7 @@ 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}
|
||||
*
|
||||
|
@ -49,7 +50,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient> {
|
||||
|
||||
public void testGetThumbnailOfVm() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("getScreenThumbnailForVm", URI.class));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "getScreenThumbnailForVm", URI.class);
|
||||
GeneratedHttpRequest request = processor
|
||||
.createRequest(method, ImmutableList.<Object> of(URI.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
|
@ -66,8 +67,8 @@ public class VmAsyncClientTest extends BaseVCloudAsyncClientTest<VmAsyncClient>
|
|||
|
||||
@Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402")
|
||||
public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VmAsyncClient.class.getMethod("updateGuestCustomizationOfVm", GuestCustomizationSection.class,
|
||||
URI.class));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "updateGuestCustomizationOfVm", GuestCustomizationSection.class,
|
||||
URI.class);
|
||||
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");
|
||||
|
@ -88,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "updateCPUCountOfVm", int.class, URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(2, URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
|
@ -106,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "updateMemoryMBOfVm", int.class, URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(512, URI
|
||||
.create("http://vcloud.example.com/api/v1.0/vApp/vm-12")));
|
||||
|
||||
|
@ -124,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "deployVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -141,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "deployAndPowerOnVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -158,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "getVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vm/1")));
|
||||
|
||||
|
@ -174,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "rebootVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -191,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "undeployVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -209,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "undeployAndSaveStateOfVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -228,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "powerOnVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -245,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "powerOffVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -262,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "resetVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -279,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "suspendVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
@ -296,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));
|
||||
Invokable<?, ?> method = method(VmAsyncClient.class, "shutdownVm", URI.class);
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
|
||||
.create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,7 +30,6 @@ 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 com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
|
||||
|
@ -42,13 +43,11 @@ public class BasePayloadTest {
|
|||
|
||||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
Invocation invocation = Invocation.create(method(String.class, "toString"), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -30,7 +31,6 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.vcloud.endpoints.VCloudLogin;
|
||||
|
@ -39,10 +39,10 @@ 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;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code VCloudLoginAsyncClient}
|
||||
*
|
||||
|
@ -53,7 +53,7 @@ import com.google.inject.Provides;
|
|||
public class VCloudLoginAsyncClientTest extends BaseAsyncClientTest<VCloudLoginAsyncClient> {
|
||||
|
||||
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(VCloudLoginAsyncClient.class.getMethod("login"));
|
||||
Invokable<?, ?> method = method(VCloudLoginAsyncClient.class, "login");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.jclouds.blobstore.util;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jclouds.blobstore.integration.internal;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Throwables.propagateIfPossible;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -524,7 +524,7 @@ public class BaseBlobStoreIntegrationTest extends BaseViewLiveTest<BlobStoreCont
|
|||
|
||||
@Override
|
||||
protected TypeToken<BlobStoreContext> viewType() {
|
||||
return typeTokenOf(BlobStoreContext.class);
|
||||
return typeToken(BlobStoreContext.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.blobstore.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import org.jclouds.View;
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
|
@ -37,7 +37,7 @@ import com.google.common.reflect.TypeToken;
|
|||
public abstract class BaseBlobStoreApiMetadataTest extends BaseApiMetadataTest {
|
||||
|
||||
public BaseBlobStoreApiMetadataTest(ApiMetadata toTest) {
|
||||
super(toTest, ImmutableSet.<TypeToken<? extends View>>of(typeTokenOf(BlobStoreContext.class)));
|
||||
super(toTest, ImmutableSet.<TypeToken<? extends View>>of(typeToken(BlobStoreContext.class)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import static org.easymock.EasyMock.replay;
|
|||
import static org.easymock.EasyMock.verify;
|
||||
import static org.jclouds.blobstore.util.BlobStoreUtils.createParentIfNeededAsync;
|
||||
import static org.jclouds.blobstore.util.BlobStoreUtils.getNameFor;
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.net.URI;
|
||||
|
@ -38,8 +39,6 @@ import org.testng.annotations.Test;
|
|||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
/**
|
||||
* Tests behavior of {@code BlobStoreUtils}
|
||||
*
|
||||
|
@ -126,13 +125,11 @@ public class BlobStoreUtilsTest {
|
|||
|
||||
GeneratedHttpRequest requestForEndpointAndArgs(String endpoint, List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
Invocation invocation = Invocation.create(method(String.class, "toString"), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create(endpoint)).invocation(invocation)
|
||||
.build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.azure.storage.filters;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -40,7 +40,6 @@ import org.testng.annotations.DataProvider;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
|
||||
|
@ -141,8 +140,8 @@ public class SharedKeyLiteAuthenticationTest {
|
|||
.credentials(ACCOUNT, "credential")
|
||||
.modules(
|
||||
ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule(),
|
||||
new AzureStorageRestClientModule<IntegrationTestClient, IntegrationTestAsyncClient>(TypeToken
|
||||
.of(IntegrationTestClient.class), typeTokenOf(IntegrationTestAsyncClient.class))))
|
||||
new AzureStorageRestClientModule<IntegrationTestClient, IntegrationTestAsyncClient>(
|
||||
typeToken(IntegrationTestClient.class), typeToken(IntegrationTestAsyncClient.class))))
|
||||
.buildInjector();
|
||||
filter = injector.getInstance(SharedKeyLiteAuthentication.class);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.openstack.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
|
@ -26,14 +28,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.IntegrationTestAsyncClient;
|
||||
import org.jclouds.http.IntegrationTestClient;
|
||||
import org.jclouds.openstack.functions.ParseAuthenticationResponseFromHeaders;
|
||||
import com.google.common.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 @@ import com.google.common.collect.ImmutableList;
|
|||
public class OpenStackAuthAsyncClientTest extends BaseAsyncClientTest<OpenStackAuthAsyncClient> {
|
||||
|
||||
public void testAuthenticate() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(OpenStackAuthAsyncClient.class.getMethod("authenticate", String.class, String.class));
|
||||
Invokable<?, ?> method = method(OpenStackAuthAsyncClient.class, "authenticate", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
|
||||
|
@ -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));
|
||||
Invokable<?, ?> method = method(OpenStackAuthAsyncClient.class, "authenticateStorage", String.class, String.class);
|
||||
GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("foo", "bar"));
|
||||
|
||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/v1.0 HTTP/1.1");
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,19 +27,16 @@ import org.jclouds.reflect.Invocation;
|
|||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.reflect.Invokable;
|
||||
|
||||
public class BasePayloadTest {
|
||||
|
||||
protected GeneratedHttpRequest requestForArgs(List<Object> args) {
|
||||
try {
|
||||
Invocation invocation = Invocation.create(Invokable.from(String.class.getDeclaredMethod("toString")), args);
|
||||
Invocation invocation = Invocation.create(method(String.class, "toString"), args);
|
||||
return GeneratedHttpRequest.builder().method("POST").endpoint(URI.create("http://localhost/key"))
|
||||
.invocation(invocation).build();
|
||||
} catch (SecurityException e) {
|
||||
throw Throwables.propagate(e);
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw Throwables.propagate(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -30,7 +31,6 @@ import org.jclouds.http.filters.BasicAuthentication;
|
|||
import org.jclouds.location.Provider;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import com.google.common.reflect.Invokable;
|
||||
import org.jclouds.rest.internal.BaseAsyncClientTest;
|
||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||
import org.jclouds.trmk.vcloud_0_8.endpoints.VCloudLogin;
|
||||
|
@ -39,6 +39,7 @@ 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 @@ import com.google.inject.Provides;
|
|||
public class TerremarkVCloudLoginAsyncClientTest extends BaseAsyncClientTest<TerremarkVCloudLoginAsyncClient> {
|
||||
|
||||
public void testLogin() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TerremarkVCloudLoginAsyncClient.class.getMethod("login"));
|
||||
Invokable<?, ?> method = method(TerremarkVCloudLoginAsyncClient.class, "login");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "POST http://localhost:8080/login HTTP/1.1");
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.trmk.vcloud_0_8.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.method;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -26,14 +27,13 @@ import org.jclouds.http.HttpRequest;
|
|||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.providers.AnonymousProviderMetadata;
|
||||
import org.jclouds.providers.ProviderMetadata;
|
||||
import com.google.common.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 +44,7 @@ import com.google.common.collect.ImmutableList;
|
|||
public class TerremarkVCloudVersionsAsyncClientTest extends BaseAsyncClientTest<TerremarkVCloudVersionsAsyncClient> {
|
||||
|
||||
public void testVersions() throws SecurityException, NoSuchMethodException, IOException {
|
||||
Invokable<?, ?> method = Invokable.from(TerremarkVCloudVersionsAsyncClient.class.getMethod("getSupportedVersions"));
|
||||
Invokable<?, ?> method = method(TerremarkVCloudVersionsAsyncClient.class, "getSupportedVersions");
|
||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
||||
|
||||
assertEquals(request.getRequestLine(), "GET http://localhost:8080/versions HTTP/1.1");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.jclouds.compute.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import org.jclouds.View;
|
||||
import org.jclouds.apis.ApiMetadata;
|
||||
|
@ -19,7 +19,7 @@ import com.google.common.reflect.TypeToken;
|
|||
public abstract class BaseComputeServiceApiMetadataTest extends BaseApiMetadataTest {
|
||||
|
||||
public BaseComputeServiceApiMetadataTest(ApiMetadata toTest) {
|
||||
super(toTest, ImmutableSet.<TypeToken<? extends View>>of(typeTokenOf(ComputeServiceContext.class)));
|
||||
super(toTest, ImmutableSet.<TypeToken<? extends View>>of(typeToken(ComputeServiceContext.class)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.compute.internal;
|
||||
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public abstract class BaseComputeServiceContextLiveTest extends BaseGenericCompu
|
|||
|
||||
@Override
|
||||
protected TypeToken<ComputeServiceContext> viewType() {
|
||||
return typeTokenOf(ComputeServiceContext.class);
|
||||
return typeToken(ComputeServiceContext.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ import static org.jclouds.Constants.PROPERTY_ENDPOINT;
|
|||
import static org.jclouds.Constants.PROPERTY_IDENTITY;
|
||||
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
|
||||
import static org.jclouds.Constants.PROPERTY_PROVIDER;
|
||||
import static org.jclouds.reflect.Reflection2.typeTokenOf;
|
||||
import static org.jclouds.reflect.Reflection2.typeToken;
|
||||
import static org.jclouds.util.Throwables2.propagateAuthorizationOrOriginalException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -491,7 +491,7 @@ public class ContextBuilder {
|
|||
// TODO: move this up
|
||||
if (apiMetadata instanceof RestApiMetadata) {
|
||||
RestApiMetadata rest = RestApiMetadata.class.cast(apiMetadata);
|
||||
modules.add(new RestClientModule(typeTokenOf(rest.getApi()), typeTokenOf(rest.getAsyncApi())));
|
||||
modules.add(new RestClientModule(typeToken(rest.getApi()), typeToken(rest.getAsyncApi())));
|
||||
} else {
|
||||
modules.add(new RestModule());
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ public class ContextBuilder {
|
|||
* @see #buildView(TypeToken)
|
||||
*/
|
||||
public <V extends View> V buildView(Class<V> viewType) {
|
||||
return buildView(typeTokenOf(viewType));
|
||||
return buildView(typeToken(viewType));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue