mirror of https://github.com/apache/jclouds.git
VCloud Director 1.5: Switching to URI params rather than using the references
This commit is contained in:
parent
139fe394f7
commit
6b7f3f1fdd
|
@ -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.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -36,11 +38,8 @@ import org.jclouds.rest.binders.BindToXMLPayload;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -58,7 +57,7 @@ public interface CatalogAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Catalog> getCatalog(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogRef);
|
||||
ListenableFuture<Catalog> getCatalog(@EndpointParam URI catalogUri);
|
||||
|
||||
/**
|
||||
* Creates a catalog item in a catalog.
|
||||
|
@ -69,7 +68,7 @@ public interface CatalogAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogRef,
|
||||
ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam URI catalogUri,
|
||||
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
|
||||
|
||||
/**
|
||||
|
@ -79,7 +78,7 @@ public interface CatalogAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef);
|
||||
ListenableFuture<CatalogItem> getCatalogItem(@EndpointParam URI catalogItemUri);
|
||||
|
||||
/**
|
||||
* Modifies a catalog item.
|
||||
|
@ -89,7 +88,7 @@ public interface CatalogAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.CATALOG_ITEM)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef,
|
||||
ListenableFuture<CatalogItem> updateCatalogItem(@EndpointParam URI catalogItemUri,
|
||||
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
|
||||
|
||||
/**
|
||||
|
@ -99,10 +98,10 @@ public interface CatalogAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Void> deleteCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef);
|
||||
ListenableFuture<Void> deleteCatalogItem(@EndpointParam URI catalogItemUri);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata.Writeable} features
|
||||
* @return asynchronous access to {@link Writable} features
|
||||
*/
|
||||
@Delegate
|
||||
MetadataAsyncClient.Writable getMetadataClient();
|
||||
|
|
|
@ -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;
|
||||
|
@ -25,7 +26,6 @@ import org.jclouds.rest.annotations.Delegate;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Catalog} objects.
|
||||
|
@ -43,10 +43,10 @@ public interface CatalogClient {
|
|||
* GET /catalog/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param catalogRef the reference for the catalog
|
||||
* @param catalogUri the reference for the catalog
|
||||
* @return a catalog
|
||||
*/
|
||||
Catalog getCatalog(URISupplier catalogRef);
|
||||
Catalog getCatalog(URI catalogUri);
|
||||
|
||||
/**
|
||||
* Creates a catalog item in a catalog.
|
||||
|
@ -55,11 +55,11 @@ public interface CatalogClient {
|
|||
* POST /catalog/{id}/catalogItems
|
||||
* </pre>
|
||||
*
|
||||
* @param catalogRef the reference for the catalog
|
||||
* @param catalogUri the URI of the catalog
|
||||
* @param item the catalog item to create
|
||||
* @return the created catalog item
|
||||
*/
|
||||
CatalogItem addCatalogItem(URISupplier catalogRef, CatalogItem item);
|
||||
CatalogItem addCatalogItem(URI catalogUri, CatalogItem item);
|
||||
|
||||
/**
|
||||
* Retrieves a catalog item.
|
||||
|
@ -71,7 +71,7 @@ public interface CatalogClient {
|
|||
* @param catalogItemRef the reference for the catalog item
|
||||
* @return the catalog item
|
||||
*/
|
||||
CatalogItem getCatalogItem(URISupplier catalogItemRef);
|
||||
CatalogItem getCatalogItem(URI catalogItemRef);
|
||||
|
||||
/**
|
||||
* Modifies a catalog item.
|
||||
|
@ -84,7 +84,7 @@ public interface CatalogClient {
|
|||
* @param catalogItem the catalog item
|
||||
* @return the updated catalog item
|
||||
*/
|
||||
CatalogItem updateCatalogItem(URISupplier catalogItemRef, CatalogItem catalogItem);
|
||||
CatalogItem updateCatalogItem(URI catalogItemRef, CatalogItem catalogItem);
|
||||
|
||||
/**
|
||||
* Deletes a catalog item.
|
||||
|
@ -95,7 +95,7 @@ public interface CatalogClient {
|
|||
*
|
||||
* @param catalogItemRef the reference for the catalog item
|
||||
*/
|
||||
void deleteCatalogItem(URISupplier catalogItemRef);
|
||||
void deleteCatalogItem(URI catalogItemRef);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Writeable} features
|
||||
|
|
|
@ -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.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -37,10 +39,8 @@ import org.jclouds.vcloud.director.v1_5.domain.Media;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -52,43 +52,42 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface MediaAsyncClient {
|
||||
|
||||
/**
|
||||
* @see MediaClient#getMedia(URISupplier)
|
||||
* @see MediaClient#getMedia(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Media> getMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
|
||||
ListenableFuture<Media> getMedia(@EndpointParam URI uri);
|
||||
|
||||
/**
|
||||
* @see MediaClient#updateMedia(URISupplier, Media))
|
||||
* @see MediaClient#updateMedia(URI, Media))
|
||||
*/
|
||||
@PUT
|
||||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@Produces(VCloudDirectorMediaType.MEDIA)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> updateMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef,
|
||||
@BinderParam(BindToXMLPayload.class) Media media);
|
||||
ListenableFuture<Task> updateMedia(@EndpointParam URI uri, @BinderParam(BindToXMLPayload.class) Media media);
|
||||
|
||||
/**
|
||||
* @see MediaClient#deleteMedia(URISupplier))
|
||||
* @see MediaClient#deleteMedia(URI))
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> deleteMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
|
||||
ListenableFuture<Task> deleteMedia(@EndpointParam URI uri);
|
||||
|
||||
/**
|
||||
* @see MediaClient#getOwner(URISupplier)
|
||||
* @see MediaClient#getOwner(URI)
|
||||
*/
|
||||
@GET
|
||||
@Path("/owner")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
|
||||
ListenableFuture<Owner> getOwner(@EndpointParam URI uri);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata.Writeable} features
|
||||
|
|
|
@ -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;
|
||||
|
@ -26,7 +27,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Media;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Media.
|
||||
|
@ -44,7 +44,7 @@ public interface MediaClient {
|
|||
*
|
||||
* @return the media or null if not found
|
||||
*/
|
||||
Media getMedia(URISupplier mediaRef);
|
||||
Media getMedia(URI mediaUri);
|
||||
|
||||
/**
|
||||
* Updates the name/description of a media.
|
||||
|
@ -52,19 +52,19 @@ public interface MediaClient {
|
|||
* @return a task. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task updateMedia(URISupplier mediaRef, Media media);
|
||||
Task updateMedia(URI mediaUri, Media media);
|
||||
|
||||
/**
|
||||
* Deletes a media.
|
||||
*/
|
||||
Task deleteMedia(URISupplier mediaRef);
|
||||
Task deleteMedia(URI mediaUri);
|
||||
|
||||
/**
|
||||
* Retrieves an owner.
|
||||
*
|
||||
* @return the owner or null if not found
|
||||
*/
|
||||
Owner getOwner(URISupplier mediaRef);
|
||||
Owner getOwner(URI mediaUri);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Writeable} features
|
||||
|
|
|
@ -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.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
|
@ -40,7 +42,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Task;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -60,24 +61,23 @@ public interface MetadataAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef);
|
||||
ListenableFuture<Metadata> getMetadata(@EndpointParam URI metaDataUri);
|
||||
|
||||
/**
|
||||
* @see MetadataClient.Readable#getMetadataEntry(URISupplier, String)
|
||||
* @see MetadataClient.Readable#getMetadataValue(URI, String)
|
||||
*/
|
||||
@GET
|
||||
@Path("/metadata/{key}")
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef ,
|
||||
@PathParam("key") String key);
|
||||
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam URI metaDataUri, @PathParam("key") String key);
|
||||
}
|
||||
|
||||
@RequestFilters(AddVCloudAuthorizationToRequest.class)
|
||||
public static interface Writable extends Readable {
|
||||
/**
|
||||
* @see MetadataClient.Writable#mergeMetadata(URISupplier, Metadata))
|
||||
* @see MetadataClient.Writable#mergeMetadata(URI, Metadata))
|
||||
*/
|
||||
@POST
|
||||
@Path("/metadata")
|
||||
|
@ -85,12 +85,10 @@ public interface MetadataAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.METADATA)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> mergeMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef,
|
||||
@BinderParam(BindToXMLPayload.class) Metadata metadata);
|
||||
|
||||
ListenableFuture<Task> mergeMetadata(@EndpointParam URI metaDataUri, @BinderParam(BindToXMLPayload.class) Metadata metadata);
|
||||
|
||||
/**
|
||||
* @see MetadataClient.Writable#setMetadata(URISupplier, String, MetadataEntry))
|
||||
* @see MetadataClient.Writable#setMetadata(URI, String, MetadataEntry))
|
||||
*/
|
||||
@PUT
|
||||
@Path("/metadata/{key}")
|
||||
|
@ -98,7 +96,7 @@ public interface MetadataAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> setMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier metaDataRef,
|
||||
ListenableFuture<Task> setMetadata(@EndpointParam URI metaDataUri,
|
||||
@PathParam("key") String key,
|
||||
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
|
||||
|
||||
|
@ -110,7 +108,6 @@ public interface MetadataAsyncClient {
|
|||
@Consumes(VCloudDirectorMediaType.TASK)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier metaDataRef,
|
||||
@PathParam("key") String key);
|
||||
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam URI metaDataUri, @PathParam("key") String key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Upload.
|
||||
|
@ -42,14 +42,14 @@ public interface MetadataClient {
|
|||
*
|
||||
* @return a list of metadata
|
||||
*/
|
||||
Metadata getMetadata(URISupplier parentRef);
|
||||
Metadata getMetadata(URI uri);
|
||||
|
||||
/**
|
||||
* Retrieves a metadata value
|
||||
*
|
||||
* @return the metadata value, or null if not found
|
||||
*/
|
||||
MetadataValue getMetadataValue(URISupplier parentRef, String key);
|
||||
MetadataValue getMetadataValue(URI uri, String key);
|
||||
}
|
||||
|
||||
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
|
||||
|
@ -60,7 +60,7 @@ public interface MetadataClient {
|
|||
* @return a task. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task mergeMetadata(URISupplier parentRef, Metadata metadata);
|
||||
Task mergeMetadata(URI uri, Metadata metadata);
|
||||
|
||||
/**
|
||||
* Sets the metadata for the particular key for the media to the value provided.
|
||||
|
@ -69,7 +69,7 @@ public interface MetadataClient {
|
|||
* @return a task. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task setMetadata(URISupplier parentRef, String key, MetadataValue metadataValue);
|
||||
Task setMetadata(URI uri, String key, MetadataValue metadataValue);
|
||||
|
||||
/**
|
||||
* Deletes a metadata entry.
|
||||
|
@ -77,6 +77,6 @@ public interface MetadataClient {
|
|||
* @return a task. This operation is asynchronous and the user should monitor the returned
|
||||
* task status in order to check when it is completed.
|
||||
*/
|
||||
Task deleteMetadataEntry(URISupplier parentRef, String key);
|
||||
Task deleteMetadataEntry(URI uri, String key);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -28,10 +30,8 @@ import org.jclouds.rest.annotations.JAXBResponseParser;
|
|||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -44,13 +44,13 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface NetworkAsyncClient {
|
||||
|
||||
/**
|
||||
* @see NeworkClient#getNetwork(URISupplier)
|
||||
* @see NetworkClient#getNetwork(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier networkRef);
|
||||
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam URI networkUri);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Network.
|
||||
|
@ -42,7 +42,7 @@ public interface NetworkClient {
|
|||
*
|
||||
* @return the network or null if not found
|
||||
*/
|
||||
OrgNetwork getNetwork(URISupplier networkRef);
|
||||
OrgNetwork getNetwork(URI networkUri);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
|
|
|
@ -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.Path;
|
||||
|
@ -30,11 +32,8 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -55,13 +54,13 @@ public interface OrgAsyncClient {
|
|||
ListenableFuture<OrgList> getOrgList();
|
||||
|
||||
/**
|
||||
* @see OrgClient#getOrg(ReferenceType)
|
||||
* @see OrgClient#getOrg(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Org> getOrg(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier orgRef);
|
||||
ListenableFuture<Org> getOrg(@EndpointParam URI orgUri);
|
||||
|
||||
/**
|
||||
* @return asynchronous access to {@link Metadata.Readable} features
|
||||
|
|
|
@ -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;
|
||||
|
@ -25,7 +26,6 @@ import org.jclouds.rest.annotations.Delegate;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.URISupplier;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Org.
|
||||
|
@ -57,7 +57,7 @@ public interface OrgClient {
|
|||
*
|
||||
* @return the org or null if not found
|
||||
*/
|
||||
Org getOrg(URISupplier orgRef);
|
||||
Org getOrg(URI orgRef);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
|||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.OrgReferenceToTaskListEndpoint;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -53,7 +52,7 @@ public interface TaskAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) URISupplier orgRef);
|
||||
ListenableFuture<TasksList> getTaskList(@EndpointParam(parser = OrgReferenceToTaskListEndpoint.class) URI orgURI);
|
||||
|
||||
/**
|
||||
* @see TaskClient#getTask(URI)
|
||||
|
@ -62,7 +61,7 @@ public interface TaskAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Task> getTask(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier taskRef);
|
||||
ListenableFuture<Task> getTask(@EndpointParam URI taskURI);
|
||||
|
||||
/**
|
||||
* @see TaskClient#cancelTask(URI)
|
||||
|
@ -72,5 +71,5 @@ public interface TaskAsyncClient {
|
|||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier taskRef);
|
||||
ListenableFuture<Void> cancelTask(@EndpointParam URI taskURI);
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
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.domain.URISupplier;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link Task} objects.
|
||||
|
@ -41,10 +41,10 @@ public interface TaskClient {
|
|||
* GET /tasksList/{id}
|
||||
* </pre>
|
||||
*
|
||||
* @param orgId the unique id for the organization
|
||||
* @param orgURI the URI of the organization
|
||||
* @return a list of tasks
|
||||
*/
|
||||
TasksList getTaskList(URISupplier orgRef);
|
||||
TasksList getTaskList(URI orgURI);
|
||||
|
||||
/**
|
||||
* Retrieves a task.
|
||||
|
@ -55,7 +55,7 @@ public interface TaskClient {
|
|||
*
|
||||
* @return the task or null if not found
|
||||
*/
|
||||
Task getTask(URISupplier taskUri);
|
||||
Task getTask(URI taskUri);
|
||||
|
||||
/**
|
||||
* Cancels a task.
|
||||
|
@ -64,5 +64,5 @@ public interface TaskClient {
|
|||
* POST /task/{id}/action/cancel
|
||||
* </pre>
|
||||
*/
|
||||
void cancelTask(URISupplier taskUri);
|
||||
void cancelTask(URI taskUri);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.PUT;
|
||||
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
|
||||
|
@ -39,17 +39,17 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface UploadAsyncClient { // TODO: implement these operations correctly
|
||||
|
||||
/**
|
||||
* @see UploadClient#uploadFile(URISupplier, File)
|
||||
* @see UploadClient#uploadFile(URI, File)
|
||||
*/
|
||||
@PUT
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Object> uploadFile(URISupplier target, File file);
|
||||
ListenableFuture<Object> uploadFile(URI uri, File file);
|
||||
|
||||
/**
|
||||
* @see UploadClient#uploadBigFile(URISupplier, File)
|
||||
* @see UploadClient#uploadBigFile(URI, File)
|
||||
*/
|
||||
@PUT
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Object> uploadBigFile(URISupplier target, File file);
|
||||
ListenableFuture<Object> uploadBigFile(URI target, File file);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Upload.
|
||||
|
@ -38,11 +38,11 @@ public interface UploadClient {
|
|||
/**
|
||||
* Uploads a file.
|
||||
*/
|
||||
void uploadFile(URISupplier target, File file);
|
||||
void uploadFile(URI uri, File file);
|
||||
|
||||
/**
|
||||
* Uploads a file using ranged PUTs.
|
||||
*/
|
||||
void uploadBigFile(URISupplier target, File file);
|
||||
void uploadBigFile(URI uri, File file);
|
||||
|
||||
}
|
||||
|
|
|
@ -20,18 +20,30 @@ package org.jclouds.vcloud.director.v1_5.features;
|
|||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType.*;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.ovf.NetworkSection;
|
||||
import org.jclouds.rest.annotations.*;
|
||||
import org.jclouds.rest.annotations.BinderParam;
|
||||
import org.jclouds.rest.annotations.EndpointParam;
|
||||
import org.jclouds.rest.annotations.ExceptionParser;
|
||||
import org.jclouds.rest.annotations.JAXBResponseParser;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ReferenceToEndpoint;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @author Adam Lowe
|
||||
|
@ -41,276 +53,276 @@ import javax.ws.rs.*;
|
|||
public interface VAppTemplateAsyncClient {
|
||||
|
||||
/**
|
||||
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient#getVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient#getVAppTemplate(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(VAPP_TEMPLATE)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<VAppTemplate> getVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier reference);
|
||||
ListenableFuture<VAppTemplate> getVAppTemplate(@EndpointParam URI reference);
|
||||
|
||||
|
||||
/**
|
||||
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient#editVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.VAppTemplate)
|
||||
* @see org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient#editVAppTemplate(URI, org.jclouds.vcloud.director.v1_5.domain.VAppTemplate)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(VAPP_TEMPLATE)
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier reference,
|
||||
ListenableFuture<Task> editVAppTemplate(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) VAppTemplate template);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#deleteVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#deleteVappTemplate(URI)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deleteVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<Task> deleteVappTemplate(@EndpointParam URI templateUri);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#consolidateVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#consolidateVappTemplate(URI)
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK)
|
||||
@Path("/action/consolidate")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> consolidateVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<Task> consolidateVappTemplate(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#disableDownloadVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#disableDownloadVappTemplate(URI)
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK)
|
||||
@Path("/action/disableDownload")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> disableDownloadVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<Task> disableDownloadVappTemplate(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#enableDownloadVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#enableDownloadVappTemplate(URI)
|
||||
*/
|
||||
@POST
|
||||
@Consumes(TASK)
|
||||
@Path("/action/enableDownload")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> enableDownloadVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<Task> enableDownloadVappTemplate(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#relocateVappTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.RelocateParams)
|
||||
* @see VAppTemplateClient#relocateVappTemplate(URI, org.jclouds.vcloud.director.v1_5.domain.RelocateParams)
|
||||
*/
|
||||
@POST
|
||||
@Produces(RELOCATE_TEMPLATE)
|
||||
@Consumes(TASK)
|
||||
@Path("/action/relocate")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> relocateVappTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
ListenableFuture<Task> relocateVappTemplate(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) RelocateParams params);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVAppTemplateCustomizationSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(CUSTOMIZATION_SECTION)
|
||||
@Path("/customizationSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<CustomizationSection> getVAppTemplateCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<CustomizationSection> getVAppTemplateCustomizationSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editVAppTemplateCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.CustomizationSection)
|
||||
* @see VAppTemplateClient#editVAppTemplateCustomizationSection(URI, org.jclouds.vcloud.director.v1_5.domain.CustomizationSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(CUSTOMIZATION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/customizationSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplateCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
ListenableFuture<Task> editVAppTemplateCustomizationSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) CustomizationSection sectionType);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateGuestCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVAppTemplateGuestCustomizationSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(GUEST_CUSTOMIZATION_SECTION)
|
||||
@Path("/guestCustomizationSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<GuestCustomizationSection> getVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<GuestCustomizationSection> getVAppTemplateGuestCustomizationSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editVAppTemplateGuestCustomizationSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection)
|
||||
* @see VAppTemplateClient#editVAppTemplateGuestCustomizationSection(URI, org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(GUEST_CUSTOMIZATION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/guestCustomizationSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplateGuestCustomizationSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||
ListenableFuture<Task> editVAppTemplateGuestCustomizationSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) GuestCustomizationSection section);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVappTemplateLeaseSettingsSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVappTemplateLeaseSettingsSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(LEASE_SETTINGS_SECTION)
|
||||
@Path("/leaseSettingsSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<LeaseSettingsSection> getVappTemplateLeaseSettingsSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<LeaseSettingsSection> getVappTemplateLeaseSettingsSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editVappTemplateLeaseSettingsSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection)
|
||||
* @see VAppTemplateClient#editVappTemplateLeaseSettingsSection(URI, org.jclouds.vcloud.director.v1_5.domain.LeaseSettingsSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(LEASE_SETTINGS_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/leaseSettingsSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVappTemplateLeaseSettingsSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
ListenableFuture<Task> editVappTemplateLeaseSettingsSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) LeaseSettingsSection settingsSection);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateMetadata(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVAppTemplateMetadata(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(METADATA)
|
||||
@Path("/metadata")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Metadata> getVAppTemplateMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<Metadata> getVAppTemplateMetadata(@EndpointParam URI templateURI);
|
||||
|
||||
@PUT
|
||||
@Produces(METADATA)
|
||||
@Consumes(TASK)
|
||||
@Path("/metadata")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplateMetadata(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@BinderParam(BindToXMLPayload.class) Metadata metadata);
|
||||
ListenableFuture<Task> editVAppTemplateMetadata(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) Metadata metadata);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateMetadataValue(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String)
|
||||
* @see VAppTemplateClient#getVAppTemplateMetadataValue(URI, String)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(METADATA_ENTRY)
|
||||
@Path("/metadata/{key}")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<MetadataValue> getVAppTemplateMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@PathParam("key") String key);
|
||||
ListenableFuture<MetadataValue> getVAppTemplateMetadataValue(@EndpointParam URI templateURI,
|
||||
@PathParam("key") String key);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editVAppTemplateMetadataValue(org.jclouds.vcloud.director.v1_5.domain.URISupplier, String, org.jclouds.vcloud.director.v1_5.domain.MetadataValue)
|
||||
* @see VAppTemplateClient#editVAppTemplateMetadataValue(URI, String, org.jclouds.vcloud.director.v1_5.domain.MetadataValue)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(METADATA_ENTRY)
|
||||
@Consumes(TASK)
|
||||
@Path("/metadata/{key}")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplateMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@PathParam("key") String key,
|
||||
@BinderParam(BindToXMLPayload.class) MetadataValue value);
|
||||
ListenableFuture<Task> editVAppTemplateMetadataValue(@EndpointParam URI templateURI,
|
||||
@PathParam("key") String key,
|
||||
@BinderParam(BindToXMLPayload.class) MetadataValue value);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#deleteVAppTemplateMetadataValue(URISupplier, String)
|
||||
* @see VAppTemplateClient#deleteVAppTemplateMetadataValue(URI, String)
|
||||
*/
|
||||
@DELETE
|
||||
@Consumes(TASK)
|
||||
@Path("/metadata/{key}")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> deleteVAppTemplateMetadataValue(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@PathParam("key") String key);
|
||||
ListenableFuture<Task> deleteVAppTemplateMetadataValue(@EndpointParam URI templateURI,
|
||||
@PathParam("key") String key);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateNetworkConfigSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVAppTemplateNetworkConfigSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_CONFIG_SECTION)
|
||||
@Path("/networkConfigSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<NetworkConfigSection> getVAppTemplateNetworkConfigSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<NetworkConfigSection> getVAppTemplateNetworkConfigSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editVAppTemplateNetworkConfigSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection)
|
||||
* @see VAppTemplateClient#editVAppTemplateNetworkConfigSection(URI, org.jclouds.vcloud.director.v1_5.domain.NetworkConfigSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(NETWORK_CONFIG_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/networkConfigSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplateNetworkConfigSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
|
||||
ListenableFuture<Task> editVAppTemplateNetworkConfigSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateNetworkConnectionSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVAppTemplateNetworkConnectionSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_CONNECTION_SECTION)
|
||||
@Path("/networkConnectionSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<NetworkConnectionSection> getVAppTemplateNetworkConnectionSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<NetworkConnectionSection> getVAppTemplateNetworkConnectionSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editVAppTemplateNetworkConnectionSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection)
|
||||
* @see VAppTemplateClient#editVAppTemplateNetworkConnectionSection(URI, org.jclouds.vcloud.director.v1_5.domain.NetworkConnectionSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(NETWORK_CONNECTION_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/networkConnectionSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplateNetworkConnectionSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
||||
ListenableFuture<Task> editVAppTemplateNetworkConnectionSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateNetworkSection(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVAppTemplateNetworkSection(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(NETWORK_SECTION)
|
||||
@Path("/networkSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<NetworkSection> getVAppTemplateNetworkSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<NetworkSection> getVAppTemplateNetworkSection(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editVAppTemplateNetworkSection(URISupplier, NetworkSection)
|
||||
* @see VAppTemplateClient#editVAppTemplateNetworkSection(URI, NetworkSection)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(NETWORK_SECTION)
|
||||
@Consumes(TASK)
|
||||
@Path("/networkSection")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editVAppTemplateNetworkSection(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkSection section);
|
||||
ListenableFuture<Task> editVAppTemplateNetworkSection(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) NetworkSection section);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getVAppTemplateOvf(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getVAppTemplateOvf(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(ENVELOPE)
|
||||
@Path("/ovf")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Envelope> getVAppTemplateOvf(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<Envelope> getVAppTemplateOvf(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getOwnerOfVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getOwnerOfVAppTemplate(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(OWNER)
|
||||
@Path("/owner")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Owner> getOwnerOfVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<Owner> getOwnerOfVAppTemplate(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#getProductSectionsForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier)
|
||||
* @see VAppTemplateClient#getProductSectionsForVAppTemplate(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes(PRODUCT_SECTION_LIST)
|
||||
@Path("/productSections")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<ProductSectionList> getProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference);
|
||||
ListenableFuture<ProductSectionList> getProductSectionsForVAppTemplate(@EndpointParam URI templateURI);
|
||||
|
||||
/**
|
||||
* @see VAppTemplateClient#editProductSectionsForVAppTemplate(org.jclouds.vcloud.director.v1_5.domain.URISupplier, org.jclouds.vcloud.director.v1_5.domain.ProductSectionList)
|
||||
* @see VAppTemplateClient#editProductSectionsForVAppTemplate(URI, org.jclouds.vcloud.director.v1_5.domain.ProductSectionList)
|
||||
*/
|
||||
@PUT
|
||||
@Produces(PRODUCT_SECTION_LIST)
|
||||
@Consumes(TASK)
|
||||
@Path("/productSections")
|
||||
@JAXBResponseParser
|
||||
ListenableFuture<Task> editProductSectionsForVAppTemplate(@EndpointParam(parser = ReferenceToEndpoint.class) URISupplier templateReference,
|
||||
ListenableFuture<Task> editProductSectionsForVAppTemplate(@EndpointParam URI templateURI,
|
||||
@BinderParam(BindToXMLPayload.class) ProductSectionList sections);
|
||||
|
||||
// TODO shadowVms ?
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.ovf.Envelope;
|
||||
import org.jclouds.ovf.NetworkSection;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} objects.
|
||||
*
|
||||
|
@ -38,227 +38,227 @@ public interface VAppTemplateClient {
|
|||
/**
|
||||
* Retrieves a vApp template (can be used also to retrieve a VM from a vApp Template).
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the requested template
|
||||
*/
|
||||
VAppTemplate getVAppTemplate(URISupplier templateReference);
|
||||
VAppTemplate getVAppTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies only the name/description of a vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @param template the template containing the new name and/or description
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplate(URISupplier templateReference, VAppTemplate template);
|
||||
Task editVAppTemplate(URI templateUri, VAppTemplate template);
|
||||
|
||||
/**
|
||||
* Deletes a vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task deleteVappTemplate(URISupplier templateReference);
|
||||
Task deleteVappTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task consolidateVappTemplate(URISupplier templateReference);
|
||||
Task consolidateVappTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task disableDownloadVappTemplate(URISupplier templateReference);
|
||||
Task disableDownloadVappTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Consolidates a VM,
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task enableDownloadVappTemplate(URISupplier templateReference);
|
||||
Task enableDownloadVappTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Relocates a virtual machine in a vApp template to a different datastore. *
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task relocateVappTemplate(URISupplier templateReference, RelocateParams params);
|
||||
Task relocateVappTemplate(URI templateUri, RelocateParams params);
|
||||
|
||||
/**
|
||||
* Retrieves the customization section of a vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
CustomizationSection getVAppTemplateCustomizationSection(URISupplier templateReference);
|
||||
CustomizationSection getVAppTemplateCustomizationSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the vApp template customization information.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplateCustomizationSection(URISupplier templateReference, CustomizationSection sectionType);
|
||||
Task editVAppTemplateCustomizationSection(URI templateUri, CustomizationSection sectionType);
|
||||
|
||||
/**
|
||||
* Retrieves the Guest Customization Section of a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
GuestCustomizationSection getVAppTemplateGuestCustomizationSection(URISupplier templateReference);
|
||||
GuestCustomizationSection getVAppTemplateGuestCustomizationSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplateGuestCustomizationSection(URISupplier templateReference, GuestCustomizationSection sectionType);
|
||||
Task editVAppTemplateGuestCustomizationSection(URI templateUri, GuestCustomizationSection sectionType);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
LeaseSettingsSection getVappTemplateLeaseSettingsSection(URISupplier templateReference);
|
||||
LeaseSettingsSection getVappTemplateLeaseSettingsSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVappTemplateLeaseSettingsSection(URISupplier templateReference, LeaseSettingsSection settingsSection);
|
||||
Task editVappTemplateLeaseSettingsSection(URI templateUri, LeaseSettingsSection settingsSection);
|
||||
|
||||
/**
|
||||
* Retrieves the metadata associated with a vApp Template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the requested metadata
|
||||
*/
|
||||
Metadata getVAppTemplateMetadata(URISupplier templateReference);
|
||||
Metadata getVAppTemplateMetadata(URI templateUri);
|
||||
|
||||
/**
|
||||
* Merges the metadata for a vApp Template with the information provided.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplateMetadata(URISupplier templateReference, Metadata metadata);
|
||||
Task editVAppTemplateMetadata(URI templateUri, Metadata metadata);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
MetadataValue getVAppTemplateMetadataValue(URISupplier templateReference, String key);
|
||||
MetadataValue getVAppTemplateMetadataValue(URI templateUri, String key);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplateMetadataValue(URISupplier templateReference, String key, MetadataValue value);
|
||||
Task editVAppTemplateMetadataValue(URI templateUri, String key, MetadataValue value);
|
||||
|
||||
/**
|
||||
* Consolidates a VM
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task deleteVAppTemplateMetadataValue(URISupplier templateReference, String key);
|
||||
Task deleteVAppTemplateMetadataValue(URI templateUri, String key);
|
||||
|
||||
/**
|
||||
* Retrieves the network config section of a vApp or vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the network config section requested
|
||||
*/
|
||||
NetworkConfigSection getVAppTemplateNetworkConfigSection(URISupplier templateReference);
|
||||
NetworkConfigSection getVAppTemplateNetworkConfigSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the network config section of a vApp or vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplateNetworkConfigSection(URISupplier templateReference, NetworkConfigSection section);
|
||||
Task editVAppTemplateNetworkConfigSection(URI templateUri, NetworkConfigSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network connection section of a vApp or vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the network connection section requested
|
||||
*/
|
||||
NetworkConnectionSection getVAppTemplateNetworkConnectionSection(URISupplier templateReference);
|
||||
NetworkConnectionSection getVAppTemplateNetworkConnectionSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the network connection section of a vApp or vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplateNetworkConnectionSection(URISupplier templateReference, NetworkConnectionSection section);
|
||||
Task editVAppTemplateNetworkConnectionSection(URI templateUri, NetworkConnectionSection section);
|
||||
|
||||
/**
|
||||
* Retrieves the network section of a vApp or vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the network section requested
|
||||
*/
|
||||
NetworkSection getVAppTemplateNetworkSection(URISupplier templateReference);
|
||||
NetworkSection getVAppTemplateNetworkSection(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the network section of a vApp or vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editVAppTemplateNetworkSection(URISupplier templateReference, NetworkSection section);
|
||||
Task editVAppTemplateNetworkSection(URI templateUri, NetworkSection section);
|
||||
|
||||
/**
|
||||
* Retrieves an OVF descriptor of a vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Envelope getVAppTemplateOvf(URISupplier templateReference);
|
||||
Envelope getVAppTemplateOvf(URI templateUri);
|
||||
|
||||
/**
|
||||
* Retrieves vApp template owner.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the owner of the vApp template
|
||||
*/
|
||||
Owner getOwnerOfVAppTemplate(URISupplier templateReference);
|
||||
Owner getOwnerOfVAppTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Retrieves VAppTemplate/VM product sections
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the product sections
|
||||
*/
|
||||
ProductSectionList getProductSectionsForVAppTemplate(URISupplier templateReference);
|
||||
ProductSectionList getProductSectionsForVAppTemplate(URI templateUri);
|
||||
|
||||
/**
|
||||
* Modifies the product sections of a vApp or vApp template.
|
||||
*
|
||||
* @param templateReference the reference to the template
|
||||
* @@param templateUri the URI of the template
|
||||
* @return the task performing the action
|
||||
*/
|
||||
Task editProductSectionsForVAppTemplate(URISupplier templateReference, ProductSectionList sections);
|
||||
Task editProductSectionsForVAppTemplate(URI templateUri, ProductSectionList sections);
|
||||
|
||||
// TODO ShadowVms???
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
* under the License.
|
||||
*/
|
||||
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;
|
||||
|
@ -32,22 +34,9 @@ import org.jclouds.rest.annotations.JAXBResponseParser;
|
|||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.binders.BindToXMLPayload;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParamsType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Media;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
|
||||
import org.jclouds.vcloud.director.v1_5.functions.URISupplierToEndpoint;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
|
@ -60,16 +49,16 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
public interface VdcAsyncClient {
|
||||
|
||||
/**
|
||||
* @see VdcClient#getVdc(URISupplier)
|
||||
* @see VdcClient#getVdc(URI)
|
||||
*/
|
||||
@GET
|
||||
@Consumes
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Vdc> getVdc(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef);
|
||||
ListenableFuture<Vdc> getVdc(@EndpointParam URI vdcURI);
|
||||
|
||||
/**
|
||||
* @see VdcClient#captureVApp(URISupplier, CaptureVAppParams)
|
||||
* @see VdcClient#captureVApp(URI, CaptureVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/captureVApp")
|
||||
|
@ -77,11 +66,11 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.CAPTURE_VAPP_PARAMS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<VAppTemplate> captureVApp(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<VAppTemplate> captureVApp(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) CaptureVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VdcClient#cloneMedia(URISupplier, CloneMediaParams)
|
||||
* @see VdcClient#cloneMedia(URI, CloneMediaParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneMedia")
|
||||
|
@ -89,11 +78,11 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.CLONE_MEDIA_PARAMS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Media> cloneMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<Media> cloneMedia(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) CloneMediaParams params);
|
||||
|
||||
/**
|
||||
* @see VdcClient#cloneVApp(URISupplier, CloneVAppParams)
|
||||
* @see VdcClient#cloneVApp(URI, CloneVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneVApp")
|
||||
|
@ -101,11 +90,11 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.CLONE_V_APP_PARAMS) //TODO fix these etc.
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<VApp> cloneVApp(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<VApp> cloneVApp(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) CloneVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VdcClient#cloneVAppTemplate(URISupplier, CloneVAppTemplateParams)
|
||||
* @see VdcClient#cloneVAppTemplate(URI, CloneVAppTemplateParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/cloneVAppTemplate")
|
||||
|
@ -113,11 +102,11 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.CLONE_V_APP_TEMPLATE_PARAMS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<VAppTemplate> cloneVAppTemplate(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<VAppTemplate> cloneVAppTemplate(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) CloneVAppTemplateParams params);
|
||||
|
||||
/**
|
||||
* @see VdcClient#composeVApp(URISupplier, ComposeVAppParams)
|
||||
* @see VdcClient#composeVApp(URI, ComposeVAppParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/composeVApp")
|
||||
|
@ -125,11 +114,11 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.COMPOSE_VAPP_PARAMS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<VApp> composeVApp(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<VApp> composeVApp(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) ComposeVAppParams params);
|
||||
|
||||
/**
|
||||
* @see VdcClient#instantiateVApp(URISupplier, InstantiateVAppParamsType)
|
||||
* @see VdcClient#instantiateVApp(URI, InstantiateVAppParamsType)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/instantiateVApp")
|
||||
|
@ -137,11 +126,11 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.INSTANTIATE_VAPP_TEMPLATE_PARAMS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<VApp> instantiateVApp(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<VApp> instantiateVApp(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) InstantiateVAppParamsType<?> params);
|
||||
|
||||
/**
|
||||
* @see VdcClient#uploadVAppTemplate(URISupplier, UploadVAppTemplateParams)
|
||||
* @see VdcClient#uploadVAppTemplate(URI, UploadVAppTemplateParams)
|
||||
*/
|
||||
@POST
|
||||
@Path("/action/uploadVAppTemplate")
|
||||
|
@ -149,11 +138,11 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.UPLOAD_VAPP_TEMPLATE_PARAMS)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<VAppTemplate> uploadVAppTemplate(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<VAppTemplate> uploadVAppTemplate(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) UploadVAppTemplateParams params);
|
||||
|
||||
/**
|
||||
* @see VdcClient#createMedia(URISupplier, Media)
|
||||
* @see VdcClient#createMedia(URI, Media)
|
||||
*/
|
||||
@POST
|
||||
@Path("/media")
|
||||
|
@ -161,7 +150,7 @@ public interface VdcAsyncClient {
|
|||
@Produces(VCloudDirectorMediaType.MEDIA)
|
||||
@JAXBResponseParser
|
||||
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
|
||||
ListenableFuture<Media> createMedia(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef,
|
||||
ListenableFuture<Media> createMedia(@EndpointParam URI vdcURI,
|
||||
@BinderParam(BindToXMLPayload.class) Media media);
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,23 +18,12 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.concurrent.Timeout;
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParamsType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Media;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
|
||||
/**
|
||||
* Provides synchronous access to a vDC.
|
||||
|
@ -52,7 +41,7 @@ public interface VdcClient {
|
|||
*
|
||||
* @return the vdc or null if not found
|
||||
*/
|
||||
Vdc getVdc(URISupplier vdcRef);
|
||||
Vdc getVdc(URI vdcUri);
|
||||
|
||||
/**
|
||||
* Captures a vApp into vApp template.
|
||||
|
@ -61,7 +50,7 @@ public interface VdcClient {
|
|||
* @return a VApp resource which will contain a task.
|
||||
* The user should should wait for this task to finish to be able to use the vApp.
|
||||
*/
|
||||
VAppTemplate captureVApp(URISupplier vdcRef, CaptureVAppParams params);
|
||||
VAppTemplate captureVApp(URI vdcUri, CaptureVAppParams params);
|
||||
|
||||
/**
|
||||
* Clones a media into new one.
|
||||
|
@ -70,7 +59,7 @@ public interface VdcClient {
|
|||
* @return a Media resource which will contain a task.
|
||||
* The user should monitor the contained task status in order to check when it is completed.
|
||||
*/
|
||||
Media cloneMedia(URISupplier vdcRef, CloneMediaParams params);
|
||||
Media cloneMedia(URI vdcUri, CloneMediaParams params);
|
||||
|
||||
/**
|
||||
* Clones a vApp into new one. The status of vApp will be in UNRESOLVED(0) until the clone task is finished.
|
||||
|
@ -78,7 +67,7 @@ public interface VdcClient {
|
|||
* @return a VApp resource which will contain a task.
|
||||
* The user should should wait for this task to finish to be able to use the vApp.
|
||||
*/
|
||||
VApp cloneVApp(URISupplier vdcRef, CloneVAppParams params);
|
||||
VApp cloneVApp(URI vdcUri, CloneVAppParams params);
|
||||
|
||||
/**
|
||||
* Clones a vApp template into new one.
|
||||
|
@ -87,7 +76,7 @@ public interface VdcClient {
|
|||
* @return a VAppTemplate resource which will contain a task.
|
||||
* The user should should wait for this task to finish to be able to use the VAppTemplate.
|
||||
*/
|
||||
VAppTemplate cloneVAppTemplate(URISupplier vdcRef, CloneVAppTemplateParams params);
|
||||
VAppTemplate cloneVAppTemplate(URI vdcUri, CloneVAppTemplateParams params);
|
||||
|
||||
/**
|
||||
* Composes a new vApp using VMs from other vApps or vApp templates. The vCloud API supports
|
||||
|
@ -111,7 +100,7 @@ public interface VdcClient {
|
|||
* @return a VApp resource which will contain a task.
|
||||
* The user should should wait for this task to finish to be able to use the vApp.
|
||||
*/
|
||||
VApp composeVApp(URISupplier vdcRef, ComposeVAppParams params);
|
||||
VApp composeVApp(URI vdcUri, ComposeVAppParams params);
|
||||
|
||||
/**
|
||||
* Instantiate a vApp template into a new vApp.
|
||||
|
@ -120,7 +109,7 @@ public interface VdcClient {
|
|||
* @return a VApp resource which will contain a task.
|
||||
* The user should should wait for this task to finish to be able to use the vApp.
|
||||
*/
|
||||
VApp instantiateVApp(URISupplier vdcRef, InstantiateVAppParamsType<?> params);
|
||||
VApp instantiateVApp(URI vdcUri, InstantiateVAppParamsType<?> params);
|
||||
|
||||
/**
|
||||
* Uploading vApp template to a vDC. The operation is separate on several steps:
|
||||
|
@ -134,14 +123,14 @@ public interface VdcClient {
|
|||
* @return a VAppTemplate resource which will contain a task.
|
||||
* The user should should wait for this task to finish to be able to use the VAppTemplate.
|
||||
*/
|
||||
VAppTemplate uploadVAppTemplate(URISupplier vdcRef, UploadVAppTemplateParams params);
|
||||
VAppTemplate uploadVAppTemplate(URI vdcUri, UploadVAppTemplateParams params);
|
||||
|
||||
/**
|
||||
* Creates a media (and present upload link for the floppy/iso file).
|
||||
*
|
||||
* @return The response will return a link to transfer site to be able to continue with uploading the media.
|
||||
*/
|
||||
Media createMedia(URISupplier vdcRef, Media media);
|
||||
Media createMedia(URI vdcUri, Media media);
|
||||
|
||||
/**
|
||||
* @return synchronous access to {@link Metadata.Readable} features
|
||||
|
|
|
@ -47,8 +47,8 @@ public class OrgReferenceToTaskListEndpoint implements Function<Object, URI> {
|
|||
@Override
|
||||
public URI apply(Object input) {
|
||||
Preconditions.checkNotNull(input);
|
||||
Preconditions.checkArgument(input instanceof URISupplier);
|
||||
URISupplier reference = (URISupplier) input;
|
||||
Preconditions.checkArgument(input instanceof URI);
|
||||
URI reference = (URI) input;
|
||||
Org org = client.getOrg(reference);
|
||||
for (Link link : org.getLinks()) {
|
||||
if (link.getType().equals(VCloudDirectorMediaType.TASKS_LIST)) {
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/**
|
||||
* 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.functions;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
|
||||
/**
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Deprecated
|
||||
public class ReferenceToEndpoint implements Function<Object, URI> {
|
||||
|
||||
@Override
|
||||
public URI apply(Object input) {
|
||||
Preconditions.checkNotNull(input);
|
||||
Preconditions.checkArgument(input instanceof URISupplier);
|
||||
URISupplier reference = (URISupplier) input;
|
||||
return reference.getURI();
|
||||
};
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/**
|
||||
* 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.functions;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
/**
|
||||
* @author danikov
|
||||
*/
|
||||
public class URISupplierToEndpoint implements Function<Object, URI> {
|
||||
|
||||
@Override
|
||||
public URI apply(Object input) {
|
||||
Preconditions.checkNotNull(input);
|
||||
Preconditions.checkArgument(input instanceof URISupplier);
|
||||
URISupplier provider = (URISupplier) input;
|
||||
return provider.getURI();
|
||||
};
|
||||
}
|
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.predicates;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -36,7 +38,7 @@ import com.google.common.base.Predicate;
|
|||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@Singleton
|
||||
public class TaskSuccess implements Predicate<URISupplier> {
|
||||
public class TaskSuccess implements Predicate<Task> {
|
||||
|
||||
private final TaskClient taskClient;
|
||||
|
||||
|
@ -50,10 +52,12 @@ public class TaskSuccess implements Predicate<URISupplier> {
|
|||
|
||||
/** @see Predicate#apply(Object) */
|
||||
@Override
|
||||
public boolean apply(URISupplier taskRef) {
|
||||
logger.trace("looking for status on task %s", taskRef);
|
||||
public boolean apply(Task task) {
|
||||
logger.trace("looking for status on task %s", task);
|
||||
|
||||
Task task = taskClient.getTask(taskRef);
|
||||
// TODO shouldn't we see if it's already done before getting it from API server?
|
||||
task = taskClient.getTask(task.getURI());
|
||||
|
||||
// perhaps task isn't available, yet
|
||||
if (task == null) return false;
|
||||
logger.trace("%s: looking for status %s: currently: %s", task, Task.Status.SUCCESS, task.getStatus());
|
||||
|
|
|
@ -69,13 +69,8 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
Catalog expected = catalog();
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalog(catalogRef), expected);
|
||||
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
|
||||
assertEquals(client.getCatalogClient().getCatalog(catalogURI), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -97,11 +92,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
|
||||
|
||||
CatalogItem newItem = CatalogItem.builder()
|
||||
.name("newCatalogItem")
|
||||
|
@ -111,7 +102,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
CatalogItem expected = createdCatalogItem();
|
||||
|
||||
assertEquals(client.getCatalogClient().addCatalogItem(catalogRef, newItem), expected);
|
||||
assertEquals(client.getCatalogClient().addCatalogItem(catalogURI, newItem), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -132,11 +123,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
|
||||
|
||||
Metadata expected = Metadata.builder()
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
|
@ -149,7 +136,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.entries(ImmutableSet.of(metadataEntry()))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogRef), expected);
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogURI), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -170,15 +157,11 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, catalogRequest, catalogResponse);
|
||||
|
||||
Reference catalogRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
.href(URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4"))
|
||||
.build();
|
||||
URI catalogURI = URI.create(endpoint + "/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4");
|
||||
|
||||
MetadataValue expected = metadataValue();
|
||||
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogRef, "KEY"), expected);
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogURI, "KEY"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -199,15 +182,11 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
|
||||
CatalogItem expected = catalogItem();
|
||||
|
||||
assertEquals(client.getCatalogClient().getCatalogItem(catalogItemReference), expected);
|
||||
assertEquals(client.getCatalogClient().getCatalogItem(catalogItemURI), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -229,15 +208,10 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
CatalogItem expected = catalogItem();
|
||||
|
||||
assertEquals(client.getCatalogClient().updateCatalogItem(catalogItemReference, expected), expected);
|
||||
assertEquals(client.getCatalogClient().updateCatalogItem(catalogItemURI, expected), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -257,13 +231,9 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
|
||||
client.getCatalogClient().deleteCatalogItem(catalogItemReference);
|
||||
client.getCatalogClient().deleteCatalogItem(catalogItemURI);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -284,11 +254,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
|
||||
Metadata expected = Metadata.builder()
|
||||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
|
@ -301,7 +267,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.entries(ImmutableSet.of(itemMetadataEntry()))
|
||||
.build();
|
||||
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogItemReference), expected);
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogItemURI), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -323,17 +289,13 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
|
||||
Metadata metadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "VALUE").build()).build();
|
||||
|
||||
Task expected = mergeMetadataTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().mergeMetadata(catalogItemReference, metadata), expected);
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().mergeMetadata(catalogItemURI, metadata), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -353,16 +315,12 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.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();
|
||||
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
|
||||
MetadataValue expected = itemMetadataValue();
|
||||
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogItemReference, "KEY"), expected);
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogItemURI, "KEY"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -384,17 +342,13 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
|
||||
MetadataValue value = MetadataValue.builder().value("KITTENS").build();
|
||||
|
||||
Task expected = setMetadataValueTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().setMetadata(catalogItemReference, "KEY", value), expected);
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().setMetadata(catalogItemURI, "KEY", value), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -415,15 +369,11 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
|
||||
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();
|
||||
URI catalogItemURI = URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df");
|
||||
|
||||
Task expected = deleteMetadataEntryTask();
|
||||
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().deleteMetadataEntry(catalogItemReference, "KEY"), expected);
|
||||
assertEquals(client.getCatalogClient().getMetadataClient().deleteMetadataEntry(catalogItemURI, "KEY"), expected);
|
||||
}
|
||||
|
||||
public static final Catalog catalog() {
|
||||
|
|
|
@ -31,6 +31,8 @@ import static org.testng.Assert.assertFalse;
|
|||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
|
@ -91,14 +93,14 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
CatalogReferences catalogReferences = queryClient.catalogReferencesQuery(String.format("name==%s", catalogName));
|
||||
assertEquals(Iterables.size(catalogReferences.getReferences()), 1, String.format(MUST_EXIST_FMT, catalogName, "Catalog"));
|
||||
catalogRef = Iterables.getOnlyElement(catalogReferences.getReferences());
|
||||
catalog = catalogClient.getCatalog(catalogRef);
|
||||
catalog = catalogClient.getCatalog(catalogRef.getHref());
|
||||
}
|
||||
|
||||
@Test(testName = "GET /catalogItem/{id}", dependsOnMethods = { "testGetCatalog" })
|
||||
public void testGetCatalogItem() {
|
||||
assertFalse(Iterables.isEmpty(catalog.getCatalogItems().getCatalogItems()));
|
||||
catalogItemRef = Iterables.get(catalog.getCatalogItems().getCatalogItems(), 0);
|
||||
catalogItem = catalogClient.getCatalogItem(catalogItemRef);
|
||||
catalogItem = catalogClient.getCatalogItem(catalogItemRef.getHref());
|
||||
checkCatalogItem(catalogItem);
|
||||
}
|
||||
|
||||
|
@ -114,14 +116,14 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
// XXX org.jclouds.vcloud.director.v1_5.VCloudDirectorException: Error: The VCD entity ubuntu10 already exists.
|
||||
// .entity(Reference.builder().href(URI.create(endpoint + "/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9")).build())
|
||||
.build();
|
||||
newCatalogItem = catalogClient.addCatalogItem(catalogRef, editedCatalogItem);
|
||||
newCatalogItem = catalogClient.addCatalogItem(catalogRef.getHref(), editedCatalogItem);
|
||||
checkCatalogItem(newCatalogItem);
|
||||
assertEquals(newCatalogItem.getName(), "newitem");
|
||||
}
|
||||
|
||||
@Test(testName = "PUT /catalogItem/{id}", dependsOnMethods = { "testAddCatalogItem" }, enabled = false)
|
||||
public void testUpdateCatalogItem() {
|
||||
Catalog catalog = catalogClient.getCatalog(catalogRef);
|
||||
Catalog catalog = catalogClient.getCatalog(catalogRef.getHref());
|
||||
newCatalogItemRef = Iterables.find(catalog.getCatalogItems().getCatalogItems(), new Predicate<Reference>() {
|
||||
@Override
|
||||
public boolean apply(Reference input) {
|
||||
|
@ -129,16 +131,16 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
});
|
||||
CatalogItem updatedCatalogItem = CatalogItem.builder().fromCatalogItem(catalogItem).name("UPDATEDNAME").build();
|
||||
newCatalogItem = catalogClient.updateCatalogItem(catalogRef, updatedCatalogItem);
|
||||
newCatalogItem = catalogClient.updateCatalogItem(catalogRef.getHref(), updatedCatalogItem);
|
||||
checkCatalogItem(newCatalogItem);
|
||||
assertEquals(newCatalogItem.getName(), "UPDATEDNAME");
|
||||
}
|
||||
|
||||
@Test(testName = "DELETE /catalogItem/{id}", dependsOnMethods = { "testAddCatalogItem" }, enabled = false)
|
||||
public void testDeleteCatalogItem() {
|
||||
catalogClient.deleteCatalogItem(newCatalogItemRef);
|
||||
catalogClient.deleteCatalogItem(newCatalogItemRef.getHref());
|
||||
try {
|
||||
catalogClient.getCatalogItem(newCatalogItemRef);
|
||||
catalogClient.getCatalogItem(newCatalogItemRef.getHref());
|
||||
fail("The CatalogItem should have been deleted");
|
||||
} catch (VCloudDirectorException vcde) {
|
||||
checkError(vcde.getError());
|
||||
|
@ -150,7 +152,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
// NOTE for this test to work, we need to be able to create metadata on a Catalog, specifically { "KEY", "VALUE" }
|
||||
@Test(testName = "GET /catalog/{id}/metadata", dependsOnMethods = { "testGetCatalog" }, enabled = false)
|
||||
public void testGetCatalogMetadata() {
|
||||
catalogMetadata = catalogClient.getMetadataClient().getMetadata(catalogRef);
|
||||
catalogMetadata = catalogClient.getMetadataClient().getMetadata(catalogRef.getHref());
|
||||
checkMetadata(catalogMetadata);
|
||||
}
|
||||
|
||||
|
@ -163,7 +165,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
return input.getKey().equals("KEY");
|
||||
}
|
||||
});
|
||||
MetadataValue metadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogRef, "KEY");
|
||||
MetadataValue metadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogRef.getHref(), "KEY");
|
||||
assertEquals(metadataValue.getValue(), existingMetadataEntry.getValue(),
|
||||
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", existingMetadataEntry.getValue(), metadataValue.getValue()));
|
||||
checkMetadataValue(metadataValue);
|
||||
|
@ -171,8 +173,8 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "GET /catalogItem/{id}/metadata", dependsOnMethods = { "testGetCatalogItem" })
|
||||
public void testGetCatalogItemMetadata() {
|
||||
resetCatalogItemMetadata(catalogItemRef);
|
||||
catalogItemMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
|
||||
resetCatalogItemMetadata(catalogItemRef.getHref());
|
||||
catalogItemMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef.getHref());
|
||||
assertEquals(catalogItemMetadata.getMetadataEntries().size(), 1, String.format(MUST_EXIST_FMT, "MetadataEntry", "CatalogItem"));
|
||||
checkMetadata(catalogItemMetadata);
|
||||
}
|
||||
|
@ -184,22 +186,22 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
.entry(MetadataEntry.builder().entry("VEGIMITE", "VALUE").build())
|
||||
.build();
|
||||
|
||||
Task mergeCatalogItemMetadata = catalogClient.getMetadataClient().mergeMetadata(catalogItemRef, newMetadata);
|
||||
Task mergeCatalogItemMetadata = catalogClient.getMetadataClient().mergeMetadata(catalogItemRef.getHref(), newMetadata);
|
||||
checkTask(mergeCatalogItemMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
|
||||
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
|
||||
|
||||
Metadata mergedCatalogItemMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
|
||||
Metadata mergedCatalogItemMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef.getHref());
|
||||
// XXX
|
||||
assertEquals(mergedCatalogItemMetadata.getMetadataEntries().size(), catalogItemMetadata.getMetadataEntries().size() + 1,
|
||||
"Should have added another MetadataEntry to the CatalogItem");
|
||||
|
||||
MetadataValue keyMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
|
||||
MetadataValue keyMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef.getHref(), "KEY");
|
||||
// XXX
|
||||
assertEquals(keyMetadataValue.getValue(), "MARMALADE", "The Value of the MetadataValue for KEY should have changed");
|
||||
checkMetadataValue(keyMetadataValue);
|
||||
|
||||
MetadataValue newKeyMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "VEGIMITE");
|
||||
MetadataValue newKeyMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef.getHref(), "VEGIMITE");
|
||||
// XXX
|
||||
assertEquals(newKeyMetadataValue.getValue(), "VALUE", "The Value of the MetadataValue for NEW_KEY should have been set");
|
||||
checkMetadataValue(newKeyMetadataValue);
|
||||
|
@ -215,7 +217,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
return input.getKey().equals("KEY");
|
||||
}
|
||||
});
|
||||
MetadataValue metadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
|
||||
MetadataValue metadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef.getHref(), "KEY");
|
||||
assertEquals(existingMetadataEntry.getValue(), metadataValue.getValue());
|
||||
checkMetadataValue(metadataValue);
|
||||
}
|
||||
|
@ -224,13 +226,13 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
public void testSetCatalogItemMetadataValue() {
|
||||
MetadataValue newMetadataValue = MetadataValue.builder().value("NEW").build();
|
||||
|
||||
Task setCatalogItemMetadataValue = catalogClient.getMetadataClient().setMetadata(catalogItemRef, "KEY", newMetadataValue);
|
||||
Task setCatalogItemMetadataValue = catalogClient.getMetadataClient().setMetadata(catalogItemRef.getHref(), "KEY", newMetadataValue);
|
||||
checkTask(setCatalogItemMetadataValue);
|
||||
Checks.checkTask(setCatalogItemMetadataValue);
|
||||
assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue),
|
||||
String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
|
||||
|
||||
MetadataValue updatedMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
|
||||
MetadataValue updatedMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef.getHref(), "KEY");
|
||||
assertEquals(updatedMetadataValue.getValue(), newMetadataValue.getValue(),
|
||||
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(), updatedMetadataValue.getValue()));
|
||||
checkMetadataValue(updatedMetadataValue);
|
||||
|
@ -238,13 +240,13 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "DELETE /catalog/{id}/metadata/{key}", dependsOnMethods = { "testSetCatalogItemMetadataValue" })
|
||||
public void testDeleteCatalogItemMetadataValue() {
|
||||
Task deleteCatalogItemMetadataValue = catalogClient.getMetadataClient().deleteMetadataEntry(catalogItemRef, "KEY");
|
||||
Task deleteCatalogItemMetadataValue = catalogClient.getMetadataClient().deleteMetadataEntry(catalogItemRef.getHref(), "KEY");
|
||||
checkTask(deleteCatalogItemMetadataValue);
|
||||
Checks.checkTask(deleteCatalogItemMetadataValue);
|
||||
assertTrue(retryTaskSuccess.apply(deleteCatalogItemMetadataValue),
|
||||
String.format(TASK_COMPLETE_TIMELY, "deleteCatalogItemMetadataValue"));
|
||||
try {
|
||||
catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
|
||||
catalogClient.getMetadataClient().getMetadataValue(catalogItemRef.getHref(), "KEY");
|
||||
fail("The CatalogItem MetadataValue for KEY should have been deleted");
|
||||
} catch (VCloudDirectorException vcde) {
|
||||
Error error = vcde.getError();
|
||||
|
@ -255,19 +257,19 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
private void deleteAllCatalogItemMetadata(ReferenceType<?> catalogItemRef) {
|
||||
Metadata currentMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
|
||||
private void deleteAllCatalogItemMetadata(URI catalogItemURI) {
|
||||
Metadata currentMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemURI);
|
||||
for (MetadataEntry currentMetadataEntry : currentMetadata.getMetadataEntries()) {
|
||||
catalogClient.getMetadataClient().deleteMetadataEntry(catalogItemRef, currentMetadataEntry.getKey());
|
||||
catalogClient.getMetadataClient().deleteMetadataEntry(catalogItemURI, currentMetadataEntry.getKey());
|
||||
}
|
||||
Metadata emptyMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
|
||||
Metadata emptyMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemURI);
|
||||
assertTrue(emptyMetadata.getMetadataEntries().isEmpty(), "The catalogItem Metadata should be empty");
|
||||
}
|
||||
|
||||
private void resetCatalogItemMetadata(ReferenceType<?> catalogItemRef) {
|
||||
deleteAllCatalogItemMetadata(catalogItemRef);
|
||||
private void resetCatalogItemMetadata(URI catalogItemURI) {
|
||||
deleteAllCatalogItemMetadata(catalogItemURI);
|
||||
Metadata newMetadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "VALUE").build()).build();
|
||||
Task mergeCatalogItemMetadata = catalogClient.getMetadataClient().mergeMetadata(catalogItemRef, newMetadata);
|
||||
Task mergeCatalogItemMetadata = catalogClient.getMetadataClient().mergeMetadata(catalogItemURI, newMetadata);
|
||||
Checks.checkTask(mergeCatalogItemMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
|
||||
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
|
||||
|
|
|
@ -26,19 +26,8 @@ import java.net.URI;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneMediaParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Error;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.File;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.FilesList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Media;
|
||||
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.Owner;
|
||||
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.TasksInProgress;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -73,9 +62,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.build();
|
||||
Media expected = createMedia();
|
||||
|
||||
Reference vdcRef = Reference.builder().href(vdcUri).build();
|
||||
|
||||
assertEquals(client.getVdcClient().createMedia(vdcRef, source), expected);
|
||||
assertEquals(client.getVdcClient().createMedia(vdcUri, source), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -96,18 +83,16 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.name("moved test media")
|
||||
.description("moved by testCloneMedia()")
|
||||
.source(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.media+xml")
|
||||
.name("copied test media")
|
||||
.id("urn:vcloud:media:da8361af-cccd-4103-a71c-493513c49094")
|
||||
.href(URI.create("https://mycloud.greenhousedata.com/api/media/da8361af-cccd-4103-a71c-493513c49094"))
|
||||
.build())
|
||||
.type("application/vnd.vmware.vcloud.media+xml")
|
||||
.name("copied test media")
|
||||
.id("urn:vcloud:media:da8361af-cccd-4103-a71c-493513c49094")
|
||||
.href(URI.create("https://mycloud.greenhousedata.com/api/media/da8361af-cccd-4103-a71c-493513c49094"))
|
||||
.build())
|
||||
.isSourceDelete(false)
|
||||
.build();
|
||||
Media expected = cloneMedia();
|
||||
|
||||
Reference vdcRef = Reference.builder().href(vdcUri).build();
|
||||
|
||||
assertEquals(client.getVdcClient().cloneMedia(vdcRef, params), expected);
|
||||
assertEquals(client.getVdcClient().cloneMedia(vdcUri, params), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -124,10 +109,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.httpResponseBuilder().build());
|
||||
|
||||
Media expected = getMedia();
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
assertEquals(client.getMediaClient().getMedia(mediaRef), expected);
|
||||
assertEquals(client.getMediaClient().getMedia(mediaUri), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -148,11 +130,9 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.majorErrorCode(400)
|
||||
.minorErrorCode("BAD_REQUEST")
|
||||
.build();
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
|
||||
try {
|
||||
client.getMediaClient().getMedia(mediaRef);
|
||||
client.getMediaClient().getMedia(mediaUri);
|
||||
fail("Should give HTTP 400 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -179,11 +159,9 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.majorErrorCode(403)
|
||||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
|
||||
try {
|
||||
client.getMediaClient().getMedia(mediaRef);
|
||||
client.getMediaClient().getMedia(mediaUri);
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -210,11 +188,9 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.majorErrorCode(403)
|
||||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
|
||||
try {
|
||||
client.getMediaClient().getMedia(mediaRef);
|
||||
client.getMediaClient().getMedia(mediaUri);
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -239,9 +215,8 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
|
||||
Media update = updateMedia();
|
||||
Task expected = updateMediaTask();
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
assertEquals(client.getMediaClient().updateMedia(mediaRef, update), expected);
|
||||
|
||||
assertEquals(client.getMediaClient().updateMedia(mediaUri, update), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -258,9 +233,8 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.httpResponseBuilder().build());
|
||||
|
||||
Task expected = deleteMediaTask();
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
assertEquals(client.getMediaClient().deleteMedia(mediaRef), expected);
|
||||
assertEquals(client.getMediaClient().deleteMedia(mediaUri), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -276,11 +250,10 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.xmlFilePayload("/media/metadata.xml", VCloudDirectorMediaType.METADATA)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
Metadata expected = metadata();
|
||||
|
||||
assertEquals(client.getMediaClient().getMetadataClient().getMetadata(mediaRef), expected);
|
||||
assertEquals(client.getMediaClient().getMetadataClient().getMetadata(mediaUri), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -297,11 +270,10 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.xmlFilePayload("/media/mergeMetadataTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
Metadata inputMetadata = metadata();
|
||||
Task expectedTask = mergeMetadataTask();
|
||||
|
||||
assertEquals(client.getMediaClient().getMetadataClient().mergeMetadata(mediaRef, inputMetadata), expectedTask);
|
||||
assertEquals(client.getMediaClient().getMetadataClient().mergeMetadata(mediaUri, inputMetadata), expectedTask);
|
||||
}
|
||||
|
||||
public void testGetMetadataValue() {
|
||||
|
@ -318,9 +290,8 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
|
||||
MetadataValue expected = metadataValue();
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
assertEquals(client.getMediaClient().getMetadataClient().getMetadataValue(mediaRef, "key"), expected);
|
||||
assertEquals(client.getMediaClient().getMetadataClient().getMetadataValue(mediaUri, "key"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -337,12 +308,11 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.xmlFilePayload("/media/setMetadataValueTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
MetadataValue inputMetadataValue = MetadataValue.builder().value("value").build();
|
||||
|
||||
Task expectedTask = setMetadataEntryTask();
|
||||
|
||||
assertEquals(client.getMediaClient().getMetadataClient().setMetadata(mediaRef, "key", inputMetadataValue), expectedTask);
|
||||
assertEquals(client.getMediaClient().getMetadataClient().setMetadata(mediaUri, "key", inputMetadataValue), expectedTask);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -358,10 +328,9 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.xmlFilePayload("/media/deleteMetadataEntryTask.xml", VCloudDirectorMediaType.TASK)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
Task expectedTask = deleteMetadataEntryTask();
|
||||
|
||||
assertEquals(client.getMediaClient().getMetadataClient().deleteMetadataEntry(mediaRef, "key"), expectedTask);
|
||||
assertEquals(client.getMediaClient().getMetadataClient().deleteMetadataEntry(mediaUri, "key"), expectedTask);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -379,9 +348,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
|
||||
Owner expected = owner();
|
||||
|
||||
Reference mediaRef = Reference.builder().href(mediaUri).build();
|
||||
|
||||
assertEquals(client.getMediaClient().getOwner(mediaRef), expected);
|
||||
assertEquals(client.getMediaClient().getOwner(mediaUri), expected);
|
||||
}
|
||||
|
||||
private static Media createMedia() {
|
||||
|
@ -482,10 +449,10 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
|
|||
.id("urn:vcloud:media:794eb334-754e-4917-b5a0-5df85cbd61d1")
|
||||
.href(URI.create("https://mycloud.greenhousedata.com/api/media/794eb334-754e-4917-b5a0-5df85cbd61d1"))
|
||||
.link(Link.builder()
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.vdc+xml")
|
||||
.href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"))
|
||||
.build())
|
||||
.rel("up")
|
||||
.type("application/vnd.vmware.vcloud.vdc+xml")
|
||||
.href(URI.create("https://mycloud.greenhousedata.com/api/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f"))
|
||||
.build())
|
||||
.link(Link.builder()
|
||||
.rel("catalogItem")
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
|
|
|
@ -63,19 +63,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
* Convenience references to API clients.
|
||||
*/
|
||||
|
||||
private URISupplier vdcRef;
|
||||
private URI vdcUri;
|
||||
protected VdcClient vdcClient;
|
||||
protected MediaClient mediaClient;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
vdcRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.vdc+xml")
|
||||
.name("")
|
||||
.href(URI.create(endpoint+"/vdc/"+vdcId))
|
||||
.id(vdcId)
|
||||
.build();
|
||||
vdcUri = URI.create(endpoint+"/vdc/"+vdcId);
|
||||
|
||||
vdcClient = context.getApi().getVdcClient();
|
||||
mediaClient = context.getApi().getMediaClient();
|
||||
|
@ -92,8 +87,8 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "POST /vdc/{id}/media", enabled = false)
|
||||
public void testCreateMedia() throws URISyntaxException {
|
||||
assertNotNull(vdcRef, String.format(REF_REQ_LIVE, VDC));
|
||||
assertNotNull(vdcClient.getVdc(vdcRef), String.format(OBJ_REQ_LIVE, VDC));
|
||||
assertNotNull(vdcUri, String.format(REF_REQ_LIVE, VDC));
|
||||
assertNotNull(vdcClient.getVdc(vdcUri), String.format(OBJ_REQ_LIVE, VDC));
|
||||
|
||||
java.io.File sourceFile = new java.io.File(getClass().getResource("/media/test.iso").toURI());
|
||||
|
||||
|
@ -104,7 +99,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
.imageType(Media.ImageType.ISO)
|
||||
.description("Test media generated by testCreateMedia()")
|
||||
.build();
|
||||
media = vdcClient.createMedia(vdcRef, sourceMedia);
|
||||
media = vdcClient.createMedia(vdcUri, sourceMedia);
|
||||
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
|
||||
|
@ -124,12 +119,12 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
assertTrue(equal(uploadLink.getRel(), Link.Rel.UPLOAD_DEFAULT), String.format(OBJ_FIELD_REQ, MEDIA, "uploadFile.links.first"));
|
||||
|
||||
fail(); //TODO upload file and assert it succeeds
|
||||
context.getApi().getUploadClient().uploadFile(uploadLink, sourceFile);
|
||||
context.getApi().getUploadClient().uploadFile(uploadLink.getHref(), sourceFile);
|
||||
}
|
||||
|
||||
@Test(testName = "GET /media/{id}", dependsOnMethods = { "testCreateMedia" }, enabled = false)
|
||||
public void testGetMedia() {
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
assertNotNull(media, String.format(OBJ_REQ_LIVE, MEDIA));
|
||||
|
||||
owner = media.getOwner();
|
||||
|
@ -142,7 +137,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "GET /media/{id}/owner",
|
||||
dependsOnMethods = { "testGetMedia" }, enabled = false)
|
||||
public void testGetMediaOwner() {
|
||||
Owner directOwner = mediaClient.getOwner(media);
|
||||
Owner directOwner = mediaClient.getOwner(media.getHref());
|
||||
assertEquals(owner, directOwner, String.format(GETTER_RETURNS_SAME_OBJ,
|
||||
"getOwner()", "owner", "media.getOwner()", owner.toString(), directOwner.toString()));
|
||||
|
||||
|
@ -158,7 +153,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
dependsOnMethods = { "testGetMediaOwner" }, enabled = false)
|
||||
public void testCloneMedia() {
|
||||
oldMedia = media;
|
||||
media = vdcClient.cloneMedia(vdcRef, CloneMediaParams.builder()
|
||||
media = vdcClient.cloneMedia(vdcUri, CloneMediaParams.builder()
|
||||
.source(Reference.builder().fromEntity(media).build())
|
||||
.name("copied test media")
|
||||
.description("copied by testCloneMedia()")
|
||||
|
@ -171,7 +166,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
if (copyTask != null) {
|
||||
Checks.checkTask(copyTask);
|
||||
assertTrue(retryTaskSuccess.apply(copyTask), String.format(TASK_COMPLETE_TIMELY, "copyTask"));
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,9 +174,9 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
assertTrue(media.clone(oldMedia), String.format(OBJ_FIELD_CLONE, MEDIA, "copied media",
|
||||
media.toString(), oldMedia.toString()));
|
||||
|
||||
mediaClient.getMetadataClient().setMetadata(media, "key", MetadataValue.builder().value("value").build());
|
||||
mediaClient.getMetadataClient().setMetadata(media.getHref(), "key", MetadataValue.builder().value("value").build());
|
||||
|
||||
media = vdcClient.cloneMedia(vdcRef, CloneMediaParams.builder()
|
||||
media = vdcClient.cloneMedia(vdcUri, CloneMediaParams.builder()
|
||||
.source(Reference.builder().fromEntity(media).build())
|
||||
.name("moved test media")
|
||||
.description("moved by testCloneMedia()")
|
||||
|
@ -195,7 +190,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
if (copyTask != null) {
|
||||
Checks.checkTask(copyTask);
|
||||
assertTrue(retryTaskSuccess.apply(copyTask), String.format(TASK_COMPLETE_TIMELY, "copyTask"));
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,10 +208,10 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
String newDescription = "new "+oldDescription;
|
||||
media = media.toBuilder().name(newName).description(newDescription).build();
|
||||
|
||||
Task updateMedia = mediaClient.updateMedia(media, media);
|
||||
Task updateMedia = mediaClient.updateMedia(media.getHref(), media);
|
||||
Checks.checkTask(updateMedia);
|
||||
assertTrue(retryTaskSuccess.apply(updateMedia), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
|
||||
assertTrue(equal(media.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, MEDIA, "name"));
|
||||
assertTrue(equal(media.getDescription(), newDescription),
|
||||
|
@ -228,16 +223,16 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
media = media.toBuilder().name(oldName).description(oldDescription).build();
|
||||
|
||||
updateMedia = mediaClient.updateMedia(media, media);
|
||||
updateMedia = mediaClient.updateMedia(media.getHref(), media);
|
||||
Checks.checkTask(updateMedia);
|
||||
assertTrue(retryTaskSuccess.apply(updateMedia), String.format(TASK_COMPLETE_TIMELY, "updateMedia"));
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
}
|
||||
|
||||
@Test(testName = "GET /media/{id}/metadata",
|
||||
dependsOnMethods = { "testGetMedia" }, enabled = false)
|
||||
public void testGetMetadata() {
|
||||
metadata = mediaClient.getMetadataClient().getMetadata(media);
|
||||
metadata = mediaClient.getMetadataClient().getMetadata(media.getHref());
|
||||
// required for testing
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
|
||||
String.format(OBJ_FIELD_REQ_LIVE, MEDIA, "metadata.entries"));
|
||||
|
@ -254,14 +249,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
.entries(inputEntries)
|
||||
.build();
|
||||
|
||||
Task mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media, inputMetadata);
|
||||
Task mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media.getHref(), inputMetadata);
|
||||
Checks.checkTask(mergeMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)"));
|
||||
metadata = mediaClient.getMetadataClient().getMetadata(media);
|
||||
metadata = mediaClient.getMetadataClient().getMetadata(media.getHref());
|
||||
Checks.checkMetadataFor(MEDIA, metadata);
|
||||
checkMetadataContainsEntries(metadata, inputEntries);
|
||||
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
|
||||
// test modify
|
||||
|
@ -270,14 +265,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
.entries(inputEntries)
|
||||
.build();
|
||||
|
||||
mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media, inputMetadata);
|
||||
mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media.getHref(), inputMetadata);
|
||||
Checks.checkTask(mergeMetadata);
|
||||
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(modify)"));
|
||||
metadata = mediaClient.getMetadataClient().getMetadata(media);
|
||||
metadata = mediaClient.getMetadataClient().getMetadata(media.getHref());
|
||||
Checks.checkMetadataFor(MEDIA, metadata);
|
||||
checkMetadataContainsEntries(metadata, inputEntries);
|
||||
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
}
|
||||
|
||||
|
@ -301,7 +296,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "GET /media/{id}/metadata/{key}",
|
||||
dependsOnMethods = { "testMergeMetadata" }, enabled = false)
|
||||
public void testGetMetadataValue() {
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "key");
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "key");
|
||||
Checks.checkMetadataValueFor(MEDIA, metadataValue);
|
||||
}
|
||||
|
||||
|
@ -311,18 +306,18 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
metadataEntryValue = "newValue";
|
||||
MetadataValue newValue = MetadataValue.builder().value(metadataEntryValue).build();
|
||||
|
||||
Task setMetadataEntry = mediaClient.getMetadataClient().setMetadata(media, "key", newValue);
|
||||
Task setMetadataEntry = mediaClient.getMetadataClient().setMetadata(media.getHref(), "key", newValue);
|
||||
Checks.checkTask(setMetadataEntry);
|
||||
assertTrue(retryTaskSuccess.apply(setMetadataEntry),
|
||||
String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry"));
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "key");
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "key");
|
||||
Checks.checkMetadataValueFor(MEDIA, metadataValue);
|
||||
}
|
||||
|
||||
@Test(testName = "DELETE /media/{id}/metadata/{key}",
|
||||
dependsOnMethods = { "testSetMetadataValue" }, enabled = false )
|
||||
public void testDeleteMetadata() {
|
||||
Task deleteMetadataEntry = mediaClient.getMetadataClient().deleteMetadataEntry(media, "testKey");
|
||||
Task deleteMetadataEntry = mediaClient.getMetadataClient().deleteMetadataEntry(media.getHref(), "testKey");
|
||||
Checks.checkTask(deleteMetadataEntry);
|
||||
assertTrue(retryTaskSuccess.apply(deleteMetadataEntry),
|
||||
String.format(TASK_COMPLETE_TIMELY, "deleteMetadataEntry"));
|
||||
|
@ -334,7 +329,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
.build();
|
||||
|
||||
try {
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "testKey");
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "testKey");
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -349,17 +344,17 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
"metadataEntry", metadataValue.toString()));
|
||||
}
|
||||
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "key");
|
||||
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media.getHref(), "key");
|
||||
Checks.checkMetadataValueFor(MEDIA, metadataValue);
|
||||
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
Checks.checkMediaFor(MEDIA, media);
|
||||
}
|
||||
|
||||
@Test(testName = "DELETE /media/{id}",
|
||||
dependsOnMethods = { "testDeleteMetadata" }, enabled = false )
|
||||
public void testDeleteMedia() {
|
||||
Task deleteMedia = mediaClient.deleteMedia(media);
|
||||
Task deleteMedia = mediaClient.deleteMedia(media.getHref());
|
||||
Checks.checkTask(deleteMedia);
|
||||
assertTrue(retryTaskSuccess.apply(deleteMedia),
|
||||
String.format(TASK_COMPLETE_TIMELY, "deleteMedia"));
|
||||
|
@ -373,7 +368,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
.build();
|
||||
|
||||
try {
|
||||
media = mediaClient.getMedia(media);
|
||||
media = mediaClient.getMedia(media.getHref());
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -386,7 +381,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
assertNull(metadataValue, String.format(OBJ_DEL, MEDIA, media.toString()));
|
||||
}
|
||||
|
||||
deleteMedia = mediaClient.deleteMedia(oldMedia);
|
||||
deleteMedia = mediaClient.deleteMedia(oldMedia.getHref());
|
||||
Checks.checkTask(deleteMedia);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,17 +27,7 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Error;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpAddresses;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpRange;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpRanges;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.IpScope;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
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.NetworkConfiguration;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.SyslogServerSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -60,10 +50,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
getStandardPayloadResponse("/network/network.xml", VCloudDirectorMediaType.ORG_NETWORK));
|
||||
|
||||
OrgNetwork expected = orgNetwork();
|
||||
|
||||
Reference networkRef = Reference.builder().href(networkUri).build();
|
||||
|
||||
assertEquals(client.getNetworkClient().getNetwork(networkRef), expected);
|
||||
assertEquals(client.getNetworkClient().getNetwork(networkUri), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -80,9 +67,8 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.minorErrorCode("BAD_REQUEST")
|
||||
.build();
|
||||
|
||||
Reference networkRef = Reference.builder().href(networkUri).build();
|
||||
try {
|
||||
client.getNetworkClient().getNetwork(networkRef);
|
||||
client.getNetworkClient().getNetwork(networkUri);
|
||||
fail("Should give HTTP 400 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -105,10 +91,8 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference networkRef = Reference.builder().href(networkUri).build();
|
||||
|
||||
try {
|
||||
client.getNetworkClient().getNetwork(networkRef);
|
||||
client.getNetworkClient().getNetwork(networkUri);
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -131,10 +115,8 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference networkRef = Reference.builder().href(networkUri).build();
|
||||
|
||||
try {
|
||||
client.getNetworkClient().getNetwork(networkRef);
|
||||
client.getNetworkClient().getNetwork(networkUri);
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -166,10 +148,8 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.build())
|
||||
.entries(ImmutableSet.of(MetadataEntry.builder().entry("key", "value").build()))
|
||||
.build();
|
||||
|
||||
Reference networkRef = Reference.builder().href(networkUri).build();
|
||||
|
||||
assertEquals(client.getNetworkClient().getMetadataClient().getMetadata(networkRef), expected);
|
||||
assertEquals(client.getNetworkClient().getMetadataClient().getMetadata(networkUri), expected);
|
||||
}
|
||||
|
||||
@Test(enabled=false) // No metadata in exemplar xml...
|
||||
|
@ -184,9 +164,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.entry("key", "value")
|
||||
.build();
|
||||
|
||||
Reference networkRef = Reference.builder().href(networkUri).build();
|
||||
|
||||
assertEquals(client.getNetworkClient().getMetadataClient().getMetadataValue(networkRef, "KEY"), expected);
|
||||
assertEquals(client.getNetworkClient().getMetadataClient().getMetadataValue(networkUri, "KEY"), expected);
|
||||
}
|
||||
|
||||
public static OrgNetwork orgNetwork() {
|
||||
|
|
|
@ -18,11 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_ATTRB_REQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_EQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkResourceType;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
|
@ -37,7 +33,6 @@ 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.OrgNetwork;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
|
@ -60,26 +55,21 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
*/
|
||||
protected NetworkClient networkClient;
|
||||
|
||||
private Reference networkRef;
|
||||
private URI networkURI;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
networkRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.orgNetwork+xml")
|
||||
.name("")
|
||||
.href(URI.create(endpoint+"/network/"+networkId))
|
||||
.id(networkId)
|
||||
.build();
|
||||
networkURI = URI.create(endpoint+"/network/"+networkId);
|
||||
networkClient = context.getApi().getNetworkClient();
|
||||
}
|
||||
|
||||
@Test(testName = "GET /network/{id}")
|
||||
public void testGetNetwork() {
|
||||
// required for testing
|
||||
assertNotNull(networkRef, String.format(REF_REQ_LIVE, NETWORK));
|
||||
assertNotNull(networkURI, String.format(REF_REQ_LIVE, NETWORK));
|
||||
|
||||
OrgNetwork network = networkClient.getNetwork(networkRef);
|
||||
OrgNetwork network = networkClient.getNetwork(networkURI);
|
||||
assertNotNull(network, String.format(OBJ_REQ_LIVE, NETWORK));
|
||||
assertTrue(!network.getDescription().equals("DO NOT USE"), "Network isn't to be used for testing");
|
||||
|
||||
|
@ -100,7 +90,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "GET /network/{id}/metadata")
|
||||
public void testGetMetadata() {
|
||||
Metadata metadata = networkClient.getMetadataClient().getMetadata(networkRef);
|
||||
Metadata metadata = networkClient.getMetadataClient().getMetadata(networkURI);
|
||||
// required for testing
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
|
||||
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
|
||||
|
@ -122,7 +112,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "GET /network/{id}/metadata/{key}")
|
||||
public void testGetMetadataValue() {
|
||||
MetadataValue metadataValue = networkClient.getMetadataClient().getMetadataValue(networkRef, "key");
|
||||
MetadataValue metadataValue = networkClient.getMetadataClient().getMetadataValue(networkURI, "key");
|
||||
|
||||
// Check parent type
|
||||
checkResourceType(metadataValue);
|
||||
|
|
|
@ -79,7 +79,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
Org expected = org();
|
||||
|
||||
assertEquals(client.getOrgClient().getOrg(org), expected);
|
||||
assertEquals(client.getOrgClient().getOrg(org.getHref()), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -92,9 +92,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
Org expected = org();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
assertEquals(client.getOrgClient().getOrg(orgRef), expected);
|
||||
assertEquals(client.getOrgClient().getOrg(orgUri), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -111,9 +109,8 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.minorErrorCode("BAD_REQUEST")
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
try {
|
||||
client.getOrgClient().getOrg(orgRef);
|
||||
client.getOrgClient().getOrg(orgUri);
|
||||
fail("Should give HTTP 400 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -136,10 +133,8 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
try {
|
||||
client.getOrgClient().getOrg(orgRef);
|
||||
client.getOrgClient().getOrg(orgUri);
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -162,10 +157,8 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
try {
|
||||
client.getOrgClient().getOrg(orgRef);
|
||||
client.getOrgClient().getOrg(orgUri);
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -197,10 +190,8 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.build())
|
||||
.entries(ImmutableSet.of(metadataEntry()))
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
assertEquals(client.getOrgClient().getMetadataClient().getMetadata(orgRef), expected);
|
||||
assertEquals(client.getOrgClient().getMetadataClient().getMetadata(orgUri), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -218,9 +209,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
MetadataValue expected = metadataValue();
|
||||
|
||||
Reference orgRef = Reference.builder().href(orgUri).build();
|
||||
|
||||
assertEquals(client.getOrgClient().getMetadataClient().getMetadataValue(orgRef, "KEY"), expected);
|
||||
assertEquals(client.getOrgClient().getMetadataClient().getMetadataValue(orgUri, "KEY"), expected);
|
||||
}
|
||||
|
||||
public static Org org() {
|
||||
|
|
|
@ -27,6 +27,9 @@ import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkOrg;
|
|||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkReferenceType;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
|
@ -65,7 +68,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private URI orgURI;
|
||||
private Org org;
|
||||
|
||||
@Test(testName = "GET /org/")
|
||||
|
@ -86,10 +89,13 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "GET /org/{id}", dependsOnMethods = { "testGetOrgList" })
|
||||
public void testGetOrg() {
|
||||
orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
|
||||
Reference orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
assertNotNull(orgRef);
|
||||
|
||||
orgURI = orgRef.getURI();
|
||||
|
||||
// Call the method being tested
|
||||
org = orgClient.getOrg(orgRef);
|
||||
org = orgClient.getOrg(orgURI);
|
||||
|
||||
checkOrg(org);
|
||||
}
|
||||
|
@ -97,7 +103,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "GET /org/{id}/metadata/", dependsOnMethods = { "testGetOrg" })
|
||||
public void testGetOrgMetadata() {
|
||||
// Call the method being tested
|
||||
Metadata metadata = orgClient.getMetadataClient().getMetadata(orgRef);
|
||||
Metadata metadata = orgClient.getMetadataClient().getMetadata(orgURI);
|
||||
|
||||
// NOTE The environment MUST have at one metadata entry for the first organisation configured
|
||||
|
||||
|
@ -110,7 +116,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "GET /org/{id}/metadata/{key}", dependsOnMethods = { "testGetOrgMetadata" })
|
||||
public void testGetOrgMetadataValue() {
|
||||
// Call the method being tested
|
||||
MetadataValue value = orgClient.getMetadataClient().getMetadataValue(orgRef, "KEY");
|
||||
MetadataValue value = orgClient.getMetadataClient().getMetadataValue(orgURI, "KEY");
|
||||
|
||||
// NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE" )'
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.jclouds.vcloud.director.v1_5.domain.Error;
|
|||
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.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
@ -86,9 +85,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.task(taskTwo())
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")).build();
|
||||
|
||||
assertEquals(client.getTaskClient().getTaskList(orgRef), expected);
|
||||
assertEquals(client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/6f312e42-cd2b-488d-a2bb-97519cd57ed0")), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -126,10 +123,8 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.minorErrorCode("BAD_REQUEST")
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/org/NOTAUUID")).build();
|
||||
|
||||
try {
|
||||
client.getTaskClient().getTaskList(orgRef);
|
||||
client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/NOTAUUID"));
|
||||
fail("Should give HTTP 400 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -173,10 +168,8 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference orgRef = Reference.builder().href(URI.create("https://vcloudbeta.bluelock.com/api/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")).build();
|
||||
|
||||
try {
|
||||
client.getTaskClient().getTaskList(orgRef);
|
||||
client.getTaskClient().getTaskList(URI.create("https://vcloudbeta.bluelock.com/api/org/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"));
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
|
@ -203,7 +196,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
|
||||
|
||||
URISupplier taskUri = URISupplier.SingleURI.fromURI(URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"));
|
||||
URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
|
||||
|
||||
Task expected = taskOne();
|
||||
|
||||
|
@ -227,7 +220,7 @@ public class TaskClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse, taskRequest, taskResponse);
|
||||
|
||||
URISupplier taskUri = URISupplier.SingleURI.fromURI(URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b"));
|
||||
URI taskUri = URI.create(endpoint + "/task/5fcd2af3-d0ec-45ce-9451-8c585a2c766b");
|
||||
|
||||
client.getTaskClient().cancelTask(taskUri);
|
||||
}
|
||||
|
|
|
@ -21,12 +21,14 @@ package org.jclouds.vcloud.director.v1_5.features;
|
|||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.NOT_EMPTY_OBJECT_FMT;
|
||||
import static org.jclouds.vcloud.director.v1_5.domain.Checks.checkTask;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
|
||||
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.domain.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -60,18 +62,20 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
*/
|
||||
|
||||
private OrgList orgList;
|
||||
private Reference orgRef;
|
||||
private URI orgURI;
|
||||
private TasksList taskList;
|
||||
private Task task;
|
||||
private URISupplier taskRef;
|
||||
private URI taskURI;
|
||||
|
||||
@Test(testName = "GET /tasksList/{id}")
|
||||
public void testGetTaskList() {
|
||||
orgList = orgClient.getOrgList();
|
||||
orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
Reference orgRef = Iterables.getFirst(orgList.getOrgs(), null);
|
||||
assertNotNull(orgRef);
|
||||
orgURI = orgRef.getHref();
|
||||
|
||||
// Call the method being tested
|
||||
taskList = taskClient.getTaskList(orgRef);
|
||||
taskList = taskClient.getTaskList(orgURI);
|
||||
|
||||
// NOTE The environment MUST have ...
|
||||
|
||||
|
@ -85,10 +89,11 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "GET /task/{id}", dependsOnMethods = { "testGetTaskList" })
|
||||
public void testGetTask() {
|
||||
taskRef = Iterables.getFirst(taskList.getTasks(), null);
|
||||
Task taskRef = Iterables.getFirst(taskList.getTasks(), null);
|
||||
taskURI = taskRef.getURI();
|
||||
|
||||
// Call the method being tested
|
||||
task = taskClient.getTask(taskRef);
|
||||
task = taskClient.getTask(taskURI);
|
||||
|
||||
// Check required elements and attributes
|
||||
checkTask(task);
|
||||
|
@ -97,6 +102,6 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "GET /task/{id}/metadata/", dependsOnMethods = { "testGetTask" })
|
||||
public void testCancelTask() {
|
||||
// Call the method being tested
|
||||
taskClient.cancelTask(taskRef);
|
||||
taskClient.cancelTask(taskURI);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
|
||||
public void testVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId).acceptMedia(VAPP_TEMPLATE).httpRequestBuilder().build(),
|
||||
|
@ -55,20 +55,20 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
VAppTemplate template = client.getVAppTemplate(vappTemplateRef);
|
||||
VAppTemplate template = client.getVAppTemplate(uri);
|
||||
|
||||
assertEquals(template, exampleTemplate());
|
||||
|
||||
Task task = client.editVAppTemplate(vappTemplateRef, template);
|
||||
Task task = client.editVAppTemplate(uri, template);
|
||||
assertNotNull(task);
|
||||
|
||||
task = client.deleteVappTemplate(vappTemplateRef);
|
||||
task = client.deleteVappTemplate(uri);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testConsolidateVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/consolidate").acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
|
@ -76,13 +76,13 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
Task task = client.consolidateVappTemplate(vappTemplateRef);
|
||||
Task task = client.consolidateVappTemplate(uri);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testDisableDownloadVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/disableDownload").acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
|
@ -90,13 +90,13 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
Task task = client.disableDownloadVappTemplate(vappTemplateRef);
|
||||
Task task = client.disableDownloadVappTemplate(uri);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testEnableDownloadVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/enableDownload").acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
|
@ -104,13 +104,13 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
Task task = client.enableDownloadVappTemplate(vappTemplateRef);
|
||||
Task task = client.enableDownloadVappTemplate(uri);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testRelocateVAppTemplate() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("POST", templateId + "/action/enableDownload").xmlFilePayload("/vappTemplate/relocateParams.xml", RELOCATE_TEMPLATE).acceptMedia(TASK).httpRequestBuilder().build(),
|
||||
|
@ -122,13 +122,13 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
Reference datastore = Reference.builder().href(URI.create("https://vcloud.example.com/api/admin/extension/datastore/607")).build();
|
||||
RelocateParams params = RelocateParams.builder().datastore(datastore).build();
|
||||
|
||||
Task task = client.relocateVappTemplate(vappTemplateRef, params);
|
||||
Task task = client.relocateVappTemplate(uri, params);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testCustomizationSection() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/customizationSection").acceptMedia(CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
|
||||
|
@ -138,17 +138,17 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
CustomizationSection section = client.getVAppTemplateCustomizationSection(vappTemplateRef);
|
||||
CustomizationSection section = client.getVAppTemplateCustomizationSection(uri);
|
||||
|
||||
assertEquals(section, exampleCustomizationSection());
|
||||
|
||||
Task task = client.editVAppTemplateCustomizationSection(vappTemplateRef, section);
|
||||
Task task = client.editVAppTemplateCustomizationSection(uri, section);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testGuestCustomizationSection() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/guestCustomizationSection").acceptMedia(GUEST_CUSTOMIZATION_SECTION).httpRequestBuilder().build(),
|
||||
|
@ -158,17 +158,17 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
GuestCustomizationSection section = client.getVAppTemplateGuestCustomizationSection(vappTemplateRef);
|
||||
GuestCustomizationSection section = client.getVAppTemplateGuestCustomizationSection(uri);
|
||||
|
||||
assertEquals(section, exampleGuestCustomizationSection());
|
||||
|
||||
Task task = client.editVAppTemplateGuestCustomizationSection(vappTemplateRef, section);
|
||||
Task task = client.editVAppTemplateGuestCustomizationSection(uri, section);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testLeaseSettingsSection() throws ParseException {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/leaseSettingsSection").acceptMedia(LEASE_SETTINGS_SECTION).httpRequestBuilder().build(),
|
||||
|
@ -178,17 +178,17 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
LeaseSettingsSection section = client.getVappTemplateLeaseSettingsSection(vappTemplateRef);
|
||||
LeaseSettingsSection section = client.getVappTemplateLeaseSettingsSection(uri);
|
||||
|
||||
assertEquals(section, exampleLeaseSettingsSection());
|
||||
|
||||
Task task = client.editVappTemplateLeaseSettingsSection(vappTemplateRef, section);
|
||||
Task task = client.editVappTemplateLeaseSettingsSection(uri, section);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testVappTemplateMetadata() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata").acceptMedia(METADATA).httpRequestBuilder().build(),
|
||||
|
@ -198,17 +198,17 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
Metadata metadata = client.getVAppTemplateMetadata(vappTemplateRef);
|
||||
Metadata metadata = client.getVAppTemplateMetadata(uri);
|
||||
|
||||
assertEquals(metadata, exampleMetadata());
|
||||
|
||||
Task task = client.editVAppTemplateMetadata(vappTemplateRef, metadata);
|
||||
Task task = client.editVAppTemplateMetadata(uri, metadata);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testVappTemplateMetadataValue() {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/metadata/12345").acceptMedia(METADATA_ENTRY).httpRequestBuilder().build(),
|
||||
|
@ -220,20 +220,20 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
).getVAppTemplateClient();
|
||||
|
||||
assertNotNull(client);
|
||||
MetadataValue metadata = client.getVAppTemplateMetadataValue(vappTemplateRef, "12345");
|
||||
MetadataValue metadata = client.getVAppTemplateMetadataValue(uri, "12345");
|
||||
|
||||
assertEquals(metadata, exampleMetadataValue());
|
||||
|
||||
Task task = client.editVAppTemplateMetadataValue(vappTemplateRef, "12345", metadata);
|
||||
Task task = client.editVAppTemplateMetadataValue(uri, "12345", metadata);
|
||||
assertNotNull(task);
|
||||
|
||||
task = client.deleteVAppTemplateMetadataValue(vappTemplateRef, "12345");
|
||||
task = client.deleteVAppTemplateMetadataValue(uri, "12345");
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
public void testNetworkConfigSection() throws ParseException {
|
||||
final String templateId = "/vAppTemplate/vAppTemplate/vappTemplate-ef4415e6-d413-4cbb-9262-f9bbec5f2ea9";
|
||||
Reference vappTemplateRef = Reference.builder().href(URI.create(endpoint + templateId)).build();
|
||||
URI uri = URI.create(endpoint + templateId);
|
||||
|
||||
VAppTemplateClient client = orderedRequestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer().apiCommand("GET", templateId + "/networkConfigSection").acceptMedia(NETWORK_CONFIG_SECTION).httpRequestBuilder().build(),
|
||||
|
@ -244,11 +244,11 @@ public class VAppTemplateClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
|
||||
assertNotNull(client);
|
||||
|
||||
NetworkConfigSection section = client.getVAppTemplateNetworkConfigSection(vappTemplateRef);
|
||||
NetworkConfigSection section = client.getVAppTemplateNetworkConfigSection(uri);
|
||||
|
||||
assertEquals(section, exampleNetworkConfigSection());
|
||||
|
||||
Task task = client.editVAppTemplateNetworkConfigSection(vappTemplateRef, section);
|
||||
Task task = client.editVAppTemplateNetworkConfigSection(uri, section);
|
||||
assertNotNull(task);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,27 +26,8 @@ import java.net.URI;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AvailableNetworks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Capabilities;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CapacityWithUsage;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ComputeCapacity;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Error;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Media;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.ResourceEntities;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.SupportedHardwareVersions;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.UploadVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -59,17 +40,12 @@ import org.testng.annotations.Test;
|
|||
@Test(groups = { "unit", "user", "vdc" }, singleThreaded = true, testName = "VdcClientExpectTest")
|
||||
public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
|
||||
|
||||
private Reference vdcRef;
|
||||
private URI vdcURI;
|
||||
|
||||
@BeforeClass
|
||||
public void before() {
|
||||
String vdcId = "e9cd3387-ac57-4d27-a481-9bee75e0690f";
|
||||
vdcRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.vdc+xml")
|
||||
.name("")
|
||||
.href(URI.create(endpoint+"/vdc/"+vdcId))
|
||||
.id(vdcId)
|
||||
.build();
|
||||
vdcURI = URI.create(endpoint+"/vdc/"+vdcId);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -85,12 +61,11 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
Vdc expected = getVdc();
|
||||
|
||||
assertEquals(client.getVdcClient().getVdc(vdcRef), expected);
|
||||
assertEquals(client.getVdcClient().getVdc(vdcURI), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testResponse400ForInvalidVdcId() {
|
||||
URI vdcUri = URI.create(endpoint + "/vdc/NOTAUUID");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
|
@ -106,22 +81,17 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.majorErrorCode(400)
|
||||
.minorErrorCode("BAD_REQUEST")
|
||||
.build();
|
||||
|
||||
Reference vdcRef = Reference.builder().href(vdcUri).build();
|
||||
|
||||
try {
|
||||
client.getVdcClient().getVdc(vdcRef);
|
||||
client.getVdcClient().getVdc(URI.create(endpoint + "/vdc/NOTAUUID"));
|
||||
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 testResponse403ForFakeVdcId() {
|
||||
URI vdcUri = URI.create(endpoint + "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
|
@ -138,15 +108,11 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.minorErrorCode("ACCESS_TO_RESOURCE_IS_FORBIDDEN")
|
||||
.build();
|
||||
|
||||
Reference vdcRef = Reference.builder().href(vdcUri).build();
|
||||
|
||||
try {
|
||||
client.getVdcClient().getVdc(vdcRef);
|
||||
client.getVdcClient().getVdc(URI.create(endpoint + "/vdc/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"));
|
||||
fail("Should give HTTP 403 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
} catch (Exception e) {
|
||||
fail("Should have thrown a VCloudDirectorException");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +135,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
.build();
|
||||
|
||||
assertEquals(client.getVdcClient().captureVApp(vdcRef, params), expected);
|
||||
assertEquals(client.getVdcClient().captureVApp(vdcURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -191,12 +157,10 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.build();
|
||||
|
||||
try {
|
||||
client.getVdcClient().captureVApp(vdcRef, null);
|
||||
client.getVdcClient().captureVApp(vdcURI, null);
|
||||
fail("Should give HTTP 400 error");
|
||||
} catch (VCloudDirectorException vde) {
|
||||
assertEquals(vde.getError(), expected);
|
||||
} catch (Exception e) {
|
||||
fail("Should have thrown a VCloudDirectorException");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,7 +183,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
.build();
|
||||
|
||||
assertEquals(client.getVdcClient().cloneVApp(vdcRef, params), expected);
|
||||
assertEquals(client.getVdcClient().cloneVApp(vdcURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -241,7 +205,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
.build();
|
||||
|
||||
assertEquals(client.getVdcClient().cloneVAppTemplate(vdcRef, params), expected);
|
||||
assertEquals(client.getVdcClient().cloneVAppTemplate(vdcURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -263,7 +227,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
.build();
|
||||
|
||||
assertEquals(client.getVdcClient().composeVApp(vdcRef, params), expected);
|
||||
assertEquals(client.getVdcClient().composeVApp(vdcURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -285,7 +249,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
.build();
|
||||
|
||||
assertEquals(client.getVdcClient().instantiateVApp(vdcRef, params), expected);
|
||||
assertEquals(client.getVdcClient().instantiateVApp(vdcURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -307,7 +271,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
.build();
|
||||
|
||||
assertEquals(client.getVdcClient().uploadVAppTemplate(vdcRef, params), expected);
|
||||
assertEquals(client.getVdcClient().uploadVAppTemplate(vdcURI, params), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -329,27 +293,25 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
|
||||
.build();
|
||||
|
||||
assertEquals(client.getVdcClient().createMedia(vdcRef, createMedia), expected);
|
||||
assertEquals(client.getVdcClient().createMedia(vdcURI, createMedia), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
public void testGetMetadata() {
|
||||
URI vdcUri = URI.create(endpoint + "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f");
|
||||
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
VCloudDirectorClient client = requestsSendResponses(loginRequest, sessionResponse,
|
||||
new VcloudHttpRequestPrimer()
|
||||
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
.apiCommand("GET", "/vdc/e9cd3387-ac57-4d27-a481-9bee75e0690f/metadata")
|
||||
.acceptAnyMedia()
|
||||
.httpRequestBuilder().build(),
|
||||
new VcloudHttpResponsePrimer()
|
||||
.xmlFilePayload("/vdc/metadata.xml", VCloudDirectorMediaType.METADATA)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Reference mediaRef = Reference.builder().href(vdcUri).build();
|
||||
|
||||
.xmlFilePayload("/vdc/metadata.xml", VCloudDirectorMediaType.METADATA)
|
||||
.httpResponseBuilder().build());
|
||||
|
||||
Metadata expected = metadata();
|
||||
|
||||
assertEquals(client.getVdcClient().getMetadataClient().getMetadata(mediaRef), expected);
|
||||
assertEquals(client.getVdcClient().getMetadataClient().getMetadata(vdcUri), expected);
|
||||
}
|
||||
|
||||
@Test(enabled = false)
|
||||
|
@ -366,10 +328,8 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
|
|||
.httpResponseBuilder().build());
|
||||
|
||||
MetadataValue expected = metadataValue();
|
||||
|
||||
Reference mediaRef = Reference.builder().href(vdcUri).build();
|
||||
|
||||
assertEquals(client.getVdcClient().getMetadataClient().getMetadataValue(mediaRef, "key"), expected);
|
||||
|
||||
assertEquals(client.getVdcClient().getMetadataClient().getMetadataValue(vdcUri, "key"), expected);
|
||||
}
|
||||
|
||||
public static Vdc getVdc() {
|
||||
|
|
|
@ -18,30 +18,14 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.features;
|
||||
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_GTE_0;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_FIELD_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.OBJ_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.REF_REQ_LIVE;
|
||||
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.Assert.assertNotNull;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CaptureVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CloneVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ComposeVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.InstantiateVAppParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
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.UploadVAppTemplateParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VApp;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.VAppTemplate;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.*;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -63,26 +47,21 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
*/
|
||||
protected VdcClient vdcClient;
|
||||
|
||||
private Reference vdcRef;
|
||||
private URI vdcURI;
|
||||
|
||||
@BeforeClass(inheritGroups = true)
|
||||
@Override
|
||||
public void setupRequiredClients() {
|
||||
vdcRef = Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.vdc+xml")
|
||||
.name("")
|
||||
.href(URI.create(endpoint+"/vdc/"+vdcId))
|
||||
.id(vdcId)
|
||||
.build();
|
||||
vdcURI = URI.create(endpoint+"/vdc/"+vdcId);
|
||||
vdcClient = context.getApi().getVdcClient();
|
||||
}
|
||||
|
||||
@Test(testName = "GET /vdc/{id}")
|
||||
public void testGetVdc() {
|
||||
// required for testing
|
||||
assertNotNull(vdcRef, String.format(REF_REQ_LIVE, VDC));
|
||||
assertNotNull(vdcURI, String.format(REF_REQ_LIVE, VDC));
|
||||
|
||||
Vdc vdc = vdcClient.getVdc(vdcRef);
|
||||
Vdc vdc = vdcClient.getVdc(vdcURI);
|
||||
assertNotNull(vdc, String.format(OBJ_REQ_LIVE, VDC));
|
||||
assertTrue(!vdc.getDescription().equals("DO NOT USE"), "vDC isn't to be used for testing");
|
||||
|
||||
|
@ -127,12 +106,12 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "POST /vdc/{id}/action/captureVApp", enabled = false)
|
||||
public void testCaptureVApp() {
|
||||
Reference templateSource = null; // TODO: vApp reference
|
||||
VAppTemplate template = vdcClient.captureVApp(vdcRef, CaptureVAppParams.builder()
|
||||
VAppTemplate template = vdcClient.captureVApp(vdcURI, CaptureVAppParams.builder()
|
||||
.source(templateSource)
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.sections(sections) // TODO: ovf sections
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.sections(sections) // TODO: ovf sections
|
||||
.build());
|
||||
|
||||
Checks.checkVAppTemplate(template);
|
||||
|
@ -144,21 +123,21 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "POST /vdc/{id}/action/cloneVApp", enabled = false)
|
||||
public void testCloneVApp() {
|
||||
Reference vAppSource = null; // TODO: vApp reference
|
||||
VApp vApp = vdcClient.cloneVApp(vdcRef, CloneVAppParams.builder()
|
||||
VApp vApp = vdcClient.cloneVApp(vdcURI, CloneVAppParams.builder()
|
||||
.source(vAppSource)
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.deploy(true)
|
||||
//.isSourceDelete(true)
|
||||
//.powerOn(true)
|
||||
//.instantiationParams(InstantiationParams.builder()
|
||||
// .sections(sections) // TODO: ovf sections? various tests?
|
||||
// .build())
|
||||
|
||||
// Reserved. Unimplemented params; may test eventually when implemented
|
||||
//.vAppParent(vAppParentRef)
|
||||
//.linkedClone(true)
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.deploy(true)
|
||||
//.isSourceDelete(true)
|
||||
//.powerOn(true)
|
||||
//.instantiationParams(InstantiationParams.builder()
|
||||
// .sections(sections) // TODO: ovf sections? various tests?
|
||||
// .build())
|
||||
|
||||
// Reserved. Unimplemented params; may test eventually when implemented
|
||||
//.vAppParent(vAppParentRef)
|
||||
//.linkedClone(true)
|
||||
.build());
|
||||
|
||||
Checks.checkVApp(vApp);
|
||||
|
@ -170,13 +149,13 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "POST /vdc/{id}/action/cloneVAppTemplate", enabled = false)
|
||||
public void testCloneVAppTemplate() {
|
||||
Reference templateSource = null; // TODO: vAppTemplate reference
|
||||
VAppTemplate template = vdcClient.cloneVAppTemplate(vdcRef, CloneVAppTemplateParams.builder()
|
||||
VAppTemplate template = vdcClient.cloneVAppTemplate(vdcURI, CloneVAppTemplateParams.builder()
|
||||
.source(templateSource)
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.isSourceDelete(true)
|
||||
//.sections(sections) // TODO: ovf sections
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.isSourceDelete(true)
|
||||
//.sections(sections) // TODO: ovf sections
|
||||
.build());
|
||||
|
||||
Checks.checkVAppTemplate(template);
|
||||
|
@ -187,7 +166,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "POST /vdc/{id}/action/composeVApp", enabled = false)
|
||||
public void testComposeVApp() {
|
||||
VApp vApp = vdcClient.composeVApp(vdcRef, ComposeVAppParams.builder()
|
||||
VApp vApp = vdcClient.composeVApp(vdcURI, ComposeVAppParams.builder()
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
|
@ -197,7 +176,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
//.instantiationParams(InstantiationParams.builder()
|
||||
// .sections(sections) // TODO: ovf sections? various tests?
|
||||
// .build())
|
||||
|
||||
|
||||
// Reserved. Unimplemented params; may test eventually when implemented
|
||||
//.linkedClone()
|
||||
.build());
|
||||
|
@ -211,12 +190,12 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
@Test(testName = "POST /vdc/{id}/action/instantiateVAppTemplate", enabled = false)
|
||||
public void testInstantiateVAppTemplate() {
|
||||
Reference templateSource = null; // TODO: vApp or vAppTemplate reference
|
||||
VApp vApp = vdcClient.instantiateVApp(vdcRef, InstantiateVAppParams.builder()
|
||||
VApp vApp = vdcClient.instantiateVApp(vdcURI, InstantiateVAppParams.builder()
|
||||
.source(templateSource)
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.isSourceDelete(true)
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
//.isSourceDelete(true)
|
||||
.build());
|
||||
|
||||
Checks.checkVApp(vApp);
|
||||
|
@ -227,7 +206,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "POST /vdc/{id}/action/uploadVAppTemplate", enabled = false)
|
||||
public void testUploadVAppTemplate() {
|
||||
VAppTemplate template = vdcClient.uploadVAppTemplate(vdcRef, UploadVAppTemplateParams.builder()
|
||||
VAppTemplate template = vdcClient.uploadVAppTemplate(vdcURI, UploadVAppTemplateParams.builder()
|
||||
// TODO: test optional params
|
||||
//.name("")
|
||||
//.description("")
|
||||
|
@ -243,7 +222,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "GET /network/{id}/metadata", enabled = false)
|
||||
public void testGetMetadata() {
|
||||
Metadata metadata = vdcClient.getMetadataClient().getMetadata(vdcRef);
|
||||
Metadata metadata = vdcClient.getMetadataClient().getMetadata(vdcURI);
|
||||
// required for testing
|
||||
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
|
||||
String.format(OBJ_FIELD_REQ_LIVE, VDC, "metadata.entries"));
|
||||
|
@ -253,7 +232,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
|
|||
|
||||
@Test(testName = "GET /network/{id}/metadata/{key}", enabled = false)
|
||||
public void testGetMetadataValue() {
|
||||
MetadataValue metadataValue = vdcClient.getMetadataClient().getMetadataValue(vdcRef, "key");
|
||||
MetadataValue metadataValue = vdcClient.getMetadataClient().getMetadataValue(vdcURI, "key");
|
||||
|
||||
Checks.checkMetadataValueFor(VDC, metadataValue);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -28,7 +29,7 @@ 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.URISupplier;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Task;
|
||||
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -74,7 +75,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
|||
public abstract void setupRequiredClients();
|
||||
|
||||
/** Injected by {@link #setupContext} */
|
||||
public Predicate<URISupplier> retryTaskSuccess;
|
||||
public Predicate<Task> retryTaskSuccess;
|
||||
|
||||
@Override
|
||||
@BeforeClass(groups = { "live" })
|
||||
|
@ -99,7 +100,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
|
|||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), overrides);
|
||||
|
||||
TaskSuccess taskSuccess = context.utils().injector().getInstance(TaskSuccess.class);
|
||||
retryTaskSuccess = new RetryablePredicate<URISupplier>(taskSuccess, 1000L);
|
||||
retryTaskSuccess = new RetryablePredicate<Task>(taskSuccess, 1000L);
|
||||
}
|
||||
|
||||
protected void tearDown() {
|
||||
|
|
Loading…
Reference in New Issue