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/07/01 21:14:58 UTC

[11/24] JCLOUDS-151 - CloudStack refactored to remove async, *Client renamed to *Api.

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
deleted file mode 100644
index d861f53..0000000
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java
+++ /dev/null
@@ -1,94 +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.cloudstack.features;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Set;
-
-import org.jclouds.cloudstack.domain.AllocationState;
-import org.jclouds.cloudstack.domain.Cluster;
-import org.jclouds.cloudstack.domain.Host;
-import org.jclouds.cloudstack.internal.BaseCloudStackClientLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Strings;
-
-/**
- * Tests behavior of {@code GlobalHostClient}
- *
- * @author Andrei Savu
- */
-@Test(groups = "live", singleThreaded = true, testName = "GlobalHostClientLiveTest")
-public class GlobalHostClientLiveTest extends BaseCloudStackClientLiveTest {
-
-   @Test(groups = "live", enabled = true)
-   public void testListHosts() throws Exception {
-      skipIfNotGlobalAdmin();
-
-      Set<Host> hosts = globalAdminClient.getHostClient().listHosts();
-      assert hosts.size() > 0 : hosts;
-
-      for(Host host : hosts) {
-         checkHost(host);
-      }
-   }
-
-   private void checkHost(Host host) {
-      if (host.getType() == Host.Type.ROUTING) {
-         assert host.getCpuNumber() > 0;
-         assert host.getAverageLoad() >= 0;
-         assert host.getHypervisor() != null;
-      }
-      assert host.getAllocationState() != null;
-      assert host.getEvents() != null;
-      if (host.getType() == Host.Type.SECONDARY_STORAGE_VM) {
-         assert host.getName().startsWith("s-");
-      }
-      if (host.getType() == Host.Type.CONSOLE_PROXY) {
-         assert host.getName().startsWith("v-");
-      }
-   }
-
-   @Test(groups = "live", enabled = true)
-   public void testListClusters() throws Exception {
-      skipIfNotGlobalAdmin();
-
-      Set<Cluster> clusters = globalAdminClient.getHostClient().listClusters();
-      assert clusters.size() > 0 : clusters;
-
-      for(Cluster cluster : clusters) {
-         checkCluster(cluster);
-      }
-   }
-
-   private void checkCluster(Cluster cluster) {
-      assertNotNull(cluster.getId());
-      assertFalse(Strings.isNullOrEmpty(cluster.getName()));
-      assertNotEquals(AllocationState.UNKNOWN, cluster.getAllocationState());
-      assertNotEquals(Host.ClusterType.UNKNOWN, cluster.getClusterType());
-      assertFalse(Strings.isNullOrEmpty(cluster.getHypervisor()));
-      assertNotEquals(Cluster.ManagedState.UNRECOGNIZED, cluster.getManagedState());
-      assertNotNull(cluster.getPodId());
-      assertFalse(Strings.isNullOrEmpty(cluster.getPodName()));
-      assertNotNull(cluster.getZoneId());
-      assertFalse(Strings.isNullOrEmpty(cluster.getZoneName()));
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiLiveTest.java
new file mode 100644
index 0000000..653efa9
--- /dev/null
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiLiveTest.java
@@ -0,0 +1,154 @@
+/*
+ * 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.cloudstack.features;
+
+import static com.google.common.collect.Iterables.getFirst;
+import static org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.OPTIONAL;
+import static org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.REQUIRED;
+import static org.jclouds.cloudstack.options.CreateDiskOfferingOptions.Builder.diskSizeInGB;
+import static org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.highlyAvailable;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import org.jclouds.cloudstack.domain.DiskOffering;
+import org.jclouds.cloudstack.domain.NetworkOffering;
+import org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType;
+import org.jclouds.cloudstack.domain.ServiceOffering;
+import org.jclouds.cloudstack.domain.StorageType;
+import org.jclouds.cloudstack.internal.BaseCloudStackApiLiveTest;
+import org.jclouds.cloudstack.options.UpdateDiskOfferingOptions;
+import org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions;
+import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
+import org.jclouds.logging.Logger;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code GlobalOfferingApi}
+ *
+ * @author Andrei Savu
+ */
+@Test(groups = "live", singleThreaded = true, testName = "GlobalOfferingApiLiveTest")
+public class GlobalOfferingApiLiveTest extends BaseCloudStackApiLiveTest {
+
+   @Test(groups = "live", enabled = true)
+   public void testCreateServiceOffering() throws Exception {
+      skipIfNotGlobalAdmin();
+
+      String name = prefix + "-test-create-service-offering";
+      String displayText = name + "-display";
+      ServiceOffering offering = null;
+      try {
+         offering = globalAdminClient.getOfferingApi().
+            createServiceOffering(name, displayText, 2, 1024, 2048, highlyAvailable(true).storageType(StorageType.LOCAL));
+         Logger.CONSOLE.info("Created Service Offering: " + offering);
+
+         assertEquals(offering.getName(), name);
+         assertEquals(offering.getDisplayText(), displayText);
+         checkServiceOffering(offering);
+
+         offering = globalAdminClient.getOfferingApi()
+            .updateServiceOffering(offering.getId(),
+               UpdateServiceOfferingOptions.Builder.name(name + "-2").displayText(displayText + "-2"));
+
+         assertEquals(offering.getName(), name + "-2");
+         assertEquals(offering.getDisplayText(), displayText + "-2");
+         checkServiceOffering(offering);
+
+      } finally {
+         if (offering != null) {
+            globalAdminClient.getOfferingApi().deleteServiceOffering(offering.getId());
+         }
+      }
+   }
+
+   private void checkServiceOffering(ServiceOffering offering) {
+      assertNotNull(offering.getId());
+      assertEquals(offering.getCpuNumber(), 2);
+      assertEquals(offering.getCpuSpeed(), 1024);
+      assertEquals(offering.getMemory(), 2048);
+      assertTrue(offering.supportsHA());
+      assertEquals(offering.getStorageType(), StorageType.LOCAL);
+   }
+
+   @Test(groups = "live", enabled = true)
+   public void testCreateDiskOffering() throws Exception {
+      skipIfNotGlobalAdmin();
+
+      String name = prefix + "-test-create-disk-offering";
+      String displayText = name + "-display";
+      DiskOffering offering = null;
+      try {
+         offering = globalAdminClient.getOfferingApi().
+            createDiskOffering(name, displayText,
+               diskSizeInGB(100).customized(true).tags(ImmutableSet.<String>of("dummy-tag")));
+
+         assertEquals(offering.getName(), name);
+         assertEquals(offering.getDisplayText(), displayText);
+         checkDiskOffering(offering);
+
+         offering = globalAdminClient.getOfferingApi().
+            updateDiskOffering(offering.getId(),
+               UpdateDiskOfferingOptions.Builder.name(name + "-2").displayText(displayText + "-2"));
+
+         assertEquals(offering.getName(), name + "-2");
+         assertEquals(offering.getDisplayText(), displayText + "-2");
+         checkDiskOffering(offering);
+
+      } finally {
+         if (offering != null) {
+            globalAdminClient.getOfferingApi().deleteDiskOffering(offering.getId());
+         }
+      }
+   }
+
+   private void checkDiskOffering(DiskOffering offering) {
+      assertTrue(offering.isCustomized());
+      assertEquals(offering.getDiskSize(), 100);
+      assertTrue(offering.getTags().contains("dummy-tag"));
+   }
+
+   @Test(groups = "live", enabled = true)
+   public void testUpdateNetworkOffering() throws Exception {
+      skipIfNotGlobalAdmin();
+
+      NetworkOffering offering = getFirst(globalAdminClient.getOfferingApi().listNetworkOfferings(), null);
+      assertNotNull(offering, "Unable to test, no network offering found.");
+
+      String name = offering.getName();
+      NetworkOfferingAvailabilityType availability = offering.getAvailability();
+
+      try {
+         NetworkOfferingAvailabilityType newValue = OPTIONAL;
+         if (availability == OPTIONAL) {
+            newValue = REQUIRED;
+         }
+         NetworkOffering updated = globalAdminClient.getOfferingApi().updateNetworkOffering(offering.getId(),
+            UpdateNetworkOfferingOptions.Builder.name(prefix + name).availability(newValue));
+
+         assertEquals(updated.getName(), prefix + name);
+         assertEquals(updated.getAvailability(), newValue);
+
+      } finally {
+         globalAdminClient.getOfferingApi().updateNetworkOffering(offering.getId(),
+            UpdateNetworkOfferingOptions.Builder.name(name).availability(availability));
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiTest.java
new file mode 100644
index 0000000..5562f6e
--- /dev/null
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingApiTest.java
@@ -0,0 +1,169 @@
+/*
+ * 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.cloudstack.features;
+import static org.jclouds.reflect.Reflection2.method;
+
+import org.jclouds.Fallbacks.NullOnNotFoundOr404;
+import org.jclouds.cloudstack.internal.BaseCloudStackApiTest;
+import org.jclouds.cloudstack.options.CreateDiskOfferingOptions;
+import org.jclouds.cloudstack.options.CreateServiceOfferingOptions;
+import org.jclouds.cloudstack.options.UpdateDiskOfferingOptions;
+import org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions;
+import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.functions.ParseFirstJsonValueNamed;
+import org.jclouds.http.functions.ReleasePayloadAndReturn;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+
+/**
+ * Tests behavior of {@code GlobalOfferingApi}
+ *
+ * @author Andrei Savu
+ */
+@Test(groups = "unit", testName = "GlobalOfferingApiTest")
+public class GlobalOfferingApiTest extends BaseCloudStackApiTest<GlobalOfferingApi> {
+
+   HttpRequest createServiceOffering = HttpRequest.builder().method("GET")
+                                                  .endpoint("http://localhost:8080/client/api")
+                                                  .addQueryParam("response", "json")
+                                                  .addQueryParam("command", "createServiceOffering")
+                                                  .addQueryParam("name", "name")
+                                                  .addQueryParam("displaytext", "displayText")
+                                                  .addQueryParam("cpunumber", "1")
+                                                  .addQueryParam("cpuspeed", "2")
+                                                  .addQueryParam("memory", "3").build();
+
+   public void testCreateServiceOffering() throws Exception {
+      Invokable<?, ?> method = method(GlobalOfferingApi.class, "createServiceOffering",
+         String.class, String.class, int.class, int.class, int.class, CreateServiceOfferingOptions[].class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText", 1, 2, 3));
+
+      assertRequestLineEquals(httpRequest, createServiceOffering.getRequestLine());
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(httpRequest);
+   }
+
+   public void testUpdateServiceOffering() throws Exception {
+      Invokable<?, ?> method = method(GlobalOfferingApi.class, "updateServiceOffering",
+         String.class, UpdateServiceOfferingOptions[].class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=updateServiceOffering&id=1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(httpRequest);
+   }
+
+   public void testDeleteServiceOffering() throws Exception {
+      Invokable<?, ?> method = method(GlobalOfferingApi.class, "deleteServiceOffering", String.class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=deleteServiceOffering&id=1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(httpRequest);
+   }
+
+   public void testCreateDiskOffering() throws Exception {
+      Invokable<?, ?> method = method(GlobalOfferingApi.class, "createDiskOffering",
+         String.class, String.class, CreateDiskOfferingOptions[].class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText"));
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=createDiskOffering&name=name&displaytext=displayText HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(httpRequest);
+   }
+
+   public void testUpdateDiskOffering() throws Exception {
+      Invokable<?, ?> method = method(GlobalOfferingApi.class, "updateDiskOffering",
+         String.class, UpdateDiskOfferingOptions[].class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=updateDiskOffering&id=1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(httpRequest);
+   }
+
+   public void testDeleteDiskOffering() throws Exception {
+      Invokable<?, ?> method = method(GlobalOfferingApi.class, "deleteDiskOffering", String.class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=deleteDiskOffering&id=1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(httpRequest);
+   }
+
+   public void testUpdateNetworkOffering() throws Exception {
+      Invokable<?, ?> method = method(GlobalOfferingApi.class, "updateNetworkOffering",
+         String.class, UpdateNetworkOfferingOptions[].class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=updateNetworkOffering&id=1 HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
+
+      checkFilters(httpRequest);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java
deleted file mode 100644
index f12cbf4..0000000
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingAsyncClientTest.java
+++ /dev/null
@@ -1,169 +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.cloudstack.features;
-import static org.jclouds.reflect.Reflection2.method;
-
-import org.jclouds.Fallbacks.NullOnNotFoundOr404;
-import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
-import org.jclouds.cloudstack.options.CreateDiskOfferingOptions;
-import org.jclouds.cloudstack.options.CreateServiceOfferingOptions;
-import org.jclouds.cloudstack.options.UpdateDiskOfferingOptions;
-import org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions;
-import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.functions.ParseFirstJsonValueNamed;
-import org.jclouds.http.functions.ReleasePayloadAndReturn;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-
-/**
- * Tests behavior of {@code GlobalOfferingAsyncClient}
- *
- * @author Andrei Savu
- */
-@Test(groups = "unit", testName = "GlobalOfferingAsyncClientTest")
-public class GlobalOfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalOfferingAsyncClient> {
-
-   HttpRequest createServiceOffering = HttpRequest.builder().method("GET")
-                                                  .endpoint("http://localhost:8080/client/api")
-                                                  .addQueryParam("response", "json")
-                                                  .addQueryParam("command", "createServiceOffering")
-                                                  .addQueryParam("name", "name")
-                                                  .addQueryParam("displaytext", "displayText")
-                                                  .addQueryParam("cpunumber", "1")
-                                                  .addQueryParam("cpuspeed", "2")
-                                                  .addQueryParam("memory", "3").build();
-
-   public void testCreateServiceOffering() throws Exception {
-      Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "createServiceOffering",
-         String.class, String.class, int.class, int.class, int.class, CreateServiceOfferingOptions[].class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText", 1, 2, 3));
-
-      assertRequestLineEquals(httpRequest, createServiceOffering.getRequestLine());
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(httpRequest);
-   }
-
-   public void testUpdateServiceOffering() throws Exception {
-      Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "updateServiceOffering",
-         String.class, UpdateServiceOfferingOptions[].class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=updateServiceOffering&id=1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(httpRequest);
-   }
-
-   public void testDeleteServiceOffering() throws Exception {
-      Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "deleteServiceOffering", String.class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=deleteServiceOffering&id=1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(httpRequest);
-   }
-
-   public void testCreateDiskOffering() throws Exception {
-      Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "createDiskOffering",
-         String.class, String.class, CreateDiskOfferingOptions[].class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of("name", "displayText"));
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=createDiskOffering&name=name&displaytext=displayText HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(httpRequest);
-   }
-
-   public void testUpdateDiskOffering() throws Exception {
-      Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "updateDiskOffering",
-         String.class, UpdateDiskOfferingOptions[].class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=updateDiskOffering&id=1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(httpRequest);
-   }
-
-   public void testDeleteDiskOffering() throws Exception {
-      Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "deleteDiskOffering", String.class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=deleteDiskOffering&id=1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ReleasePayloadAndReturn.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(httpRequest);
-   }
-
-   public void testUpdateNetworkOffering() throws Exception {
-      Invokable<?, ?> method = method(GlobalOfferingAsyncClient.class, "updateNetworkOffering",
-         String.class, UpdateNetworkOfferingOptions[].class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(1L));
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=updateNetworkOffering&id=1 HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, NullOnNotFoundOr404.class);
-
-      checkFilters(httpRequest);
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java
deleted file mode 100644
index b429d4b..0000000
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalOfferingClientLiveTest.java
+++ /dev/null
@@ -1,154 +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.cloudstack.features;
-
-import static com.google.common.collect.Iterables.getFirst;
-import static org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.OPTIONAL;
-import static org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.REQUIRED;
-import static org.jclouds.cloudstack.options.CreateDiskOfferingOptions.Builder.diskSizeInGB;
-import static org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.highlyAvailable;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import org.jclouds.cloudstack.domain.DiskOffering;
-import org.jclouds.cloudstack.domain.NetworkOffering;
-import org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType;
-import org.jclouds.cloudstack.domain.ServiceOffering;
-import org.jclouds.cloudstack.domain.StorageType;
-import org.jclouds.cloudstack.internal.BaseCloudStackClientLiveTest;
-import org.jclouds.cloudstack.options.UpdateDiskOfferingOptions;
-import org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions;
-import org.jclouds.cloudstack.options.UpdateServiceOfferingOptions;
-import org.jclouds.logging.Logger;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Tests behavior of {@code GlobalOfferingClient}
- *
- * @author Andrei Savu
- */
-@Test(groups = "live", singleThreaded = true, testName = "GlobalOfferingClientLiveTest")
-public class GlobalOfferingClientLiveTest extends BaseCloudStackClientLiveTest {
-
-   @Test(groups = "live", enabled = true)
-   public void testCreateServiceOffering() throws Exception {
-      skipIfNotGlobalAdmin();
-
-      String name = prefix + "-test-create-service-offering";
-      String displayText = name + "-display";
-      ServiceOffering offering = null;
-      try {
-         offering = globalAdminClient.getOfferingClient().
-            createServiceOffering(name, displayText, 2, 1024, 2048, highlyAvailable(true).storageType(StorageType.LOCAL));
-         Logger.CONSOLE.info("Created Service Offering: " + offering);
-
-         assertEquals(offering.getName(), name);
-         assertEquals(offering.getDisplayText(), displayText);
-         checkServiceOffering(offering);
-
-         offering = globalAdminClient.getOfferingClient()
-            .updateServiceOffering(offering.getId(),
-               UpdateServiceOfferingOptions.Builder.name(name + "-2").displayText(displayText + "-2"));
-
-         assertEquals(offering.getName(), name + "-2");
-         assertEquals(offering.getDisplayText(), displayText + "-2");
-         checkServiceOffering(offering);
-
-      } finally {
-         if (offering != null) {
-            globalAdminClient.getOfferingClient().deleteServiceOffering(offering.getId());
-         }
-      }
-   }
-
-   private void checkServiceOffering(ServiceOffering offering) {
-      assertNotNull(offering.getId());
-      assertEquals(offering.getCpuNumber(), 2);
-      assertEquals(offering.getCpuSpeed(), 1024);
-      assertEquals(offering.getMemory(), 2048);
-      assertTrue(offering.supportsHA());
-      assertEquals(offering.getStorageType(), StorageType.LOCAL);
-   }
-
-   @Test(groups = "live", enabled = true)
-   public void testCreateDiskOffering() throws Exception {
-      skipIfNotGlobalAdmin();
-
-      String name = prefix + "-test-create-disk-offering";
-      String displayText = name + "-display";
-      DiskOffering offering = null;
-      try {
-         offering = globalAdminClient.getOfferingClient().
-            createDiskOffering(name, displayText,
-               diskSizeInGB(100).customized(true).tags(ImmutableSet.<String>of("dummy-tag")));
-
-         assertEquals(offering.getName(), name);
-         assertEquals(offering.getDisplayText(), displayText);
-         checkDiskOffering(offering);
-
-         offering = globalAdminClient.getOfferingClient().
-            updateDiskOffering(offering.getId(),
-               UpdateDiskOfferingOptions.Builder.name(name + "-2").displayText(displayText + "-2"));
-
-         assertEquals(offering.getName(), name + "-2");
-         assertEquals(offering.getDisplayText(), displayText + "-2");
-         checkDiskOffering(offering);
-
-      } finally {
-         if (offering != null) {
-            globalAdminClient.getOfferingClient().deleteDiskOffering(offering.getId());
-         }
-      }
-   }
-
-   private void checkDiskOffering(DiskOffering offering) {
-      assertTrue(offering.isCustomized());
-      assertEquals(offering.getDiskSize(), 100);
-      assertTrue(offering.getTags().contains("dummy-tag"));
-   }
-
-   @Test(groups = "live", enabled = true)
-   public void testUpdateNetworkOffering() throws Exception {
-      skipIfNotGlobalAdmin();
-
-      NetworkOffering offering = getFirst(globalAdminClient.getOfferingClient().listNetworkOfferings(), null);
-      assertNotNull(offering, "Unable to test, no network offering found.");
-
-      String name = offering.getName();
-      NetworkOfferingAvailabilityType availability = offering.getAvailability();
-
-      try {
-         NetworkOfferingAvailabilityType newValue = OPTIONAL;
-         if (availability == OPTIONAL) {
-            newValue = REQUIRED;
-         }
-         NetworkOffering updated = globalAdminClient.getOfferingClient().updateNetworkOffering(offering.getId(),
-            UpdateNetworkOfferingOptions.Builder.name(prefix + name).availability(newValue));
-
-         assertEquals(updated.getName(), prefix + name);
-         assertEquals(updated.getAvailability(), newValue);
-
-      } finally {
-         globalAdminClient.getOfferingClient().updateNetworkOffering(offering.getId(),
-            UpdateNetworkOfferingOptions.Builder.name(name).availability(availability));
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiExpectTest.java
new file mode 100644
index 0000000..ef6f339
--- /dev/null
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiExpectTest.java
@@ -0,0 +1,208 @@
+/*
+ * 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.cloudstack.features;
+
+import static org.testng.Assert.assertEquals;
+
+import java.net.URI;
+
+import org.jclouds.cloudstack.CloudStackContext;
+import org.jclouds.cloudstack.domain.AllocationState;
+import org.jclouds.cloudstack.domain.Pod;
+import org.jclouds.cloudstack.internal.BaseCloudStackExpectTest;
+import org.jclouds.cloudstack.options.CreatePodOptions;
+import org.jclouds.cloudstack.options.UpdatePodOptions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Test the CloudStack PodClient
+ *
+ * @author Richard Downer
+ */
+@Test(groups = "unit", testName = "GlobalPodApiExpectTest")
+public class GlobalPodApiExpectTest extends BaseCloudStackExpectTest<GlobalPodApi> {
+
+   public void testListPodsWhenResponseIs2xx() {
+      GlobalPodApi client = requestSendsResponse(
+         HttpRequest.builder()
+            .method("GET")
+            .endpoint(
+               URI.create("http://localhost:8080/client/api?response=json&" +
+                  "command=listPods&listAll=true&apiKey=identity&signature=MuowIOuZqOpKTPVQOfrDZEmpepw%3D"))
+            .headers(
+               ImmutableMultimap.<String, String>builder()
+                  .put("Accept", "application/json")
+                  .build())
+            .build(),
+         HttpResponse.builder()
+            .statusCode(200)
+            .payload(payloadFromResource("/listpodsresponse.json"))
+            .build());
+
+      Pod pod1 = Pod.builder()
+         .id("1")
+         .name("Dev Pod 1")
+         .zoneId("1")
+         .zoneName("Dev Zone 1")
+         .gateway("10.26.26.254")
+         .netmask("255.255.255.0")
+         .startIp("10.26.26.50")
+         .endIp("10.26.26.100")
+         .allocationState(AllocationState.ENABLED)
+         .build();
+      Pod pod2 = Pod.builder()
+         .id("2")
+         .name("Dev Pod 2")
+         .zoneId("2")
+         .zoneName("Dev Zone 2")
+         .gateway("10.22.22.254")
+         .netmask("255.255.255.0")
+         .startIp("10.22.22.25")
+         .endIp("10.22.22.50")
+         .allocationState(AllocationState.ENABLED)
+         .build();
+
+      assertEquals(client.listPods(), ImmutableSet.of(pod1, pod2));
+   }
+
+   public void testListPodsWhenResponseIs404() {
+      GlobalPodApi client = requestSendsResponse(
+         HttpRequest.builder()
+            .method("GET")
+            .endpoint(
+               URI.create("http://localhost:8080/client/api?response=json&" +
+                  "command=listPods&listAll=true&apiKey=identity&signature=MuowIOuZqOpKTPVQOfrDZEmpepw%3D"))
+            .headers(
+               ImmutableMultimap.<String, String>builder()
+                  .put("Accept", "application/json")
+                  .build())
+            .build(),
+         HttpResponse.builder()
+            .statusCode(404)
+            .build());
+
+      assertEquals(client.listPods(), ImmutableSet.of());
+   }
+
+   HttpRequest createPod = HttpRequest.builder().method("GET")
+                                      .endpoint("http://localhost:8080/client/api")
+                                      .addQueryParam("response", "json")
+                                      .addQueryParam("command", "createPod")
+                                      .addQueryParam("name", "richard-pod")
+                                      .addQueryParam("zoneid", "10")
+                                      .addQueryParam("startip", "172.20.0.1")
+                                      .addQueryParam("endip", "172.20.0.250")
+                                      .addQueryParam("gateway", "172.20.0.254")
+                                      .addQueryParam("netmask", "255.255.255.0")
+                                      .addQueryParam("allocationstate", "Enabled")
+                                      .addQueryParam("apiKey", "identity")
+                                      .addQueryParam("signature", "fwsoQ77BmNQWfuqv4nVlPcKvKbU=")
+                                      .addHeader("Accept", "application/json").build();
+
+   public void testCreatePodWhenResponseIs2xx() {
+      GlobalPodApi client = requestSendsResponse(createPod,
+         HttpResponse.builder()
+            .statusCode(200)
+            .payload(payloadFromResource("/createpodresponse.json"))
+            .build());
+
+      Pod expected = Pod.builder()
+         .id("6")
+         .name("richard-pod")
+         .zoneId("10")
+         .zoneName("richard-zone")
+         .gateway("172.20.0.254")
+         .netmask("255.255.255.0")
+         .startIp("172.20.0.1")
+         .endIp("172.20.0.250")
+         .allocationState(AllocationState.ENABLED)
+         .build();
+
+      Pod actual = client.createPod("richard-pod", "10", "172.20.0.1", "172.20.0.250", "172.20.0.254", "255.255.255.0",
+         CreatePodOptions.Builder.allocationState(AllocationState.ENABLED));
+
+      assertEquals(actual, expected);
+   }
+
+   public void testUpdatePodWhenResponseIs2xx() {
+      GlobalPodApi client = requestSendsResponse(
+         HttpRequest.builder()
+            .method("GET")
+            .endpoint(
+               URI.create("http://localhost:8080/client/api?response=json&command=updatePod&id=7&netmask=255.255.255.128&name=richard-updatepod&startip=172.21.0.129&endip=172.21.0.250&gateway=172.21.0.254&allocationstate=Disabled&apiKey=identity&signature=QpdbRyyF/xJ78ioJWhPKXEWhthY%3D"))
+            .headers(
+               ImmutableMultimap.<String, String>builder()
+                  .put("Accept", "application/json")
+                  .build())
+            .build(),
+         HttpResponse.builder()
+            .statusCode(200)
+            .payload(payloadFromResource("/updatepodresponse.json"))
+            .build());
+
+      Pod expected = Pod.builder()
+         .id("7")
+         .name("richard-updatedpod")
+         .zoneId("11")
+         .zoneName("richard-zone")
+         .gateway("172.21.0.254")
+         .netmask("255.255.255.128")
+         .startIp("172.21.0.129")
+         .endIp("172.21.0.250")
+         .allocationState(AllocationState.DISABLED)
+         .build();
+
+      Pod actual = client.updatePod("7", UpdatePodOptions.Builder
+         .netmask("255.255.255.128")
+         .name("richard-updatepod")
+         .startIp("172.21.0.129")
+         .endIp("172.21.0.250")
+         .gateway("172.21.0.254")
+         .allocationState(AllocationState.DISABLED)
+      );
+
+      assertEquals(actual, expected);
+   }
+
+   public void testDeletePodWhenResponseIs2xx() {
+      GlobalPodApi client = requestSendsResponse(
+         HttpRequest.builder()
+            .method("GET")
+            .endpoint(
+               URI.create("http://localhost:8080/client/api?response=json&command=deletePod&id=3&apiKey=identity&signature=rm4ItuAL1Ztnj%2BHFFvBFzvHAIog%3D"))
+            .headers(
+               ImmutableMultimap.<String, String>builder()
+                  .put("Accept", "application/json")
+                  .build())
+            .build(),
+         HttpResponse.builder()
+            .statusCode(200)
+            .build());
+
+      client.deletePod("3");
+   }
+
+   @Override
+   protected GlobalPodApi clientFrom(CloudStackContext context) {
+      return context.getGlobalApi().getPodClient();
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiLiveTest.java
new file mode 100644
index 0000000..aa851ec
--- /dev/null
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodApiLiveTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.cloudstack.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.cloudstack.domain.AllocationState;
+import org.jclouds.cloudstack.domain.NetworkType;
+import org.jclouds.cloudstack.domain.Pod;
+import org.jclouds.cloudstack.domain.Zone;
+import org.jclouds.cloudstack.internal.BaseCloudStackApiLiveTest;
+import org.jclouds.cloudstack.options.CreatePodOptions;
+import org.jclouds.cloudstack.options.ListPodsOptions;
+import org.jclouds.cloudstack.options.UpdatePodOptions;
+import org.testng.annotations.AfterGroups;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Iterables;
+
+/**
+ * Tests behavior of {@code GlobalPodApi}
+ *
+ * @author Richard Downer
+ */
+@Test(groups = "live", singleThreaded = true, testName = "GlobalPodApiLiveTest")
+public class GlobalPodApiLiveTest extends BaseCloudStackApiLiveTest {
+
+   private Zone zone;
+   private Pod pod;
+
+   public void testListPods() throws Exception {
+      skipIfNotGlobalAdmin();
+
+      Set<Pod> response = globalAdminClient.getPodClient().listPods();
+      assert null != response;
+      long podCount = response.size();
+      assertTrue(podCount >= 0);
+
+      for (Pod pod : response) {
+         Pod newDetails = Iterables.getOnlyElement(globalAdminClient.getPodClient().listPods(
+            ListPodsOptions.Builder.id(pod.getId())));
+         assertEquals(pod, newDetails);
+         assertEquals(pod, globalAdminClient.getPodClient().getPod(pod.getId()));
+         assertNotNull(pod.getId());
+         assertFalse(Strings.isNullOrEmpty(pod.getName()));
+         assertNotNull(pod.getZoneId());
+         assertFalse(Strings.isNullOrEmpty(pod.getZoneName()));
+         assertFalse(Strings.isNullOrEmpty(pod.getGateway()));
+         assertFalse(Strings.isNullOrEmpty(pod.getNetmask()));
+         assertFalse(Strings.isNullOrEmpty(pod.getStartIp()));
+         assertFalse(Strings.isNullOrEmpty(pod.getEndIp()));
+         assertNotEquals(pod.getAllocationState(), AllocationState.UNKNOWN);
+      }
+   }
+
+   @Test
+   public void testCreatePod() {
+      skipIfNotGlobalAdmin();
+
+      zone = globalAdminClient.getZoneApi().createZone(prefix + "-zone", NetworkType.BASIC, "8.8.8.8", "10.10.10.10");
+      pod = globalAdminClient.getPodClient().createPod(prefix + "-pod", zone.getId(), "172.20.0.1", "172.20.0.250", "172.20.0.254", "255.255.255.0",
+      CreatePodOptions.Builder.allocationState(AllocationState.ENABLED));
+
+      assertNotNull(pod);
+      assertEquals(pod.getName(), prefix + "-pod");
+      assertEquals(pod.getZoneId(), zone.getId());
+      assertEquals(pod.getZoneName(), prefix + "-zone");
+      assertEquals(pod.getStartIp(), "172.20.0.1");
+      assertEquals(pod.getEndIp(), "172.20.0.250");
+      assertEquals(pod.getGateway(), "172.20.0.254");
+      assertEquals(pod.getNetmask(), "255.255.255.0");
+      assertEquals(pod.getAllocationState(), AllocationState.ENABLED);
+   }
+
+   @Test(dependsOnMethods = "testCreatePod")
+   public void testUpdatePod() {
+      Pod updated = globalAdminClient.getPodClient().updatePod(pod.getId(), UpdatePodOptions.Builder
+         .name(prefix + "-updatedpod")
+         .startIp("172.21.0.129")
+         .endIp("172.21.0.250")
+         .gateway("172.21.0.254")
+         .netmask("255.255.255.128")
+         .allocationState(AllocationState.DISABLED)
+      );
+
+      assertNotNull(updated);
+      assertEquals(updated.getName(), prefix + "-updatedpod");
+      assertEquals(updated.getZoneId(), zone.getId());
+      assertEquals(updated.getZoneName(), prefix + "-zone");
+      assertEquals(updated.getStartIp(), "172.21.0.129");
+      assertEquals(updated.getEndIp(), "172.21.0.250");
+      assertEquals(updated.getGateway(), "172.21.0.254");
+      assertEquals(updated.getNetmask(), "255.255.255.128");
+      assertEquals(updated.getAllocationState(), AllocationState.DISABLED);
+   }
+
+   @AfterGroups(groups = "live")
+   @Override
+   protected void tearDownContext() {
+      if (pod != null) {
+         globalAdminClient.getPodClient().deletePod(pod.getId());
+         pod = null;
+      }
+      if (zone != null) {
+         globalAdminClient.getZoneApi().deleteZone(zone.getId());
+         zone = null;
+      }
+      super.tearDownContext();
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientExpectTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientExpectTest.java
deleted file mode 100644
index e61d26a..0000000
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientExpectTest.java
+++ /dev/null
@@ -1,208 +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.cloudstack.features;
-
-import static org.testng.Assert.assertEquals;
-
-import java.net.URI;
-
-import org.jclouds.cloudstack.CloudStackContext;
-import org.jclouds.cloudstack.domain.AllocationState;
-import org.jclouds.cloudstack.domain.Pod;
-import org.jclouds.cloudstack.internal.BaseCloudStackExpectTest;
-import org.jclouds.cloudstack.options.CreatePodOptions;
-import org.jclouds.cloudstack.options.UpdatePodOptions;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Test the CloudStack PodClient
- *
- * @author Richard Downer
- */
-@Test(groups = "unit", testName = "GlobalPodClientExpectTest")
-public class GlobalPodClientExpectTest extends BaseCloudStackExpectTest<GlobalPodClient> {
-
-   public void testListPodsWhenResponseIs2xx() {
-      GlobalPodClient client = requestSendsResponse(
-         HttpRequest.builder()
-            .method("GET")
-            .endpoint(
-               URI.create("http://localhost:8080/client/api?response=json&" +
-                  "command=listPods&listAll=true&apiKey=identity&signature=MuowIOuZqOpKTPVQOfrDZEmpepw%3D"))
-            .headers(
-               ImmutableMultimap.<String, String>builder()
-                  .put("Accept", "application/json")
-                  .build())
-            .build(),
-         HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResource("/listpodsresponse.json"))
-            .build());
-
-      Pod pod1 = Pod.builder()
-         .id("1")
-         .name("Dev Pod 1")
-         .zoneId("1")
-         .zoneName("Dev Zone 1")
-         .gateway("10.26.26.254")
-         .netmask("255.255.255.0")
-         .startIp("10.26.26.50")
-         .endIp("10.26.26.100")
-         .allocationState(AllocationState.ENABLED)
-         .build();
-      Pod pod2 = Pod.builder()
-         .id("2")
-         .name("Dev Pod 2")
-         .zoneId("2")
-         .zoneName("Dev Zone 2")
-         .gateway("10.22.22.254")
-         .netmask("255.255.255.0")
-         .startIp("10.22.22.25")
-         .endIp("10.22.22.50")
-         .allocationState(AllocationState.ENABLED)
-         .build();
-
-      assertEquals(client.listPods(), ImmutableSet.of(pod1, pod2));
-   }
-
-   public void testListPodsWhenResponseIs404() {
-      GlobalPodClient client = requestSendsResponse(
-         HttpRequest.builder()
-            .method("GET")
-            .endpoint(
-               URI.create("http://localhost:8080/client/api?response=json&" +
-                  "command=listPods&listAll=true&apiKey=identity&signature=MuowIOuZqOpKTPVQOfrDZEmpepw%3D"))
-            .headers(
-               ImmutableMultimap.<String, String>builder()
-                  .put("Accept", "application/json")
-                  .build())
-            .build(),
-         HttpResponse.builder()
-            .statusCode(404)
-            .build());
-
-      assertEquals(client.listPods(), ImmutableSet.of());
-   }
-
-   HttpRequest createPod = HttpRequest.builder().method("GET")
-                                      .endpoint("http://localhost:8080/client/api")
-                                      .addQueryParam("response", "json")
-                                      .addQueryParam("command", "createPod")
-                                      .addQueryParam("name", "richard-pod")
-                                      .addQueryParam("zoneid", "10")
-                                      .addQueryParam("startip", "172.20.0.1")
-                                      .addQueryParam("endip", "172.20.0.250")
-                                      .addQueryParam("gateway", "172.20.0.254")
-                                      .addQueryParam("netmask", "255.255.255.0")
-                                      .addQueryParam("allocationstate", "Enabled")
-                                      .addQueryParam("apiKey", "identity")
-                                      .addQueryParam("signature", "fwsoQ77BmNQWfuqv4nVlPcKvKbU=")
-                                      .addHeader("Accept", "application/json").build();
-
-   public void testCreatePodWhenResponseIs2xx() {
-      GlobalPodClient client = requestSendsResponse(createPod,
-         HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResource("/createpodresponse.json"))
-            .build());
-
-      Pod expected = Pod.builder()
-         .id("6")
-         .name("richard-pod")
-         .zoneId("10")
-         .zoneName("richard-zone")
-         .gateway("172.20.0.254")
-         .netmask("255.255.255.0")
-         .startIp("172.20.0.1")
-         .endIp("172.20.0.250")
-         .allocationState(AllocationState.ENABLED)
-         .build();
-
-      Pod actual = client.createPod("richard-pod", "10", "172.20.0.1", "172.20.0.250", "172.20.0.254", "255.255.255.0",
-         CreatePodOptions.Builder.allocationState(AllocationState.ENABLED));
-
-      assertEquals(actual, expected);
-   }
-
-   public void testUpdatePodWhenResponseIs2xx() {
-      GlobalPodClient client = requestSendsResponse(
-         HttpRequest.builder()
-            .method("GET")
-            .endpoint(
-               URI.create("http://localhost:8080/client/api?response=json&command=updatePod&id=7&netmask=255.255.255.128&name=richard-updatepod&startip=172.21.0.129&endip=172.21.0.250&gateway=172.21.0.254&allocationstate=Disabled&apiKey=identity&signature=QpdbRyyF/xJ78ioJWhPKXEWhthY%3D"))
-            .headers(
-               ImmutableMultimap.<String, String>builder()
-                  .put("Accept", "application/json")
-                  .build())
-            .build(),
-         HttpResponse.builder()
-            .statusCode(200)
-            .payload(payloadFromResource("/updatepodresponse.json"))
-            .build());
-
-      Pod expected = Pod.builder()
-         .id("7")
-         .name("richard-updatedpod")
-         .zoneId("11")
-         .zoneName("richard-zone")
-         .gateway("172.21.0.254")
-         .netmask("255.255.255.128")
-         .startIp("172.21.0.129")
-         .endIp("172.21.0.250")
-         .allocationState(AllocationState.DISABLED)
-         .build();
-
-      Pod actual = client.updatePod("7", UpdatePodOptions.Builder
-         .netmask("255.255.255.128")
-         .name("richard-updatepod")
-         .startIp("172.21.0.129")
-         .endIp("172.21.0.250")
-         .gateway("172.21.0.254")
-         .allocationState(AllocationState.DISABLED)
-      );
-
-      assertEquals(actual, expected);
-   }
-
-   public void testDeletePodWhenResponseIs2xx() {
-      GlobalPodClient client = requestSendsResponse(
-         HttpRequest.builder()
-            .method("GET")
-            .endpoint(
-               URI.create("http://localhost:8080/client/api?response=json&command=deletePod&id=3&apiKey=identity&signature=rm4ItuAL1Ztnj%2BHFFvBFzvHAIog%3D"))
-            .headers(
-               ImmutableMultimap.<String, String>builder()
-                  .put("Accept", "application/json")
-                  .build())
-            .build(),
-         HttpResponse.builder()
-            .statusCode(200)
-            .build());
-
-      client.deletePod("3");
-   }
-
-   @Override
-   protected GlobalPodClient clientFrom(CloudStackContext context) {
-      return context.getGlobalContext().getApi().getPodClient();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java
deleted file mode 100644
index 1018bfd..0000000
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.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.cloudstack.features;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.jclouds.cloudstack.domain.AllocationState;
-import org.jclouds.cloudstack.domain.NetworkType;
-import org.jclouds.cloudstack.domain.Pod;
-import org.jclouds.cloudstack.domain.Zone;
-import org.jclouds.cloudstack.internal.BaseCloudStackClientLiveTest;
-import org.jclouds.cloudstack.options.CreatePodOptions;
-import org.jclouds.cloudstack.options.ListPodsOptions;
-import org.jclouds.cloudstack.options.UpdatePodOptions;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Iterables;
-
-/**
- * Tests behavior of {@code GlobalPodClient}
- *
- * @author Richard Downer
- */
-@Test(groups = "live", singleThreaded = true, testName = "GlobalPodClientLiveTest")
-public class GlobalPodClientLiveTest extends BaseCloudStackClientLiveTest {
-
-   private Zone zone;
-   private Pod pod;
-
-   public void testListPods() throws Exception {
-      skipIfNotGlobalAdmin();
-
-      Set<Pod> response = globalAdminClient.getPodClient().listPods();
-      assert null != response;
-      long podCount = response.size();
-      assertTrue(podCount >= 0);
-
-      for (Pod pod : response) {
-         Pod newDetails = Iterables.getOnlyElement(globalAdminClient.getPodClient().listPods(
-            ListPodsOptions.Builder.id(pod.getId())));
-         assertEquals(pod, newDetails);
-         assertEquals(pod, globalAdminClient.getPodClient().getPod(pod.getId()));
-         assertNotNull(pod.getId());
-         assertFalse(Strings.isNullOrEmpty(pod.getName()));
-         assertNotNull(pod.getZoneId());
-         assertFalse(Strings.isNullOrEmpty(pod.getZoneName()));
-         assertFalse(Strings.isNullOrEmpty(pod.getGateway()));
-         assertFalse(Strings.isNullOrEmpty(pod.getNetmask()));
-         assertFalse(Strings.isNullOrEmpty(pod.getStartIp()));
-         assertFalse(Strings.isNullOrEmpty(pod.getEndIp()));
-         assertNotEquals(pod.getAllocationState(), AllocationState.UNKNOWN);
-      }
-   }
-
-   @Test
-   public void testCreatePod() {
-      skipIfNotGlobalAdmin();
-
-      zone = globalAdminClient.getZoneClient().createZone(prefix + "-zone", NetworkType.BASIC, "8.8.8.8", "10.10.10.10");
-      pod = globalAdminClient.getPodClient().createPod(prefix + "-pod", zone.getId(), "172.20.0.1", "172.20.0.250", "172.20.0.254", "255.255.255.0",
-      CreatePodOptions.Builder.allocationState(AllocationState.ENABLED));
-
-      assertNotNull(pod);
-      assertEquals(pod.getName(), prefix + "-pod");
-      assertEquals(pod.getZoneId(), zone.getId());
-      assertEquals(pod.getZoneName(), prefix + "-zone");
-      assertEquals(pod.getStartIp(), "172.20.0.1");
-      assertEquals(pod.getEndIp(), "172.20.0.250");
-      assertEquals(pod.getGateway(), "172.20.0.254");
-      assertEquals(pod.getNetmask(), "255.255.255.0");
-      assertEquals(pod.getAllocationState(), AllocationState.ENABLED);
-   }
-
-   @Test(dependsOnMethods = "testCreatePod")
-   public void testUpdatePod() {
-      Pod updated = globalAdminClient.getPodClient().updatePod(pod.getId(), UpdatePodOptions.Builder
-         .name(prefix + "-updatedpod")
-         .startIp("172.21.0.129")
-         .endIp("172.21.0.250")
-         .gateway("172.21.0.254")
-         .netmask("255.255.255.128")
-         .allocationState(AllocationState.DISABLED)
-      );
-
-      assertNotNull(updated);
-      assertEquals(updated.getName(), prefix + "-updatedpod");
-      assertEquals(updated.getZoneId(), zone.getId());
-      assertEquals(updated.getZoneName(), prefix + "-zone");
-      assertEquals(updated.getStartIp(), "172.21.0.129");
-      assertEquals(updated.getEndIp(), "172.21.0.250");
-      assertEquals(updated.getGateway(), "172.21.0.254");
-      assertEquals(updated.getNetmask(), "255.255.255.128");
-      assertEquals(updated.getAllocationState(), AllocationState.DISABLED);
-   }
-
-   @AfterGroups(groups = "live")
-   @Override
-   protected void tearDownContext() {
-      if (pod != null) {
-         globalAdminClient.getPodClient().deletePod(pod.getId());
-         pod = null;
-      }
-      if (zone != null) {
-         globalAdminClient.getZoneClient().deleteZone(zone.getId());
-         zone = null;
-      }
-      super.tearDownContext();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiLiveTest.java
new file mode 100644
index 0000000..e5ec3a9
--- /dev/null
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiLiveTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.cloudstack.features;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.jclouds.cloudstack.domain.StoragePool;
+import org.jclouds.cloudstack.internal.BaseCloudStackApiLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Strings;
+
+/**
+ * Tests behavior of {@code GlobalStoragePoolApi}
+ *
+ * @author Richard Downer
+ */
+@Test(groups = "live", singleThreaded = true, testName = "GlobalStoragePoolApiLiveTest")
+public class GlobalStoragePoolApiLiveTest extends BaseCloudStackApiLiveTest {
+
+   @Test(groups = "live", enabled = true)
+   public void testListStoragePools() throws Exception {
+      skipIfNotGlobalAdmin();
+
+      Set<StoragePool> result = globalAdminClient.getStoragePoolClient().listStoragePools();
+      assertNotNull(result);
+      assertTrue(result.size() > 0);
+      for(StoragePool pool : result) {
+         assertNotNull(pool.getId());
+         assertFalse(Strings.isNullOrEmpty(pool.getName()));
+         assertFalse(Strings.isNullOrEmpty(pool.getPath()));
+         assertNotNull(pool.getTags());
+         assertNotEquals(StoragePool.State.UNRECOGNIZED, pool.getState());
+         assertNotEquals(StoragePool.Type.UNRECOGNIZED, pool.getType());
+         assertNotNull(pool.getZoneId());
+         assertFalse(Strings.isNullOrEmpty(pool.getZoneName()));
+         assertNotNull(pool.getPodId());
+         assertFalse(Strings.isNullOrEmpty(pool.getPodName()));
+         assertNotNull(pool.getClusterId());
+         assertFalse(Strings.isNullOrEmpty(pool.getClusterName()));
+         assertNotNull(pool.getCreated());
+         assertTrue(pool.getDiskSizeTotal() > 0);
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiTest.java
new file mode 100644
index 0000000..bac7207
--- /dev/null
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolApiTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.cloudstack.features;
+
+import static org.jclouds.reflect.Reflection2.method;
+
+import org.jclouds.cloudstack.internal.BaseCloudStackApiTest;
+import org.jclouds.cloudstack.options.ListStoragePoolsOptions;
+import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
+import org.jclouds.http.functions.ParseFirstJsonValueNamed;
+import org.jclouds.rest.internal.GeneratedHttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.reflect.Invokable;
+/**
+ * Tests behavior of {@code GlobalStoragePoolApi}
+ *
+ * @author Richard Downer
+ */
+@Test(groups = "unit", testName = "GlobalStoragePoolApiTest")
+public class GlobalStoragePoolApiTest extends BaseCloudStackApiTest<GlobalStoragePoolApi> {
+
+   public void testListStoragePools() throws NoSuchMethodException {
+      Invokable<?, ?> method = method(GlobalStoragePoolApi.class, "listStoragePools", ListStoragePoolsOptions[].class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=listStoragePools&listAll=true HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+      checkFilters(httpRequest);
+   }
+
+   public void testListStoragePoolsOptions() throws NoSuchMethodException {
+      Invokable<?, ?> method = method(GlobalStoragePoolApi.class, "listStoragePools", ListStoragePoolsOptions[].class);
+      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListStoragePoolsOptions.Builder.clusterId("3").id("4").ipAddress("192.168.42.42").keyword("fred").name("bob").path("/mnt/store42").podId("4").zoneId("5")));
+
+      assertRequestLineEquals(httpRequest,
+         "GET http://localhost:8080/client/api?response=json&command=listStoragePools&listAll=true&clusterid=3&id=4&ipaddress=192.168.42.42&keyword=fred&name=bob&path=/mnt/store42&podid=4&zoneid=5 HTTP/1.1");
+      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
+      assertPayloadEquals(httpRequest, null, null, false);
+
+      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
+      assertSaxResponseParserClassEquals(method, null);
+      assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
+
+      checkFilters(httpRequest);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java
deleted file mode 100644
index 6fab631..0000000
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolAsyncClientTest.java
+++ /dev/null
@@ -1,69 +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.cloudstack.features;
-
-import static org.jclouds.reflect.Reflection2.method;
-
-import org.jclouds.cloudstack.internal.BaseCloudStackAsyncClientTest;
-import org.jclouds.cloudstack.options.ListStoragePoolsOptions;
-import org.jclouds.fallbacks.MapHttp4xxCodesToExceptions;
-import org.jclouds.http.functions.ParseFirstJsonValueNamed;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.reflect.Invokable;
-/**
- * Tests behavior of {@code GlobalStoragePoolAsyncClient}
- *
- * @author Richard Downer
- */
-@Test(groups = "unit", testName = "GlobalStoragePoolAsyncClientTest")
-public class GlobalStoragePoolAsyncClientTest extends BaseCloudStackAsyncClientTest<GlobalStoragePoolAsyncClient> {
-
-   public void testListStoragePools() throws NoSuchMethodException {
-      Invokable<?, ?> method = method(GlobalStoragePoolAsyncClient.class, "listStoragePools", ListStoragePoolsOptions[].class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.of());
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=listStoragePools&listAll=true HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
-      checkFilters(httpRequest);
-   }
-
-   public void testListStoragePoolsOptions() throws NoSuchMethodException {
-      Invokable<?, ?> method = method(GlobalStoragePoolAsyncClient.class, "listStoragePools", ListStoragePoolsOptions[].class);
-      GeneratedHttpRequest httpRequest = processor.createRequest(method, ImmutableList.<Object> of(ListStoragePoolsOptions.Builder.clusterId("3").id("4").ipAddress("192.168.42.42").keyword("fred").name("bob").path("/mnt/store42").podId("4").zoneId("5")));
-
-      assertRequestLineEquals(httpRequest,
-         "GET http://localhost:8080/client/api?response=json&command=listStoragePools&listAll=true&clusterid=3&id=4&ipaddress=192.168.42.42&keyword=fred&name=bob&path=/mnt/store42&podid=4&zoneid=5 HTTP/1.1");
-      assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
-      assertPayloadEquals(httpRequest, null, null, false);
-
-      assertResponseParserClassEquals(method, httpRequest, ParseFirstJsonValueNamed.class);
-      assertSaxResponseParserClassEquals(method, null);
-      assertFallbackClassEquals(method, MapHttp4xxCodesToExceptions.class);
-
-      checkFilters(httpRequest);
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java
deleted file mode 100644
index cfc9cf7..0000000
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalStoragePoolClientLiveTest.java
+++ /dev/null
@@ -1,65 +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.cloudstack.features;
-
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.jclouds.cloudstack.domain.StoragePool;
-import org.jclouds.cloudstack.internal.BaseCloudStackClientLiveTest;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Strings;
-
-/**
- * Tests behavior of {@code GlobalStoragePoolClient}
- *
- * @author Richard Downer
- */
-@Test(groups = "live", singleThreaded = true, testName = "GlobalStoragePoolClientLiveTest")
-public class GlobalStoragePoolClientLiveTest extends BaseCloudStackClientLiveTest {
-
-   @Test(groups = "live", enabled = true)
-   public void testListStoragePools() throws Exception {
-      skipIfNotGlobalAdmin();
-
-      Set<StoragePool> result = globalAdminClient.getStoragePoolClient().listStoragePools();
-      assertNotNull(result);
-      assertTrue(result.size() > 0);
-      for(StoragePool pool : result) {
-         assertNotNull(pool.getId());
-         assertFalse(Strings.isNullOrEmpty(pool.getName()));
-         assertFalse(Strings.isNullOrEmpty(pool.getPath()));
-         assertNotNull(pool.getTags());
-         assertNotEquals(StoragePool.State.UNRECOGNIZED, pool.getState());
-         assertNotEquals(StoragePool.Type.UNRECOGNIZED, pool.getType());
-         assertNotNull(pool.getZoneId());
-         assertFalse(Strings.isNullOrEmpty(pool.getZoneName()));
-         assertNotNull(pool.getPodId());
-         assertFalse(Strings.isNullOrEmpty(pool.getPodName()));
-         assertNotNull(pool.getClusterId());
-         assertFalse(Strings.isNullOrEmpty(pool.getClusterName()));
-         assertNotNull(pool.getCreated());
-         assertTrue(pool.getDiskSizeTotal() > 0);
-      }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/c6986efd/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageApiLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageApiLiveTest.java
new file mode 100644
index 0000000..79eb4ec
--- /dev/null
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalUsageApiLiveTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.cloudstack.features;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Set;
+import java.util.TimeZone;
+
+import org.jclouds.cloudstack.domain.JobResult;
+import org.jclouds.cloudstack.domain.UsageRecord;
+import org.jclouds.cloudstack.internal.BaseCloudStackApiLiveTest;
+import org.jclouds.cloudstack.options.GenerateUsageRecordsOptions;
+import org.jclouds.cloudstack.options.ListUsageRecordsOptions;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code GlobalUsageApi}
+ *
+ * @author Richard Downer
+ */
+@Test(groups = "live", singleThreaded = true, testName = "GlobalUsageApiLiveTest")
+public class GlobalUsageApiLiveTest extends BaseCloudStackApiLiveTest {
+
+   @Test(groups = "live", enabled = true)
+   public void testListUsage() {
+      skipIfNotGlobalAdmin();
+
+      Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+      Date end = c.getTime();
+      c.add(Calendar.MONTH, -1);
+      Date start = c.getTime();
+
+      JobResult result = globalAdminClient.getUsageClient().generateUsageRecords(start, end, GenerateUsageRecordsOptions.NONE);
+      assertNotNull(result);
+      assertTrue(result.isSuccess(), result.getDisplayText());
+
+      Set<UsageRecord> records = globalAdminClient.getUsageClient().listUsageRecords(start, end, ListUsageRecordsOptions.NONE);
+      assertNotNull(records);
+      assertTrue(records.size() > 0);
+   }
+
+}