fix tests

This commit is contained in:
danikov 2012-02-07 15:15:55 +00:00
parent 693af6dc25
commit e368e8e4cc
1 changed files with 22 additions and 20 deletions

View File

@ -64,15 +64,15 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgListRequest, VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgListRequest,
orgListResponse); orgListResponse);
OrgList actual = OrgList.builder() OrgList expected = OrgList.builder()
.org(OrgLink.builder() .org(Reference.builder()
.type("application/vnd.vmware.vcloud.org+xml") .type("application/vnd.vmware.vcloud.org+xml")
.name("JClouds") .name("JClouds")
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build()) .build())
.build(); .build();
assertEquals(client.getOrgClient().getOrgList(), actual); assertEquals(client.getOrgClient().getOrgList(), expected);
} }
@Test @Test
@ -95,7 +95,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgRequest, orgResponse); VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, orgRequest, orgResponse);
Org actual = Org Org expected = Org
.builder() .builder()
.name("JClouds") .name("JClouds")
.description("") .description("")
@ -129,7 +129,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.rel("down") .rel("down")
.type("application/vnd.vmware.vcloud.orgNetwork+xml") .type("application/vnd.vmware.vcloud.orgNetwork+xml")
.name("ilsolation01-Jclouds") .name("ilsolation01-Jclouds")
.href(URI.create("https://vcloudbeta.bluelock.com/api/network/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .href(URI.create("https://vcloudbeta.bluelock.com/api/network/f3ba8256-6f48-4512-aad6-600e85b4dc38"))
.build()) .build())
.link(Link.builder() .link(Link.builder()
.rel("down") .rel("down")
@ -144,40 +144,42 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
.build()) .build())
.build(); .build();
assertEquals(client.getOrgClient().getOrg(orgRef), actual); assertEquals(client.getOrgClient().getOrg(orgRef), expected);
} }
@Test @Test
public void testWhenResponseIs2xxLoginReturnsValidMetadataList() { public void testWhenResponseIs2xxLoginReturnsValidMetadataList() {
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");
URI metaRef = URI.create(orgRef.toASCIIString()+"/metadata/");
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
getStandardRequest("GET", orgRef), getStandardRequest("GET", metaRef),
getStandardPaylodResponse("/orglist.xml")); getStandardPaylodResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA_XML));
Metadata actual = Metadata.builder() Metadata expected = Metadata.builder()
// .link(Link.builder() .type("application/vnd.vmware.vcloud.metadata+xml")
// .rel("up") .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))
// .type("application/vnd.vmware.vcloud.vdc+xml") .link(Link.builder()
// .name("Cluster01-JClouds") .rel("up")
// .href(URI.create("https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07")) .type("application/vnd.vmware.vcloud.org+xml")
// .build()) .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build())
.build(); .build();
assertEquals(client.getOrgClient().getMetadata(orgRef), actual); assertEquals(client.getOrgClient().getMetadata(orgRef), expected);
} }
@Test(enabled=false) @Test(enabled=false)
public void testWhenResponseIs2xxLoginReturnsValidMetadata() { public void testWhenResponseIs2xxLoginReturnsValidMetadata() {
URI metadataRef = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadataKEY"); 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")); getStandardPaylodResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATAENTRY_XML));
MetadataEntry actual = MetadataEntry.builder() MetadataEntry expected = MetadataEntry.builder()
.build(); .build();
assertEquals(client.getOrgClient().getMetadataEntry(metadataRef), actual); assertEquals(client.getOrgClient().getMetadataEntry(metadataRef), expected);
} }
} }