subclass catalogClient with adminCatalogClient, plus adjust usages

This commit is contained in:
danikov 2012-03-07 15:41:02 +00:00
parent bb7cb44db9
commit bd72880240
5 changed files with 12 additions and 8 deletions

View File

@ -48,7 +48,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminCatalogAsyncClient {
public interface AdminCatalogAsyncClient extends CatalogAsyncClient {
/**
* @see AdminClient#getCatalog(URI)
@ -57,6 +57,7 @@ public interface AdminCatalogAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
@Override
ListenableFuture<AdminCatalog> getCatalog(@EndpointParam URI catalogRef);
/**

View File

@ -33,7 +33,7 @@ import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams;
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminCatalogClient {
public interface AdminCatalogClient extends CatalogClient {
/**
* Retrieves a catalog.
@ -45,6 +45,7 @@ public interface AdminCatalogClient {
* @param catalogRef the reference for the catalog
* @return a catalog
*/
@Override
AdminCatalog getCatalog(URI catalogRef);
/**

View File

@ -36,8 +36,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.Catalog;
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
import org.jclouds.vcloud.director.v1_5.domain.CatalogType;
import org.jclouds.vcloud.director.v1_5.features.MetadataAsyncClient.Writable;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx;
@ -57,7 +58,7 @@ public interface CatalogAsyncClient {
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
ListenableFuture<Catalog> getCatalog(@EndpointParam URI catalogUri);
ListenableFuture<? extends CatalogType<?>> getCatalog(@EndpointParam URI catalogUri);
/**
* Creates a catalog item in a catalog.

View File

@ -25,6 +25,7 @@ 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.CatalogType;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
/**
@ -46,7 +47,7 @@ public interface CatalogClient {
* @param catalogUri the reference for the catalog
* @return a catalog
*/
Catalog getCatalog(URI catalogUri);
CatalogType<?> getCatalog(URI catalogUri);
/**
* Creates a catalog item in a catalog.

View File

@ -34,8 +34,8 @@ 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;
import org.jclouds.vcloud.director.v1_5.domain.CatalogType;
import org.jclouds.vcloud.director.v1_5.domain.Checks;
import org.jclouds.vcloud.director.v1_5.domain.Error;
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
@ -74,7 +74,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
private ReferenceType<?> catalogRef;
private ReferenceType<?> catalogItemRef;
private ReferenceType<?> newCatalogItemRef;
private Catalog catalog;
private CatalogType<?> catalog;
private CatalogItem catalogItem;
private CatalogItem newCatalogItem;
private Metadata catalogMetadata;
@ -123,7 +123,7 @@ public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "PUT /catalogItem/{id}", dependsOnMethods = { "testAddCatalogItem" }, enabled = false)
public void testUpdateCatalogItem() {
Catalog catalog = catalogClient.getCatalog(catalogRef.getHref());
CatalogType<?> catalog = catalogClient.getCatalog(catalogRef.getHref());
newCatalogItemRef = Iterables.find(catalog.getCatalogItems().getCatalogItems(), new Predicate<Reference>() {
@Override
public boolean apply(Reference input) {