change expect test to match live xml

This commit is contained in:
danikov 2012-03-06 11:01:55 +00:00
parent 53c8222eac
commit 23267369c1
1 changed files with 47 additions and 9 deletions

View File

@ -27,6 +27,7 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog; import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItems; import org.jclouds.vcloud.director.v1_5.domain.CatalogItems;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
import org.jclouds.vcloud.director.v1_5.domain.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Reference;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -47,7 +48,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.acceptAnyMedia() .acceptAnyMedia()
.httpRequestBuilder().build(), .httpRequestBuilder().build(),
new VcloudHttpResponsePrimer() new VcloudHttpResponsePrimer()
.xmlFilePayload("/admin/catalog/catalog.xml", VCloudDirectorMediaType.ADMIN_CATALOG) .xmlFilePayload("/catalog/admin/catalog.xml", VCloudDirectorMediaType.ADMIN_CATALOG)
.httpResponseBuilder().build()); .httpResponseBuilder().build());
AdminCatalog expected = catalog(); AdminCatalog expected = catalog();
@ -58,31 +59,64 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.href(URI.create(endpoint + "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")) .href(URI.create(endpoint + "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.build(); .build();
assertEquals(client.getCatalogClient().getCatalog(catalogRef), expected); assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getURI()), expected);
} }
public static final AdminCatalog catalog() { public static final AdminCatalog catalog() {
return AdminCatalog.builder() return AdminCatalog.builder()
.name("QunyingTestCatalog") .name("QunyingTestCatalog")
.type("application/vnd.vmware.vcloud.catalog+xml")
.id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4") .id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4")) .type("application/vnd.vmware.admin.catalog+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.link(Link.builder() .link(Link.builder()
.rel("up") .rel("up")
.type("application/vnd.vmware.vcloud.org+xml") .type("application/vnd.vmware.admin.organization+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")) .href(URI.create("https://vcloudbeta.bluelock.com/api/admin/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
.build())
.link(Link.builder()
.rel("alternate")
.type("application/vnd.vmware.vcloud.catalog+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.build())
.link(Link.builder()
.rel("down")
.type("application/vnd.vmware.vcloud.owner+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"))
.build()) .build())
.link(Link.builder() .link(Link.builder()
.rel("add") .rel("add")
.type("application/vnd.vmware.vcloud.catalogItem+xml") .type("application/vnd.vmware.vcloud.catalogItem+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"))
.build()) .build())
.link(Link.builder()
.rel("edit")
.type("application/vnd.vmware.admin.catalog+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.build())
.link(Link.builder()
.rel("remove")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
.build())
.link(Link.builder() .link(Link.builder()
.rel("down") .rel("down")
.type("application/vnd.vmware.vcloud.metadata+xml") .type("application/vnd.vmware.vcloud.metadata+xml")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
.build()) .build())
.description("Testing")
.owner(Owner.builder()
.type("application/vnd.vmware.vcloud.owner+xml")
.user(Reference.builder()
.type("application/vnd.vmware.admin.user+xml")
.name("qunying.huang@enstratus.com")
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"))
.build())
.build())
.catalogItems(CatalogItems.builder() .catalogItems(CatalogItems.builder()
.item(Reference.builder()
.type("application/vnd.vmware.vcloud.catalogItem+xml")
.name("image")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"))
.build())
.item(Reference.builder() .item(Reference.builder()
.type("application/vnd.vmware.vcloud.catalogItem+xml") .type("application/vnd.vmware.vcloud.catalogItem+xml")
.name("ubuntu10") .name("ubuntu10")
@ -93,9 +127,13 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
.name("imageTesting") .name("imageTesting")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939")) .href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
.build()) .build())
.item(Reference.builder()
.type("application/vnd.vmware.vcloud.catalogItem+xml")
.name("TestCase")
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"))
.build())
.build()) .build())
.description("Testing") .isPublished(false)
.build(); .build();
} }
} }