diff --git a/labs/vcloud-director/pom.xml b/labs/vcloud-director/pom.xml
index 29028bcc02..3deb2d64b7 100644
--- a/labs/vcloud-director/pom.xml
+++ b/labs/vcloud-director/pom.xml
@@ -43,8 +43,10 @@
Public
+
+
@@ -114,9 +116,11 @@
${test.vcloud-director.image-id}
${test.vcloud-director.image.login-user}
${test.vcloud-director.image.authenticate-sudo}
+ ${test.vcloud-director.catalog-id}
${test.vcloud-director.catalog-name}
${test.vcloud-director.media-id}
${test.vcloud-director.vapptemplate-id}
+ ${test.vcloud-director.network-name}
${test.vcloud-director.network-id}
${test.vcloud-director.vdc-id}
diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncClient.java
index 5d024165f6..58d1937d5b 100644
--- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncClient.java
+++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/OrgAsyncClient.java
@@ -78,18 +78,20 @@ public interface OrgAsyncClient {
@Consumes(CONTROL_ACCESS)
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
- ListenableFuture modifyControlAccess(@EndpointParam URI orgURI, @PathParam("catalogId") String catalogId,
+ ListenableFuture modifyControlAccess(@EndpointParam URI orgRef,
+ @PathParam("catalogId") String catalogId,
@BinderParam(BindToXMLPayload.class) ControlAccessParams params);
/**
* @see OrgClient#getControlAccess(URI, URI, ControlAccessParams)
*/
- @POST
+ @GET
@Path("/catalog/{catalogId}/controlAccess")
@Consumes
@JAXBResponseParser
@ExceptionParser(ThrowVCloudErrorOn4xx.class)
- ListenableFuture getControlAccess(@EndpointParam URI orgURI, @PathParam("catalogId") String catalogId);
+ ListenableFuture getControlAccess(@EndpointParam URI orgRef,
+ @PathParam("catalogId") String catalogId);
/**
* @return asynchronous access to {@link Metadata.Readable} features
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 2ea94a3749..da745d3b64 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
@@ -145,18 +145,24 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest {
assertEquals(value.getValue(), expected, String.format(CORRECT_VALUE_OBJECT_FMT, "Value", "MetadataValue", expected, value.getValue()));
}
- @Test(testName = "GET /org/{id}/catalog/{catalogId}/controlAccess")
- public void testGetontrolAccess() {
- String catalogId = "";
+ @Test(testName = "GET /org/{id}/catalog/{catalogId}/controlAccess", dependsOnMethods = { "testGetOrg" })
+ public void testGetControlAccess() {
+ // Call the method being tested
ControlAccessParams params = orgClient.getControlAccess(orgURI, catalogId);
+
+ // Check params are well formed
checkControlAccessParams(params);
}
- @Test(testName = "GET /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testGetontrolAccess" })
+ @Test(testName = "GET /org/{id}/catalog/{catalogId}/action/controlAccess", dependsOnMethods = { "testGetControlAccess" })
public void testModifyControlAccess() {
- String catalogId = "";
+ // Setup params
ControlAccessParams params = orgClient.getControlAccess(orgURI, catalogId);
+
+ // Call the method being tested
ControlAccessParams modified = orgClient.modifyControlAccess(orgURI, catalogId, params);
+
+ // Check params are well formed
checkControlAccessParams(modified);
}
}
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 a23563d9ff..a1e26a0134 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
@@ -77,6 +77,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
+import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
@@ -112,6 +113,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
protected Session session;
protected String catalogName;
+ protected String catalogId;
protected String networkName;
protected String userName;
@@ -166,6 +168,7 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
@SuppressWarnings("unchecked")
protected void initTestParametersFromPropertiesOrLazyDiscover() {
catalogName = Strings.emptyToNull(System.getProperty("test." + provider + ".catalog-name"));
+ catalogId = Strings.emptyToNull(System.getProperty("test." + provider + ".catalog-id"));
networkName = Strings.emptyToNull(System.getProperty("test." + provider + ".network-name"));
String vAppTemplateId = Strings.emptyToNull(System.getProperty("test." + provider + ".vapptemplate-id"));
@@ -201,11 +204,20 @@ public abstract class BaseVCloudDirectorClientLiveTest extends BaseVersionedServ
networkURI = Iterables.find(thisOrg.getLinks(),
ReferenceTypePredicates. typeEquals(VCloudDirectorMediaType.ORG_NETWORK)).getHref();
- if (catalogName == null)
+ if (Strings.isNullOrEmpty(networkName))
+ networkName = Iterables.find(thisOrg.getLinks(),
+ ReferenceTypePredicates. typeEquals(VCloudDirectorMediaType.ORG_NETWORK)).getName();
+
+ if (Strings.isNullOrEmpty(catalogName))
catalogName = Iterables.find(thisOrg.getLinks(),
ReferenceTypePredicates. typeEquals(VCloudDirectorMediaType.CATALOG)).getName();
- // TODO look for default networkName
+ // FIXME the URI should be opaque
+ if (Strings.isNullOrEmpty(catalogId)) {
+ String uri = Iterables.find(thisOrg.getLinks(),
+ ReferenceTypePredicates. typeEquals(VCloudDirectorMediaType.CATALOG)).getHref().toASCIIString();
+ catalogId = Iterables.getLast(Splitter.on('/').split(uri));
+ }
}
}