test groupings + metadataclient delegation

This commit is contained in:
danikov 2012-03-05 10:52:04 +00:00
parent f194523403
commit 5789d1783e
25 changed files with 110 additions and 448 deletions

View File

@ -21,20 +21,18 @@ package org.jclouds.vcloud.director.v1_5;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
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.Org;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.UploadAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.VdcAsyncClient;
import com.google.inject.Provides;
@ -101,11 +99,7 @@ public interface VCloudDirectorAsyncClient {
@Delegate
UploadAsyncClient getUploadClient();
/**
* @return asynchronous access to {@link Metadata} features
*/
@Delegate
MetadataAsyncClient getMetadataClient();
/**
* @return asynchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} features
*/

View File

@ -24,7 +24,6 @@ import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.vcloud.director.v1_5.domain.Catalog;
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.Org;
import org.jclouds.vcloud.director.v1_5.domain.Session;
import org.jclouds.vcloud.director.v1_5.domain.Task;
@ -32,13 +31,12 @@ import org.jclouds.vcloud.director.v1_5.domain.Vdc;
import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
import org.jclouds.vcloud.director.v1_5.features.MetadataClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkClient;
import org.jclouds.vcloud.director.v1_5.features.OrgClient;
import org.jclouds.vcloud.director.v1_5.features.QueryClient;
import org.jclouds.vcloud.director.v1_5.features.TaskClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.UploadClient;
import org.jclouds.vcloud.director.v1_5.features.VAppTemplateClient;
import org.jclouds.vcloud.director.v1_5.features.VdcClient;
import com.google.inject.Provides;
@ -106,11 +104,6 @@ public interface VCloudDirectorClient {
UploadClient getUploadClient();
/**
* @return synchronous access to {@link Metadata} features
*/
@Delegate
MetadataClient getMetadataClient();
/*
* @return synchronous access to {@link org.jclouds.vcloud.director.v1_5.domain.VAppTemplate} features
*/
@Delegate

View File

@ -83,7 +83,8 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
.put(VdcClient.class, VdcAsyncClient.class)
.put(VAppTemplateClient.class, VAppTemplateAsyncClient.class)
.put(UploadClient.class, UploadAsyncClient.class)
.put(MetadataClient.class, MetadataAsyncClient.class)
.put(MetadataClient.Readable.class, MetadataAsyncClient.Readable.class)
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class)
.build();
public VCloudDirectorRestClientModule() {

View File

@ -24,10 +24,10 @@ 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.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
@ -37,8 +37,6 @@ 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.MetadataValue;
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;
@ -74,27 +72,6 @@ public interface CatalogAsyncClient {
ListenableFuture<CatalogItem> addCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogRef,
@BinderParam(BindToXMLPayload.class) CatalogItem catalogItem);
/**
* Returns the metadata associated with the catalog.
*/
@GET
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getCatalogMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogRef);
/**
* Returns the metadata associated with the catalog for the specified key.
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getCatalogMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogRef,
@PathParam("key") String key);
/**
* Retrieves a catalog item.
*/
@ -125,58 +102,8 @@ public interface CatalogAsyncClient {
ListenableFuture<Void> deleteCatalogItem(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef);
/**
* Returns the metadata associated with the catalog item.
* @return asynchronous access to {@link Metadata.Writeable} features
*/
@GET
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getCatalogItemMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef);
/**
* Merges the metadata for a catalog item with the information provided.
*/
@POST
@Path("/metadata")
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> mergeCatalogItemMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef,
@BinderParam(BindToXMLPayload.class) Metadata catalogItemMetadata);
/**
* Returns the metadata associated with the catalog item for the specified key.
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getCatalogItemMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef,
@PathParam("key") String key);
/**
* Sets the metadata for the particular key for the catalog item to the value provided.
*/
@PUT
@Path("/metadata/{key}")
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> setCatalogItemMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef,
@PathParam("key") String key, @BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
/**
* Deletes the metadata for the particular key for the catalog item.
*/
@DELETE
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteCatalogItemMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier catalogItemRef,
@PathParam("key") String key);
@Delegate
MetadataAsyncClient.Writable getMetadataClient();
}

View File

@ -21,11 +21,10 @@ package org.jclouds.vcloud.director.v1_5.features;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
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.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
/**
@ -62,31 +61,6 @@ public interface CatalogClient {
*/
CatalogItem addCatalogItem(URISupplier catalogRef, CatalogItem item);
/**
* Returns the metadata associated with the catalog.
*
* <pre>
* GET /catalog/{id}/metadata
* </pre>
*
* @param catalogRef the reference for the catalog
* @return the catalog metadata
*/
Metadata getCatalogMetadata(URISupplier catalogRef);
/**
* Returns the metadata associated with the catalog for the specified key.
*
* <pre>
* GET /catalog/{id}/metadata/{key}
* </pre>
*
* @param catalogRef the reference for the catalog
* @param key the metadata entry key
* @return the catalog metadata value
*/
MetadataValue getCatalogMetadataValue(URISupplier catalogRef, String key);
/**
* Retrieves a catalog item.
*
@ -124,67 +98,8 @@ public interface CatalogClient {
void deleteCatalogItem(URISupplier catalogItemRef);
/**
* Returns the metadata associated with the catalog item.
*
* <pre>
* GET /catalogItem/{id}/metadata
* </pre>
*
* @param catalogItemRef the reference for the catalog item
* @return the catalog item metadata
* @return synchronous access to {@link Metadata.Writeable} features
*/
Metadata getCatalogItemMetadata(URISupplier catalogItemRef);
/**
* Merges the metadata for a catalog item with the information provided.
*
* <pre>
* POST /catalogItem/{id}/metadata
* </pre>
*
* @param catalogItemRef the reference for the catalog item
* @param catalogItemMetadata the metadata for the catalog item
* @return a task for the merge operation
*/
Task mergeCatalogItemMetadata(URISupplier catalogItemRef, Metadata catalogItemMetadata);
/**
* Returns the metadata associated with the catalog item for the specified key.
*
* <pre>
* GET /catalog/{id}/metadata/{key}
* </pre>
*
* @param catalogItemRef the reference for the catalog item
* @param key the metadata entry key
* @return the catalog item metadata value
*/
MetadataValue getCatalogItemMetadataValue(URISupplier catalogItemRef, String key);
/**
* Sets the metadata for the particular key for the catalog item to the value provided.
*
* <pre>
* PUT /catalog/{id}/metadata/{key}
* </pre>
*
* @param catalogItemRef the reference for the catalog item
* @param key the metadata entry key
* @param value the metadata value
* @return a task for the set operation
*/
Task setCatalogItemMetadataValue(URISupplier catalogItemRef, String key, MetadataValue value);
/**
* Deletes the metadata for the particular key for the catalog item.
*
* <pre>
* DELETE /catalog/{id}/metadata/{key}
* </pre>
*
* @param catalogItemRef the reference for the catalog item
* @param key the metadata entry key
* @return a task for the delete operation
*/
Task deleteCatalogItemMetadataValue(URISupplier catalogItemRef, String key);
@Delegate
MetadataClient.Writeable getMetadataClient();
}

View File

@ -21,13 +21,12 @@ package org.jclouds.vcloud.director.v1_5.features;
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.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
@ -36,7 +35,6 @@ import org.jclouds.rest.binders.BindToXMLPayload;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
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.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
@ -93,60 +91,8 @@ public interface MediaAsyncClient {
ListenableFuture<Owner> getOwner(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
/**
* @see MediaClient#getMetadata(URISupplier))
*/
@GET
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef);
/**
* @see MediaClient#mergeMetadata(URISupplier, Metadata))
*/
@POST
@Path("/metadata")
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> mergeMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef,
@BinderParam(BindToXMLPayload.class) Metadata metadata);
/**
* @see MediaClient#getMetadataEntry(URISupplier, String))
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef,
@PathParam("key") String key);
/**
* @see MediaClient#setMetadata(URISupplier, String, MetadataEntry))
*/
@PUT
@Path("/metadata/{key}")
@Consumes(VCloudDirectorMediaType.TASK)
@Produces(VCloudDirectorMediaType.METADATA_VALUE)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> setMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier metaDataRef,
@PathParam("key") String key,
@BinderParam(BindToXMLPayload.class) MetadataValue metadataValue);
/**
* @see MediaClient#deleteMetadataEntry(URISupplier, String))
*/
@DELETE
@Path("/metadata/{key}")
@Consumes(VCloudDirectorMediaType.TASK)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> deleteMetadataEntry(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier metaDataRef,
@PathParam("key") String key);
* @return asynchronous access to {@link Metadata.Writeable} features
*/
@Delegate
MetadataAsyncClient.Writable getMetadataClient();
}

View File

@ -21,9 +21,9 @@ package org.jclouds.vcloud.director.v1_5.features;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.rest.annotations.Delegate;
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.Owner;
import org.jclouds.vcloud.director.v1_5.domain.Task;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
@ -67,42 +67,9 @@ public interface MediaClient {
Owner getOwner(URISupplier mediaRef);
/**
* Retrieves an list of the media's metadata
*
* @return a list of metadata
* @return synchronous access to {@link Metadata.Writeable} features
*/
Metadata getMetadata(URISupplier mediaRef);
/**
* Merges the metadata for a media with the information provided.
*
* @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 mediaRef, Metadata metadata);
/**
* Retrieves a metadata value
*
* @return the metadata value, or null if not found
*/
MetadataValue getMetadataValue(URISupplier mediaRef, String key);
/**
* Sets the metadata for the particular key for the media to the value provided.
* Note: this will replace any existing metadata information
*
* @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 mediaRef, String key, MetadataValue metadataValue);
/**
* Deletes a metadata entry.
*
* @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 mediaRef, String key);
@Delegate
MetadataClient.Writeable getMetadataClient();
}

View File

@ -60,7 +60,7 @@ public interface MetadataAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parent);
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef);
/**
* @see MetadataClient.Readable#getMetadataEntry(URISupplier, String)
@ -70,7 +70,7 @@ public interface MetadataAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parent ,
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef ,
@PathParam("key") String key);
}
@ -84,7 +84,7 @@ public interface MetadataAsyncClient {
@Produces(VCloudDirectorMediaType.METADATA)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Task> mergeMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier mediaRef,
ListenableFuture<Task> mergeMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier parentRef,
@BinderParam(BindToXMLPayload.class) Metadata metadata);

View File

@ -34,32 +34,33 @@ import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
* @see <a href= "http://support.theenterprisecloud.com/kb/default.asp?id=984&Lang=1&SID=" />
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface MetadataClient {
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public static interface Readable extends MetadataClient {
/**
* Retrieves an list of metadata
*
* @return a list of metadata
*/
Metadata getMetadata(URISupplier vdcRef);
Metadata getMetadata(URISupplier parentRef);
/**
* Retrieves a metadata value
*
* @return the metadata value, or null if not found
*/
MetadataValue getMetadataValue(URISupplier vdcRef, String key);
MetadataValue getMetadataValue(URISupplier parentRef, String key);
}
public static interface Writable extends Readable {
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public static interface Writeable extends Readable {
/**
* Merges the metadata for a media with the information provided.
*
* @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 mediaRef, Metadata metadata);
Task mergeMetadata(URISupplier parentRef, Metadata metadata);
/**
* Sets the metadata for the particular key for the media to the value provided.
@ -68,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 mediaRef, String key, MetadataValue metadataValue);
Task setMetadata(URISupplier parentRef, String key, MetadataValue metadataValue);
/**
* Deletes a metadata entry.
@ -76,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 mediaRef, String key);
Task deleteMetadataEntry(URISupplier parentRef, String key);
}
}

View File

@ -20,15 +20,13 @@ package org.jclouds.vcloud.director.v1_5.features;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import org.jclouds.rest.annotations.Delegate;
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.vcloud.director.v1_5.domain.Metadata;
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.URISupplier;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
@ -55,24 +53,9 @@ public interface NetworkAsyncClient {
ListenableFuture<OrgNetwork> getNetwork(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier networkRef);
/**
* @see NeworkClient#getMetadata(URISupplier)
* @return asynchronous access to {@link Metadata.Readable} features
*/
@GET
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier networkRef);
/**
* @see NeworkClient#getMetadataValue(URISupplier, String)
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier networkRef ,
@PathParam("key") String key);
@Delegate
MetadataAsyncClient.Readable getMetadataClient();
}

View File

@ -21,8 +21,8 @@ package org.jclouds.vcloud.director.v1_5.features;
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.MetadataValue;
import org.jclouds.vcloud.director.v1_5.domain.OrgNetwork;
import org.jclouds.vcloud.director.v1_5.domain.URISupplier;
@ -45,17 +45,8 @@ public interface NetworkClient {
OrgNetwork getNetwork(URISupplier networkRef);
/**
* Retrieves an list of the network's metadata
*
* @return a list of metadata
* @return synchronous access to {@link Metadata.Readable} features
*/
Metadata getMetadata(URISupplier networkRef);
/**
* Retrieves a metadata value
*
* @return the metadata value, or null if not found
*/
MetadataValue getMetadataValue(URISupplier networkRef, String key);
@Delegate
MetadataClient.Readable getMetadataClient();
}

View File

@ -21,14 +21,13 @@ package org.jclouds.vcloud.director.v1_5.features;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import org.jclouds.rest.annotations.Delegate;
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.vcloud.director.v1_5.domain.Metadata;
import org.jclouds.vcloud.director.v1_5.domain.MetadataValue;
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;
@ -65,23 +64,8 @@ public interface OrgAsyncClient {
ListenableFuture<Org> getOrg(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier orgRef);
/**
* @see OrgClient#getMetadata(ReferenceType)
* @return asynchronous access to {@link Metadata.Readable} features
*/
@GET
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getOrgMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier orgRef);
/**
* @see OrgClient#getMetadataEntry(ReferenceType, String)
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getOrgMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier orgRef,
@PathParam("key") String key);
@Delegate
MetadataAsyncClient.Readable getMetadataClient();
}

View File

@ -21,8 +21,8 @@ package org.jclouds.vcloud.director.v1_5.features;
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.MetadataValue;
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;
@ -60,24 +60,8 @@ public interface OrgClient {
Org getOrg(URISupplier orgRef);
/**
* Retrieves an list of the organization's metadata
*
* <pre>
* GET /org/{id}/metadata
* </pre>
*
* @return a list of metadata
* @return synchronous access to {@link Metadata.Readable} features
*/
Metadata getOrgMetadata(URISupplier orgRef);
/**
* Retrieves a metadata entry.
*
* <pre>
* GET /org/{id}/metadata{key}
* </pre>
*
* @return the metadata entry or null if not found
*/
MetadataValue getOrgMetadataValue(URISupplier orgRef, String key);
@Delegate
MetadataClient.Readable getMetadataClient();
}

View File

@ -22,10 +22,10 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.jclouds.rest.annotations.BinderParam;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;
import org.jclouds.rest.annotations.ExceptionParser;
import org.jclouds.rest.annotations.JAXBResponseParser;
@ -40,7 +40,6 @@ 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.MetadataValue;
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;
@ -166,24 +165,9 @@ public interface VdcAsyncClient {
@BinderParam(BindToXMLPayload.class) Media media);
/**
* @see VdcClient#getMetadata(URISupplier)
* @return asynchronous access to {@link Metadata.Readable} features
*/
@GET
@Path("/metadata")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Metadata> getMetadata(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef);
/**
* @see VdcClient#getMetadataEntry(URISupplier, String)
*/
@GET
@Path("/metadata/{key}")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<MetadataValue> getMetadataValue(@EndpointParam(parser = URISupplierToEndpoint.class) URISupplier vdcRef ,
@PathParam("key") String key);
@Delegate
MetadataAsyncClient.Readable getMetadataClient();
}

View File

@ -21,6 +21,7 @@ package org.jclouds.vcloud.director.v1_5.features;
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;
@ -29,7 +30,6 @@ 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.MetadataValue;
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;
@ -144,17 +144,9 @@ public interface VdcClient {
Media createMedia(URISupplier vdcRef, Media media);
/**
* Retrieves an list of the vdc's metadata
*
* @return a list of metadata
* @return synchronous access to {@link Metadata.Readable} features
*/
Metadata getMetadata(URISupplier vdcRef);
/**
* Retrieves a metadata value
*
* @return the metadata value, or null if not found
*/
MetadataValue getMetadataValue(URISupplier vdcRef, String key);
@Delegate
MetadataClient.Readable getMetadataClient();
}

View File

@ -149,7 +149,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.entries(ImmutableSet.of(metadataEntry()))
.build();
assertEquals(client.getCatalogClient().getCatalogMetadata(catalogRef), expected);
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogRef), expected);
}
@Test
@ -178,7 +178,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
MetadataValue expected = metadataValue();
assertEquals(client.getCatalogClient().getCatalogMetadataValue(catalogRef, "KEY"), expected);
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogRef, "KEY"), expected);
}
@Test
@ -301,7 +301,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
.entries(ImmutableSet.of(itemMetadataEntry()))
.build();
assertEquals(client.getCatalogClient().getCatalogItemMetadata(catalogItemReference), expected);
assertEquals(client.getCatalogClient().getMetadataClient().getMetadata(catalogItemReference), expected);
}
@Test
@ -333,7 +333,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
Task expected = mergeMetadataTask();
assertEquals(client.getCatalogClient().mergeCatalogItemMetadata(catalogItemReference, metadata), expected);
assertEquals(client.getCatalogClient().getMetadataClient().mergeMetadata(catalogItemReference, metadata), expected);
}
@Test
@ -362,7 +362,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
MetadataValue expected = itemMetadataValue();
assertEquals(client.getCatalogClient().getCatalogItemMetadataValue(catalogItemReference, "KEY"), expected);
assertEquals(client.getCatalogClient().getMetadataClient().getMetadataValue(catalogItemReference, "KEY"), expected);
}
@Test
@ -394,7 +394,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
Task expected = setMetadataValueTask();
assertEquals(client.getCatalogClient().setCatalogItemMetadataValue(catalogItemReference, "KEY", value), expected);
assertEquals(client.getCatalogClient().getMetadataClient().setMetadata(catalogItemReference, "KEY", value), expected);
}
@Test
@ -423,7 +423,7 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
Task expected = deleteMetadataEntryTask();
assertEquals(client.getCatalogClient().deleteCatalogItemMetadataValue(catalogItemReference, "KEY"), expected);
assertEquals(client.getCatalogClient().getMetadataClient().deleteMetadataEntry(catalogItemReference, "KEY"), expected);
}
public static final Catalog catalog() {

View File

@ -150,7 +150,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.getCatalogMetadata(catalogRef);
catalogMetadata = catalogClient.getMetadataClient().getMetadata(catalogRef);
checkMetadata(catalogMetadata);
}
@ -163,7 +163,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
return input.getKey().equals("KEY");
}
});
MetadataValue metadataValue = catalogClient.getCatalogMetadataValue(catalogRef, "KEY");
MetadataValue metadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogRef, "KEY");
assertEquals(metadataValue.getValue(), existingMetadataEntry.getValue(),
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", existingMetadataEntry.getValue(), metadataValue.getValue()));
checkMetadataValue(metadataValue);
@ -172,7 +172,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /catalogItem/{id}/metadata", dependsOnMethods = { "testGetCatalogItem" })
public void testGetCatalogItemMetadata() {
resetCatalogItemMetadata(catalogItemRef);
catalogItemMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
catalogItemMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
assertEquals(catalogItemMetadata.getMetadataEntries().size(), 1, String.format(MUST_EXIST_FMT, "MetadataEntry", "CatalogItem"));
checkMetadata(catalogItemMetadata);
}
@ -184,22 +184,22 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.entry(MetadataEntry.builder().entry("VEGIMITE", "VALUE").build())
.build();
Task mergeCatalogItemMetadata = catalogClient.mergeCatalogItemMetadata(catalogItemRef, newMetadata);
Task mergeCatalogItemMetadata = catalogClient.getMetadataClient().mergeMetadata(catalogItemRef, newMetadata);
checkTask(mergeCatalogItemMetadata);
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));
Metadata mergedCatalogItemMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
Metadata mergedCatalogItemMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
// XXX
assertEquals(mergedCatalogItemMetadata.getMetadataEntries().size(), catalogItemMetadata.getMetadataEntries().size() + 1,
"Should have added another MetadataEntry to the CatalogItem");
MetadataValue keyMetadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
MetadataValue keyMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
// XXX
assertEquals(keyMetadataValue.getValue(), "MARMALADE", "The Value of the MetadataValue for KEY should have changed");
checkMetadataValue(keyMetadataValue);
MetadataValue newKeyMetadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "VEGIMITE");
MetadataValue newKeyMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "VEGIMITE");
// XXX
assertEquals(newKeyMetadataValue.getValue(), "VALUE", "The Value of the MetadataValue for NEW_KEY should have been set");
checkMetadataValue(newKeyMetadataValue);
@ -215,7 +215,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
return input.getKey().equals("KEY");
}
});
MetadataValue metadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
MetadataValue metadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
assertEquals(existingMetadataEntry.getValue(), metadataValue.getValue());
checkMetadataValue(metadataValue);
}
@ -224,13 +224,13 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public void testSetCatalogItemMetadataValue() {
MetadataValue newMetadataValue = MetadataValue.builder().value("NEW").build();
Task setCatalogItemMetadataValue = catalogClient.setCatalogItemMetadataValue(catalogItemRef, "KEY", newMetadataValue);
Task setCatalogItemMetadataValue = catalogClient.getMetadataClient().setMetadata(catalogItemRef, "KEY", newMetadataValue);
checkTask(setCatalogItemMetadataValue);
Checks.checkTask(setCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(setCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "setCatalogItemMetadataValue"));
MetadataValue updatedMetadataValue = catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
MetadataValue updatedMetadataValue = catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
assertEquals(updatedMetadataValue.getValue(), newMetadataValue.getValue(),
String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", newMetadataValue.getValue(), updatedMetadataValue.getValue()));
checkMetadataValue(updatedMetadataValue);
@ -238,13 +238,13 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "DELETE /catalog/{id}/metadata/{key}", dependsOnMethods = { "testSetCatalogItemMetadataValue" })
public void testDeleteCatalogItemMetadataValue() {
Task deleteCatalogItemMetadataValue = catalogClient.deleteCatalogItemMetadataValue(catalogItemRef, "KEY");
Task deleteCatalogItemMetadataValue = catalogClient.getMetadataClient().deleteMetadataEntry(catalogItemRef, "KEY");
checkTask(deleteCatalogItemMetadataValue);
Checks.checkTask(deleteCatalogItemMetadataValue);
assertTrue(retryTaskSuccess.apply(deleteCatalogItemMetadataValue),
String.format(TASK_COMPLETE_TIMELY, "deleteCatalogItemMetadataValue"));
try {
catalogClient.getCatalogItemMetadataValue(catalogItemRef, "KEY");
catalogClient.getMetadataClient().getMetadataValue(catalogItemRef, "KEY");
fail("The CatalogItem MetadataValue for KEY should have been deleted");
} catch (VCloudDirectorException vcde) {
Error error = vcde.getError();
@ -256,18 +256,18 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
}
private void deleteAllCatalogItemMetadata(ReferenceType<?> catalogItemRef) {
Metadata currentMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
Metadata currentMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
for (MetadataEntry currentMetadataEntry : currentMetadata.getMetadataEntries()) {
catalogClient.deleteCatalogItemMetadataValue(catalogItemRef, currentMetadataEntry.getKey());
catalogClient.getMetadataClient().deleteMetadataEntry(catalogItemRef, currentMetadataEntry.getKey());
}
Metadata emptyMetadata = catalogClient.getCatalogItemMetadata(catalogItemRef);
Metadata emptyMetadata = catalogClient.getMetadataClient().getMetadata(catalogItemRef);
assertTrue(emptyMetadata.getMetadataEntries().isEmpty(), "The catalogItem Metadata should be empty");
}
private void resetCatalogItemMetadata(ReferenceType<?> catalogItemRef) {
deleteAllCatalogItemMetadata(catalogItemRef);
Metadata newMetadata = Metadata.builder().entry(MetadataEntry.builder().entry("KEY", "VALUE").build()).build();
Task mergeCatalogItemMetadata = catalogClient.mergeCatalogItemMetadata(catalogItemRef, newMetadata);
Task mergeCatalogItemMetadata = catalogClient.getMetadataClient().mergeMetadata(catalogItemRef, newMetadata);
Checks.checkTask(mergeCatalogItemMetadata);
assertTrue(retryTaskSuccess.apply(mergeCatalogItemMetadata),
String.format(TASK_COMPLETE_TIMELY, "mergeCatalogItemMetadata"));

View File

@ -47,7 +47,7 @@ import org.testng.annotations.Test;
*
* @author danikov
*/
@Test(groups = { "unit", "user", "media" }, singleThreaded = true, testName = "MediaClientExpectTest")
@Test(groups = { "unit", "media" }, singleThreaded = true, testName = "MediaClientExpectTest")
public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
@Test
@ -280,7 +280,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
Metadata expected = metadata();
assertEquals(client.getMediaClient().getMetadata(mediaRef), expected);
assertEquals(client.getMediaClient().getMetadataClient().getMetadata(mediaRef), expected);
}
@Test
@ -301,7 +301,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
Metadata inputMetadata = metadata();
Task expectedTask = mergeMetadataTask();
assertEquals(client.getMediaClient().mergeMetadata(mediaRef, inputMetadata), expectedTask);
assertEquals(client.getMediaClient().getMetadataClient().mergeMetadata(mediaRef, inputMetadata), expectedTask);
}
public void testGetMetadataValue() {
@ -320,7 +320,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
Reference mediaRef = Reference.builder().href(mediaUri).build();
assertEquals(client.getMediaClient().getMetadataValue(mediaRef, "key"), expected);
assertEquals(client.getMediaClient().getMetadataClient().getMetadataValue(mediaRef, "key"), expected);
}
@Test
@ -342,7 +342,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
Task expectedTask = setMetadataEntryTask();
assertEquals(client.getMediaClient().setMetadata(mediaRef, "key", inputMetadataValue), expectedTask);
assertEquals(client.getMediaClient().getMetadataClient().setMetadata(mediaRef, "key", inputMetadataValue), expectedTask);
}
@Test
@ -361,7 +361,7 @@ public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTes
Reference mediaRef = Reference.builder().href(mediaUri).build();
Task expectedTask = deleteMetadataEntryTask();
assertEquals(client.getMediaClient().deleteMetadataEntry(mediaRef, "key"), expectedTask);
assertEquals(client.getMediaClient().getMetadataClient().deleteMetadataEntry(mediaRef, "key"), expectedTask);
}
@Test

View File

@ -175,7 +175,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
Checks.checkMediaFor(MEDIA, media);
assertTrue(media.clone(oldMedia), "");
mediaClient.setMetadata(media, "key", MetadataValue.builder().value("value").build());
mediaClient.getMetadataClient().setMetadata(media, "key", MetadataValue.builder().value("value").build());
media = vdcClient.cloneMedia(vdcRef, CloneMediaParams.builder()
.source(Reference.builder().fromEntity(media).build())
@ -232,7 +232,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /media/{id}/metadata",
dependsOnMethods = { "testGetMedia" }, enabled = false)
public void testGetMetadata() {
metadata = mediaClient.getMetadata(media);
metadata = mediaClient.getMetadataClient().getMetadata(media);
// required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, MEDIA, "metadata.entries"));
@ -249,10 +249,10 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.entries(inputEntries)
.build();
Task mergeMetadata = mediaClient.mergeMetadata(media, inputMetadata);
Task mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media, inputMetadata);
Checks.checkTask(mergeMetadata);
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(new)"));
metadata = mediaClient.getMetadata(media);
metadata = mediaClient.getMetadataClient().getMetadata(media);
Checks.checkMetadataFor(MEDIA, metadata);
checkMetadataContainsEntries(metadata, inputEntries);
@ -265,10 +265,10 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.entries(inputEntries)
.build();
mergeMetadata = mediaClient.mergeMetadata(media, inputMetadata);
mergeMetadata = mediaClient.getMetadataClient().mergeMetadata(media, inputMetadata);
Checks.checkTask(mergeMetadata);
assertTrue(retryTaskSuccess.apply(mergeMetadata), String.format(TASK_COMPLETE_TIMELY, "mergeMetadata(modify)"));
metadata = mediaClient.getMetadata(media);
metadata = mediaClient.getMetadataClient().getMetadata(media);
Checks.checkMetadataFor(MEDIA, metadata);
checkMetadataContainsEntries(metadata, inputEntries);
@ -296,7 +296,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /media/{id}/metadata/{key}",
dependsOnMethods = { "testMergeMetadata" }, enabled = false)
public void testGetMetadataValue() {
metadataValue = mediaClient.getMetadataValue(media, "key");
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "key");
Checks.checkMetadataValueFor(MEDIA, metadataValue);
}
@ -306,18 +306,18 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
metadataEntryValue = "newValue";
MetadataValue newValue = MetadataValue.builder().value(metadataEntryValue).build();
Task setMetadataEntry = mediaClient.setMetadata(media, "key", newValue);
Task setMetadataEntry = mediaClient.getMetadataClient().setMetadata(media, "key", newValue);
Checks.checkTask(setMetadataEntry);
assertTrue(retryTaskSuccess.apply(setMetadataEntry),
String.format(TASK_COMPLETE_TIMELY, "setMetadataEntry"));
metadataValue = mediaClient.getMetadataValue(media, "key");
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "key");
Checks.checkMetadataValueFor(MEDIA, metadataValue);
}
@Test(testName = "DELETE /media/{id}/metadata/{key}",
dependsOnMethods = { "testSetMetadataValue" }, enabled = false )
public void testDeleteMetadata() {
Task deleteMetadataEntry = mediaClient.deleteMetadataEntry(media, "testKey");
Task deleteMetadataEntry = mediaClient.getMetadataClient().deleteMetadataEntry(media, "testKey");
Checks.checkTask(deleteMetadataEntry);
assertTrue(retryTaskSuccess.apply(deleteMetadataEntry),
String.format(TASK_COMPLETE_TIMELY, "deleteMetadataEntry"));
@ -329,7 +329,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
.build();
try {
metadataValue = mediaClient.getMetadataValue(media, "testKey");
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "testKey");
fail("Should give HTTP 403 error");
} catch (VCloudDirectorException vde) {
assertEquals(vde.getError(), expected);
@ -344,7 +344,7 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
"metadataEntry", metadataValue.toString()));
}
metadataValue = mediaClient.getMetadataValue(media, "key");
metadataValue = mediaClient.getMetadataClient().getMetadataValue(media, "key");
Checks.checkMetadataValueFor(MEDIA, metadataValue);
media = mediaClient.getMedia(media);

View File

@ -164,7 +164,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
Reference networkRef = Reference.builder().href(networkUri).build();
assertEquals(client.getNetworkClient().getMetadata(networkRef), expected);
assertEquals(client.getNetworkClient().getMetadataClient().getMetadata(networkRef), expected);
}
@Test(enabled=false) // No metadata in exemplar xml...
@ -181,7 +181,7 @@ public class NetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectT
Reference networkRef = Reference.builder().href(networkUri).build();
assertEquals(client.getNetworkClient().getMetadataValue(networkRef, "KEY"), expected);
assertEquals(client.getNetworkClient().getMetadataClient().getMetadataValue(networkRef, "KEY"), expected);
}
public static OrgNetwork orgNetwork() {

View File

@ -100,7 +100,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /network/{id}/metadata")
public void testGetMetadata() {
Metadata metadata = networkClient.getMetadata(networkRef);
Metadata metadata = networkClient.getMetadataClient().getMetadata(networkRef);
// required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, NETWORK, "metadata.entries"));
@ -122,7 +122,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /network/{id}/metadata/{key}")
public void testGetMetadataValue() {
MetadataValue metadataValue = networkClient.getMetadataValue(networkRef, "key");
MetadataValue metadataValue = networkClient.getMetadataClient().getMetadataValue(networkRef, "key");
// Check parent type
checkResourceType(metadataValue);

View File

@ -195,7 +195,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
Reference orgRef = Reference.builder().href(orgUri).build();
assertEquals(client.getOrgClient().getOrgMetadata(orgRef), expected);
assertEquals(client.getOrgClient().getMetadataClient().getMetadata(orgRef), expected);
}
@Test
@ -210,7 +210,7 @@ public class OrgClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
Reference orgRef = Reference.builder().href(orgUri).build();
assertEquals(client.getOrgClient().getOrgMetadataValue(orgRef, "KEY"), expected);
assertEquals(client.getOrgClient().getMetadataClient().getMetadataValue(orgRef, "KEY"), expected);
}
public static Org org() {

View File

@ -97,7 +97,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.getOrgMetadata(orgRef);
Metadata metadata = orgClient.getMetadataClient().getMetadata(orgRef);
// NOTE The environment MUST have at one metadata entry for the first organisation configured
@ -110,7 +110,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.getOrgMetadataValue(orgRef, "KEY");
MetadataValue value = orgClient.getMetadataClient().getMetadataValue(orgRef, "KEY");
// NOTE The environment MUST have configured the metadata entry as '{ key="KEY", value="VALUE" )'

View File

@ -349,7 +349,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
Metadata expected = metadata();
assertEquals(client.getMediaClient().getMetadata(mediaRef), expected);
assertEquals(client.getVdcClient().getMetadataClient().getMetadata(mediaRef), expected);
}
@Test(enabled = false)
@ -369,7 +369,7 @@ public class VdcClientExpectTest extends BaseVCloudDirectorRestClientExpectTest
Reference mediaRef = Reference.builder().href(vdcUri).build();
assertEquals(client.getVdcClient().getMetadataValue(mediaRef, "key"), expected);
assertEquals(client.getVdcClient().getMetadataClient().getMetadataValue(mediaRef, "key"), expected);
}
public static Vdc getVdc() {

View File

@ -243,7 +243,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /network/{id}/metadata", enabled = false)
public void testGetMetadata() {
Metadata metadata = vdcClient.getMetadata(vdcRef);
Metadata metadata = vdcClient.getMetadataClient().getMetadata(vdcRef);
// required for testing
assertFalse(Iterables.isEmpty(metadata.getMetadataEntries()),
String.format(OBJ_FIELD_REQ_LIVE, VDC, "metadata.entries"));
@ -253,7 +253,7 @@ public class VdcClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /network/{id}/metadata/{key}", enabled = false)
public void testGetMetadataValue() {
MetadataValue metadataValue = vdcClient.getMetadataValue(vdcRef, "key");
MetadataValue metadataValue = vdcClient.getMetadataClient().getMetadataValue(vdcRef, "key");
Checks.checkMetadataValueFor(VDC, metadataValue);
}