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(
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,

View File

@ -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() { }
}

View File

@ -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");

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.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());
}

View File

@ -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();
}

View File

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

View File

@ -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();

View File

@ -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();

View File

@ -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";
@ -76,6 +76,11 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe
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;
@Override