From 8891dcf280b13fc9b386b32500ecb2289757cb60 Mon Sep 17 00:00:00 2001 From: danikov Date: Mon, 5 Mar 2012 12:19:33 +0000 Subject: [PATCH] fix headers using primer approach --- .../features/NetworkClientExpectTest.java | 9 +++++++-- .../v1_5/features/OrgClientExpectTest.java | 20 ++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java index 8f99fdd390..fecbe925b4 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientExpectTest.java @@ -148,8 +148,13 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT URI networkUri = URI.create(endpoint + "/network/55a677cf-ab3f-48ae-b880-fab90421980c"); VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - getStandardRequest("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata"), - getStandardPayloadResponse("/network/metadata.xml", VCloudDirectorMediaType.METADATA)); + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/network/55a677cf-ab3f-48ae-b880-fab90421980c/metadata") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/network/metadata.xml", VCloudDirectorMediaType.METADATA) + .httpResponseBuilder().build()); Metadata expected = Metadata.builder() .type("application/vnd.vmware.vcloud.metadata+xml") diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java index 6489dacb3d..67242bafc2 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientExpectTest.java @@ -179,8 +179,13 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"), - getStandardPayloadResponse("/org/orgMetadata.xml", VCloudDirectorMediaType.METADATA)); + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/orgMetadata.xml", VCloudDirectorMediaType.METADATA) + .httpResponseBuilder().build()); Metadata expected = Metadata.builder() .type("application/vnd.vmware.vcloud.metadata+xml") @@ -202,9 +207,14 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testGetOrgMetadataValue() { URI orgUri = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, - getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"), - getStandardPayloadResponse("/org/orgMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE)); + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + new VcloudHttpRequestPrimer() + .apiCommand("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY") + .acceptAnyMedia() + .httpRequestBuilder().build(), + new VcloudHttpResponsePrimer() + .xmlFilePayload("/org/orgMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE) + .httpResponseBuilder().build()); MetadataValue expected = metadataValue();