Updates to tidy up and make sure everything is both internally and externally consistent

This commit is contained in:
Andrew Donald Kennedy 2012-02-21 17:14:26 +00:00
parent 06ca9b1e3d
commit 5201207f1c
9 changed files with 35 additions and 9 deletions

View File

@ -88,7 +88,7 @@ public class VCloudDirectorMediaType {
*/ */
public static final List<String> ALL = Arrays.asList( public static final List<String> ALL = Arrays.asList(
SESSION, ERROR, ORG_LIST, METADATA, METADATA_ENTRY, 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, CATALOG, CATALOG_ITEM, CATALOG_ITEMS, CATALOGS_LIST, PROPERTY,
MEDIA, OWNER, VDC, ADMIN_USER, QUERY_RESULT_RECORDS, MEDIA, OWNER, VDC, ADMIN_USER, QUERY_RESULT_RECORDS,
QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS, QUERY_RESULT_REFERENCES, QUERY_RESULT_ID_RECORDS,

View File

@ -36,4 +36,12 @@ public class VCloudDirectorClientExperimentLiveTest extends BaseVCloudDirectorCl
assertEquals(session.getHref().toASCIIString(), context.getEndpoint().toASCIIString() + "/session/"); assertEquals(session.getHref().toASCIIString(), context.getEndpoint().toASCIIString() + "/session/");
} }
/**
* No operation.
*
* @see BaseVCloudDirectorClientLiveTest#setupRequiredClients()
*/
@Override
public void setupRequiredClients() { }
} }

View File

@ -46,7 +46,7 @@ import org.testng.annotations.Test;
@Test(groups = { "unit", "user" }, singleThreaded = true, testName = "NetworkClientExpectTest") @Test(groups = { "unit", "user" }, singleThreaded = true, testName = "NetworkClientExpectTest")
public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest { public class MediaClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
@Test @Test(enabled = false)
public void testGetMedia() { public void testGetMedia() {
URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1"); URI mediaUri = URI.create(endpoint + "/media/794eb334-754e-4917-b5a0-5df85cbd61d1");

View File

@ -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.domain.Task;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest; import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess; import org.jclouds.vcloud.director.v1_5.predicates.TaskSuccess;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups; import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -71,13 +72,21 @@ import com.google.common.collect.Iterables;
*/ */
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "MediaClientLiveTest") @Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "MediaClientLiveTest")
public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest { public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public static final String MEDIA = "media"; public static final String MEDIA = "media";
/* /*
* Convenience references to API clients. * Convenience references to API clients.
*/ */
protected MediaClient mediaClient; protected MediaClient mediaClient;
@BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() {
mediaClient = context.getApi().getMediaClient();
}
/* /*
* Shared state between dependent tests. * Shared state between dependent tests.
*/ */
@ -88,16 +97,14 @@ public class MediaClientLiveTest extends BaseVCloudDirectorClientLiveTest {
private MetadataValue metadataValue; private MetadataValue metadataValue;
private String metadataEntryValue = "value"; private String metadataEntryValue = "value";
@BeforeGroups(groups = { "live" }, dependsOnMethods = { "setupClient" }) @BeforeGroups(groups = { "live" })
public void before() { public void createReferenceData() {
String mediaId = "68dc01a4-6c76-4177-9f19-ec12bf94287c"; // TODO: inject
mediaRef = Reference.builder() mediaRef = Reference.builder()
.type("application/vnd.vmware.vcloud.media+xml") .type("application/vnd.vmware.vcloud.media+xml")
.name("") .name("")
.href(URI.create(endpoint+"/media/"+mediaId)) .href(URI.create(endpoint+"/media/" + mediaId))
.id(mediaId) .id(mediaId)
.build(); .build();
mediaClient = context.getApi().getMediaClient();
mediaClient.setMetadata(mediaRef, "key", MetadataValue.builder().value("value").build()); mediaClient.setMetadata(mediaRef, "key", MetadataValue.builder().value("value").build());
} }

View File

@ -41,13 +41,16 @@ import org.testng.annotations.Test;
@Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest") @Test(groups = { "live", "api", "user" }, singleThreaded = true, testName = "NetworkClientLiveTest")
public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest { public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
public static final String NETWORK = "network";
/* /*
* Convenience references to API clients. * Convenience references to API clients.
*/ */
private NetworkClient networkClient; protected NetworkClient networkClient;
@BeforeClass(inheritGroups = true) @BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() { public void setupRequiredClients() {
networkClient = context.getApi().getNetworkClient(); networkClient = context.getApi().getNetworkClient();
} }

View File

@ -49,6 +49,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
private OrgClient orgClient; private OrgClient orgClient;
@BeforeClass(inheritGroups = true) @BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() { public void setupRequiredClients() {
orgClient = context.getApi().getOrgClient(); orgClient = context.getApi().getOrgClient();
} }

View File

@ -43,6 +43,7 @@ public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
private QueryClient queryClient; private QueryClient queryClient;
@BeforeClass(inheritGroups = true) @BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() { public void setupRequiredClients() {
catalogClient = context.getApi().getCatalogClient(); catalogClient = context.getApi().getCatalogClient();
queryClient = context.getApi().getQueryClient(); queryClient = context.getApi().getQueryClient();

View File

@ -50,6 +50,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest {
private TaskClient taskClient; private TaskClient taskClient;
@BeforeClass(inheritGroups = true) @BeforeClass(inheritGroups = true)
@Override
public void setupRequiredClients() { public void setupRequiredClients() {
orgClient = context.getApi().getOrgClient(); orgClient = context.getApi().getOrgClient();
taskClient = context.getApi().getTaskClient(); taskClient = context.getApi().getTaskClient();

View File

@ -48,7 +48,7 @@ import com.google.inject.Module;
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@Test(groups = "live") @Test(groups = "live")
public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest { public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTest {
protected BaseVCloudDirectorClientLiveTest() { protected BaseVCloudDirectorClientLiveTest() {
provider = "vcloud-director"; provider = "vcloud-director";
@ -75,7 +75,12 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe
overrides.setProperty(provider + ".vcd-id", vDCId); overrides.setProperty(provider + ".vcd-id", vDCId);
return overrides; 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<URI> retryTaskSuccess; public Predicate<URI> retryTaskSuccess;
@Override @Override