diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java index d52451b1b9..2b445387b9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorAsyncClient.java @@ -23,6 +23,7 @@ import org.jclouds.vcloud.director.v1_5.domain.Session; import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient; import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient; import org.jclouds.vcloud.director.v1_5.features.OrgAsyncClient; +import org.jclouds.vcloud.director.v1_5.features.QueryAsyncClient; import org.jclouds.vcloud.director.v1_5.features.TaskAsyncClient; import com.google.inject.Provides; @@ -42,6 +43,12 @@ public interface VCloudDirectorAsyncClient { @Provides Session getCurrentSession(); + /** + * @return asynchronous access to query features + */ + @Delegate + QueryAsyncClient getQueryClient(); + /** * @return asynchronous access to {@link Org} features */ diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java index 096e0737c5..b64c125f65 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/VCloudDirectorClient.java @@ -27,13 +27,13 @@ import org.jclouds.vcloud.director.v1_5.features.CatalogClient; import org.jclouds.vcloud.director.v1_5.features.MediaClient; import org.jclouds.vcloud.director.v1_5.features.NetworkClient; import org.jclouds.vcloud.director.v1_5.features.OrgClient; +import org.jclouds.vcloud.director.v1_5.features.QueryClient; import org.jclouds.vcloud.director.v1_5.features.TaskClient; import com.google.inject.Provides; /** * Provides synchronous access to VCloudDirector. - *
* * @see VCloudDirectorAsyncClient * @author Adrian Cole @@ -41,12 +41,17 @@ import com.google.inject.Provides; @Timeout(duration = 60, timeUnit = TimeUnit.SECONDS) public interface VCloudDirectorClient { /** - * * @return the current login session */ @Provides Session getCurrentSession(); - + + /** + * @return asynchronous access to query features + */ + @Delegate + QueryClient getQueryClient(); + /** * @return synchronous access to {@link Org} features */ 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 eae847ebd3..909d347cb6 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 @@ -73,10 +73,12 @@ public class VCloudDirectorMediaType { public static final String ADMIN_USER = "application/vnd.vmware.admin.user+xml"; + public static final String QUERY_RESULT_RECORDS = "application/vnd.vmware.vcloud.query.records+xml"; + public static final ListJava class for ResourceEntity complex type. + * + *
The following schema fragment specifies the expected content contained within this class. + * + *
+ * <complexType name="ResourceEntity"> + * <complexContent> + * <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType"> + * <sequence> + * <element name="Files" type="{http://www.vmware.com/vcloud/v1.5}FilesListType" minOccurs="0"/> + * </sequence> + * <attribute name="status" type="{http://www.w3.org/2001/XMLSchema}int" /> + * <anyAttribute processContents='lax' namespace='##other'/> + * </extension> + * </complexContent> + * </complexType> + *+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ResourceEntity", propOrder = { + "files" +}) +@XmlSeeAlso({ + MediaType.class, + VAppTemplateType.class, + AbstractVAppType.class, + NetworkPoolType.class +}) +public class ResourceEntity + extends EntityType
Java class for User complex type. + * + *
The following schema fragment specifies the expected content contained within this class. + * + *
+ * <complexType name="User"> + * <complexContent> + * <extension base="{http://www.vmware.com/vcloud/v1.5}EntityType"> + * <sequence> + * <element name="FullName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="EmailAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="Telephone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="IsEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="IsLocked" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="IM" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="NameInSource" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="IsAlertEnabled" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="AlertEmailPrefix" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="AlertEmail" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="IsExternal" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="IsDefaultCached" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="IsGroupRole" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> + * <element name="StoredVmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> + * <element name="DeployedVmQuota" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> + * <element name="Role" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/> + * <element name="Password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> + * <element name="GroupReferences" type="{http://www.vmware.com/vcloud/v1.5}GroupsListType" minOccurs="0"/> + * </sequence> + * <anyAttribute processContents='lax' namespace='##other'/> + * </extension> + * </complexContent> + * </complexType> + *+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "User", propOrder = { + "fullName", + "emailAddress", + "telephone", + "isEnabled", + "isLocked", + "im", + "nameInSource", + "isAlertEnabled", + "alertEmailPrefix", + "alertEmail", + "isExternal", + "isDefaultCached", + "isGroupRole", + "storedVmQuota", + "deployedVmQuota", + "role", + "password", + "groupReferences" +}) +public class User + extends EntityType
+ * <complexType name="Container" /> + *+ * + * @author grkvlt@apache.org + */ +public class ContainerType
+ * <complexType name="QueryResultCatalogRecord" /> + *+ * + * @author grkvlt@apache.org + */ +public class QueryResultCatalogRecord extends QueryResultRecordType
+ * <complexType name="QueryResultNetworkRecord" /> + *+ * + * @author grkvlt@apache.org + */ +public class QueryResultNetworkRecord extends QueryResultRecordType
+ * <complexType name="QueryResultRecordType" /> + *+ * + * @author grkvlt@apache.org + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class QueryResultRecordType
+ * <complexType name="QueryResultRecords" /> + *+ * + * @author grkvlt@apache.org + */ +public class QueryResultRecords extends ContainerType
Java class for AbstractVAppType complex type. + * + *
The following schema fragment specifies the expected content contained within this class. + * + *
+ * <complexType name="AbstractVAppType"> + * <complexContent> + * <extension base="{http://www.vmware.com/vcloud/v1.5}ResourceEntityType"> + * <sequence> + * <element name="VAppParent" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" minOccurs="0"/> + * <element ref="{http://schemas.dmtf.org/ovf/envelope/1}Section" maxOccurs="unbounded" minOccurs="0"/> + * </sequence> + * <attribute name="deployed" type="{http://www.w3.org/2001/XMLSchema}boolean" /> + * <anyAttribute processContents='lax' namespace='##other'/> + * </extension> + * </complexContent> + * </complexType> + *+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "AbstractVAppType", propOrder = { + "vAppParent", + "section" +}) +@XmlSeeAlso({ + VmType.class, + VAppType.class +}) +public abstract class AbstractVAppType + extends ResourceEntityType +{ + + @XmlElement(name = "VAppParent") + protected ReferenceType vAppParent; + @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) + protected List
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a set
method for the section property.
+ *
+ *
+ * For example, to add a new item, do as follows: + *
+ * getSection().add(newItem); + *+ * + * + *
+ * Objects of the following type(s) are allowed in the list
+ * {@link JAXBElement }{@code <}{@link SectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link VirtualHardwareSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link LeaseSettingsSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link EulaSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link RuntimeInfoSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link AnnotationSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link DeploymentOptionSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link StartupSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link ResourceAllocationSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link NetworkConnectionSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link CustomizationSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link ProductSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link GuestCustomizationSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link OperatingSystemSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link NetworkConfigSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link NetworkSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link DiskSectionType }{@code >}
+ * {@link JAXBElement }{@code <}{@link InstallSectionType }{@code >}
+ *
+ *
+ */
+ public List Java class for VApp complex type.
+ *
+ * The following schema fragment specifies the expected content contained within this class.
+ *
+ *
+ * <complexType name="VApp">
+ * <complexContent>
+ * <extension base="{http://www.vmware.com/vcloud/v1.5}AbstractVApp">
+ * <sequence>
+ * <element name="Owner" type="{http://www.vmware.com/vcloud/v1.5}OwnerType" minOccurs="0"/>
+ * <element name="InMaintenanceMode" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * <element name="Children" type="{http://www.vmware.com/vcloud/v1.5}VAppChildrenType" minOccurs="0"/>
+ * </sequence>
+ * <attribute name="ovfDescriptorUploaded" type="{http://www.w3.org/2001/XMLSchema}boolean" />
+ * <anyAttribute processContents='lax' namespace='##other'/>
+ * </extension>
+ * </complexContent>
+ * </complexType>
+ *
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "VApp", propOrder = {
+ "owner",
+ "inMaintenanceMode",
+ "children"
+})
+public class VApp
+ extends AbstractVAppType
+ * GET /query/
+ *
+ */
+ ContainerType query(String queryParams);
+
+ /**
+ * Retrieves a list of Catalogs by using REST API general QueryHandler.
+ *
+ * If filter is provided it will be applied to the corresponding result set.
+ * Format determines the elements representation - references or records.
+ * Default format is references.
+ *
+ *
+ * GET /catalogs/query/
+ *
+ *
+ * @param orgId the unique id for the organization
+ * @return a list of tasks
+ */
+ ContainerType catalogsQuery(ReferenceType> orgRef);
+}
diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java
index ba26090415..819d5861c7 100644
--- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java
+++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogClientLiveTest.java
@@ -33,55 +33,30 @@ import org.testng.annotations.Test;
import com.google.common.collect.Iterables;
/**
-* Tests live behavior of {@link taskClient}.
-*
-* @author grkvlt@apache.task
-*/
-@Test(groups = { "live", "apitests" }, testName = "TaskClientLiveTest")
+ * Tests live behavior of {@link CatalogClient}.
+ *
+ * @author grkvlt@apache.org
+ */
+@Test(groups = { "live", "apitests" }, testName = "CatalogClientLiveTest")
public class CatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest {
+ /*
+ * Convenience references to API clients.
+ */
+
+ private final CatalogClient catalogClient = context.getApi().getCatalogClient();
+ private final QueryClient queryClient = context.getApi().getQueryClient();
+
/*
* Shared state between dependant tests.
*/
-
- private OrgList orgList;
- private Reference orgRef;
- private TasksList taskList;
- private Task task;
- private URI taskUri;
-
- @Test(testName = "GET /tasksList/{id}")
+
+ private Reference catalogRef;
+ private Catalog catalog;
+
+ @Test(testName = "GET /catalog/{id}")
public void testGetTaskList() {
- orgList = context.getApi().getOrgClient().getOrgList();
- orgRef = Iterables.getFirst(orgList.getOrgs(), null);
-
- // Call the method being tested
- taskList = context.getApi().getTaskClient().getTaskList(orgRef);
-
- // NOTE The environment MUST have ...
-
- // Check required elements and attributes
- assertFalse(Iterables.isEmpty(taskList.getTasks()), "There must always be Task elements in the TaskList");
-
- for (Task task : taskList.getTasks()) {
- checkTask(task);
- }
+ catalogRef = null;
+ catalog = catalogClient.getCatalog(catalogRef);
}
-
- @Test(testName = "GET /task/{id}", dependsOnMethods = { "testGetTaskList" })
- public void testGetTask() {
- taskUri = Iterables.getFirst(taskList.getTasks(), null).getHref();
-
- // Call the method being tested
- task = context.getApi().getTaskClient().getTask(taskUri);
-
- // Check required elements and attributes
- checkTask(task);
- }
-
- @Test(testName = "GET /task/{id}/metadata/", dependsOnMethods = { "testGetTask" })
- public void testCancelTask() {
- // Call the method being tested
- context.getApi().getTaskClient().cancelTask(taskUri);
- }
-}
\ No newline at end of file
+}
diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientExpectTest.java
new file mode 100644
index 0000000000..5bba119b06
--- /dev/null
+++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientExpectTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.vcloud.director.v1_5.features;
+
+import static org.testng.Assert.*;
+
+import java.net.URI;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
+import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
+import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
+import org.jclouds.vcloud.director.v1_5.domain.Error;
+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.TasksList;
+import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMultimap;
+
+/**
+ * Test the {@link TaskClient} by observing its side effects.
+ *
+ * @author grkvlt@apache.org
+ */
+@Test(groups = "unit", singleThreaded = true, testName = "QueryClientExpectTest")
+public class QueryClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
+
+ @Test
+ public void testQueryCatalogNoParam() {
+ assertTrue(true);
+ }
+}
+
\ No newline at end of file
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
new file mode 100644
index 0000000000..f90f927e2a
--- /dev/null
+++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/QueryClientLiveTest.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.vcloud.director.v1_5.features;
+
+import static org.jclouds.vcloud.director.v1_5.VCloudDirectorLiveTestConstants.*;
+import static org.jclouds.vcloud.director.v1_5.domain.Checks.*;
+import static org.testng.Assert.*;
+
+import java.net.URI;
+
+import org.jclouds.vcloud.director.v1_5.domain.Metadata;
+import org.jclouds.vcloud.director.v1_5.domain.MetadataEntry;
+import org.jclouds.vcloud.director.v1_5.domain.OrgList;
+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.TasksList;
+import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+
+/**
+* Tests live behavior of {@link QueryClient}.
+*
+* @author grkvlt@apache.org
+*/
+@Test(groups = { "live", "apitests" }, testName = "QueryClientLiveTest")
+public class QueryClientLiveTest extends BaseVCloudDirectorClientLiveTest {
+
+ /*
+ * Convenience references to API clients.
+ */
+
+ private final CatalogClient catalogClient = context.getApi().getCatalogClient();
+ private final QueryClient queryClient = context.getApi().getQueryClient();
+
+ /*
+ * Shared state between dependant tests.
+ */
+
+ private OrgList orgList;
+ private Reference orgRef;
+ private TasksList taskList;
+ private Task task;
+ private URI taskUri;
+
+ @Test(testName = "GET /catalogs/query/")
+ public void testQueryCatalogNoParam() {
+ assertTrue(true);
+ }
+}
\ No newline at end of file
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 5bd2cb9c4b..249f9707ad 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
@@ -62,3 +62,4 @@ public class BaseVCloudDirectorClientLiveTest extends BaseVersionedServiceLiveTe
}
}
+
diff --git a/labs/vcloud-director/src/test/resources/query/allCatalogs.xml b/labs/vcloud-director/src/test/resources/query/allCatalogs.xml
new file mode 100644
index 0000000000..da801692f3
--- /dev/null
+++ b/labs/vcloud-director/src/test/resources/query/allCatalogs.xml
@@ -0,0 +1,8 @@
+
+