From 5201207f1ca515a87564de23c64a9243ca9e576f Mon Sep 17 00:00:00 2001 From: Andrew Donald Kennedy Date: Tue, 21 Feb 2012 17:14:26 +0000 Subject: [PATCH] Updates to tidy up and make sure everything is both internally and externally consistent --- .../director/v1_5/VCloudDirectorMediaType.java | 2 +- .../VCloudDirectorClientExperimentLiveTest.java | 8 ++++++++ .../v1_5/features/MediaClientExpectTest.java | 2 +- .../v1_5/features/MediaClientLiveTest.java | 17 ++++++++++++----- .../v1_5/features/NetworkClientLiveTest.java | 5 ++++- .../v1_5/features/OrgClientLiveTest.java | 1 + .../v1_5/features/QueryClientLiveTest.java | 1 + .../v1_5/features/TaskClientLiveTest.java | 1 + .../BaseVCloudDirectorClientLiveTest.java | 7 ++++++- 9 files changed, 35 insertions(+), 9 deletions(-) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java index 01c4808467..82282db00f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorMediaType.java @@ -88,7 +88,7 @@ public class VCloudDirectorMediaType { */ public static final List ALL = Arrays.asList( SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY, - METADATA_VALUE, ORG, TASKS_LIST, TASK, ORG_NETWORK, + METADATA_VALUE, ORG, TASKS_LIST, TASK, NETWORK, ORG_NETWORK, CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY, MEDIA, OWNER, VDC, ADMIN_USER, QUERY_RESULT_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS, diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExperimentLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExperimentLiveTest.java index de9d0afdaf..101fdecb89 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExperimentLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClientExperimentLiveTest.java @@ -36,4 +36,12 @@ public class VCloudDirectorClientExperimentLiveTest extends BaseVCloudDirectorCl assertEquals(session.getHref().toASCIIString(), context.getEndpoint().toASCIIString() + "/session/"); } + /** + * No operation. + * + * @see BaseVCloudDirectorClientLiveTest#setupRequiredClients() + */ + @Override + public void setupRequiredClients() { } + } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java index e3c74afac4..230c04ed73 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientExpectTest.java @@ -46,7 +46,7 @@ import org.testng.annotations.Test; @Test(groups = { "unit", "user" }, singleThreaded = true, testName = "NetworkClientExpectTest") public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { - @Test + @Test(enabled = false) public void testGetMedia() { URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientLiveTest.java index acfda6450a..428fa35e3a 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/MediaClientLiveTest.java @@ -57,6 +57,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Reference; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess; +import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -71,13 +72,21 @@ import com.google.common.collect.Iterables; */ @Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "MediaClientLiveTest") public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest { + public static final String MEDIA = "media"; /* * Convenience references to API clients. */ + protected MediaClient mediaClient; + @BeforeClass(inheritGroups = true) + @Override + public void setupRequiredClients() { + mediaClient = context.getApi().getMediaClient(); + } + /* * Shared state between dependent tests. */ @@ -88,16 +97,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest { private MetadataValue metadataValue; private String metadataEntryValue = "value"; - @BeforeGroups(groups = { "live" }, dependsOnMethods = { "setupClient" }) - public void before() { - String mediaId = "68dc01a4-6c76-4177-9f19-ec12bf94287c"; // TODO: inject + @BeforeGroups(groups = { "live" }) + public void createReferenceData() { mediaRef = Reference.builder() .type("application/vnd.vmware.vcloud.media+xml") .name("") - .href(URI.create(endpoint+"/media/"+mediaId)) + .href(URI.create(endpoint+"/media/" + mediaId)) .id(mediaId) .build(); - mediaClient = context.getApi().getMediaClient(); mediaClient.setMetadata(mediaRef, "key", MetadataValue.builder().value("value").build()); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java index e75fd7c47e..3a16992387 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/NetworkClientLiveTest.java @@ -41,13 +41,16 @@ import org.testng.annotations.Test; @Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest") public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest { + public static final String NETWORK = "network"; + /* * Convenience references to API clients. */ - private NetworkClient networkClient; + protected NetworkClient networkClient; @BeforeClass(inheritGroups = true) + @Override public void setupRequiredClients() { networkClient = context.getApi().getNetworkClient(); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java index 2a243da968..90cb04c083 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java @@ -49,6 +49,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { private OrgClient orgClient; @BeforeClass(inheritGroups = true) + @Override public void setupRequiredClients() { orgClient = context.getApi().getOrgClient(); } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientLiveTest.java index 268a99c725..93b23be2b1 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientLiveTest.java @@ -43,6 +43,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest { private QueryClient queryClient; @BeforeClass(inheritGroups = true) + @Override public void setupRequiredClients() { catalogClient = context.getApi().getCatalogClient(); queryClient = context.getApi().getQueryClient(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java index eebc3c1c7b..8e3288b466 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java @@ -50,6 +50,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest { private TaskClient taskClient; @BeforeClass(inheritGroups = true) + @Override public void setupRequiredClients() { orgClient = context.getApi().getOrgClient(); taskClient = context.getApi().getTaskClient(); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java index 79b0e0d79e..b68ee2c84f 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/internal/BaseVCloudDirectorClientLiveTest.java @@ -48,7 +48,7 @@ import com.google.inject.Module; * @author grkvlt@apache.org */ @Test(groups = "live") -public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest { +public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest { protected BaseVCloudDirectorClientLiveTest() { provider = "vcloud-director"; @@ -75,7 +75,12 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe overrides.setProperty(provider + ".vcd-id", vDCId); return overrides; } + + @BeforeClass(inheritGroups = true) + // NOTE Implement as required to populate xxxClient fields, or NOP + public abstract void setupRequiredClients(); + /** Injected by {@link #setupContext} */ public Predicate retryTaskSuccess; @Override