mirror of https://github.com/apache/jclouds.git
fix typo and tidy tests
This commit is contained in:
parent
e368e8e4cc
commit
0feb27fd93
|
@ -46,24 +46,11 @@ import com.google.common.collect.ImmutableMultimap;
|
||||||
public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||||
@Test
|
@Test
|
||||||
public void testWhenResponseIs2xxLoginReturnsValidOrgList() {
|
public void testWhenResponseIs2xxLoginReturnsValidOrgList() {
|
||||||
HttpRequest orgListRequest = HttpRequest.builder()
|
|
||||||
.method("GET")
|
|
||||||
.endpoint(URI.create("http://localhost/api/org/"))
|
|
||||||
.headers(ImmutableMultimap.<String, String> builder()
|
|
||||||
.put("Accept", "*/*")
|
|
||||||
.put("x-vcloud-authorization",token)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
HttpResponse orgListResponse = HttpResponse.builder()
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
.statusCode(200)
|
getStandardRequest("GET", URI.create("http://localhost/api/org/")),
|
||||||
.payload(payloadFromResourceWithContentType("/org/orglist.xml", VCloudDirectorMediaType.ORGLIST_XML
|
getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORGLIST_XML));
|
||||||
+";version=1.5"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgListRequest,
|
|
||||||
orgListResponse);
|
|
||||||
|
|
||||||
OrgList expected = OrgList.builder()
|
OrgList expected = OrgList.builder()
|
||||||
.org(Reference.builder()
|
.org(Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.org+xml")
|
.type("application/vnd.vmware.vcloud.org+xml")
|
||||||
|
@ -79,21 +66,9 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
||||||
public void testWhenResponseIs2xxLoginReturnsValidOrg() {
|
public void testWhenResponseIs2xxLoginReturnsValidOrg() {
|
||||||
URI orgRef = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
URI orgRef = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||||
|
|
||||||
HttpRequest orgRequest = HttpRequest.builder()
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
.method("GET")
|
getStandardRequest("GET", orgRef),
|
||||||
.endpoint(orgRef)
|
getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG_XML));
|
||||||
.headers(ImmutableMultimap.<String, String> 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);
|
|
||||||
|
|
||||||
Org expected = Org
|
Org expected = Org
|
||||||
.builder()
|
.builder()
|
||||||
|
@ -154,7 +129,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
||||||
|
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
getStandardRequest("GET", metaRef),
|
getStandardRequest("GET", metaRef),
|
||||||
getStandardPaylodResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA_XML));
|
getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA_XML));
|
||||||
|
|
||||||
Metadata expected = Metadata.builder()
|
Metadata expected = Metadata.builder()
|
||||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||||
|
@ -169,13 +144,13 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
||||||
assertEquals(client.getOrgClient().getMetadata(orgRef), expected);
|
assertEquals(client.getOrgClient().getMetadata(orgRef), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(enabled=false)
|
@Test(enabled=false) // No metadata in exemplar xml...
|
||||||
public void testWhenResponseIs2xxLoginReturnsValidMetadata() {
|
public void testWhenResponseIs2xxLoginReturnsValidMetadata() {
|
||||||
URI metadataRef = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY");
|
URI metadataRef = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY");
|
||||||
|
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
getStandardRequest("GET", metadataRef),
|
getStandardRequest("GET", metadataRef),
|
||||||
getStandardPaylodResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATAENTRY_XML));
|
getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATAENTRY_XML));
|
||||||
|
|
||||||
MetadataEntry expected = MetadataEntry.builder()
|
MetadataEntry expected = MetadataEntry.builder()
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
||||||
.build()).build();
|
.build()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpResponse getStandardPaylodResponse(String relativeFilePath, String mediaType) {
|
protected HttpResponse getStandardPayloadResponse(String relativeFilePath, String mediaType) {
|
||||||
return HttpResponse.builder().statusCode(200)
|
return HttpResponse.builder().statusCode(200)
|
||||||
.payload(payloadFromResourceWithContentType(relativeFilePath, mediaType+";version=1.5")).build();
|
.payload(payloadFromResourceWithContentType(relativeFilePath, mediaType+";version=1.5")).build();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue