Updated Branches:
  refs/heads/master f196ee3b6 -> 725b7c5c2

JCLOUDS-353 openstack list availability zones for NOVA


Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/commit/725b7c5c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/tree/725b7c5c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds/diff/725b7c5c

Branch: refs/heads/master
Commit: 725b7c5c2c3c0751f67eb2256b4ea8b8114de155
Parents: f196ee3
Author: istolber <[email protected]>
Authored: Mon Oct 14 10:03:44 2013 +0200
Committer: Everett Toews <[email protected]>
Committed: Mon Oct 21 09:08:07 2013 -0500

----------------------------------------------------------------------
 .../jclouds/openstack/nova/v2_0/NovaApi.java    | 14 +++-
 .../openstack/nova/v2_0/NovaAsyncApi.java       | 12 +++-
 .../nova/v2_0/config/NovaRestClientModule.java  |  3 +
 .../domain/zonescoped/AvailabilityZone.java     | 73 ++++++++++++++++++++
 .../nova/v2_0/domain/zonescoped/ZoneState.java  | 62 +++++++++++++++++
 .../v2_0/extensions/AvailabilityZoneAPI.java    | 40 +++++++++++
 .../extensions/AvailabilityZoneAsyncApi.java    | 58 ++++++++++++++++
 .../AvailabilityZoneApiExpectTest.java          | 64 +++++++++++++++++
 .../AvailabilityZonesApiLiveTest.java           | 45 ++++++++++++
 .../test/resources/listAvailabilityZones.json   | 11 +++
 10 files changed, 377 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
index 9674089..b03727e 100644
--- 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java
@@ -21,6 +21,7 @@ import java.util.Set;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.location.Zone;
 import org.jclouds.location.functions.ZoneToEndpoint;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
 import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
 import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPApi;
 import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationApi;
@@ -49,7 +50,7 @@ import com.google.inject.Provides;
 /**
  * Provides synchronous access to Nova.
  * <p/>
- * 
+ *
  * @see NovaAsyncApi
  * @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/";
  *      />
@@ -57,7 +58,7 @@ import com.google.inject.Provides;
  */
 public interface NovaApi extends Closeable {
    /**
-    * 
+    *
     * @return the Zone codes configured
     */
    @Provides
@@ -65,6 +66,13 @@ public interface NovaApi extends Closeable {
    Set<String> getConfiguredZones();
 
    /**
+    * Provides synchronous access to availability zone features
+    */
+   @Delegate
+   AvailabilityZoneAPI getAvailabilityZoneApi(
+         @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+   /**
     * Provides synchronous access to Server features.
     */
    @Delegate
@@ -147,7 +155,7 @@ public interface NovaApi extends Closeable {
    @Delegate
    Optional<? extends ServerAdminApi> getServerAdminExtensionForZone(
          @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
- 
+
    /**
     * Provides synchronous access to Aggregate features.
     */

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
index 934ca75..9abea53 100644
--- 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaAsyncApi.java
@@ -22,6 +22,7 @@ import java.util.Set;
 import org.jclouds.javax.annotation.Nullable;
 import org.jclouds.location.Zone;
 import org.jclouds.location.functions.ZoneToEndpoint;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
 import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
 import org.jclouds.openstack.nova.v2_0.extensions.FloatingIPAsyncApi;
 import org.jclouds.openstack.nova.v2_0.extensions.HostAdministrationAsyncApi;
@@ -50,7 +51,7 @@ import com.google.inject.Provides;
 /**
  * Provides asynchronous access to Nova via their REST API.
  * <p/>
- * 
+ *
  * @see NovaApi
  * @see <a href="http://docs.openstack.org/api/openstack-compute/1.1/content/";
  *      />
@@ -62,7 +63,7 @@ import com.google.inject.Provides;
 public interface NovaAsyncApi extends Closeable {
 
    /**
-    * 
+    *
     * @return the Zone codes configured
     */
    @Provides
@@ -70,6 +71,13 @@ public interface NovaAsyncApi extends Closeable {
    Set<String> getConfiguredZones();
 
    /**
+    * Provides asynchronous access to availability zone features
+    */
+   @Delegate
+   AvailabilityZoneAPI getAvailabilityZoneApi(
+         @EndpointParam(parser = ZoneToEndpoint.class) @Nullable String zone);
+
+   /**
     * Provides asynchronous access to Server features.
     */
    @Delegate

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
index 2a028c1..556ec60 100644
--- 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaRestClientModule.java
@@ -31,6 +31,8 @@ import org.jclouds.http.annotation.Redirection;
 import org.jclouds.http.annotation.ServerError;
 import org.jclouds.openstack.nova.v2_0.NovaApi;
 import org.jclouds.openstack.nova.v2_0.NovaAsyncApi;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAPI;
+import org.jclouds.openstack.nova.v2_0.extensions.AvailabilityZoneAsyncApi;
 import org.jclouds.openstack.nova.v2_0.extensions.ExtensionNamespaces;
 import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsApi;
 import org.jclouds.openstack.nova.v2_0.extensions.FlavorExtraSpecsAsyncApi;
@@ -100,6 +102,7 @@ public class NovaRestClientModule<S extends NovaApi, A 
extends NovaAsyncApi> ext
          .put(ImageApi.class, ImageAsyncApi.class)
          .put(ExtensionApi.class, ExtensionAsyncApi.class)
          .put(FloatingIPApi.class, FloatingIPAsyncApi.class)
+         .put(AvailabilityZoneAPI.class, AvailabilityZoneAsyncApi.class)
          .put(SecurityGroupApi.class, SecurityGroupAsyncApi.class)
          .put(KeyPairApi.class, KeyPairAsyncApi.class)
          .put(HostAdministrationApi.class, HostAdministrationAsyncApi.class)

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
new file mode 100644
index 0000000..6946961
--- /dev/null
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/AvailabilityZone.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain.zonescoped;
+
+import com.google.common.base.Objects;
+import com.google.gson.annotations.SerializedName;
+
+import java.beans.ConstructorProperties;
+
+/**
+ * @author Inbar Stolberg
+ */
+public class AvailabilityZone {
+
+   @SerializedName("zoneName")
+   private final String name;
+   private final ZoneState state;
+
+   @ConstructorProperties({"zoneName" , "zoneState"})
+   protected AvailabilityZone(String name, ZoneState state) {
+      this.name = name;
+      this.state = state;
+   }
+
+   public String getName() {
+      return name;
+   }
+
+   public ZoneState getState() {
+      return state;
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(name, state);
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+      if (this != obj) return false;
+      if (obj == null || getClass() != obj.getClass()) return false;
+      AvailabilityZone that = AvailabilityZone.class.cast(obj);
+      return Objects.equal(this.name, that.name) && Objects.equal(this.state, 
that.state);
+   }
+
+   protected Objects.ToStringHelper string() {
+      return Objects.toStringHelper(this)
+            .add("name", name)
+            .add("state", state);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
new file mode 100644
index 0000000..684ed9c
--- /dev/null
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/zonescoped/ZoneState.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.domain.zonescoped;
+
+import com.google.common.base.Objects;
+import java.beans.ConstructorProperties;
+
+/**
+ * @author Inbar Stolberg
+ */
+public class ZoneState {
+
+   private final boolean available;
+
+   protected ZoneState(boolean available) {
+      this.available = available;
+   }
+
+   public boolean available() {
+      return this.available;
+   }
+
+   @Override
+   public int hashCode() {
+      return Objects.hashCode(available);
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+      if (this != obj) return false;
+      if (obj == null || getClass() != obj.getClass()) return false;
+      ZoneState that = ZoneState.class.cast(obj);
+      return Objects.equal(this.available, that.available);
+   }
+
+   protected Objects.ToStringHelper string() {
+      return Objects.toStringHelper(this)
+            .add("available", available);
+   }
+
+   @Override
+   public String toString() {
+      return string().toString();
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
new file mode 100644
index 0000000..d92804f
--- /dev/null
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAPI.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.extensions;
+
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+
+/**
+ * @author Inbar Stolberg
+ */
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = 
ExtensionNamespaces.ADMIN_ACTIONS)
+public interface AvailabilityZoneAPI {
+
+   /**
+    * @return all availability zones
+    */
+   FluentIterable<? extends AvailabilityZone> list();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
new file mode 100644
index 0000000..522fb87
--- /dev/null
+++ 
b/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneAsyncApi.java
@@ -0,0 +1,58 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.extensions;
+
+
+import com.google.common.annotations.Beta;
+import com.google.common.collect.FluentIterable;
+import com.google.common.util.concurrent.ListenableFuture;
+import org.jclouds.Fallbacks;
+import org.jclouds.openstack.keystone.v2_0.filters.AuthenticateRequest;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.v2_0.ServiceType;
+import org.jclouds.openstack.v2_0.services.Extension;
+import org.jclouds.rest.annotations.Fallback;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.SelectJson;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Inbar Stolberg
+ */
+
+@Beta
+@Extension(of = ServiceType.COMPUTE, namespace = 
ExtensionNamespaces.ADMIN_ACTIONS)
+@RequestFilters(AuthenticateRequest.class)
+public interface AvailabilityZoneAsyncApi {
+
+   /**
+    * @return all availability zones
+    */
+   @GET
+   @Path("/os-availability-zone")
+   @SelectJson("availabilityZoneInfo")
+   @Consumes(MediaType.APPLICATION_JSON)
+   @Fallback(Fallbacks.EmptyFluentIterableOnNotFoundOr404.class)
+   ListenableFuture<? extends FluentIterable<? extends AvailabilityZone>> 
list();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
 
b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
new file mode 100644
index 0000000..f033a1b
--- /dev/null
+++ 
b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZoneApiExpectTest.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.extensions;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableSet;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.v2_0.NovaApi;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author Inbar Stolberg
+ */
+@Test(groups = "unit", testName = "AvailabilityZoneApiExpectTest")
+public class AvailabilityZoneApiExpectTest extends BaseNovaApiExpectTest {
+
+   public void testLAvailabilityZonesList() throws Exception {
+      HttpRequest list = HttpRequest
+            .builder()
+            .method("GET")
+            
.endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/os-availability-zone";)
+            .addHeader("Accept", "application/json")
+            .addHeader("X-Auth-Token", authToken).build();
+
+      HttpResponse listResponse = HttpResponse.builder().statusCode(200)
+            
.payload(payloadFromResource("/listAvailabilityZones.json")).build();
+
+      NovaApi availabilityZonesApi = 
requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName,
+            responseWithKeystoneAccess, extensionsOfNovaRequest, 
extensionsOfNovaResponse, list, listResponse);
+
+      assertEquals(availabilityZonesApi.getConfiguredZones(), 
ImmutableSet.of("az-1.region-a.geo-1", "az-2.region-a.geo-1", 
"az-3.region-a.geo-1"));
+
+      FluentIterable<? extends AvailabilityZone> zones = 
availabilityZonesApi.getAvailabilityZoneApi("az-1.region-a.geo-1").list();
+
+      Optional<? extends AvailabilityZone> zone = zones.first();
+
+      assertTrue(zone.isPresent(), "Couldn't find zone");
+      assertTrue(zone.get().getName().equals("nova"), "Expected zone name to 
be nova but it was: " + zone.get().getName());
+      assertTrue(zone.get().getState().available(), "Zone: "+ 
zone.get().getName() + " is not available.");
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
 
b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
new file mode 100644
index 0000000..81e5d6c
--- /dev/null
+++ 
b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/AvailabilityZonesApiLiveTest.java
@@ -0,0 +1,45 @@
+/**
+ * Licensed to jclouds, Inc. (jclouds) under one or more
+ * contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  jclouds licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jclouds.openstack.nova.v2_0.extensions;
+
+import com.google.common.collect.FluentIterable;
+import org.jclouds.openstack.nova.v2_0.domain.zonescoped.AvailabilityZone;
+import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiLiveTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @author inbar stolberg
+ */
+@Test(groups = "live", testName = "AvailabilityZonesApiLiveTest")
+public class AvailabilityZonesApiLiveTest extends BaseNovaApiLiveTest {
+
+   @Test
+   public void testListAvailabilityZones() throws Exception {
+
+      AvailabilityZoneAPI availabilityZoneApi = 
api.getAvailabilityZoneApi("RegionOne");
+      FluentIterable<? extends AvailabilityZone> zones = 
availabilityZoneApi.list();
+
+      for (AvailabilityZone zone : zones) {
+         assertNotNull(zone.getName());
+         assertTrue(zone.getState().available(), "zone: " + zone.getName() + " 
is not available.");
+      }
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/725b7c5c/apis/openstack-nova/src/test/resources/listAvailabilityZones.json
----------------------------------------------------------------------
diff --git a/apis/openstack-nova/src/test/resources/listAvailabilityZones.json 
b/apis/openstack-nova/src/test/resources/listAvailabilityZones.json
new file mode 100644
index 0000000..2d4ad78
--- /dev/null
+++ b/apis/openstack-nova/src/test/resources/listAvailabilityZones.json
@@ -0,0 +1,11 @@
+{
+    "availabilityZoneInfo": [
+        {
+            "zoneState": {
+                "available": true
+            },
+            "hosts": null,
+            "zoneName": "nova"
+        }
+    ]
+}

Reply via email to