mirror of https://github.com/apache/jclouds.git
Merge pull request #1142 from jclouds/deterministic-requests
deterministic creation of requests based on arg order
This commit is contained in:
commit
37759d1c8c
|
@ -115,8 +115,8 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
|
||||||
HttpRequest cdnContainerRequest = HttpRequest.builder()
|
HttpRequest cdnContainerRequest = HttpRequest.builder()
|
||||||
.method("POST")
|
.method("POST")
|
||||||
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
|
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
|
||||||
.addHeader(CloudFilesHeaders.CDN_LOG_RETENTION, "true")
|
|
||||||
.addHeader(CloudFilesHeaders.CDN_TTL, "259200")
|
.addHeader(CloudFilesHeaders.CDN_TTL, "259200")
|
||||||
|
.addHeader(CloudFilesHeaders.CDN_LOG_RETENTION, "true")
|
||||||
.addHeader("X-Auth-Token", authToken)
|
.addHeader("X-Auth-Token", authToken)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ public class CloudFilesClientExpectTest extends BaseCloudFilesRestClientExpectTe
|
||||||
HttpRequest cdnContainerRequest = HttpRequest.builder()
|
HttpRequest cdnContainerRequest = HttpRequest.builder()
|
||||||
.method("POST")
|
.method("POST")
|
||||||
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
|
.endpoint("https://cdn3.clouddrive.com/v1/MossoCloudFS_83a9d536-2e25-4166-bd3b-a503a934f953/container")
|
||||||
.addHeader(CloudFilesHeaders.CDN_LOG_RETENTION, "true")
|
|
||||||
.addHeader(CloudFilesHeaders.CDN_TTL, "259200")
|
.addHeader(CloudFilesHeaders.CDN_TTL, "259200")
|
||||||
|
.addHeader(CloudFilesHeaders.CDN_LOG_RETENTION, "true")
|
||||||
.addHeader("X-Auth-Token", authToken)
|
.addHeader("X-Auth-Token", authToken)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -71,8 +71,8 @@ public class CloudStackComputeServiceAdapterExpectTest extends BaseCloudStackCom
|
||||||
.addQueryParam("response", "json")
|
.addQueryParam("response", "json")
|
||||||
.addQueryParam("command", "deployVirtualMachine")
|
.addQueryParam("command", "deployVirtualMachine")
|
||||||
.addQueryParam("zoneid", "1")
|
.addQueryParam("zoneid", "1")
|
||||||
.addQueryParam("templateid", "4")
|
|
||||||
.addQueryParam("serviceofferingid", "1")
|
.addQueryParam("serviceofferingid", "1")
|
||||||
|
.addQueryParam("templateid", "4")
|
||||||
.addQueryParam("displayname", "test-e92")
|
.addQueryParam("displayname", "test-e92")
|
||||||
.addQueryParam("name", "test-e92")
|
.addQueryParam("name", "test-e92")
|
||||||
.addQueryParam("networkids", "204")
|
.addQueryParam("networkids", "204")
|
||||||
|
@ -114,8 +114,8 @@ public class CloudStackComputeServiceAdapterExpectTest extends BaseCloudStackCom
|
||||||
.addQueryParam("response", "json")
|
.addQueryParam("response", "json")
|
||||||
.addQueryParam("command", "deployVirtualMachine")
|
.addQueryParam("command", "deployVirtualMachine")
|
||||||
.addQueryParam("zoneid", "1")
|
.addQueryParam("zoneid", "1")
|
||||||
.addQueryParam("templateid", "4")
|
|
||||||
.addQueryParam("serviceofferingid", "1")
|
.addQueryParam("serviceofferingid", "1")
|
||||||
|
.addQueryParam("templateid", "4")
|
||||||
.addQueryParam("displayname", "test-e92")
|
.addQueryParam("displayname", "test-e92")
|
||||||
.addQueryParam("name", "test-e92")
|
.addQueryParam("name", "test-e92")
|
||||||
.addQueryParam("account", "account") //
|
.addQueryParam("account", "account") //
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class DomainAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "1", "2", true);
|
HttpRequest httpRequest = processor.createRequest(method, "1", "2", true);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest,
|
||||||
"GET http://localhost:8080/client/api?response=json&command=disableAccount&account=1&lock=true&domainid=2 HTTP/1.1");
|
"GET http://localhost:8080/client/api?response=json&command=disableAccount&account=1&domainid=2&lock=true HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<Firew
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
httpRequest,
|
httpRequest,
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createPortForwardingRule&ipaddressid=6&publicport=22&protocol=tcp&virtualmachineid=7&privateport=22 HTTP/1.1");
|
"GET http://localhost:8080/client/api?response=json&command=createPortForwardingRule&ipaddressid=6&protocol=tcp&publicport=22&virtualmachineid=7&privateport=22 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -243,12 +243,17 @@ public class FirewallClientExpectTest extends BaseCloudStackExpectTest<FirewallC
|
||||||
|
|
||||||
public void testCreatePortForwardingRuleForVirtualMachine() {
|
public void testCreatePortForwardingRuleForVirtualMachine() {
|
||||||
FirewallClient client = requestSendsResponse(
|
FirewallClient client = requestSendsResponse(
|
||||||
HttpRequest.builder()
|
HttpRequest.builder().method("GET")
|
||||||
.method("GET")
|
.endpoint("http://localhost:8080/client/api")
|
||||||
.endpoint(
|
.addQueryParam("response", "json")
|
||||||
URI.create("http://localhost:8080/client/api?response=json&command=createPortForwardingRule&" +
|
.addQueryParam("command", "createPortForwardingRule")
|
||||||
"ipaddressid=2&publicport=22&protocol=tcp&virtualmachineid=1234&privateport=22&" +
|
.addQueryParam("ipaddressid", "2")
|
||||||
"apiKey=identity&signature=84dtGzQp0G6k3z3Gkc3F/HBNS2Y%3D"))
|
.addQueryParam("protocol", "tcp")
|
||||||
|
.addQueryParam("publicport", "22")
|
||||||
|
.addQueryParam("virtualmachineid", "1234")
|
||||||
|
.addQueryParam("privateport", "22")
|
||||||
|
.addQueryParam("apiKey", "identity")
|
||||||
|
.addQueryParam("signature", "84dtGzQp0G6k3z3Gkc3F/HBNS2Y%3D")
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.build(),
|
.build(),
|
||||||
HttpResponse.builder()
|
HttpResponse.builder()
|
||||||
|
|
|
@ -38,15 +38,25 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "GlobalAccountAsyncClientTest")
|
@Test(groups = "unit", testName = "GlobalAccountAsyncClientTest")
|
||||||
public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalAccountAsyncClient> {
|
public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalAccountAsyncClient> {
|
||||||
|
|
||||||
|
HttpRequest create = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createAccount")
|
||||||
|
.addQueryParam("username", "user")
|
||||||
|
.addQueryParam("accounttype", "0")
|
||||||
|
.addQueryParam("email", "email@example.com")
|
||||||
|
.addQueryParam("firstname", "FirstName")
|
||||||
|
.addQueryParam("lastname", "LastName")
|
||||||
|
.addQueryParam("password", "hashed-password")
|
||||||
|
.build();
|
||||||
|
|
||||||
public void testCreateAccount() throws Exception {
|
public void testCreateAccount() throws Exception {
|
||||||
Method method = GlobalAccountAsyncClient.class.getMethod("createAccount", String.class, Account.Type.class,
|
Method method = GlobalAccountAsyncClient.class.getMethod("createAccount", String.class, Account.Type.class,
|
||||||
String.class, String.class, String.class, String.class, CreateAccountOptions[].class);
|
String.class, String.class, String.class, String.class, CreateAccountOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "user", Account.Type.USER, "email@example.com",
|
HttpRequest httpRequest = processor.createRequest(method, "user", Account.Type.USER, "email@example.com",
|
||||||
"FirstName", "LastName", "hashed-password");
|
"FirstName", "LastName", "hashed-password");
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, create.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createAccount&password=hashed-password&" +
|
|
||||||
"username=user&email=email%40example.com&accounttype=0&firstname=FirstName&lastname=LastName HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -57,14 +67,21 @@ public class GlobalAccountAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest update = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "updateAccount")
|
||||||
|
.addQueryParam("account", "account")
|
||||||
|
.addQueryParam("domainid", "42")
|
||||||
|
.addQueryParam("newname", "new-account-name")
|
||||||
|
.build();
|
||||||
|
|
||||||
public void testUpdateAccount() throws Exception {
|
public void testUpdateAccount() throws Exception {
|
||||||
Method method = GlobalAccountAsyncClient.class.getMethod("updateAccount", String.class, String.class,
|
Method method = GlobalAccountAsyncClient.class.getMethod("updateAccount", String.class, String.class,
|
||||||
String.class, UpdateAccountOptions[].class);
|
String.class, UpdateAccountOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "account", 42L, "new-account-name");
|
HttpRequest httpRequest = processor.createRequest(method, "account", 42L, "new-account-name");
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, update.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=updateAccount&account=account&" +
|
|
||||||
"newname=new-account-name&domainid=42 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,26 @@ public class GlobalHostClientExpectTest extends BaseCloudStackExpectTest<GlobalH
|
||||||
assertEquals(client.listHosts(), ImmutableSet.of());
|
assertEquals(client.listHosts(), ImmutableSet.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest addHost = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "addHost")
|
||||||
|
.addQueryParam("zoneid", "1")
|
||||||
|
.addQueryParam("url", "http%3A//example.com")
|
||||||
|
.addQueryParam("hypervisor", "XenServer")
|
||||||
|
.addQueryParam("username", "fred")
|
||||||
|
.addQueryParam("password", "sekrit")
|
||||||
|
.addQueryParam("hosttags", "")
|
||||||
|
.addQueryParam("allocationstate", "Enabled")
|
||||||
|
.addQueryParam("clusterid", "1")
|
||||||
|
.addQueryParam("clustername", "Xen%20Clust%201")
|
||||||
|
.addQueryParam("podid", "1")
|
||||||
|
.addQueryParam("apiKey", "identity")
|
||||||
|
.addQueryParam("signature", "ExGaljKKQIlVbWk5hd0BnnjmBzs=")
|
||||||
|
.addHeader("Accept", "application/json").build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddHostWhenResponseIs2xx() {
|
public void testAddHostWhenResponseIs2xx() {
|
||||||
HttpRequest request = HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("http://localhost:8080/client/api?response=json&command=addHost&zoneid=1&hypervisor=XenServer&url=http%3A//example.com&username=fred&password=sekrit&hosttags=&allocationstate=Enabled&clusterid=1&clustername=Xen%20Clust%201&podid=1&apiKey=identity&signature=ExGaljKKQIlVbWk5hd0BnnjmBzs%3D")
|
|
||||||
.addHeader("Accept", "application/json").build();
|
|
||||||
HttpResponse response = HttpResponse.builder()
|
HttpResponse response = HttpResponse.builder()
|
||||||
.payload(payloadFromResource("/addhostresponse.json"))
|
.payload(payloadFromResource("/addhostresponse.json"))
|
||||||
.statusCode(200).build();
|
.statusCode(200).build();
|
||||||
|
@ -110,7 +124,7 @@ public class GlobalHostClientExpectTest extends BaseCloudStackExpectTest<GlobalH
|
||||||
Date created = makeDate(2011, Calendar.NOVEMBER, 26, 23, 28, 36, "GMT+02:00");
|
Date created = makeDate(2011, Calendar.NOVEMBER, 26, 23, 28, 36, "GMT+02:00");
|
||||||
Host expected = Host.builder().id("1").name("cs2-xevsrv.alucloud.local").state(Host.State.UP).type(Host.Type.ROUTING).ipAddress("10.26.26.107").zoneId("1").zoneName("Dev Zone 1").podId("1").podName("Dev Pod 1").version("2.2.12.20110928142833").hypervisor("XenServer").cpuNumber(24).cpuSpeed(2266).cpuAllocated("2.76%").cpuUsed("0.1%").cpuWithOverProvisioning(54384.0F).networkKbsRead(4443).networkKbsWrite(15048).memoryTotal(100549733760L).memoryAllocated(3623878656L).memoryUsed(3623878656L).capabilities("xen-3.0-x86_64 , xen-3.0-x86_32p , hvm-3.0-x86_32 , hvm-3.0-x86_32p , hvm-3.0-x86_64").lastPinged(lastPinged).managementServerId("223098941760041").clusterId("1").clusterName("Xen Clust 1").clusterType(Host.ClusterType.CLOUD_MANAGED).localStorageActive(false).created(created).events("PrepareUnmanaged; HypervisorVersionChanged; ManagementServerDown; PingTimeout; AgentDisconnected; MaintenanceRequested; HostDown; AgentConnected; StartAgentRebalance; ShutdownRequested; Ping").hasEnoughCapacity(false).allocationState(AllocationState.ENABLED).build();
|
Host expected = Host.builder().id("1").name("cs2-xevsrv.alucloud.local").state(Host.State.UP).type(Host.Type.ROUTING).ipAddress("10.26.26.107").zoneId("1").zoneName("Dev Zone 1").podId("1").podName("Dev Pod 1").version("2.2.12.20110928142833").hypervisor("XenServer").cpuNumber(24).cpuSpeed(2266).cpuAllocated("2.76%").cpuUsed("0.1%").cpuWithOverProvisioning(54384.0F).networkKbsRead(4443).networkKbsWrite(15048).memoryTotal(100549733760L).memoryAllocated(3623878656L).memoryUsed(3623878656L).capabilities("xen-3.0-x86_64 , xen-3.0-x86_32p , hvm-3.0-x86_32 , hvm-3.0-x86_32p , hvm-3.0-x86_64").lastPinged(lastPinged).managementServerId("223098941760041").clusterId("1").clusterName("Xen Clust 1").clusterType(Host.ClusterType.CLOUD_MANAGED).localStorageActive(false).created(created).events("PrepareUnmanaged; HypervisorVersionChanged; ManagementServerDown; PingTimeout; AgentDisconnected; MaintenanceRequested; HostDown; AgentConnected; StartAgentRebalance; ShutdownRequested; Ping").hasEnoughCapacity(false).allocationState(AllocationState.ENABLED).build();
|
||||||
|
|
||||||
Host actual = requestSendsResponse(request, response).addHost("1", "http://example.com", "XenServer", "fred", "sekrit",
|
Host actual = requestSendsResponse(addHost, response).addHost("1", "http://example.com", "XenServer", "fred", "sekrit",
|
||||||
AddHostOptions.Builder.hostTags(ImmutableSet.<String>of()).allocationState(AllocationState.ENABLED).clusterId("1").clusterName("Xen Clust 1").podId("1"));
|
AddHostOptions.Builder.hostTags(ImmutableSet.<String>of()).allocationState(AllocationState.ENABLED).clusterId("1").clusterName("Xen Clust 1").podId("1"));
|
||||||
|
|
||||||
assertEquals(actual, expected);
|
assertEquals(actual, expected);
|
||||||
|
@ -135,16 +149,22 @@ public class GlobalHostClientExpectTest extends BaseCloudStackExpectTest<GlobalH
|
||||||
assertEquals(actual, expected);
|
assertEquals(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest updateHostPassword = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "updateHostPassword")
|
||||||
|
.addQueryParam("hostid", "1")
|
||||||
|
.addQueryParam("username", "fred")
|
||||||
|
.addQueryParam("password", "sekrit")
|
||||||
|
.addQueryParam("apiKey", "identity")
|
||||||
|
.addQueryParam("signature", "g9nMKDWoiU72y0HhaRFekZCgfJc=")
|
||||||
|
.addHeader("Accept", "application/json").build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateHostPasswordWhenResponseIs2xx() {
|
public void testUpdateHostPasswordWhenResponseIs2xx() {
|
||||||
HttpRequest request = HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("http://localhost:8080/client/api?response=json&command=updateHostPassword&hostid=1&password=sekrit&username=fred&apiKey=identity&signature=g9nMKDWoiU72y0HhaRFekZCgfJc%3D")
|
|
||||||
.addHeader("Accept", "application/json").build();
|
|
||||||
HttpResponse response = HttpResponse.builder()
|
HttpResponse response = HttpResponse.builder()
|
||||||
.statusCode(200).build();
|
.statusCode(200).build();
|
||||||
|
requestSendsResponse(updateHostPassword, response).updateHostPassword("1", "fred", "sekrit");
|
||||||
requestSendsResponse(request, response).updateHostPassword("1", "fred", "sekrit");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -253,50 +273,79 @@ public class GlobalHostClientExpectTest extends BaseCloudStackExpectTest<GlobalH
|
||||||
assertEquals(client.listClusters(), ImmutableSet.of());
|
assertEquals(client.listClusters(), ImmutableSet.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest addCluster = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "addCluster")
|
||||||
|
.addQueryParam("zoneid", "1")
|
||||||
|
.addQueryParam("clustername", "Xen Clust 1")
|
||||||
|
.addQueryParam("clustertype", "CloudManaged")
|
||||||
|
.addQueryParam("hypervisor", "XenServer")
|
||||||
|
.addQueryParam("allocationstate", "Enabled")
|
||||||
|
.addQueryParam("podid", "1")
|
||||||
|
.addQueryParam("url", "http://example.com/cluster")
|
||||||
|
.addQueryParam("username", "fred")
|
||||||
|
.addQueryParam("password", "sekrit")
|
||||||
|
.addQueryParam("apiKey", "identity")
|
||||||
|
.addQueryParam("signature", "2uIQ5qF0bVycXK111wxvogWp1Yw=")
|
||||||
|
.addHeader("Accept", "application/json").build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddClusterWhenResponseIs2xx() {
|
public void testAddClusterWhenResponseIs2xx() {
|
||||||
HttpRequest request = HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("http://localhost:8080/client/api?response=json&command=addCluster&zoneid=1&clustertype=CloudManaged&clustername=Xen%20Clust%201&hypervisor=XenServer&allocationstate=Enabled&podid=1&url=http%3A//example.com/cluster&username=fred&password=sekrit&apiKey=identity&signature=2uIQ5qF0bVycXK111wxvogWp1Yw%3D")
|
|
||||||
.addHeader("Accept", "application/json").build();
|
|
||||||
HttpResponse response = HttpResponse.builder()
|
HttpResponse response = HttpResponse.builder()
|
||||||
.payload(payloadFromResource("/addclusterresponse.json"))
|
.payload(payloadFromResource("/addclusterresponse.json"))
|
||||||
.statusCode(200).build();
|
.statusCode(200).build();
|
||||||
|
|
||||||
Cluster expected = Cluster.builder().id("1").name("Xen Clust 1").podId("1").podName("Dev Pod 1").zoneId("1").zoneName("Dev Zone 1").hypervisor("XenServer").clusterType(Host.ClusterType.CLOUD_MANAGED).allocationState(AllocationState.ENABLED).managedState(Cluster.ManagedState.MANAGED).build();
|
Cluster expected = Cluster.builder().id("1").name("Xen Clust 1").podId("1").podName("Dev Pod 1").zoneId("1").zoneName("Dev Zone 1").hypervisor("XenServer").clusterType(Host.ClusterType.CLOUD_MANAGED).allocationState(AllocationState.ENABLED).managedState(Cluster.ManagedState.MANAGED).build();
|
||||||
|
|
||||||
Cluster actual = requestSendsResponse(request, response).addCluster("1", "Xen Clust 1", Host.ClusterType.CLOUD_MANAGED, "XenServer", AddClusterOptions.Builder.allocationState(AllocationState.ENABLED).podId("1").url("http://example.com/cluster").username("fred").password("sekrit"));
|
Cluster actual = requestSendsResponse(addCluster, response).addCluster("1", "Xen Clust 1", Host.ClusterType.CLOUD_MANAGED, "XenServer", AddClusterOptions.Builder.allocationState(AllocationState.ENABLED).podId("1").url("http://example.com/cluster").username("fred").password("sekrit"));
|
||||||
|
|
||||||
assertEquals(actual, expected);
|
assertEquals(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest updateCluster = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "updateCluster")
|
||||||
|
.addQueryParam("id", "1")
|
||||||
|
.addQueryParam("allocationstate", "Enabled")
|
||||||
|
.addQueryParam("clustername", "Xen Clust 1")
|
||||||
|
.addQueryParam("clustertype", "CloudManaged")
|
||||||
|
.addQueryParam("hypervisor", "XenServer")
|
||||||
|
.addQueryParam("managedstate", "Managed")
|
||||||
|
.addQueryParam("apiKey", "identity")
|
||||||
|
.addQueryParam("signature", "/wbuYKwInciSXWkUf05lEfJZShQ=")
|
||||||
|
.addHeader("Accept", "application/json").build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateClusterWhenResponseIs2xx() {
|
public void testUpdateClusterWhenResponseIs2xx() {
|
||||||
HttpRequest request = HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("http://localhost:8080/client/api?response=json&command=updateCluster&id=1&allocationstate=Enabled&clustername=Xen%20Clust%201&clustertype=CloudManaged&hypervisor=XenServer&managedstate=Managed&apiKey=identity&signature=/wbuYKwInciSXWkUf05lEfJZShQ%3D")
|
|
||||||
.addHeader("Accept", "application/json").build();
|
|
||||||
HttpResponse response = HttpResponse.builder()
|
HttpResponse response = HttpResponse.builder()
|
||||||
.payload(payloadFromResource("/updateclusterresponse.json"))
|
.payload(payloadFromResource("/updateclusterresponse.json"))
|
||||||
.statusCode(200).build();
|
.statusCode(200).build();
|
||||||
|
|
||||||
Cluster expected = Cluster.builder().id("1").name("Xen Clust 1").podId("1").podName("Dev Pod 1").zoneId("1").zoneName("Dev Zone 1").hypervisor("XenServer").clusterType(Host.ClusterType.CLOUD_MANAGED).allocationState(AllocationState.ENABLED).managedState(Cluster.ManagedState.MANAGED).build();
|
Cluster expected = Cluster.builder().id("1").name("Xen Clust 1").podId("1").podName("Dev Pod 1").zoneId("1").zoneName("Dev Zone 1").hypervisor("XenServer").clusterType(Host.ClusterType.CLOUD_MANAGED).allocationState(AllocationState.ENABLED).managedState(Cluster.ManagedState.MANAGED).build();
|
||||||
|
|
||||||
Cluster actual = requestSendsResponse(request, response).updateCluster("1", UpdateClusterOptions.Builder.allocationState(AllocationState.ENABLED).clusterName("Xen Clust 1").clusterType(Host.ClusterType.CLOUD_MANAGED).hypervisor("XenServer").managedState(Cluster.ManagedState.MANAGED));
|
Cluster actual = requestSendsResponse(updateCluster, response).updateCluster("1", UpdateClusterOptions.Builder.allocationState(AllocationState.ENABLED).clusterName("Xen Clust 1").clusterType(Host.ClusterType.CLOUD_MANAGED).hypervisor("XenServer").managedState(Cluster.ManagedState.MANAGED));
|
||||||
|
|
||||||
assertEquals(actual, expected);
|
assertEquals(actual, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest updateClusterPassword = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "updateHostPassword")
|
||||||
|
.addQueryParam("clusterid", "1")
|
||||||
|
.addQueryParam("username", "fred")
|
||||||
|
.addQueryParam("password", "sekrit")
|
||||||
|
.addQueryParam("apiKey", "identity")
|
||||||
|
.addQueryParam("signature", "xwc83%2BoYK0cuAiFQAlg/7/1IVHE=")
|
||||||
|
.addHeader("Accept", "application/json").build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateClusterPasswordWhenResponseIs2xx() {
|
public void testUpdateClusterPasswordWhenResponseIs2xx() {
|
||||||
HttpRequest request = HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint("http://localhost:8080/client/api?response=json&command=updateHostPassword&clusterid=1&password=sekrit&username=fred&apiKey=identity&signature=xwc83%2BoYK0cuAiFQAlg/7/1IVHE%3D")
|
|
||||||
.addHeader("Accept", "application/json").build();
|
|
||||||
HttpResponse response = HttpResponse.builder()
|
HttpResponse response = HttpResponse.builder()
|
||||||
.statusCode(200).build();
|
.statusCode(200).build();
|
||||||
|
requestSendsResponse(updateClusterPassword, response).updateClusterPassword("1", "fred", "sekrit");
|
||||||
requestSendsResponse(request, response).updateClusterPassword("1", "fred", "sekrit");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -40,13 +40,22 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "GlobalOfferingAsyncClientTest")
|
@Test(groups = "unit", testName = "GlobalOfferingAsyncClientTest")
|
||||||
public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalOfferingAsyncClient> {
|
public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalOfferingAsyncClient> {
|
||||||
|
|
||||||
|
HttpRequest createServiceOffering = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createServiceOffering")
|
||||||
|
.addQueryParam("name", "name")
|
||||||
|
.addQueryParam("displaytext", "displayText")
|
||||||
|
.addQueryParam("cpunumber", "1")
|
||||||
|
.addQueryParam("cpuspeed", "2")
|
||||||
|
.addQueryParam("memory", "3").build();
|
||||||
|
|
||||||
public void testCreateServiceOffering() throws Exception {
|
public void testCreateServiceOffering() throws Exception {
|
||||||
Method method = GlobalOfferingAsyncClient.class.getMethod("createServiceOffering",
|
Method method = GlobalOfferingAsyncClient.class.getMethod("createServiceOffering",
|
||||||
String.class, String.class, int.class, int.class, int.class, CreateServiceOfferingOptions[].class);
|
String.class, String.class, int.class, int.class, int.class, CreateServiceOfferingOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "name", "displayText", 1, 2, 3);
|
HttpRequest httpRequest = processor.createRequest(method, "name", "displayText", 1, 2, 3);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, createServiceOffering.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createServiceOffering&name=name&cpunumber=1&displaytext=displayText&cpuspeed=2&memory=3 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -105,17 +105,23 @@ public class GlobalPodClientExpectTest extends BaseCloudStackExpectTest<GlobalPo
|
||||||
assertEquals(client.listPods(), ImmutableSet.of());
|
assertEquals(client.listPods(), ImmutableSet.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createPod = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createPod")
|
||||||
|
.addQueryParam("name", "richard-pod")
|
||||||
|
.addQueryParam("zoneid", "10")
|
||||||
|
.addQueryParam("startip", "172.20.0.1")
|
||||||
|
.addQueryParam("endip", "172.20.0.250")
|
||||||
|
.addQueryParam("gateway", "172.20.0.254")
|
||||||
|
.addQueryParam("netmask", "255.255.255.0")
|
||||||
|
.addQueryParam("allocationstate", "Enabled")
|
||||||
|
.addQueryParam("apiKey", "identity")
|
||||||
|
.addQueryParam("signature", "fwsoQ77BmNQWfuqv4nVlPcKvKbU=")
|
||||||
|
.addHeader("Accept", "application/json").build();
|
||||||
|
|
||||||
public void testCreatePodWhenResponseIs2xx() {
|
public void testCreatePodWhenResponseIs2xx() {
|
||||||
GlobalPodClient client = requestSendsResponse(
|
GlobalPodClient client = requestSendsResponse(createPod,
|
||||||
HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint(
|
|
||||||
URI.create("http://localhost:8080/client/api?response=json&command=createPod&netmask=255.255.255.0&name=richard-pod&startip=172.20.0.1&zoneid=10&endip=172.20.0.250&gateway=172.20.0.254&allocationstate=Enabled&apiKey=identity&signature=fwsoQ77BmNQWfuqv4nVlPcKvKbU%3D"))
|
|
||||||
.headers(
|
|
||||||
ImmutableMultimap.<String, String>builder()
|
|
||||||
.put("Accept", "application/json")
|
|
||||||
.build())
|
|
||||||
.build(),
|
|
||||||
HttpResponse.builder()
|
HttpResponse.builder()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.payload(payloadFromResource("/createpodresponse.json"))
|
.payload(payloadFromResource("/createpodresponse.json"))
|
||||||
|
|
|
@ -35,15 +35,24 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "GlobalUserAsyncClientTest")
|
@Test(groups = "unit", testName = "GlobalUserAsyncClientTest")
|
||||||
public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalUserAsyncClient> {
|
public class GlobalUserAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalUserAsyncClient> {
|
||||||
|
|
||||||
|
HttpRequest createUser = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createUser")
|
||||||
|
.addQueryParam("username", "user")
|
||||||
|
.addQueryParam("account", "account")
|
||||||
|
.addQueryParam("email", "email%40example.com")
|
||||||
|
.addQueryParam("password", "hashed-password")
|
||||||
|
.addQueryParam("firstname", "FirstName")
|
||||||
|
.addQueryParam("lastname", "LastName").build();
|
||||||
|
|
||||||
public void testCreateAccount() throws Exception {
|
public void testCreateAccount() throws Exception {
|
||||||
Method method = GlobalUserAsyncClient.class.getMethod("createUser", String.class, String.class,
|
Method method = GlobalUserAsyncClient.class.getMethod("createUser", String.class, String.class,
|
||||||
String.class, String.class, String.class, String.class, CreateUserOptions[].class);
|
String.class, String.class, String.class, String.class, CreateUserOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "user", "account", "email@example.com",
|
HttpRequest httpRequest = processor.createRequest(method, "user", "account", "email@example.com",
|
||||||
"hashed-password", "FirstName", "LastName");
|
"hashed-password", "FirstName", "LastName");
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, createUser.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createUser&lastname=LastName&" +
|
|
||||||
"username=user&email=email%40example.com&account=account&password=hashed-password&firstname=FirstName HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -44,20 +44,20 @@ import com.google.common.collect.ImmutableMultimap;
|
||||||
@Test(groups = "unit", testName = "GlobalZoneClientExpectTest")
|
@Test(groups = "unit", testName = "GlobalZoneClientExpectTest")
|
||||||
public class GlobalZoneClientExpectTest extends BaseCloudStackExpectTest<GlobalZoneClient> {
|
public class GlobalZoneClientExpectTest extends BaseCloudStackExpectTest<GlobalZoneClient> {
|
||||||
|
|
||||||
public void testCreateZoneWhenResponseIs2xxAnd404() {
|
HttpRequest createZone = HttpRequest.builder().method("GET")
|
||||||
HttpRequest request = HttpRequest.builder()
|
.endpoint("http://localhost:8080/client/api")
|
||||||
.method("GET")
|
.addQueryParam("response", "json")
|
||||||
.endpoint(
|
.addQueryParam("command", "createZone")
|
||||||
URI.create("http://localhost:8080/client/api?response=json&command=createZone&" +
|
.addQueryParam("name", "test-zone")
|
||||||
"name=test-zone&dns1=8.8.8.8&networktype=Basic&internaldns1=10.10.10.10&" +
|
.addQueryParam("networktype", "Basic")
|
||||||
"apiKey=identity&signature=hWNmM2%2BTsfb5DelQa/GJLN5DVWE%3D"))
|
.addQueryParam("dns1", "8.8.8.8")
|
||||||
.headers(
|
.addQueryParam("internaldns1", "10.10.10.10")
|
||||||
ImmutableMultimap.<String, String>builder()
|
.addQueryParam("apiKey", "identity")
|
||||||
.put("Accept", "application/json")
|
.addQueryParam("signature", "hWNmM2%2BTsfb5DelQa/GJLN5DVWE=")
|
||||||
.build())
|
.addHeader("Accept", "application/json").build();
|
||||||
.build();
|
|
||||||
|
|
||||||
GlobalZoneClient client = requestSendsResponse(request,
|
public void testCreateZoneWhenResponseIs2xxAnd404() {
|
||||||
|
GlobalZoneClient client = requestSendsResponse(createZone,
|
||||||
HttpResponse.builder()
|
HttpResponse.builder()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.payload(payloadFromResource("/createzoneresponse.json"))
|
.payload(payloadFromResource("/createzoneresponse.json"))
|
||||||
|
@ -75,7 +75,7 @@ public class GlobalZoneClientExpectTest extends BaseCloudStackExpectTest<GlobalZ
|
||||||
.zoneToken("7b6e27df-30a6-3024-9d8b-7971a3127f64")
|
.zoneToken("7b6e27df-30a6-3024-9d8b-7971a3127f64")
|
||||||
.dhcpProvider("DhcpServer").build());
|
.dhcpProvider("DhcpServer").build());
|
||||||
|
|
||||||
client = requestSendsResponse(request, HttpResponse.builder().statusCode(404).build());
|
client = requestSendsResponse(createZone, HttpResponse.builder().statusCode(404).build());
|
||||||
assertNull(client.createZone("test-zone", NetworkType.BASIC, "8.8.8.8", "10.10.10.10"));
|
assertNull(client.createZone("test-zone", NetworkType.BASIC, "8.8.8.8", "10.10.10.10"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,13 +142,20 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest copyIso = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "copyIso")
|
||||||
|
.addQueryParam("id", "3")
|
||||||
|
.addQueryParam("sourcezoneid", "5")
|
||||||
|
.addQueryParam("destzoneid", "7")
|
||||||
|
.build();
|
||||||
|
|
||||||
public void testCopyISO() throws NoSuchMethodException {
|
public void testCopyISO() throws NoSuchMethodException {
|
||||||
Method method = ISOAsyncClient.class.getMethod("copyISO", String.class, String.class, String.class);
|
Method method = ISOAsyncClient.class.getMethod("copyISO", String.class, String.class, String.class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 3, 5, 7);
|
HttpRequest httpRequest = processor.createRequest(method, 3, 5, 7);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, copyIso.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=copyIso&id=3&destzoneid=7&sourcezoneid=5 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
assertResponseParserClassEquals(method, httpRequest, UnwrapOnlyJsonValue.class);
|
||||||
|
@ -222,12 +229,20 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest extractIso = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "extractIso")
|
||||||
|
.addQueryParam("id", "3")
|
||||||
|
.addQueryParam("mode", "HTTP_DOWNLOAD")
|
||||||
|
.addQueryParam("zoneid", "5")
|
||||||
|
.build();
|
||||||
|
|
||||||
public void testExtractISO() throws NoSuchMethodException {
|
public void testExtractISO() throws NoSuchMethodException {
|
||||||
Method method = ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class);
|
Method method = ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5);
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, extractIso.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=extractIso&id=3&zoneid=5&mode=HTTP_DOWNLOAD HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -238,12 +253,21 @@ public class ISOAsyncClientTest extends BaseCloudStackAsyncClientTest<ISOAsyncCl
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest extractIsoOptions = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "extractIso")
|
||||||
|
.addQueryParam("id", "3")
|
||||||
|
.addQueryParam("mode", "HTTP_DOWNLOAD")
|
||||||
|
.addQueryParam("zoneid", "5")
|
||||||
|
.addQueryParam("url", "http://example.com/")
|
||||||
|
.build();
|
||||||
|
|
||||||
public void testExtractISOOptions() throws NoSuchMethodException {
|
public void testExtractISOOptions() throws NoSuchMethodException {
|
||||||
Method method = ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class);
|
Method method = ISOAsyncClient.class.getMethod("extractISO", String.class, ExtractMode.class, String.class, ExtractISOOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractISOOptions.Builder.url("http://example.com/"));
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractISOOptions.Builder.url("http://example.com/"));
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, extractIsoOptions.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=extractIso&id=3&zoneid=5&mode=HTTP_DOWNLOAD&url=http%3A//example.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -170,8 +170,8 @@ public class ISOClientExpectTest extends BaseCloudStackExpectTest<ISOClient> {
|
||||||
.addQueryParam("response", "json")
|
.addQueryParam("response", "json")
|
||||||
.addQueryParam("command", "registerIso")
|
.addQueryParam("command", "registerIso")
|
||||||
.addQueryParam("name", "ubuntu10.10")
|
.addQueryParam("name", "ubuntu10.10")
|
||||||
.addQueryParam("url", "http://ubuntu/ubuntu-10.10.iso")
|
|
||||||
.addQueryParam("displaytext", "ubuntu 10.10 (32 bit)")
|
.addQueryParam("displaytext", "ubuntu 10.10 (32 bit)")
|
||||||
|
.addQueryParam("url", "http://ubuntu/ubuntu-10.10.iso")
|
||||||
.addQueryParam("zoneid", "1e0335d9-b6cc-4805-bddf-0828e66a0d01")
|
.addQueryParam("zoneid", "1e0335d9-b6cc-4805-bddf-0828e66a0d01")
|
||||||
.addQueryParam("account", "root")
|
.addQueryParam("account", "root")
|
||||||
.addQueryParam("domainid", "99f4159b-c698-4bd9-b8c5-5ac462f101eb")
|
.addQueryParam("domainid", "99f4159b-c698-4bd9-b8c5-5ac462f101eb")
|
||||||
|
|
|
@ -78,14 +78,22 @@ public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<L
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createLoadBalancerRule = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createLoadBalancerRule")
|
||||||
|
.addQueryParam("publicipid", "6")
|
||||||
|
.addQueryParam("algorithm", "leastconn")
|
||||||
|
.addQueryParam("name", "tcp")
|
||||||
|
.addQueryParam("privateport", "22")
|
||||||
|
.addQueryParam("publicport", "22").build();
|
||||||
|
|
||||||
public void testCreateLoadBalancerRuleForPublicIP() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateLoadBalancerRuleForPublicIP() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = LoadBalancerAsyncClient.class.getMethod("createLoadBalancerRuleForPublicIP", String.class,
|
Method method = LoadBalancerAsyncClient.class.getMethod("createLoadBalancerRuleForPublicIP", String.class,
|
||||||
Algorithm.class, String.class, int.class, int.class, CreateLoadBalancerRuleOptions[].class);
|
Algorithm.class, String.class, int.class, int.class, CreateLoadBalancerRuleOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 6, Algorithm.LEASTCONN, "tcp", 22, 22);
|
HttpRequest httpRequest = processor.createRequest(method, 6, Algorithm.LEASTCONN, "tcp", 22, 22);
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, createLoadBalancerRule.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createLoadBalancerRule&publicipid=6&name=tcp&algorithm=leastconn&privateport=22&publicport=22 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -93,15 +93,21 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createIpForwardingRule = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createIpForwardingRule")
|
||||||
|
.addQueryParam("ipaddressid", "7")
|
||||||
|
.addQueryParam("protocol", "tcp")
|
||||||
|
.addQueryParam("startport", "22").build();
|
||||||
|
|
||||||
public void testCreateIPForwardingRuleForVirtualMachine() throws SecurityException, NoSuchMethodException,
|
public void testCreateIPForwardingRuleForVirtualMachine() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
Method method = NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
||||||
CreateIPForwardingRuleOptions[].class);
|
CreateIPForwardingRuleOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 7, "tcp", 22);
|
HttpRequest httpRequest = processor.createRequest(method, 7, "tcp", 22);
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, createIpForwardingRule.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createIpForwardingRule&ipaddressid=7&startport=22&protocol=tcp HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -113,6 +119,15 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createIpForwardingRuleOptions = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createIpForwardingRule")
|
||||||
|
.addQueryParam("ipaddressid", "7")
|
||||||
|
.addQueryParam("protocol", "tcp")
|
||||||
|
.addQueryParam("startport", "22")
|
||||||
|
.addQueryParam("endport", "22").build();
|
||||||
|
|
||||||
public void testCreateIPForwardingRuleForVirtualMachineOptions() throws SecurityException, NoSuchMethodException,
|
public void testCreateIPForwardingRuleForVirtualMachineOptions() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
Method method = NATAsyncClient.class.getMethod("createIPForwardingRule", String.class, String.class, int.class,
|
||||||
|
@ -120,9 +135,7 @@ public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncCl
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 7, "tcp", 22,
|
HttpRequest httpRequest = processor.createRequest(method, 7, "tcp", 22,
|
||||||
CreateIPForwardingRuleOptions.Builder.endPort(22));
|
CreateIPForwardingRuleOptions.Builder.endPort(22));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, createIpForwardingRuleOptions.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createIpForwardingRule&ipaddressid=7&startport=22&protocol=tcp&endport=22 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -97,14 +97,21 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createNetwork = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createNetwork")
|
||||||
|
.addQueryParam("zoneid", "1")
|
||||||
|
.addQueryParam("networkofferingid", "2")
|
||||||
|
.addQueryParam("name", "named")
|
||||||
|
.addQueryParam("displaytext", "lovely").build();
|
||||||
|
|
||||||
public void testCreateNetworkInZone() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateNetworkInZone() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = NetworkAsyncClient.class.getMethod("createNetworkInZone", String.class, String.class, String.class,
|
Method method = NetworkAsyncClient.class.getMethod("createNetworkInZone", String.class, String.class, String.class,
|
||||||
String.class, CreateNetworkOptions[].class);
|
String.class, CreateNetworkOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely");
|
HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely");
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, createNetwork.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createNetwork&zoneid=1&name=named&networkofferingid=2&displaytext=lovely HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -116,6 +123,17 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createNetworkOptions = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createNetwork")
|
||||||
|
.addQueryParam("zoneid", "1")
|
||||||
|
.addQueryParam("networkofferingid", "2")
|
||||||
|
.addQueryParam("name", "named")
|
||||||
|
.addQueryParam("displaytext", "lovely")
|
||||||
|
.addQueryParam("netmask", "255.255.255.0")
|
||||||
|
.addQueryParam("domainid", "6").build();
|
||||||
|
|
||||||
public void testCreateNetworkInZoneOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateNetworkInZoneOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = NetworkAsyncClient.class.getMethod("createNetworkInZone", String.class, String.class, String.class,
|
Method method = NetworkAsyncClient.class.getMethod("createNetworkInZone", String.class, String.class, String.class,
|
||||||
String.class, CreateNetworkOptions[].class);
|
String.class, CreateNetworkOptions[].class);
|
||||||
|
@ -123,9 +141,7 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely", CreateNetworkOptions.Builder
|
HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely", CreateNetworkOptions.Builder
|
||||||
.netmask("255.255.255.0").domainId("6"));
|
.netmask("255.255.255.0").domainId("6"));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, createNetworkOptions.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createNetwork&zoneid=1&name=named&networkofferingid=2&displaytext=lovely&netmask=255.255.255.0&domainid=6 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -120,15 +120,23 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest authorizeSecurityGroupIngress3 = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "authorizeSecurityGroupIngress")
|
||||||
|
.addQueryParam("securitygroupid", "2")
|
||||||
|
.addQueryParam("protocol", "tcp")
|
||||||
|
.addQueryParam("startport", "22")
|
||||||
|
.addQueryParam("endport", "22")
|
||||||
|
.addQueryParam("cidrlist", "1.1.1.1/24,1.2.2.2/16").build();
|
||||||
|
|
||||||
public void testAuthorizeIngressPortsToCIDRs() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAuthorizeIngressPortsToCIDRs() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToCIDRs", String.class,
|
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToCIDRs", String.class,
|
||||||
String.class, int.class, int.class, Iterable.class, AccountInDomainOptions[].class);
|
String.class, int.class, int.class, Iterable.class, AccountInDomainOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22,
|
HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22,
|
||||||
ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16"));
|
ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16"));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress3.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=authorizeSecurityGroupIngress&securitygroupid=2&startport=22&protocol=tcp&endport=22&cidrlist=1.1.1.1/24,1.2.2.2/16 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -140,15 +148,28 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest authorizeSecurityGroupIngress4 = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "authorizeSecurityGroupIngress")
|
||||||
|
.addQueryParam("securitygroupid", "2")
|
||||||
|
.addQueryParam("protocol", "tcp")
|
||||||
|
.addQueryParam("startport", "22")
|
||||||
|
.addQueryParam("endport", "22")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B0%5D.account", "adrian")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B0%5D.group", "group1")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B1%5D.account", "adrian")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B1%5D.group", "group2")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B2%5D.account", "bob")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B2%5D.group", "group1").build();
|
||||||
|
|
||||||
public void testAuthorizeIngressPortsToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAuthorizeIngressPortsToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToSecurityGroups", String.class,
|
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToSecurityGroups", String.class,
|
||||||
String.class, int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
|
String.class, int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22,
|
HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22,
|
||||||
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1"));
|
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1"));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress4.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=authorizeSecurityGroupIngress&securitygroupid=2&startport=22&protocol=tcp&endport=22&usersecuritygrouplist%5B0%5D.account=adrian&usersecuritygrouplist%5B0%5D.group=group1&usersecuritygrouplist%5B1%5D.account=adrian&usersecuritygrouplist%5B1%5D.group=group2&usersecuritygrouplist%5B2%5D.account=bob&usersecuritygrouplist%5B2%5D.group=group1 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -160,14 +181,22 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest authorizeSecurityGroupIngress1 = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "authorizeSecurityGroupIngress")
|
||||||
|
.addQueryParam("protocol", "ICMP")
|
||||||
|
.addQueryParam("securitygroupid", "2")
|
||||||
|
.addQueryParam("icmpcode", "22")
|
||||||
|
.addQueryParam("icmptype", "22")
|
||||||
|
.addQueryParam("cidrlist", "1.1.1.1/24,1.2.2.2/16").build();
|
||||||
|
|
||||||
public void testAuthorizeIngressICMPToCIDRs() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAuthorizeIngressICMPToCIDRs() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToCIDRs", String.class , int.class,
|
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToCIDRs", String.class , int.class,
|
||||||
int.class, Iterable.class, AccountInDomainOptions[].class);
|
int.class, Iterable.class, AccountInDomainOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 2, 22, 22, ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16"));
|
HttpRequest httpRequest = processor.createRequest(method, 2, 22, 22, ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16"));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress1.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=authorizeSecurityGroupIngress&protocol=ICMP&securitygroupid=2&icmptype=22&icmpcode=22&cidrlist=1.1.1.1/24,1.2.2.2/16 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -179,15 +208,28 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest authorizeSecurityGroupIngress2 = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "authorizeSecurityGroupIngress")
|
||||||
|
.addQueryParam("protocol", "ICMP")
|
||||||
|
.addQueryParam("securitygroupid", "2")
|
||||||
|
.addQueryParam("icmpcode", "22")
|
||||||
|
.addQueryParam("icmptype", "22")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B0%5D.account", "adrian")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B0%5D.group", "group1")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B1%5D.account", "adrian")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B1%5D.group", "group2")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B2%5D.account", "bob")
|
||||||
|
.addQueryParam("usersecuritygrouplist%5B2%5D.group", "group1").build();
|
||||||
|
|
||||||
public void testAuthorizeIngressICMPToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAuthorizeIngressICMPToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToSecurityGroups", String.class,
|
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToSecurityGroups", String.class,
|
||||||
int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
|
int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 2, 22, 22,
|
HttpRequest httpRequest = processor.createRequest(method, 2, 22, 22,
|
||||||
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1"));
|
ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1"));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, authorizeSecurityGroupIngress2.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=authorizeSecurityGroupIngress&protocol=ICMP&securitygroupid=2&icmptype=22&icmpcode=22&usersecuritygrouplist%5B0%5D.account=adrian&usersecuritygrouplist%5B0%5D.group=group1&usersecuritygrouplist%5B1%5D.account=adrian&usersecuritygrouplist%5B1%5D.group=group2&usersecuritygrouplist%5B2%5D.account=bob&usersecuritygrouplist%5B2%5D.group=group1 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -44,22 +44,23 @@ import com.google.common.collect.ImmutableMultimap;
|
||||||
@Test(groups = "live", singleThreaded = true, testName = "SessionClientExpectTest")
|
@Test(groups = "live", singleThreaded = true, testName = "SessionClientExpectTest")
|
||||||
public class SessionClientExpectTest extends BaseCloudStackExpectTest<SessionClient> {
|
public class SessionClientExpectTest extends BaseCloudStackExpectTest<SessionClient> {
|
||||||
|
|
||||||
|
HttpRequest login = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "login")
|
||||||
|
.addQueryParam("username", "jcloud")
|
||||||
|
.addQueryParam("domain", "Partners/jCloud")
|
||||||
|
.addQueryParam("password", "30e14b3727225d833aad2206acea1275")
|
||||||
|
.addHeader("Accept", "application/json").build();
|
||||||
|
|
||||||
public void testLoginWhenResponseIs2xxIncludesJSessionId() throws IOException {
|
public void testLoginWhenResponseIs2xxIncludesJSessionId() throws IOException {
|
||||||
String domain = "Partners/jCloud";
|
String domain = "Partners/jCloud";
|
||||||
String user = "jcloud";
|
String user = "jcloud";
|
||||||
String password = "jcl0ud";
|
String password = "jcl0ud";
|
||||||
String md5password = base16().lowerCase().encode(md5().hashString(password, UTF_8).asBytes());
|
String md5password = base16().lowerCase().encode(md5().hashString(password, UTF_8).asBytes());
|
||||||
|
|
||||||
HttpRequest request = HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint(
|
|
||||||
URI.create("http://localhost:8080/client/api?response=json&command=login&" +
|
|
||||||
"username=" + user + "&password=" + md5password + "&domain=" + domain))
|
|
||||||
.addHeader("Accept", "application/json")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
String jSessionId = "90DD65D13AEAA590ECCA312D150B9F6D";
|
String jSessionId = "90DD65D13AEAA590ECCA312D150B9F6D";
|
||||||
SessionClient client = requestSendsResponse(request,
|
SessionClient client = requestSendsResponse(login,
|
||||||
HttpResponse.builder()
|
HttpResponse.builder()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
.headers(
|
.headers(
|
||||||
|
|
|
@ -149,12 +149,21 @@ public class SnapshotAsyncClientTest extends BaseCloudStackAsyncClientTest<Snaps
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest extractIso = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createSnapshotPolicy")
|
||||||
|
.addQueryParam("maxsnaps", "10")
|
||||||
|
.addQueryParam("timezone", "UTC")
|
||||||
|
.addQueryParam("volumeid", "12")
|
||||||
|
.addQueryParam("intervaltype", "MONTHLY")
|
||||||
|
.addQueryParam("schedule", "07%3A06%3A05").build();
|
||||||
|
|
||||||
public void testCreateSnapshotPolicy() throws NoSuchMethodException {
|
public void testCreateSnapshotPolicy() throws NoSuchMethodException {
|
||||||
Method method = SnapshotAsyncClient.class.getMethod("createSnapshotPolicy", SnapshotPolicySchedule.class, String.class, String.class, String.class);
|
Method method = SnapshotAsyncClient.class.getMethod("createSnapshotPolicy", SnapshotPolicySchedule.class, String.class, String.class, String.class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, SnapshotPolicySchedules.monthly(5, 6, 7), 10, "UTC", 12);
|
HttpRequest httpRequest = processor.createRequest(method, SnapshotPolicySchedules.monthly(5, 6, 7), 10, "UTC", 12);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest,extractIso.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createSnapshotPolicy&timezone=UTC&maxsnaps=10&volumeid=12&intervaltype=MONTHLY&schedule=07%3A06%3A05 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -87,11 +87,23 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerTemplate = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "registerTemplate")
|
||||||
|
.addQueryParam("format", "QCOW2")
|
||||||
|
.addQueryParam("hypervisor", "xen")
|
||||||
|
.addQueryParam("url", "http%3A//example.com/")
|
||||||
|
.addQueryParam("zoneid", "20")
|
||||||
|
.addQueryParam("name", "thename")
|
||||||
|
.addQueryParam("ostypeid", "10")
|
||||||
|
.addQueryParam("displaytext", "description").build();
|
||||||
|
|
||||||
public void testRegisterTemplate() throws NoSuchMethodException {
|
public void testRegisterTemplate() throws NoSuchMethodException {
|
||||||
Method method = TemplateAsyncClient.class.getMethod("registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class);
|
Method method = TemplateAsyncClient.class.getMethod("registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), Template.Format.QCOW2, "xen", "http://example.com/", 20);
|
HttpRequest httpRequest = processor.createRequest(method, TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), Template.Format.QCOW2, "xen", "http://example.com/", 20);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=registerTemplate&hypervisor=xen&format=QCOW2&url=http%3A//example.com/&zoneid=20&name=thename&ostypeid=10&displaytext=description HTTP/1.1");
|
assertRequestLineEquals(httpRequest, registerTemplate.getRequestLine());
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -102,12 +114,33 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerTemplateOptions = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "registerTemplate")
|
||||||
|
.addQueryParam("format", "QCOW2")
|
||||||
|
.addQueryParam("hypervisor", "xen")
|
||||||
|
.addQueryParam("url", "http%3A//example.com/")
|
||||||
|
.addQueryParam("zoneid", "20")
|
||||||
|
.addQueryParam("account", "mydomain")
|
||||||
|
.addQueryParam("domainid", "3")
|
||||||
|
.addQueryParam("bits", "32")
|
||||||
|
.addQueryParam("checksum", "ABC")
|
||||||
|
.addQueryParam("isextractable", "true")
|
||||||
|
.addQueryParam("isfeatured", "true")
|
||||||
|
.addQueryParam("ispublic", "true")
|
||||||
|
.addQueryParam("passwordenabled", "true")
|
||||||
|
.addQueryParam("requireshvm", "true")
|
||||||
|
.addQueryParam("name", "thename")
|
||||||
|
.addQueryParam("ostypeid", "10")
|
||||||
|
.addQueryParam("displaytext", "description").build();
|
||||||
|
|
||||||
public void testRegisterTemplateOptions() throws NoSuchMethodException {
|
public void testRegisterTemplateOptions() throws NoSuchMethodException {
|
||||||
Method method = TemplateAsyncClient.class.getMethod("registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class);
|
Method method = TemplateAsyncClient.class.getMethod("registerTemplate", TemplateMetadata.class, String.class, String.class, String.class, String.class, RegisterTemplateOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, TemplateMetadata.builder().name("thename").osTypeId("10").displayText("description").build(), Template.Format.QCOW2, "xen", "http://example.com/", 20,
|
HttpRequest httpRequest = processor.createRequest(method, 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));
|
RegisterTemplateOptions.Builder.accountInDomain("mydomain", "3").bits(32).checksum("ABC").isExtractable(true).isFeatured(true).isPublic(true).passwordEnabled(true).requiresHVM(true));
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=registerTemplate&hypervisor=xen&format=QCOW2&url=http%3A//example.com/&zoneid=20&account=mydomain&domainid=3&bits=32&checksum=ABC&isextractable=true&isfeatured=true&ispublic=true&passwordenabled=true&requireshvm=true&name=thename&ostypeid=10&displaytext=description HTTP/1.1");
|
assertRequestLineEquals(httpRequest, registerTemplateOptions.getRequestLine());
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -148,11 +181,19 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest copyTemplate = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "copyTemplate")
|
||||||
|
.addQueryParam("id", "17")
|
||||||
|
.addQueryParam("sourcezoneid", "18")
|
||||||
|
.addQueryParam("destzoneid", "19").build();
|
||||||
|
|
||||||
public void testCopyTemplate() throws NoSuchMethodException {
|
public void testCopyTemplate() throws NoSuchMethodException {
|
||||||
Method method = TemplateAsyncClient.class.getMethod("copyTemplateToZone", String.class, String.class, String.class);
|
Method method = TemplateAsyncClient.class.getMethod("copyTemplateToZone", String.class, String.class, String.class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 17, 18, 19);
|
HttpRequest httpRequest = processor.createRequest(method, 17, 18, 19);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=copyTemplate&id=17&destzoneid=19&sourcezoneid=18 HTTP/1.1");
|
assertRequestLineEquals(httpRequest,copyTemplate.getRequestLine());
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -311,11 +352,19 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest extractTemplate = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "extractTemplate")
|
||||||
|
.addQueryParam("id", "3")
|
||||||
|
.addQueryParam("mode", "HTTP_DOWNLOAD")
|
||||||
|
.addQueryParam("zoneid", "5").build();
|
||||||
|
|
||||||
public void testExtractTemplate() throws NoSuchMethodException {
|
public void testExtractTemplate() throws NoSuchMethodException {
|
||||||
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class);
|
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5);
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=extractTemplate&id=3&zoneid=5&mode=HTTP_DOWNLOAD HTTP/1.1");
|
assertRequestLineEquals(httpRequest, extractTemplate.getRequestLine());
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -326,11 +375,20 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
|
||||||
checkFilters(httpRequest);
|
checkFilters(httpRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest extractTemplateOptions = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "extractTemplate")
|
||||||
|
.addQueryParam("id", "3")
|
||||||
|
.addQueryParam("mode", "HTTP_DOWNLOAD")
|
||||||
|
.addQueryParam("zoneid", "5")
|
||||||
|
.addQueryParam("url", "http%3A//example.com/").build();
|
||||||
|
|
||||||
public void testExtractTemplateOptions() throws NoSuchMethodException {
|
public void testExtractTemplateOptions() throws NoSuchMethodException {
|
||||||
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class);
|
Method method = TemplateAsyncClient.class.getMethod("extractTemplate", String.class, ExtractMode.class, String.class, ExtractTemplateOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractTemplateOptions.Builder.url("http://example.com/"));
|
HttpRequest httpRequest = processor.createRequest(method, 3, ExtractMode.HTTP_DOWNLOAD, 5, ExtractTemplateOptions.Builder.url("http://example.com/"));
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET http://localhost:8080/client/api?response=json&command=extractTemplate&id=3&zoneid=5&mode=HTTP_DOWNLOAD&url=http%3A//example.com/ HTTP/1.1");
|
assertRequestLineEquals(httpRequest, extractTemplateOptions.getRequestLine());
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -101,14 +101,20 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest deployVirtualMachine = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "deployVirtualMachine")
|
||||||
|
.addQueryParam("zoneid", "6")
|
||||||
|
.addQueryParam("serviceofferingid", "4")
|
||||||
|
.addQueryParam("templateid", "5").build();
|
||||||
|
|
||||||
public void testDeployVirtualMachineInZone() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeployVirtualMachineInZone() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VirtualMachineAsyncClient.class.getMethod("deployVirtualMachineInZone", String.class, String.class,
|
Method method = VirtualMachineAsyncClient.class.getMethod("deployVirtualMachineInZone", String.class, String.class,
|
||||||
String.class, DeployVirtualMachineOptions[].class);
|
String.class, DeployVirtualMachineOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, 6, 4, 5);
|
HttpRequest httpRequest = processor.createRequest(method, 6, 4, 5);
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, deployVirtualMachine.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=deployVirtualMachine&zoneid=6&templateid=5&serviceofferingid=4 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -71,14 +71,20 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createVolumeFromSnapshot = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createVolume")
|
||||||
|
.addQueryParam("name", "jclouds-volume")
|
||||||
|
.addQueryParam("snapshotid", "999")
|
||||||
|
.addQueryParam("zoneid", "111").build();
|
||||||
|
|
||||||
public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateVolumeWithSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VolumeAsyncClient.class.getMethod("createVolumeFromSnapshotInZone", String.class, String.class,
|
Method method = VolumeAsyncClient.class.getMethod("createVolumeFromSnapshotInZone", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "jclouds-volume", 999L, 111l);
|
HttpRequest httpRequest = processor.createRequest(method, "jclouds-volume", 999L, 111l);
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(httpRequest, createVolumeFromSnapshot.getRequestLine());
|
||||||
httpRequest,
|
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createVolume&name=jclouds-volume&zoneid=111&snapshotid=999 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
@ -87,14 +93,21 @@ public class VolumeAsyncClientTest extends BaseCloudStackAsyncClientTest<VolumeA
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createVolumeFromDiskOffering = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("http://localhost:8080/client/api")
|
||||||
|
.addQueryParam("response", "json")
|
||||||
|
.addQueryParam("command", "createVolume")
|
||||||
|
.addQueryParam("name", "jclouds-volume")
|
||||||
|
.addQueryParam("diskofferingid", "999")
|
||||||
|
.addQueryParam("zoneid", "111").build();
|
||||||
|
|
||||||
public void testCreateVolumeFromDiskOffering() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateVolumeFromDiskOffering() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = VolumeAsyncClient.class.getMethod("createVolumeFromDiskOfferingInZone", String.class, String.class,
|
Method method = VolumeAsyncClient.class.getMethod("createVolumeFromDiskOfferingInZone", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
|
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "jclouds-volume", 999L, 111L);
|
HttpRequest httpRequest = processor.createRequest(method, "jclouds-volume", 999L, 111L);
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest,
|
assertRequestLineEquals(httpRequest, createVolumeFromDiskOffering.getRequestLine());
|
||||||
"GET http://localhost:8080/client/api?response=json&command=createVolume&name=jclouds-volume&zoneid=111&diskofferingid=999 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -63,8 +63,8 @@ public abstract class BaseCloudStackExpectTest<S> extends BaseRestClientExpectTe
|
||||||
.addQueryParam("response", "json")
|
.addQueryParam("response", "json")
|
||||||
.addQueryParam("command", "login")
|
.addQueryParam("command", "login")
|
||||||
.addQueryParam("username", "identity")
|
.addQueryParam("username", "identity")
|
||||||
.addQueryParam("password", base16().lowerCase().encode(md5().hashString("credential", UTF_8).asBytes()))
|
|
||||||
.addQueryParam("domain", "")
|
.addQueryParam("domain", "")
|
||||||
|
.addQueryParam("password", base16().lowerCase().encode(md5().hashString("credential", UTF_8).asBytes()))
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,29 @@ import com.google.common.collect.ImmutableList;
|
||||||
@Test(groups = "unit", testName = "AMIAsyncClientTest")
|
@Test(groups = "unit", testName = "AMIAsyncClientTest")
|
||||||
public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
|
|
||||||
|
HttpRequest createImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "CreateImage")
|
||||||
|
.addFormParam("InstanceId", "instanceId")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("Signature", "hBIUf4IUOiCKGQKehaNwwbZUjRN4NC4RSNfJ%2B8kvJdY%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
Method method = AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||||
Array.newInstance(CreateImageOptions.class, 0).getClass());
|
Array.newInstance(CreateImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "instanceId");
|
HttpRequest request = processor.createRequest(method, null, "name", "instanceId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=CreateImage&InstanceId=instanceId&Name=name",
|
assertPayloadEquals(request, createImage.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -65,17 +80,32 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createImageOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "CreateImage")
|
||||||
|
.addFormParam("Description", "description")
|
||||||
|
.addFormParam("InstanceId", "instanceId")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("NoReboot", "true")
|
||||||
|
.addFormParam("Signature", "fz3KW27JxlSq9ivmVOl4IujcHXXw1cOhdig80I7wR6o%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
Method method = AMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||||
Array.newInstance(CreateImageOptions.class, 0).getClass());
|
Array.newInstance(CreateImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "instanceId", new CreateImageOptions()
|
HttpRequest request = processor.createRequest(method, null, "name", "instanceId", new CreateImageOptions()
|
||||||
.withDescription("description").noReboot());
|
.withDescription("description").noReboot());
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, createImageOptions.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=CreateImage&InstanceId=instanceId&Name=name&Description=description&NoReboot=true",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -85,19 +115,27 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest describeImages = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImages")
|
||||||
|
.addFormParam("Signature", "qE4vexSFJqS0UWK%2BccV3s%2BP9woL3M5HI5bTBoM7s/LY%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array.newInstance(
|
Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array.newInstance(
|
||||||
DescribeImagesOptions.class, 0).getClass());
|
DescribeImagesOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, (String) null);
|
HttpRequest request = processor.createRequest(method, (String) null);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=DescribeImages", "application/x-www-form-urlencoded",
|
assertPayloadEquals(request, describeImages.getPayload().getRawContent().toString(),
|
||||||
false);
|
|
||||||
filter.filter(request);
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=DescribeImages&Signature=qE4vexSFJqS0UWK%2BccV3s%2BP9woL3M5HI5bTBoM7s/LY%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Version=2010-06-15&AWSAccessKeyId=identity",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -107,17 +145,33 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest describeImagesOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImages")
|
||||||
|
.addFormParam("ExecutableBy", "me")
|
||||||
|
.addFormParam("ImageId.1", "1")
|
||||||
|
.addFormParam("ImageId.2", "2")
|
||||||
|
.addFormParam("Owner.1", "fred")
|
||||||
|
.addFormParam("Owner.2", "nancy")
|
||||||
|
.addFormParam("Signature", "%2BE9wji7oFnNUaGmOBggYNNp6v%2BL8OzSGjuI4nx1l2Jw%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array.newInstance(
|
Method method = AMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array.newInstance(
|
||||||
DescribeImagesOptions.class, 0).getClass());
|
DescribeImagesOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
HttpRequest request = processor.createRequest(method, null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||||
"1", "2"));
|
"1", "2"));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, describeImagesOptions.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=DescribeImages&ExecutableBy=me&Owner.1=fred&Owner.2=nancy&ImageId.1=1&ImageId.2=2",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -127,13 +181,27 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest deregisterImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DeregisterImage")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "3sk9LAJAIr2lG04OMuI0qtzCoBtCU1Ac9I6TTmAWjyA%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class);
|
Method method = AMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=DeregisterImage&ImageId=imageId",
|
assertPayloadEquals(request, deregisterImage.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -143,14 +211,29 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageFromManifest = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("ImageLocation", "pathToManifest")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("Signature", "alGqfUiV/bpmpCAj/YzG9VxdTeCwOYyoPjNfwYhm7os%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||||
String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest");
|
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=RegisterImage&ImageLocation=pathToManifest&Name=name",
|
assertPayloadEquals(request, registerImageFromManifest.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -159,17 +242,31 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageFromManifestOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("Description", "description")
|
||||||
|
.addFormParam("ImageLocation", "pathToManifest")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("Signature", "p77vQLVlPoak6cP/8eoM%2Bz6zkSXx9e2iSlGgLvIwP7I%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
Method method = AMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||||
String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest", new RegisterImageOptions()
|
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest", new RegisterImageOptions()
|
||||||
.withDescription("description"));
|
.withDescription("description"));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, registerImageFromManifestOptions.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=RegisterImage&ImageLocation=pathToManifest&Name=name&Description=description",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -179,16 +276,31 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageBackedByEBS = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.DeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.Ebs.SnapshotId", "snapshotId")
|
||||||
|
.addFormParam("Name", "imageName")
|
||||||
|
.addFormParam("RootDeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("Signature", "KGqYXGpJ/UQVTM172Y2TwU4tlG21JXd3Qrx5nSLBVuA%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageName", "snapshotId");
|
HttpRequest request = processor.createRequest(method, null, "imageName", "snapshotId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, registerImageBackedByEBS.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=RegisterImage&RootDeviceName=/dev/sda1&BlockDeviceMapping.0.DeviceName=/dev/sda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -197,6 +309,29 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageBackedByEBSOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.DeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.Ebs.SnapshotId", "snapshotId")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.DeviceName", "/dev/device")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.SnapshotId", "snapshot")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.DeviceName", "/dev/newdevice")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.Ebs.DeleteOnTermination", "false")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.Ebs.VolumeSize", "100")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.VirtualName", "newblock")
|
||||||
|
.addFormParam("Description", "description")
|
||||||
|
.addFormParam("Name", "imageName")
|
||||||
|
.addFormParam("RootDeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("Signature", "xuWi0w8iODQrg4E0azwqNm2lz/Rf4hBa7m%2BunDTZvVI%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
Method method = AMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
||||||
|
@ -204,11 +339,11 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
new RegisterImageBackedByEbsOptions().withDescription("description").addBlockDeviceFromSnapshot(
|
new RegisterImageBackedByEbsOptions().withDescription("description").addBlockDeviceFromSnapshot(
|
||||||
"/dev/device", null, "snapshot").addNewBlockDevice("/dev/newdevice", "newblock", 100));
|
"/dev/device", null, "snapshot").addNewBlockDevice("/dev/newdevice", "newblock", 100));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, registerImageBackedByEBSOptions.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=RegisterImage&RootDeviceName=/dev/sda1&BlockDeviceMapping.0.DeviceName=/dev/sda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName&Description=description&BlockDeviceMapping.1.Ebs.DeleteOnTermination=false&BlockDeviceMapping.1.DeviceName=/dev/device&BlockDeviceMapping.1.Ebs.SnapshotId=snapshot&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false&BlockDeviceMapping.2.DeviceName=/dev/newdevice&BlockDeviceMapping.2.VirtualName=newblock&BlockDeviceMapping.2.Ebs.VolumeSize=100",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -218,15 +353,29 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest getBlockDeviceMappingsForImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImageAttribute")
|
||||||
|
.addFormParam("Attribute", "blockDeviceMapping")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "puwfzm8BlfeKiEZ9CNn5ax86weZ6SQ2xyZhN6etu4gA%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", String.class,
|
Method method = AMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, getBlockDeviceMappingsForImage.getPayload().getRawContent().toString(),
|
||||||
"Action=DescribeImageAttribute&Attribute=blockDeviceMapping&ImageId=imageId",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -236,14 +385,28 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest getLaunchPermissionForImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "ocCMlLh3Kpg6HwIcPKlrwoPPg9C5rt5nD0dl717mOq8%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", String.class, String.class);
|
Method method = AMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, getLaunchPermissionForImage.getPayload().getRawContent().toString(),
|
||||||
"Action=DescribeImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -253,22 +416,34 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest addLaunchPermission = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("OperationType", "add")
|
||||||
|
.addFormParam("Signature", "WZzNWOC1KHbuySvXEuLTiBA%2BVUfKpSBN2Lud6MrhlCQ%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("UserGroup.1", "all")
|
||||||
|
.addFormParam("UserId.1", "bob")
|
||||||
|
.addFormParam("UserId.2", "sue")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", String.class,
|
Method method = AMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", String.class,
|
||||||
Iterable.class, Iterable.class, String.class);
|
Iterable.class, Iterable.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "imageId");
|
.of("all"), "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, addLaunchPermission.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifyImageAttribute&OperationType=add&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
filter.filter(request);
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=ModifyImageAttribute&Attribute=launchPermission&ImageId=imageId&OperationType=add&Signature=WZzNWOC1KHbuySvXEuLTiBA%2BVUfKpSBN2Lud6MrhlCQ%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&UserGroup.1=all&UserId.1=bob&UserId.2=sue&Version=2010-06-15&AWSAccessKeyId=identity",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -278,17 +453,34 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest removeLaunchPermission = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("OperationType", "remove")
|
||||||
|
.addFormParam("Signature", "z8OYGQBAwu4HwXV6VF/vuOZlBtptxLxtCQiLXY7UvMU%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("UserGroup.1", "all")
|
||||||
|
.addFormParam("UserId.1", "bob")
|
||||||
|
.addFormParam("UserId.2", "sue")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", String.class,
|
Method method = AMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", String.class,
|
||||||
Iterable.class, Iterable.class, String.class);
|
Iterable.class, Iterable.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "imageId");
|
.of("all"), "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, removeLaunchPermission.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifyImageAttribute&OperationType=remove&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
@ -297,15 +489,29 @@ public class AMIAsyncClientTest extends BaseEC2AsyncClientTest<AMIAsyncClient> {
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest resetLaunchPermissionsOnImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ResetImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "mOVwrqAzidhz%2B4E1dqOJAzG9G9ZX7eDpi8BobN4dA%2BE%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", String.class,
|
Method method = AMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, resetLaunchPermissionsOnImage.getPayload().getRawContent().toString(),
|
||||||
"Action=ResetImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
|
|
@ -67,15 +67,28 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest describeVolumes = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeVolumes")
|
||||||
|
.addFormParam("Signature", "hNuorhZQS%2BThX5dWXOvBkvnmTpgp6SvwHmgzjjfKyG8%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", String.class, Array
|
Method method = ElasticBlockStoreAsyncClient.class.getMethod("describeVolumesInRegion", String.class,
|
||||||
.newInstance(String.class, 0).getClass());
|
String[].class);
|
||||||
HttpRequest request = processor.createRequest(method, (String) null);
|
HttpRequest request = processor.createRequest(method, null);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=DescribeVolumes", "application/x-www-form-urlencoded",
|
assertPayloadEquals(request, describeVolumes.getPayload().getRawContent().toString(),
|
||||||
false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, DescribeVolumesResponseHandler.class);
|
assertSaxResponseParserClassEquals(method, DescribeVolumesResponseHandler.class);
|
||||||
|
@ -101,15 +114,30 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest attachVolume = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "AttachVolume")
|
||||||
|
.addFormParam("Device", "/device")
|
||||||
|
.addFormParam("InstanceId", "instanceId")
|
||||||
|
.addFormParam("Signature", "LaOppR61eWpdNgMYJ3ccfo9vzbmUyJf9Ars%2Bbcu4OGI%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("VolumeId", "id")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAttachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = ElasticBlockStoreAsyncClient.class.getMethod("attachVolumeInRegion", String.class, String.class,
|
Method method = ElasticBlockStoreAsyncClient.class.getMethod("attachVolumeInRegion", String.class, String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "id", "instanceId", "/device");
|
HttpRequest request = processor.createRequest(method, null, "id", "instanceId", "/device");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, attachVolume.getPayload().getRawContent().toString(),
|
||||||
"Action=AttachVolume&InstanceId=instanceId&VolumeId=id&Device=/device",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -119,14 +147,29 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest detachVolume = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DetachVolume")
|
||||||
|
.addFormParam("Force", "false")
|
||||||
|
.addFormParam("Signature", "4c6EmHwCYbe%2BifuUV0PNXpKfReoZvJXyme37mKtnLk8%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("VolumeId", "id")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDetachVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
||||||
boolean.class, Array.newInstance(DetachVolumeOptions.class, 0).getClass());
|
boolean.class, Array.newInstance(DetachVolumeOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "id", false);
|
HttpRequest request = processor.createRequest(method, null, "id", false);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=DetachVolume&Force=false&VolumeId=id",
|
assertPayloadEquals(request, detachVolume.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -136,16 +179,32 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest detachVolumeOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DetachVolume")
|
||||||
|
.addFormParam("Device", "/device")
|
||||||
|
.addFormParam("Force", "true")
|
||||||
|
.addFormParam("InstanceId", "instanceId")
|
||||||
|
.addFormParam("Signature", "GrUGXc6H5W%2BNF8zcXU8gSRbt1ELt%2BTcCDEvbY1a88NE%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("VolumeId", "id")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDetachVolumeOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
Method method = ElasticBlockStoreAsyncClient.class.getMethod("detachVolumeInRegion", String.class, String.class,
|
||||||
boolean.class, Array.newInstance(DetachVolumeOptions.class, 0).getClass());
|
boolean.class, Array.newInstance(DetachVolumeOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "id", true, fromInstance("instanceId").fromDevice(
|
HttpRequest request = processor.createRequest(method, null, "id", true, fromInstance("instanceId").fromDevice(
|
||||||
"/device"));
|
"/device"));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, detachVolumeOptions.getPayload().getRawContent().toString(),
|
||||||
"Action=DetachVolume&Force=true&VolumeId=id&InstanceId=instanceId&Device=/device",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -247,17 +306,34 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest addCreateVolumePermissionsToSnapshot = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifySnapshotAttribute")
|
||||||
|
.addFormParam("Attribute", "createVolumePermission")
|
||||||
|
.addFormParam("OperationType", "add")
|
||||||
|
.addFormParam("Signature", "AizV1N1rCCXi%2BbzXX/Vz7shFq9yAJAwcmAGyRQMH%2Bjs%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("SnapshotId", "snapshotId")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("UserGroup.1", "all")
|
||||||
|
.addFormParam("UserId.1", "bob")
|
||||||
|
.addFormParam("UserId.2", "sue")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAddCreateVolumePermissionsToSnapshot() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = ElasticBlockStoreAsyncClient.class.getMethod("addCreateVolumePermissionsToSnapshotInRegion",
|
Method method = ElasticBlockStoreAsyncClient.class.getMethod("addCreateVolumePermissionsToSnapshotInRegion",
|
||||||
String.class, Iterable.class, Iterable.class, String.class);
|
String.class, Iterable.class, Iterable.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "snapshotId");
|
.of("all"), "snapshotId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, addCreateVolumePermissionsToSnapshot.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifySnapshotAttribute&OperationType=add&Attribute=createVolumePermission&SnapshotId=snapshotId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -267,6 +343,23 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest removeCreateVolumePermissionsFromSnapshot = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifySnapshotAttribute")
|
||||||
|
.addFormParam("Attribute", "createVolumePermission")
|
||||||
|
.addFormParam("OperationType", "remove")
|
||||||
|
.addFormParam("Signature", "Lmlt2daM%2BJ4kIoU9HmCempwVGZP1fC6V%2Br9o8MQjYy8%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("SnapshotId", "snapshotId")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("UserGroup.1", "all")
|
||||||
|
.addFormParam("UserId.1", "bob")
|
||||||
|
.addFormParam("UserId.2", "sue")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException, NoSuchMethodException,
|
public void testRemoveCreateVolumePermissionsFromSnapshot() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = ElasticBlockStoreAsyncClient.class.getMethod("removeCreateVolumePermissionsFromSnapshotInRegion",
|
Method method = ElasticBlockStoreAsyncClient.class.getMethod("removeCreateVolumePermissionsFromSnapshotInRegion",
|
||||||
|
@ -274,12 +367,13 @@ public class ElasticBlockStoreAsyncClientTest extends BaseEC2AsyncClientTest<Ela
|
||||||
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
.of("all"), "snapshotId");
|
.of("all"), "snapshotId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, removeCreateVolumePermissionsFromSnapshot.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifySnapshotAttribute&OperationType=remove&Attribute=createVolumePermission&SnapshotId=snapshotId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
|
@ -56,14 +56,29 @@ public class ElasticIPAddressAsyncClientTest extends BaseEC2AsyncClientTest<Elas
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest associateAddress = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "AssociateAddress")
|
||||||
|
.addFormParam("InstanceId", "me")
|
||||||
|
.addFormParam("PublicIp", "127.0.0.1")
|
||||||
|
.addFormParam("Signature", "YmPyvEljuFw0INSUbQx5xAhC/1GQ4a1Ht6TdoXeMc9Y%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAssociateAddress() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = ElasticIPAddressAsyncClient.class.getMethod("associateAddressInRegion", String.class,
|
Method method = ElasticIPAddressAsyncClient.class.getMethod("associateAddressInRegion", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "127.0.0.1", "me");
|
HttpRequest request = processor.createRequest(method, null, "127.0.0.1", "me");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=AssociateAddress&InstanceId=me&PublicIp=127.0.0.1",
|
assertPayloadEquals(request, associateAddress.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -346,21 +346,32 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setUserDataForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "userData")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "LfUmzLM5DsACR5nQcEfGF5FPdznOwwhJ7tjhBWfHtGs%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "dGVzdA%3D%3D")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = InstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", String.class, String.class,
|
Method method = InstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", String.class, String.class,
|
||||||
Array.newInstance(byte.class, 0).getClass());
|
Array.newInstance(byte.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", "test".getBytes());
|
HttpRequest request = processor.createRequest(method, null, "1", "test".getBytes());
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, setUserDataForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=userData&Value=dGVzdA%3D%3D&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
filter.filter(request);// ensure encoding worked properly
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&Attribute=userData&InstanceId=1&Signature=LfUmzLM5DsACR5nQcEfGF5FPdznOwwhJ7tjhBWfHtGs%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Value=dGVzdA%3D%3D&Version=2010-06-15&AWSAccessKeyId=identity",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
@ -368,16 +379,32 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setRamdiskForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "ramdisk")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "qx6NeVbihiYrKvi5Oe5LzMsGHTjS7%2BqoNhh2abt275g%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "test")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = InstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", String.class, String.class,
|
Method method = InstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, setRamdiskForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=ramdisk&Value=test&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
@ -385,16 +412,32 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setKernelForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "kernel")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "juSiuoiXJzTxj3q0LUW2528HzDyP4JAcKin%2BI4AuIT0%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "test")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = InstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", String.class, String.class,
|
Method method = InstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, setKernelForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=kernel&Value=test&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
@ -402,17 +445,31 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setApiTerminationDisabled = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "disableApiTermination")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "tiBMWWTi22BWeAjsRfuzVom0tQgsOBeYTkatMuWRrbg%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "true")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = InstanceAsyncClient.class.getMethod("setApiTerminationDisabledForInstanceInRegion", String.class,
|
Method method = InstanceAsyncClient.class.getMethod("setApiTerminationDisabledForInstanceInRegion", String.class,
|
||||||
String.class, boolean.class);
|
String.class, boolean.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", true);
|
HttpRequest request = processor.createRequest(method, null, "1", true);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, setApiTerminationDisabled.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&Attribute=disableApiTermination&Value=true&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -422,15 +479,30 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest instanceTypeForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "instanceType")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "XK%2BzQmQ0S57gXIgVRMqUkKunURN9TaCJD1YWiYMAOHo%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "c1.medium")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = InstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", String.class,
|
Method method = InstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", InstanceType.C1_MEDIUM);
|
HttpRequest request = processor.createRequest(method, null, "1", InstanceType.C1_MEDIUM);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, instanceTypeForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=instanceType&Value=c1.medium&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -440,17 +512,31 @@ public class InstanceAsyncClientTest extends BaseEC2AsyncClientTest<InstanceAsyn
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setInstanceInitiatedShutdownBehavior = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "instanceInitiatedShutdownBehavior")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "s5xBMLd%2BXNVp44x7C6qVE58qBov//f6yvxoM757KcZU%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "terminate")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
||||||
NoSuchMethodException, IOException {
|
NoSuchMethodException, IOException {
|
||||||
Method method = InstanceAsyncClient.class.getMethod("setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
Method method = InstanceAsyncClient.class.getMethod("setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||||
String.class, String.class, InstanceInitiatedShutdownBehavior.class);
|
String.class, String.class, InstanceInitiatedShutdownBehavior.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", InstanceInitiatedShutdownBehavior.TERMINATE);
|
HttpRequest request = processor.createRequest(method, null, "1", InstanceInitiatedShutdownBehavior.TERMINATE);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, setInstanceInitiatedShutdownBehavior.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&Attribute=instanceInitiatedShutdownBehavior&Value=terminate&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -58,15 +58,29 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createSecurityGroup = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "CreateSecurityGroup")
|
||||||
|
.addFormParam("GroupDescription", "description")
|
||||||
|
.addFormParam("GroupName", "name")
|
||||||
|
.addFormParam("Signature", "F3o0gnZcX9sWrtDUhVwi3k5GY2JKLP0Dhi6CcEqK2vE%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion", String.class,
|
Method method = SecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "description");
|
HttpRequest request = processor.createRequest(method, null, "name", "description");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, createSecurityGroup.getPayload().getRawContent().toString(),
|
||||||
"Action=CreateSecurityGroup&GroupDescription=description&GroupName=name",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -130,25 +144,33 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest authorizeSecurityGroupIngressCidr = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "AuthorizeSecurityGroupIngress")
|
||||||
|
.addFormParam("CidrIp", "0.0.0.0/0")
|
||||||
|
.addFormParam("FromPort", "6000")
|
||||||
|
.addFormParam("GroupName", "group")
|
||||||
|
.addFormParam("IpProtocol", "tcp")
|
||||||
|
.addFormParam("Signature", "6NQega9YUGDxdwk3Y0Hv71u/lHi%2B0D6qMCJLpJVD/aI%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("ToPort", "7000")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testAuthorizeSecurityGroupIngressCidr() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAuthorizeSecurityGroupIngressCidr() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeSecurityGroupIngressInRegion", String.class,
|
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeSecurityGroupIngressInRegion", String.class,
|
||||||
String.class, IpProtocol.class, int.class, int.class, String.class);
|
String.class, IpProtocol.class, int.class, int.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0");
|
HttpRequest request = processor.createRequest(method, null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertPayloadEquals(request, authorizeSecurityGroupIngressCidr.getPayload().getRawContent().toString(),
|
||||||
try {
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=AuthorizeSecurityGroupIngress&CidrIp=0.0.0.0/0&IpProtocol=tcp&GroupName=group&FromPort=6000&ToPort=7000",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
} catch (AssertionError e) {
|
|
||||||
// mvn 3.0 osx 10.6.5 somehow sorts differently
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=AuthorizeSecurityGroupIngress&CidrIp=0.0.0.0/0&IpProtocol=tcp&GroupName=group&ToPort=7000&FromPort=6000",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
}
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
@ -176,25 +198,34 @@ public class SecurityGroupAsyncClientTest extends BaseEC2AsyncClientTest<Securit
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest revokeSecurityGroupIngressCidr = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RevokeSecurityGroupIngress")
|
||||||
|
.addFormParam("CidrIp", "0.0.0.0/0")
|
||||||
|
.addFormParam("FromPort", "6000")
|
||||||
|
.addFormParam("GroupName", "group")
|
||||||
|
.addFormParam("IpProtocol", "tcp")
|
||||||
|
.addFormParam("Signature", "WPlDYXI8P6Ip4F2JIEP3lWrVlP/7gxbZvlshKYlrvxk%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("ToPort", "7000")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRevokeSecurityGroupIngressCidr() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRevokeSecurityGroupIngressCidr() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SecurityGroupAsyncClient.class.getMethod("revokeSecurityGroupIngressInRegion", String.class,
|
Method method = SecurityGroupAsyncClient.class.getMethod("revokeSecurityGroupIngressInRegion", String.class,
|
||||||
String.class, IpProtocol.class, int.class, int.class, String.class);
|
String.class, IpProtocol.class, int.class, int.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0");
|
HttpRequest request = processor.createRequest(method, null, "group", IpProtocol.TCP, 6000, 7000, "0.0.0.0/0");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
try {
|
assertPayloadEquals(request, revokeSecurityGroupIngressCidr.getPayload().getRawContent().toString(),
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=RevokeSecurityGroupIngress&CidrIp=0.0.0.0/0&IpProtocol=tcp&GroupName=group&FromPort=6000&ToPort=7000",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
} catch (AssertionError e) {
|
|
||||||
// mvn 3.0 osx 10.6.5 somehow sorts differently
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=RevokeSecurityGroupIngress&CidrIp=0.0.0.0/0&IpProtocol=tcp&GroupName=group&ToPort=7000&FromPort=6000",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
}
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
|
@ -38,6 +38,22 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "WindowsAsyncClientTest")
|
@Test(groups = "unit", testName = "WindowsAsyncClientTest")
|
||||||
public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncClient> {
|
public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncClient> {
|
||||||
|
|
||||||
|
HttpRequest bundleInstanceInRegion = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "BundleInstance")
|
||||||
|
.addFormParam("InstanceId", "i-e468cd8d")
|
||||||
|
.addFormParam("Signature", "Uw5gH4eN3H8KXeFfIVLDDt88ApYn8L4pkf31hpojpcM%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Storage.S3.Bucket", "my-bucket")
|
||||||
|
.addFormParam("Storage.S3.Prefix", "winami")
|
||||||
|
.addFormParam("Storage.S3.UploadPolicy", "eyJleHBpcmF0aW9uIjogIjIwMDgtMDgtMzBUMDg6NDk6MDlaIiwiY29uZGl0aW9ucyI6IFt7ImJ1Y2tldCI6ICJteS1idWNrZXQifSxbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAibXktbmV3LWltYWdlIl1dfQ%3D%3D")
|
||||||
|
.addFormParam("Storage.S3.UploadPolicySignature", "ih/iohGe0A7y4QVRbKaq6BZShzUsmBEJEa9AdFbxM6Y%3D")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testBundleInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testBundleInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = WindowsAsyncClient.class.getMethod("bundleInstanceInRegion", String.class, String.class,
|
Method method = WindowsAsyncClient.class.getMethod("bundleInstanceInRegion", String.class, String.class,
|
||||||
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class);
|
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class);
|
||||||
|
@ -49,10 +65,13 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
||||||
"winami",
|
"winami",
|
||||||
"my-bucket",
|
"my-bucket",
|
||||||
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}");
|
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
String payload = "Action=BundleInstance&Storage.S3.Prefix=winami&InstanceId=i-e468cd8d&Storage.S3.Bucket=my-bucket&Storage.S3.UploadPolicy=eyJleHBpcmF0aW9uIjogIjIwMDgtMDgtMzBUMDg6NDk6MDlaIiwiY29uZGl0aW9ucyI6IFt7ImJ1Y2tldCI6ICJteS1idWNrZXQifSxbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAibXktbmV3LWltYWdlIl1dfQ%3D%3D&Storage.S3.UploadPolicySignature=ih/iohGe0A7y4QVRbKaq6BZShzUsmBEJEa9AdFbxM6Y%3D";
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, payload, "application/x-www-form-urlencoded", false);
|
assertPayloadEquals(request, bundleInstanceInRegion.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, BundleTaskHandler.class);
|
assertSaxResponseParserClassEquals(method, BundleTaskHandler.class);
|
||||||
|
@ -61,6 +80,23 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest bundleInstanceInRegionOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "BundleInstance")
|
||||||
|
.addFormParam("InstanceId","i-e468cd8d")
|
||||||
|
.addFormParam("Signature", "ahFjX9Tv/DGMFq9EFdF1mWSAnTKyQyyIj7dWJxBOhaE%3D")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Storage.S3.AWSAccessKeyId", "10QMXFEV71ZS32XQFTR2")
|
||||||
|
.addFormParam("Storage.S3.Bucket", "my-bucket")
|
||||||
|
.addFormParam("Storage.S3.Prefix", "winami")
|
||||||
|
.addFormParam("Storage.S3.UploadPolicy", "eyJleHBpcmF0aW9uIjogIjIwMDgtMDgtMzBUMDg6NDk6MDlaIiwiY29uZGl0aW9ucyI6IFt7ImJ1Y2tldCI6ICJteS1idWNrZXQifSxbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAibXktbmV3LWltYWdlIl1dfQ%3D%3D")
|
||||||
|
.addFormParam("Storage.S3.UploadPolicySignature", "ih/iohGe0A7y4QVRbKaq6BZShzUsmBEJEa9AdFbxM6Y%3D")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2010-06-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testBundleInstanceInRegionOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testBundleInstanceInRegionOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = WindowsAsyncClient.class.getMethod("bundleInstanceInRegion", String.class, String.class,
|
Method method = WindowsAsyncClient.class.getMethod("bundleInstanceInRegion", String.class, String.class,
|
||||||
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class);
|
String.class, String.class, String.class, BundleInstanceS3StorageOptions[].class);
|
||||||
|
@ -73,10 +109,14 @@ public class WindowsAsyncClientTest extends BaseEC2AsyncClientTest<WindowsAsyncC
|
||||||
"my-bucket",
|
"my-bucket",
|
||||||
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}",
|
"{\"expiration\": \"2008-08-30T08:49:09Z\",\"conditions\": [{\"bucket\": \"my-bucket\"},[\"starts-with\", \"$key\", \"my-new-image\"]]}",
|
||||||
BundleInstanceS3StorageOptions.Builder.bucketOwnedBy("10QMXFEV71ZS32XQFTR2"));
|
BundleInstanceS3StorageOptions.Builder.bucketOwnedBy("10QMXFEV71ZS32XQFTR2"));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
String payload = "Action=BundleInstance&Storage.S3.Prefix=winami&InstanceId=i-e468cd8d&Storage.S3.Bucket=my-bucket&Storage.S3.AWSAccessKeyId=10QMXFEV71ZS32XQFTR2&Storage.S3.UploadPolicy=eyJleHBpcmF0aW9uIjogIjIwMDgtMDgtMzBUMDg6NDk6MDlaIiwiY29uZGl0aW9ucyI6IFt7ImJ1Y2tldCI6ICJteS1idWNrZXQifSxbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAibXktbmV3LWltYWdlIl1dfQ%3D%3D&Storage.S3.UploadPolicySignature=ih/iohGe0A7y4QVRbKaq6BZShzUsmBEJEa9AdFbxM6Y%3D";
|
String payload = "Action=BundleInstance&Storage.S3.Prefix=winami&InstanceId=i-e468cd8d&Storage.S3.Bucket=my-bucket&Storage.S3.AWSAccessKeyId=10QMXFEV71ZS32XQFTR2&Storage.S3.UploadPolicy=eyJleHBpcmF0aW9uIjogIjIwMDgtMDgtMzBUMDg6NDk6MDlaIiwiY29uZGl0aW9ucyI6IFt7ImJ1Y2tldCI6ICJteS1idWNrZXQifSxbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAibXktbmV3LWltYWdlIl1dfQ%3D%3D&Storage.S3.UploadPolicySignature=ih/iohGe0A7y4QVRbKaq6BZShzUsmBEJEa9AdFbxM6Y%3D";
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, payload, "application/x-www-form-urlencoded", false);
|
assertPayloadEquals(request, bundleInstanceInRegionOptions.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, BundleTaskHandler.class);
|
assertSaxResponseParserClassEquals(method, BundleTaskHandler.class);
|
||||||
|
|
|
@ -476,8 +476,7 @@ public class MessageApiExpectTest extends BaseSQSApiExpectTest {
|
||||||
.toString(), new ChangeMessageVisibilityBatchResponseTest().expected().toString());
|
.toString(), new ChangeMessageVisibilityBatchResponseTest().expected().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpRequest changeMessageVisibilityMapInt = HttpRequest.builder()
|
public HttpRequest changeMessageVisibilityMapInt = HttpRequest.builder().method("POST")
|
||||||
.method("POST")
|
|
||||||
.endpoint("https://sqs.us-east-1.amazonaws.com/993194456877/adrian-sqs11/")
|
.endpoint("https://sqs.us-east-1.amazonaws.com/993194456877/adrian-sqs11/")
|
||||||
.addHeader("Host", "sqs.us-east-1.amazonaws.com")
|
.addHeader("Host", "sqs.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "ChangeMessageVisibilityBatch")
|
.addFormParam("Action", "ChangeMessageVisibilityBatch")
|
||||||
|
@ -509,8 +508,7 @@ public class MessageApiExpectTest extends BaseSQSApiExpectTest {
|
||||||
.toString(), new ChangeMessageVisibilityBatchResponseTest().expected().toString());
|
.toString(), new ChangeMessageVisibilityBatchResponseTest().expected().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpRequest changeMessageVisibilityIterableInt = HttpRequest.builder()
|
public HttpRequest changeMessageVisibilityIterableInt = HttpRequest.builder().method("POST")
|
||||||
.method("POST")
|
|
||||||
.endpoint("https://sqs.us-east-1.amazonaws.com/993194456877/adrian-sqs11/")
|
.endpoint("https://sqs.us-east-1.amazonaws.com/993194456877/adrian-sqs11/")
|
||||||
.addHeader("Host", "sqs.us-east-1.amazonaws.com")
|
.addHeader("Host", "sqs.us-east-1.amazonaws.com")
|
||||||
.addFormParam("Action", "ChangeMessageVisibilityBatch")
|
.addFormParam("Action", "ChangeMessageVisibilityBatch")
|
||||||
|
|
|
@ -35,7 +35,7 @@ import static com.google.common.collect.Iterables.transform;
|
||||||
import static com.google.common.collect.Lists.newArrayList;
|
import static com.google.common.collect.Lists.newArrayList;
|
||||||
import static com.google.common.collect.Lists.newLinkedList;
|
import static com.google.common.collect.Lists.newLinkedList;
|
||||||
import static com.google.common.collect.Maps.filterValues;
|
import static com.google.common.collect.Maps.filterValues;
|
||||||
import static com.google.common.collect.Maps.newHashMap;
|
import static com.google.common.collect.Maps.newLinkedHashMap;
|
||||||
import static com.google.common.collect.Multimaps.filterKeys;
|
import static com.google.common.collect.Multimaps.filterKeys;
|
||||||
import static com.google.common.collect.Multimaps.transformValues;
|
import static com.google.common.collect.Multimaps.transformValues;
|
||||||
import static com.google.common.collect.Sets.newTreeSet;
|
import static com.google.common.collect.Sets.newTreeSet;
|
||||||
|
@ -155,6 +155,7 @@ import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.ImmutableSet.Builder;
|
import com.google.common.collect.ImmutableSet.Builder;
|
||||||
|
import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.google.common.collect.LinkedHashMultimap;
|
import com.google.common.collect.LinkedHashMultimap;
|
||||||
import com.google.common.collect.LinkedListMultimap;
|
import com.google.common.collect.LinkedListMultimap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
@ -692,7 +693,7 @@ public abstract class RestAnnotationProcessor {
|
||||||
public static URI getEndpointInParametersOrNull(Method method, final Object[] args, Injector injector) {
|
public static URI getEndpointInParametersOrNull(Method method, final Object[] args, Injector injector) {
|
||||||
Map<Integer, Set<Annotation>> map = indexWithAtLeastOneAnnotation(method,
|
Map<Integer, Set<Annotation>> map = indexWithAtLeastOneAnnotation(method,
|
||||||
methodToIndexOfParamToEndpointParamAnnotations);
|
methodToIndexOfParamToEndpointParamAnnotations);
|
||||||
if (map.size() >= 1 && args.length > 0) {
|
if (map.size() >= 1 && args != null && args.length > 0) {
|
||||||
EndpointParam firstAnnotation = (EndpointParam) get(get(map.values(), 0), 0);
|
EndpointParam firstAnnotation = (EndpointParam) get(get(map.values(), 0), 0);
|
||||||
Function<Object, URI> parser = injector.getInstance(firstAnnotation.parser());
|
Function<Object, URI> parser = injector.getInstance(firstAnnotation.parser());
|
||||||
|
|
||||||
|
@ -927,10 +928,10 @@ public abstract class RestAnnotationProcessor {
|
||||||
|
|
||||||
public GeneratedHttpRequest decorateRequest(GeneratedHttpRequest request) throws NegativeArraySizeException {
|
public GeneratedHttpRequest decorateRequest(GeneratedHttpRequest request) throws NegativeArraySizeException {
|
||||||
Iterable<Entry<Integer, Set<Annotation>>> binderOrWrapWith = concat(
|
Iterable<Entry<Integer, Set<Annotation>>> binderOrWrapWith = concat(
|
||||||
filterValues(methodToIndexOfParamToBinderParamAnnotation.getUnchecked(request.getJavaMethod()).asMap(),
|
ImmutableSortedMap.copyOf(filterValues(methodToIndexOfParamToBinderParamAnnotation.getUnchecked(request.getJavaMethod()).asMap(),
|
||||||
notEmpty).entrySet(),
|
notEmpty)).entrySet(),
|
||||||
filterValues(methodToIndexOfParamToWrapWithAnnotation.getUnchecked(request.getJavaMethod()).asMap(),
|
ImmutableSortedMap.copyOf(filterValues(methodToIndexOfParamToWrapWithAnnotation.getUnchecked(request.getJavaMethod()).asMap(),
|
||||||
notEmpty).entrySet());
|
notEmpty)).entrySet());
|
||||||
OUTER: for (Entry<Integer, Set<Annotation>> entry : binderOrWrapWith) {
|
OUTER: for (Entry<Integer, Set<Annotation>> entry : binderOrWrapWith) {
|
||||||
boolean shouldBreak = false;
|
boolean shouldBreak = false;
|
||||||
Annotation annotation = get(entry.getValue(), 0);
|
Annotation annotation = get(entry.getValue(), 0);
|
||||||
|
@ -1009,7 +1010,7 @@ public abstract class RestAnnotationProcessor {
|
||||||
return input.size() == 1;
|
return input.size() == 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return indexToPayloadAnnotation;
|
return ImmutableSortedMap.copyOf(indexToPayloadAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: change to LoadingCache<ClassMethodArgs, HttpRequestOptions and move this logic to the CacheLoader.
|
//TODO: change to LoadingCache<ClassMethodArgs, HttpRequestOptions and move this logic to the CacheLoader.
|
||||||
|
@ -1040,7 +1041,7 @@ public abstract class RestAnnotationProcessor {
|
||||||
addHeaderIfAnnotationPresentOnMethod(headers, method, tokenValues);
|
addHeaderIfAnnotationPresentOnMethod(headers, method, tokenValues);
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToHeaderParam = methodToIndexOfParamToHeaderParamAnnotations
|
LoadingCache<Integer, Set<Annotation>> indexToHeaderParam = methodToIndexOfParamToHeaderParamAnnotations
|
||||||
.getUnchecked(method);
|
.getUnchecked(method);
|
||||||
for (Entry<Integer, Set<Annotation>> entry : indexToHeaderParam.asMap().entrySet()) {
|
for (Entry<Integer, Set<Annotation>> entry : ImmutableSortedMap.copyOf(indexToHeaderParam.asMap()).entrySet()) {
|
||||||
for (Annotation key : entry.getValue()) {
|
for (Annotation key : entry.getValue()) {
|
||||||
String value = args[entry.getKey()].toString();
|
String value = args[entry.getKey()].toString();
|
||||||
value = replaceTokens(value, tokenValues);
|
value = replaceTokens(value, tokenValues);
|
||||||
|
@ -1106,7 +1107,7 @@ public abstract class RestAnnotationProcessor {
|
||||||
ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
|
ImmutableList.Builder<Part> parts = ImmutableList.<Part> builder();
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToPartParam = methodToIndexOfParamToPartParamAnnotations
|
LoadingCache<Integer, Set<Annotation>> indexToPartParam = methodToIndexOfParamToPartParamAnnotations
|
||||||
.getUnchecked(method);
|
.getUnchecked(method);
|
||||||
for (Entry<Integer, Set<Annotation>> entry : indexToPartParam.asMap().entrySet()) {
|
for (Entry<Integer, Set<Annotation>> entry : ImmutableSortedMap.copyOf(indexToPartParam.asMap()).entrySet()) {
|
||||||
for (Annotation key : entry.getValue()) {
|
for (Annotation key : entry.getValue()) {
|
||||||
PartParam param = (PartParam) key;
|
PartParam param = (PartParam) key;
|
||||||
PartOptions options = new PartOptions();
|
PartOptions options = new PartOptions();
|
||||||
|
@ -1149,7 +1150,7 @@ public abstract class RestAnnotationProcessor {
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToPathParam = methodToIndexOfParamToPathParamAnnotations.getUnchecked(method);
|
LoadingCache<Integer, Set<Annotation>> indexToPathParam = methodToIndexOfParamToPathParamAnnotations.getUnchecked(method);
|
||||||
|
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations.getUnchecked(method);
|
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations.getUnchecked(method);
|
||||||
for (Entry<Integer, Set<Annotation>> entry : indexToPathParam.asMap().entrySet()) {
|
for (Entry<Integer, Set<Annotation>> entry : ImmutableSortedMap.copyOf(indexToPathParam.asMap()).entrySet()) {
|
||||||
for (Annotation key : entry.getValue()) {
|
for (Annotation key : entry.getValue()) {
|
||||||
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
||||||
String paramKey = ((PathParam) key).value();
|
String paramKey = ((PathParam) key).value();
|
||||||
|
@ -1209,7 +1210,7 @@ public abstract class RestAnnotationProcessor {
|
||||||
|
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations
|
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations
|
||||||
.getUnchecked(method);
|
.getUnchecked(method);
|
||||||
for (Entry<Integer, Set<Annotation>> entry : indexToFormParam.asMap().entrySet()) {
|
for (Entry<Integer, Set<Annotation>> entry : ImmutableSortedMap.copyOf(indexToFormParam.asMap()).entrySet()) {
|
||||||
for (Annotation key : entry.getValue()) {
|
for (Annotation key : entry.getValue()) {
|
||||||
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
||||||
String paramKey = ((FormParam) key).value();
|
String paramKey = ((FormParam) key).value();
|
||||||
|
@ -1235,7 +1236,7 @@ public abstract class RestAnnotationProcessor {
|
||||||
|
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations
|
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations
|
||||||
.getUnchecked(method);
|
.getUnchecked(method);
|
||||||
for (Entry<Integer, Set<Annotation>> entry : indexToQueryParam.asMap().entrySet()) {
|
for (Entry<Integer, Set<Annotation>> entry : ImmutableSortedMap.copyOf(indexToQueryParam.asMap()).entrySet()) {
|
||||||
for (Annotation key : entry.getValue()) {
|
for (Annotation key : entry.getValue()) {
|
||||||
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
||||||
String paramKey = ((QueryParam) key).value();
|
String paramKey = ((QueryParam) key).value();
|
||||||
|
@ -1262,10 +1263,10 @@ public abstract class RestAnnotationProcessor {
|
||||||
//TODO: change to LoadingCache<ClassMethodArgs, Map<String,Object> and move this logic to the CacheLoader.
|
//TODO: change to LoadingCache<ClassMethodArgs, Map<String,Object> and move this logic to the CacheLoader.
|
||||||
//take care to manage size of this cache
|
//take care to manage size of this cache
|
||||||
private Map<String, Object> buildPostParams(Method method, Object... args) {
|
private Map<String, Object> buildPostParams(Method method, Object... args) {
|
||||||
Map<String, Object> postParams = newHashMap();
|
Map<String, Object> postParams = newLinkedHashMap();
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToPathParam = methodToIndexOfParamToPostParamAnnotations.getUnchecked(method);
|
LoadingCache<Integer, Set<Annotation>> indexToPathParam = methodToIndexOfParamToPostParamAnnotations.getUnchecked(method);
|
||||||
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations.getUnchecked(method);
|
LoadingCache<Integer, Set<Annotation>> indexToParamExtractor = methodToIndexOfParamToParamParserAnnotations.getUnchecked(method);
|
||||||
for (Entry<Integer, Set<Annotation>> entry : indexToPathParam.asMap().entrySet()) {
|
for (Entry<Integer, Set<Annotation>> entry : ImmutableSortedMap.copyOf(indexToPathParam.asMap()).entrySet()) {
|
||||||
for (Annotation key : entry.getValue()) {
|
for (Annotation key : entry.getValue()) {
|
||||||
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
Set<Annotation> extractors = indexToParamExtractor.getUnchecked(entry.getKey());
|
||||||
String paramKey = ((PayloadParam) key).value();
|
String paramKey = ((PayloadParam) key).value();
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
InfrastructureResources.datacenterPut(), EnterpriseResources.enterprisePut());
|
InfrastructureResources.datacenterPut(), EnterpriseResources.enterprisePut());
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters?enterprise=1&datacenter=1 HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters?datacenter=1&enterprise=1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, withHeader(CloudResources.virtualDatacenterPostPayload()),
|
assertPayloadEquals(request, withHeader(CloudResources.virtualDatacenterPostPayload()),
|
||||||
VirtualDatacenterDto.class, VirtualDatacenterDto.BASE_MEDIA_TYPE, false);
|
VirtualDatacenterDto.class, VirtualDatacenterDto.BASE_MEDIA_TYPE, false);
|
||||||
|
|
|
@ -484,7 +484,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/associate?bladeDn=blade&org=org-root/org-Finance&lsName=server HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/associate?bladeDn=blade&lsName=server&org=org-root/org-Finance HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/associatetemplate?newName=newname&bladeDn=blade&org=org-root/org-Finance&lsName=server HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/associatetemplate?newName=newname&bladeDn=blade&lsName=server&org=org-root/org-Finance HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/assocclone?newName=newname&bladeDn=blade&org=org-root/org-Finance&lsName=server HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/assocclone?newName=newname&bladeDn=blade&lsName=server&org=org-root/org-Finance HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/clone?newName=name&org=org-root/org-Finance&lsName=server HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/clone?newName=name&lsName=server&org=org-root/org-Finance HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -714,7 +714,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass");
|
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass");
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle";
|
||||||
String query = "hypervisor=XENSERVER&ip=10.60.1.222&user=user&password=pass";
|
String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -735,7 +735,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().port(8889).build());
|
"80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().port(8889).build());
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle";
|
||||||
String query = "hypervisor=KVM&ip=80.80.80.80&user=user&password=pass&port=8889";
|
String query = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass&port=8889";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -756,7 +756,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().build());
|
"80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().build());
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle";
|
||||||
String query = "hypervisor=KVM&ip=80.80.80.80&user=user&password=pass";
|
String query = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -778,7 +778,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"10.60.1.222", "10.60.1.250", HypervisorType.XENSERVER, "user", "pass");
|
"10.60.1.222", "10.60.1.250", HypervisorType.XENSERVER, "user", "pass");
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discovermultiple";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discovermultiple";
|
||||||
String query = "password=pass&ipTo=10.60.1.250&ipFrom=10.60.1.222&hypervisor=XENSERVER&user=user";
|
String query = "ipFrom=10.60.1.222&ipTo=10.60.1.250&hypervisor=XENSERVER&user=user&password=pass";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -800,7 +800,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discovermultiple";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discovermultiple";
|
||||||
String query = "password=pass&ipTo=80.80.80.86&ipFrom=80.80.80.80&hypervisor=KVM&user=user&port=8889";
|
String query = "ipFrom=80.80.80.80&ipTo=80.80.80.86&hypervisor=KVM&user=user&password=pass&port=8889";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -821,7 +821,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass");
|
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass");
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachinestate";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachinestate";
|
||||||
String query = "hypervisor=XENSERVER&ip=10.60.1.222&user=user&password=pass";
|
String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -842,7 +842,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass", MachineOptions.builder().port(8889).build());
|
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass", MachineOptions.builder().port(8889).build());
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachinestate";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachinestate";
|
||||||
String query = "hypervisor=XENSERVER&ip=10.60.1.222&user=user&password=pass&port=8889";
|
String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass&port=8889";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -863,7 +863,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"10.60.1.222", "user", "pass");
|
"10.60.1.222", "user", "pass");
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachineipmistate";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachineipmistate";
|
||||||
String query = "user=user&ip=10.60.1.222&password=pass";
|
String query = "ip=10.60.1.222&user=user&password=pass";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
@ -884,7 +884,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
"10.60.1.222", "user", "pass", IpmiOptions.builder().port(8889).build());
|
"10.60.1.222", "user", "pass", IpmiOptions.builder().port(8889).build());
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachineipmistate";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachineipmistate";
|
||||||
String query = "user=user&ip=10.60.1.222&password=pass&port=8889";
|
String query = "ip=10.60.1.222&user=user&password=pass&port=8889";
|
||||||
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
String expectedRequest = String.format("GET %s?%s HTTP/1.1", baseUrl, query);
|
||||||
|
|
||||||
assertRequestLineEquals(request, expectedRequest);
|
assertRequestLineEquals(request, expectedRequest);
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class AdditionalDiskApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=UpdateVDiskAttribute"
|
HttpRequest request = buildGETWithQuery("Action=UpdateVDiskAttribute"
|
||||||
+ "&vdiskId=CONTRACT-VSYS00001-D-0001"
|
+ "&vdiskId=CONTRACT-VSYS00001-D-0001"
|
||||||
+ "&attributeValue=new-name" + "&attributeName=updateName"
|
+ "&attributeName=updateName" + "&attributeValue=new-name"
|
||||||
+ "&vsysId=CONTRACT-VSYS00001");
|
+ "&vsysId=CONTRACT-VSYS00001");
|
||||||
HttpResponse response = HttpResponse
|
HttpResponse response = HttpResponse
|
||||||
.builder()
|
.builder()
|
||||||
|
|
|
@ -134,8 +134,8 @@ public class BuiltinServerApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=UpdateEFMAttribute"
|
HttpRequest request = buildGETWithQuery("Action=UpdateEFMAttribute"
|
||||||
+ "&efmId=CONTRACT-VSYS00001-S-0001"
|
+ "&efmId=CONTRACT-VSYS00001-S-0001"
|
||||||
+ "&attributeValue=new%20name"
|
|
||||||
+ "&attributeName=vserverName"
|
+ "&attributeName=vserverName"
|
||||||
|
+ "&attributeValue=new%20name"
|
||||||
+ "&vsysId=CONTRACT-VSYS00001");
|
+ "&vsysId=CONTRACT-VSYS00001");
|
||||||
HttpResponse response = HttpResponse
|
HttpResponse response = HttpResponse
|
||||||
.builder()
|
.builder()
|
||||||
|
|
|
@ -50,8 +50,8 @@ public class DiskImageApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=UpdateDiskImageAttribute"
|
HttpRequest request = buildGETWithQuery("Action=UpdateDiskImageAttribute"
|
||||||
+ "&diskImageId=IMG_A1B2C3_1234567890ABCD"
|
+ "&diskImageId=IMG_A1B2C3_1234567890ABCD"
|
||||||
+ "&attributeName=updateName"
|
|
||||||
+ "&updateLcId=en"
|
+ "&updateLcId=en"
|
||||||
|
+ "&attributeName=updateName"
|
||||||
+ "&attributeValue=new-name");
|
+ "&attributeValue=new-name");
|
||||||
HttpResponse response = HttpResponse.builder().statusCode(200)
|
HttpResponse response = HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResource("/UpdateDiskImageAttribute-response.xml"))
|
.payload(payloadFromResource("/UpdateDiskImageAttribute-response.xml"))
|
||||||
|
|
|
@ -51,8 +51,8 @@ public class SystemTemplateApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
|
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=UpdateVSYSDescriptorAttribute"
|
HttpRequest request = buildGETWithQuery("Action=UpdateVSYSDescriptorAttribute"
|
||||||
+ "&vsysDescriptorId=3-tier%20Skeleton" + "&attributeName=updateName"
|
+ "&vsysDescriptorId=3-tier%20Skeleton"
|
||||||
+ "&updateLcId=en"
|
+ "&updateLcId=en" + "&attributeName=updateName"
|
||||||
+ "&attributeValue=new-name");
|
+ "&attributeValue=new-name");
|
||||||
HttpResponse response = HttpResponse
|
HttpResponse response = HttpResponse
|
||||||
.builder()
|
.builder()
|
||||||
|
|
|
@ -168,8 +168,8 @@ public class VirtualServerApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=UpdateVServerAttribute"
|
HttpRequest request = buildGETWithQuery("Action=UpdateVServerAttribute"
|
||||||
+ "&vserverId=CONTRACT-VSYS00001-S-0005"
|
+ "&vserverId=CONTRACT-VSYS00001-S-0005"
|
||||||
+ "&attributeValue=new%20name"
|
|
||||||
+ "&attributeName=vserverName"
|
+ "&attributeName=vserverName"
|
||||||
|
+ "&attributeValue=new%20name"
|
||||||
+ "&vsysId=CONTRACT-VSYS00001");
|
+ "&vsysId=CONTRACT-VSYS00001");
|
||||||
HttpResponse response = HttpResponse
|
HttpResponse response = HttpResponse
|
||||||
.builder()
|
.builder()
|
||||||
|
|
|
@ -20,7 +20,6 @@ package org.jclouds.fujitsu.fgcp.services;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -84,8 +83,8 @@ public class VirtualSystemApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
|
|
||||||
public void testUpdate() {
|
public void testUpdate() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=UpdateVSYSAttribute"
|
HttpRequest request = buildGETWithQuery("Action=UpdateVSYSAttribute"
|
||||||
+ "&vsysId=ABCDEFGH-A123B456CE" + "&attributeValue=new-name"
|
+ "&vsysId=ABCDEFGH-A123B456CE"
|
||||||
+ "&attributeName=updateName");
|
+ "&attributeName=updateName" + "&attributeValue=new-name");
|
||||||
HttpResponse response = HttpResponse
|
HttpResponse response = HttpResponse
|
||||||
.builder()
|
.builder()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
|
@ -205,8 +204,8 @@ public class VirtualSystemApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
public void testCreateServer() {
|
public void testCreateServer() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=CreateVServer"
|
HttpRequest request = buildGETWithQuery("Action=CreateVServer"
|
||||||
+ "&vserverName=vm1"
|
+ "&vserverName=vm1"
|
||||||
+ "&diskImageId=IMG_A1B2C3_1234567890ABCD"
|
|
||||||
+ "&vserverType=economy"
|
+ "&vserverType=economy"
|
||||||
|
+ "&diskImageId=IMG_A1B2C3_1234567890ABCD"
|
||||||
+ "&networkId=ABCDEFGH-A123B456CE-N-DMZ"
|
+ "&networkId=ABCDEFGH-A123B456CE-N-DMZ"
|
||||||
+ "&vsysId=ABCDEFGH-A123B456CE");
|
+ "&vsysId=ABCDEFGH-A123B456CE");
|
||||||
HttpResponse response = HttpResponse
|
HttpResponse response = HttpResponse
|
||||||
|
@ -225,9 +224,8 @@ public class VirtualSystemApiExpectTest extends BaseFGCPRestApiExpectTest {
|
||||||
|
|
||||||
public void testCreateDisk() {
|
public void testCreateDisk() {
|
||||||
HttpRequest request = buildGETWithQuery("Action=CreateVDisk"
|
HttpRequest request = buildGETWithQuery("Action=CreateVDisk"
|
||||||
+ "&vsysId=ABCDEFGH-A123B456CE"
|
+ "&vsysId=ABCDEFGH-A123B456CE" + "&vdiskName=disk1"
|
||||||
+ "&size=10"
|
+ "&size=10");
|
||||||
+ "&vdiskName=disk1");
|
|
||||||
HttpResponse response = HttpResponse
|
HttpResponse response = HttpResponse
|
||||||
.builder()
|
.builder()
|
||||||
.statusCode(200)
|
.statusCode(200)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.aws.ec2.services;
|
package org.jclouds.aws.ec2.services;
|
||||||
|
|
||||||
import static org.jclouds.aws.ec2.options.AWSDescribeImagesOptions.Builder.filters;
|
import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.executableBy;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
|
@ -40,7 +40,6 @@ import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code AWSAMIAsyncClient}
|
* Tests behavior of {@code AWSAMIAsyncClient}
|
||||||
|
@ -54,14 +53,29 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
provider = "aws-ec2";
|
provider = "aws-ec2";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "CreateImage")
|
||||||
|
.addFormParam("InstanceId", "instanceId")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("Signature", "ISQJKjDmhy9Vyc5zKYfkSk%2B2zIu%2Bfm6nc4H0a4mvmcU=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||||
String.class, Array.newInstance(CreateImageOptions.class, 0).getClass());
|
Array.newInstance(CreateImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "instanceId");
|
HttpRequest request = processor.createRequest(method, null, "name", "instanceId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=CreateImage&InstanceId=instanceId&Name=name",
|
assertPayloadEquals(request, createImage.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -70,17 +84,32 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createImageOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "CreateImage")
|
||||||
|
.addFormParam("Description", "description")
|
||||||
|
.addFormParam("InstanceId", "instanceId")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("NoReboot", "true")
|
||||||
|
.addFormParam("Signature", "nEpcd4m4UGl7OUm3sIlknV98HzHRUg4WYd/doIJ9S84=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateImageOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("createImageInRegion", String.class, String.class, String.class,
|
||||||
String.class, Array.newInstance(CreateImageOptions.class, 0).getClass());
|
Array.newInstance(CreateImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "instanceId", new CreateImageOptions()
|
HttpRequest request = processor.createRequest(method, null, "name", "instanceId", new CreateImageOptions()
|
||||||
.withDescription("description").noReboot());
|
.withDescription("description").noReboot());
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, createImageOptions.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=CreateImage&InstanceId=instanceId&Name=name&Description=description&NoReboot=true",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -90,36 +119,27 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest describeImages = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImages")
|
||||||
|
.addFormParam("Signature", "tMg44xaebrZMOYS6EOf2RvvrOEJMacSlNAJaQruj100=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDescribeImages() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array.newInstance(
|
||||||
Array.newInstance(DescribeImagesOptions.class, 0).getClass());
|
DescribeImagesOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, (String) null);
|
HttpRequest request = processor.createRequest(method, (String) null);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
request = request.getFilters().get(0).filter(request);
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(request, "Action=DescribeImages", "application/x-www-form-urlencoded",
|
|
||||||
false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, DescribeImagesResponseHandler.class);
|
|
||||||
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("describeImagesInRegion", String.class,
|
|
||||||
DescribeImagesOptions[].class);
|
|
||||||
|
|
||||||
HttpRequest request = processor.createRequest(method, null, filters(
|
|
||||||
ImmutableMap.of("state", "available", "image-type", "machine")).executableBy("me").ownedBy("fred",
|
|
||||||
"nancy").imageIds("1", "2"));
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, describeImages.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=DescribeImages&Filter.1.Name=state&Filter.1.Value.1=available&Filter.2.Name=image-type&Filter.2.Value.1=machine&ExecutableBy=me&Owner.1=fred&Owner.2=nancy&ImageId.1=1&ImageId.2=2",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -129,13 +149,63 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest describeImagesOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImages")
|
||||||
|
.addFormParam("ExecutableBy", "me")
|
||||||
|
.addFormParam("ImageId.1", "1")
|
||||||
|
.addFormParam("ImageId.2", "2")
|
||||||
|
.addFormParam("Owner.1", "fred")
|
||||||
|
.addFormParam("Owner.2", "nancy")
|
||||||
|
.addFormParam("Signature", "WeMm/2znlzxYhwQqbcLr74qXreoQ60WI76T6NKZ071Q=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
|
public void testDescribeImagesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = AWSAMIAsyncClient.class.getMethod("describeImagesInRegion", String.class, Array.newInstance(
|
||||||
|
DescribeImagesOptions.class, 0).getClass());
|
||||||
|
HttpRequest request = processor.createRequest(method, null, executableBy("me").ownedBy("fred", "nancy").imageIds(
|
||||||
|
"1", "2"));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
|
assertPayloadEquals(request, describeImagesOptions.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, DescribeImagesResponseHandler.class);
|
||||||
|
assertFallbackClassEquals(method, EmptySetOnNotFoundOr404.class);
|
||||||
|
|
||||||
|
checkFilters(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest deregisterImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DeregisterImage")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "89plCGzc15vXmjO38/B430Pwz5/Zv6%2BxLwIQivUJIQ8=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeregisterImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class);
|
Method method = AWSAMIAsyncClient.class.getMethod("deregisterImageInRegion", String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=DeregisterImage&ImageId=imageId",
|
assertPayloadEquals(request, deregisterImage.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -145,14 +215,29 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageFromManifest = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("ImageLocation", "pathToManifest")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("Signature", "XnUpMvw7tz6PEngDmt%2Bx2XKFFfV1HWg54rxv5DrudrQ=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifest() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||||
String.class, String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest");
|
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=RegisterImage&ImageLocation=pathToManifest&Name=name",
|
assertPayloadEquals(request, registerImageFromManifest.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -161,16 +246,31 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageFromManifestOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("Description", "description")
|
||||||
|
.addFormParam("ImageLocation", "pathToManifest")
|
||||||
|
.addFormParam("Name", "name")
|
||||||
|
.addFormParam("Signature", "/nJBP27hFsDual7ZRIK8fQsWiNNA8hWaVY7AFIuismE=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageFromManifestOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("registerImageFromManifestInRegion", String.class, String.class,
|
||||||
String.class, String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
String.class, Array.newInstance(RegisterImageOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest",
|
HttpRequest request = processor.createRequest(method, null, "name", "pathToManifest", new RegisterImageOptions()
|
||||||
new RegisterImageOptions().withDescription("description"));
|
.withDescription("description"));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, registerImageFromManifestOptions.getPayload().getRawContent().toString(),
|
||||||
"Action=RegisterImage&ImageLocation=pathToManifest&Name=name&Description=description",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -180,16 +280,31 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageBackedByEBS = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.DeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.Ebs.SnapshotId", "snapshotId")
|
||||||
|
.addFormParam("Name", "imageName")
|
||||||
|
.addFormParam("RootDeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("Signature", "Pj242OpjbY4NXvaVYzQdjTud4N68NIxQP0oRZtdjd%2BY=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBS() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageName", "snapshotId");
|
HttpRequest request = processor.createRequest(method, null, "imageName", "snapshotId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, registerImageBackedByEBS.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=RegisterImage&RootDeviceName=/dev/sda1&BlockDeviceMapping.0.DeviceName=/dev/sda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
assertSaxResponseParserClassEquals(method, ImageIdHandler.class);
|
||||||
|
@ -198,23 +313,41 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest registerImageBackedByEBSOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RegisterImage")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.DeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("BlockDeviceMapping.0.Ebs.SnapshotId", "snapshotId")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.DeviceName", "/dev/device")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false")
|
||||||
|
.addFormParam("BlockDeviceMapping.1.Ebs.SnapshotId", "snapshot")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.DeviceName", "/dev/newdevice")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.Ebs.DeleteOnTermination", "false")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.Ebs.VolumeSize", "100")
|
||||||
|
.addFormParam("BlockDeviceMapping.2.VirtualName", "newblock")
|
||||||
|
.addFormParam("Description", "description")
|
||||||
|
.addFormParam("Name", "imageName")
|
||||||
|
.addFormParam("RootDeviceName", "/dev/sda1")
|
||||||
|
.addFormParam("Signature", "QGwHRDis98NSU2KU9W52srltVyAQrDtj3MQ5YlzNX3I=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRegisterImageBackedByEBSOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("registerUnixImageBackedByEbsInRegion", String.class,
|
||||||
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
String.class, String.class, Array.newInstance(RegisterImageBackedByEbsOptions.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(
|
HttpRequest request = processor.createRequest(method, null, "imageName", "snapshotId",
|
||||||
method,
|
new RegisterImageBackedByEbsOptions().withDescription("description").addBlockDeviceFromSnapshot(
|
||||||
null,
|
"/dev/device", null, "snapshot").addNewBlockDevice("/dev/newdevice", "newblock", 100));
|
||||||
"imageName",
|
|
||||||
"snapshotId",
|
request = request.getFilters().get(0).filter(request);
|
||||||
new RegisterImageBackedByEbsOptions().withDescription("description")
|
|
||||||
.addBlockDeviceFromSnapshot("/dev/device", null, "snapshot")
|
|
||||||
.addNewBlockDevice("/dev/newdevice", "newblock", 100));
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, registerImageBackedByEBSOptions.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=RegisterImage&RootDeviceName=/dev/sda1&BlockDeviceMapping.0.DeviceName=/dev/sda1&BlockDeviceMapping.0.Ebs.SnapshotId=snapshotId&Name=imageName&Description=description&BlockDeviceMapping.1.Ebs.DeleteOnTermination=false&BlockDeviceMapping.1.DeviceName=/dev/device&BlockDeviceMapping.1.Ebs.SnapshotId=snapshot&BlockDeviceMapping.2.Ebs.DeleteOnTermination=false&BlockDeviceMapping.2.DeviceName=/dev/newdevice&BlockDeviceMapping.2.VirtualName=newblock&BlockDeviceMapping.2.Ebs.VolumeSize=100",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -224,6 +357,173 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest getBlockDeviceMappingsForImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImageAttribute")
|
||||||
|
.addFormParam("Attribute", "blockDeviceMapping")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "aJjRBDJvQ91Zw33%2BLqyhDsfQdWxF2xdN3KlV90pGCb0=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
|
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = AWSAMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", String.class,
|
||||||
|
String.class);
|
||||||
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
|
assertPayloadEquals(request, getBlockDeviceMappingsForImage.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, BlockDeviceMappingHandler.class);
|
||||||
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
||||||
|
checkFilters(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest getLaunchPermissionForImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "DescribeImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "qVRsCNECPCvnU340sv7yLVCDzRYIMGCyAypl4ioWKVU=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
|
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = AWSAMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", String.class, String.class);
|
||||||
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
|
assertPayloadEquals(request, getLaunchPermissionForImage.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, PermissionHandler.class);
|
||||||
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
||||||
|
checkFilters(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest addLaunchPermission = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("OperationType", "add")
|
||||||
|
.addFormParam("Signature", "CpCCffn%2BuR5LjbI/iCTl7%2BsrPxbrYEYvVZue%2BmWgRgE=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("UserGroup.1", "all")
|
||||||
|
.addFormParam("UserId.1", "bob")
|
||||||
|
.addFormParam("UserId.2", "sue")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
|
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = AWSAMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", String.class,
|
||||||
|
Iterable.class, Iterable.class, String.class);
|
||||||
|
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
|
.of("all"), "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
|
assertPayloadEquals(request, addLaunchPermission.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
||||||
|
checkFilters(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest removeLaunchPermission = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("OperationType", "remove")
|
||||||
|
.addFormParam("Signature", "ScuPcaRhVy/Je%2BXUGIo1mB4IUevDBW/0tAod4FHQQS8=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("UserGroup.1", "all")
|
||||||
|
.addFormParam("UserId.1", "bob")
|
||||||
|
.addFormParam("UserId.2", "sue")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
|
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = AWSAMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", String.class,
|
||||||
|
Iterable.class, Iterable.class, String.class);
|
||||||
|
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"), ImmutableList
|
||||||
|
.of("all"), "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
|
assertPayloadEquals(request, removeLaunchPermission.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
||||||
|
checkFilters(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest resetLaunchPermissionsOnImage = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ResetImageAttribute")
|
||||||
|
.addFormParam("Attribute", "launchPermission")
|
||||||
|
.addFormParam("ImageId", "imageId")
|
||||||
|
.addFormParam("Signature", "l9F9IalCsYbGGf8O/35lLhttJ4vLLgoZZHUpmCCH9tI=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
|
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
Method method = AWSAMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", String.class,
|
||||||
|
String.class);
|
||||||
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
|
assertPayloadEquals(request, resetLaunchPermissionsOnImage.getPayload().getRawContent().toString(),
|
||||||
|
"application/x-www-form-urlencoded", false);
|
||||||
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
||||||
|
checkFilters(request);
|
||||||
|
}
|
||||||
|
|
||||||
public void testGetProductCodesForImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetProductCodesForImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("getProductCodesForImageInRegion", String.class, String.class);
|
Method method = AWSAMIAsyncClient.class.getMethod("getProductCodesForImageInRegion", String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
HttpRequest request = processor.createRequest(method, null, "imageId");
|
||||||
|
@ -241,98 +541,6 @@ public class AWSAMIAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSAMIAsync
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetBlockDeviceMappingsForImage() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("getBlockDeviceMappingsForImageInRegion", String.class,
|
|
||||||
String.class);
|
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(request,
|
|
||||||
"Action=DescribeImageAttribute&Attribute=blockDeviceMapping&ImageId=imageId",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, BlockDeviceMappingHandler.class);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testGetLaunchPermissionForImage() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("getLaunchPermissionForImageInRegion", String.class,
|
|
||||||
String.class);
|
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(request,
|
|
||||||
"Action=DescribeImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, PermissionHandler.class);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAddLaunchPermissionsToImage() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("addLaunchPermissionsToImageInRegion", String.class,
|
|
||||||
Iterable.class, Iterable.class, String.class);
|
|
||||||
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"),
|
|
||||||
ImmutableList.of("all"), "imageId");
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=ModifyImageAttribute&OperationType=add&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testRemoveLaunchPermissionsFromImage() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("removeLaunchPermissionsFromImageInRegion", String.class,
|
|
||||||
Iterable.class, Iterable.class, String.class);
|
|
||||||
HttpRequest request = processor.createRequest(method, null, ImmutableList.of("bob", "sue"),
|
|
||||||
ImmutableList.of("all"), "imageId");
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=ModifyImageAttribute&OperationType=remove&Attribute=launchPermission&ImageId=imageId&UserGroup.1=all&UserId.1=bob&UserId.2=sue",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testResetLaunchPermissionsOnImage() throws SecurityException, NoSuchMethodException, IOException {
|
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("resetLaunchPermissionsOnImageInRegion", String.class,
|
|
||||||
String.class);
|
|
||||||
HttpRequest request = processor.createRequest(method, null, "imageId");
|
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
|
||||||
assertPayloadEquals(request,
|
|
||||||
"Action=ResetImageAttribute&Attribute=launchPermission&ImageId=imageId",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
|
||||||
assertFallbackClassEquals(method, null);
|
|
||||||
|
|
||||||
checkFilters(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testAddProductCodesToImage() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAddProductCodesToImage() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSAMIAsyncClient.class.getMethod("addProductCodesToImageInRegion", String.class, Iterable.class,
|
Method method = AWSAMIAsyncClient.class.getMethod("addProductCodesToImageInRegion", String.class, Iterable.class,
|
||||||
String.class);
|
String.class);
|
||||||
|
|
|
@ -357,21 +357,32 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setUserDataForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "userData")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "nArJlrtyAfgqDnXxv%2B2y0r9O%2BIfUcitpQMjfQR0oeRM=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "dGVzdA%3D%3D")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetUserDataForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSInstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", String.class,
|
Method method = AWSInstanceAsyncClient.class.getMethod("setUserDataForInstanceInRegion", String.class, String.class,
|
||||||
String.class, Array.newInstance(byte.class, 0).getClass());
|
Array.newInstance(byte.class, 0).getClass());
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", "test".getBytes());
|
HttpRequest request = processor.createRequest(method, null, "1", "test".getBytes());
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, setUserDataForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=userData&Value=dGVzdA%3D%3D&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
|
||||||
filter.filter(request);// ensure encoding worked properly
|
|
||||||
assertPayloadEquals(
|
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&Attribute=userData&InstanceId=1&Signature=nArJlrtyAfgqDnXxv%2B2y0r9O%2BIfUcitpQMjfQR0oeRM%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2009-11-08T15%3A54%3A08.897Z&Value=dGVzdA%3D%3D&Version=2011-05-15&AWSAccessKeyId=identity",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
@ -379,16 +390,32 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setRamdiskForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "ramdisk")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "y9xr294R57Pjzzafq90Xi2LMi0JKj/Jwy5HL%2BYWyTvo=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "test")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetRamdiskForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSInstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", String.class,
|
Method method = AWSInstanceAsyncClient.class.getMethod("setRamdiskForInstanceInRegion", String.class, String.class,
|
||||||
String.class, String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, setRamdiskForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=ramdisk&Value=test&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
@ -396,16 +423,32 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setKernelForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "kernel")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "vqAuTOcX6i8UfiVGAO/2yz2HHTqZyayiy/SiEU4ySws=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "test")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetKernelForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSInstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", String.class,
|
Method method = AWSInstanceAsyncClient.class.getMethod("setKernelForInstanceInRegion", String.class, String.class,
|
||||||
String.class, String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
HttpRequest request = processor.createRequest(method, null, "1", "test");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, setKernelForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=kernel&Value=test&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
@ -413,17 +456,31 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setApiTerminationDisabled = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "disableApiTermination")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "tOgWZ2rJ2KDgV55oMEa3RXKHvroiuqZfGfugBCV7ZLk=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "true")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
public void testSetApiTerminationDisabledForInstanceInRegion() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Method method = AWSInstanceAsyncClient.class.getMethod("setApiTerminationDisabledForInstanceInRegion",
|
Method method = AWSInstanceAsyncClient.class.getMethod("setApiTerminationDisabledForInstanceInRegion", String.class,
|
||||||
String.class, String.class, boolean.class);
|
String.class, boolean.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", true);
|
HttpRequest request = processor.createRequest(method, null, "1", true);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, setApiTerminationDisabled.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&Attribute=disableApiTermination&Value=true&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -433,15 +490,30 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest instanceTypeForInstance = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "instanceType")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "DC1r80OrSLCVcVt/y3gUPWxRWrPK8T96FXjNfmCMwRY=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "c1.medium")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetInstanceTypeForInstanceInRegion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSInstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", String.class,
|
Method method = AWSInstanceAsyncClient.class.getMethod("setInstanceTypeForInstanceInRegion", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", InstanceType.C1_MEDIUM);
|
HttpRequest request = processor.createRequest(method, null, "1", InstanceType.C1_MEDIUM);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, instanceTypeForInstance.getPayload().getRawContent().toString(),
|
||||||
"Action=ModifyInstanceAttribute&Attribute=instanceType&Value=c1.medium&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
@ -451,17 +523,31 @@ public class AWSInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSIns
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest setInstanceInitiatedShutdownBehavior = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ModifyInstanceAttribute")
|
||||||
|
.addFormParam("Attribute", "instanceInitiatedShutdownBehavior")
|
||||||
|
.addFormParam("InstanceId", "1")
|
||||||
|
.addFormParam("Signature", "HLu0ufuCEUPUrNzjMsmFvjqEFbdawad/7Hufdg9flbc=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Value", "terminate")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
public void testSetInstanceInitiatedShutdownBehaviorForInstanceInRegion() throws SecurityException,
|
||||||
NoSuchMethodException, IOException {
|
NoSuchMethodException, IOException {
|
||||||
Method method = AWSInstanceAsyncClient.class.getMethod("setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
Method method = AWSInstanceAsyncClient.class.getMethod("setInstanceInitiatedShutdownBehaviorForInstanceInRegion",
|
||||||
String.class, String.class, InstanceInitiatedShutdownBehavior.class);
|
String.class, String.class, InstanceInitiatedShutdownBehavior.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "1", InstanceInitiatedShutdownBehavior.TERMINATE);
|
HttpRequest request = processor.createRequest(method, null, "1", InstanceInitiatedShutdownBehavior.TERMINATE);
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, setInstanceInitiatedShutdownBehavior.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=ModifyInstanceAttribute&Attribute=instanceInitiatedShutdownBehavior&Value=terminate&InstanceId=1",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -55,14 +55,29 @@ public class AWSKeyPairAsyncClientTest extends BaseAWSEC2AsyncClientTest<AWSKeyP
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest importKeyPair = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "ImportKeyPair")
|
||||||
|
.addFormParam("KeyName", "mykey")
|
||||||
|
.addFormParam("PublicKeyMaterial", "c3NoLXJzYSBBQQ%3D%3D")
|
||||||
|
.addFormParam("Signature", "hI3Y8ggtVzXrEMmHp4Kem2/HCAX9hYN2NKjhDBz9SkY=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testImportKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
public void testImportKeyPair() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSKeyPairAsyncClient.class.getMethod("importKeyPairInRegion", String.class, String.class,
|
Method method = AWSKeyPairAsyncClient.class.getMethod("importKeyPairInRegion", String.class, String.class,
|
||||||
String.class);
|
String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "mykey", "ssh-rsa AA");
|
HttpRequest request = processor.createRequest(method, null, "mykey", "ssh-rsa AA");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=ImportKeyPair&PublicKeyMaterial=c3NoLXJzYSBBQQ%3D%3D&KeyName=mykey",
|
assertPayloadEquals(request, importKeyPair.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
|
|
@ -23,8 +23,6 @@ import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
import org.jclouds.Fallbacks.EmptySetOnNotFoundOr404;
|
||||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||||
import org.jclouds.aws.ec2.options.CreateSecurityGroupOptions;
|
|
||||||
import org.jclouds.aws.ec2.xml.CreateSecurityGroupResponseHandler;
|
|
||||||
import org.jclouds.ec2.domain.IpPermission;
|
import org.jclouds.ec2.domain.IpPermission;
|
||||||
import org.jclouds.ec2.domain.IpProtocol;
|
import org.jclouds.ec2.domain.IpProtocol;
|
||||||
import org.jclouds.ec2.util.IpPermissions;
|
import org.jclouds.ec2.util.IpPermissions;
|
||||||
|
@ -100,19 +98,33 @@ public class AWSSecurityGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<A
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createSecurityGroup = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "CreateSecurityGroup")
|
||||||
|
.addFormParam("GroupDescription", "description")
|
||||||
|
.addFormParam("GroupName", "name")
|
||||||
|
.addFormParam("Signature", "4uhrFtF0ppjWPJU6MUto3iQ8z3e5WKMUuPCE294hrg4=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateSecurityGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = AWSSecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegionAndReturnId",
|
Method method = AWSSecurityGroupAsyncClient.class.getMethod("createSecurityGroupInRegion", String.class,
|
||||||
String.class, String.class, String.class, CreateSecurityGroupOptions[].class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "description");
|
HttpRequest request = processor.createRequest(method, null, "name", "description");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request,
|
assertPayloadEquals(request, createSecurityGroup.getPayload().getRawContent().toString(),
|
||||||
"Action=CreateSecurityGroup&GroupDescription=description&GroupName=name",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
assertSaxResponseParserClassEquals(method, CreateSecurityGroupResponseHandler.class);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
|
|
|
@ -55,14 +55,29 @@ public class PlacementGroupAsyncClientTest extends BaseAWSEC2AsyncClientTest<Pla
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest createPlacementGroup = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "CreatePlacementGroup")
|
||||||
|
.addFormParam("GroupName", "name")
|
||||||
|
.addFormParam("Signature", "V3o3tjvFQfI1zdP4iZJLnlusP3dSpPFx7bJVJlJbs2w=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("Strategy", "cluster")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testCreatePlacementGroup() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreatePlacementGroup() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = PlacementGroupAsyncClient.class.getMethod("createPlacementGroupInRegion", String.class,
|
Method method = PlacementGroupAsyncClient.class.getMethod("createPlacementGroupInRegion", String.class,
|
||||||
String.class, String.class);
|
String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, "name", "cluster");
|
HttpRequest request = processor.createRequest(method, null, "name", "cluster");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(request, "Action=CreatePlacementGroup&Strategy=cluster&GroupName=name",
|
assertPayloadEquals(request, createPlacementGroup.getPayload().getRawContent().toString(),
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
|
||||||
|
|
|
@ -43,16 +43,31 @@ import org.testng.annotations.Test;
|
||||||
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
|
||||||
@Test(groups = "unit", testName = "SpotInstanceAsyncClientTest")
|
@Test(groups = "unit", testName = "SpotInstanceAsyncClientTest")
|
||||||
public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotInstanceAsyncClient> {
|
public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotInstanceAsyncClient> {
|
||||||
|
|
||||||
|
HttpRequest requestSpotInstances = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RequestSpotInstances")
|
||||||
|
.addFormParam("LaunchSpecification.ImageId", "m1.small")
|
||||||
|
.addFormParam("LaunchSpecification.InstanceType", "ami-voo")
|
||||||
|
.addFormParam("Signature", "5PZRT8xXMugx1ku/NxQpaGWqYLLbKwJksBbeldGLO2s=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("SpotPrice", "0.01")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRequestSpotInstance() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRequestSpotInstance() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SpotInstanceAsyncClient.class.getMethod("requestSpotInstanceInRegion", String.class,
|
Method method = SpotInstanceAsyncClient.class.getMethod("requestSpotInstanceInRegion", String.class,
|
||||||
float.class, String.class, String.class);
|
float.class, String.class, String.class);
|
||||||
HttpRequest request = processor.createRequest(method, null, 0.01f, "m1.small", "ami-voo");
|
HttpRequest request = processor.createRequest(method, null, 0.01f, "m1.small", "ami-voo");
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.us-east-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, requestSpotInstances.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=RequestSpotInstances&LaunchSpecification.ImageId=m1.small&SpotPrice=0.01&LaunchSpecification.InstanceType=ami-voo",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
@ -62,6 +77,28 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
||||||
checkFilters(request);
|
checkFilters(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest requestSpotInstancesOptions = HttpRequest.builder().method("POST")
|
||||||
|
.endpoint("https://ec2.us-east-1.amazonaws.com/")
|
||||||
|
.addHeader("Host", "ec2.us-east-1.amazonaws.com")
|
||||||
|
.addFormParam("Action", "RequestSpotInstances")
|
||||||
|
.addFormParam("AvailabilityZoneGroup", "availabilityZoneGroup")
|
||||||
|
.addFormParam("InstanceCount", "3")
|
||||||
|
.addFormParam("LaunchGroup", "launchGroup")
|
||||||
|
.addFormParam("LaunchSpecification.ImageId", "ami-voo")
|
||||||
|
.addFormParam("LaunchSpecification.InstanceType", "m1.small")
|
||||||
|
.addFormParam("LaunchSpecification.KernelId", "kernelId")
|
||||||
|
.addFormParam("LaunchSpecification.Placement.AvailabilityZone", "eu-west-1a")
|
||||||
|
.addFormParam("LaunchSpecification.SecurityGroup.1", "group1")
|
||||||
|
.addFormParam("Signature", "94pCsdmfYVMbMzofCeTvfvpQozIY6iDu0LewXvHl1ao=")
|
||||||
|
.addFormParam("SignatureMethod", "HmacSHA256")
|
||||||
|
.addFormParam("SignatureVersion", "2")
|
||||||
|
.addFormParam("SpotPrice", "0.01")
|
||||||
|
.addFormParam("Timestamp", "2009-11-08T15%3A54%3A08.897Z")
|
||||||
|
.addFormParam("ValidFrom", "1970-05-23T21%3A21%3A18Z")
|
||||||
|
.addFormParam("ValidUntil", "2009-02-13T23%3A31%3A31Z")
|
||||||
|
.addFormParam("Version", "2011-05-15")
|
||||||
|
.addFormParam("AWSAccessKeyId", "identity").build();
|
||||||
|
|
||||||
public void testRequestSpotInstancesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRequestSpotInstancesOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Method method = SpotInstanceAsyncClient.class.getMethod("requestSpotInstancesInRegion", String.class,
|
Method method = SpotInstanceAsyncClient.class.getMethod("requestSpotInstancesInRegion", String.class,
|
||||||
float.class, int.class, LaunchSpecification.class, RequestSpotInstancesOptions[].class);
|
float.class, int.class, LaunchSpecification.class, RequestSpotInstancesOptions[].class);
|
||||||
|
@ -70,11 +107,11 @@ public class SpotInstanceAsyncClientTest extends BaseAWSEC2AsyncClientTest<SpotI
|
||||||
.kernelId("kernelId").securityGroupName("group1").build(), new RequestSpotInstancesOptions().validFrom(from)
|
.kernelId("kernelId").securityGroupName("group1").build(), new RequestSpotInstancesOptions().validFrom(from)
|
||||||
.validUntil(to).availabilityZoneGroup("availabilityZoneGroup").launchGroup("launchGroup"));
|
.validUntil(to).availabilityZoneGroup("availabilityZoneGroup").launchGroup("launchGroup"));
|
||||||
|
|
||||||
|
request = request.getFilters().get(0).filter(request);
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST https://ec2.eu-west-1.amazonaws.com/ HTTP/1.1");
|
assertRequestLineEquals(request, "POST https://ec2.eu-west-1.amazonaws.com/ HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Host: ec2.eu-west-1.amazonaws.com\n");
|
assertNonPayloadHeadersEqual(request, "Host: ec2.eu-west-1.amazonaws.com\n");
|
||||||
assertPayloadEquals(
|
assertPayloadEquals(request, requestSpotInstancesOptions.getPayload().getRawContent().toString(),
|
||||||
request,
|
|
||||||
"Action=RequestSpotInstances&InstanceCount=3&SpotPrice=0.01&ValidFrom=1970-05-23T21%3A21%3A18Z&ValidUntil=2009-02-13T23%3A31%3A31Z&AvailabilityZoneGroup=availabilityZoneGroup&LaunchGroup=launchGroup&LaunchSpecification.ImageId=ami-voo&LaunchSpecification.Placement.AvailabilityZone=eu-west-1a&LaunchSpecification.SecurityGroup.1=group1&LaunchSpecification.InstanceType=m1.small&LaunchSpecification.KernelId=kernelId",
|
|
||||||
"application/x-www-form-urlencoded", false);
|
"application/x-www-form-urlencoded", false);
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, request, ParseSax.class);
|
assertResponseParserClassEquals(method, request, ParseSax.class);
|
||||||
|
|
|
@ -102,8 +102,8 @@ public class ArchiveApiExpectTest extends BaseGleSYSApiExpectTest {
|
||||||
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
||||||
.addFormParams(ImmutableMultimap.<String, String>builder()
|
.addFormParams(ImmutableMultimap.<String, String>builder()
|
||||||
.put("username", "xxxxxx_test1")
|
.put("username", "xxxxxx_test1")
|
||||||
.put("size", "5")
|
.put("password", "somepass")
|
||||||
.put("password", "somepass").build()).build(),
|
.put("size", "5").build()).build(),
|
||||||
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/archive_details.json")).build()).getArchiveApi();
|
HttpResponse.builder().statusCode(200).payload(payloadFromResource("/archive_details.json")).build()).getArchiveApi();
|
||||||
assertEquals(api.createWithCredentialsAndSize("xxxxxx_test1", "somepass", 5), detailsInArchiveDetails());
|
assertEquals(api.createWithCredentialsAndSize("xxxxxx_test1", "somepass", 5), detailsInArchiveDetails());
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,8 @@ public class DomainApiExpectTest extends BaseGleSYSApiExpectTest {
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
||||||
.addFormParam("domainname", "jclouds.org")
|
.addFormParam("domainname", "jclouds.org")
|
||||||
.addFormParam("type", "A")
|
|
||||||
.addFormParam("host", "jclouds.org")
|
.addFormParam("host", "jclouds.org")
|
||||||
|
.addFormParam("type", "A")
|
||||||
.addFormParam("data", "").build(),
|
.addFormParam("data", "").build(),
|
||||||
HttpResponse.builder().statusCode(200)
|
HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/domain_record.json", MediaType.APPLICATION_JSON)).build())
|
.payload(payloadFromResourceWithContentType("/domain_record.json", MediaType.APPLICATION_JSON)).build())
|
||||||
|
@ -143,8 +143,8 @@ public class DomainApiExpectTest extends BaseGleSYSApiExpectTest {
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
||||||
.addFormParam("domainname", "jclouds.org")
|
.addFormParam("domainname", "jclouds.org")
|
||||||
.addFormParam("type", "A")
|
|
||||||
.addFormParam("host", "jclouds.org")
|
.addFormParam("host", "jclouds.org")
|
||||||
|
.addFormParam("type", "A")
|
||||||
.addFormParam("data", "").build(),
|
.addFormParam("data", "").build(),
|
||||||
HttpResponse.builder().statusCode(404).build()).getDomainApi();
|
HttpResponse.builder().statusCode(404).build()).getDomainApi();
|
||||||
|
|
||||||
|
|
|
@ -526,8 +526,8 @@ public class ServerApiExpectTest extends BaseGleSYSApiExpectTest {
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
||||||
.addFormParam("serverid", "server777")
|
.addFormParam("serverid", "server777")
|
||||||
.addFormParam("resolution", "minute")
|
.addFormParam("resource", "diskioread")
|
||||||
.addFormParam("resource", "diskioread").build(),
|
.addFormParam("resolution", "minute").build(),
|
||||||
HttpResponse.builder().statusCode(200)
|
HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType("/server_resource_usage.json", MediaType.APPLICATION_JSON))
|
.payload(payloadFromResourceWithContentType("/server_resource_usage.json", MediaType.APPLICATION_JSON))
|
||||||
.build())
|
.build())
|
||||||
|
@ -555,8 +555,8 @@ public class ServerApiExpectTest extends BaseGleSYSApiExpectTest {
|
||||||
.addHeader("Accept", "application/json")
|
.addHeader("Accept", "application/json")
|
||||||
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
.addHeader("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==")
|
||||||
.addFormParam("serverid", "server777")
|
.addFormParam("serverid", "server777")
|
||||||
.addFormParam("resolution", "minute")
|
.addFormParam("resource", "diskioread")
|
||||||
.addFormParam("resource", "diskioread").build(),
|
.addFormParam("resolution", "minute").build(),
|
||||||
HttpResponse.builder().statusCode(401).build())
|
HttpResponse.builder().statusCode(401).build())
|
||||||
.getServerApi();
|
.getServerApi();
|
||||||
|
|
||||||
|
|
|
@ -66,40 +66,43 @@ public class GridLoadBalancerAsyncClientTest extends BaseGoGridAsyncClientTest<G
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
assertPayloadEquals(httpRequest, null, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpRequest addLoadBalancer = HttpRequest.builder().method("GET")
|
||||||
|
.endpoint("https://api.gogrid.com/api/grid/loadbalancer/add")
|
||||||
|
.addQueryParam("v", "1.5")
|
||||||
|
.addQueryParam("name", "BalanceIt")
|
||||||
|
.addQueryParam("loadbalancer.type", "Least Connect")
|
||||||
|
.addQueryParam("loadbalancer.persistence", "SSL Sticky")
|
||||||
|
.addQueryParam("virtualip.ip", "127.0.0.1")
|
||||||
|
.addQueryParam("virtualip.port", "80")
|
||||||
|
.addQueryParam("realiplist.0.ip", "127.0.0.1")
|
||||||
|
.addQueryParam("realiplist.0.port", "8080")
|
||||||
|
.addQueryParam("realiplist.1.ip", "127.0.0.1")
|
||||||
|
.addQueryParam("realiplist.1.port", "9090")
|
||||||
|
.addQueryParam("sig", "e9aafd0a5d4c69bb24536be4bce8a528")
|
||||||
|
.addQueryParam("api_key", "identity").build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddLoadBalancer() throws NoSuchMethodException, IOException {
|
public void testAddLoadBalancer() throws NoSuchMethodException, IOException {
|
||||||
Method method = GridLoadBalancerAsyncClient.class.getMethod("addLoadBalancer", String.class, IpPortPair.class,
|
Method method = GridLoadBalancerAsyncClient.class.getMethod("addLoadBalancer", String.class, IpPortPair.class,
|
||||||
List.class, AddLoadBalancerOptions[].class);
|
List.class, AddLoadBalancerOptions[].class);
|
||||||
HttpRequest httpRequest = processor.createRequest(method, "BalanceIt",
|
HttpRequest request = processor.createRequest(method, "BalanceIt",
|
||||||
IpPortPair.builder().ip(Ip.builder().ip("127.0.0.1").build()).port(80).build(),
|
IpPortPair.builder().ip(Ip.builder().ip("127.0.0.1").build()).port(80).build(),
|
||||||
ImmutableList.of(IpPortPair.builder().ip(Ip.builder().ip("127.0.0.1").build()).port(8080).build(),
|
ImmutableList.of(IpPortPair.builder().ip(Ip.builder().ip("127.0.0.1").build()).port(8080).build(),
|
||||||
IpPortPair.builder().ip(Ip.builder().ip("127.0.0.1").build()).port(9090).build()),
|
IpPortPair.builder().ip(Ip.builder().ip("127.0.0.1").build()).port(9090).build()),
|
||||||
new AddLoadBalancerOptions.Builder().create(
|
new AddLoadBalancerOptions.Builder().create(
|
||||||
LoadBalancerType.LEAST_CONNECTED, LoadBalancerPersistenceType.SSL_STICKY));
|
LoadBalancerType.LEAST_CONNECTED, LoadBalancerPersistenceType.SSL_STICKY));
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
request = request.getFilters().get(0).filter(request);
|
||||||
+ "add?v=1.5&name=BalanceIt&loadbalancer.type=Least%20Connect&"
|
|
||||||
+ "loadbalancer.persistence=SSL%20Sticky&realiplist.0.ip=127.0.0.1&"
|
|
||||||
+ "realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&"
|
|
||||||
+ "virtualip.ip=127.0.0.1&virtualip.port=80 HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "");
|
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
|
||||||
|
|
||||||
assertResponseParserClassEquals(method, httpRequest, ParseLoadBalancerFromJsonResponse.class);
|
assertRequestLineEquals(request, addLoadBalancer.getRequestLine());
|
||||||
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
assertResponseParserClassEquals(method, request, ParseLoadBalancerFromJsonResponse.class);
|
||||||
assertSaxResponseParserClassEquals(method, null);
|
assertSaxResponseParserClassEquals(method, null);
|
||||||
assertFallbackClassEquals(method, null);
|
assertFallbackClassEquals(method, null);
|
||||||
|
|
||||||
checkFilters(httpRequest);
|
checkFilters(request);
|
||||||
httpRequest = Iterables.getOnlyElement(httpRequest.getFilters()).filter(httpRequest);
|
|
||||||
|
|
||||||
assertRequestLineEquals(httpRequest, "GET https://api.gogrid.com/api/grid/loadbalancer/"
|
|
||||||
+ "add?v=1.5&name=BalanceIt&loadbalancer.type=Least%20Connect&"
|
|
||||||
+ "loadbalancer.persistence=SSL%20Sticky&realiplist.0.ip=127.0.0.1&"
|
|
||||||
+ "realiplist.0.port=8080&realiplist.1.ip=127.0.0.1&realiplist.1.port=9090&"
|
|
||||||
+ "virtualip.ip=127.0.0.1&virtualip.port=80&" + "sig=e9aafd0a5d4c69bb24536be4bce8a528&api_key=identity "
|
|
||||||
+ "HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(httpRequest, "");
|
|
||||||
assertPayloadEquals(httpRequest, null, null, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -23,35 +23,43 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = "unit", testName = "GridServerClientExpectTest")
|
@Test(groups = "unit", testName = "GridServerClientExpectTest")
|
||||||
public class GridServerClientExpectTest extends BaseGoGridRestClientExpectTest {
|
public class GridServerClientExpectTest extends BaseGoGridRestClientExpectTest {
|
||||||
|
|
||||||
public void testAddServerWhenResponseIs2xx() throws Exception {
|
HttpRequest addServer = HttpRequest.builder().method("GET")
|
||||||
HttpRequest listGridServers = HttpRequest.builder().method("GET").endpoint(
|
.endpoint("https://api.gogrid.com/api/grid/server/add")
|
||||||
URI.create("https://api.gogrid.com/api/grid/server/add?"
|
.addQueryParam("v", "1.6")
|
||||||
+ "v=1.6&name=serverName&server.ram=memory&image=img55&ip=127.0.0.1&"
|
.addQueryParam("name", "serverName")
|
||||||
+ "sig=e9aafd0a5d4c69bb24536be4bce8a528&api_key=identity")).build();
|
.addQueryParam("image", "img55")
|
||||||
|
.addQueryParam("server.ram", "memory")
|
||||||
|
.addQueryParam("ip", "127.0.0.1")
|
||||||
|
.addQueryParam("sig", "e9aafd0a5d4c69bb24536be4bce8a528")
|
||||||
|
.addQueryParam("api_key", "identity").build();
|
||||||
|
|
||||||
|
public void testAddServerWhenResponseIs2xx() throws Exception {
|
||||||
HttpResponse listGridServersResponse = HttpResponse.builder().statusCode(200).payload(
|
HttpResponse listGridServersResponse = HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/test_get_server_list.json", "application/json")).build();
|
payloadFromResourceWithContentType("/test_get_server_list.json", "application/json")).build();
|
||||||
|
|
||||||
GoGridClient addServerWorked = requestSendsResponse(listGridServers, listGridServersResponse);
|
GoGridClient addServerWorked = requestSendsResponse(addServer, listGridServersResponse);
|
||||||
|
|
||||||
assertEquals(addServerWorked.getServerServices().addServer("serverName", "img55", "memory", "127.0.0.1")
|
assertEquals(addServerWorked.getServerServices().addServer("serverName", "img55", "memory", "127.0.0.1")
|
||||||
.toString(), new ParseServerTest().expected().toString());
|
.toString(), new ParseServerTest().expected().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAddServerWithOptionsWhenResponseIs2xx() throws Exception {
|
HttpRequest addServerOptions = HttpRequest.builder().method("GET")
|
||||||
HttpRequest listGridServers = HttpRequest
|
.endpoint("https://api.gogrid.com/api/grid/server/add")
|
||||||
.builder()
|
.addQueryParam("v", "1.6")
|
||||||
.method("GET")
|
.addQueryParam("name", "serverName")
|
||||||
.endpoint(
|
.addQueryParam("image", "img55")
|
||||||
URI
|
.addQueryParam("server.ram", "memory")
|
||||||
.create("https://api.gogrid.com/api/grid/server/add?"
|
.addQueryParam("ip", "127.0.0.1")
|
||||||
+ "v=1.6&name=serverName&server.ram=memory&image=img55&ip=127.0.0.1&isSandbox=true&description=fooy&"
|
.addQueryParam("isSandbox", "true")
|
||||||
+ "sig=e9aafd0a5d4c69bb24536be4bce8a528&api_key=identity")).build();
|
.addQueryParam("description", "fooy")
|
||||||
|
.addQueryParam("sig", "e9aafd0a5d4c69bb24536be4bce8a528")
|
||||||
|
.addQueryParam("api_key", "identity").build();
|
||||||
|
|
||||||
|
public void testAddServerWithOptionsWhenResponseIs2xx() throws Exception {
|
||||||
HttpResponse listGridServersResponse = HttpResponse.builder().statusCode(200).payload(
|
HttpResponse listGridServersResponse = HttpResponse.builder().statusCode(200).payload(
|
||||||
payloadFromResourceWithContentType("/test_get_server_list.json", "application/json")).build();
|
payloadFromResourceWithContentType("/test_get_server_list.json", "application/json")).build();
|
||||||
|
|
||||||
GoGridClient addServerWithOptionsWorked = requestSendsResponse(listGridServers, listGridServersResponse);
|
GoGridClient addServerWithOptionsWorked = requestSendsResponse(addServerOptions, listGridServersResponse);
|
||||||
|
|
||||||
assertEquals(addServerWithOptionsWorked.getServerServices().addServer("serverName", "img55", "memory",
|
assertEquals(addServerWithOptionsWorked.getServerServices().addServer("serverName", "img55", "memory",
|
||||||
"127.0.0.1", new AddServerOptions().asSandboxType().withDescription("fooy")).toString(),
|
"127.0.0.1", new AddServerOptions().asSandboxType().withDescription("fooy")).toString(),
|
||||||
|
|
Loading…
Reference in New Issue