You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/08/29 20:31:53 UTC
[11/14] JCLOUDS-166,
JCLOUDS-167 - Removing async from vcloud and Terremark APIs/providers
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java
deleted file mode 100644
index 78a4b80..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogAsyncClientTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
-import org.jclouds.vcloud.options.CatalogItemOptions;
-import org.jclouds.vcloud.xml.CatalogHandler;
-import org.jclouds.vcloud.xml.CatalogItemHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code CatalogAsyncClient}
- *
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "CatalogAsyncClientTest")
-public class CatalogAsyncClientTest extends BaseVCloudAsyncClientTest<CatalogAsyncClient> {
-
- public void testCatalog() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(CatalogAsyncClient.class, "getCatalog", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1")));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, CatalogHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testCatalogInOrg() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(CatalogAsyncClient.class, "findCatalogInOrgNamed", String.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog"));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalog/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalog+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, CatalogHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testCatalogItemURI() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(CatalogAsyncClient.class, "getCatalogItem", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2")));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testFindCatalogItemInOrgCatalogNamed() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(CatalogAsyncClient.class, "findCatalogItemInOrgCatalogNamed", String.class,
- String.class, String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "catalog", "item"));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/catalogItem/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testAddVAppTemplateOrMediaImageToCatalogAndNameItem() throws SecurityException, NoSuchMethodException,
- IOException {
- Invokable<?, ?> method = method(CatalogAsyncClient.class, "addVAppTemplateOrMediaImageToCatalogAndNameItem", URI.class,
- URI.class, String.class, CatalogItemOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI.create("http://fooentity"), URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/catalog/1"), "myname", CatalogItemOptions.Builder
- .description("mydescription")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/catalog/1/catalogItems HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.catalogItem+xml\n");
- assertPayloadEquals(
- request,
- "<CatalogItem xmlns=\"http://www.vmware.com/vcloud/v1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" name=\"myname\" xsi:schemaLocation=\"http://www.vmware.com/vcloud/v1 http://vcloud.safesecureweb.com/ns/vcloud.xsd\"><Description>mydescription</Description><Entity href=\"http://fooentity\"/></CatalogItem>",
- "application/vnd.vmware.vcloud.catalogItem+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, CatalogItemHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogClientLiveTest.java
deleted file mode 100644
index e95be41..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/CatalogClientLiveTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.rest.annotations.ApiVersion;
-import org.jclouds.vcloud.VCloudMediaType;
-import org.jclouds.vcloud.domain.Org;
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.inject.Key;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "CatalogClientLiveTest")
-public class CatalogClientLiveTest extends BaseVCloudClientLiveTest {
- @Test
- public void testGetCatalog() throws Exception {
- Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
- for (ReferenceType catalog : org.getCatalogs().values()) {
- assertEquals(catalog.getType(), VCloudMediaType.CATALOG_XML);
- assertNotNull(getVCloudApi().getCatalogClient().getCatalog(catalog.getHref()));
- }
- }
-
- @Test
- public void testFindCatalogIsWriteableIfNotVersion1_5() throws Exception {
- // when we are in vCloud 1.0.0 public catalogs don't work, so our default
- // catalog is private
- if (!view.utils().injector().getInstance(Key.get(String.class, ApiVersion.class)).startsWith("1.5"))
- assertTrue(getVCloudApi().getCatalogClient().findCatalogInOrgNamed(null, null).isReadOnly());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
new file mode 100644
index 0000000..c9c6e4f
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkApiLiveTest")
+public class NetworkApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
new file mode 100644
index 0000000..0d23a22
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkApiTest.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.OrgNetworkHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code NetworkApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "NetworkApiTest")
+public class NetworkApiTest extends BaseVCloudApiTest<NetworkApi> {
+
+ public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(NetworkApi.class, "getNetwork", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/network/2")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(NetworkApi.class, "findNetworkInOrgVDCNamed", String.class, String.class,
+ String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
+
+ assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java
deleted file mode 100644
index 2294285..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkAsyncClientTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
-import org.jclouds.vcloud.xml.OrgNetworkHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code NetworkAsyncClient}
- *
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "NetworkAsyncClientTest")
-public class NetworkAsyncClientTest extends BaseVCloudAsyncClientTest<NetworkAsyncClient> {
-
- public void testNetwork() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(NetworkAsyncClient.class, "getNetwork", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/network/2")));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/network/2 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testFindNetworkInOrgVDCNamed() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(NetworkAsyncClient.class, "findNetworkInOrgVDCNamed", String.class, String.class,
- String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org", "vdc", "network"));
-
- assertRequestLineEquals(request, "GET https://vcloud.safesecureweb.com/network/1990 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.network+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, OrgNetworkHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkClientLiveTest.java
deleted file mode 100644
index 1e91ac9..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/NetworkClientLiveTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "NetworkClientLiveTest")
-public class NetworkClientLiveTest extends BaseVCloudClientLiveTest {
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
new file mode 100644
index 0000000..91a06e8
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiLiveTest.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgApiLiveTest")
+public class OrgApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testListOrgs() throws Exception {
+ for (ReferenceType response : getVCloudApi().getOrgClient().listOrgs().values()) {
+ assertNotNull(response);
+ assertNotNull(response.getName());
+ assertNotNull(response.getHref());
+ assertEquals(getVCloudApi().getOrgClient().getOrg(response.getHref()).getName(), response.getName());
+ assertEquals(getVCloudApi().getOrgClient().findOrgNamed(response.getName()).getName(), response.getName());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
new file mode 100644
index 0000000..0f9fc72
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgApiTest.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.OrgHandler;
+import org.jclouds.vcloud.xml.OrgListHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code OrgApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "OrgApiTest")
+public class OrgApiTest extends BaseVCloudApiTest<OrgApi> {
+
+ public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "listOrgs");
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.orgList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgListHandler.class);
+ assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+ checkFilters(request);
+ }
+
+ public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "getOrg", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(OrgApi.class, "findOrgNamed", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, OrgHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java
deleted file mode 100644
index 82eed46..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgAsyncClientTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
-import org.jclouds.vcloud.xml.OrgHandler;
-import org.jclouds.vcloud.xml.OrgListHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code OrgAsyncClient}
- *
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "OrgAsyncClientTest")
-public class OrgAsyncClientTest extends BaseVCloudAsyncClientTest<OrgAsyncClient> {
-
- public void testlistOrgs() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(OrgAsyncClient.class, "listOrgs");
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.of());
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.orgList+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, OrgListHandler.class);
- assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
- checkFilters(request);
- }
-
- public void testOrg() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(OrgAsyncClient.class, "getOrg", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/org/1")));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, OrgHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testFindOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(OrgAsyncClient.class, "findOrgNamed", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/org/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.org+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, OrgHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgClientLiveTest.java
deleted file mode 100644
index aa944c2..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/OrgClientLiveTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import org.jclouds.vcloud.domain.ReferenceType;
-import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "OrgClientLiveTest")
-public class OrgClientLiveTest extends BaseVCloudClientLiveTest {
-
- @Test
- public void testListOrgs() throws Exception {
- for (ReferenceType response : getVCloudApi().getOrgClient().listOrgs().values()) {
- assertNotNull(response);
- assertNotNull(response.getName());
- assertNotNull(response.getHref());
- assertEquals(getVCloudApi().getOrgClient().getOrg(response.getHref()).getName(), response.getName());
- assertEquals(getVCloudApi().getOrgClient().findOrgNamed(response.getName()).getName(), response.getName());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
new file mode 100644
index 0000000..4a87247
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiLiveTest.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskApiLiveTest")
+public class TaskApiLiveTest extends BaseVCloudApiLiveTest {
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
new file mode 100644
index 0000000..4c3ee51
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskApiTest.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.TasksListHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code TaskApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "TaskApiTest")
+public class TaskApiTest extends BaseVCloudApiTest<TaskApi> {
+
+ public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "getTasksList", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "findTasksListInOrgNamed", String.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TasksListHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "getTask", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(TaskApi.class, "cancelTask", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java
deleted file mode 100644
index cac82ab..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskAsyncClientTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
-import org.jclouds.vcloud.xml.TaskHandler;
-import org.jclouds.vcloud.xml.TasksListHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code TaskAsyncClient}
- *
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "TaskAsyncClientTest")
-public class TaskAsyncClientTest extends BaseVCloudAsyncClientTest<TaskAsyncClient> {
-
- public void testGetTasksList() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(TaskAsyncClient.class, "getTasksList", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/tasksList/1")));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TasksListHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testFindTasksListInOrgNamed() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(TaskAsyncClient.class, "findTasksListInOrgNamed", String.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of("org"));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/tasksList/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.tasksList+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TasksListHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testGetTask() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(TaskAsyncClient.class, "getTask", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/task/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testCancelTask() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(TaskAsyncClient.class, "cancelTask", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/task/1")));
-
- assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/task/1/action/cancel HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskClientLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskClientLiveTest.java
deleted file mode 100644
index b6b67b0..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/TaskClientLiveTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import org.jclouds.vcloud.internal.BaseVCloudClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Adrian Cole
- */
-@Test(groups = "live", enabled = true, singleThreaded = true, testName = "TaskClientLiveTest")
-public class TaskClientLiveTest extends BaseVCloudClientLiveTest {
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
new file mode 100644
index 0000000..dd73785
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiLiveTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.testng.Assert.assertNotNull;
+
+import org.jclouds.vcloud.VCloudMediaType;
+import org.jclouds.vcloud.domain.Org;
+import org.jclouds.vcloud.domain.ReferenceType;
+import org.jclouds.vcloud.domain.VApp;
+import org.jclouds.vcloud.domain.VDC;
+import org.jclouds.vcloud.internal.BaseVCloudApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+@Test(groups = "live", enabled = true, singleThreaded = true, testName = "VAppApiLiveTest")
+public class VAppApiLiveTest extends BaseVCloudApiLiveTest {
+
+ @Test
+ public void testGetVApp() throws Exception {
+ Org org = getVCloudApi().getOrgClient().findOrgNamed(null);
+ for (ReferenceType vdc : org.getVDCs().values()) {
+ VDC response = getVCloudApi().getVDCClient().getVDC(vdc.getHref());
+ for (ReferenceType item : response.getResourceEntities().values()) {
+ if (item.getType().equals(VCloudMediaType.VAPP_XML)) {
+ try {
+ VApp app = getVCloudApi().getVAppClient().getVApp(item.getHref());
+ assertNotNull(app);
+ } catch (RuntimeException e) {
+
+ }
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
new file mode 100644
index 0000000..d8ec98f
--- /dev/null
+++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppApiTest.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+import org.jclouds.http.functions.ParseSax;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.jclouds.util.Strings2;
+import org.jclouds.vcloud.internal.BaseVCloudApiTest;
+import org.jclouds.vcloud.options.CloneVAppOptions;
+import org.jclouds.vcloud.xml.TaskHandler;
+import org.jclouds.vcloud.xml.VAppHandler;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code VAppApi}
+ *
+ * @author Adrian Cole
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during
+// surefire
+@Test(groups = "unit", testName = "VAppApiTest")
+public class VAppApiTest extends BaseVCloudApiTest<VAppApi> {
+
+ public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapp"));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp-default.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testCopyVAppToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
+ .deploy().powerOn().description("The description of the new vApp")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testMoveVAppToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class,
+ CloneVAppOptions[].class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
+ .deploy().powerOn().description("The description of the new vApp")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVApp.xml")),
+ "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deployVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeployAndPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deployAndPowerOnVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
+ "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "getVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, VAppHandler.class);
+ assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testRebootVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "rebootVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "undeployVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testUndeployAndSaveStateOfVAppSaveState() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "undeployAndSaveStateOfVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request,
+ "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
+ "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "deleteVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "powerOnVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "powerOffVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "resetVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "suspendVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ParseSax.class);
+ assertSaxResponseParserClassEquals(method, TaskHandler.class);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+ public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
+ Invokable<?, ?> method = method(VAppApi.class, "shutdownVApp", URI.class);
+ GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
+ .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
+
+ assertRequestLineEquals(request,
+ "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
+ assertNonPayloadHeadersEqual(request, "");
+ assertPayloadEquals(request, null, null, false);
+
+ assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
+ assertSaxResponseParserClassEquals(method, null);
+ assertFallbackClassEquals(method, null);
+
+ checkFilters(request);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/a61ad06c/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java
deleted file mode 100644
index af4fd5c..0000000
--- a/apis/vcloud/src/test/java/org/jclouds/vcloud/features/VAppAsyncClientTest.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.jclouds.util.Strings2;
-import org.jclouds.vcloud.internal.BaseVCloudAsyncClientTest;
-import org.jclouds.vcloud.options.CloneVAppOptions;
-import org.jclouds.vcloud.xml.TaskHandler;
-import org.jclouds.vcloud.xml.VAppHandler;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code VAppAsyncClient}
- *
- * @author Adrian Cole
- */
-// NOTE:without testName, this will not call @Before* and fail w/NPE during
-// surefire
-@Test(groups = "unit", testName = "VAppAsyncClientTest")
-public class VAppAsyncClientTest extends BaseVCloudAsyncClientTest<VAppAsyncClient> {
-
- public void testopyVAppToVDCAndName() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
- CloneVAppOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/4181"), URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "my-vapp"));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp-default.xml")),
- "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testCopyVAppToVDCAndNameOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "copyVAppToVDCAndName", URI.class, URI.class, String.class,
- CloneVAppOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
- .deploy().powerOn().description("The description of the new vApp")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/copyVApp.xml")),
- "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testMoveVAppToVDCAndRenameOptions() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "moveVAppToVDCAndRename", URI.class, URI.class, String.class,
- CloneVAppOptions[].class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vapp/201"), URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vdc/1"), "new-linux-server", new CloneVAppOptions()
- .deploy().powerOn().description("The description of the new vApp")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vdc/1/action/cloneVApp HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, Strings2.toStringAndClose(getClass().getResourceAsStream("/moveVApp.xml")),
- "application/vnd.vmware.vcloud.cloneVAppParams+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testDeployVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "deployVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
- "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testDeployAndPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "deployAndPowerOnVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request, "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/deploy HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, "<DeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" powerOn=\"true\"/>",
- "application/vnd.vmware.vcloud.deployVAppParams+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testGetVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "getVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request, "GET https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.vApp+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, VAppHandler.class);
- assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testRebootVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "rebootVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reboot HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testUndeployVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "undeployVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\"/>",
- "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testUndeployAndSaveStateOfVAppSaveState() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "undeployAndSaveStateOfVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/action/undeploy HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request,
- "<UndeployVAppParams xmlns=\"http://www.vmware.com/vcloud/v1\" saveState=\"true\"/>",
- "application/vnd.vmware.vcloud.undeployVAppParams+xml", false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testDeleteVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "deleteVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request, "DELETE https://vcenterprise.bluelock.com/api/v1.0/vApp/1 HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, VoidOnNotFoundOr404.class);
-
- checkFilters(request);
- }
-
- public void testPowerOnVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "powerOnVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOn HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testPowerOffVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "powerOffVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/powerOff HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testResetVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "resetVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/reset HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testSuspendVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "suspendVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/suspend HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "Accept: application/vnd.vmware.vcloud.task+xml\n");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ParseSax.class);
- assertSaxResponseParserClassEquals(method, TaskHandler.class);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
- public void testShutdownVApp() throws SecurityException, NoSuchMethodException, IOException {
- Invokable<?, ?> method = method(VAppAsyncClient.class, "shutdownVApp", URI.class);
- GeneratedHttpRequest request = processor.createRequest(method, ImmutableList.<Object> of(URI
- .create("https://vcenterprise.bluelock.com/api/v1.0/vApp/1")));
-
- assertRequestLineEquals(request,
- "POST https://vcenterprise.bluelock.com/api/v1.0/vApp/1/power/action/shutdown HTTP/1.1");
- assertNonPayloadHeadersEqual(request, "");
- assertPayloadEquals(request, null, null, false);
-
- assertResponseParserClassEquals(method, request, ReleasePayloadAndReturn.class);
- assertSaxResponseParserClassEquals(method, null);
- assertFallbackClassEquals(method, null);
-
- checkFilters(request);
- }
-
-}