From 0feb27fd93a7f5694a80372bb128e07b04e07725 Mon Sep 17 00:00:00 2001 From: danikov Date: Tue, 7 Feb 2012 15:21:11 +0000 Subject: [PATCH] fix typo and tidy tests --- .../v1_5/features/OrgClientExpectTest.java | 43 ++++--------------- ...aseVCloudDirectorRestClientExpectTest.java | 2 +- 2 files changed, 10 insertions(+), 35 deletions(-) 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 eae3034c18..0f2d02e1a1 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 @@ -46,24 +46,11 @@ import com.google.common.collect.ImmutableMultimap; public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { @Test public void testWhenResponseIs2xxLoginReturnsValidOrgList() { - HttpRequest orgListRequest = HttpRequest.builder() - .method("GET") - .endpoint(URI.create("http://localhost/api/org/")) - .headers(ImmutableMultimap. builder() - .put("Accept", "*/*") - .put("x-vcloud-authorization",token) - .build()) - .build(); - HttpResponse orgListResponse = HttpResponse.builder() - .statusCode(200) - .payload(payloadFromResourceWithContentType("/org/orglist.xml", VCloudDirectorMediaType.ORGLIST_XML - +";version=1.5")) - .build(); + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + getStandardRequest("GET", URI.create("http://localhost/api/org/")), + getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORGLIST_XML)); - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgListRequest, - orgListResponse); - OrgList expected = OrgList.builder() .org(Reference.builder() .type("application/vnd.vmware.vcloud.org+xml") @@ -79,21 +66,9 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest public void testWhenResponseIs2xxLoginReturnsValidOrg() { URI orgRef = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"); - HttpRequest orgRequest = HttpRequest.builder() - .method("GET") - .endpoint(orgRef) - .headers(ImmutableMultimap. builder() - .put("Accept", "*/*") - .put("x-vcloud-authorization", token) - .build()) - .build(); - - HttpResponse orgResponse = HttpResponse.builder() - .statusCode(200) - .payload(payloadFromResourceWithContentType("/org/org.xml", VCloudDirectorMediaType.ORG_XML + ";version=1.5")) - .build(); - - VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgRequest, orgResponse); + VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, + getStandardRequest("GET", orgRef), + getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG_XML)); Org expected = Org .builder() @@ -154,7 +129,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", metaRef), - getStandardPaylodResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA_XML)); + getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA_XML)); Metadata expected = Metadata.builder() .type("application/vnd.vmware.vcloud.metadata+xml") @@ -169,13 +144,13 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest assertEquals(client.getOrgClient().getMetadata(orgRef), expected); } - @Test(enabled=false) + @Test(enabled=false) // No metadata in exemplar xml... public void testWhenResponseIs2xxLoginReturnsValidMetadata() { URI metadataRef = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"); VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, getStandardRequest("GET", metadataRef), - getStandardPaylodResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATAENTRY_XML)); + getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATAENTRY_XML)); MetadataEntry expected = MetadataEntry.builder() .build(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java index 9177a97d2e..244ede2323 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorRestClientExpectTest.java @@ -65,7 +65,7 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect .build()).build(); } - protected HttpResponse getStandardPaylodResponse(String relativeFilePath, String mediaType) { + protected HttpResponse getStandardPayloadResponse(String relativeFilePath, String mediaType) { return HttpResponse.builder().statusCode(200) .payload(payloadFromResourceWithContentType(relativeFilePath, mediaType+";version=1.5")).build(); }