Add extra system properties for customising live User API. - including modifying NetworkClientLiveTest to use 'network-id' property

This commit is contained in:
Andrew Donald Kennedy 2012-02-16 19:56:28 +00:00
parent c42137ab08
commit a6b47cda5f
3 changed files with 32 additions and 10 deletions

View File

@ -42,6 +42,11 @@
<test.vcloud-director.image-id></test.vcloud-director.image-id> <test.vcloud-director.image-id></test.vcloud-director.image-id>
<test.vcloud-director.image.login-user></test.vcloud-director.image.login-user> <test.vcloud-director.image.login-user></test.vcloud-director.image.login-user>
<test.vcloud-director.image.authenticate-sudo></test.vcloud-director.image.authenticate-sudo> <test.vcloud-director.image.authenticate-sudo></test.vcloud-director.image.authenticate-sudo>
<test.vcloud-director.catalog-name></test.vcloud-director.catalog-name>
<test.vcloud-director.media-id></test.vcloud-director.media-id>
<test.vcloud-director.vapptemplate-id></test.vcloud-director.vapptemplate-id>
<test.vcloud-director.network-id></test.vcloud-director.network-id>
<test.vcloud-director.vdc-id></test.vcloud-director.vdc-id>
</properties> </properties>
<dependencies> <dependencies>
@ -109,6 +114,11 @@
<test.vcloud-director.image-id>${test.vcloud-director.image-id}</test.vcloud-director.image-id> <test.vcloud-director.image-id>${test.vcloud-director.image-id}</test.vcloud-director.image-id>
<test.vcloud-director.image.login-user>${test.vcloud-director.image.login-user}</test.vcloud-director.image.login-user> <test.vcloud-director.image.login-user>${test.vcloud-director.image.login-user}</test.vcloud-director.image.login-user>
<test.vcloud-director.image.authenticate-sudo>${test.vcloud-director.image.authenticate-sudo}</test.vcloud-director.image.authenticate-sudo> <test.vcloud-director.image.authenticate-sudo>${test.vcloud-director.image.authenticate-sudo}</test.vcloud-director.image.authenticate-sudo>
<test.vcloud-director.catalog-name>${test.vcloud-director.catalog-name}</test.vcloud-director.catalog-name>
<test.vcloud-director.media-id>${test.vcloud-director.media-id}</test.vcloud-director.media-id>
<test.vcloud-director.vapptemplate-id>${test.vcloud-director.vapptemplate-id}</test.vcloud-director.vapptemplate-id>
<test.vcloud-director.network-id>${test.vcloud-director.network-id}</test.vcloud-director.network-id>
<test.vcloud-director.vdc-id>${test.vcloud-director.vdc-id}</test.vcloud-director.vdc-id>
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</execution> </execution>

View File

@ -40,14 +40,10 @@ import org.testng.annotations.Test;
@Test(groups = { "live", "apitests" }, testName = "NetworkClientLiveTest") @Test(groups = { "live", "apitests" }, testName = "NetworkClientLiveTest")
public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest { public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
// @Before populate
String networkId = "55a677cf-ab3f-48ae-b880-fab90421980c";
String catalogId = "9e08c2f6-077a-42ce-bece-d5332e2ebb5c";
@Test(testName = "GET /network/{id}") @Test(testName = "GET /network/{id}")
public void testWhenResponseIs2xxLoginReturnsValidNetwork() { public void testWhenResponseIs2xxLoginReturnsValidNetwork() {
Reference networkRef = Reference.builder() Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/"+networkId)).build(); .href(URI.create(endpoint + "/network/" + networkId)).build();
OrgNetwork network = context.getApi().getNetworkClient().getNetwork(networkRef); OrgNetwork network = context.getApi().getNetworkClient().getNetwork(networkRef);
@ -77,8 +73,8 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /network/{catalog_id}", enabled=false) @Test(testName = "GET /network/{catalog_id}", enabled=false)
public void testWhenResponseIs403ForCatalogIdUsedAsNetworkId() { public void testWhenResponseIs403ForCatalogIdUsedAsNetworkId() {
Reference networkRef = Reference.builder() String catalogId = "7212e451-76e1-4631-b2de-ba1dfd8080e4";
.href(URI.create(endpoint + "/network"+catalogId)).build(); Reference networkRef = Reference.builder().href(URI.create(endpoint + "/network/" + catalogId)).build();
Error expected = Error.builder() Error expected = Error.builder()
.message("This operation is denied.") .message("This operation is denied.")
@ -120,7 +116,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /network/{id}/metadata") @Test(testName = "GET /network/{id}/metadata")
public void testWhenResponseIs2xxLoginReturnsValidMetadataList() { public void testWhenResponseIs2xxLoginReturnsValidMetadataList() {
Reference networkRef = Reference.builder() Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/"+networkId)).build(); .href(URI.create(endpoint + "/network/" + networkId)).build();
Metadata expected = context.getApi().getNetworkClient().getMetadata(networkRef); Metadata expected = context.getApi().getNetworkClient().getMetadata(networkRef);
@ -135,7 +131,7 @@ public class NetworkClientLiveTest extends BaseVCloudDirectorClientLiveTest {
@Test(testName = "GET /network/{id}/metadata", enabled=false) @Test(testName = "GET /network/{id}/metadata", enabled=false)
public void testWhenResponseIs2xxLoginReturnsValidMetadataEntry() { public void testWhenResponseIs2xxLoginReturnsValidMetadataEntry() {
Reference networkRef = Reference.builder() Reference networkRef = Reference.builder()
.href(URI.create(endpoint + "/network/"+networkId)).build(); .href(URI.create(endpoint + "/network/" + networkId)).build();
MetadataEntry expected = context.getApi().getNetworkClient().getMetadataEntry(networkRef, metadataKey); MetadataEntry expected = context.getApi().getNetworkClient().getMetadataEntry(networkRef, metadataKey);

View File

@ -35,7 +35,7 @@ import com.google.common.collect.ImmutableSet;
import com.google.inject.Module; import com.google.inject.Module;
/** /**
* Tests behavior of {@code VCloudDirectorClient} * Tests behavior of {@link VCloudDirectorClient} and acts as parent for other client live tests.
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@ -47,6 +47,22 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe
protected RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context; protected RestContext<VCloudDirectorClient, VCloudDirectorAsyncClient> context;
protected String catalogName;
protected String mediaId;
protected String vAppTemplateId;
protected String networkId;
protected String vDCId;
@Override
protected void setupCredentials() {
super.setupCredentials();
catalogName = System.getProperty("test." + provider + ".catalog-name", "Public");
mediaId = System.getProperty("test." + provider + ".media-id");
vAppTemplateId = System.getProperty("test." + provider + ".vapptemplate-id");
networkId = System.getProperty("test." + provider + ".network-id");
vDCId = System.getProperty("test." + provider + ".vdc-id");
}
@BeforeGroups(groups = { "live" }) @BeforeGroups(groups = { "live" })
public void setupClient() { public void setupClient() {
setupCredentials(); setupCredentials();