mirror of https://github.com/apache/jclouds.git
Merge pull request #1209 from nacx/compile-warnings-abiquo
Removed all compile warnings in Abiquo
This commit is contained in:
commit
2a405248aa
|
@ -29,6 +29,7 @@ import org.jclouds.abiquo.domain.AdminResources;
|
||||||
import org.jclouds.abiquo.domain.EnterpriseResources;
|
import org.jclouds.abiquo.domain.EnterpriseResources;
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ import com.abiquo.server.core.enterprise.RolesDto;
|
||||||
import com.abiquo.server.core.enterprise.UserDto;
|
import com.abiquo.server.core.enterprise.UserDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code AdminAsyncApi}
|
* Tests annotation parsing of {@code AdminAsyncApi}
|
||||||
*
|
*
|
||||||
|
@ -50,7 +52,7 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testListRoles() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListRoles() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "listRoles");
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "listRoles");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RolesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RolesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -65,7 +67,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testGetRoleFromUser() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetRoleFromUser() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "getRole", UserDto.class);
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "getRole", UserDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.userPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.userPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -80,7 +83,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testCreateRole() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateRole() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "createRole", RoleDto.class);
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "createRole", RoleDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(AdminResources.rolePost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(AdminResources.rolePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/roles HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/roles HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -96,7 +100,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testDeleteRole() throws SecurityException, NoSuchMethodException {
|
public void testDeleteRole() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "deleteRole", RoleDto.class);
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "deleteRole", RoleDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(AdminResources.rolePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(AdminResources.rolePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/roles/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/roles/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -111,7 +116,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testUpdateRole() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateRole() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "updateRole", RoleDto.class);
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "updateRole", RoleDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(AdminResources.rolePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(AdminResources.rolePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/roles/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/roles/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -127,7 +133,7 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testGetRoleById() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetRoleById() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "getRole", Integer.class);
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "getRole", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -142,7 +148,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testListPrivilegesByRoles() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPrivilegesByRoles() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "listPrivileges", RoleDto.class);
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "listPrivileges", RoleDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(AdminResources.rolePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(AdminResources.rolePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1/action/privileges HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1/action/privileges HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -159,7 +166,7 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest<AdminAsyncApi> {
|
||||||
|
|
||||||
public void testGetCurrentUser() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetCurrentUser() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(AdminAsyncApi.class, "getCurrentUser");
|
Invokable<?, ?> method = method(AdminAsyncApi.class, "getCurrentUser");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/login HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/login HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.abiquo.features;
|
package org.jclouds.abiquo.features;
|
||||||
|
|
||||||
import static org.jclouds.abiquo.domain.DomainUtils.withHeader;
|
import static org.jclouds.abiquo.domain.DomainUtils.withHeader;
|
||||||
import static org.jclouds.reflect.Reflection2.method;
|
import static org.jclouds.reflect.Reflection2.method;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ import org.jclouds.abiquo.functions.ReturnTaskReferenceOrNull;
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
import org.jclouds.http.functions.ReturnStringIf2xx;
|
import org.jclouds.http.functions.ReturnStringIf2xx;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -91,8 +93,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListVirtualDatacentersParams() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualDatacentersParams() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualDatacenters", VirtualDatacenterOptions.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualDatacenters", VirtualDatacenterOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(VirtualDatacenterOptions.builder().datacenterId(1)
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
.enterpriseId(1).build()));
|
ImmutableList.<Object> of(VirtualDatacenterOptions.builder().datacenterId(1).enterpriseId(1).build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters?datacenter=1&enterprise=1 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters?datacenter=1&enterprise=1 HTTP/1.1");
|
||||||
|
@ -108,7 +110,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListVirtualDatacentersNoParams() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualDatacentersNoParams() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualDatacenters", VirtualDatacenterOptions.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualDatacenters", VirtualDatacenterOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(VirtualDatacenterOptions.builder().build()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(VirtualDatacenterOptions.builder().build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacentersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacentersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -124,8 +127,9 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testCreateVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVirtualDatacenter", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVirtualDatacenter", VirtualDatacenterDto.class,
|
||||||
DatacenterDto.class, EnterpriseDto.class);
|
DatacenterDto.class, EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPost(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
InfrastructureResources.datacenterPut(), EnterpriseResources.enterprisePut()));
|
CloudResources.virtualDatacenterPost(), InfrastructureResources.datacenterPut(),
|
||||||
|
EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters?datacenter=1&enterprise=1 HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters?datacenter=1&enterprise=1 HTTP/1.1");
|
||||||
|
@ -142,7 +146,7 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualDatacenter", Integer.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualDatacenter", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -157,7 +161,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testUpdateVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualDatacenter", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualDatacenter", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -173,7 +178,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDeleteVirtualDatacenter() throws SecurityException, NoSuchMethodException {
|
public void testDeleteVirtualDatacenter() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVirtualDatacenter", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVirtualDatacenter", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -192,7 +198,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
IpOptions options = IpOptions.builder().limit(5).build();
|
IpOptions options = IpOptions.builder().limit(5).build();
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAvailablePublicIps", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAvailablePublicIps", VirtualDatacenterDto.class,
|
||||||
IpOptions.class);
|
IpOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), options));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/publicips/topurchase?limit=5 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/publicips/topurchase?limit=5 HTTP/1.1");
|
||||||
|
@ -210,7 +217,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
IpOptions options = IpOptions.builder().limit(5).build();
|
IpOptions options = IpOptions.builder().limit(5).build();
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPurchasedPublicIps", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPurchasedPublicIps", VirtualDatacenterDto.class,
|
||||||
IpOptions.class);
|
IpOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), options));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/publicips/purchased?limit=5 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/publicips/purchased?limit=5 HTTP/1.1");
|
||||||
|
@ -226,7 +234,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testPurchasePublicIp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testPurchasePublicIp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "purchasePublicIp", PublicIpDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "purchasePublicIp", PublicIpDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.publicIpToPurchase()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.publicIpToPurchase())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/cloud/virtualdatacenters/5/publicips/purchased/1 HTTP/1.1");
|
"PUT http://localhost/api/cloud/virtualdatacenters/5/publicips/purchased/1 HTTP/1.1");
|
||||||
|
@ -242,7 +251,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testReleasePublicIp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testReleasePublicIp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "releasePublicIp", PublicIpDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "releasePublicIp", PublicIpDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.publicIpToRelease()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.publicIpToRelease())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/cloud/virtualdatacenters/5/publicips/topurchase/1 HTTP/1.1");
|
"PUT http://localhost/api/cloud/virtualdatacenters/5/publicips/topurchase/1 HTTP/1.1");
|
||||||
|
@ -260,7 +270,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListAvailableTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListAvailableTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAvailableTemplates", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAvailableTemplates", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/action/templates HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/action/templates HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplatesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplatesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -276,9 +287,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testListAvailableTemplatesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListAvailableTemplatesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAvailableTemplates", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAvailableTemplates", VirtualDatacenterDto.class,
|
||||||
VirtualMachineTemplateOptions.class);
|
VirtualMachineTemplateOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
VirtualMachineTemplateOptions.builder().hypervisorType(HypervisorType.XENSERVER).categoryName("Firewalls")
|
method,
|
||||||
.idTemplate(1).build()));
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), VirtualMachineTemplateOptions.builder()
|
||||||
|
.hypervisorType(HypervisorType.XENSERVER).categoryName("Firewalls").idTemplate(1).build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/action/templates"
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/action/templates"
|
||||||
+ "?hypervisorTypeName=XENSERVER&categoryName=Firewalls&idTemplate=1 HTTP/1.1");
|
+ "?hypervisorTypeName=XENSERVER&categoryName=Firewalls&idTemplate=1 HTTP/1.1");
|
||||||
|
@ -296,7 +308,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListStorageTiers() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListStorageTiers() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listStorageTiers", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listStorageTiers", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/tiers HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/tiers HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TiersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TiersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -311,7 +324,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetStorageTier() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetStorageTier() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getStorageTier", VirtualDatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getStorageTier", VirtualDatacenterDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/tiers/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/tiers/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -326,7 +340,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetDefaultNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetDefaultNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getDefaultNetwork", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getDefaultNetwork", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -342,8 +357,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testSetDefaultNetworkInternal() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetDefaultNetworkInternal() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "setDefaultNetwork", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "setDefaultNetwork", VirtualDatacenterDto.class,
|
||||||
VLANNetworkDto.class);
|
VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
NetworkResources.privateNetworkPut()));
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), NetworkResources.privateNetworkPut())));
|
||||||
|
|
||||||
RESTLink netLink = NetworkResources.privateNetworkPut().getEditLink();
|
RESTLink netLink = NetworkResources.privateNetworkPut().getEditLink();
|
||||||
|
|
||||||
|
@ -363,8 +378,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testSetDefaultNetworkExternal() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetDefaultNetworkExternal() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "setDefaultNetwork", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "setDefaultNetwork", VirtualDatacenterDto.class,
|
||||||
VLANNetworkDto.class);
|
VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
NetworkResources.externalNetworkPut()));
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), NetworkResources.externalNetworkPut())));
|
||||||
|
|
||||||
RESTLink netLink = NetworkResources.externalNetworkPut().getEditLink();
|
RESTLink netLink = NetworkResources.externalNetworkPut().getEditLink();
|
||||||
|
|
||||||
|
@ -385,7 +400,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListPrivateNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPrivateNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPrivateNetworks", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPrivateNetworks", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -399,8 +415,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetPrivateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPrivateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getPrivateNetwork", VirtualDatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getPrivateNetwork", VirtualDatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -416,8 +434,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testCreatePrivateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreatePrivateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "createPrivateNetwork", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "createPrivateNetwork", VirtualDatacenterDto.class,
|
||||||
VLANNetworkDto.class);
|
VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
NetworkResources.vlanPost()));
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), NetworkResources.vlanPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/privatenetworks HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/privatenetworks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -433,7 +451,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testUpdatePrivateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdatePrivateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "updatePrivateNetwork", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "updatePrivateNetwork", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.privateNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.privateNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -449,7 +468,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDeletePrivateNetwork() throws SecurityException, NoSuchMethodException {
|
public void testDeletePrivateNetwork() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deletePrivateNetwork", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deletePrivateNetwork", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.privateNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.privateNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
"DELETE http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1");
|
||||||
|
@ -467,7 +487,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListPrivateNetworkIps() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPrivateNetworkIps() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPrivateNetworkIps", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPrivateNetworkIps", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.privateNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.privateNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips HTTP/1.1");
|
||||||
|
@ -483,8 +504,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListPrivateNetworkIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPrivateNetworkIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
IpOptions options = IpOptions.builder().startWith(10).build();
|
IpOptions options = IpOptions.builder().startWith(10).build();
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPrivateNetworkIps", VLANNetworkDto.class, IpOptions.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listPrivateNetworkIps", VLANNetworkDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.privateNetworkPut(), options));
|
IpOptions.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.privateNetworkPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips?startwith=10 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips?startwith=10 HTTP/1.1");
|
||||||
|
@ -500,7 +523,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetPrivateNetworkIp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPrivateNetworkIp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getPrivateNetworkIp", VLANNetworkDto.class, Integer.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getPrivateNetworkIp", VLANNetworkDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.privateNetworkPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.privateNetworkPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips/1 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips/1 HTTP/1.1");
|
||||||
|
@ -518,7 +542,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListVirtualAppliances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualAppliances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualAppliances", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualAppliances", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualAppliancesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualAppliancesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -532,8 +557,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualAppliance", VirtualDatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualAppliance", VirtualDatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1");
|
||||||
|
@ -549,7 +576,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetVirtualApplianceState() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualApplianceState() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualApplianceState", VirtualApplianceDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualApplianceState", VirtualApplianceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/state HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/state HTTP/1.1");
|
||||||
|
@ -566,8 +594,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testCreateVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVirtualAppliance", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVirtualAppliance", VirtualDatacenterDto.class,
|
||||||
VirtualApplianceDto.class);
|
VirtualApplianceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.virtualAppliancePost()));
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), CloudResources.virtualAppliancePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances HTTP/1.1");
|
||||||
|
@ -584,7 +612,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testUpdateVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualAppliance", VirtualApplianceDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualAppliance", VirtualApplianceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1");
|
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1");
|
||||||
|
@ -601,7 +630,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDeleteVirtualAppliance() throws SecurityException, NoSuchMethodException {
|
public void testDeleteVirtualAppliance() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVirtualAppliance", VirtualApplianceDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVirtualAppliance", VirtualApplianceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1");
|
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1");
|
||||||
|
@ -618,8 +648,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testDeployVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeployVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deployVirtualAppliance", VirtualApplianceDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deployVirtualAppliance", VirtualApplianceDto.class,
|
||||||
VirtualMachineTaskDto.class);
|
VirtualMachineTaskDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.deployOptions()));
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut(), CloudResources.deployOptions())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/deploy HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/deploy HTTP/1.1");
|
||||||
|
@ -637,8 +667,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testUndeployVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUndeployVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "undeployVirtualAppliance", VirtualApplianceDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "undeployVirtualAppliance", VirtualApplianceDto.class,
|
||||||
VirtualMachineTaskDto.class);
|
VirtualMachineTaskDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.undeployOptions()));
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut(), CloudResources.undeployOptions())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/undeploy HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/undeploy HTTP/1.1");
|
||||||
|
@ -655,7 +685,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetVirtualAppliancePrice() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualAppliancePrice() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualAppliancePrice", VirtualApplianceDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualAppliancePrice", VirtualApplianceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/price HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/price HTTP/1.1");
|
||||||
|
@ -673,7 +704,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualMachines", VirtualApplianceDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualMachines", VirtualApplianceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines HTTP/1.1");
|
||||||
|
@ -690,8 +722,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testListVirtualMachinesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualMachinesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualMachines", VirtualApplianceDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVirtualMachines", VirtualApplianceDto.class,
|
||||||
VirtualMachineOptions.class);
|
VirtualMachineOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
VirtualMachineOptions.builder().disablePagination().build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut(), VirtualMachineOptions.builder()
|
||||||
|
.disablePagination().build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines?limit=0 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines?limit=0 HTTP/1.1");
|
||||||
|
@ -706,8 +740,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualMachine", VirtualApplianceDto.class, Integer.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualMachine", VirtualApplianceDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1");
|
||||||
|
@ -724,8 +760,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testCreateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVirtualMachine", VirtualApplianceDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVirtualMachine", VirtualApplianceDto.class,
|
||||||
VirtualMachineWithNodeExtendedDto.class);
|
VirtualMachineWithNodeExtendedDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualAppliancePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.virtualMachinePost()));
|
ImmutableList.<Object> of(CloudResources.virtualAppliancePut(), CloudResources.virtualMachinePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines HTTP/1.1");
|
||||||
|
@ -741,8 +777,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualMachine", VirtualMachineWithNodeExtendedDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualMachine",
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
VirtualMachineWithNodeExtendedDto.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1");
|
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1");
|
||||||
|
@ -758,10 +796,12 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdateVirtualMachineWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateVirtualMachineWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualMachine", VirtualMachineWithNodeExtendedDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVirtualMachine",
|
||||||
VirtualMachineOptions.class);
|
VirtualMachineWithNodeExtendedDto.class, VirtualMachineOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
VirtualMachineOptions.builder().force(true).build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut(), VirtualMachineOptions.builder().force(true)
|
||||||
|
.build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1?force=true HTTP/1.1");
|
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1?force=true HTTP/1.1");
|
||||||
|
@ -779,8 +819,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testChangeVirtualMachineState() throws SecurityException, NoSuchMethodException, IOException {
|
public void testChangeVirtualMachineState() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "changeVirtualMachineState", VirtualMachineDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "changeVirtualMachineState", VirtualMachineDto.class,
|
||||||
VirtualMachineStateDto.class);
|
VirtualMachineStateDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.virtualMachineState()));
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut(), CloudResources.virtualMachineState())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/state HTTP/1.1");
|
"PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/state HTTP/1.1");
|
||||||
|
@ -797,7 +837,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDeleteVirtualMachine() throws SecurityException, NoSuchMethodException {
|
public void testDeleteVirtualMachine() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVirtualMachine", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVirtualMachine", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1");
|
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1");
|
||||||
|
@ -813,7 +854,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetVirtualMachineState() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualMachineState() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualMachineState", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualMachineState", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/state HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/state HTTP/1.1");
|
||||||
|
@ -830,8 +872,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testDeployVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeployVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deployVirtualMachine", VirtualMachineDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deployVirtualMachine", VirtualMachineDto.class,
|
||||||
VirtualMachineTaskDto.class);
|
VirtualMachineTaskDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.deployOptions()));
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut(), CloudResources.deployOptions())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/deploy HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/deploy HTTP/1.1");
|
||||||
|
@ -849,8 +891,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testUndeployVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUndeployVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "undeployVirtualMachine", VirtualMachineDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "undeployVirtualMachine", VirtualMachineDto.class,
|
||||||
VirtualMachineTaskDto.class);
|
VirtualMachineTaskDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.undeployOptions()));
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut(), CloudResources.undeployOptions())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/undeploy HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/undeploy HTTP/1.1");
|
||||||
|
@ -867,7 +909,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testRebootVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRebootVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "rebootVirtualMachine", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "rebootVirtualMachine", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/reset HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/action/reset HTTP/1.1");
|
||||||
|
@ -883,7 +926,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListNetworkConfigurations() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListNetworkConfigurations() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listNetworkConfigurations", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listNetworkConfigurations", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
|
@ -899,12 +943,13 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetGatewayNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testSetGatewayNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "setGatewayNetwork", VirtualMachineDto.class, VLANNetworkDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "setGatewayNetwork", VirtualMachineDto.class,
|
||||||
|
VLANNetworkDto.class);
|
||||||
|
|
||||||
VirtualMachineDto vm = CloudResources.virtualMachinePut();
|
VirtualMachineDto vm = CloudResources.virtualMachinePut();
|
||||||
VLANNetworkDto network = NetworkResources.privateNetworkPut();
|
VLANNetworkDto network = NetworkResources.privateNetworkPut();
|
||||||
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(vm, network));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(vm, network)));
|
||||||
|
|
||||||
String configLink = vm.searchLink("configurations").getHref() + "/" + network.getId();
|
String configLink = vm.searchLink("configurations").getHref() + "/" + network.getId();
|
||||||
|
|
||||||
|
@ -926,7 +971,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualMachineTemplate", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVirtualMachineTemplate", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1");
|
||||||
|
@ -942,7 +988,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListAttachedVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListAttachedVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAttachedVolumes", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAttachedVolumes", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/volumes HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/volumes HTTP/1.1");
|
||||||
|
@ -958,7 +1005,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDetachAllVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDetachAllVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "detachAllVolumes", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "detachAllVolumes", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/volumes HTTP/1.1");
|
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/volumes HTTP/1.1");
|
||||||
|
@ -979,8 +1027,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "replaceVolumes", VirtualMachineDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "replaceVolumes", VirtualMachineDto.class,
|
||||||
VirtualMachineOptions.class, VolumeManagementDto[].class);
|
VirtualMachineOptions.class, VolumeManagementDto[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
VirtualMachineOptions.builder().force(true).build(), new VolumeManagementDto[] { first, second }));
|
method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut(), VirtualMachineOptions.builder().force(true)
|
||||||
|
.build(), new VolumeManagementDto[] { first, second })));
|
||||||
|
|
||||||
String editLink = CloudResources.volumePut().getEditLink().getHref();
|
String editLink = CloudResources.volumePut().getEditLink().getHref();
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
|
@ -999,7 +1049,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListAttachedHardDisks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListAttachedHardDisks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAttachedHardDisks", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listAttachedHardDisks", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/disks HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/disks HTTP/1.1");
|
||||||
|
@ -1015,7 +1066,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDetachAllHardDisks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDetachAllHardDisks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "detachAllHardDisks", VirtualMachineDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "detachAllHardDisks", VirtualMachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/disks HTTP/1.1");
|
"DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/storage/disks HTTP/1.1");
|
||||||
|
@ -1036,8 +1088,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "replaceHardDisks", VirtualMachineDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "replaceHardDisks", VirtualMachineDto.class,
|
||||||
DiskManagementDto[].class);
|
DiskManagementDto[].class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
new DiskManagementDto[] { first, second }));
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut(), new DiskManagementDto[] { first, second })));
|
||||||
|
|
||||||
String editLink = CloudResources.hardDiskPut().getEditLink().getHref();
|
String editLink = CloudResources.hardDiskPut().getEditLink().getHref();
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
|
@ -1057,7 +1109,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListHardDisks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListHardDisks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listHardDisks", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listHardDisks", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/disks HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/disks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DisksManagementDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DisksManagementDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1071,8 +1124,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetHardDisk() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetHardDisk() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getHardDisk", VirtualDatacenterDto.class, Integer.class);;
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getHardDisk", VirtualDatacenterDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1));
|
;
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/disks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/disks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DiskManagementDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DiskManagementDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1088,8 +1143,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testCreateHardDisk() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateHardDisk() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "createHardDisk", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "createHardDisk", VirtualDatacenterDto.class,
|
||||||
DiskManagementDto.class);
|
DiskManagementDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.hardDiskPost()));
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), CloudResources.hardDiskPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/disks HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/disks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DiskManagementDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DiskManagementDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1105,7 +1160,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDeleteHardDisk() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeleteHardDisk() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteHardDisk", DiskManagementDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteHardDisk", DiskManagementDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.hardDiskPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.hardDiskPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/disks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/disks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -1122,7 +1178,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testListVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVolumes() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/volumes HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/volumes HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VolumesManagementDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VolumesManagementDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1136,9 +1193,12 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListVolumesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVolumesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class, VolumeOptions.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
VolumeOptions.class);
|
||||||
VolumeOptions.builder().onlyAvailable(true).build()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
|
method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), VolumeOptions.builder()
|
||||||
|
.onlyAvailable(true).build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/volumes?available=true HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/volumes?available=true HTTP/1.1");
|
||||||
|
@ -1153,10 +1213,13 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListVolumesWithFilterOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVolumesWithFilterOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class, VolumeOptions.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class,
|
||||||
|
VolumeOptions.class);
|
||||||
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
VolumeOptions.builder().has("vol").orderBy(OrderBy.NAME).ascendant(true).build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), VolumeOptions.builder().has("vol")
|
||||||
|
.orderBy(OrderBy.NAME).ascendant(true).build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/volumes?has=vol&by=name&asc=true HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/volumes?has=vol&by=name&asc=true HTTP/1.1");
|
||||||
|
@ -1172,7 +1235,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testGetVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVolume", VirtualDatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "getVolume", VirtualDatacenterDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VolumeManagementDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VolumeManagementDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1188,8 +1252,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testCreateVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVolume", VirtualDatacenterDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "createVolume", VirtualDatacenterDto.class,
|
||||||
VolumeManagementDto.class);
|
VolumeManagementDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.volumePost()));
|
ImmutableList.<Object> of(CloudResources.virtualDatacenterPut(), CloudResources.volumePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/volumes HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/volumes HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VolumeManagementDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VolumeManagementDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1205,7 +1269,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testUpdateVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVolume", VolumeManagementDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "updateVolume", VolumeManagementDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.volumePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.volumePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1221,7 +1286,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
|
|
||||||
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVolume", VolumeManagementDto.class);
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "deleteVolume", VolumeManagementDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.volumePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.volumePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -1237,8 +1303,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest<CloudAsyncApi> {
|
||||||
public void testMoveVolume() throws SecurityException, NoSuchMethodException, IOException {
|
public void testMoveVolume() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(CloudAsyncApi.class, "moveVolume", VolumeManagementDto.class,
|
Invokable<?, ?> method = method(CloudAsyncApi.class, "moveVolume", VolumeManagementDto.class,
|
||||||
VirtualDatacenterDto.class);
|
VirtualDatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.volumePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
CloudResources.virtualDatacenterPut()));
|
ImmutableList.<Object> of(CloudResources.volumePut(), CloudResources.virtualDatacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/cloud/virtualdatacenters/1/volumes/1/action/move HTTP/1.1");
|
"POST http://localhost/api/cloud/virtualdatacenters/1/volumes/1/action/move HTTP/1.1");
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.jclouds.abiquo.domain.config.options.LicenseOptions;
|
||||||
import org.jclouds.abiquo.domain.config.options.PropertyOptions;
|
import org.jclouds.abiquo.domain.config.options.PropertyOptions;
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ import com.abiquo.server.core.enterprise.PrivilegeDto;
|
||||||
import com.abiquo.server.core.enterprise.PrivilegesDto;
|
import com.abiquo.server.core.enterprise.PrivilegesDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code AdminAsyncApi}.
|
* Tests annotation parsing of {@code AdminAsyncApi}.
|
||||||
*
|
*
|
||||||
|
@ -55,7 +57,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testListLicenses() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListLicenses() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listLicenses");
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listLicenses");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/licenses HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/licenses HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + LicensesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + LicensesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -70,7 +72,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testListLicenseWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListLicenseWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listLicenses", LicenseOptions.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listLicenses", LicenseOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(LicenseOptions.builder().active(true).build()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(LicenseOptions.builder().active(true).build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/licenses?active=true HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/licenses?active=true HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + LicensesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + LicensesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -85,7 +88,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testAddLicense() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAddLicense() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "addLicense", LicenseDto.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "addLicense", LicenseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(ConfigResources.licensePost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(ConfigResources.licensePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/config/licenses HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/config/licenses HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + LicenseDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + LicenseDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -101,7 +105,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testRemoveLicense() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRemoveLicense() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "removeLicense", LicenseDto.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "removeLicense", LicenseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(ConfigResources.licensePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(ConfigResources.licensePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/config/licenses/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/config/licenses/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -118,7 +123,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testListPrivileges() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPrivileges() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listPrivileges");
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listPrivileges");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/privileges HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/privileges HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -133,7 +138,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testGetPrivilege() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPrivilege() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "getPrivilege", Integer.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "getPrivilege", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/privileges/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/privileges/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegeDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegeDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -150,7 +155,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testListSystemProperties() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListSystemProperties() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listSystemProperties");
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listSystemProperties");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/properties HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/properties HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertiesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertiesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -165,8 +170,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testListSystemPropertiesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListSystemPropertiesWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listSystemProperties", PropertyOptions.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listSystemProperties", PropertyOptions.class);
|
||||||
GeneratedHttpRequest request = processor
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
.createRequest(method, ImmutableList.<Object> of(PropertyOptions.builder().component("api").build()));
|
ImmutableList.<Object> of(PropertyOptions.builder().component("api").build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/properties?component=api HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/properties?component=api HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertiesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertiesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -181,7 +186,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testUpdateSystemProperty() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateSystemProperty() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "updateSystemProperty", SystemPropertyDto.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "updateSystemProperty", SystemPropertyDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(ConfigResources.propertyPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(ConfigResources.propertyPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/properties/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/properties/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertyDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertyDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -199,7 +205,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testListCategories() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListCategories() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listCategories");
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "listCategories");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/categories HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/categories HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CategoriesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CategoriesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -214,7 +220,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testGetCategory() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetCategory() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "getCategory", Integer.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "getCategory", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/categories/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/categories/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -229,7 +235,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testCreateCategory() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateCategory() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "createCategory", CategoryDto.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "createCategory", CategoryDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(ConfigResources.categoryPost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(ConfigResources.categoryPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/config/categories HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/config/categories HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -245,7 +252,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testUpdateCategory() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateCategory() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "updateCategory", CategoryDto.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "updateCategory", CategoryDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(ConfigResources.categoryPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(ConfigResources.categoryPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/categories/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/categories/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -261,7 +269,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest<ConfigAsyncApi> {
|
||||||
|
|
||||||
public void testDeleteCategory() throws SecurityException, NoSuchMethodException {
|
public void testDeleteCategory() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(ConfigAsyncApi.class, "deleteCategory", CategoryDto.class);
|
Invokable<?, ?> method = method(ConfigAsyncApi.class, "deleteCategory", CategoryDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(ConfigResources.categoryPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(ConfigResources.categoryPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/config/categories/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/config/categories/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.jclouds.abiquo.domain.options.search.reference.OrderBy;
|
||||||
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ import com.abiquo.server.core.infrastructure.MachinesDto;
|
||||||
import com.abiquo.server.core.infrastructure.network.VLANNetworksDto;
|
import com.abiquo.server.core.infrastructure.network.VLANNetworksDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code EnterpriseAsyncApi}
|
* Tests annotation parsing of {@code EnterpriseAsyncApi}
|
||||||
*
|
*
|
||||||
|
@ -67,7 +69,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListEnterprises() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListEnterprises() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listEnterprises");
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listEnterprises");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -84,7 +86,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
EnterpriseOptions options = EnterpriseOptions.builder().has("abi").orderBy(OrderBy.NAME).ascendant(true).build();
|
EnterpriseOptions options = EnterpriseOptions.builder().has("abi").orderBy(OrderBy.NAME).ascendant(true).build();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listEnterprises", EnterpriseOptions.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listEnterprises", EnterpriseOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(options));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises?has=abi&by=name&asc=true HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises?has=abi&by=name&asc=true HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -102,7 +104,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listEnterprises", DatacenterDto.class,
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listEnterprises", DatacenterDto.class,
|
||||||
EnterpriseOptions.class);
|
EnterpriseOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), options));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/action/enterprises?network=true&startwith=0&limit=25 HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/action/enterprises?network=true&startwith=0&limit=25 HTTP/1.1");
|
||||||
|
@ -118,7 +121,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testCreateEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createEnterprise", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createEnterprise", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -134,7 +138,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testGetEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getEnterprise", Integer.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getEnterprise", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -149,7 +153,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testUpdateEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateEnterprise", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateEnterprise", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -165,7 +170,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testDeleteEnterprise() throws SecurityException, NoSuchMethodException {
|
public void testDeleteEnterprise() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteEnterprise", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteEnterprise", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -180,7 +186,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListAllowedDatacenters() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListAllowedDatacenters() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listAllowedDatacenters", Integer.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listAllowedDatacenters", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters?idEnterprise=1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters?idEnterprise=1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -195,7 +201,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListVirtualDatacentersFromEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualDatacentersFromEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualDatacenters", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualDatacenters", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/action/virtualdatacenters HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/action/virtualdatacenters HTTP/1.1");
|
||||||
|
@ -213,7 +220,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testGetEnterpriseProperties() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetEnterpriseProperties() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getEnterpriseProperties", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getEnterpriseProperties", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/properties HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/properties HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisePropertiesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisePropertiesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -227,8 +235,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdateEnterpriseProperties() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateEnterpriseProperties() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateEnterpriseProperties", EnterprisePropertiesDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateEnterpriseProperties",
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePropertiesPut()));
|
EnterprisePropertiesDto.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePropertiesPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/properties HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/properties HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisePropertiesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisePropertiesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -249,9 +259,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
DatacenterDto datacenter = InfrastructureResources.datacenterPut();
|
DatacenterDto datacenter = InfrastructureResources.datacenterPut();
|
||||||
DatacenterLimitsDto limits = EnterpriseResources.datacenterLimitsPost();
|
DatacenterLimitsDto limits = EnterpriseResources.datacenterLimitsPost();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createLimits", EnterpriseDto.class, DatacenterDto.class,
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createLimits", EnterpriseDto.class,
|
||||||
DatacenterLimitsDto.class);
|
DatacenterDto.class, DatacenterLimitsDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(enterprise, datacenter, limits));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(enterprise, datacenter, limits)));
|
||||||
|
|
||||||
String limitsUri = enterprise.searchLink("limits").getHref();
|
String limitsUri = enterprise.searchLink("limits").getHref();
|
||||||
String requestURI = String.format("POST %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());
|
String requestURI = String.format("POST %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());
|
||||||
|
@ -273,7 +284,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
DatacenterDto datacenter = InfrastructureResources.datacenterPut();
|
DatacenterDto datacenter = InfrastructureResources.datacenterPut();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getLimits", EnterpriseDto.class, DatacenterDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getLimits", EnterpriseDto.class, DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(enterprise, datacenter));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(enterprise, datacenter)));
|
||||||
|
|
||||||
String limitsUri = enterprise.searchLink("limits").getHref();
|
String limitsUri = enterprise.searchLink("limits").getHref();
|
||||||
String requestURI = String.format("GET %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());
|
String requestURI = String.format("GET %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId());
|
||||||
|
@ -293,8 +305,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
|
EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateLimits", DatacenterLimitsDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateLimits", DatacenterLimitsDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method,
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
ImmutableList.<Object> of(EnterpriseResources.datacenterLimitsPut(enterprise)));
|
ImmutableList.<Object> of(EnterpriseResources.datacenterLimitsPut(enterprise))));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/limits/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/limits/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterLimitsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterLimitsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -312,8 +324,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
|
EnterpriseDto enterprise = EnterpriseResources.enterprisePut();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteLimits", DatacenterLimitsDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteLimits", DatacenterLimitsDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method,
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
ImmutableList.<Object> of(EnterpriseResources.datacenterLimitsPut(enterprise)));
|
ImmutableList.<Object> of(EnterpriseResources.datacenterLimitsPut(enterprise))));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/limits/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/limits/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -328,7 +340,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListLimitsEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListLimitsEnterprise() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listLimits", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listLimits", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/limits HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/limits HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -345,7 +358,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testGetUser() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetUser() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getUser", EnterpriseDto.class, Integer.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getUser", EnterpriseDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -360,7 +374,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListUsers() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListUsers() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listUsers", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listUsers", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/users HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/users HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UsersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UsersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -378,7 +393,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
UserDto user = EnterpriseResources.userPost();
|
UserDto user = EnterpriseResources.userPost();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createUser", EnterpriseDto.class, UserDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createUser", EnterpriseDto.class, UserDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(enterprise, user));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(enterprise, user)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/users HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/users HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -394,7 +410,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testUpdateUser() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateUser() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateUser", UserDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateUser", UserDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.userPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.userPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -410,7 +427,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testDeleteUser() throws SecurityException, NoSuchMethodException {
|
public void testDeleteUser() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteUser", UserDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteUser", UserDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.userPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.userPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -425,7 +443,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListVirtualMachinesByUser() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualMachinesByUser() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualMachines", UserDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualMachines", UserDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.userPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.userPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/users/1/action/virtualmachines HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/users/1/action/virtualmachines HTTP/1.1");
|
||||||
|
@ -442,9 +461,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
/*********************** Datacenter Repository ********************** */
|
/*********************** Datacenter Repository ********************** */
|
||||||
|
|
||||||
public void testGetDatacenterRepository() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetDatacenterRepository() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getDatacenterRepository", EnterpriseDto.class, Integer.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getDatacenterRepository", EnterpriseDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut(),
|
Integer.class);
|
||||||
InfrastructureResources.datacenterPut().getId()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
|
EnterpriseResources.enterprisePut(), InfrastructureResources.datacenterPut().getId())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterRepositoryDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterRepositoryDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -458,9 +478,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRefreshTemplateRepository() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRefreshTemplateRepository() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "refreshTemplateRepository", Integer.class, Integer.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "refreshTemplateRepository", Integer.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut().getId(),
|
Integer.class);
|
||||||
InfrastructureResources.datacenterPut().getId()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
|
EnterpriseResources.enterprisePut().getId(), InfrastructureResources.datacenterPut().getId())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/actions/refresh HTTP/1.1");
|
"PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/actions/refresh HTTP/1.1");
|
||||||
|
@ -478,7 +499,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListExternalNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListExternalNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listExternalNetworks", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listExternalNetworks", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/externalnetworks HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/externalnetworks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -495,7 +517,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualMachines", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualMachines", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/virtualmachines HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/virtualmachines HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -510,7 +533,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListVirtualAppliances() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualAppliances() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualAppliances", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listVirtualAppliances", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/virtualappliances HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/virtualappliances HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualAppliancesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualAppliancesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -527,7 +551,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListReservedMachines() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListReservedMachines() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listReservedMachines", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listReservedMachines", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/reservedmachines HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/reservedmachines HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + MachinesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + MachinesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -544,7 +569,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
public void testListTemplateDefinitionLists() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListTemplateDefinitionLists() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listTemplateDefinitionLists", EnterpriseDto.class);
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listTemplateDefinitionLists", EnterpriseDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists HTTP/1.1");
|
||||||
|
@ -564,7 +590,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createTemplateDefinitionList", EnterpriseDto.class,
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "createTemplateDefinitionList", EnterpriseDto.class,
|
||||||
TemplateDefinitionListDto.class);
|
TemplateDefinitionListDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(enterprise, template));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(enterprise, template)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists HTTP/1.1");
|
"POST http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists HTTP/1.1");
|
||||||
|
@ -584,7 +611,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
|
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateTemplateDefinitionList",
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "updateTemplateDefinitionList",
|
||||||
TemplateDefinitionListDto.class);
|
TemplateDefinitionListDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(template));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(template)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1");
|
"PUT http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1");
|
||||||
|
@ -602,7 +629,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
public void testDeleteTemplateDefinitionList() throws SecurityException, NoSuchMethodException {
|
public void testDeleteTemplateDefinitionList() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteTemplateDefinitionList",
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "deleteTemplateDefinitionList",
|
||||||
TemplateDefinitionListDto.class);
|
TemplateDefinitionListDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.templateListPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.templateListPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1");
|
"DELETE http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1");
|
||||||
|
@ -619,7 +647,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
public void testGetTemplateDefinitionList() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTemplateDefinitionList() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getTemplateDefinitionList", EnterpriseDto.class,
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "getTemplateDefinitionList", EnterpriseDto.class,
|
||||||
Integer.class);
|
Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1");
|
||||||
|
@ -634,10 +663,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest<EnterpriseAsy
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListTemplateListStatus() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListTemplateListStatus() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listTemplateListStatus", TemplateDefinitionListDto.class,
|
Invokable<?, ?> method = method(EnterpriseAsyncApi.class, "listTemplateListStatus",
|
||||||
DatacenterDto.class);
|
TemplateDefinitionListDto.class, DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.templateListPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
InfrastructureResources.datacenterPut()));
|
ImmutableList.<Object> of(EnterpriseResources.templateListPut(), InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
|
|
|
@ -24,12 +24,14 @@ import static org.jclouds.reflect.Reflection2.method;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import com.abiquo.server.core.event.EventsDto;
|
import com.abiquo.server.core.event.EventsDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code EventAsyncApi}
|
* Tests annotation parsing of {@code EventAsyncApi}
|
||||||
*
|
*
|
||||||
|
@ -40,7 +42,7 @@ import com.google.common.reflect.Invokable;
|
||||||
public class EventAsyncApiTest extends BaseAbiquoAsyncApiTest<EventAsyncApi> {
|
public class EventAsyncApiTest extends BaseAbiquoAsyncApiTest<EventAsyncApi> {
|
||||||
public void testListEvents() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListEvents() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(EventAsyncApi.class, "listEvents");
|
Invokable<?, ?> method = method(EventAsyncApi.class, "listEvents");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/events HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/events HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + EventsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + EventsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
import org.jclouds.http.functions.ReturnStringIf2xx;
|
import org.jclouds.http.functions.ReturnStringIf2xx;
|
||||||
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
import org.jclouds.http.functions.ReturnTrueIf2xx;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -91,6 +92,7 @@ import com.abiquo.server.core.infrastructure.storage.TierDto;
|
||||||
import com.abiquo.server.core.infrastructure.storage.TiersDto;
|
import com.abiquo.server.core.infrastructure.storage.TiersDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code InfrastructureAsyncApi}
|
* Tests annotation parsing of {@code InfrastructureAsyncApi}
|
||||||
*
|
*
|
||||||
|
@ -102,7 +104,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListDatacenters() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListDatacenters() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listDatacenters");
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listDatacenters");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -117,7 +119,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testCreateDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createDatacenter", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createDatacenter", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -133,7 +136,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getDatacenter", Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getDatacenter", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -148,7 +151,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateDatacenter", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateDatacenter", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -164,7 +168,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testDeleteDatacenter() throws SecurityException, NoSuchMethodException {
|
public void testDeleteDatacenter() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteDatacenter", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteDatacenter", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -179,7 +184,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListLimitsDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListLimitsDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listLimits", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listLimits", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/action/getLimits HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/action/getLimits HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -195,10 +201,12 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
/*********************** Hypervisor ***********************/
|
/*********************** Hypervisor ***********************/
|
||||||
|
|
||||||
public void testGetHypervisorTypeFromMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetHypervisorTypeFromMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getHypervisorTypeFromMachine", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getHypervisorTypeFromMachine",
|
||||||
DatacenterOptions.class);
|
DatacenterDto.class, DatacenterOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
DatacenterOptions.builder().ip("10.60.1.120").build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
||||||
|
DatacenterOptions.builder().ip("10.60.1.120").build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/action/hypervisor?ip=10.60.1.120 HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/action/hypervisor?ip=10.60.1.120 HTTP/1.1");
|
||||||
|
@ -214,7 +222,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetHypervisorTypesFromDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetHypervisorTypesFromDatacenter() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getHypervisorTypes", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getHypervisorTypes", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/hypervisors HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/hypervisors HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + HypervisorTypesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + HypervisorTypesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -231,7 +240,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListRacks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListRacks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listRacks", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listRacks", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RacksDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RacksDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -246,8 +256,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testCreateRack() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateRack() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createRack", DatacenterDto.class, RackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createRack", DatacenterDto.class, RackDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
InfrastructureResources.rackPost()));
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), InfrastructureResources.rackPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -263,7 +273,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetRack() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetRack() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getRack", DatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getRack", DatacenterDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -278,7 +289,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateRack() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateRack() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateRack", RackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateRack", RackDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.rackPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.rackPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -294,7 +306,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testDeleteRack() throws SecurityException, NoSuchMethodException {
|
public void testDeleteRack() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteRack", RackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteRack", RackDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.rackPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.rackPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -311,7 +324,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListManagedRacks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListManagedRacks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listManagedRacks", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listManagedRacks", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRacksDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRacksDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -325,9 +339,12 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateManagedRack() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateManagedRack() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createManagedRack", DatacenterDto.class, UcsRackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createManagedRack", DatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
UcsRackDto.class);
|
||||||
InfrastructureResources.managedRackPost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
||||||
|
InfrastructureResources.managedRackPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -342,8 +359,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetManagedRack() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetManagedRack() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getManagedRack", DatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getManagedRack", DatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -359,7 +378,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testUpdateManagedRack() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateManagedRack() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateManagedRack", UcsRackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateManagedRack", UcsRackDto.class);
|
||||||
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -375,7 +395,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListServiceProfiles() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListServiceProfiles() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfiles", UcsRackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfiles", UcsRackDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/logicservers HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/logicservers HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + LogicServersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + LogicServersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -393,7 +414,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfiles", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfiles", UcsRackDto.class,
|
||||||
FilterOptions.class);
|
FilterOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), options));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/logicservers?startwith=1&limit=2 HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/logicservers?startwith=1&limit=2 HTTP/1.1");
|
||||||
|
@ -409,7 +431,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListOrganizations() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListOrganizations() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listOrganizations", UcsRackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listOrganizations", UcsRackDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/organizations HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/organizations HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + OrganizationsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + OrganizationsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -425,8 +448,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testListOrganizationsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListOrganizationsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
FilterOptions options = FilterOptions.builder().has("org").build();
|
FilterOptions options = FilterOptions.builder().has("org").build();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listOrganizations", UcsRackDto.class, FilterOptions.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listOrganizations", UcsRackDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), options));
|
FilterOptions.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/organizations?has=org HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/organizations?has=org HTTP/1.1");
|
||||||
|
@ -442,7 +467,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListServiceProfileTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListServiceProfileTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfileTemplates", UcsRackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfileTemplates", UcsRackDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/lstemplates HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/lstemplates HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + LogicServersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + LogicServersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -461,7 +487,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfileTemplates", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listServiceProfileTemplates", UcsRackDto.class,
|
||||||
FilterOptions.class);
|
FilterOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), options));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/lstemplates?asc=true HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/lstemplates?asc=true HTTP/1.1");
|
||||||
|
@ -478,8 +505,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testAssociateLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAssociateLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "associateLogicServer", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "associateLogicServer", UcsRackDto.class,
|
||||||
LogicServerDto.class, OrganizationDto.class, String.class);
|
LogicServerDto.class, OrganizationDto.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "blade"));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
||||||
|
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "blade")));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
|
@ -497,8 +526,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testAssociateTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testAssociateTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "associateTemplate", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "associateTemplate", UcsRackDto.class,
|
||||||
LogicServerDto.class, OrganizationDto.class, String.class, String.class);
|
LogicServerDto.class, OrganizationDto.class, String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "newname", "blade"));
|
InfrastructureResources.managedRackPut(), InfrastructureResources.logicServerPut(),
|
||||||
|
InfrastructureResources.organizationPut(), "newname", "blade")));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
|
@ -516,8 +546,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testCloneAndAssociateLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCloneAndAssociateLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "cloneAndAssociateLogicServer", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "cloneAndAssociateLogicServer", UcsRackDto.class,
|
||||||
LogicServerDto.class, OrganizationDto.class, String.class, String.class);
|
LogicServerDto.class, OrganizationDto.class, String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "newname", "blade"));
|
InfrastructureResources.managedRackPut(), InfrastructureResources.logicServerPut(),
|
||||||
|
InfrastructureResources.organizationPut(), "newname", "blade")));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
|
@ -535,8 +566,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testDissociateLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDissociateLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "dissociateLogicServer", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "dissociateLogicServer", UcsRackDto.class,
|
||||||
LogicServerDto.class);
|
LogicServerDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
||||||
|
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/dissociate?lsName=server HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/dissociate?lsName=server HTTP/1.1");
|
||||||
|
@ -553,8 +586,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testCloneLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCloneLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "cloneLogicServer", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "cloneLogicServer", UcsRackDto.class,
|
||||||
LogicServerDto.class, OrganizationDto.class, String.class);
|
LogicServerDto.class, OrganizationDto.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "name"));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
||||||
|
InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "name")));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(
|
||||||
request,
|
request,
|
||||||
|
@ -572,8 +607,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testDeleteLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDeleteLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteLogicServer", UcsRackDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteLogicServer", UcsRackDto.class,
|
||||||
LogicServerDto.class);
|
LogicServerDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
InfrastructureResources.logicServerPut()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(),
|
||||||
|
InfrastructureResources.logicServerPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/delete?lsName=server HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/logicservers/delete?lsName=server HTTP/1.1");
|
||||||
|
@ -589,7 +626,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListFsms() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListFsms() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listFsms", UcsRackDto.class, String.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listFsms", UcsRackDto.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), "dn"));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.managedRackPut(), "dn")));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/fsm?dn=dn HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/fsm?dn=dn HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + FsmsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + FsmsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -606,7 +644,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListRemoteServices() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListRemoteServices() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listRemoteServices", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listRemoteServices", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/remoteservices HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/remoteservices HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RemoteServicesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RemoteServicesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -622,8 +661,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testCreateRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createRemoteService", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createRemoteService", DatacenterDto.class,
|
||||||
RemoteServiceDto.class);
|
RemoteServiceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
InfrastructureResources.remoteServicePost()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
||||||
|
InfrastructureResources.remoteServicePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/remoteservices HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/remoteservices HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + RemoteServiceDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + RemoteServiceDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -640,8 +681,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testGetRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getRemoteService", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getRemoteService", DatacenterDto.class,
|
||||||
RemoteServiceType.class);
|
RemoteServiceType.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
RemoteServiceType.STORAGE_SYSTEM_MONITOR));
|
InfrastructureResources.datacenterPut(), RemoteServiceType.STORAGE_SYSTEM_MONITOR)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/remoteservices/storagesystemmonitor HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/remoteservices/storagesystemmonitor HTTP/1.1");
|
||||||
|
@ -657,7 +698,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateRemoteService", RemoteServiceDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateRemoteService", RemoteServiceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.remoteServicePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.remoteServicePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/admin/datacenters/1/remoteservices/nodecollector HTTP/1.1");
|
"PUT http://localhost/api/admin/datacenters/1/remoteservices/nodecollector HTTP/1.1");
|
||||||
|
@ -674,7 +716,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testDeleteRemoteService() throws SecurityException, NoSuchMethodException {
|
public void testDeleteRemoteService() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteRemoteService", RemoteServiceDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteRemoteService", RemoteServiceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.remoteServicePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.remoteServicePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/admin/datacenters/1/remoteservices/nodecollector HTTP/1.1");
|
"DELETE http://localhost/api/admin/datacenters/1/remoteservices/nodecollector HTTP/1.1");
|
||||||
|
@ -690,7 +733,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testIsAvailableRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
public void testIsAvailableRemoteService() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "isAvailable", RemoteServiceDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "isAvailable", RemoteServiceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.remoteServicePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.remoteServicePut())));
|
||||||
|
|
||||||
String checkUri = InfrastructureResources.remoteServicePut().searchLink("check").getHref();
|
String checkUri = InfrastructureResources.remoteServicePut().searchLink("check").getHref();
|
||||||
assertRequestLineEquals(request, String.format("GET %s HTTP/1.1", checkUri));
|
assertRequestLineEquals(request, String.format("GET %s HTTP/1.1", checkUri));
|
||||||
|
@ -709,8 +753,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testDiscoverSingleMachineWithoutOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testDiscoverSingleMachineWithoutOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class,
|
||||||
String.class, HypervisorType.class, String.class, String.class);
|
String.class, HypervisorType.class, String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass"));
|
InfrastructureResources.datacenterPut(), "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 = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass";
|
String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass";
|
||||||
|
@ -730,8 +774,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testDiscoverSingleMachineAllParams() throws SecurityException, NoSuchMethodException {
|
public void testDiscoverSingleMachineAllParams() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class,
|
||||||
String.class, HypervisorType.class, String.class, String.class, MachineOptions.class);
|
String.class, HypervisorType.class, String.class, String.class, MachineOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().port(8889).build()));
|
InfrastructureResources.datacenterPut(), "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 = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass&port=8889";
|
String query = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass&port=8889";
|
||||||
|
@ -751,8 +796,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testDiscoverSingleMachineDefaultValues() throws SecurityException, NoSuchMethodException {
|
public void testDiscoverSingleMachineDefaultValues() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class,
|
||||||
String.class, HypervisorType.class, String.class, String.class, MachineOptions.class);
|
String.class, HypervisorType.class, String.class, String.class, MachineOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().build()));
|
InfrastructureResources.datacenterPut(), "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 = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass";
|
String query = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass";
|
||||||
|
@ -773,8 +819,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverMultipleMachines", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverMultipleMachines", DatacenterDto.class,
|
||||||
String.class, String.class, HypervisorType.class, String.class, String.class);
|
String.class, String.class, HypervisorType.class, String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"10.60.1.222", "10.60.1.250", HypervisorType.XENSERVER, "user", "pass"));
|
InfrastructureResources.datacenterPut(), "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 = "ipFrom=10.60.1.222&ipTo=10.60.1.250&hypervisor=XENSERVER&user=user&password=pass";
|
String query = "ipFrom=10.60.1.222&ipTo=10.60.1.250&hypervisor=XENSERVER&user=user&password=pass";
|
||||||
|
@ -794,9 +841,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testDiscoverMultipleMachinesAllParams() throws SecurityException, NoSuchMethodException {
|
public void testDiscoverMultipleMachinesAllParams() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverMultipleMachines", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "discoverMultipleMachines", DatacenterDto.class,
|
||||||
String.class, String.class, HypervisorType.class, String.class, String.class, MachineOptions.class);
|
String.class, String.class, HypervisorType.class, String.class, String.class, MachineOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"80.80.80.80", "80.80.80.86", HypervisorType.KVM, "user", "pass", MachineOptions.builder().port(8889)
|
InfrastructureResources.datacenterPut(), "80.80.80.80", "80.80.80.86", HypervisorType.KVM, "user", "pass",
|
||||||
.build()));
|
MachineOptions.builder().port(8889).build())));
|
||||||
|
|
||||||
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discovermultiple";
|
String baseUrl = "http://localhost/api/admin/datacenters/1/action/discovermultiple";
|
||||||
String query = "ipFrom=80.80.80.80&ipTo=80.80.80.86&hypervisor=KVM&user=user&password=pass&port=8889";
|
String query = "ipFrom=80.80.80.80&ipTo=80.80.80.86&hypervisor=KVM&user=user&password=pass&port=8889";
|
||||||
|
@ -814,10 +861,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckMachineStateWithoutOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCheckMachineStateWithoutOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class, String.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class,
|
||||||
HypervisorType.class, String.class, String.class);
|
String.class, HypervisorType.class, String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass"));
|
InfrastructureResources.datacenterPut(), "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 = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass";
|
String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass";
|
||||||
|
@ -835,10 +882,11 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckMachineStateAllParams() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCheckMachineStateAllParams() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class, String.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class,
|
||||||
HypervisorType.class, String.class, String.class, MachineOptions.class);
|
String.class, HypervisorType.class, String.class, String.class, MachineOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"10.60.1.222", HypervisorType.XENSERVER, "user", "pass", MachineOptions.builder().port(8889).build()));
|
InfrastructureResources.datacenterPut(), "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 = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass&port=8889";
|
String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass&port=8889";
|
||||||
|
@ -858,8 +906,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testCheckMachineIpmiStateWithoutOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCheckMachineIpmiStateWithoutOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", DatacenterDto.class,
|
||||||
String.class, String.class, String.class);
|
String.class, String.class, String.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
"10.60.1.222", "user", "pass"));
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), "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 = "ip=10.60.1.222&user=user&password=pass";
|
String query = "ip=10.60.1.222&user=user&password=pass";
|
||||||
|
@ -879,8 +927,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testCheckMachineIpmiStateWithALLOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCheckMachineIpmiStateWithALLOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", DatacenterDto.class,
|
||||||
String.class, String.class, String.class, IpmiOptions.class);
|
String.class, String.class, String.class, IpmiOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
"10.60.1.222", "user", "pass", IpmiOptions.builder().port(8889).build()));
|
InfrastructureResources.datacenterPut(), "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 = "ip=10.60.1.222&user=user&password=pass&port=8889";
|
String query = "ip=10.60.1.222&user=user&password=pass&port=8889";
|
||||||
|
@ -899,7 +948,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListMachines() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListMachines() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listMachines", RackDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listMachines", RackDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.rackPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.rackPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + MachinesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + MachinesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -914,7 +964,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getMachine", RackDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getMachine", RackDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.rackPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.rackPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -928,8 +979,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckMachineState() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCheckMachineState() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineState", MachineDto.class, boolean.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineState", MachineDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut(), true));
|
boolean.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut(), true)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/checkstate?sync=true HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/checkstate?sync=true HTTP/1.1");
|
||||||
|
@ -945,7 +998,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testCheckMachineIpmiState() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCheckMachineIpmiState() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/checkipmistate HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/checkipmistate HTTP/1.1");
|
||||||
|
@ -961,8 +1015,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testCreateMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createMachine", RackDto.class, MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createMachine", RackDto.class, MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.rackPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
InfrastructureResources.machinePost()));
|
ImmutableList.<Object> of(InfrastructureResources.rackPut(), InfrastructureResources.machinePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks/1/machines HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks/1/machines HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -978,7 +1032,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateMachine", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateMachine", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -994,7 +1049,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testDeleteMachine() throws SecurityException, NoSuchMethodException {
|
public void testDeleteMachine() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteMachine", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteMachine", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -1008,9 +1064,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReserveMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testReserveMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "reserveMachine", EnterpriseDto.class, MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "reserveMachine", EnterpriseDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut(),
|
MachineDto.class);
|
||||||
InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut(), InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/reservedmachines HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/reservedmachines HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1025,9 +1082,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCancelReservation() throws SecurityException, NoSuchMethodException {
|
public void testCancelReservation() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "cancelReservation", EnterpriseDto.class, MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "cancelReservation", EnterpriseDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(EnterpriseResources.enterprisePut(),
|
MachineDto.class);
|
||||||
InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(EnterpriseResources.enterprisePut(), InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/reservedmachines/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/reservedmachines/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -1045,7 +1103,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listVirtualMachinesByMachine", MachineDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listVirtualMachinesByMachine", MachineDto.class,
|
||||||
MachineOptions.class);
|
MachineOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut(), options));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/virtualmachines?sync=true HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/virtualmachines?sync=true HTTP/1.1");
|
||||||
|
@ -1061,8 +1120,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetVirtualMachineByMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualMachineByMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
|
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getVirtualMachine", MachineDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getVirtualMachine", MachineDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/virtualmachines/1 HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/virtualmachines/1 HTTP/1.1");
|
||||||
|
@ -1080,7 +1141,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testPowerOff() throws SecurityException, NoSuchMethodException, IOException {
|
public void testPowerOff() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "powerOff", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "powerOff", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/poweroff HTTP/1.1");
|
"PUT http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/poweroff HTTP/1.1");
|
||||||
|
@ -1096,7 +1158,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testPowerOn() throws SecurityException, NoSuchMethodException, IOException {
|
public void testPowerOn() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "powerOn", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "powerOn", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/poweron HTTP/1.1");
|
"PUT http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/poweron HTTP/1.1");
|
||||||
|
@ -1112,7 +1175,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetLogicServer() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getLogicServer", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getLogicServer", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/logicserver HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/logicserver HTTP/1.1");
|
||||||
|
@ -1128,7 +1192,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testLedOn() throws SecurityException, NoSuchMethodException, IOException {
|
public void testLedOn() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "ledOn", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "ledOn", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/ledon HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/ledon HTTP/1.1");
|
||||||
|
@ -1144,7 +1209,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testLedOff() throws SecurityException, NoSuchMethodException, IOException {
|
public void testLedOff() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "ledOff", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "ledOff", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/ledoff HTTP/1.1");
|
"POST http://localhost/api/admin/datacenters/1/racks/1/machines/1/action/ledoff HTTP/1.1");
|
||||||
|
@ -1160,7 +1226,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetLocatorLed() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetLocatorLed() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getLocatorLed", MachineDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getLocatorLed", MachineDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.machinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.machinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/led HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/led HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + BladeLocatorLedDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + BladeLocatorLedDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1177,7 +1244,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListStorageDevices() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListStorageDevices() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStorageDevices", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStorageDevices", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDevicesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDevicesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1192,7 +1260,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListSupportedStorageDevices() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListSupportedStorageDevices() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listSupportedStorageDevices", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listSupportedStorageDevices", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/storage/devices/action/supported HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/storage/devices/action/supported HTTP/1.1");
|
||||||
|
@ -1209,8 +1278,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testCreateStorageDevice() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateStorageDevice() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createStorageDevice", DatacenterDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createStorageDevice", DatacenterDto.class,
|
||||||
StorageDeviceDto.class);
|
StorageDeviceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
InfrastructureResources.storageDevicePost()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
||||||
|
InfrastructureResources.storageDevicePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/storage/devices HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/storage/devices HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1226,7 +1297,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testDeleteStorageDevice() throws SecurityException, NoSuchMethodException {
|
public void testDeleteStorageDevice() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteStorageDevice", StorageDeviceDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteStorageDevice", StorageDeviceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storageDevicePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.storageDevicePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -1241,7 +1313,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateStorageDevice() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateStorageDevice() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateStorageDevice", StorageDeviceDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateStorageDevice", StorageDeviceDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storageDevicePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.storageDevicePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1256,8 +1329,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetStorageDevice() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetStorageDevice() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getStorageDevice", DatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getStorageDevice", DatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1274,7 +1349,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListTiers() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListTiers() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listTiers", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listTiers", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TiersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TiersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1289,7 +1365,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateTier() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateTier() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateTier", TierDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateTier", TierDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.tierPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.tierPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/storage/tiers/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/storage/tiers/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1305,7 +1382,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetTier() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTier() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getTier", DatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getTier", DatacenterDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1323,8 +1401,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testListSyncStoragePools() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListSyncStoragePools() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStoragePools", StorageDeviceDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStoragePools", StorageDeviceDto.class,
|
||||||
StoragePoolOptions.class);
|
StoragePoolOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storageDevicePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
StoragePoolOptions.builder().sync(true).build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.storageDevicePut(),
|
||||||
|
StoragePoolOptions.builder().sync(true).build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools?sync=true HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools?sync=true HTTP/1.1");
|
||||||
|
@ -1340,8 +1420,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListStoragePoolsFromTier() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListStoragePoolsFromTier() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStoragePools", TierDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStoragePools", TierDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.tierPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
StoragePoolOptions.builder().sync(true).build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.tierPut(), StoragePoolOptions.builder().sync(true)
|
||||||
|
.build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers/1/pools HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers/1/pools HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1357,8 +1439,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testListStoragePoolsNoParams() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListStoragePoolsNoParams() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStoragePools", StorageDeviceDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listStoragePools", StorageDeviceDto.class,
|
||||||
StoragePoolOptions.class);
|
StoragePoolOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storageDevicePut(),
|
GeneratedHttpRequest request = processor
|
||||||
StoragePoolOptions.builder().build()));
|
.apply(Invocation.create(method, ImmutableList.<Object> of(InfrastructureResources.storageDevicePut(),
|
||||||
|
StoragePoolOptions.builder().build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1374,8 +1457,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testCreateStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createStoragePool", StorageDeviceDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createStoragePool", StorageDeviceDto.class,
|
||||||
StoragePoolDto.class);
|
StoragePoolDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storageDevicePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
InfrastructureResources.storagePoolPost()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.storageDevicePut(),
|
||||||
|
InfrastructureResources.storagePoolPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/storage/devices/1/pools HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/storage/devices/1/pools HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1391,7 +1476,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateStoragePool", StoragePoolDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateStoragePool", StoragePoolDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storagePoolPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.storagePoolPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"PUT http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1");
|
"PUT http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1");
|
||||||
|
@ -1408,7 +1494,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testDeleteStoragePool() throws SecurityException, NoSuchMethodException {
|
public void testDeleteStoragePool() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteStoragePool", StoragePoolDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteStoragePool", StoragePoolDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storagePoolPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.storagePoolPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"DELETE http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1");
|
"DELETE http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1");
|
||||||
|
@ -1423,9 +1510,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getStoragePool", StorageDeviceDto.class, String.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getStoragePool", StorageDeviceDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storageDevicePut(),
|
String.class);
|
||||||
InfrastructureResources.storagePoolPut().getIdStorage()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
|
InfrastructureResources.storageDevicePut(), InfrastructureResources.storagePoolPut().getIdStorage())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1");
|
||||||
|
@ -1442,8 +1530,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testRefreshStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
public void testRefreshStoragePool() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "refreshStoragePool", StoragePoolDto.class,
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "refreshStoragePool", StoragePoolDto.class,
|
||||||
StoragePoolOptions.class);
|
StoragePoolOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.storagePoolPut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
StoragePoolOptions.builder().sync(true).build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.storagePoolPut(), StoragePoolOptions.builder().sync(true)
|
||||||
|
.build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu?sync=true HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu?sync=true HTTP/1.1");
|
||||||
|
@ -1461,7 +1551,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listNetworks", DatacenterDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listNetworks", DatacenterDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1477,8 +1568,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
public void testListNetworksWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListNetworksWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
NetworkOptions options = NetworkOptions.builder().type(NetworkType.PUBLIC).build();
|
NetworkOptions options = NetworkOptions.builder().type(NetworkType.PUBLIC).build();
|
||||||
|
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listNetworks", DatacenterDto.class, NetworkOptions.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listNetworks", DatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), options));
|
NetworkOptions.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network?type=PUBLIC HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network?type=PUBLIC HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1493,7 +1586,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetNetworks() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getNetwork", DatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getNetwork", DatacenterDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1507,9 +1601,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createNetwork", DatacenterDto.class, VLANNetworkDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "createNetwork", DatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(),
|
VLANNetworkDto.class);
|
||||||
NetworkResources.vlanPost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), NetworkResources.vlanPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/network HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/network HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1525,7 +1620,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testUpdateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateNetwork() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateNetwork", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "updateNetwork", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.publicNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.publicNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1541,7 +1637,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testDeleteNetwork() throws SecurityException, NoSuchMethodException {
|
public void testDeleteNetwork() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteNetwork", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "deleteNetwork", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.publicNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.publicNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -1555,8 +1652,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCheckTagAvailability() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCheckTagAvailability() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkTagAvailability", DatacenterDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "checkTagAvailability", DatacenterDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 2));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(InfrastructureResources.datacenterPut(), 2)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/network/action/checkavailability?tag=2 HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/network/action/checkavailability?tag=2 HTTP/1.1");
|
||||||
|
@ -1574,7 +1673,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListPublicIps() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPublicIps() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listPublicIps", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listPublicIps", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.publicNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.publicNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1/ips HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1/ips HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PublicIpsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PublicIpsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1589,8 +1689,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListPublicIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPublicIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
IpOptions options = IpOptions.builder().startWith(10).build();
|
IpOptions options = IpOptions.builder().startWith(10).build();
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listPublicIps", VLANNetworkDto.class, IpOptions.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listPublicIps", VLANNetworkDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.publicNetworkPut(), options));
|
IpOptions.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.publicNetworkPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/datacenters/1/network/1/ips?startwith=10 HTTP/1.1");
|
"GET http://localhost/api/admin/datacenters/1/network/1/ips?startwith=10 HTTP/1.1");
|
||||||
|
@ -1606,7 +1708,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testGetPublicIp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPublicIp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getPublicIp", VLANNetworkDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getPublicIp", VLANNetworkDto.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.publicNetworkPut(), 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.publicNetworkPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1/ips/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1/ips/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PublicIpDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PublicIpDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -1621,7 +1724,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListExternalIps() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListExternalIps() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listExternalIps", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listExternalIps", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.externalNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.externalNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips HTTP/1.1");
|
||||||
|
@ -1637,8 +1741,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListExternalIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListExternalIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
IpOptions options = IpOptions.builder().startWith(10).build();
|
IpOptions options = IpOptions.builder().startWith(10).build();
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listExternalIps", VLANNetworkDto.class, IpOptions.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listExternalIps", VLANNetworkDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.externalNetworkPut(), options));
|
IpOptions.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.externalNetworkPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips?startwith=10 HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips?startwith=10 HTTP/1.1");
|
||||||
|
@ -1653,8 +1759,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetExternalIp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetExternalIp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getExternalIp", VLANNetworkDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getExternalIp", VLANNetworkDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.externalNetworkPut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.externalNetworkPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips/1 HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips/1 HTTP/1.1");
|
||||||
|
@ -1670,7 +1778,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListUnmanagedIps() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListUnmanagedIps() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listUnmanagedIps", VLANNetworkDto.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listUnmanagedIps", VLANNetworkDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.unmanagedNetworkPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.unmanagedNetworkPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips HTTP/1.1");
|
||||||
|
@ -1686,8 +1795,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
|
|
||||||
public void testListUnmanagedIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListUnmanagedIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
IpOptions options = IpOptions.builder().startWith(10).build();
|
IpOptions options = IpOptions.builder().startWith(10).build();
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listUnmanagedIps", VLANNetworkDto.class, IpOptions.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "listUnmanagedIps", VLANNetworkDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.unmanagedNetworkPut(), options));
|
IpOptions.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.unmanagedNetworkPut(), options)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips?startwith=10 HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips?startwith=10 HTTP/1.1");
|
||||||
|
@ -1702,8 +1813,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest<Infrastru
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetUnmanagedIp() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetUnmanagedIp() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getUnmanagedIp", VLANNetworkDto.class, Integer.class);
|
Invokable<?, ?> method = method(InfrastructureAsyncApi.class, "getUnmanagedIp", VLANNetworkDto.class,
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(NetworkResources.externalNetworkPut(), 1));
|
Integer.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(NetworkResources.externalNetworkPut(), 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips/1 HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips/1 HTTP/1.1");
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
import org.jclouds.abiquo.domain.PricingResources;
|
import org.jclouds.abiquo.domain.PricingResources;
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ import com.abiquo.server.core.pricing.PricingTierDto;
|
||||||
import com.abiquo.server.core.pricing.PricingTiersDto;
|
import com.abiquo.server.core.pricing.PricingTiersDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code PricingAsyncApi}.
|
* Tests annotation parsing of {@code PricingAsyncApi}.
|
||||||
*
|
*
|
||||||
|
@ -56,7 +58,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testListCurrencies() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListCurrencies() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "listCurrencies");
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "listCurrencies");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/currencies HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/currencies HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CurrenciesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CurrenciesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -71,7 +73,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetCurrency() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetCurrency() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getCurrency", Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getCurrency", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/currencies/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/currencies/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -86,7 +88,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testCreateCurrency() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateCurrency() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "createCurrency", CurrencyDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "createCurrency", CurrencyDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.currencyPost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.currencyPost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/config/currencies HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/config/currencies HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -102,7 +105,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testUpdateCurrency() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateCurrency() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "updateCurrency", CurrencyDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "updateCurrency", CurrencyDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.currencyPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.currencyPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/currencies/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/currencies/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -118,7 +122,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testDeleteCurrency() throws SecurityException, NoSuchMethodException {
|
public void testDeleteCurrency() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "deleteCurrency", CurrencyDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "deleteCurrency", CurrencyDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.currencyPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.currencyPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/config/currencies/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/config/currencies/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -135,7 +140,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testListCostCodes() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListCostCodes() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "listCostCodes");
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "listCostCodes");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/costcodes HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/costcodes HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -150,7 +155,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getCostCode", Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getCostCode", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/costcodes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/costcodes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -165,7 +170,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testCreateCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreateCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "createCostCode", CostCodeDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "createCostCode", CostCodeDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.costcodePost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.costcodePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/config/costcodes HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/config/costcodes HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -181,7 +187,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testUpdateCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "updateCostCode", CostCodeDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "updateCostCode", CostCodeDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.costcodePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.costcodePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/costcodes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/costcodes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -197,7 +204,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testDeleteCostCode() throws SecurityException, NoSuchMethodException {
|
public void testDeleteCostCode() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "deleteCostCode", CostCodeDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "deleteCostCode", CostCodeDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.costcodePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.costcodePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/config/costcodes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/config/costcodes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -214,7 +222,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testListPricingTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListPricingTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "listPricingTemplates");
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "listPricingTemplates");
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.of()));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplatesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplatesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -229,7 +237,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetPricingTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPricingTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingTemplate", Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingTemplate", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -244,7 +252,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testCreatePricingTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testCreatePricingTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "createPricingTemplate", PricingTemplateDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "createPricingTemplate", PricingTemplateDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.pricingtemplatePost()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.pricingtemplatePost())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "POST http://localhost/api/config/pricingtemplates HTTP/1.1");
|
assertRequestLineEquals(request, "POST http://localhost/api/config/pricingtemplates HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -260,7 +269,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testUpdatePricingTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdatePricingTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "updatePricingTemplate", PricingTemplateDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "updatePricingTemplate", PricingTemplateDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.pricingtemplatePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.pricingtemplatePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -276,7 +286,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testDeletePricingTemplate() throws SecurityException, NoSuchMethodException {
|
public void testDeletePricingTemplate() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "deletePricingTemplate", PricingTemplateDto.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "deletePricingTemplate", PricingTemplateDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.pricingtemplatePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.pricingtemplatePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "DELETE http://localhost/api/config/pricingtemplates/1 HTTP/1.1");
|
assertRequestLineEquals(request, "DELETE http://localhost/api/config/pricingtemplates/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
|
@ -293,7 +304,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetCostCodeCurrencies() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetCostCodeCurrencies() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getCostCodeCurrencies", Integer.class, Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getCostCodeCurrencies", Integer.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1, 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/costcodes/1/currencies?idCurrency=1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/costcodes/1/currencies?idCurrency=1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeCurrenciesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeCurrenciesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -309,7 +320,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
public void testUpdateCostCodeCurrencies() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateCostCodeCurrencies() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "updateCostCodeCurrencies", Integer.class,
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "updateCostCodeCurrencies", Integer.class,
|
||||||
CostCodeCurrenciesDto.class);
|
CostCodeCurrenciesDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, PricingResources.costcodecurrencyPut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(1, PricingResources.costcodecurrencyPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/costcodes/1/currencies HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/costcodes/1/currencies HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeCurrenciesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeCurrenciesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -327,7 +339,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetPricingCostCodes() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPricingCostCodes() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingCostCodes", Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingCostCodes", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/costcodes HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/costcodes HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodesDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodesDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -342,7 +354,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetPricingCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPricingCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingCostCode", Integer.class, Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingCostCode", Integer.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1, 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/costcodes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/costcodes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodeDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodeDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -356,9 +368,10 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdatePricingCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdatePricingCostCode() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "updatePricingCostCode", PricingCostCodeDto.class, Integer.class,
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "updatePricingCostCode", PricingCostCodeDto.class,
|
||||||
Integer.class);
|
Integer.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.pricingCostcodePut(), 1, 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.pricingCostcodePut(), 1, 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1/costcodes/1 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1/costcodes/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodeDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodeDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -376,7 +389,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetPricingTiers() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPricingTiers() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingTiers", Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingTiers", Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/tiers HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/tiers HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTiersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTiersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -391,7 +404,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
|
|
||||||
public void testGetPricingTier() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetPricingTier() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingTier", Integer.class, Integer.class);
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "getPricingTier", Integer.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1, 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/tiers/1 HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/tiers/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTierDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTierDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
@ -407,7 +420,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest<PricingAsyncApi>
|
||||||
public void testUpdatePricingTier() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdatePricingTier() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(PricingAsyncApi.class, "updatePricingTier", PricingTierDto.class, Integer.class,
|
Invokable<?, ?> method = method(PricingAsyncApi.class, "updatePricingTier", PricingTierDto.class, Integer.class,
|
||||||
Integer.class);
|
Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(PricingResources.pricingTierPut(), 1, 2));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(PricingResources.pricingTierPut(), 1, 2)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1/tiers/2 HTTP/1.1");
|
assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1/tiers/2 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTierDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + PricingTierDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.jclouds.abiquo.AbiquoFallbacks.NullOn303;
|
||||||
import org.jclouds.abiquo.domain.CloudResources;
|
import org.jclouds.abiquo.domain.CloudResources;
|
||||||
import org.jclouds.abiquo.domain.TemplateResources;
|
import org.jclouds.abiquo.domain.TemplateResources;
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ import com.abiquo.server.core.task.TaskDto;
|
||||||
import com.abiquo.server.core.task.TasksDto;
|
import com.abiquo.server.core.task.TasksDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code TaskAsyncApi}
|
* Tests annotation parsing of {@code TaskAsyncApi}
|
||||||
*
|
*
|
||||||
|
@ -48,16 +50,14 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest<TaskAsyncApi> {
|
||||||
|
|
||||||
public void testGetTaskVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTaskVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(TaskAsyncApi.class, "getTask", RESTLink.class);
|
Invokable<?, ?> method = method(TaskAsyncApi.class, "getTask", RESTLink.class);
|
||||||
GeneratedHttpRequest request = processor
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
.createRequest(
|
ImmutableList.<Object> of(new RESTLink("task",
|
||||||
method,
|
"http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1"
|
||||||
ImmutableList.<Object> of(new RESTLink(
|
+ "/tasks/169f1877-5f17-4f62-9563-974001295c54"))));
|
||||||
"task",
|
|
||||||
"http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks/169f1877-5f17-4f62-9563-974001295c54")));
|
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(request,
|
||||||
request,
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/"
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1");
|
+ "tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TaskDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TaskDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -70,7 +70,8 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest<TaskAsyncApi> {
|
||||||
|
|
||||||
public void testListTasksVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListTasksVirtualMachine() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(TaskAsyncApi.class, "listTasks", SingleResourceTransportDto.class);
|
Invokable<?, ?> method = method(TaskAsyncApi.class, "listTasks", SingleResourceTransportDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(CloudResources.virtualMachinePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(CloudResources.virtualMachinePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks HTTP/1.1");
|
"GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks HTTP/1.1");
|
||||||
|
@ -86,16 +87,14 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest<TaskAsyncApi> {
|
||||||
|
|
||||||
public void testGetTaskVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetTaskVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(TaskAsyncApi.class, "getTask", RESTLink.class);
|
Invokable<?, ?> method = method(TaskAsyncApi.class, "getTask", RESTLink.class);
|
||||||
GeneratedHttpRequest request = processor
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
.createRequest(
|
ImmutableList.<Object> of(new RESTLink("task",
|
||||||
method,
|
"http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/"
|
||||||
ImmutableList.<Object> of(new RESTLink(
|
+ "tasks/169f1877-5f17-4f62-9563-974001295c54"))));
|
||||||
"task",
|
|
||||||
"http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/tasks/169f1877-5f17-4f62-9563-974001295c54")));
|
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(request,
|
||||||
request,
|
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1"
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1");
|
+ "/tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TaskDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TaskDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -108,10 +107,11 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest<TaskAsyncApi> {
|
||||||
|
|
||||||
public void testListTasksVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListTasksVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(TaskAsyncApi.class, "listTasks", SingleResourceTransportDto.class);
|
Invokable<?, ?> method = method(TaskAsyncApi.class, "listTasks", SingleResourceTransportDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/"
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/tasks HTTP/1.1");
|
+ "virtualmachinetemplates/1/tasks HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + TasksDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + TasksDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.jclouds.abiquo.domain.cloud.options.VirtualMachineTemplateOptions;
|
||||||
import org.jclouds.abiquo.functions.ReturnTaskReferenceOrNull;
|
import org.jclouds.abiquo.functions.ReturnTaskReferenceOrNull;
|
||||||
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
import org.jclouds.http.functions.ParseXMLWithJAXB;
|
||||||
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
import org.jclouds.http.functions.ReleasePayloadAndReturn;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ import com.abiquo.server.core.appslibrary.VirtualMachineTemplatePersistentDto;
|
||||||
import com.abiquo.server.core.appslibrary.VirtualMachineTemplatesDto;
|
import com.abiquo.server.core.appslibrary.VirtualMachineTemplatesDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code VirtualMachineTemplateAsyncApi}
|
* Tests annotation parsing of {@code VirtualMachineTemplateAsyncApi}
|
||||||
*
|
*
|
||||||
|
@ -56,9 +58,9 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
/*********************** Virtual Machine Template ***********************/
|
/*********************** Virtual Machine Template ***********************/
|
||||||
|
|
||||||
public void testListVirtualMachineTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListVirtualMachineTemplates() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates", Integer.class,
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates",
|
||||||
Integer.class);
|
Integer.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1, 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates HTTP/1.1");
|
||||||
|
@ -74,10 +76,15 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
|
|
||||||
public void testListVirtualMachineTemplatesWithOptions() throws SecurityException, NoSuchMethodException,
|
public void testListVirtualMachineTemplatesWithOptions() throws SecurityException, NoSuchMethodException,
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates", Integer.class,
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates",
|
||||||
Integer.class, VirtualMachineTemplateOptions.class);
|
Integer.class, Integer.class, VirtualMachineTemplateOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, 1, VirtualMachineTemplateOptions.builder()
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
.hypervisorType(HypervisorType.XENSERVER).categoryName("Firewalls").build()));
|
method,
|
||||||
|
ImmutableList.<Object> of(
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
VirtualMachineTemplateOptions.builder().hypervisorType(HypervisorType.XENSERVER)
|
||||||
|
.categoryName("Firewalls").build())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates"
|
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates"
|
||||||
|
@ -95,7 +102,7 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
public void testGetVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "getVirtualMachineTemplate", Integer.class,
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "getVirtualMachineTemplate", Integer.class,
|
||||||
Integer.class, Integer.class);
|
Integer.class, Integer.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, 1, 1));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(1, 1, 1)));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1");
|
||||||
|
@ -112,10 +119,11 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
public void testUpdateVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
public void testUpdateVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "updateVirtualMachineTemplate",
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "updateVirtualMachineTemplate",
|
||||||
VirtualMachineTemplateDto.class);
|
VirtualMachineTemplateDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/"
|
||||||
"PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1");
|
+ "virtualmachinetemplates/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplateDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplateDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, withHeader(TemplateResources.virtualMachineTemplatePutPayload()),
|
assertPayloadEquals(request, withHeader(TemplateResources.virtualMachineTemplatePutPayload()),
|
||||||
VirtualMachineTemplateDto.class, VirtualMachineTemplateDto.BASE_MEDIA_TYPE, false);
|
VirtualMachineTemplateDto.class, VirtualMachineTemplateDto.BASE_MEDIA_TYPE, false);
|
||||||
|
@ -130,10 +138,11 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
public void testDeleteVirtualMachineTemplate() throws SecurityException, NoSuchMethodException {
|
public void testDeleteVirtualMachineTemplate() throws SecurityException, NoSuchMethodException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "deleteVirtualMachineTemplate",
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "deleteVirtualMachineTemplate",
|
||||||
VirtualMachineTemplateDto.class);
|
VirtualMachineTemplateDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/datacenterrepositories/1/"
|
||||||
"DELETE http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1");
|
+ "virtualmachinetemplates/1 HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "");
|
assertNonPayloadHeadersEqual(request, "");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -148,7 +157,8 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
IOException {
|
IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "createPersistentVirtualMachineTemplate",
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "createPersistentVirtualMachineTemplate",
|
||||||
Integer.class, Integer.class, VirtualMachineTemplatePersistentDto.class);
|
Integer.class, Integer.class, VirtualMachineTemplatePersistentDto.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(1, 1, TemplateResources.persistentData()));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(1, 1, TemplateResources.persistentData())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"POST http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates HTTP/1.1");
|
"POST http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates HTTP/1.1");
|
||||||
|
@ -169,12 +179,13 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "requestConversion",
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "requestConversion",
|
||||||
VirtualMachineTemplateDto.class, DiskFormatType.class, ConversionDto.class);
|
VirtualMachineTemplateDto.class, DiskFormatType.class, ConversionDto.class);
|
||||||
|
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(
|
||||||
DiskFormatType.VMDK_STREAM_OPTIMIZED, TemplateResources.conversionPut()));
|
TemplateResources.virtualMachineTemplatePut(), DiskFormatType.VMDK_STREAM_OPTIMIZED,
|
||||||
|
TemplateResources.conversionPut())));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(request,
|
||||||
request,
|
"PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/"
|
||||||
"PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/conversions/VMDK_STREAM_OPTIMIZED HTTP/1.1");
|
+ "1/conversions/VMDK_STREAM_OPTIMIZED HTTP/1.1");
|
||||||
|
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, withHeader(TemplateResources.conversionPutPlayload()),
|
assertPayloadEquals(request, withHeader(TemplateResources.conversionPutPlayload()),
|
||||||
|
@ -188,11 +199,14 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testListConversions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListConversions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listConversions", VirtualMachineTemplateDto.class);
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listConversions",
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut()));
|
VirtualMachineTemplateDto.class);
|
||||||
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
|
ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut())));
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/conversions HTTP/1.1");
|
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/"
|
||||||
|
+ "1/conversions HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + ConversionsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + ConversionsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -206,15 +220,14 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
public void testListConversionsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
public void testListConversionsWithOptions() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listConversions",
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "listConversions",
|
||||||
VirtualMachineTemplateDto.class, ConversionOptions.class);
|
VirtualMachineTemplateDto.class, ConversionOptions.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(
|
GeneratedHttpRequest request = processor.apply(Invocation.create(
|
||||||
method,
|
method,
|
||||||
ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut(),
|
ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut(), ConversionOptions.builder()
|
||||||
ConversionOptions.builder().hypervisorType(HypervisorType.XENSERVER)
|
.hypervisorType(HypervisorType.XENSERVER).conversionState(ConversionState.FINISHED).build())));
|
||||||
.conversionState(ConversionState.FINISHED).build()));
|
|
||||||
|
|
||||||
assertRequestLineEquals(request,
|
assertRequestLineEquals(request,
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/conversions"
|
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/"
|
||||||
+ "?hypervisor=XENSERVER&state=FINISHED HTTP/1.1");
|
+ "1/conversions" + "?hypervisor=XENSERVER&state=FINISHED HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + ConversionsDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + ConversionsDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
@ -226,14 +239,13 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest<V
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetConversion() throws SecurityException, NoSuchMethodException, IOException {
|
public void testGetConversion() throws SecurityException, NoSuchMethodException, IOException {
|
||||||
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "getConversion", VirtualMachineTemplateDto.class,
|
Invokable<?, ?> method = method(VirtualMachineTemplateAsyncApi.class, "getConversion",
|
||||||
DiskFormatType.class);
|
VirtualMachineTemplateDto.class, DiskFormatType.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut(),
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method,
|
||||||
DiskFormatType.RAW));
|
ImmutableList.<Object> of(TemplateResources.virtualMachineTemplatePut(), DiskFormatType.RAW)));
|
||||||
|
|
||||||
assertRequestLineEquals(
|
assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/"
|
||||||
request,
|
+ "virtualmachinetemplates/1/conversions/RAW HTTP/1.1");
|
||||||
"GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/conversions/RAW HTTP/1.1");
|
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + ConversionDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + ConversionDto.BASE_MEDIA_TYPE + "\n");
|
||||||
assertPayloadEquals(request, null, null, false);
|
assertPayloadEquals(request, null, null, false);
|
||||||
|
|
||||||
|
|
|
@ -513,7 +513,7 @@ public class AsyncMonitorTest {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class CoutingEventHandler {
|
static class CoutingEventHandler {
|
||||||
public int numCompletes = 0;
|
public int numCompletes = 0;
|
||||||
|
|
||||||
public int numFailures = 0;
|
public int numFailures = 0;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.io.IOException;
|
||||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
import org.jclouds.abiquo.features.BaseAbiquoAsyncApiTest;
|
import org.jclouds.abiquo.features.BaseAbiquoAsyncApiTest;
|
||||||
import org.jclouds.functions.IdentityFunction;
|
import org.jclouds.functions.IdentityFunction;
|
||||||
|
import org.jclouds.reflect.Invocation;
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ import com.abiquo.model.rest.RESTLink;
|
||||||
import com.abiquo.server.core.infrastructure.DatacentersDto;
|
import com.abiquo.server.core.infrastructure.DatacentersDto;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.reflect.Invokable;
|
import com.google.common.reflect.Invokable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests annotation parsing of {@code AbiquoHttpAsyncApi}.
|
* Tests annotation parsing of {@code AbiquoHttpAsyncApi}.
|
||||||
*
|
*
|
||||||
|
@ -45,7 +47,7 @@ public class AbiquoHttpAsyncClientTest extends BaseAbiquoAsyncApiTest<AbiquoHttp
|
||||||
link.setType(DatacentersDto.BASE_MEDIA_TYPE);
|
link.setType(DatacentersDto.BASE_MEDIA_TYPE);
|
||||||
|
|
||||||
Invokable<?, ?> method = method(AbiquoHttpAsyncClient.class, "get", RESTLink.class);
|
Invokable<?, ?> method = method(AbiquoHttpAsyncClient.class, "get", RESTLink.class);
|
||||||
GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(link));
|
GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList.<Object> of(link)));
|
||||||
|
|
||||||
assertRequestLineEquals(request, "GET http://foo/bar HTTP/1.1");
|
assertRequestLineEquals(request, "GET http://foo/bar HTTP/1.1");
|
||||||
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n");
|
assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n");
|
||||||
|
|
Loading…
Reference in New Issue