mirror of https://github.com/apache/jclouds.git
Merge pull request #400 from danikov/vclouds-director-admin-catalog-3
Issue 830: vCloud director Admin Catalog (get/setOwner)
This commit is contained in:
commit
c793f706a7
|
@ -23,6 +23,7 @@ import java.net.URI;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.PUT;
|
import javax.ws.rs.PUT;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
|
|
||||||
import org.jclouds.rest.annotations.BinderParam;
|
import org.jclouds.rest.annotations.BinderParam;
|
||||||
|
@ -33,6 +34,7 @@ import org.jclouds.rest.annotations.RequestFilters;
|
||||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
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.Owner;
|
||||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||||
|
|
||||||
|
@ -65,8 +67,28 @@ public interface AdminCatalogAsyncClient {
|
||||||
ListenableFuture<AdminCatalog> updateCatalog(@EndpointParam URI catalogRef,
|
ListenableFuture<AdminCatalog> updateCatalog(@EndpointParam URI catalogRef,
|
||||||
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
|
@BinderParam(BindToXMLPayload.class) AdminCatalog catalog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AdminClient#getOwner(URI)
|
||||||
|
*/
|
||||||
|
@GET
|
||||||
|
@Path("/owner")
|
||||||
|
@Consumes
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<Owner> getOwner(@EndpointParam URI catalogRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see AdminClient#setOwner(URI, Owner)
|
||||||
|
*/
|
||||||
|
@PUT
|
||||||
|
@Path("/owner")
|
||||||
|
@Consumes
|
||||||
|
@Produces(VCloudDirectorMediaType.OWNER)
|
||||||
|
@JAXBResponseParser
|
||||||
|
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||||
|
ListenableFuture<Void> setOwner(@EndpointParam URI catalogRef,
|
||||||
|
@BinderParam(BindToXMLPayload.class) Owner newOwner);
|
||||||
|
|
||||||
// DELETE /admin/catalog/{id}
|
// DELETE /admin/catalog/{id}
|
||||||
// POST /admin/catalog/{id}/action/publish
|
// POST /admin/catalog/{id}/action/publish
|
||||||
// GET /admin/catalog/{id}/owner
|
|
||||||
// PUT /admin/catalog/{id}/owner
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.jclouds.concurrent.Timeout;
|
import org.jclouds.concurrent.Timeout;
|
||||||
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.Owner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides synchronous access to {@link AdminCatalog} objects.
|
* Provides synchronous access to {@link AdminCatalog} objects.
|
||||||
|
@ -56,4 +57,24 @@ public interface AdminCatalogClient {
|
||||||
* @return the updated catalog
|
* @return the updated catalog
|
||||||
*/
|
*/
|
||||||
AdminCatalog updateCatalog(URI catalogRef, AdminCatalog catalog);
|
AdminCatalog updateCatalog(URI catalogRef, AdminCatalog catalog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the owner of a catalog.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* GET /admin/catalog/{id}/owner
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @return the owner or null if not found
|
||||||
|
*/
|
||||||
|
Owner getOwner(URI catalogRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes owner for catalog.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* PUT /admin/catalog/{id}/owner
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
void setOwner(URI catalogRef, Owner newOwner);
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class Checks {
|
||||||
checkEntityType(catalog);
|
checkEntityType(catalog);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkOwner(Owner owner) {
|
public static void checkOwner(Owner owner) {
|
||||||
// Check optional elements/attributes
|
// Check optional elements/attributes
|
||||||
if (owner.getUser() != null) {
|
if (owner.getUser() != null) {
|
||||||
checkReferenceType(owner.getUser());
|
checkReferenceType(owner.getUser());
|
||||||
|
|
|
@ -40,6 +40,12 @@ import org.testng.annotations.Test;
|
||||||
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "CatalogClientExpectTest")
|
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "CatalogClientExpectTest")
|
||||||
public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||||
|
|
||||||
|
private Reference catalogRef = Reference.builder()
|
||||||
|
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||||
|
.name("QunyingTestCatalog")
|
||||||
|
.href(URI.create(endpoint + "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||||
|
.build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCatalog() {
|
public void testGetCatalog() {
|
||||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
|
@ -53,12 +59,6 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
||||||
|
|
||||||
AdminCatalog expected = catalog();
|
AdminCatalog expected = catalog();
|
||||||
|
|
||||||
Reference catalogRef = Reference.builder()
|
|
||||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
|
||||||
.name("QunyingTestCatalog")
|
|
||||||
.href(URI.create(endpoint + "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getURI()), expected);
|
assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getURI()), expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,13 +76,46 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
||||||
|
|
||||||
AdminCatalog expected = modifyCatalog();
|
AdminCatalog expected = modifyCatalog();
|
||||||
|
|
||||||
Reference catalogRef = Reference.builder()
|
assertEquals(client.getAdminCatalogClient().updateCatalog(catalogRef.getURI(), expected), expected);
|
||||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
}
|
||||||
.name("QunyingTestCatalog")
|
|
||||||
.href(URI.create(endpoint + "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
@Test
|
||||||
|
public void testGetOwner() {
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
|
new VcloudHttpRequestPrimer()
|
||||||
|
.apiCommand("GET", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner")
|
||||||
|
.acceptAnyMedia()
|
||||||
|
.httpRequestBuilder().build(),
|
||||||
|
new VcloudHttpResponsePrimer()
|
||||||
|
.xmlFilePayload("/catalog/admin/owner.xml", VCloudDirectorMediaType.OWNER)
|
||||||
|
.httpResponseBuilder().build());
|
||||||
|
|
||||||
|
Owner expected = owner();
|
||||||
|
|
||||||
|
assertEquals(client.getAdminCatalogClient().getOwner(catalogRef.getURI()), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSetOwner() {
|
||||||
|
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||||
|
new VcloudHttpRequestPrimer()
|
||||||
|
.apiCommand("PUT", "/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner")
|
||||||
|
.xmlFilePayload("/catalog/admin/updateOwnerSource.xml", VCloudDirectorMediaType.OWNER)
|
||||||
|
.acceptAnyMedia()
|
||||||
|
.httpRequestBuilder().build(),
|
||||||
|
new VcloudHttpResponsePrimer()
|
||||||
|
.httpResponseBuilder().statusCode(204).build());
|
||||||
|
|
||||||
|
Owner newOwner = Owner.builder()
|
||||||
|
.type("application/vnd.vmware.vcloud.owner+xml")
|
||||||
|
.user(Reference.builder()
|
||||||
|
.type("application/vnd.vmware.admin.user+xml")
|
||||||
|
.name("adk@cloudsoftcorp.com")
|
||||||
|
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"))
|
||||||
|
.build())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertEquals(client.getAdminCatalogClient().updateCatalog(catalogRef.getURI(), expected), expected);
|
client.getAdminCatalogClient().setOwner(catalogRef.getURI(), newOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final AdminCatalog catalog() {
|
public static final AdminCatalog catalog() {
|
||||||
|
@ -126,14 +159,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
||||||
.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")
|
.description("Testing")
|
||||||
.owner(Owner.builder()
|
.owner(owner())
|
||||||
.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()
|
.item(Reference.builder()
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||||
|
@ -160,78 +186,21 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Owner owner() {
|
||||||
|
return 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();
|
||||||
|
}
|
||||||
|
|
||||||
public static final AdminCatalog modifyCatalog() {
|
public static final AdminCatalog modifyCatalog() {
|
||||||
return AdminCatalog.builder()
|
return catalog().toBuilder()
|
||||||
.name("new QunyingTestCatalog")
|
.name("new QunyingTestCatalog")
|
||||||
.id("urn:vcloud: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()
|
|
||||||
.rel("up")
|
|
||||||
.type("application/vnd.vmware.admin.organization+xml")
|
|
||||||
.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())
|
|
||||||
.link(Link.builder()
|
|
||||||
.rel("add")
|
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
|
||||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/catalogItems"))
|
|
||||||
.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()
|
|
||||||
.rel("down")
|
|
||||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
|
||||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
|
||||||
.build())
|
|
||||||
.description("new Testing")
|
.description("new 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()
|
|
||||||
.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()
|
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
|
||||||
.name("ubuntu10")
|
|
||||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
|
||||||
.build())
|
|
||||||
.item(Reference.builder()
|
|
||||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
|
||||||
.name("imageTesting")
|
|
||||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
|
|
||||||
.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())
|
|
||||||
.isPublished(false)
|
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,11 @@
|
||||||
package org.jclouds.vcloud.director.v1_5.features;
|
package org.jclouds.vcloud.director.v1_5.features;
|
||||||
|
|
||||||
import static com.google.common.base.Objects.equal;
|
import static com.google.common.base.Objects.equal;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.GETTER_RETURNS_SAME_OBJ;
|
||||||
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_UPDATABLE;
|
||||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
||||||
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
@ -28,6 +31,7 @@ import java.net.URI;
|
||||||
|
|
||||||
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.Checks;
|
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||||
|
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.domain.ReferenceType;
|
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||||
|
@ -55,6 +59,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
|
||||||
*/
|
*/
|
||||||
private ReferenceType<?> catalogRef;
|
private ReferenceType<?> catalogRef;
|
||||||
private AdminCatalog catalog;
|
private AdminCatalog catalog;
|
||||||
|
private Owner owner;
|
||||||
|
|
||||||
@BeforeClass(inheritGroups = true)
|
@BeforeClass(inheritGroups = true)
|
||||||
public void setupRequiredClients() {
|
public void setupRequiredClients() {
|
||||||
|
@ -72,7 +77,38 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest
|
||||||
Checks.checkAdminCatalog(catalog);
|
Checks.checkAdminCatalog(catalog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(testName = "PUT /admin/catalog/{id}", dependsOnMethods = { "testGetCatalog" })
|
@Test(testName = "GET /admin/catalog/{id}/owner",
|
||||||
|
dependsOnMethods = { "testGetCatalog" })
|
||||||
|
public void testGetCatalogOwner() {
|
||||||
|
owner = catalogClient.getOwner(catalog.getURI());
|
||||||
|
Checks.checkOwner(owner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(testName = "PUT /admin/catalog/{id}/owner",
|
||||||
|
dependsOnMethods = { "testGetCatalog" })
|
||||||
|
public void updateCatalogOwner() {
|
||||||
|
Owner oldOwner = owner;
|
||||||
|
Owner newOwner = Owner.builder() // TODO auto-find a new owner?
|
||||||
|
.type("application/vnd.vmware.vcloud.owner+xml")
|
||||||
|
.user(Reference.builder()
|
||||||
|
.type("application/vnd.vmware.admin.user+xml")
|
||||||
|
.name("adk@cloudsoftcorp.com")
|
||||||
|
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"))
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try {
|
||||||
|
catalogClient.setOwner(catalog.getURI(), newOwner);
|
||||||
|
owner = catalogClient.getOwner(catalog.getURI());
|
||||||
|
Checks.checkOwner(owner);
|
||||||
|
assertTrue(equal(owner, newOwner), String.format(OBJ_FIELD_UPDATABLE, CATALOG, "owner"));
|
||||||
|
} finally {
|
||||||
|
catalogClient.setOwner(catalog.getURI(), oldOwner);
|
||||||
|
owner = catalogClient.getOwner(catalog.getURI());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(testName = "PUT /admin/catalog/{id}", dependsOnMethods = { "testGetCatalogOwner" })
|
||||||
public void testUpdateCatalog() {
|
public void testUpdateCatalog() {
|
||||||
String oldName = catalog.getName();
|
String oldName = catalog.getName();
|
||||||
String newName = "new "+oldName;
|
String newName = "new "+oldName;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Owner xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.owner+xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://vcloudbeta.bluelock.com/api/v1.5/schema/master.xsd">
|
||||||
|
<Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||||
|
<Link rel="edit" type="application/vnd.vmware.vcloud.owner+xml" href="https://vcloudbeta.bluelock.com/api/admin/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/owner"/>
|
||||||
|
<User type="application/vnd.vmware.admin.user+xml" name="qunying.huang@enstratus.com" href="https://vcloudbeta.bluelock.com/api/admin/user/967d317c-4273-4a95-b8a4-bf63b78e9c69"/>
|
||||||
|
</Owner>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<Owner type="application/vnd.vmware.vcloud.owner+xml" xmlns="http://www.vmware.com/vcloud/v1.5">
|
||||||
|
<User type="application/vnd.vmware.admin.user+xml" name="adk@cloudsoftcorp.com" href="https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"/>
|
||||||
|
</Owner>
|
Loading…
Reference in New Issue