From f5d9e381de534ad3c2c64028715a19c91a2d3131 Mon Sep 17 00:00:00 2001 From: Ignasi Barrera Date: Sun, 20 Jan 2013 12:49:06 +0100 Subject: [PATCH] Removed all compile warnings in Abiquo --- .../abiquo/features/AdminAsyncApiTest.java | 23 +- .../abiquo/features/CloudAsyncApiTest.java | 268 +++++++----- .../abiquo/features/ConfigAsyncApiTest.java | 39 +- .../features/EnterpriseAsyncApiTest.java | 121 +++-- .../abiquo/features/EventAsyncApiTest.java | 4 +- .../features/InfrastructureAsyncApiTest.java | 413 +++++++++++------- .../abiquo/features/PricingAsyncApiTest.java | 66 +-- .../abiquo/features/TaskAsyncApiTest.java | 44 +- .../VirtualMachineTemplateAsyncApiTest.java | 84 ++-- .../abiquo/internal/AsyncMonitorTest.java | 2 +- .../internal/AbiquoHttpAsyncClientTest.java | 4 +- 11 files changed, 661 insertions(+), 407 deletions(-) diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java index a109bf63e2..b76593917b 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/AdminAsyncApiTest.java @@ -29,6 +29,7 @@ import org.jclouds.abiquo.domain.AdminResources; import org.jclouds.abiquo.domain.EnterpriseResources; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; 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.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code AdminAsyncApi} * @@ -50,7 +52,7 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListRoles() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + RolesDto.BASE_MEDIA_TYPE + "\n"); @@ -65,7 +67,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetRoleFromUser() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(AdminAsyncApi.class, "getRole", UserDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.userPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.userPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n"); @@ -80,7 +83,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreateRole() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(AdminAsyncApi.class, "createRole", RoleDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(AdminResources.rolePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(AdminResources.rolePost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/roles HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n"); @@ -96,7 +100,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeleteRole() throws SecurityException, NoSuchMethodException { Invokable method = method(AdminAsyncApi.class, "deleteRole", RoleDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(AdminResources.rolePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(AdminResources.rolePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/roles/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -111,7 +116,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUpdateRole() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(AdminAsyncApi.class, "updateRole", RoleDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(AdminResources.rolePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(AdminResources.rolePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/roles/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n"); @@ -127,7 +133,7 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetRoleById() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(AdminAsyncApi.class, "getRole", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RoleDto.BASE_MEDIA_TYPE + "\n"); @@ -142,7 +148,8 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListPrivilegesByRoles() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(AdminAsyncApi.class, "listPrivileges", RoleDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(AdminResources.rolePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(AdminResources.rolePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/roles/1/action/privileges HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegesDto.BASE_MEDIA_TYPE + "\n"); @@ -159,7 +166,7 @@ public class AdminAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetCurrentUser() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(AdminAsyncApi.class, "getCurrentUser"); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/login HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n"); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java index 1ce95e0108..8a474362c5 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/CloudAsyncApiTest.java @@ -18,6 +18,7 @@ */ package org.jclouds.abiquo.features; + import static org.jclouds.abiquo.domain.DomainUtils.withHeader; 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.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReturnStringIf2xx; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.testng.annotations.Test; @@ -91,8 +93,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListVirtualDatacentersParams() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listVirtualDatacenters", VirtualDatacenterOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(VirtualDatacenterOptions.builder().datacenterId(1) - .enterpriseId(1).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(VirtualDatacenterOptions.builder().datacenterId(1).enterpriseId(1).build()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters?datacenter=1&enterprise=1 HTTP/1.1"); @@ -108,7 +110,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListVirtualDatacentersNoParams() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listVirtualDatacenters", VirtualDatacenterOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(VirtualDatacenterOptions.builder().build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(VirtualDatacenterOptions.builder().build()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacentersDto.BASE_MEDIA_TYPE + "\n"); @@ -124,8 +127,9 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreateVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "createVirtualDatacenter", VirtualDatacenterDto.class, DatacenterDto.class, EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPost(), - InfrastructureResources.datacenterPut(), EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + CloudResources.virtualDatacenterPost(), InfrastructureResources.datacenterPut(), + EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters?datacenter=1&enterprise=1 HTTP/1.1"); @@ -142,7 +146,7 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getVirtualDatacenter", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n"); @@ -157,7 +161,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUpdateVirtualDatacenter() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "updateVirtualDatacenter", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualDatacenterDto.BASE_MEDIA_TYPE + "\n"); @@ -173,7 +178,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeleteVirtualDatacenter() throws SecurityException, NoSuchMethodException { Invokable method = method(CloudAsyncApi.class, "deleteVirtualDatacenter", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -192,7 +198,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { IpOptions options = IpOptions.builder().limit(5).build(); Invokable method = method(CloudAsyncApi.class, "listAvailablePublicIps", VirtualDatacenterDto.class, IpOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), options)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), options))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/publicips/topurchase?limit=5 HTTP/1.1"); @@ -210,7 +217,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { IpOptions options = IpOptions.builder().limit(5).build(); Invokable method = method(CloudAsyncApi.class, "listPurchasedPublicIps", VirtualDatacenterDto.class, IpOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), options)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), options))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/publicips/purchased?limit=5 HTTP/1.1"); @@ -226,7 +234,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testPurchasePublicIp() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "purchasePublicIp", PublicIpDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.publicIpToPurchase())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.publicIpToPurchase()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/5/publicips/purchased/1 HTTP/1.1"); @@ -242,7 +251,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testReleasePublicIp() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "releasePublicIp", PublicIpDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.publicIpToRelease())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.publicIpToRelease()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/5/publicips/topurchase/1 HTTP/1.1"); @@ -260,7 +270,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListAvailableTemplates() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listAvailableTemplates", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/action/templates HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplatesDto.BASE_MEDIA_TYPE + "\n"); @@ -276,9 +287,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListAvailableTemplatesWithOptions() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listAvailableTemplates", VirtualDatacenterDto.class, VirtualMachineTemplateOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - VirtualMachineTemplateOptions.builder().hypervisorType(HypervisorType.XENSERVER).categoryName("Firewalls") - .idTemplate(1).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), VirtualMachineTemplateOptions.builder() + .hypervisorType(HypervisorType.XENSERVER).categoryName("Firewalls").idTemplate(1).build()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/action/templates" + "?hypervisorTypeName=XENSERVER&categoryName=Firewalls&idTemplate=1 HTTP/1.1"); @@ -296,7 +308,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListStorageTiers() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listStorageTiers", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/tiers HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TiersDto.BASE_MEDIA_TYPE + "\n"); @@ -311,7 +324,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetStorageTier() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getStorageTier", VirtualDatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/tiers/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n"); @@ -326,7 +340,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetDefaultNetwork() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getDefaultNetwork", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n"); @@ -342,8 +357,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testSetDefaultNetworkInternal() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "setDefaultNetwork", VirtualDatacenterDto.class, VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - NetworkResources.privateNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), NetworkResources.privateNetworkPut()))); RESTLink netLink = NetworkResources.privateNetworkPut().getEditLink(); @@ -363,8 +378,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testSetDefaultNetworkExternal() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "setDefaultNetwork", VirtualDatacenterDto.class, VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - NetworkResources.externalNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), NetworkResources.externalNetworkPut()))); RESTLink netLink = NetworkResources.externalNetworkPut().getEditLink(); @@ -385,7 +400,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListPrivateNetworks() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listPrivateNetworks", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n"); @@ -399,8 +415,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } public void testGetPrivateNetwork() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudAsyncApi.class, "getPrivateNetwork", VirtualDatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), 1)); + Invokable method = method(CloudAsyncApi.class, "getPrivateNetwork", VirtualDatacenterDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n"); @@ -416,8 +434,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreatePrivateNetwork() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "createPrivateNetwork", VirtualDatacenterDto.class, VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - NetworkResources.vlanPost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), NetworkResources.vlanPost()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/privatenetworks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n"); @@ -433,7 +451,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUpdatePrivateNetwork() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "updatePrivateNetwork", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.privateNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.privateNetworkPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n"); @@ -449,7 +468,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeletePrivateNetwork() throws SecurityException, NoSuchMethodException { Invokable method = method(CloudAsyncApi.class, "deletePrivateNetwork", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.privateNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.privateNetworkPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1 HTTP/1.1"); @@ -467,7 +487,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListPrivateNetworkIps() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listPrivateNetworkIps", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.privateNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.privateNetworkPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips HTTP/1.1"); @@ -483,8 +504,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListPrivateNetworkIpsWithOptions() throws SecurityException, NoSuchMethodException, IOException { IpOptions options = IpOptions.builder().startWith(10).build(); - Invokable method = method(CloudAsyncApi.class, "listPrivateNetworkIps", VLANNetworkDto.class, IpOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.privateNetworkPut(), options)); + Invokable method = method(CloudAsyncApi.class, "listPrivateNetworkIps", VLANNetworkDto.class, + IpOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.privateNetworkPut(), options))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips?startwith=10 HTTP/1.1"); @@ -500,7 +523,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetPrivateNetworkIp() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getPrivateNetworkIp", VLANNetworkDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.privateNetworkPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.privateNetworkPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/privatenetworks/1/ips/1 HTTP/1.1"); @@ -518,7 +542,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListVirtualAppliances() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listVirtualAppliances", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualAppliancesDto.BASE_MEDIA_TYPE + "\n"); @@ -532,8 +557,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } public void testGetVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudAsyncApi.class, "getVirtualAppliance", VirtualDatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), 1)); + Invokable method = method(CloudAsyncApi.class, "getVirtualAppliance", VirtualDatacenterDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1"); @@ -549,7 +576,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetVirtualApplianceState() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getVirtualApplianceState", VirtualApplianceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/state HTTP/1.1"); @@ -566,8 +594,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreateVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "createVirtualAppliance", VirtualDatacenterDto.class, VirtualApplianceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - CloudResources.virtualAppliancePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), CloudResources.virtualAppliancePost()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances HTTP/1.1"); @@ -584,7 +612,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUpdateVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "updateVirtualAppliance", VirtualApplianceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1"); @@ -601,7 +630,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeleteVirtualAppliance() throws SecurityException, NoSuchMethodException { Invokable method = method(CloudAsyncApi.class, "deleteVirtualAppliance", VirtualApplianceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1 HTTP/1.1"); @@ -618,8 +648,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeployVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "deployVirtualAppliance", VirtualApplianceDto.class, VirtualMachineTaskDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut(), - CloudResources.deployOptions())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut(), CloudResources.deployOptions()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/deploy HTTP/1.1"); @@ -637,8 +667,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUndeployVirtualAppliance() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "undeployVirtualAppliance", VirtualApplianceDto.class, VirtualMachineTaskDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut(), - CloudResources.undeployOptions())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut(), CloudResources.undeployOptions()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/undeploy HTTP/1.1"); @@ -655,7 +685,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetVirtualAppliancePrice() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getVirtualAppliancePrice", VirtualApplianceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/action/price HTTP/1.1"); @@ -673,7 +704,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listVirtualMachines", VirtualApplianceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines HTTP/1.1"); @@ -690,8 +722,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListVirtualMachinesWithOptions() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listVirtualMachines", VirtualApplianceDto.class, VirtualMachineOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut(), - VirtualMachineOptions.builder().disablePagination().build())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(CloudResources.virtualAppliancePut(), VirtualMachineOptions.builder() + .disablePagination().build()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines?limit=0 HTTP/1.1"); @@ -706,8 +740,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } public void testGetVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudAsyncApi.class, "getVirtualMachine", VirtualApplianceDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut(), 1)); + Invokable method = method(CloudAsyncApi.class, "getVirtualMachine", VirtualApplianceDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1"); @@ -724,8 +760,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "createVirtualMachine", VirtualApplianceDto.class, VirtualMachineWithNodeExtendedDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualAppliancePut(), - CloudResources.virtualMachinePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualAppliancePut(), CloudResources.virtualMachinePost()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines HTTP/1.1"); @@ -741,8 +777,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } public void testUpdateVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudAsyncApi.class, "updateVirtualMachine", VirtualMachineWithNodeExtendedDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + Invokable method = method(CloudAsyncApi.class, "updateVirtualMachine", + VirtualMachineWithNodeExtendedDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1"); @@ -758,10 +796,12 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } public void testUpdateVirtualMachineWithOptions() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudAsyncApi.class, "updateVirtualMachine", VirtualMachineWithNodeExtendedDto.class, - VirtualMachineOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut(), - VirtualMachineOptions.builder().force(true).build())); + Invokable method = method(CloudAsyncApi.class, "updateVirtualMachine", + VirtualMachineWithNodeExtendedDto.class, VirtualMachineOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(CloudResources.virtualMachinePut(), VirtualMachineOptions.builder().force(true) + .build()))); assertRequestLineEquals(request, "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 { public void testChangeVirtualMachineState() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "changeVirtualMachineState", VirtualMachineDto.class, VirtualMachineStateDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut(), - CloudResources.virtualMachineState())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut(), CloudResources.virtualMachineState()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/state HTTP/1.1"); @@ -797,7 +837,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeleteVirtualMachine() throws SecurityException, NoSuchMethodException { Invokable method = method(CloudAsyncApi.class, "deleteVirtualMachine", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1 HTTP/1.1"); @@ -813,7 +854,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetVirtualMachineState() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getVirtualMachineState", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/state HTTP/1.1"); @@ -830,8 +872,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeployVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "deployVirtualMachine", VirtualMachineDto.class, VirtualMachineTaskDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut(), - CloudResources.deployOptions())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut(), CloudResources.deployOptions()))); assertRequestLineEquals(request, "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 { public void testUndeployVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "undeployVirtualMachine", VirtualMachineDto.class, VirtualMachineTaskDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut(), - CloudResources.undeployOptions())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut(), CloudResources.undeployOptions()))); assertRequestLineEquals(request, "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 { public void testRebootVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "rebootVirtualMachine", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "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 { public void testListNetworkConfigurations() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listNetworkConfigurations", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals( request, @@ -899,12 +943,13 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } 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(); VLANNetworkDto network = NetworkResources.privateNetworkPut(); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(vm, network)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(vm, network))); String configLink = vm.searchLink("configurations").getHref() + "/" + network.getId(); @@ -926,7 +971,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getVirtualMachineTemplate", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1"); @@ -942,7 +988,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListAttachedVolumes() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listAttachedVolumes", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "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 { public void testDetachAllVolumes() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "detachAllVolumes", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "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 { Invokable method = method(CloudAsyncApi.class, "replaceVolumes", VirtualMachineDto.class, VirtualMachineOptions.class, VolumeManagementDto[].class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut(), - VirtualMachineOptions.builder().force(true).build(), new VolumeManagementDto[] { first, second })); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(CloudResources.virtualMachinePut(), VirtualMachineOptions.builder().force(true) + .build(), new VolumeManagementDto[] { first, second }))); String editLink = CloudResources.volumePut().getEditLink().getHref(); assertRequestLineEquals( @@ -999,7 +1049,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListAttachedHardDisks() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listAttachedHardDisks", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "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 { public void testDetachAllHardDisks() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "detachAllHardDisks", VirtualMachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "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 { Invokable method = method(CloudAsyncApi.class, "replaceHardDisks", VirtualMachineDto.class, DiskManagementDto[].class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut(), - new DiskManagementDto[] { first, second })); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut(), new DiskManagementDto[] { first, second }))); String editLink = CloudResources.hardDiskPut().getEditLink().getHref(); assertRequestLineEquals(request, @@ -1057,7 +1109,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListHardDisks() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listHardDisks", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/disks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DisksManagementDto.BASE_MEDIA_TYPE + "\n"); @@ -1071,8 +1124,10 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } public void testGetHardDisk() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudAsyncApi.class, "getHardDisk", VirtualDatacenterDto.class, Integer.class);; - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), 1)); + Invokable method = method(CloudAsyncApi.class, "getHardDisk", VirtualDatacenterDto.class, Integer.class); + ; + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/disks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DiskManagementDto.BASE_MEDIA_TYPE + "\n"); @@ -1088,8 +1143,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreateHardDisk() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "createHardDisk", VirtualDatacenterDto.class, DiskManagementDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - CloudResources.hardDiskPost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), CloudResources.hardDiskPost()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/disks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DiskManagementDto.BASE_MEDIA_TYPE + "\n"); @@ -1105,7 +1160,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeleteHardDisk() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "deleteHardDisk", DiskManagementDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.hardDiskPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.hardDiskPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/disks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -1122,7 +1178,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListVolumes() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/volumes HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VolumesManagementDto.BASE_MEDIA_TYPE + "\n"); @@ -1136,9 +1193,12 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } public void testListVolumesWithOptions() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class, VolumeOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - VolumeOptions.builder().onlyAvailable(true).build())); + Invokable method = method(CloudAsyncApi.class, "listVolumes", VirtualDatacenterDto.class, + VolumeOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), VolumeOptions.builder() + .onlyAvailable(true).build()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/volumes?available=true HTTP/1.1"); @@ -1153,10 +1213,13 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { } 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. of(CloudResources.virtualDatacenterPut(), - VolumeOptions.builder().has("vol").orderBy(OrderBy.NAME).ascendant(true).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), VolumeOptions.builder().has("vol") + .orderBy(OrderBy.NAME).ascendant(true).build()))); assertRequestLineEquals(request, "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 { public void testGetVolume() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "getVolume", VirtualDatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VolumeManagementDto.BASE_MEDIA_TYPE + "\n"); @@ -1188,8 +1252,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreateVolume() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "createVolume", VirtualDatacenterDto.class, VolumeManagementDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualDatacenterPut(), - CloudResources.volumePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualDatacenterPut(), CloudResources.volumePost()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/volumes HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VolumeManagementDto.BASE_MEDIA_TYPE + "\n"); @@ -1205,7 +1269,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUpdateVolume() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "updateVolume", VolumeManagementDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.volumePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.volumePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n"); @@ -1221,7 +1286,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeleteVolume() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "deleteVolume", VolumeManagementDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.volumePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.volumePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/cloud/virtualdatacenters/1/volumes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -1237,8 +1303,8 @@ public class CloudAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testMoveVolume() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(CloudAsyncApi.class, "moveVolume", VolumeManagementDto.class, VirtualDatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.volumePut(), - CloudResources.virtualDatacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.volumePut(), CloudResources.virtualDatacenterPut()))); assertRequestLineEquals(request, "POST http://localhost/api/cloud/virtualdatacenters/1/volumes/1/action/move HTTP/1.1"); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java index 2e4cf272f6..a26e52b230 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/ConfigAsyncApiTest.java @@ -30,6 +30,7 @@ import org.jclouds.abiquo.domain.config.options.LicenseOptions; import org.jclouds.abiquo.domain.config.options.PropertyOptions; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; 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.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code AdminAsyncApi}. * @@ -55,7 +57,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListLicenses() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + LicensesDto.BASE_MEDIA_TYPE + "\n"); @@ -70,7 +72,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListLicenseWithOptions() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "listLicenses", LicenseOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(LicenseOptions.builder().active(true).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(LicenseOptions.builder().active(true).build()))); assertRequestLineEquals(request, "GET http://localhost/api/config/licenses?active=true HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + LicensesDto.BASE_MEDIA_TYPE + "\n"); @@ -85,7 +88,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testAddLicense() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "addLicense", LicenseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(ConfigResources.licensePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(ConfigResources.licensePost()))); assertRequestLineEquals(request, "POST http://localhost/api/config/licenses HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + LicenseDto.BASE_MEDIA_TYPE + "\n"); @@ -101,7 +105,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testRemoveLicense() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "removeLicense", LicenseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(ConfigResources.licensePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(ConfigResources.licensePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/config/licenses/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -118,7 +123,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListPrivileges() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegesDto.BASE_MEDIA_TYPE + "\n"); @@ -133,7 +138,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetPrivilege() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "getPrivilege", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/config/privileges/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PrivilegeDto.BASE_MEDIA_TYPE + "\n"); @@ -150,7 +155,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListSystemProperties() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertiesDto.BASE_MEDIA_TYPE + "\n"); @@ -165,8 +170,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListSystemPropertiesWithOptions() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "listSystemProperties", PropertyOptions.class); - GeneratedHttpRequest request = processor - .createRequest(method, ImmutableList. of(PropertyOptions.builder().component("api").build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PropertyOptions.builder().component("api").build()))); assertRequestLineEquals(request, "GET http://localhost/api/config/properties?component=api HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertiesDto.BASE_MEDIA_TYPE + "\n"); @@ -181,7 +186,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUpdateSystemProperty() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "updateSystemProperty", SystemPropertyDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(ConfigResources.propertyPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(ConfigResources.propertyPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/config/properties/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + SystemPropertyDto.BASE_MEDIA_TYPE + "\n"); @@ -199,7 +205,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListCategories() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + CategoriesDto.BASE_MEDIA_TYPE + "\n"); @@ -214,7 +220,7 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetCategory() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "getCategory", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/config/categories/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n"); @@ -229,7 +235,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testCreateCategory() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "createCategory", CategoryDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(ConfigResources.categoryPost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(ConfigResources.categoryPost()))); assertRequestLineEquals(request, "POST http://localhost/api/config/categories HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n"); @@ -245,7 +252,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testUpdateCategory() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(ConfigAsyncApi.class, "updateCategory", CategoryDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(ConfigResources.categoryPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(ConfigResources.categoryPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/config/categories/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CategoryDto.BASE_MEDIA_TYPE + "\n"); @@ -261,7 +269,8 @@ public class ConfigAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testDeleteCategory() throws SecurityException, NoSuchMethodException { Invokable method = method(ConfigAsyncApi.class, "deleteCategory", CategoryDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(ConfigResources.categoryPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(ConfigResources.categoryPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/config/categories/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java index 90a81ca1f3..8608876473 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EnterpriseAsyncApiTest.java @@ -32,6 +32,7 @@ import org.jclouds.abiquo.domain.options.search.reference.OrderBy; import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; 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.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code EnterpriseAsyncApi} * @@ -67,7 +69,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest 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"); assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisesDto.BASE_MEDIA_TYPE + "\n"); @@ -84,7 +86,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listEnterprises", EnterpriseOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(options)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(options))); 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"); @@ -102,7 +104,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listEnterprises", DatacenterDto.class, EnterpriseOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), options)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), options))); assertRequestLineEquals(request, "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 method = method(EnterpriseAsyncApi.class, "createEnterprise", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n"); @@ -134,7 +138,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "getEnterprise", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n"); @@ -149,7 +153,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "updateEnterprise", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + EnterpriseDto.BASE_MEDIA_TYPE + "\n"); @@ -165,7 +170,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "deleteEnterprise", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -180,7 +186,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listAllowedDatacenters", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters?idEnterprise=1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n"); @@ -195,7 +201,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listVirtualDatacenters", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/virtualdatacenters HTTP/1.1"); @@ -213,7 +220,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "getEnterpriseProperties", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/properties HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisePropertiesDto.BASE_MEDIA_TYPE + "\n"); @@ -227,8 +235,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "updateEnterpriseProperties", EnterprisePropertiesDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePropertiesPut())); + Invokable method = method(EnterpriseAsyncApi.class, "updateEnterpriseProperties", + EnterprisePropertiesDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePropertiesPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/properties HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + EnterprisePropertiesDto.BASE_MEDIA_TYPE + "\n"); @@ -249,9 +259,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "createLimits", EnterpriseDto.class, DatacenterDto.class, - DatacenterLimitsDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(enterprise, datacenter, limits)); + Invokable method = method(EnterpriseAsyncApi.class, "createLimits", EnterpriseDto.class, + DatacenterDto.class, DatacenterLimitsDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(enterprise, datacenter, limits))); String limitsUri = enterprise.searchLink("limits").getHref(); String requestURI = String.format("POST %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId()); @@ -273,7 +284,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "getLimits", EnterpriseDto.class, DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(enterprise, datacenter)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(enterprise, datacenter))); String limitsUri = enterprise.searchLink("limits").getHref(); String requestURI = String.format("GET %s?datacenter=%d HTTP/1.1", limitsUri, datacenter.getId()); @@ -293,8 +305,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "updateLimits", DatacenterLimitsDto.class); - GeneratedHttpRequest request = processor.createRequest(method, - ImmutableList. of(EnterpriseResources.datacenterLimitsPut(enterprise))); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.datacenterLimitsPut(enterprise)))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/limits/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterLimitsDto.BASE_MEDIA_TYPE + "\n"); @@ -312,8 +324,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "deleteLimits", DatacenterLimitsDto.class); - GeneratedHttpRequest request = processor.createRequest(method, - ImmutableList. of(EnterpriseResources.datacenterLimitsPut(enterprise))); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.datacenterLimitsPut(enterprise)))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/limits/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -328,7 +340,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listLimits", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/limits HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n"); @@ -345,7 +358,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "getUser", EnterpriseDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n"); @@ -360,7 +374,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listUsers", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/users HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UsersDto.BASE_MEDIA_TYPE + "\n"); @@ -378,7 +393,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "createUser", EnterpriseDto.class, UserDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(enterprise, user)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(enterprise, user))); assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/users HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n"); @@ -394,7 +410,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "updateUser", UserDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.userPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.userPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UserDto.BASE_MEDIA_TYPE + "\n"); @@ -410,7 +427,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "deleteUser", UserDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.userPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.userPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/users/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -425,7 +443,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listVirtualMachines", UserDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.userPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.userPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/users/1/action/virtualmachines HTTP/1.1"); @@ -442,9 +461,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "getDatacenterRepository", EnterpriseDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut(), - InfrastructureResources.datacenterPut().getId())); + Invokable method = method(EnterpriseAsyncApi.class, "getDatacenterRepository", EnterpriseDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + EnterpriseResources.enterprisePut(), InfrastructureResources.datacenterPut().getId()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterRepositoryDto.BASE_MEDIA_TYPE + "\n"); @@ -458,9 +478,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "refreshTemplateRepository", Integer.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut().getId(), - InfrastructureResources.datacenterPut().getId())); + Invokable method = method(EnterpriseAsyncApi.class, "refreshTemplateRepository", Integer.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + EnterpriseResources.enterprisePut().getId(), InfrastructureResources.datacenterPut().getId()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/actions/refresh HTTP/1.1"); @@ -478,7 +499,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listExternalNetworks", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/externalnetworks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n"); @@ -495,7 +517,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listVirtualMachines", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/virtualmachines HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachinesWithNodeExtendedDto.BASE_MEDIA_TYPE + "\n"); @@ -510,7 +533,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listVirtualAppliances", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/action/virtualappliances HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualAppliancesDto.BASE_MEDIA_TYPE + "\n"); @@ -527,7 +551,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listReservedMachines", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/reservedmachines HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + MachinesDto.BASE_MEDIA_TYPE + "\n"); @@ -544,7 +569,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listTemplateDefinitionLists", EnterpriseDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists HTTP/1.1"); @@ -564,7 +590,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "createTemplateDefinitionList", EnterpriseDto.class, TemplateDefinitionListDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(enterprise, template)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(enterprise, template))); assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists HTTP/1.1"); @@ -584,7 +611,7 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "updateTemplateDefinitionList", TemplateDefinitionListDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(template)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(template))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1"); @@ -602,7 +629,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "deleteTemplateDefinitionList", TemplateDefinitionListDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.templateListPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.templateListPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1"); @@ -619,7 +647,8 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "getTemplateDefinitionList", EnterpriseDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1 HTTP/1.1"); @@ -634,10 +663,10 @@ public class EnterpriseAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(EnterpriseAsyncApi.class, "listTemplateListStatus", TemplateDefinitionListDto.class, - DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.templateListPut(), - InfrastructureResources.datacenterPut())); + Invokable method = method(EnterpriseAsyncApi.class, "listTemplateListStatus", + TemplateDefinitionListDto.class, DatacenterDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.templateListPut(), InfrastructureResources.datacenterPut()))); assertRequestLineEquals( request, diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java index 5aadbcd384..ed67486505 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/EventAsyncApiTest.java @@ -24,12 +24,14 @@ import static org.jclouds.reflect.Reflection2.method; import java.io.IOException; import org.jclouds.http.functions.ParseXMLWithJAXB; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.testng.annotations.Test; import com.abiquo.server.core.event.EventsDto; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code EventAsyncApi} * @@ -40,7 +42,7 @@ import com.google.common.reflect.Invokable; public class EventAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListEvents() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + EventsDto.BASE_MEDIA_TYPE + "\n"); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java index fa7b2034a0..c793aa7e46 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/InfrastructureAsyncApiTest.java @@ -44,6 +44,7 @@ import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReturnStringIf2xx; import org.jclouds.http.functions.ReturnTrueIf2xx; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; 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.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code InfrastructureAsyncApi} * @@ -102,7 +104,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest 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"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n"); @@ -117,7 +119,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "createDatacenter", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n"); @@ -133,7 +136,7 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getDatacenter", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n"); @@ -148,7 +151,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateDatacenter", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacenterDto.BASE_MEDIA_TYPE + "\n"); @@ -164,7 +168,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteDatacenter", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -179,7 +184,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listLimits", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/action/getLimits HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersLimitsDto.BASE_MEDIA_TYPE + "\n"); @@ -195,10 +201,12 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getHypervisorTypeFromMachine", DatacenterDto.class, - DatacenterOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - DatacenterOptions.builder().ip("10.60.1.120").build())); + Invokable method = method(InfrastructureAsyncApi.class, "getHypervisorTypeFromMachine", + DatacenterDto.class, DatacenterOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.datacenterPut(), + DatacenterOptions.builder().ip("10.60.1.120").build()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "getHypervisorTypes", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/hypervisors HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + HypervisorTypesDto.BASE_MEDIA_TYPE + "\n"); @@ -231,7 +240,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listRacks", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RacksDto.BASE_MEDIA_TYPE + "\n"); @@ -246,8 +256,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "createRack", DatacenterDto.class, RackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - InfrastructureResources.rackPost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), InfrastructureResources.rackPost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n"); @@ -263,7 +273,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getRack", DatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n"); @@ -278,7 +289,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateRack", RackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.rackPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.rackPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RackDto.BASE_MEDIA_TYPE + "\n"); @@ -294,7 +306,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteRack", RackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.rackPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.rackPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -311,7 +324,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listManagedRacks", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UcsRacksDto.BASE_MEDIA_TYPE + "\n"); @@ -325,9 +339,12 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "createManagedRack", DatacenterDto.class, UcsRackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - InfrastructureResources.managedRackPost())); + Invokable method = method(InfrastructureAsyncApi.class, "createManagedRack", DatacenterDto.class, + UcsRackDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.datacenterPut(), + InfrastructureResources.managedRackPost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n"); @@ -342,8 +359,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getManagedRack", DatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), 1)); + Invokable method = method(InfrastructureAsyncApi.class, "getManagedRack", DatacenterDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n"); @@ -359,7 +378,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateManagedRack", UcsRackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + UcsRackDto.BASE_MEDIA_TYPE + "\n"); @@ -375,7 +395,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listServiceProfiles", UcsRackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/logicservers HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + LogicServersDto.BASE_MEDIA_TYPE + "\n"); @@ -393,7 +414,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listServiceProfiles", UcsRackDto.class, FilterOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), options)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut(), options))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "listOrganizations", UcsRackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/organizations HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + OrganizationsDto.BASE_MEDIA_TYPE + "\n"); @@ -425,8 +448,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listOrganizations", UcsRackDto.class, FilterOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), options)); + Invokable method = method(InfrastructureAsyncApi.class, "listOrganizations", UcsRackDto.class, + FilterOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut(), options))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/organizations?has=org HTTP/1.1"); @@ -442,7 +467,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listServiceProfileTemplates", UcsRackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/lstemplates HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + LogicServersDto.BASE_MEDIA_TYPE + "\n"); @@ -461,7 +487,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listServiceProfileTemplates", UcsRackDto.class, FilterOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), options)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut(), options))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/lstemplates?asc=true HTTP/1.1"); @@ -478,8 +505,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "associateLogicServer", UcsRackDto.class, LogicServerDto.class, OrganizationDto.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), - InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "blade")); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.managedRackPut(), + InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "blade"))); assertRequestLineEquals( request, @@ -497,8 +526,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "associateTemplate", UcsRackDto.class, LogicServerDto.class, OrganizationDto.class, String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), - InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "newname", "blade")); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.managedRackPut(), InfrastructureResources.logicServerPut(), + InfrastructureResources.organizationPut(), "newname", "blade"))); assertRequestLineEquals( request, @@ -516,8 +546,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "cloneAndAssociateLogicServer", UcsRackDto.class, LogicServerDto.class, OrganizationDto.class, String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), - InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "newname", "blade")); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.managedRackPut(), InfrastructureResources.logicServerPut(), + InfrastructureResources.organizationPut(), "newname", "blade"))); assertRequestLineEquals( request, @@ -535,8 +566,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "dissociateLogicServer", UcsRackDto.class, LogicServerDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), - InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.managedRackPut(), + InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "cloneLogicServer", UcsRackDto.class, LogicServerDto.class, OrganizationDto.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), - InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "name")); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.managedRackPut(), + InfrastructureResources.logicServerPut(), InfrastructureResources.organizationPut(), "name"))); assertRequestLineEquals( request, @@ -572,8 +607,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteLogicServer", UcsRackDto.class, LogicServerDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), - InfrastructureResources.logicServerPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.managedRackPut(), + InfrastructureResources.logicServerPut()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "listFsms", UcsRackDto.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.managedRackPut(), "dn")); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.managedRackPut(), "dn"))); 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"); @@ -606,7 +644,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listRemoteServices", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/remoteservices HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RemoteServicesDto.BASE_MEDIA_TYPE + "\n"); @@ -622,8 +661,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "createRemoteService", DatacenterDto.class, RemoteServiceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - InfrastructureResources.remoteServicePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.datacenterPut(), + InfrastructureResources.remoteServicePost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/remoteservices HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + RemoteServiceDto.BASE_MEDIA_TYPE + "\n"); @@ -640,8 +681,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getRemoteService", DatacenterDto.class, RemoteServiceType.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - RemoteServiceType.STORAGE_SYSTEM_MONITOR)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.datacenterPut(), RemoteServiceType.STORAGE_SYSTEM_MONITOR))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/remoteservices/storagesystemmonitor HTTP/1.1"); @@ -657,7 +698,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateRemoteService", RemoteServiceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.remoteServicePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.remoteServicePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/remoteservices/nodecollector HTTP/1.1"); @@ -674,7 +716,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteRemoteService", RemoteServiceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.remoteServicePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.remoteServicePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/remoteservices/nodecollector HTTP/1.1"); @@ -690,7 +733,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "isAvailable", RemoteServiceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.remoteServicePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.remoteServicePut()))); String checkUri = InfrastructureResources.remoteServicePut().searchLink("check").getHref(); assertRequestLineEquals(request, String.format("GET %s HTTP/1.1", checkUri)); @@ -709,8 +753,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class, String.class, HypervisorType.class, String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "10.60.1.222", HypervisorType.XENSERVER, "user", "pass")); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.datacenterPut(), "10.60.1.222", HypervisorType.XENSERVER, "user", "pass"))); String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle"; String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass"; @@ -730,8 +774,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class, String.class, HypervisorType.class, String.class, String.class, MachineOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().port(8889).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + 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 query = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass&port=8889"; @@ -751,8 +796,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "discoverSingleMachine", DatacenterDto.class, String.class, HypervisorType.class, String.class, String.class, MachineOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions.builder().build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.datacenterPut(), "80.80.80.80", HypervisorType.KVM, "user", "pass", MachineOptions + .builder().build()))); String baseUrl = "http://localhost/api/admin/datacenters/1/action/discoversingle"; String query = "ip=80.80.80.80&hypervisor=KVM&user=user&password=pass"; @@ -773,8 +819,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "discoverMultipleMachines", DatacenterDto.class, String.class, String.class, HypervisorType.class, String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "10.60.1.222", "10.60.1.250", HypervisorType.XENSERVER, "user", "pass")); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + 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 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 method = method(InfrastructureAsyncApi.class, "discoverMultipleMachines", DatacenterDto.class, String.class, String.class, HypervisorType.class, String.class, String.class, MachineOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "80.80.80.80", "80.80.80.86", HypervisorType.KVM, "user", "pass", MachineOptions.builder().port(8889) - .build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.datacenterPut(), "80.80.80.80", "80.80.80.86", HypervisorType.KVM, "user", "pass", + MachineOptions.builder().port(8889).build()))); 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"; @@ -814,10 +861,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class, String.class, - HypervisorType.class, String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "10.60.1.222", HypervisorType.XENSERVER, "user", "pass")); + Invokable method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class, + String.class, HypervisorType.class, String.class, String.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.datacenterPut(), "10.60.1.222", HypervisorType.XENSERVER, "user", "pass"))); String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachinestate"; String query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass"; @@ -835,10 +882,11 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class, String.class, - HypervisorType.class, String.class, String.class, MachineOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "10.60.1.222", HypervisorType.XENSERVER, "user", "pass", MachineOptions.builder().port(8889).build())); + Invokable method = method(InfrastructureAsyncApi.class, "checkMachineState", DatacenterDto.class, + String.class, HypervisorType.class, String.class, String.class, MachineOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + 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 query = "ip=10.60.1.222&hypervisor=XENSERVER&user=user&password=pass&port=8889"; @@ -858,8 +906,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", DatacenterDto.class, String.class, String.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "10.60.1.222", "user", "pass")); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), "10.60.1.222", "user", "pass"))); String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachineipmistate"; String query = "ip=10.60.1.222&user=user&password=pass"; @@ -879,8 +927,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", DatacenterDto.class, String.class, String.class, String.class, IpmiOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - "10.60.1.222", "user", "pass", IpmiOptions.builder().port(8889).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.datacenterPut(), "10.60.1.222", "user", "pass", IpmiOptions.builder().port(8889) + .build()))); String baseUrl = "http://localhost/api/admin/datacenters/1/action/checkmachineipmistate"; String query = "ip=10.60.1.222&user=user&password=pass&port=8889"; @@ -899,7 +948,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listMachines", RackDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.rackPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.rackPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + MachinesDto.BASE_MEDIA_TYPE + "\n"); @@ -914,7 +964,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getMachine", RackDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.rackPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.rackPut(), 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"); @@ -928,8 +979,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "checkMachineState", MachineDto.class, boolean.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut(), true)); + Invokable method = method(InfrastructureAsyncApi.class, "checkMachineState", MachineDto.class, + boolean.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut(), true))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "checkMachineIpmiState", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "createMachine", RackDto.class, MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.rackPut(), - InfrastructureResources.machinePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.rackPut(), InfrastructureResources.machinePost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/racks/1/machines HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n"); @@ -978,7 +1032,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateMachine", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n"); @@ -994,7 +1049,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteMachine", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/racks/1/machines/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -1008,9 +1064,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "reserveMachine", EnterpriseDto.class, MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut(), - InfrastructureResources.machinePut())); + Invokable method = method(InfrastructureAsyncApi.class, "reserveMachine", EnterpriseDto.class, + MachineDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut(), InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/reservedmachines HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + MachineDto.BASE_MEDIA_TYPE + "\n"); @@ -1025,9 +1082,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "cancelReservation", EnterpriseDto.class, MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(EnterpriseResources.enterprisePut(), - InfrastructureResources.machinePut())); + Invokable method = method(InfrastructureAsyncApi.class, "cancelReservation", EnterpriseDto.class, + MachineDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(EnterpriseResources.enterprisePut(), InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/reservedmachines/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -1045,7 +1103,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listVirtualMachinesByMachine", MachineDto.class, MachineOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut(), options)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut(), options))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "getVirtualMachine", MachineDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut(), 1)); + Invokable method = method(InfrastructureAsyncApi.class, "getVirtualMachine", MachineDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut(), 1))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "powerOff", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "powerOn", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "getLogicServer", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/racks/1/machines/1/logicserver HTTP/1.1"); @@ -1128,7 +1192,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "ledOn", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "ledOff", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "getLocatorLed", MachineDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.machinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.machinePut()))); 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"); @@ -1177,7 +1244,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listStorageDevices", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + StorageDevicesDto.BASE_MEDIA_TYPE + "\n"); @@ -1192,7 +1260,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listSupportedStorageDevices", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/action/supported HTTP/1.1"); @@ -1209,8 +1278,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "createStorageDevice", DatacenterDto.class, StorageDeviceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - InfrastructureResources.storageDevicePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.datacenterPut(), + InfrastructureResources.storageDevicePost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/storage/devices HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n"); @@ -1226,7 +1297,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteStorageDevice", StorageDeviceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storageDevicePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.storageDevicePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -1241,7 +1313,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateStorageDevice", StorageDeviceDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storageDevicePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.storageDevicePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n"); @@ -1256,8 +1329,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getStorageDevice", DatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), 1)); + Invokable method = method(InfrastructureAsyncApi.class, "getStorageDevice", DatacenterDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + StorageDeviceDto.BASE_MEDIA_TYPE + "\n"); @@ -1274,7 +1349,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listTiers", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TiersDto.BASE_MEDIA_TYPE + "\n"); @@ -1289,7 +1365,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateTier", TierDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.tierPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.tierPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/storage/tiers/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n"); @@ -1305,7 +1382,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getTier", DatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TierDto.BASE_MEDIA_TYPE + "\n"); @@ -1323,8 +1401,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listStoragePools", StorageDeviceDto.class, StoragePoolOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storageDevicePut(), - StoragePoolOptions.builder().sync(true).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.storageDevicePut(), + StoragePoolOptions.builder().sync(true).build()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "listStoragePools", TierDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.tierPut(), - StoragePoolOptions.builder().sync(true).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.tierPut(), StoragePoolOptions.builder().sync(true) + .build()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/tiers/1/pools HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolsDto.BASE_MEDIA_TYPE + "\n"); @@ -1357,8 +1439,9 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listStoragePools", StorageDeviceDto.class, StoragePoolOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storageDevicePut(), - StoragePoolOptions.builder().build())); + GeneratedHttpRequest request = processor + .apply(Invocation.create(method, ImmutableList. of(InfrastructureResources.storageDevicePut(), + StoragePoolOptions.builder().build()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolsDto.BASE_MEDIA_TYPE + "\n"); @@ -1374,8 +1457,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "createStoragePool", StorageDeviceDto.class, StoragePoolDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storageDevicePut(), - InfrastructureResources.storagePoolPost())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.storageDevicePut(), + InfrastructureResources.storagePoolPost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/storage/devices/1/pools HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + StoragePoolDto.BASE_MEDIA_TYPE + "\n"); @@ -1391,7 +1476,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateStoragePool", StoragePoolDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storagePoolPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.storagePoolPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1"); @@ -1408,7 +1494,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteStoragePool", StoragePoolDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storagePoolPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.storagePoolPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1"); @@ -1423,9 +1510,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getStoragePool", StorageDeviceDto.class, String.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storageDevicePut(), - InfrastructureResources.storagePoolPut().getIdStorage())); + Invokable method = method(InfrastructureAsyncApi.class, "getStoragePool", StorageDeviceDto.class, + String.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + InfrastructureResources.storageDevicePut(), InfrastructureResources.storagePoolPut().getIdStorage()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/storage/devices/1/pools/tururututu HTTP/1.1"); @@ -1442,8 +1530,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "refreshStoragePool", StoragePoolDto.class, StoragePoolOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.storagePoolPut(), - StoragePoolOptions.builder().sync(true).build())); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of(InfrastructureResources.storagePoolPut(), StoragePoolOptions.builder().sync(true) + .build()))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "listNetworks", DatacenterDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n"); @@ -1477,8 +1568,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listNetworks", DatacenterDto.class, NetworkOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), options)); + Invokable method = method(InfrastructureAsyncApi.class, "listNetworks", DatacenterDto.class, + NetworkOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), options))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network?type=PUBLIC HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworksDto.BASE_MEDIA_TYPE + "\n"); @@ -1493,7 +1586,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getNetwork", DatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n"); @@ -1507,9 +1601,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "createNetwork", DatacenterDto.class, VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), - NetworkResources.vlanPost())); + Invokable method = method(InfrastructureAsyncApi.class, "createNetwork", DatacenterDto.class, + VLANNetworkDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), NetworkResources.vlanPost()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/datacenters/1/network HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n"); @@ -1525,7 +1620,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "updateNetwork", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.publicNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.publicNetworkPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VLANNetworkDto.BASE_MEDIA_TYPE + "\n"); @@ -1541,7 +1637,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "deleteNetwork", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.publicNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.publicNetworkPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/admin/datacenters/1/network/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -1555,8 +1652,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "checkTagAvailability", DatacenterDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(InfrastructureResources.datacenterPut(), 2)); + Invokable method = method(InfrastructureAsyncApi.class, "checkTagAvailability", DatacenterDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(InfrastructureResources.datacenterPut(), 2))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/action/checkavailability?tag=2 HTTP/1.1"); @@ -1574,7 +1673,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listPublicIps", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.publicNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.publicNetworkPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1/ips HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PublicIpsDto.BASE_MEDIA_TYPE + "\n"); @@ -1589,8 +1689,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listPublicIps", VLANNetworkDto.class, IpOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.publicNetworkPut(), options)); + Invokable method = method(InfrastructureAsyncApi.class, "listPublicIps", VLANNetworkDto.class, + IpOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.publicNetworkPut(), options))); assertRequestLineEquals(request, "GET http://localhost/api/admin/datacenters/1/network/1/ips?startwith=10 HTTP/1.1"); @@ -1606,7 +1708,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "getPublicIp", VLANNetworkDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.publicNetworkPut(), 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.publicNetworkPut(), 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"); @@ -1621,7 +1724,8 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listExternalIps", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.externalNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.externalNetworkPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips HTTP/1.1"); @@ -1637,8 +1741,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listExternalIps", VLANNetworkDto.class, IpOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.externalNetworkPut(), options)); + Invokable method = method(InfrastructureAsyncApi.class, "listExternalIps", VLANNetworkDto.class, + IpOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.externalNetworkPut(), options))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "getExternalIp", VLANNetworkDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.externalNetworkPut(), 1)); + Invokable method = method(InfrastructureAsyncApi.class, "getExternalIp", VLANNetworkDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.externalNetworkPut(), 1))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "listUnmanagedIps", VLANNetworkDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.unmanagedNetworkPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.unmanagedNetworkPut()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips HTTP/1.1"); @@ -1686,8 +1795,10 @@ public class InfrastructureAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(InfrastructureAsyncApi.class, "listUnmanagedIps", VLANNetworkDto.class, IpOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.unmanagedNetworkPut(), options)); + Invokable method = method(InfrastructureAsyncApi.class, "listUnmanagedIps", VLANNetworkDto.class, + IpOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.unmanagedNetworkPut(), options))); assertRequestLineEquals(request, "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 method = method(InfrastructureAsyncApi.class, "getUnmanagedIp", VLANNetworkDto.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(NetworkResources.externalNetworkPut(), 1)); + Invokable method = method(InfrastructureAsyncApi.class, "getUnmanagedIp", VLANNetworkDto.class, + Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(NetworkResources.externalNetworkPut(), 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/limits/1/externalnetworks/1/ips/1 HTTP/1.1"); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java index 958335b9d0..335a46d5ba 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/PricingAsyncApiTest.java @@ -28,6 +28,7 @@ import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.abiquo.domain.PricingResources; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; 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.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code PricingAsyncApi}. * @@ -56,7 +58,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testListCurrencies() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + CurrenciesDto.BASE_MEDIA_TYPE + "\n"); @@ -71,7 +73,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testGetCurrency() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getCurrency", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/config/currencies/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n"); @@ -86,7 +88,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testCreateCurrency() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "createCurrency", CurrencyDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.currencyPost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.currencyPost()))); assertRequestLineEquals(request, "POST http://localhost/api/config/currencies HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n"); @@ -102,7 +105,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testUpdateCurrency() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "updateCurrency", CurrencyDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.currencyPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.currencyPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/config/currencies/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CurrencyDto.BASE_MEDIA_TYPE + "\n"); @@ -118,7 +122,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testDeleteCurrency() throws SecurityException, NoSuchMethodException { Invokable method = method(PricingAsyncApi.class, "deleteCurrency", CurrencyDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.currencyPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.currencyPut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/config/currencies/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -135,7 +140,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testListCostCodes() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + CostCodesDto.BASE_MEDIA_TYPE + "\n"); @@ -150,7 +155,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testGetCostCode() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getCostCode", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/config/costcodes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n"); @@ -165,7 +170,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testCreateCostCode() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "createCostCode", CostCodeDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.costcodePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.costcodePost()))); assertRequestLineEquals(request, "POST http://localhost/api/config/costcodes HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n"); @@ -181,7 +187,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testUpdateCostCode() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "updateCostCode", CostCodeDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.costcodePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.costcodePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/config/costcodes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeDto.BASE_MEDIA_TYPE + "\n"); @@ -197,7 +204,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testDeleteCostCode() throws SecurityException, NoSuchMethodException { Invokable method = method(PricingAsyncApi.class, "deleteCostCode", CostCodeDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.costcodePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.costcodePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/config/costcodes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -214,7 +222,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testListPricingTemplates() throws SecurityException, NoSuchMethodException, IOException { 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"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplatesDto.BASE_MEDIA_TYPE + "\n"); @@ -229,7 +237,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testGetPricingTemplate() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getPricingTemplate", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n"); @@ -244,7 +252,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testCreatePricingTemplate() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "createPricingTemplate", PricingTemplateDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.pricingtemplatePost())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.pricingtemplatePost()))); assertRequestLineEquals(request, "POST http://localhost/api/config/pricingtemplates HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n"); @@ -260,7 +269,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testUpdatePricingTemplate() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "updatePricingTemplate", PricingTemplateDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.pricingtemplatePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.pricingtemplatePut()))); assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingTemplateDto.BASE_MEDIA_TYPE + "\n"); @@ -276,7 +286,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testDeletePricingTemplate() throws SecurityException, NoSuchMethodException { Invokable method = method(PricingAsyncApi.class, "deletePricingTemplate", PricingTemplateDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.pricingtemplatePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.pricingtemplatePut()))); assertRequestLineEquals(request, "DELETE http://localhost/api/config/pricingtemplates/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); @@ -288,12 +299,12 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest checkFilters(request); } - + /*********************** Cost Code Currency ***********************/ public void testGetCostCodeCurrencies() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getCostCodeCurrencies", Integer.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(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"); @@ -309,7 +320,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testUpdateCostCodeCurrencies() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "updateCostCodeCurrencies", Integer.class, CostCodeCurrenciesDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, PricingResources.costcodecurrencyPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(1, PricingResources.costcodecurrencyPut()))); assertRequestLineEquals(request, "PUT http://localhost/api/config/costcodes/1/currencies HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + CostCodeCurrenciesDto.BASE_MEDIA_TYPE + "\n"); @@ -327,7 +339,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testGetPricingCostCodes() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getPricingCostCodes", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/costcodes HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodesDto.BASE_MEDIA_TYPE + "\n"); @@ -342,7 +354,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testGetPricingCostCode() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getPricingCostCode", Integer.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1, 1))); assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/costcodes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodeDto.BASE_MEDIA_TYPE + "\n"); @@ -356,9 +368,10 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest } public void testUpdatePricingCostCode() throws SecurityException, NoSuchMethodException, IOException { - Invokable method = method(PricingAsyncApi.class, "updatePricingCostCode", PricingCostCodeDto.class, Integer.class, - Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.pricingCostcodePut(), 1, 1)); + Invokable method = method(PricingAsyncApi.class, "updatePricingCostCode", PricingCostCodeDto.class, + Integer.class, Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.pricingCostcodePut(), 1, 1))); assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1/costcodes/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingCostCodeDto.BASE_MEDIA_TYPE + "\n"); @@ -376,7 +389,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testGetPricingTiers() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getPricingTiers", Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1))); assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/tiers HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingTiersDto.BASE_MEDIA_TYPE + "\n"); @@ -391,7 +404,7 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testGetPricingTier() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "getPricingTier", Integer.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1, 1))); assertRequestLineEquals(request, "GET http://localhost/api/config/pricingtemplates/1/tiers/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingTierDto.BASE_MEDIA_TYPE + "\n"); @@ -407,7 +420,8 @@ public class PricingAsyncApiTest extends BaseAbiquoAsyncApiTest public void testUpdatePricingTier() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(PricingAsyncApi.class, "updatePricingTier", PricingTierDto.class, Integer.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(PricingResources.pricingTierPut(), 1, 2)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(PricingResources.pricingTierPut(), 1, 2))); assertRequestLineEquals(request, "PUT http://localhost/api/config/pricingtemplates/1/tiers/2 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + PricingTierDto.BASE_MEDIA_TYPE + "\n"); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java index dacfa61ac3..b6930a1ab8 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/TaskAsyncApiTest.java @@ -27,6 +27,7 @@ import org.jclouds.abiquo.AbiquoFallbacks.NullOn303; import org.jclouds.abiquo.domain.CloudResources; import org.jclouds.abiquo.domain.TemplateResources; import org.jclouds.http.functions.ParseXMLWithJAXB; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; 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.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code TaskAsyncApi} * @@ -48,16 +50,14 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetTaskVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(TaskAsyncApi.class, "getTask", RESTLink.class); - GeneratedHttpRequest request = processor - .createRequest( - method, - ImmutableList. of(new RESTLink( - "task", - "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks/169f1877-5f17-4f62-9563-974001295c54"))); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(new RESTLink("task", + "http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1" + + "/tasks/169f1877-5f17-4f62-9563-974001295c54")))); - assertRequestLineEquals( - request, - "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1"); + assertRequestLineEquals(request, + "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/" + + "tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TaskDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, null, null, false); @@ -70,7 +70,8 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListTasksVirtualMachine() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(TaskAsyncApi.class, "listTasks", SingleResourceTransportDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(CloudResources.virtualMachinePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(CloudResources.virtualMachinePut()))); assertRequestLineEquals(request, "GET http://localhost/api/cloud/virtualdatacenters/1/virtualappliances/1/virtualmachines/1/tasks HTTP/1.1"); @@ -86,16 +87,14 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testGetTaskVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(TaskAsyncApi.class, "getTask", RESTLink.class); - GeneratedHttpRequest request = processor - .createRequest( - method, - ImmutableList. of(new RESTLink( - "task", - "http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/tasks/169f1877-5f17-4f62-9563-974001295c54"))); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(new RESTLink("task", + "http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/" + + "tasks/169f1877-5f17-4f62-9563-974001295c54")))); - assertRequestLineEquals( - request, - "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1"); + assertRequestLineEquals(request, + "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1" + + "/tasks/169f1877-5f17-4f62-9563-974001295c54 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TaskDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, null, null, false); @@ -108,10 +107,11 @@ public class TaskAsyncApiTest extends BaseAbiquoAsyncApiTest { public void testListTasksVirtualMachineTemplate() throws SecurityException, NoSuchMethodException, IOException { Invokable method = method(TaskAsyncApi.class, "listTasks", SingleResourceTransportDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(TemplateResources.virtualMachineTemplatePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(TemplateResources.virtualMachineTemplatePut()))); - assertRequestLineEquals(request, - "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/tasks HTTP/1.1"); + assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/" + + "virtualmachinetemplates/1/tasks HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + TasksDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, null, null, false); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java index b0ba199c78..5bcad1100c 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/features/VirtualMachineTemplateAsyncApiTest.java @@ -31,6 +31,7 @@ import org.jclouds.abiquo.domain.cloud.options.VirtualMachineTemplateOptions; import org.jclouds.abiquo.functions.ReturnTaskReferenceOrNull; import org.jclouds.http.functions.ParseXMLWithJAXB; import org.jclouds.http.functions.ReleasePayloadAndReturn; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; 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.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code VirtualMachineTemplateAsyncApi} * @@ -56,9 +58,9 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates", Integer.class, - Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, 1)); + Invokable method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates", + Integer.class, Integer.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1, 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates HTTP/1.1"); @@ -74,10 +76,15 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates", Integer.class, - Integer.class, VirtualMachineTemplateOptions.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, 1, VirtualMachineTemplateOptions.builder() - .hypervisorType(HypervisorType.XENSERVER).categoryName("Firewalls").build())); + Invokable method = method(VirtualMachineTemplateAsyncApi.class, "listVirtualMachineTemplates", + Integer.class, Integer.class, VirtualMachineTemplateOptions.class); + GeneratedHttpRequest request = processor.apply(Invocation.create( + method, + ImmutableList. of( + 1, + 1, + VirtualMachineTemplateOptions.builder().hypervisorType(HypervisorType.XENSERVER) + .categoryName("Firewalls").build()))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates" @@ -95,7 +102,7 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "getVirtualMachineTemplate", Integer.class, Integer.class, Integer.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, 1, 1)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(1, 1, 1))); assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1"); @@ -112,10 +119,11 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "updateVirtualMachineTemplate", VirtualMachineTemplateDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(TemplateResources.virtualMachineTemplatePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(TemplateResources.virtualMachineTemplatePut()))); - assertRequestLineEquals(request, - "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1"); + assertRequestLineEquals(request, "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/" + + "virtualmachinetemplates/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + VirtualMachineTemplateDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, withHeader(TemplateResources.virtualMachineTemplatePutPayload()), VirtualMachineTemplateDto.class, VirtualMachineTemplateDto.BASE_MEDIA_TYPE, false); @@ -130,10 +138,11 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "deleteVirtualMachineTemplate", VirtualMachineTemplateDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(TemplateResources.virtualMachineTemplatePut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(TemplateResources.virtualMachineTemplatePut()))); - assertRequestLineEquals(request, - "DELETE http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1 HTTP/1.1"); + assertRequestLineEquals(request, "DELETE http://localhost/api/admin/enterprises/1/datacenterrepositories/1/" + + "virtualmachinetemplates/1 HTTP/1.1"); assertNonPayloadHeadersEqual(request, ""); assertPayloadEquals(request, null, null, false); @@ -148,7 +157,8 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "createPersistentVirtualMachineTemplate", Integer.class, Integer.class, VirtualMachineTemplatePersistentDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(1, 1, TemplateResources.persistentData())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(1, 1, TemplateResources.persistentData()))); assertRequestLineEquals(request, "POST http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates HTTP/1.1"); @@ -169,12 +179,13 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "requestConversion", VirtualMachineTemplateDto.class, DiskFormatType.class, ConversionDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(TemplateResources.virtualMachineTemplatePut(), - DiskFormatType.VMDK_STREAM_OPTIMIZED, TemplateResources.conversionPut())); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of( + TemplateResources.virtualMachineTemplatePut(), DiskFormatType.VMDK_STREAM_OPTIMIZED, + TemplateResources.conversionPut()))); - assertRequestLineEquals( - request, - "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/conversions/VMDK_STREAM_OPTIMIZED HTTP/1.1"); + assertRequestLineEquals(request, + "PUT http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/" + + "1/conversions/VMDK_STREAM_OPTIMIZED HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + AcceptedRequestDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, withHeader(TemplateResources.conversionPutPlayload()), @@ -188,11 +199,14 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "listConversions", VirtualMachineTemplateDto.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(TemplateResources.virtualMachineTemplatePut())); + Invokable method = method(VirtualMachineTemplateAsyncApi.class, "listConversions", + VirtualMachineTemplateDto.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(TemplateResources.virtualMachineTemplatePut()))); 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"); assertPayloadEquals(request, null, null, false); @@ -206,15 +220,14 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "listConversions", VirtualMachineTemplateDto.class, ConversionOptions.class); - GeneratedHttpRequest request = processor.createRequest( + GeneratedHttpRequest request = processor.apply(Invocation.create( method, - ImmutableList. of(TemplateResources.virtualMachineTemplatePut(), - ConversionOptions.builder().hypervisorType(HypervisorType.XENSERVER) - .conversionState(ConversionState.FINISHED).build())); + ImmutableList. of(TemplateResources.virtualMachineTemplatePut(), ConversionOptions.builder() + .hypervisorType(HypervisorType.XENSERVER).conversionState(ConversionState.FINISHED).build()))); assertRequestLineEquals(request, - "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/conversions" - + "?hypervisor=XENSERVER&state=FINISHED HTTP/1.1"); + "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/" + + "1/conversions" + "?hypervisor=XENSERVER&state=FINISHED HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + ConversionsDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, null, null, false); @@ -226,14 +239,13 @@ public class VirtualMachineTemplateAsyncApiTest extends BaseAbiquoAsyncApiTest method = method(VirtualMachineTemplateAsyncApi.class, "getConversion", VirtualMachineTemplateDto.class, - DiskFormatType.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(TemplateResources.virtualMachineTemplatePut(), - DiskFormatType.RAW)); + Invokable method = method(VirtualMachineTemplateAsyncApi.class, "getConversion", + VirtualMachineTemplateDto.class, DiskFormatType.class); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, + ImmutableList. of(TemplateResources.virtualMachineTemplatePut(), DiskFormatType.RAW))); - assertRequestLineEquals( - request, - "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/virtualmachinetemplates/1/conversions/RAW HTTP/1.1"); + assertRequestLineEquals(request, "GET http://localhost/api/admin/enterprises/1/datacenterrepositories/1/" + + "virtualmachinetemplates/1/conversions/RAW HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + ConversionDto.BASE_MEDIA_TYPE + "\n"); assertPayloadEquals(request, null, null, false); diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java index fcf0f1602b..e49b960ec3 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/internal/AsyncMonitorTest.java @@ -513,7 +513,7 @@ public class AsyncMonitorTest { }; } - private static class CoutingEventHandler { + static class CoutingEventHandler { public int numCompletes = 0; public int numFailures = 0; diff --git a/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java b/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java index 83115a260f..a855ee973f 100644 --- a/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java +++ b/labs/abiquo/src/test/java/org/jclouds/abiquo/rest/internal/AbiquoHttpAsyncClientTest.java @@ -26,6 +26,7 @@ import java.io.IOException; import org.jclouds.Fallbacks.NullOnNotFoundOr404; import org.jclouds.abiquo.features.BaseAbiquoAsyncApiTest; import org.jclouds.functions.IdentityFunction; +import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.testng.annotations.Test; @@ -33,6 +34,7 @@ import com.abiquo.model.rest.RESTLink; import com.abiquo.server.core.infrastructure.DatacentersDto; import com.google.common.collect.ImmutableList; import com.google.common.reflect.Invokable; + /** * Tests annotation parsing of {@code AbiquoHttpAsyncApi}. * @@ -45,7 +47,7 @@ public class AbiquoHttpAsyncClientTest extends BaseAbiquoAsyncApiTest method = method(AbiquoHttpAsyncClient.class, "get", RESTLink.class); - GeneratedHttpRequest request = processor.createRequest(method, ImmutableList. of(link)); + GeneratedHttpRequest request = processor.apply(Invocation.create(method, ImmutableList. of(link))); assertRequestLineEquals(request, "GET http://foo/bar HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: " + DatacentersDto.BASE_MEDIA_TYPE + "\n");