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:13:13 UTC

[08/20] JCLOUDS-150 - Removal of async from AWS - specifically EC2

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/ec2/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java
----------------------------------------------------------------------
diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java
index ecc9ace..8914805 100644
--- a/apis/ec2/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java
+++ b/apis/ec2/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java
@@ -25,13 +25,14 @@ import java.util.Map;
 import java.util.Set;
 
 import org.easymock.classextension.IMocksControl;
-import org.jclouds.ec2.EC2Client;
+import org.jclouds.ec2.EC2Api;
 import org.jclouds.ec2.domain.AvailabilityZoneInfo;
-import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
+import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
 import org.jclouds.http.HttpCommand;
 import org.jclouds.http.HttpResponseException;
 import org.testng.annotations.Test;
 
+import com.google.common.base.Optional;
 import com.google.common.base.Suppliers;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
@@ -46,15 +47,15 @@ public class DescribeAvailabilityZonesInRegionTest {
    @Test
    public void testDescribeAvailabilityZonesInRegion_BestEffort() {
       IMocksControl control = createControl();
-      EC2Client client = control.createMock(EC2Client.class);
-      AvailabilityZoneAndRegionClient regionClient = control.createMock(AvailabilityZoneAndRegionClient.class);
+      EC2Api client = control.createMock(EC2Api.class);
+      AvailabilityZoneAndRegionApi regionClient = control.createMock(AvailabilityZoneAndRegionApi.class);
       AvailabilityZoneInfo info1 = control.createMock(AvailabilityZoneInfo.class);
       AvailabilityZoneInfo info2 = control.createMock(AvailabilityZoneInfo.class);
       HttpCommand command = control.createMock(HttpCommand.class);
       HttpResponseException exception = new HttpResponseException("Error: Unable to tunnel through proxy: ...",
                command, null);
 
-      expect(client.getAvailabilityZoneAndRegionServices()).andStubReturn(regionClient);
+      expect(client.getAvailabilityZoneAndRegionApi()).andStubReturn((Optional) Optional.of(regionClient));
       expect(regionClient.describeAvailabilityZonesInRegion("accessibleRegion1")).andReturn(
                ImmutableSet.of(info1));
       expect(regionClient.describeAvailabilityZonesInRegion("inaccessibleRegion")).andThrow(exception);
@@ -79,13 +80,13 @@ public class DescribeAvailabilityZonesInRegionTest {
    @Test
    public void testDescribeAvailabilityZonesInRegion_RethrowIfNoneFound() {
       IMocksControl control = createControl();
-      EC2Client client = control.createMock(EC2Client.class);
-      AvailabilityZoneAndRegionClient regionClient = control.createMock(AvailabilityZoneAndRegionClient.class);
+      EC2Api client = control.createMock(EC2Api.class);
+      AvailabilityZoneAndRegionApi regionClient = control.createMock(AvailabilityZoneAndRegionApi.class);
       HttpCommand command = control.createMock(HttpCommand.class);
       HttpResponseException exception = new HttpResponseException("Error: Unable to tunnel through proxy: ...",
                command, null);
 
-      expect(client.getAvailabilityZoneAndRegionServices()).andStubReturn(regionClient);
+      expect(client.getAvailabilityZoneAndRegionApi()).andStubReturn((Optional) Optional.of(regionClient));
       expect(regionClient.describeAvailabilityZonesInRegion("inaccessibleRegion")).andThrow(exception);
 
       Set<String> regions = ImmutableSet.of("inaccessibleRegion");
@@ -105,10 +106,10 @@ public class DescribeAvailabilityZonesInRegionTest {
    @Test
    public void testDescribeAvailabilityZonesInRegion_NoZones() {
       IMocksControl control = createControl();
-      EC2Client client = control.createMock(EC2Client.class);
-      AvailabilityZoneAndRegionClient regionClient = control.createMock(AvailabilityZoneAndRegionClient.class);
+      EC2Api client = control.createMock(EC2Api.class);
+      AvailabilityZoneAndRegionApi regionClient = control.createMock(AvailabilityZoneAndRegionApi.class);
 
-      expect(client.getAvailabilityZoneAndRegionServices()).andStubReturn(regionClient);
+      expect(client.getAvailabilityZoneAndRegionApi()).andStubReturn((Optional) Optional.of(regionClient));
       expect(regionClient.describeAvailabilityZonesInRegion("emptyRegion")).andReturn(
                ImmutableSet.<AvailabilityZoneInfo> of());
 

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Api.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Api.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Api.java
new file mode 100644
index 0000000..47800ac
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Api.java
@@ -0,0 +1,47 @@
+/*
+ * 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.openstack.nova.ec2;
+
+import org.jclouds.ec2.EC2Api;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
+import org.jclouds.openstack.nova.ec2.features.NovaEC2KeyPairApi;
+import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.rest.annotations.EndpointParam;
+
+import com.google.common.base.Optional;
+
+/**
+ * Provides synchronous access to EC2 services.
+ * 
+ * @author Adam Lowe
+ */
+public interface NovaEC2Api extends EC2Api {
+
+   /**
+    * {@inheritDoc}
+    */
+   @Delegate
+   @Override
+   Optional<? extends NovaEC2KeyPairApi> getKeyPairApi();
+   
+   @Delegate
+   @Override
+   Optional<? extends NovaEC2KeyPairApi> getKeyPairApiForRegion(
+            @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java
index 5c6a22c..d24e334 100644
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2ApiMetadata.java
@@ -30,7 +30,7 @@ import org.jclouds.ec2.EC2ApiMetadata;
 import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
 import org.jclouds.openstack.nova.ec2.config.HyphenToNullIso8601Module;
 import org.jclouds.openstack.nova.ec2.config.NovaEC2ComputeServiceContextModule;
-import org.jclouds.openstack.nova.ec2.config.NovaEC2RestClientModule;
+import org.jclouds.openstack.nova.ec2.config.NovaEC2HttpApiModule;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.reflect.TypeToken;
@@ -43,15 +43,6 @@ import com.google.inject.Module;
  */
 public class NovaEC2ApiMetadata extends EC2ApiMetadata {
 
-   /**
-    * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaEC2Client.class)} as
-    *             {@link NovaEC2AsyncClient} interface will be removed in jclouds 1.7.
-    */
-   @Deprecated
-   public static final TypeToken<org.jclouds.rest.RestContext<NovaEC2Client, NovaEC2AsyncClient>> CONTEXT_TOKEN = new TypeToken<org.jclouds.rest.RestContext<NovaEC2Client, NovaEC2AsyncClient>>() {
-      private static final long serialVersionUID = 1L;
-   };
-
    @Override
    public Builder toBuilder() {
       return new Builder().fromApiMetadata(this);
@@ -85,15 +76,13 @@ public class NovaEC2ApiMetadata extends EC2ApiMetadata {
    public static class Builder extends EC2ApiMetadata.Builder<Builder> {
       @SuppressWarnings("deprecation")
       protected Builder(){
-         super(NovaEC2Client.class, NovaEC2AsyncClient.class);
          id("openstack-nova-ec2")
          .name("OpenStack Nova's EC2-clone API")
          .version("2009-04-04")
          .defaultEndpoint("http://localhost:8773/services/Cloud")
          .defaultProperties(NovaEC2ApiMetadata.defaultProperties())
-         .context(CONTEXT_TOKEN)
          .defaultModules(ImmutableSet.<Class<? extends Module>>builder()
-                                     .add(NovaEC2RestClientModule.class)
+                                     .add(NovaEC2HttpApiModule.class)
                                      .add(EC2ResolveImagesModule.class)
                                      .add(NovaEC2ComputeServiceContextModule.class)
                                      .add(HyphenToNullIso8601Module.class).build());

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java
deleted file mode 100644
index 0e208e9..0000000
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2AsyncClient.java
+++ /dev/null
@@ -1,38 +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.openstack.nova.ec2;
-
-import org.jclouds.ec2.EC2AsyncClient;
-import org.jclouds.openstack.nova.ec2.services.NovaEC2KeyPairAsyncClient;
-import org.jclouds.rest.annotations.Delegate;
-
-/**
- * Provides asynchronous access to EC2 services.
- * 
- * @author Adam Lowe
- * @deprecated please use {@code org.jclouds.ContextBuilder#buildApi(NovaEC2Client.class)} as
- *             {@link NovaEC2AsyncClient} interface will be removed in jclouds 1.7.
- */
-@Deprecated
-public interface NovaEC2AsyncClient extends EC2AsyncClient {
-   /**
-    * {@inheritDoc}
-    */
-   @Delegate
-   @Override
-   NovaEC2KeyPairAsyncClient getKeyPairServices();
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Client.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Client.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Client.java
deleted file mode 100644
index f0c0bea..0000000
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/NovaEC2Client.java
+++ /dev/null
@@ -1,36 +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.openstack.nova.ec2;
-
-import org.jclouds.ec2.EC2Client;
-import org.jclouds.openstack.nova.ec2.services.NovaEC2KeyPairClient;
-import org.jclouds.rest.annotations.Delegate;
-
-/**
- * Provides synchronous access to EC2 services.
- * 
- * @author Adam Lowe
- */
-public interface NovaEC2Client extends EC2Client {
-
-   /**
-    * {@inheritDoc}
-    */
-   @Delegate
-   @Override
-   NovaEC2KeyPairClient getKeyPairServices();   
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2HttpApiModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2HttpApiModule.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2HttpApiModule.java
new file mode 100644
index 0000000..08ff665
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2HttpApiModule.java
@@ -0,0 +1,81 @@
+/*
+ * 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.openstack.nova.ec2.config;
+
+import static org.jclouds.reflect.Reflection2.typeToken;
+
+import java.util.Map;
+
+import javax.inject.Singleton;
+
+import org.jclouds.ec2.EC2Api;
+import org.jclouds.ec2.config.BaseEC2HttpApiModule;
+import org.jclouds.ec2.features.SubnetApi;
+import org.jclouds.ec2.features.TagApi;
+import org.jclouds.ec2.features.WindowsApi;
+import org.jclouds.ec2.features.AMIApi;
+import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
+import org.jclouds.ec2.features.ElasticIPAddressApi;
+import org.jclouds.ec2.features.InstanceApi;
+import org.jclouds.ec2.features.SecurityGroupApi;
+import org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion;
+import org.jclouds.ec2.xml.CreateVolumeResponseHandler;
+import org.jclouds.ec2.xml.DescribeImagesResponseHandler;
+import org.jclouds.location.config.LocationModule;
+import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
+import org.jclouds.location.suppliers.ZoneIdsSupplier;
+import org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues;
+import org.jclouds.openstack.nova.ec2.NovaEC2Api;
+import org.jclouds.openstack.nova.ec2.features.NovaEC2KeyPairApi;
+import org.jclouds.openstack.nova.ec2.xml.NovaCreateVolumeResponseHandler;
+import org.jclouds.openstack.nova.ec2.xml.NovaDescribeImagesResponseHandler;
+import org.jclouds.rest.ConfiguresHttpApi;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Provides;
+import com.google.inject.Scopes;
+
+/**
+ * 
+ * @author Adrian Cole
+ * @author Adam Lowe
+ */
+@ConfiguresHttpApi
+public class NovaEC2HttpApiModule extends BaseEC2HttpApiModule<NovaEC2Api> {
+
+   public NovaEC2HttpApiModule() {
+      super(NovaEC2Api.class);
+   }
+   
+   @Override
+   protected void configure() {
+      bind(EC2Api.class).to(NovaEC2Api.class);
+      super.configure();
+      bind(CreateVolumeResponseHandler.class).to(NovaCreateVolumeResponseHandler.class).in(Scopes.SINGLETON);
+      bind(DescribeImagesResponseHandler.class).to(NovaDescribeImagesResponseHandler.class);
+   }
+
+   @Override
+   protected void installLocations() {
+      install(new LocationModule());
+      bind(RegionIdToZoneIdsSupplier.class).to(DescribeAvailabilityZonesInRegion.class).in(Scopes.SINGLETON);
+      // there is only one region, and its endpoint is the same as the provider
+      bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2RestClientModule.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2RestClientModule.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2RestClientModule.java
deleted file mode 100644
index 0669f14..0000000
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/config/NovaEC2RestClientModule.java
+++ /dev/null
@@ -1,118 +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.openstack.nova.ec2.config;
-
-import static org.jclouds.reflect.Reflection2.typeToken;
-
-import java.util.Map;
-
-import javax.inject.Singleton;
-
-import org.jclouds.ec2.EC2AsyncClient;
-import org.jclouds.ec2.EC2Client;
-import org.jclouds.ec2.config.EC2RestClientModule;
-import org.jclouds.ec2.features.SubnetApi;
-import org.jclouds.ec2.features.SubnetAsyncApi;
-import org.jclouds.ec2.features.TagApi;
-import org.jclouds.ec2.features.TagAsyncApi;
-import org.jclouds.ec2.features.WindowsApi;
-import org.jclouds.ec2.features.WindowsAsyncApi;
-import org.jclouds.ec2.services.AMIAsyncClient;
-import org.jclouds.ec2.services.AMIClient;
-import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
-import org.jclouds.ec2.services.AvailabilityZoneAndRegionClient;
-import org.jclouds.ec2.services.ElasticBlockStoreAsyncClient;
-import org.jclouds.ec2.services.ElasticBlockStoreClient;
-import org.jclouds.ec2.services.ElasticIPAddressAsyncClient;
-import org.jclouds.ec2.services.ElasticIPAddressClient;
-import org.jclouds.ec2.services.InstanceAsyncClient;
-import org.jclouds.ec2.services.InstanceClient;
-import org.jclouds.ec2.services.SecurityGroupAsyncClient;
-import org.jclouds.ec2.services.SecurityGroupClient;
-import org.jclouds.ec2.services.WindowsAsyncClient;
-import org.jclouds.ec2.services.WindowsClient;
-import org.jclouds.ec2.suppliers.DescribeAvailabilityZonesInRegion;
-import org.jclouds.ec2.xml.CreateVolumeResponseHandler;
-import org.jclouds.ec2.xml.DescribeImagesResponseHandler;
-import org.jclouds.location.config.LocationModule;
-import org.jclouds.location.suppliers.RegionIdToZoneIdsSupplier;
-import org.jclouds.location.suppliers.ZoneIdsSupplier;
-import org.jclouds.location.suppliers.derived.ZoneIdsFromRegionIdToZoneIdsValues;
-import org.jclouds.openstack.nova.ec2.NovaEC2AsyncClient;
-import org.jclouds.openstack.nova.ec2.NovaEC2Client;
-import org.jclouds.openstack.nova.ec2.services.NovaEC2KeyPairAsyncClient;
-import org.jclouds.openstack.nova.ec2.services.NovaEC2KeyPairClient;
-import org.jclouds.openstack.nova.ec2.xml.NovaCreateVolumeResponseHandler;
-import org.jclouds.openstack.nova.ec2.xml.NovaDescribeImagesResponseHandler;
-import org.jclouds.rest.ConfiguresRestClient;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-/**
- * 
- * @author Adrian Cole
- * @author Adam Lowe
- */
-@ConfiguresRestClient
-public class NovaEC2RestClientModule extends EC2RestClientModule<NovaEC2Client, NovaEC2AsyncClient> {
-   public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()//
-         .put(AMIClient.class, AMIAsyncClient.class)//
-         .put(ElasticIPAddressClient.class, ElasticIPAddressAsyncClient.class)//
-         .put(InstanceClient.class, InstanceAsyncClient.class)//
-         .put(NovaEC2KeyPairClient.class, NovaEC2KeyPairAsyncClient.class)//
-         .put(SecurityGroupClient.class, SecurityGroupAsyncClient.class)//
-         .put(WindowsClient.class, WindowsAsyncClient.class)//
-         .put(AvailabilityZoneAndRegionClient.class, AvailabilityZoneAndRegionAsyncClient.class)//
-         .put(ElasticBlockStoreClient.class, ElasticBlockStoreAsyncClient.class)//
-         .put(WindowsApi.class, WindowsAsyncApi.class)//
-         .put(TagApi.class, TagAsyncApi.class)//
-         .put(SubnetApi.class, SubnetAsyncApi.class)//
-         .build();
-
-   public NovaEC2RestClientModule() {
-      super(typeToken(NovaEC2Client.class), typeToken(NovaEC2AsyncClient.class), DELEGATE_MAP);
-   }
-   
-   @Override
-   protected void configure() {
-      super.configure();
-      bind(CreateVolumeResponseHandler.class).to(NovaCreateVolumeResponseHandler.class).in(Scopes.SINGLETON);
-      bind(DescribeImagesResponseHandler.class).to(NovaDescribeImagesResponseHandler.class);
-   }
-
-   @Override
-   protected void installLocations() {
-      install(new LocationModule());
-      bind(RegionIdToZoneIdsSupplier.class).to(DescribeAvailabilityZonesInRegion.class).in(Scopes.SINGLETON);
-      // there is only one region, and its endpoint is the same as the provider
-      bind(ZoneIdsSupplier.class).to(ZoneIdsFromRegionIdToZoneIdsValues.class).in(Scopes.SINGLETON);
-   }
-
-   @Singleton
-   @Provides
-   EC2Client provide(NovaEC2Client in) {
-      return in;
-   }
-
-   @Singleton
-   @Provides
-   EC2AsyncClient provide(NovaEC2AsyncClient in) {
-      return in;
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApi.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApi.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApi.java
new file mode 100644
index 0000000..b1a21c4
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApi.java
@@ -0,0 +1,88 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import static org.jclouds.aws.reference.FormParameters.ACTION;
+
+import javax.inject.Named;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+
+import org.jclouds.aws.filters.FormSigner;
+import org.jclouds.ec2.domain.KeyPair;
+import org.jclouds.ec2.features.KeyPairApi;
+import org.jclouds.ec2.functions.EncodedRSAPublicKeyToBase64;
+import org.jclouds.ec2.xml.KeyPairResponseHandler;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
+import org.jclouds.rest.annotations.EndpointParam;
+import org.jclouds.rest.annotations.FormParams;
+import org.jclouds.rest.annotations.ParamParser;
+import org.jclouds.rest.annotations.RequestFilters;
+import org.jclouds.rest.annotations.VirtualHost;
+import org.jclouds.rest.annotations.XMLResponseParser;
+
+/**
+ * @author Adrian Cole
+ */
+@RequestFilters(FormSigner.class)
+@VirtualHost
+public interface NovaEC2KeyPairApi extends KeyPairApi {
+
+   /**
+    * Imports the public key from an RSA key pair that you created with a third-party tool. Compare
+    * this with CreateKeyPair, in which AWS creates the key pair and gives the keys to you (Nova
+    * keeps a copy of the public key). With ImportKeyPair, you create the key pair and give Nova just
+    * the public key. The private key is never transferred between you and Nova.
+    * 
+    * <p/>
+    * You can easily create an RSA key pair on Windows and Linux using the ssh-keygen command line
+    * tool (provided with the standard OpenSSH installation). Standard library support for RSA key
+    * pair creation is also available in Java, Ruby, Python, and many other programming languages.
+    * 
+    * <p/>
+    * <h4>Supported Formats</h4>
+    * <ul>
+    * <li>OpenSSH public key format (e.g., the format in ~/.ssh/authorized_keys)</li>
+    * <li>Base64 encoded DER format</li>
+    * <li>SSH public key file format as specified in RFC4716</li>
+    * </ul>
+    * DSA keys are not supported. Make sure your key generator is set up to create RSA keys.
+    * <p/>
+    * Supported lengths: 1024, 2048, and 4096.
+    * <p/>
+    * 
+    * @param region
+    *           region to import the key into
+    * @param keyName
+    *           A unique name for the key pair. Accepts alphanumeric characters, spaces, dashes, and
+    *           underscores.
+    * @param publicKeyMaterial
+    *           The public key
+    * @return imported key including fingerprint
+    */
+   @Named("keypair:import")
+   @POST
+   @Path("/")
+   @FormParams(keys = ACTION, values = "ImportKeyPair")
+   @XMLResponseParser(KeyPairResponseHandler.class)
+   KeyPair importKeyPairInRegion(
+         @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
+         @FormParam("KeyName") String keyName,
+         @FormParam("PublicKeyMaterial") @ParamParser(EncodedRSAPublicKeyToBase64.class) String publicKeyMaterial);
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java
index b9c1e76..77c9a29 100644
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java
+++ b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/loaders/NovaCreateSecurityGroupIfNeeded.java
@@ -23,7 +23,7 @@ import javax.inject.Named;
 import javax.inject.Singleton;
 
 import org.jclouds.aws.AWSResponseException;
-import org.jclouds.ec2.EC2Client;
+import org.jclouds.ec2.EC2Api;
 import org.jclouds.ec2.compute.domain.RegionAndName;
 import org.jclouds.ec2.compute.loaders.CreateSecurityGroupIfNeeded;
 
@@ -37,9 +37,9 @@ import com.google.common.base.Predicate;
 public class NovaCreateSecurityGroupIfNeeded extends CreateSecurityGroupIfNeeded {
 
    @Inject
-   public NovaCreateSecurityGroupIfNeeded(EC2Client ec2Client,
+   public NovaCreateSecurityGroupIfNeeded(EC2Api ec2Client,
             @Named("SECURITY") Predicate<RegionAndName> securityGroupEventualConsistencyDelay) {
-      super(checkNotNull(ec2Client, "ec2Client").getSecurityGroupServices(), securityGroupEventualConsistencyDelay);
+      super(checkNotNull(ec2Client, "ec2Client").getSecurityGroupApi().get(), securityGroupEventualConsistencyDelay);
    }
 
    protected void authorizeGroupToItself(String region, String name) {

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairAsyncClient.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairAsyncClient.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairAsyncClient.java
deleted file mode 100644
index d1fcd46..0000000
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairAsyncClient.java
+++ /dev/null
@@ -1,61 +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.openstack.nova.ec2.services;
-
-import static org.jclouds.aws.reference.FormParameters.ACTION;
-
-import javax.inject.Named;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-
-import org.jclouds.aws.filters.FormSigner;
-import org.jclouds.ec2.domain.KeyPair;
-import org.jclouds.ec2.functions.EncodedRSAPublicKeyToBase64;
-import org.jclouds.ec2.services.KeyPairAsyncClient;
-import org.jclouds.ec2.xml.KeyPairResponseHandler;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.FormParams;
-import org.jclouds.rest.annotations.ParamParser;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.VirtualHost;
-import org.jclouds.rest.annotations.XMLResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * @author Adrian Cole
- */
-@RequestFilters(FormSigner.class)
-@VirtualHost
-public interface NovaEC2KeyPairAsyncClient extends KeyPairAsyncClient {
-
-   /**
-    * @see NovaEC2KeyPairClient#importKeyPairInRegion(String, String, String)
-    */
-   @Named("keypair:import")
-   @POST
-   @Path("/")
-   @FormParams(keys = ACTION, values = "ImportKeyPair")
-   @XMLResponseParser(KeyPairResponseHandler.class)
-   ListenableFuture<KeyPair> importKeyPairInRegion(
-         @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region,
-         @FormParam("KeyName") String keyName,
-         @FormParam("PublicKeyMaterial") @ParamParser(EncodedRSAPublicKeyToBase64.class) String publicKeyMaterial);
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairClient.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairClient.java b/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairClient.java
deleted file mode 100644
index bb20296..0000000
--- a/apis/openstack-nova-ec2/src/main/java/org/jclouds/openstack/nova/ec2/services/NovaEC2KeyPairClient.java
+++ /dev/null
@@ -1,63 +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.openstack.nova.ec2.services;
-
-import org.jclouds.ec2.domain.KeyPair;
-import org.jclouds.ec2.services.KeyPairClient;
-import org.jclouds.javax.annotation.Nullable;
-
-/**
- * 
- * @author Adrian Cole
- */
-public interface NovaEC2KeyPairClient extends KeyPairClient {
-
-   /**
-    * Imports the public key from an RSA key pair that you created with a third-party tool. Compare
-    * this with CreateKeyPair, in which AWS creates the key pair and gives the keys to you (Nova
-    * keeps a copy of the public key). With ImportKeyPair, you create the key pair and give Nova just
-    * the public key. The private key is never transferred between you and Nova.
-    * 
-    * <p/>
-    * You can easily create an RSA key pair on Windows and Linux using the ssh-keygen command line
-    * tool (provided with the standard OpenSSH installation). Standard library support for RSA key
-    * pair creation is also available in Java, Ruby, Python, and many other programming languages.
-    * 
-    * <p/>
-    * <h4>Supported Formats</h4>
-    * <ul>
-    * <li>OpenSSH public key format (e.g., the format in ~/.ssh/authorized_keys)</li>
-    * <li>Base64 encoded DER format</li>
-    * <li>SSH public key file format as specified in RFC4716</li>
-    * </ul>
-    * DSA keys are not supported. Make sure your key generator is set up to create RSA keys.
-    * <p/>
-    * Supported lengths: 1024, 2048, and 4096.
-    * <p/>
-    * 
-    * @param region
-    *           region to import the key into
-    * @param keyName
-    *           A unique name for the key pair. Accepts alphanumeric characters, spaces, dashes, and
-    *           underscores.
-    * @param publicKeyMaterial
-    *           The public key
-    * @return imported key including fingerprint
-    */
-   KeyPair importKeyPairInRegion(@Nullable String region, String keyName, String publicKeyMaterial);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiExpectTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiExpectTest.java
new file mode 100644
index 0000000..492346a
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiExpectTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.openstack.nova.ec2.features;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Set;
+
+import org.jclouds.ec2.domain.Image;
+import org.jclouds.ec2.features.AMIApi;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.ec2.internal.BaseNovaEC2RestApiExpectTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "NovaEC2ElasticBlockStoreApiTest")
+public class NovaEC2AMIApiExpectTest extends BaseNovaEC2RestApiExpectTest {
+
+   public void testDescribeImagesWithNonMachineTypes() {
+      AMIApi client = requestsSendResponses(
+            describeAvailabilityZonesRequest,
+            describeAvailabilityZonesResponse,
+            HttpRequest.builder().method("POST")
+                  .endpoint("http://localhost:8773/services/Cloud/")
+                  .addHeader("Host", "localhost:8773")
+                  .payload(payloadFromStringWithContentType("Action=DescribeImages&Signature=Z3q3jSutwlfgvbcINT0Ed3AjrjxM4WMvQloXu/1kd40%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity", "application/x-www-form-urlencoded")).build(),
+            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nova_ec2_images_with_ramdisk.xml")).build()
+                                               ).getAMIApi().get();
+
+      Set<? extends Image> images = client.describeImagesInRegion("nova");
+      
+      assertEquals(images.size(), 1);
+      
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiLiveTest.java
new file mode 100644
index 0000000..4110467
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AMIApiLiveTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import org.jclouds.ec2.features.AMIApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaEC2AMIApiLiveTest")
+public class NovaEC2AMIApiLiveTest extends AMIApiLiveTest {
+   public NovaEC2AMIApiLiveTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AvailabilityZoneAndRegionApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AvailabilityZoneAndRegionApiLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AvailabilityZoneAndRegionApiLiveTest.java
new file mode 100644
index 0000000..be4ac8d
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2AvailabilityZoneAndRegionApiLiveTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import org.jclouds.ec2.features.AvailabilityZoneAndRegionApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaEC2AvailabilityZoneAndRegionApiLiveTest")
+public class NovaEC2AvailabilityZoneAndRegionApiLiveTest extends AvailabilityZoneAndRegionApiLiveTest {
+   public NovaEC2AvailabilityZoneAndRegionApiLiveTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreApiLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreApiLiveTest.java
new file mode 100644
index 0000000..7714579
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreApiLiveTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import org.jclouds.ec2.features.ElasticBlockStoreApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaEC2ElasticBlockStoreApiLiveTest")
+public class NovaEC2ElasticBlockStoreApiLiveTest extends ElasticBlockStoreApiLiveTest {
+   public NovaEC2ElasticBlockStoreApiLiveTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreExpectApiTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreExpectApiTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreExpectApiTest.java
new file mode 100644
index 0000000..0c6151e
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticBlockStoreExpectApiTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import static org.testng.Assert.assertEquals;
+
+import java.util.Set;
+
+import org.jclouds.ec2.domain.Attachment;
+import org.jclouds.ec2.domain.Volume;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.ec2.internal.BaseNovaEC2RestApiExpectTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * @author Adam Lowe
+ */
+@Test(groups = "unit", testName = "NovaEC2ElasticBlockStoreApiTest")
+public class NovaEC2ElasticBlockStoreExpectApiTest extends BaseNovaEC2RestApiExpectTest {
+
+   public void testDescribeVolumesWithNovaEC2Status() {
+      ElasticBlockStoreApi client = requestsSendResponses(
+            describeAvailabilityZonesRequest,
+            describeAvailabilityZonesResponse,
+            HttpRequest.builder().method("POST")
+                  .endpoint("http://localhost:8773/services/Cloud/")
+                  .addHeader("Host", "localhost:8773")
+                  .payload(payloadFromStringWithContentType("Action=DescribeVolumes&Signature=AvRznSzGExM%2Buaj2JJj66wq4v4f%2BakicyLooRDtC0t0%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity", "application/x-www-form-urlencoded")).build(),
+            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nova_ec2_describe_volumes.xml")).build()
+                                                          ).getElasticBlockStoreApi().get();
+
+      Set<Volume> expected = ImmutableSet.of(Volume
+            .builder()
+            .status(Volume.Status.AVAILABLE)
+            .availabilityZone("nova")
+            .region("nova")
+            .id("vol-00000007")
+            .size(1)
+            .attachments(Attachment.builder().region("nova").build())
+            .createTime(dateService.iso8601SecondsDateParse("2012-04-10T10:39:52Z"))
+            .build());
+
+      assertEquals(client.describeVolumesInRegion("nova"), expected);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticIPAddressApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticIPAddressApiLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticIPAddressApiLiveTest.java
new file mode 100644
index 0000000..96aaa25
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2ElasticIPAddressApiLiveTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import org.jclouds.ec2.features.ElasticIPAddressApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaEC2ElasticIPAddressApiLiveTest")
+public class NovaEC2ElasticIPAddressApiLiveTest extends ElasticIPAddressApiLiveTest {
+   public NovaEC2ElasticIPAddressApiLiveTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiExpectTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiExpectTest.java
new file mode 100644
index 0000000..7f32f0a
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiExpectTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+
+import java.util.Set;
+
+import org.jclouds.ec2.domain.BlockDevice;
+import org.jclouds.ec2.domain.Reservation;
+import org.jclouds.ec2.domain.RunningInstance;
+import org.jclouds.ec2.features.InstanceApi;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.ec2.internal.BaseNovaEC2RestApiExpectTest;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * @author Adam Lowe
+ */
+public class NovaEC2InstanceApiExpectTest extends BaseNovaEC2RestApiExpectTest {
+
+   public void testDescribeInstancesWithDashesInPlaceOfNullDates() {
+      InstanceApi client = requestsSendResponses(
+            describeAvailabilityZonesRequest,
+            describeAvailabilityZonesResponse,
+            HttpRequest.builder().method("POST")
+                  .endpoint("http://localhost:8773/services/Cloud/")
+                  .addHeader("Host", "localhost:8773")
+                  .payload(payloadFromStringWithContentType("Action=DescribeInstances&Signature=kkCE1HzyntmkICEidOizw50B9yjLdNZvAWUXVse1c8o%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity", "application/x-www-form-urlencoded")).build(),
+            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nova_ec2_describe_instances.xml")).build()
+                                                    ).getInstanceApi().get();
+
+      Set<? extends Reservation<? extends RunningInstance>> response = client.describeInstancesInRegion("nova");
+      
+      assertEquals(response.size(), 3);
+
+      Reservation<? extends RunningInstance> target = Iterables.get(response, 2);
+      RunningInstance runningInstance = Iterables.getOnlyElement(target);
+      BlockDevice bd = Iterables.getOnlyElement(runningInstance.getEbsBlockDevices().values());
+      
+      // this is a '-' in the nova_ec2_describe_instances.xml
+      assertNull(bd.getAttachTime());
+
+      // double-check the other fields
+      assertFalse(bd.isDeleteOnTermination());
+      assertEquals(bd.getVolumeId(), "1");
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiLiveTest.java
new file mode 100644
index 0000000..6a2b236
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2InstanceApiLiveTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import org.jclouds.ec2.features.InstanceApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaEC2InstanceApiLiveTest")
+public class NovaEC2InstanceApiLiveTest extends InstanceApiLiveTest {
+   public NovaEC2InstanceApiLiveTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiExpectTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiExpectTest.java
new file mode 100644
index 0000000..8bc493e
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiExpectTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.ec2.domain.KeyPair;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.ec2.internal.BaseNovaEC2RestApiExpectTest;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+/**
+ * @author Adam Lowe
+ */
+public class NovaEC2KeyPairApiExpectTest extends BaseNovaEC2RestApiExpectTest {
+
+   public void testImportKeyPair() {
+      NovaEC2KeyPairApi client = requestsSendResponses(
+            describeAvailabilityZonesRequest,
+            describeAvailabilityZonesResponse,
+            HttpRequest.builder().method("POST")
+                  .endpoint("http://localhost:8773/services/Cloud/")
+                  .addHeader("Host", "localhost:8773")
+                  .payload(payloadFromStringWithContentType("Action=ImportKeyPair&KeyName=mykey&PublicKeyMaterial=c3NoLXJzYSBBQQ%3D%3D&Signature=wOOKOlDfJezRkx7NKcyOyaBQuY7PoVE3HFa9495RL7s%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity", "application/x-www-form-urlencoded")).build(),
+            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nova_ec2_import_keypair_response.xml")).build()
+      ).getKeyPairApi().get();
+
+      KeyPair result = client.importKeyPairInRegion(null, "mykey", "ssh-rsa AA");
+      assertEquals(result.getKeyName(), "aplowe-nova-ec22");
+      assertEquals(result.getSha1OfPrivateKey(), "e3:fd:de:f6:4c:36:7d:9b:8f:2f:4c:20:f8:ae:b0:ea");
+   }
+
+   @Test(expectedExceptions = ResourceNotFoundException.class)
+   public void testImportKeyPairFailsNotFound() {
+      NovaEC2KeyPairApi client = requestsSendResponses(
+            describeAvailabilityZonesRequest,
+            describeAvailabilityZonesResponse,
+            HttpRequest.builder().method("POST")
+                  .endpoint("http://localhost:8773/services/Cloud/")
+                  .addHeader("Host", "localhost:8773")
+                  .payload(payloadFromStringWithContentType("Action=ImportKeyPair&KeyName=mykey&PublicKeyMaterial=c3NoLXJzYSBBQQ%3D%3D&Signature=wOOKOlDfJezRkx7NKcyOyaBQuY7PoVE3HFa9495RL7s%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity", "application/x-www-form-urlencoded")).build(),
+            HttpResponse.builder().statusCode(404).build()
+      ).getKeyPairApi().get();
+
+      client.importKeyPairInRegion(null, "mykey", "ssh-rsa AA");
+   }
+
+   @Test(expectedExceptions = IllegalStateException.class)
+   public void testImportKeyPairFailsAlreadyExists() {
+      NovaEC2KeyPairApi client = requestsSendResponses(
+            describeAvailabilityZonesRequest,
+            describeAvailabilityZonesResponse,
+            HttpRequest.builder().method("POST")
+                  .endpoint("http://localhost:8773/services/Cloud/")
+                  .addHeader("Host", "localhost:8773")
+                  .payload(payloadFromStringWithContentType("Action=ImportKeyPair&KeyName=mykey&PublicKeyMaterial=c3NoLXJzYSBBQQ%3D%3D&Signature=wOOKOlDfJezRkx7NKcyOyaBQuY7PoVE3HFa9495RL7s%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity", "application/x-www-form-urlencoded")).build(),
+            HttpResponse.builder().statusCode(409).build()
+      ).getKeyPairApi().get();
+
+      client.importKeyPairInRegion(null, "mykey", "ssh-rsa AA");
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiLiveTest.java
new file mode 100644
index 0000000..7b02d12
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2KeyPairApiLiveTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import static com.google.common.collect.Sets.newTreeSet;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+
+import org.jclouds.compute.ComputeTestUtils;
+import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
+import org.jclouds.ec2.domain.KeyPair;
+import org.jclouds.openstack.nova.ec2.NovaEC2Api;
+import org.jclouds.openstack.nova.ec2.NovaEC2ApiMetadata;
+import org.jclouds.ssh.SshKeys;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code NovaKeyPairApi}
+ * 
+ * @author Adam Lowe
+ */
+@Test(groups = "live", singleThreaded = true)
+public class NovaEC2KeyPairApiLiveTest extends BaseComputeServiceContextLiveTest {
+
+   public static final String PREFIX = System.getProperty("user.name") + "-nova-ec2";
+
+   public NovaEC2KeyPairApiLiveTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+   private NovaEC2KeyPairApi client;
+   private Set<String> regions;
+   
+   @Override
+   @BeforeClass(groups = { "integration", "live" })
+   public void setupContext() {
+      super.setupContext();
+      client = view.unwrapApi(NovaEC2Api.class).getKeyPairApi().get();
+      regions = view.unwrapApi(NovaEC2Api.class).getAvailabilityZoneAndRegionApi().get().describeRegions().keySet();
+   }
+
+   @Test
+   void testDescribeKeyPairs() {
+      for (String region : regions) {
+         SortedSet<KeyPair> allResults = newTreeSet(client.describeKeyPairsInRegion(region));
+         assertNotNull(allResults);
+         if (allResults.size() >= 1) {
+            KeyPair pair = allResults.last();
+            SortedSet<KeyPair> result = newTreeSet(client.describeKeyPairsInRegion(region, pair.getKeyName()));
+            assertNotNull(result);
+            KeyPair compare = result.last();
+            assertEquals(compare, pair);
+         }
+      }
+   }
+
+   @Test
+   void testCreateKeyPair() {
+      String keyName = PREFIX + "1";
+      cleanupKeyPair(keyName);
+      try {
+         KeyPair keyPair = client.createKeyPairInRegion(null, keyName);
+         checkKeyPair(keyName, keyPair);
+         assertNotNull(keyPair.getKeyMaterial());
+      } finally {
+         cleanupKeyPair(keyName);
+      }
+   }
+
+   protected void cleanupKeyPair(String keyName) {
+      try {
+         client.deleteKeyPairInRegion(null, keyName);
+      } catch (Exception e) {
+
+      }
+      client.deleteKeyPairInRegion(null, keyName);
+   }
+
+   @Test
+   void testImportKeyPair() throws IOException {
+      String keyName = PREFIX + "2";
+      cleanupKeyPair(keyName);
+      Map<String, String> myKey = ComputeTestUtils.setupKeyPair();
+      try {
+         KeyPair keyPair = client.importKeyPairInRegion(null, keyName, myKey.get("public"));
+         checkKeyPair(keyName, keyPair);
+
+         // check the fingerprint of public key (in the sha10OfPrivateKey field)
+         assertEquals(keyPair.getSha1OfPrivateKey(), SshKeys.fingerprintPublicKey(myKey.get("public")));
+
+         // try again to see if there's an error
+         try {
+            client.importKeyPairInRegion(null, keyName, myKey.get("public"));
+            fail("Duplicate call importKeyPairInRegion should have failed!");
+         } catch (IllegalStateException e) {
+         }
+      } finally {
+         cleanupKeyPair(keyName);
+      }
+   }
+
+   protected void checkKeyPair(String keyName, KeyPair keyPair) {
+      assertNotNull(keyPair);
+      assertNotNull(keyPair.getSha1OfPrivateKey());
+      assertEquals(keyPair.getKeyName(), keyName);
+
+      Set<KeyPair> twoResults = client.describeKeyPairsInRegion(null, keyName);
+      assertNotNull(twoResults);
+      assertEquals(twoResults.size(), 1);
+      KeyPair listPair = twoResults.iterator().next();
+      assertEquals(listPair.getKeyName(), keyPair.getKeyName());
+      assertEquals(listPair.getSha1OfPrivateKey(), keyPair.getSha1OfPrivateKey());
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2SecurityGroupApiLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2SecurityGroupApiLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2SecurityGroupApiLiveTest.java
new file mode 100644
index 0000000..11b30a8
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/features/NovaEC2SecurityGroupApiLiveTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.openstack.nova.ec2.features;
+
+import org.jclouds.ec2.features.SecurityGroupApiLiveTest;
+import org.testng.annotations.Test;
+
+/**
+ * 
+ * @author Adrian Cole
+ */
+@Test(groups = "live", singleThreaded = true, testName = "NovaEC2SecurityGroupApiLiveTest")
+public class NovaEC2SecurityGroupApiLiveTest extends SecurityGroupApiLiveTest {
+   public NovaEC2SecurityGroupApiLiveTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestApiExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestApiExpectTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestApiExpectTest.java
new file mode 100644
index 0000000..462bd53
--- /dev/null
+++ b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestApiExpectTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.openstack.nova.ec2.internal;
+
+import java.net.URI;
+
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.date.DateService;
+import org.jclouds.date.internal.SimpleDateFormatDateService;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.openstack.nova.ec2.NovaEC2Api;
+import org.jclouds.openstack.nova.ec2.config.NovaEC2HttpApiModule;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.BaseRestApiExpectTest;
+
+import com.google.inject.Module;
+import com.google.inject.Provides;
+
+public abstract class BaseNovaEC2RestApiExpectTest extends BaseRestApiExpectTest<NovaEC2Api> {
+   protected static final String CONSTANT_DATE = "2012-04-16T15:54:08.897Z";
+   
+   protected DateService dateService = new SimpleDateFormatDateService();
+   protected URI endpoint = URI.create("http://localhost:8773/services/Cloud/");
+
+   protected HttpRequest describeAvailabilityZonesRequest = HttpRequest
+            .builder()
+            .method("POST")
+            .endpoint(endpoint)
+            .addHeader("Host", "localhost:8773")
+            .payload(payloadFromStringWithContentType(
+                     "Action=DescribeAvailabilityZones&Signature=S3fa5fybw4KAq4o11IpKHlqwx3cVJdKfeAKw3FIJYvM%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity",
+                     MediaType.APPLICATION_FORM_URLENCODED)).build();
+   protected HttpResponse describeAvailabilityZonesResponse = HttpResponse.builder().statusCode(200)
+            .payload(payloadFromResourceWithContentType("/nova_ec2_availabilityZones.xml", MediaType.APPLICATION_XML))
+            .build();
+
+   public BaseNovaEC2RestApiExpectTest() {
+      provider = "openstack-nova-ec2";
+   }
+
+   @ConfiguresHttpApi
+   private static final class TestNovaEC2HttpApiModule extends NovaEC2HttpApiModule {
+
+      @Override
+      @Provides
+      protected String provideTimeStamp(DateService dateService) {
+         return CONSTANT_DATE;
+      }
+   }
+
+   @Override
+   protected Module createModule() {
+      return new TestNovaEC2HttpApiModule();
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestClientExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestClientExpectTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestClientExpectTest.java
deleted file mode 100644
index c57e383..0000000
--- a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/internal/BaseNovaEC2RestClientExpectTest.java
+++ /dev/null
@@ -1,70 +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.openstack.nova.ec2.internal;
-
-import java.net.URI;
-
-import javax.ws.rs.core.MediaType;
-
-import org.jclouds.date.DateService;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.ec2.NovaEC2Client;
-import org.jclouds.openstack.nova.ec2.config.NovaEC2RestClientModule;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.internal.BaseRestClientExpectTest;
-
-import com.google.inject.Module;
-import com.google.inject.Provides;
-
-public abstract class BaseNovaEC2RestClientExpectTest extends BaseRestClientExpectTest<NovaEC2Client> {
-   protected static final String CONSTANT_DATE = "2012-04-16T15:54:08.897Z";
-   
-   protected DateService dateService = new SimpleDateFormatDateService();
-   protected URI endpoint = URI.create("http://localhost:8773/services/Cloud/");
-
-   protected HttpRequest describeAvailabilityZonesRequest = HttpRequest
-            .builder()
-            .method("POST")
-            .endpoint(endpoint)
-            .addHeader("Host", "localhost:8773")
-            .payload(payloadFromStringWithContentType(
-                     "Action=DescribeAvailabilityZones&Signature=S3fa5fybw4KAq4o11IpKHlqwx3cVJdKfeAKw3FIJYvM%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity",
-                     MediaType.APPLICATION_FORM_URLENCODED)).build();
-   protected HttpResponse describeAvailabilityZonesResponse = HttpResponse.builder().statusCode(200)
-            .payload(payloadFromResourceWithContentType("/nova_ec2_availabilityZones.xml", MediaType.APPLICATION_XML))
-            .build();
-
-   public BaseNovaEC2RestClientExpectTest() {
-      provider = "openstack-nova-ec2";
-   }
-
-   @ConfiguresRestClient
-   private static final class TestNovaEC2RestClientModule extends NovaEC2RestClientModule {
-      @Override
-      @Provides
-      protected String provideTimeStamp(DateService dateService) {
-         return CONSTANT_DATE;
-      }
-   }
-
-   @Override
-   protected Module createModule() {
-      return new TestNovaEC2RestClientModule();
-   }
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientExpectTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientExpectTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientExpectTest.java
deleted file mode 100644
index 54e4404..0000000
--- a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientExpectTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jclouds.openstack.nova.ec2.services;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Set;
-
-import org.jclouds.ec2.domain.Image;
-import org.jclouds.ec2.services.AMIClient;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.openstack.nova.ec2.internal.BaseNovaEC2RestClientExpectTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Adam Lowe
- */
-@Test(groups = "unit", testName = "NovaEC2ElasticBlockStoreClientTest")
-public class NovaEC2AMIClientExpectTest extends BaseNovaEC2RestClientExpectTest {
-
-   public void testDescribeImagesWithNonMachineTypes() {
-      AMIClient client = requestsSendResponses(
-            describeAvailabilityZonesRequest,
-            describeAvailabilityZonesResponse,
-            HttpRequest.builder().method("POST")
-                  .endpoint("http://localhost:8773/services/Cloud/")
-                  .addHeader("Host", "localhost:8773")
-                  .payload(payloadFromStringWithContentType("Action=DescribeImages&Signature=Z3q3jSutwlfgvbcINT0Ed3AjrjxM4WMvQloXu/1kd40%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2009-04-04&AWSAccessKeyId=identity", "application/x-www-form-urlencoded")).build(),
-            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/nova_ec2_images_with_ramdisk.xml")).build()
-      ).getAMIServices();
-
-      Set<? extends Image> images = client.describeImagesInRegion("nova");
-      
-      assertEquals(images.size(), 1);
-      
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientLiveTest.java
deleted file mode 100644
index 4b15421..0000000
--- a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AMIClientLiveTest.java
+++ /dev/null
@@ -1,32 +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.openstack.nova.ec2.services;
-
-import org.jclouds.ec2.services.AMIClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Test(groups = "live", singleThreaded = true, testName = "NovaEC2AMIClientLiveTest")
-public class NovaEC2AMIClientLiveTest extends AMIClientLiveTest {
-   public NovaEC2AMIClientLiveTest() {
-      provider = "openstack-nova-ec2";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AvailabilityZoneAndRegionClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AvailabilityZoneAndRegionClientLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AvailabilityZoneAndRegionClientLiveTest.java
deleted file mode 100644
index bff8248..0000000
--- a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2AvailabilityZoneAndRegionClientLiveTest.java
+++ /dev/null
@@ -1,32 +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.openstack.nova.ec2.services;
-
-import org.jclouds.ec2.services.AvailabilityZoneAndRegionClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Test(groups = "live", singleThreaded = true, testName = "NovaEC2AvailabilityZoneAndRegionClientLiveTest")
-public class NovaEC2AvailabilityZoneAndRegionClientLiveTest extends AvailabilityZoneAndRegionClientLiveTest {
-   public NovaEC2AvailabilityZoneAndRegionClientLiveTest() {
-      provider = "openstack-nova-ec2";
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/5f3b8d3f/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2ElasticBlockStoreClientLiveTest.java
----------------------------------------------------------------------
diff --git a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2ElasticBlockStoreClientLiveTest.java b/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2ElasticBlockStoreClientLiveTest.java
deleted file mode 100644
index 6a8f27d..0000000
--- a/apis/openstack-nova-ec2/src/test/java/org/jclouds/openstack/nova/ec2/services/NovaEC2ElasticBlockStoreClientLiveTest.java
+++ /dev/null
@@ -1,32 +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.openstack.nova.ec2.services;
-
-import org.jclouds.ec2.services.ElasticBlockStoreClientLiveTest;
-import org.testng.annotations.Test;
-
-/**
- * 
- * @author Adrian Cole
- */
-@Test(groups = "live", singleThreaded = true, testName = "NovaEC2ElasticBlockStoreClientLiveTest")
-public class NovaEC2ElasticBlockStoreClientLiveTest extends ElasticBlockStoreClientLiveTest {
-   public NovaEC2ElasticBlockStoreClientLiveTest() {
-      provider = "openstack-nova-ec2";
-   }
-
-}