mirror of https://github.com/apache/jclouds.git
Updating tests.
- Created new live tests for Org and Task and some Catalog - Helper methods for domain object builders and consistency checks - Updated existing expect/unit tests to use these helpers - Updating Catalog unit tests
This commit is contained in:
parent
06661abe1e
commit
6b7478f724
|
@ -47,9 +47,10 @@ public class Link extends ReferenceType<Link> {
|
|||
public static final String DOWN = "down";
|
||||
public static final String EDIT = "edit";
|
||||
public static final String DELETE = "delete";
|
||||
public static final String TASK_CANCEL = "task:cancel";
|
||||
|
||||
public static final List<String> ALL = Arrays.asList(
|
||||
UP, DOWN, EDIT, DELETE
|
||||
UP, DOWN, EDIT, DELETE, TASK_CANCEL
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ public class Metadata extends ResourceType<Metadata> {
|
|||
}
|
||||
|
||||
public Builder fromMetadata(Metadata in) {
|
||||
return fromResourceType(in).metadata(in.getMetadata());
|
||||
return fromResourceType(in).metadata(in.getMetadataEntries());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ public class Metadata extends ResourceType<Metadata> {
|
|||
@XmlElement(namespace = VCLOUD_1_5_NS, name = "MetadataEntry")
|
||||
private Set<MetadataEntry> metadataEntries = Sets.newLinkedHashSet();
|
||||
|
||||
public Set<MetadataEntry> getMetadata() {
|
||||
public Set<MetadataEntry> getMetadataEntries() {
|
||||
return ImmutableSet.copyOf(metadataEntries);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.task/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
|
|
|
@ -140,8 +140,8 @@ public interface CatalogAsyncClient {
|
|||
*/
|
||||
@POST
|
||||
@Path("/metadata")
|
||||
@Consumes(VCloudDirectorMediaType.METADATA)
|
||||
@Produces(VCloudDirectorMediaType.TASK)
|
||||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@Produces(VCloudDirectorMediaType.METADATA)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> mergeCatalogItemMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
|
@ -163,8 +163,8 @@ public interface CatalogAsyncClient {
|
|||
*/
|
||||
@PUT
|
||||
@Path("/metadata/{key}")
|
||||
@Consumes(VCloudDirectorMediaType.METADATA_VALUE)
|
||||
@Produces(VCloudDirectorMediaType.TASK)
|
||||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> setCatalogItemMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> catalogItemRef,
|
||||
|
|
|
@ -49,7 +49,7 @@ public interface OrgAsyncClient {
|
|||
* @see OrgClient#getOrgList()
|
||||
*/
|
||||
@GET
|
||||
@Path("/org")
|
||||
@Path("/org/")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<OrgList> getOrgList();
|
||||
|
@ -71,7 +71,7 @@ public interface OrgAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> orgRef);
|
||||
ListenableFuture<Metadata> getOrgMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> orgRef);
|
||||
|
||||
/**
|
||||
* @see OrgClient#getMetadataEntry(ReferenceType, String)
|
||||
|
@ -81,6 +81,6 @@ public interface OrgAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<MetadataEntry> getMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> orgRef,
|
||||
ListenableFuture<MetadataEntry> getOrgMetadataEntry(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> orgRef,
|
||||
@PathParam("key") String key);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public interface OrgClient {
|
|||
*
|
||||
* @return a list of metadata
|
||||
*/
|
||||
Metadata getMetadata(ReferenceType<?> orgRef);
|
||||
Metadata getOrgMetadata(ReferenceType<?> orgRef);
|
||||
|
||||
/**
|
||||
* Retrieves a metadata entry.
|
||||
|
@ -80,6 +80,6 @@ public interface OrgClient {
|
|||
*
|
||||
* @return the metadata entry or null if not found
|
||||
*/
|
||||
MetadataEntry getMetadataEntry(ReferenceType<?> orgRef, String key);
|
||||
MetadataEntry getOrgMetadataEntry(ReferenceType<?> orgRef, String key);
|
||||
// FIXME throws exception on not found currently
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
|
@ -54,13 +56,13 @@ public interface TaskAsyncClient {
|
|||
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) ReferenceType<?> orgRef);
|
||||
|
||||
/**
|
||||
* @see TaskClient#getTask(ReferenceType<?>)
|
||||
* @see TaskClient#getTask(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> getTask(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> taskRef);
|
||||
ListenableFuture<Task> getTask(@EndpointParam URI taskUri);
|
||||
|
||||
/**
|
||||
* @see TaskClient#cancelTask(URI)
|
||||
|
@ -70,5 +72,5 @@ public interface TaskAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam(parser = ReferenceToEndpoint.class) ReferenceType<?> taskRef);
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam URI taskUri);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
|
@ -55,7 +56,7 @@ public interface TaskClient {
|
|||
*
|
||||
* @return the task or null if not found
|
||||
*/
|
||||
Task getTask(ReferenceType<?> taskRef);
|
||||
Task getTask(URI taskUri);
|
||||
|
||||
/**
|
||||
* Cancels a task.
|
||||
|
@ -64,5 +65,5 @@ public interface TaskClient {
|
|||
* POST /task/{id}/action/cancel
|
||||
* </pre>
|
||||
*/
|
||||
void cancelTask(ReferenceType<?> taskRef);
|
||||
void cancelTask(URI taskUri);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
|
@ -25,7 +25,6 @@ import org.jclouds.vcloud.director.v1_5.login.SessionClientExpectTest;
|
|||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "VCloudDirectorClient")
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5;
|
||||
|
||||
/**
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
public class VCloudDirectorLiveTestConstants {
|
||||
|
||||
public static final String FIELD_NOT_NULL_FMT = "The %s field of the %s must not be null";
|
||||
|
||||
}
|
|
@ -34,12 +34,12 @@ import com.google.common.collect.Iterables;
|
|||
*/
|
||||
public class Checks {
|
||||
|
||||
protected void checkEntityType(EntityType<?> entity) {
|
||||
public static void checkEntityType(EntityType<?> entity) {
|
||||
// Check required fields
|
||||
assertNotNull(entity.getName(), "The Name attribute of an EntityType must be set");
|
||||
|
||||
// Check optional fields
|
||||
// String description = entity.getDescription(); // ???
|
||||
// NOTE description cannot be checked
|
||||
TasksInProgress tasksInProgress = entity.getTasksInProgress();
|
||||
if (tasksInProgress != null && tasksInProgress.getTasks() != null && !tasksInProgress.getTasks().isEmpty()) {
|
||||
for (Task task : tasksInProgress.getTasks()) checkTask(task);
|
||||
|
@ -49,7 +49,7 @@ public class Checks {
|
|||
checkResourceType(entity);
|
||||
}
|
||||
|
||||
protected void checkReferenceType(ReferenceType<?> reference) {
|
||||
public static void checkReferenceType(ReferenceType<?> reference) {
|
||||
// Check required fields
|
||||
assertNotNull(reference.getHref(), "The Href attribute of a ReferenceType must be set");
|
||||
|
||||
|
@ -58,10 +58,10 @@ public class Checks {
|
|||
if (id != null) checkId(id);
|
||||
String type = reference.getType();
|
||||
if (type != null) checkType(type);
|
||||
// String name = reference.getName(); // ???
|
||||
// NOTE name cannot be checked
|
||||
}
|
||||
|
||||
protected void checkResourceType(ResourceType<?> resource) {
|
||||
public static void checkResourceType(ResourceType<?> resource) {
|
||||
// Check optional fields
|
||||
URI href = resource.getHref();
|
||||
if (href != null) checkHref(href);
|
||||
|
@ -73,7 +73,7 @@ public class Checks {
|
|||
}
|
||||
}
|
||||
|
||||
protected void checkId(String id) {
|
||||
public static void checkId(String id) {
|
||||
Iterable<String> parts = Splitter.on(':').split(id);
|
||||
assertEquals(Iterables.size(parts), 4, "The Id must be well formed");
|
||||
assertEquals(Iterables.get(parts, 0), "urn", "The Id must start with 'urn'");
|
||||
|
@ -86,20 +86,22 @@ public class Checks {
|
|||
}
|
||||
}
|
||||
|
||||
protected void checkType(String type) {
|
||||
public static void checkType(String type) {
|
||||
assertTrue(VCloudDirectorMediaType.ALL.contains(type), "The Type must be a valid media type");
|
||||
}
|
||||
|
||||
protected void checkHref(URI href) {
|
||||
// NOTE this does not currently check anything
|
||||
public static void checkHref(URI href) {
|
||||
String uri = href.toASCIIString();
|
||||
String auth = href.getAuthority();
|
||||
String host = href.getHost();
|
||||
String path = href.getPath();
|
||||
// assertEquals(auth + "://" + host + path, endpoint, "The Href must contain the provider endpoint");
|
||||
// assertTrue(uri.startsWith(endpoint), "The Href must contain the provider endpoint");
|
||||
// TODO inject the endpoint of the provider here for rudimentary checks as below
|
||||
// assertEquals(auth + "://" + host + path, endpoint, "The Href must contain the provider endpoint");
|
||||
// assertTrue(uri.startsWith(endpoint), "The Href must contain the provider endpoint");
|
||||
}
|
||||
|
||||
protected void checkLink(Link link) {
|
||||
public static void checkLink(Link link) {
|
||||
// Check required fields
|
||||
assertNotNull(link.getRel(), "The Rel attribute of a Link must be set");
|
||||
assertTrue(Link.Rel.ALL.contains(link.getRel()), "The Rel attribute of a Link must be one of the allowed list");
|
||||
|
@ -108,41 +110,44 @@ public class Checks {
|
|||
checkReferenceType(link);
|
||||
}
|
||||
|
||||
protected void checkTask(Task task) {
|
||||
public static void checkTask(Task task) {
|
||||
// Check required fields
|
||||
assertNotNull(task.getStatus(), "The Status attribute of a Task must be set");
|
||||
assertTrue(Task.Status.ALL.contains(task.getStatus()), "The Status of a Task must be one of the allowed list");
|
||||
|
||||
// Check optional fields
|
||||
// String operation = task.getOperation(); // ???
|
||||
// String operationName = task.getOperationName(); // ???;
|
||||
// Date startTime = task.getStartTime(); // ???
|
||||
// Date endTime = task.getEndTime(); // ???
|
||||
// Date expiryTime = task.getExpiryTime(); // ???
|
||||
// ReferenceType<?> owner = task.getOwner(); // ???
|
||||
// NOTE operation cannot be checked
|
||||
// NOTE operationName cannot be checked
|
||||
// NOTE startTime cannot be checked
|
||||
// NOTE endTime cannot be checked
|
||||
// NOTE expiryTimecannot be checked
|
||||
ReferenceType<?> owner = task.getOwner();
|
||||
if (owner != null) checkReferenceType(owner);
|
||||
Error error = task.getError();
|
||||
if (error != null) checkError(error);
|
||||
// ReferenceType<?> user = task.getUser(); // ???
|
||||
// ReferenceType<?> organization = task.getOrg(); // ???
|
||||
ReferenceType<?> user = task.getUser();
|
||||
if (user != null) checkReferenceType(user);
|
||||
ReferenceType<?> org = task.getOrg();
|
||||
if (org != null) checkReferenceType(org);
|
||||
Integer progress = task.getProgress();
|
||||
if (progress != null) checkProgress(progress);
|
||||
// Object params = task.getParams(); // ???
|
||||
// NOTE params cannot be checked
|
||||
|
||||
// Check parent type
|
||||
checkEntityType(task);
|
||||
}
|
||||
|
||||
protected void checkProgress(Integer progress) {
|
||||
public static void checkProgress(Integer progress) {
|
||||
assertTrue(progress >= 0 && progress <= 100, "The Progress attribute must be between 0 and 100");
|
||||
}
|
||||
|
||||
protected void checkError(Error error) {
|
||||
public static void checkError(Error error) {
|
||||
// Check required fields
|
||||
assertNotNull(error.getMessage(), "The Message attribute of an Error must be set");
|
||||
assertNotNull(error.getMajorErrorCode(), "The MajorErrorCode attribute of an Error must be set");
|
||||
assertNotNull(error.getMinorErrorCode(), "The MinorErrorCode attribute of an Error must be set");
|
||||
|
||||
// String vendorSpecificErrorCode = error.getVendorSpecificErrorCode(); // ???
|
||||
// String stackTrace = error.getStackTrace(); // ???
|
||||
// NOTE vendorSpecificErrorCode cannot be checked
|
||||
// NOTE stackTrace cannot be checked
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
*(Link.builder().regarding copyright ownership. jclouds licenses this file
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless(Link.builder().required by applicable law or agreed to in writing,
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
|
@ -34,6 +34,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -66,40 +67,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
|
||||
|
||||
Catalog expected = Catalog.builder()
|
||||
.name("QunyingTestCatalog")
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.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("down")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.build())
|
||||
.catalogItems(CatalogItems.builder()
|
||||
.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())
|
||||
.build())
|
||||
.description("Testing")
|
||||
.build();
|
||||
Catalog expected = catalog();
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
|
@ -124,7 +92,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/catalog/catalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5"))
|
||||
.payload(payloadFromResourceWithContentType("/catalog/createdCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5"))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||
|
@ -135,20 +103,348 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
|
||||
Reference ubuntu = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.vAppTemplate+xml")
|
||||
.name("ubuntu10")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"))
|
||||
.build();
|
||||
|
||||
CatalogItem newItem = CatalogItem.builder()
|
||||
.name("newCatalogItem")
|
||||
.description("New Catalog Item")
|
||||
.entity(ubuntu)
|
||||
.entity(ubuntuVappTemplateReference())
|
||||
.build();
|
||||
|
||||
CatalogItem expected = CatalogItem.builder()
|
||||
.name("newCatalogItem")
|
||||
CatalogItem expected = createdCatalogItem();
|
||||
|
||||
assertEquals(client.getCatalogClient().addCatalogItem(catalogRef, newItem), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCatalogMetadata() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"),
|
||||
getStandardPayloadResponse("/catalog/catalogMetadata.xml", VCloudDirectorMediaType.METADATA));
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
|
||||
Metadata expected = Metadata.builder()
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.metadata(ImmutableSet.of(metadataEntry()))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogMetadata(catalogRef), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCatalogMetadataEntry() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY"),
|
||||
getStandardPayloadResponse("/catalog/catalogMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
|
||||
MetadataEntry expected = metadataEntry();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogMetadataEntry(catalogRef, "KEY"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCatalogItem() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"),
|
||||
getStandardPayloadResponse("/catalog/catalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM));
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
CatalogItem expected = catalogItem();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogItem(catalogItemReference), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateCatalogItem() {
|
||||
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||
.method("PUT")
|
||||
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Accept", "application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.put("x-vcloud-authorization", token)
|
||||
.build())
|
||||
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM))
|
||||
.build();
|
||||
|
||||
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/catalog/updateCatalogItem.xml", VCloudDirectorMediaType.CATALOG_ITEM + ";version=1.5"))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
CatalogItem expected = catalogItem();
|
||||
|
||||
assertEquals(client.getCatalogClient().updateCatalogItem(catalogItemReference, expected), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteCatalogItem() {
|
||||
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||
.method("DELETE")
|
||||
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Accept", "*/*")
|
||||
.put("x-vcloud-authorization", token)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
client.getCatalogClient().deleteCatalogItem(catalogItemReference);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCatalogItemMetadata() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"),
|
||||
getStandardPayloadResponse("/catalog/catalogItemMetadata.xml", VCloudDirectorMediaType.METADATA));
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
Metadata expected = Metadata.builder()
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.metadata(ImmutableSet.of(itemMetadataEntry()))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogItemMetadata(catalogItemReference), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMergeCatalogItemMetadata() {
|
||||
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||
.method("POST")
|
||||
.endpoint(URI.create(endpoint + "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"))
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Accept", "application/vnd.vmware.vcloud.task+xml")
|
||||
.put("x-vcloud-authorization", token)
|
||||
.build())
|
||||
.payload(payloadFromResourceWithContentType("/catalog/mergeCatalogItemMetadata.xml", VCloudDirectorMediaType.METADATA))
|
||||
.build();
|
||||
|
||||
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/catalog/mergeMetadataTask.xml", VCloudDirectorMediaType.TASK + ";version=1.5"))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
Metadata metadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "VALUE").build()).build();
|
||||
|
||||
Task expected = mergeMetadataTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().mergeCatalogItemMetadata(catalogItemReference, metadata), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCatalogItemMetadataEntry() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY"),
|
||||
getStandardPayloadResponse("/catalog/catalogItemMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
MetadataEntry expected = itemMetadataEntry();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogItemMetadataEntry(catalogItemReference, "KEY"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetCatalogItemMetadataEntry() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequestWithPayload("PUT", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY", VCloudDirectorMediaType.TASK,
|
||||
"/catalog/setCatalogItemMetadataValue.xml", VCloudDirectorMediaType.METADATA_VALUE),
|
||||
getStandardPayloadResponse("/catalog/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK));
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
MetadataValue value = MetadataValue.builder().value("KITTENS").build();
|
||||
|
||||
Task expected = setMetadataValueTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().setCatalogItemMetadataEntry(catalogItemReference, "KEY", value), expected);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteCatalogItemMetadataEntry() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("DELETE", "/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY", VCloudDirectorMediaType.TASK),
|
||||
getStandardPayloadResponse("/catalog/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK));
|
||||
|
||||
Reference catalogItemReference = 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();
|
||||
|
||||
Task expected = deleteMetadataEntryTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().deleteCatalogItemMetadataEntry(catalogItemReference, "KEY"), expected);
|
||||
}
|
||||
|
||||
public static final Catalog catalog() {
|
||||
return Catalog.builder()
|
||||
.name("QunyingTestCatalog")
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.id("urn:vcloud:catalog:7212e451-76e1-4631-b2de-ba1dfd8080e4")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.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("down")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.build())
|
||||
.catalogItems(CatalogItems.builder()
|
||||
.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())
|
||||
.build())
|
||||
.description("Testing")
|
||||
.build();
|
||||
}
|
||||
|
||||
public static CatalogItem createdCatalogItem() {
|
||||
return CatalogItem.builder()
|
||||
.name("newCatalogItem")
|
||||
.id("urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df")
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.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.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("edit")
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("remove")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.description("New Catalog Item")
|
||||
.entity(ubuntuVappTemplateReference())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Reference ubuntuVappTemplateReference() {
|
||||
return Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.vAppTemplate+xml")
|
||||
.name("ubuntu10")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"))
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MetadataEntry metadataEntry() {
|
||||
return MetadataEntry.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.build())
|
||||
.entry("KEY", "VALUE")
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MetadataEntry itemMetadataEntry() {
|
||||
return MetadataEntry.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"))
|
||||
.build())
|
||||
.entry("KEY", "VALUE")
|
||||
.build();
|
||||
}
|
||||
|
||||
public static CatalogItem catalogItem() {
|
||||
return CatalogItem.builder()
|
||||
.name("ubuntu10")
|
||||
.id("urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df")
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
|
@ -171,48 +467,108 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.rel("remove")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.description("New Catalog Item")
|
||||
.entity(ubuntu)
|
||||
.description("For testing")
|
||||
.entity(ubuntuVappTemplateReference())
|
||||
.build();
|
||||
|
||||
assertEquals(client.getCatalogClient().addCatalogItem(catalogRef, newItem), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCatalogMetadata() {
|
||||
HttpRequest catalogItemRequest = HttpRequest.builder()
|
||||
.method("GET")
|
||||
.endpoint(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Accept", "*/*")
|
||||
.put("x-vcloud-authorization", token)
|
||||
.build())
|
||||
.build();
|
||||
|
||||
HttpResponse catalogItemResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/catalog/catalogMetadata.xml", VCloudDirectorMediaType.METADATA + ";version=1.5"))
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogItemRequest, catalogItemResponse);
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
|
||||
Metadata expected = Metadata.builder()
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api//catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
public static Task mergeMetadataTask() {
|
||||
return Task.builder()
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c")
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c"))
|
||||
.status("running")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00"))
|
||||
.operationName("metadataUpdate")
|
||||
.operation("Updating metadata for Catalog Item (a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df)")
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.rel("task:cancel")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel"))
|
||||
.build())
|
||||
.owner(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.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())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Task setMetadataValueTask() {
|
||||
return Task.builder()
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c")
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c"))
|
||||
.status("running")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00"))
|
||||
.operationName("metadataSet")
|
||||
.operation("Setting metadata for Catalog Item (a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df)")
|
||||
.link(Link.builder()
|
||||
.rel("task:cancel")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel"))
|
||||
.build())
|
||||
.owner(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.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())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Task deleteMetadataEntryTask() {
|
||||
return Task.builder()
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c")
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c"))
|
||||
.status("running")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-13T06:35:08.011-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-13T06:35:08.011-04:00"))
|
||||
.operationName("metadataDelete")
|
||||
.operation("Deleting metadata for Catalog Item (a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df)")
|
||||
.link(Link.builder()
|
||||
.rel("task:cancel")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel"))
|
||||
.build())
|
||||
.owner(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.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())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.metadata(ImmutableSet.of(MetadataEntry.builder().entry("key", "value").build()))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogMetadata(catalogRef), expected);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link taskClient}.
|
||||
*
|
||||
* @author grkvlt@apache.task
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "TaskClientLiveTest")
|
||||
public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private TasksList taskList;
|
||||
private Task task;
|
||||
private URI taskUri;
|
||||
|
||||
@Test(testName = "GET /tasksList/{id}")
|
||||
public void testGetTaskList() {
|
||||
orgList = getOrgList();
|
||||
orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
|
||||
// Call the method being tested
|
||||
taskList = getTaskList(orgRef);
|
||||
|
||||
// NOTE The environment MUST have ...
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(taskList.getTasks()), "There must always be Task elements in the TaskList");
|
||||
|
||||
for (Task task : taskList.getTasks()) {
|
||||
checkTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}", dependsOnMethods = { "testGetTaskList" })
|
||||
public void testGetTask() {
|
||||
taskUri = Iterables.getFirst(taskList.getTasks(), null).getHref();
|
||||
|
||||
// Call the method being tested
|
||||
task = getTask(taskUri);
|
||||
|
||||
// Check required elements and attributes
|
||||
checkTask(task);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}/metadata/", dependsOnMethods = { "testGetTask" })
|
||||
public void testCancelTask() {
|
||||
// Call the method being tested
|
||||
cancelTask(taskUri);
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
*(Link.builder().regarding copyright ownership. jclouds licenses this file
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless(Link.builder().required by applicable law or agreed to in writing,
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
*(Link.builder().regarding copyright ownership. jclouds licenses this file
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless(Link.builder().required by applicable law or agreed to in writing,
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
|
@ -35,6 +35,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
|||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
|
@ -46,9 +47,9 @@ import com.google.common.collect.Iterables;
|
|||
public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs2xxLoginReturnsValidOrgList() {
|
||||
public void testGetOrgList() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/org"),
|
||||
getStandardRequest("GET", "/org/"),
|
||||
getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
|
||||
|
||||
OrgList expected = OrgList.builder()
|
||||
|
@ -63,9 +64,9 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs2xxLoginReturnsValidOrgFromListByReference() {
|
||||
public void testGetOrgFromOrgListReference() {
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/org"),
|
||||
getStandardRequest("GET", "/org/"),
|
||||
getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
|
||||
|
||||
Reference org = Iterables.getOnlyElement(client.getOrgClient().getOrgList().getOrgs());
|
||||
|
@ -80,7 +81,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs2xxLoginReturnsValidOrg() {
|
||||
public void testGetOrg() {
|
||||
URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -95,7 +96,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs400ForInvalidOrgId() {
|
||||
public void testGetOrgFailOnInvalidOrgId() {
|
||||
URI orgUri = URI.create(endpoint + "/org/NOTAUUID");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -120,7 +121,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs403ForCatalogIdUsedAsOrgId() {
|
||||
public void testGetOrgFailOnWrongOrgId() {
|
||||
URI orgUri = URI.create(endpoint + "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -146,7 +147,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs403ForFakeOrgId() {
|
||||
public void testGetOrgFailOnFakeOrgId() {
|
||||
URI orgUri = URI.create(endpoint + "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
|
@ -172,12 +173,12 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testWhenResponseIs2xxLoginReturnsValidMetadataList() {
|
||||
public void testGetOrgMetadata() {
|
||||
URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"),
|
||||
getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA));
|
||||
getStandardPayloadResponse("/org/orgMetadata.xml", VCloudDirectorMediaType.METADATA));
|
||||
|
||||
Metadata expected = Metadata.builder()
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
|
@ -187,28 +188,27 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.metadata(ImmutableSet.of(metadataEntry()))
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
assertEquals(client.getOrgClient().getMetadata(orgRef), expected);
|
||||
assertEquals(client.getOrgClient().getOrgMetadata(orgRef), expected);
|
||||
}
|
||||
|
||||
@Test(enabled=false) // No metadata in exemplar xml...
|
||||
public void testWhenResponseIs2xxLoginReturnsValidMetadata() {
|
||||
@Test
|
||||
public void testGetOrgMetadataEntry() {
|
||||
URI orgUri = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"),
|
||||
getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
||||
getStandardPayloadResponse("/org/orgMetadataEntry.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
||||
|
||||
MetadataEntry expected = MetadataEntry.builder()
|
||||
.key("KEY")
|
||||
.build();
|
||||
MetadataEntry expected = metadataEntry();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
assertEquals(client.getOrgClient().getMetadataEntry(orgRef, "KEY"), expected);
|
||||
assertEquals(client.getOrgClient().getOrgMetadataEntry(orgRef, "KEY"), expected);
|
||||
}
|
||||
|
||||
public static Org org() {
|
||||
|
@ -260,4 +260,16 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static MetadataEntry metadataEntry() {
|
||||
return MetadataEntry.builder()
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))
|
||||
.build())
|
||||
.entry("KEY", "VALUE")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
*(Link.builder().regarding copyright ownership. jclouds licenses this file
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless(Link.builder().required by applicable law or agreed to in writing,
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
|
@ -18,8 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
|
@ -35,192 +40,88 @@ import com.google.common.collect.Iterables;
|
|||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "OrgClientLiveTest")
|
||||
public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
@Test(testName = "GET /org/{id}")
|
||||
public void testGetOrg() {
|
||||
OrgList orgList = context.getApi().getOrgClient().getOrgList();
|
||||
assertFalse(Iterables.isEmpty(orgList.getOrgs()), "There must always be Org elements in the OrgList");
|
||||
Reference orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private final OrgClient orgClient = context.getApi().getOrgClient();
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private Org org;
|
||||
|
||||
@Test(testName = "GET /org/")
|
||||
public void testGetOrgList() {
|
||||
// Call the method being tested
|
||||
Org org = context.getApi().getOrgClient().getOrg(orgRef);
|
||||
|
||||
// Check required elements and attributes of the Org
|
||||
assertNotNull(org.getFullName(), "The FullName field of the Org must not be null");
|
||||
|
||||
// Check required elements and attributes of EntityType
|
||||
checkEntityType(org);
|
||||
orgList = orgClient.getOrgList();
|
||||
|
||||
assertNotNull(org.getName(), "The Name field of the Org must not be null");
|
||||
// NOTE The environment MUST have at least one organisation configured
|
||||
|
||||
// Check optional elements and attributes of the Org
|
||||
org.getDescription();
|
||||
org.g
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(orgList.getOrgs()), "There must always be Org elements in the OrgList");
|
||||
|
||||
for (Reference orgRef : orgList.getOrgs()) {
|
||||
assertEquals(orgRef.getType(), VCloudDirectorMediaType.ORG, "The Refernce must be to an Org type");
|
||||
checkReferenceType(orgRef);
|
||||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testWhenResponseIs2xxLoginReturnsValidOrgList() {
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org"),
|
||||
// getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
|
||||
//
|
||||
// OrgList expected = OrgList.builder()
|
||||
// .org(Reference.builder()
|
||||
// .type("application/vnd.vmware.vcloud.org+xml")
|
||||
// .name("JClouds")
|
||||
// .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
// .build())
|
||||
// .build();
|
||||
//
|
||||
// assertEquals(client.getOrgClient().getOrgList(), expected);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testWhenResponseIs2xxLoginReturnsValidOrgFromListByReference() {
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org"),
|
||||
// getStandardPayloadResponse("/org/orglist.xml", VCloudDirectorMediaType.ORG_LIST));
|
||||
//
|
||||
// Reference org = Iterables.getOnlyElement(client.getOrgClient().getOrgList().getOrgs());
|
||||
//
|
||||
// client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", org.getHref()),
|
||||
// getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG));
|
||||
//
|
||||
// Org expected = org();
|
||||
//
|
||||
// assertEquals(client.getOrgClient().getOrg(org), expected);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testWhenResponseIs2xxLoginReturnsValidOrg() {
|
||||
// URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||
//
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"),
|
||||
// getStandardPayloadResponse("/org/org.xml", VCloudDirectorMediaType.ORG));
|
||||
//
|
||||
// Org expected = org();
|
||||
//
|
||||
// Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
//
|
||||
// assertEquals(client.getOrgClient().getOrg(orgRef), expected);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testWhenResponseIs400ForInvalidOrgId() {
|
||||
// URI orgUri = URI.create(endpoint + "/org/NOTAUUID");
|
||||
//
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org/NOTAUUID"),
|
||||
// getStandardPayloadResponse(400, "/org/error400.xml", VCloudDirectorMediaType.ERROR));
|
||||
//
|
||||
// Error expected = Error.builder()
|
||||
// .message("validation error on field 'id': String value has invalid format or length")
|
||||
// .majorErrorCode(400)
|
||||
// .minorErrorCode("BAD_REQUEST")
|
||||
// .build();
|
||||
//
|
||||
// Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
// try {
|
||||
// client.getOrgClient().getOrg(orgRef);
|
||||
// fail("Should give HTTP 400 error");
|
||||
// } catch (VCloudDirectorException vde) {
|
||||
// assertEquals(vde.getError(), expected);
|
||||
// } catch (Exception e) {
|
||||
// fail("Should have thrown a VCloudDirectorException");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testWhenResponseIs403ForCatalogIdUsedAsOrgId() {
|
||||
// URI orgUri = URI.create(endpoint + "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c");
|
||||
//
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org/9e08c2f6-077a-42ce-bece-d5332e2ebb5c"),
|
||||
// getStandardPayloadResponse(403, "/org/error403-catalog.xml", VCloudDirectorMediaType.ERROR));
|
||||
//
|
||||
// Error expected = Error.builder()
|
||||
// .message("No access to entity \"com.vmware.vcloud.entity.org:9e08c2f6-077a-42ce-bece-d5332e2ebb5c\".")
|
||||
// .majorErrorCode(403)
|
||||
// .minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
// .build();
|
||||
//
|
||||
// Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
//
|
||||
// try {
|
||||
// client.getOrgClient().getOrg(orgRef);
|
||||
// fail("Should give HTTP 403 error");
|
||||
// } catch (VCloudDirectorException vde) {
|
||||
// assertEquals(vde.getError(), expected);
|
||||
// } catch (Exception e) {
|
||||
// fail("Should have thrown a VCloudDirectorException");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testWhenResponseIs403ForFakeOrgId() {
|
||||
// URI orgUri = URI.create(endpoint + "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
|
||||
//
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"),
|
||||
// getStandardPayloadResponse(403, "/org/error403-fake.xml", VCloudDirectorMediaType.ERROR));
|
||||
//
|
||||
// Error expected = Error.builder()
|
||||
// .message("No access to entity \"com.vmware.vcloud.entity.org:aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\".")
|
||||
// .majorErrorCode(403)
|
||||
// .minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
// .build();
|
||||
//
|
||||
// Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
//
|
||||
// try {
|
||||
// client.getOrgClient().getOrg(orgRef);
|
||||
// fail("Should give HTTP 403 error");
|
||||
// } catch (VCloudDirectorException vde) {
|
||||
// assertEquals(vde.getError(), expected);
|
||||
// } catch (Exception e) {
|
||||
// fail("Should have thrown a VCloudDirectorException");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testWhenResponseIs2xxLoginReturnsValidMetadataList() {
|
||||
// URI orgUri = URI.create(endpoint + "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||
//
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"),
|
||||
// getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA));
|
||||
//
|
||||
// Metadata expected = Metadata.builder()
|
||||
// .type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
// .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"))
|
||||
// .link(Link.builder()
|
||||
// .rel("up")
|
||||
// .type("application/vnd.vmware.vcloud.org+xml")
|
||||
// .href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
// .build())
|
||||
// .build();
|
||||
//
|
||||
// Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
//
|
||||
// assertEquals(client.getOrgClient().getMetadata(orgRef), expected);
|
||||
// }
|
||||
//
|
||||
// @Test(enabled=false) // No metadata in exemplar xml...
|
||||
// public void testWhenResponseIs2xxLoginReturnsValidMetadata() {
|
||||
// URI orgUri = URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0");
|
||||
//
|
||||
// VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
// getStandardRequest("GET", "/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY"),
|
||||
// getStandardPayloadResponse("/org/metadata.xml", VCloudDirectorMediaType.METADATA_ENTRY));
|
||||
//
|
||||
// MetadataEntry expected = MetadataEntry.builder()
|
||||
// .key("KEY")
|
||||
// .build();
|
||||
//
|
||||
// Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
//
|
||||
// assertEquals(client.getOrgClient().getMetadataEntry(orgRef, "KEY"), expected);
|
||||
// }
|
||||
@Test(testName = "GET /org/{id}", dependsOnMethods = { "testGetOrgList" })
|
||||
public void testGetOrg() {
|
||||
orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
|
||||
// Call the method being tested
|
||||
org = orgClient.getOrg(orgRef);
|
||||
|
||||
// Check required elements and attributes
|
||||
assertNotNull(org.getFullName(), String.format(FIELD_NOT_NULL_FMT, "FullName", "Org"));
|
||||
|
||||
// Check parent type
|
||||
checkEntityType(org);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /org/{id}/metadata/", dependsOnMethods = { "testGetOrg" })
|
||||
public void testGetOrgMetadata() {
|
||||
// Call the method being tested
|
||||
Metadata metadata = orgClient.getOrgMetadata(orgRef);
|
||||
|
||||
// NOTE The environment MUST have at one metadata entry for the first organisation configured
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()), "There must always be MetadataEntry elements in the Org");
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(metadata);
|
||||
|
||||
for (MetadataEntry entry : metadata.getMetadataEntries()) {
|
||||
// Check required elements and attributes
|
||||
assertNotNull(entry.getKey(), String.format(FIELD_NOT_NULL_FMT, "Key", "MetadataEntry"));
|
||||
assertNotNull(entry.getValue(), String.format(FIELD_NOT_NULL_FMT, "Value", "MetadataEntry"));
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(entry);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" })
|
||||
public void testGetOrgMetadataEntry() {
|
||||
// Call the method being tested
|
||||
MetadataEntry entry = orgClient.getOrgMetadataEntry(orgRef, "KEY");
|
||||
|
||||
// NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE" )'
|
||||
|
||||
// Check required elements and attributes
|
||||
assertNotNull(entry.getKey(), String.format(FIELD_NOT_NULL_FMT, "Key", "MetadataEntry"));
|
||||
assertEquals(entry.getKey(), "KEY", "The Key field must have the value \"KEY\"");
|
||||
assertNotNull(entry.getValue(), String.format(FIELD_NOT_NULL_FMT, "Value", "MetadataEntry"));
|
||||
assertEquals(entry.getValue(), "VALUE", "The Value field must have the value \"VALUE\"");
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(entry);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/**
|
||||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
*(Link.builder().regarding copyright ownership. jclouds licenses this file
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless(Link.builder().required by applicable law or agreed to in writing,
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
|
@ -80,55 +80,8 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.name("Tasks Lists")
|
||||
.type("application/vnd.vmware.vcloud.tasksList+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/tasksList/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.task(Task.builder()
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:5fcd2af3-d0ec-45ce-9451-8c585a2c766b")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"))
|
||||
.status("success")
|
||||
.operation("Created Catalog QunyingTestCatalog(7212e451-76e1-4631-b2de-ba1dfd8080e4)")
|
||||
.operationName("catalogCreateCatalog")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-07T00:16:28.450-05:00"))
|
||||
.endTime(dateService.iso8601DateParse("2012-02-07T00:16:28.867-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-07T00:16:28.450-04:00"))
|
||||
.owner(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build())
|
||||
.task(Task.builder()
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:bd22e745-9c2a-4f82-a954-0e35b6f76ba5")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/bd22e745-9c2a-4f82-a954-0e35b6f76ba5"))
|
||||
.status("success")
|
||||
.operation("Enabled User (967d317c-4273-4a95-b8a4-bf63b78e9c69)")
|
||||
.operationName("jobEnable")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-06T17:30:38.507-05:00"))
|
||||
.endTime(dateService.iso8601DateParse("2012-02-06T17:30:38.507-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-06T17:30:38.507-04:00"))
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("adrian@jclouds.org")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/8c360b93-ed25-4c9a-8e24-d48cd9966d93"))
|
||||
.build())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build())
|
||||
.task(taskOne())
|
||||
.task(taskTwo())
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")).build();
|
||||
|
@ -248,41 +201,11 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
|
||||
|
||||
Reference taskRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.name("task")
|
||||
.href(URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"))
|
||||
.build();
|
||||
URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
|
||||
|
||||
Task expected = Task.builder()
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:5fcd2af3-d0ec-45ce-9451-8c585a2c766b")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"))
|
||||
.status("success")
|
||||
.operation("Created Catalog QunyingTestCatalog(7212e451-76e1-4631-b2de-ba1dfd8080e4)")
|
||||
.operationName("catalogCreateCatalog")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-07T00:16:28.450-05:00"))
|
||||
.endTime(dateService.iso8601DateParse("2012-02-07T00:16:28.867-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-07T00:16:28.450-04:00"))
|
||||
.owner(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build();
|
||||
Task expected = taskOne();
|
||||
|
||||
assertEquals(client.getTaskClient().getTask(taskRef), expected);
|
||||
assertEquals(client.getTaskClient().getTask(taskUri), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -296,18 +219,70 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.build())
|
||||
.build();
|
||||
|
||||
HttpResponse taskResponse = HttpResponse.builder()
|
||||
HttpResponse taskResponse = HttpResponse.builder()
|
||||
.statusCode(200)
|
||||
.build();
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
|
||||
|
||||
Reference taskRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.name("task")
|
||||
.href(URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"))
|
||||
.build();
|
||||
URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
|
||||
|
||||
client.getTaskClient().cancelTask(taskRef);
|
||||
client.getTaskClient().cancelTask(taskUri);
|
||||
}
|
||||
|
||||
public static Task taskOne() {
|
||||
return Task.builder()
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:5fcd2af3-d0ec-45ce-9451-8c585a2c766b")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"))
|
||||
.status("success")
|
||||
.operation("Created Catalog QunyingTestCatalog(7212e451-76e1-4631-b2de-ba1dfd8080e4)")
|
||||
.operationName("catalogCreateCatalog")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-07T00:16:28.450-05:00"))
|
||||
.endTime(dateService.iso8601DateParse("2012-02-07T00:16:28.867-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-07T00:16:28.450-04:00"))
|
||||
.owner(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build())
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Task taskTwo() {
|
||||
return Task.builder()
|
||||
.type("application/vnd.vmware.vcloud.task+xml")
|
||||
.name("task")
|
||||
.id("urn:vcloud:task:bd22e745-9c2a-4f82-a954-0e35b6f76ba5")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/task/bd22e745-9c2a-4f82-a954-0e35b6f76ba5"))
|
||||
.status("success")
|
||||
.operation("Enabled User (967d317c-4273-4a95-b8a4-bf63b78e9c69)")
|
||||
.operationName("jobEnable")
|
||||
.startTime(dateService.iso8601DateParse("2012-02-06T17:30:38.507-05:00"))
|
||||
.endTime(dateService.iso8601DateParse("2012-02-06T17:30:38.507-05:00"))
|
||||
.expiryTime(dateService.iso8601DateParse("2012-05-06T17:30:38.507-04:00"))
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("adrian@jclouds.org")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/8c360b93-ed25-4c9a-8e24-d48cd9966d93"))
|
||||
.build())
|
||||
.org(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.org+xml")
|
||||
.name("JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"))
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Tests live behavior of {@link TaskClient}.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Test(groups = { "live", "apitests" }, testName = "TaskClientLiveTest")
|
||||
public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
||||
|
||||
/*
|
||||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private final OrgClient orgClient = context.getApi().getOrgClient();
|
||||
private final TaskClient taskClient = context.getApi().getTaskClient();
|
||||
|
||||
/*
|
||||
* Shared state between dependant tests.
|
||||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private TasksList taskList;
|
||||
private Task task;
|
||||
private URI taskUri;
|
||||
|
||||
@Test(testName = "GET /tasksList/{id}")
|
||||
public void testGetTaskList() {
|
||||
orgList = orgClient.getOrgList();
|
||||
orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
|
||||
// Call the method being tested
|
||||
taskList = taskClient.getTaskList(orgRef);
|
||||
|
||||
// NOTE The environment MUST have ...
|
||||
|
||||
// Check required elements and attributes
|
||||
assertFalse(Iterables.isEmpty(taskList.getTasks()), "There must always be Task elements in the TaskList");
|
||||
|
||||
for (Task task : taskList.getTasks()) {
|
||||
checkTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}", dependsOnMethods = { "testGetTaskList" })
|
||||
public void testGetTask() {
|
||||
taskUri = Iterables.getFirst(taskList.getTasks(), null).getHref();
|
||||
|
||||
// Call the method being tested
|
||||
task = taskClient.getTask(taskUri);
|
||||
|
||||
// Check required elements and attributes
|
||||
checkTask(task);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /task/{id}/metadata/", dependsOnMethods = { "testGetTask" })
|
||||
public void testCancelTask() {
|
||||
// Call the method being tested
|
||||
taskClient.cancelTask(taskUri);
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.internal;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.jclouds.compute.BaseVersionedServiceLiveTest;
|
||||
|
@ -27,6 +28,15 @@ import org.jclouds.rest.RestContextFactory;
|
|||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorAsyncClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Org;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.TasksList;
|
||||
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
|
||||
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -40,7 +50,7 @@ import com.google.inject.Module;
|
|||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live")
|
||||
public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest {
|
||||
public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest implements OrgClient, TaskClient {
|
||||
public BaseVCloudDirectorClientLiveTest() {
|
||||
provider = "vcloud-director";
|
||||
}
|
||||
|
@ -60,4 +70,58 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe
|
|||
if (context != null)
|
||||
context.close();
|
||||
}
|
||||
|
||||
|
||||
private final OrgClient orgClient = context.getApi().getOrgClient();
|
||||
private final TaskClient taskClient = context.getApi().getTaskClient();
|
||||
|
||||
/*
|
||||
* Proxying implementations of OrgClient.
|
||||
*/
|
||||
|
||||
/** @see OrgClient#getOrgList() */
|
||||
@Override
|
||||
public OrgList getOrgList() {
|
||||
return orgClient.getOrgList();
|
||||
}
|
||||
|
||||
/** @see OrgClient#getOrg(ReferenceType) */
|
||||
@Override
|
||||
public Org getOrg(ReferenceType<?> orgRef) {
|
||||
return orgClient.getOrg(orgRef);
|
||||
}
|
||||
|
||||
/** @see OrgClient#getOrgMetadata(ReferenceType) */
|
||||
@Override
|
||||
public Metadata getOrgMetadata(ReferenceType<?> orgRef) {
|
||||
return orgClient.getOrgMetadata(orgRef);
|
||||
}
|
||||
|
||||
/** @see OrgClient#getOrgMetadataEntry(ReferenceType, String) */
|
||||
@Override
|
||||
public MetadataEntry getOrgMetadataEntry(ReferenceType<?> orgRef, String key) {
|
||||
return orgClient.getOrgMetadataEntry(orgRef, key);
|
||||
}
|
||||
|
||||
/*
|
||||
* Proxying implementations of TaskClient.
|
||||
*/
|
||||
|
||||
/** @see TaskClient#getTaskList(ReferenceType) */
|
||||
@Override
|
||||
public TasksList getTaskList(ReferenceType<?> orgRef) {
|
||||
return taskClient.getTaskList(orgRef);
|
||||
}
|
||||
|
||||
/** @see TaskClient#getTask(URI) */
|
||||
@Override
|
||||
public Task getTask(URI taskUri) {
|
||||
return taskClient.getTask(taskUri);
|
||||
}
|
||||
|
||||
/** @see TaskClient#cancelTask(URI */
|
||||
@Override
|
||||
public void cancelTask(URI taskUri) {
|
||||
taskClient.cancelTask(taskUri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.internal;
|
||||
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.date.DateService;
|
||||
|
@ -26,13 +28,9 @@ import org.jclouds.http.HttpResponse;
|
|||
import org.jclouds.rest.BaseRestClientExpectTest;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.Guice;
|
||||
|
||||
/**
|
||||
|
@ -48,12 +46,12 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
|||
public static final String token = "mIaR3/6Lna8DWImd7/JPR5rK8FcUHabt+G/UCJV5pJQ=";
|
||||
public static final String endpoint = "https://vcloudbeta.bluelock.com/api";
|
||||
|
||||
protected DateService dateService;
|
||||
protected static DateService dateService;
|
||||
|
||||
@BeforeClass
|
||||
protected void setUpInjector() {
|
||||
@BeforeGroups("unit")
|
||||
protected static void setUpInjector() {
|
||||
dateService = Guice.createInjector().getInstance(DateService.class);
|
||||
assert dateService != null;
|
||||
assertNotNull(dateService);
|
||||
}
|
||||
|
||||
protected HttpRequest loginRequest = HttpRequest.builder()
|
||||
|
@ -80,14 +78,18 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
|||
credential = password;
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequest(String method, String command) {
|
||||
return getStandardRequest(method, URI.create(endpoint + command));
|
||||
protected HttpRequest getStandardRequest(String method, String path) {
|
||||
return getStandardRequest(method, path, VCloudDirectorMediaType.ANY);
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequest(String method, URI uri) {
|
||||
return getStandardRequest(method, uri, VCloudDirectorMediaType.ANY);
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequest(String method, String path, String mediaType) {
|
||||
return getStandardRequest(method, URI.create(endpoint + path), VCloudDirectorMediaType.ANY);
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequest(String method, URI uri, String mediaType) {
|
||||
return HttpRequest.builder()
|
||||
.method(method)
|
||||
|
@ -99,6 +101,31 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
|||
.build();
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequestWithPayload(String method, String path, String relativeFilePath, String mediaType) {
|
||||
return getStandardRequestWithPayload(method, path, VCloudDirectorMediaType.ANY, relativeFilePath, mediaType);
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequestWithPayload(String method, URI uri, String relativeFilePath, String mediaType) {
|
||||
return getStandardRequestWithPayload(method, uri, VCloudDirectorMediaType.ANY, relativeFilePath, mediaType);
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequestWithPayload(String method, String path, String acceptType, String relativeFilePath, String mediaType) {
|
||||
URI uri = URI.create(endpoint + path);
|
||||
return getStandardRequestWithPayload(method, uri, acceptType, relativeFilePath, mediaType);
|
||||
}
|
||||
|
||||
protected HttpRequest getStandardRequestWithPayload(String method, URI uri, String acceptType, String relativeFilePath, String mediaType) {
|
||||
return HttpRequest.builder()
|
||||
.method(method)
|
||||
.endpoint(uri)
|
||||
.headers(ImmutableMultimap.<String, String> builder()
|
||||
.put("Accept", acceptType)
|
||||
.put("x-vcloud-authorization", token)
|
||||
.build())
|
||||
.payload(payloadFromResourceWithContentType(relativeFilePath, mediaType))
|
||||
.build();
|
||||
}
|
||||
|
||||
protected HttpResponse getStandardPayloadResponse(String relativeFilePath, String mediaType) {
|
||||
return getStandardPayloadResponse(200, relativeFilePath, mediaType);
|
||||
}
|
||||
|
@ -106,6 +133,7 @@ public class BaseVCloudDirectorRestClientExpectTest extends BaseRestClientExpect
|
|||
protected HttpResponse getStandardPayloadResponse(int statusCode, String relativeFilePath, String mediaType) {
|
||||
return HttpResponse.builder()
|
||||
.statusCode(statusCode)
|
||||
.payload(payloadFromResourceWithContentType(relativeFilePath, mediaType + ";version=1.5")).build();
|
||||
.payload(payloadFromResourceWithContentType(relativeFilePath, mediaType + ";version=1.5"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CatalogItem xmlns="http://www.vmware.com/vcloud/v1.5" name="newCatalogItem" id="urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" 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">
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<CatalogItem name="ubuntu10" id="urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" xmlns="http://www.vmware.com/vcloud/v1.5">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<Link rel="remove" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<Description>New Catalog Item</Description>
|
||||
<Description>For testing</Description>
|
||||
<Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
|
||||
</CatalogItem>
|
||||
</CatalogItem>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Metadata xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata" 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.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY" 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.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
||||
</Metadata>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata/KEY" 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.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Metadata xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api//catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata" 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">
|
||||
<Metadata xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata" 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/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<MetadataEntry>
|
||||
<Key>key</Key>
|
||||
<Value>value</Value>
|
||||
</MetadataEntry>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY" 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.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
||||
</Metadata>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata/KEY" 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.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CatalogItem xmlns="http://www.vmware.com/vcloud/v1.5" name="newCatalogItem" id="urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" 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/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<Link rel="remove" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<Description>New Catalog Item</Description>
|
||||
<Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
|
||||
</CatalogItem>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Task xmlns="http://www.vmware.com/vcloud/v1.5" status="running" startTime="2012-02-13T06:35:08.011-05:00" operationName="metadataDelete" operation="Deleting metadata for Catalog Item (a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df)" expiryTime="2012-05-13T06:35:08.011-04:00" name="task" id="urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c" type="application/vnd.vmware.vcloud.task+xml" href="https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c" 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="task:cancel" href="https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel"/>
|
||||
<Owner type="application/vnd.vmware.vcloud.catalogItem+xml" name="" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<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"/>
|
||||
<Organization type="application/vnd.vmware.vcloud.org+xml" name="JClouds" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
</Task>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Metadata xmlns="http://www.vmware.com/vcloud/v1.5">
|
||||
<MetadataEntry>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
||||
</Metadata>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Task xmlns="http://www.vmware.com/vcloud/v1.5" status="running" startTime="2012-02-13T06:35:08.011-05:00" operationName="metadataUpdate" operation="Updating metadata for Catalog Item (a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df)" expiryTime="2012-05-13T06:35:08.011-04:00" name="task" id="urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c" type="application/vnd.vmware.vcloud.task+xml" href="https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c" 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="task:cancel" href="https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel"/>
|
||||
<Owner type="application/vnd.vmware.vcloud.catalogItem+xml" name="" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<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"/>
|
||||
<Organization type="application/vnd.vmware.vcloud.org+xml" name="JClouds" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
</Task>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<MetadataValue xmlns="http://www.vmware.com/vcloud/v1.5">
|
||||
<Value>KITTENS</Value>
|
||||
</MetadataValue>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Task xmlns="http://www.vmware.com/vcloud/v1.5" status="running" startTime="2012-02-13T06:35:08.011-05:00" operationName="metadataSet" operation="Setting metadata for Catalog Item (a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df)" expiryTime="2012-05-13T06:35:08.011-04:00" name="task" id="urn:vcloud:task:c6dca927-eab4-41fa-ad6a-3ac58602541c" type="application/vnd.vmware.vcloud.task+xml" href="https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c" 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="task:cancel" href="https://vcloudbeta.bluelock.com/api/task/c6dca927-eab4-41fa-ad6a-3ac58602541c/action/cancel"/>
|
||||
<Owner type="application/vnd.vmware.vcloud.catalogItem+xml" name="" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<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"/>
|
||||
<Organization type="application/vnd.vmware.vcloud.org+xml" name="JClouds" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
</Task>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<CatalogItem name="ubuntu10" id="urn:vcloud:catalogitem:a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df" xmlns="http://www.vmware.com/vcloud/v1.5">
|
||||
<Link rel="up" type="application/vnd.vmware.vcloud.catalog+xml" href="https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"/>
|
||||
<Link rel="down" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df/metadata"/>
|
||||
<Link rel="edit" type="application/vnd.vmware.vcloud.catalogItem+xml" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<Link rel="remove" href="https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"/>
|
||||
<Description>For testing</Description>
|
||||
<Entity type="application/vnd.vmware.vcloud.vAppTemplate+xml" name="ubuntu10" href="https://vcloudbeta.bluelock.com/api/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9"/>
|
||||
</CatalogItem>
|
|
@ -1,4 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Metadata xmlns="http://www.vmware.com/vcloud/v1.5" type="application/vnd.vmware.vcloud.metadata+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata" 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.org+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0"/>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY" 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.metadata+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
||||
</Metadata>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<MetadataEntry xmlns="http://www.vmware.com/vcloud/v1.5" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata/KEY" 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.metadata+xml" href="https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0/metadata"/>
|
||||
<Key>KEY</Key>
|
||||
<Value>VALUE</Value>
|
||||
</MetadataEntry>
|
Loading…
Reference in New Issue