From bd72880240a29359eddea1f3be10008248e30f7e Mon Sep 17 00:00:00 2001 From: danikov Date: Wed, 7 Mar 2012 15:41:02 +0000 Subject: [PATCH] subclass catalogClient with adminCatalogClient, plus adjust usages --- .../director/v1_5/features/AdminCatalogAsyncClient.java | 3 ++- .../vcloud/director/v1_5/features/AdminCatalogClient.java | 3 ++- .../vcloud/director/v1_5/features/CatalogAsyncClient.java | 5 +++-- .../vcloud/director/v1_5/features/CatalogClient.java | 3 ++- .../director/v1_5/features/CatalogClientLiveTest.java | 6 +++--- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogAsyncClient.java index 85ceeaf85e..f8d55b35dc 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogAsyncClient.java @@ -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 getCatalog(@EndpointParam URI catalogRef); /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClient.java index b913a50ee9..b7ee427eb3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClient.java @@ -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); /** diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncClient.java index 55806b5130..831359b695 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogAsyncClient.java @@ -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 getCatalog(@EndpointParam URI catalogUri); + ListenableFuture> getCatalog(@EndpointParam URI catalogUri); /** * Creates a catalog item in a catalog. diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogClient.java index 8e52894b01..287cc17f6a 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/CatalogClient.java @@ -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. diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java index 92090b6671..5c938c14dd 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java @@ -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() { @Override public boolean apply(Reference input) {