Merge pull request #1352 from jclouds/ec2-subnet-cleanup

various cleanups to get ec2 subnet api up to latest
This commit is contained in:
Adrian Cole 2013-02-24 15:18:25 -08:00
commit 0d43da7339
12 changed files with 445 additions and 423 deletions

View File

@ -24,22 +24,17 @@ import java.util.Map;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
/** /**
* Amazon EC2 VPCs contain one or more subnets. * Amazon EC2 VPCs contain one or more subnets.
* *
* @see <a * @see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html" >doc</a>
* href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html"
* >doc</a>
* *
* @author Adrian Cole * @author Adrian Cole
* @author Andrew Bayer * @author Andrew Bayer
*/ */
public class Subnet { public final class Subnet {
public static enum State { public static enum State {
/** /**
@ -71,16 +66,15 @@ public class Subnet {
private final String availabilityZone; private final String availabilityZone;
private final Map<String, String> tags; private final Map<String, String> tags;
public Subnet(String subnetId, State subnetState, String vpcId, String cidrBlock, private Subnet(String subnetId, State subnetState, String vpcId, String cidrBlock, int availableIpAddressCount,
int availableIpAddressCount, String availabilityZone, Map<String, String> tags) { String availabilityZone, ImmutableMap<String, String> tags) {
this.subnetId = checkNotNull(subnetId, "subnetId"); this.subnetId = checkNotNull(subnetId, "subnetId");
this.subnetState = checkNotNull(subnetState, "subnetState for %s", subnetId); this.subnetState = checkNotNull(subnetState, "subnetState for %s", subnetId);
this.vpcId = checkNotNull(vpcId, "vpcId for %s", subnetId); this.vpcId = checkNotNull(vpcId, "vpcId for %s", subnetId);
this.cidrBlock = checkNotNull(cidrBlock, "cidrBlock for %s", subnetId); this.cidrBlock = checkNotNull(cidrBlock, "cidrBlock for %s", subnetId);
this.availableIpAddressCount = availableIpAddressCount; this.availableIpAddressCount = availableIpAddressCount;
this.availabilityZone = checkNotNull(availabilityZone, "availabilityZone for %s", subnetId); this.availabilityZone = checkNotNull(availabilityZone, "availabilityZone for %s", subnetId);
this.tags = ImmutableMap.<String, String> copyOf(checkNotNull(tags, "tags for %s", subnetId)); this.tags = checkNotNull(tags, "tags for %s", subnetId);
} }
/** /**
@ -132,43 +126,30 @@ public class Subnet {
return tags; return tags;
} }
/**
* {@inheritDoc}
*/
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(subnetId, vpcId, availabilityZone); return Objects.hashCode(subnetId, vpcId, availabilityZone);
} }
/**
* {@inheritDoc}
*/
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
return true; return true;
if (obj == null) if (obj == null || getClass() != obj.getClass())
return false; return false;
if (getClass() != obj.getClass()) Subnet that = Subnet.class.cast(obj);
return false; return Objects.equal(this.subnetId, that.subnetId) && Objects.equal(this.vpcId, that.vpcId)
Subnet other = (Subnet) obj; && Objects.equal(this.availabilityZone, that.availabilityZone);
return Objects.equal(this.subnetId, other.subnetId)
&& Objects.equal(this.vpcId, other.vpcId)
&& Objects.equal(this.availabilityZone, other.availabilityZone);
} }
/**
* {@inheritDoc}
*/
@Override @Override
public String toString() { public String toString() {
return string().toString(); return string().toString();
} }
private final ToStringHelper string() { private final ToStringHelper string() {
return Objects.toStringHelper(this).omitNullValues().add("subnetId", subnetId) return Objects.toStringHelper(this).omitNullValues().add("subnetId", subnetId).add("subnetState", subnetState)
.add("subnetState", subnetState).add("vpcId", vpcId) .add("vpcId", vpcId).add("cidrBlock", cidrBlock).add("availableIpAddressCount", availableIpAddressCount)
.add("cidrBlock", cidrBlock).add("availableIpAddressCount", availableIpAddressCount)
.add("availabilityZone", availabilityZone).add("tags", tags); .add("availabilityZone", availabilityZone).add("tags", tags);
} }
@ -177,17 +158,17 @@ public class Subnet {
} }
public Builder toBuilder() { public Builder toBuilder() {
return builder().fromSubnet(this); return builder().from(this);
} }
public static class Builder { public final static class Builder {
private String subnetId; private String subnetId;
private State subnetState; private State subnetState;
private String vpcId; private String vpcId;
private String cidrBlock; private String cidrBlock;
private int availableIpAddressCount; private int availableIpAddressCount;
private String availabilityZone; private String availabilityZone;
private Map<String, String> tags = Maps.newLinkedHashMap(); private ImmutableMap.Builder<String, String> tags = ImmutableMap.<String, String> builder();
/** /**
* @see Subnet#getSubnetId() * @see Subnet#getSubnetId()
@ -241,32 +222,34 @@ public class Subnet {
* @see Subnet#getTags() * @see Subnet#getTags()
*/ */
public Builder tags(Map<String, String> tags) { public Builder tags(Map<String, String> tags) {
this.tags = ImmutableMap.copyOf(checkNotNull(tags, "tags")); this.tags.putAll(checkNotNull(tags, "tags"));
return this; return this;
} }
/**
* @see Subnet#getTags()
*/
public Builder tag(String key) {
return tag(key, "");
}
/** /**
* @see Subnet#getTags() * @see Subnet#getTags()
*/ */
public Builder tag(String key, String value) { public Builder tag(String key, String value) {
if (key != null) this.tags.put(checkNotNull(key, "key"), checkNotNull(value, "value"));
this.tags.put(key, Strings.nullToEmpty(value));
return this; return this;
} }
public Subnet build() { public Subnet build() {
return new Subnet(subnetId, subnetState, vpcId, cidrBlock, availableIpAddressCount, return new Subnet(subnetId, subnetState, vpcId, cidrBlock, availableIpAddressCount, availabilityZone,
availabilityZone, tags); tags.build());
} }
public Builder fromSubnet(Subnet in) { public Builder from(Subnet in) {
return this.subnetId(in.getSubnetId()) return this.subnetId(in.getSubnetId()).subnetState(in.getSubnetState()).vpcId(in.getVpcId())
.subnetState(in.getSubnetState()) .cidrBlock(in.getCidrBlock()).availableIpAddressCount(in.getAvailableIpAddressCount())
.vpcId(in.getVpcId()) .availabilityZone(in.getAvailabilityZone()).tags(in.getTags());
.cidrBlock(in.getCidrBlock())
.availableIpAddressCount(in.getAvailableIpAddressCount())
.availabilityZone(in.getAvailabilityZone())
.tags(in.getTags());
} }
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
package org.jclouds.ec2.features; package org.jclouds.ec2.features;
import java.util.Map;
import org.jclouds.ec2.domain.Subnet; import org.jclouds.ec2.domain.Subnet;
import org.jclouds.ec2.util.SubnetFilterBuilder; import org.jclouds.ec2.util.SubnetFilterBuilder;
import org.jclouds.rest.annotations.SinceApiVersion; import org.jclouds.rest.annotations.SinceApiVersion;
@ -27,13 +26,10 @@ import com.google.common.collect.FluentIterable;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
/** /**
* To help you manage your Amazon EC2 instances, images, and other Amazon EC2 * To help you manage your Amazon EC2 instances, images, and other Amazon EC2 resources, you can assign your own
* resources, you can assign your own metadata to each resource in the form of * metadata to each resource in the form of tags.
* tags.
* *
* @see <a * @see <a href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html" >doc</a>
* href="http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Subnets.html"
* >doc</a>
* @see SubnetAsyncApi * @see SubnetAsyncApi
* @author Adrian Cole * @author Adrian Cole
* @author Andrew Bayer * @author Andrew Bayer
@ -57,7 +53,7 @@ public interface SubnetApi {
* <h4>example</h4> * <h4>example</h4>
* *
* <pre> * <pre>
* subnets = subnetApi.filter(new SubnetFilterBuilder().vpcId("vpc-1a2b3c4d").build()); * subnets = subnetApi.filter(new SubnetFilterBuilder().vpcId(&quot;vpc-1a2b3c4d&quot;).build());
* </pre> * </pre>
* *
* @param filter * @param filter

View File

@ -20,8 +20,6 @@ package org.jclouds.ec2.features;
import static org.jclouds.aws.reference.FormParameters.ACTION; import static org.jclouds.aws.reference.FormParameters.ACTION;
import java.util.Map;
import javax.inject.Named; import javax.inject.Named;
import javax.ws.rs.POST; import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
@ -47,8 +45,7 @@ import com.google.common.util.concurrent.ListenableFuture;
* Provides access to Amazon EC2 via the Query API * Provides access to Amazon EC2 via the Query API
* <p/> * <p/>
* *
* @see <a * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
* href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
* >doc</a> * >doc</a>
* @see SubnetApi * @see SubnetApi
* @author Adrian Cole * @author Adrian Cole

View File

@ -18,31 +18,25 @@
*/ */
package org.jclouds.ec2.xml; package org.jclouds.ec2.xml;
import static org.jclouds.util.SaxUtils.currentOrNull;
import static org.jclouds.util.SaxUtils.equalsOrSuffix; import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import java.util.Set;
import org.jclouds.ec2.domain.Subnet; import org.jclouds.ec2.domain.Subnet;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import com.google.common.collect.FluentIterable; import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder; import com.google.common.collect.ImmutableSet.Builder;
import com.google.common.collect.Sets;
import com.google.inject.Inject; import com.google.inject.Inject;
/** /**
* @see <a * @see <a href="http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html" >xml</a>
* href="http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html"
* >xml</a>
* *
* @author Adrian Cole * @author Adrian Cole
* @author Andrew Bayer * @author Andrew Bayer
*/ */
public class DescribeSubnetsResponseHandler extends ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<Subnet>> { public class DescribeSubnetsResponseHandler extends
ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<Subnet>> {
private final SubnetHandler subnetHandler; private final SubnetHandler subnetHandler;
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
@ -55,19 +49,13 @@ public class DescribeSubnetsResponseHandler extends ParseSax.HandlerForGenerated
this.subnetHandler = subnetHandler; this.subnetHandler = subnetHandler;
} }
/**
* {@inheritDoc}
*/
@Override @Override
public FluentIterable<Subnet> getResult() { public FluentIterable<Subnet> getResult() {
return FluentIterable.from(subnets.build()); return FluentIterable.from(subnets.build());
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void startElement(String url, String name, String qName, Attributes attributes) throws SAXException { public void startElement(String url, String name, String qName, Attributes attributes) {
if (equalsOrSuffix(qName, "subnetSet")) { if (equalsOrSuffix(qName, "subnetSet")) {
inSubnetSet = true; inSubnetSet = true;
} else if (inSubnetSet) { } else if (inSubnetSet) {
@ -78,11 +66,8 @@ public class DescribeSubnetsResponseHandler extends ParseSax.HandlerForGenerated
} }
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void endElement(String uri, String name, String qName) throws SAXException { public void endElement(String uri, String name, String qName) {
if (equalsOrSuffix(qName, "subnetSet")) { if (equalsOrSuffix(qName, "subnetSet")) {
inSubnetSet = false; inSubnetSet = false;
} else if (equalsOrSuffix(qName, "tagSet")) { } else if (equalsOrSuffix(qName, "tagSet")) {
@ -97,9 +82,6 @@ public class DescribeSubnetsResponseHandler extends ParseSax.HandlerForGenerated
currentText = new StringBuilder(); currentText = new StringBuilder();
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void characters(char ch[], int start, int length) { public void characters(char ch[], int start, int length) {
if (inSubnetSet) { if (inSubnetSet) {
@ -108,5 +90,4 @@ public class DescribeSubnetsResponseHandler extends ParseSax.HandlerForGenerated
currentText.append(ch, start, length); currentText.append(ch, start, length);
} }
} }
} }

View File

@ -24,24 +24,18 @@ import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.ec2.domain.Subnet; import org.jclouds.ec2.domain.Subnet;
import org.jclouds.ec2.domain.Subnet.State;
import org.jclouds.http.functions.ParseSax; import org.jclouds.http.functions.ParseSax;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import com.google.common.base.Supplier;
/** /**
* @see <a * @see <a href="http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-ItemType-SubnetType.html" >xml</a>
* href="http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-ItemType-SubnetType.html"
* >xml</a>
* *
* @author Adrian Cole * @author Adrian Cole
* @author Andrew Bayer * @author Andrew Bayer
*/ */
public class SubnetHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Subnet> { public class SubnetHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Subnet> {
private StringBuilder currentText = new StringBuilder(); private StringBuilder currentText = new StringBuilder();
private Subnet.Builder builder = newBuilder(); private Subnet.Builder builder = Subnet.builder();
private final TagSetHandler tagSetHandler; private final TagSetHandler tagSetHandler;
private boolean inTagSet; private boolean inTagSet;
@ -50,9 +44,6 @@ public class SubnetHandler extends ParseSax.HandlerForGeneratedRequestWithResult
this.tagSetHandler = tagSetHandler; this.tagSetHandler = tagSetHandler;
} }
/**
* {@inheritDoc}
*/
@Override @Override
public Subnet getResult() { public Subnet getResult() {
try { try {
@ -62,9 +53,6 @@ public class SubnetHandler extends ParseSax.HandlerForGeneratedRequestWithResult
} }
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void startElement(String uri, String name, String qName, Attributes attrs) { public void startElement(String uri, String name, String qName, Attributes attrs) {
if (equalsOrSuffix(qName, "tagSet")) { if (equalsOrSuffix(qName, "tagSet")) {
@ -75,9 +63,6 @@ public class SubnetHandler extends ParseSax.HandlerForGeneratedRequestWithResult
} }
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void endElement(String uri, String name, String qName) { public void endElement(String uri, String name, String qName) {
if (equalsOrSuffix(qName, "tagSet")) { if (equalsOrSuffix(qName, "tagSet")) {
@ -101,11 +86,6 @@ public class SubnetHandler extends ParseSax.HandlerForGeneratedRequestWithResult
currentText = new StringBuilder(); currentText = new StringBuilder();
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void characters(char ch[], int start, int length) { public void characters(char ch[], int start, int length) {
if (inTagSet) { if (inTagSet) {
@ -114,9 +94,4 @@ public class SubnetHandler extends ParseSax.HandlerForGeneratedRequestWithResult
currentText.append(ch, start, length); currentText.append(ch, start, length);
} }
} }
private Subnet.Builder newBuilder() {
return Subnet.builder();
}
} }

View File

@ -27,11 +27,9 @@ import org.jclouds.ec2.internal.BaseEC2ApiExpectTest;
import org.jclouds.ec2.parse.DescribeSubnetsResponseTest; import org.jclouds.ec2.parse.DescribeSubnetsResponseTest;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.HttpResponse; import org.jclouds.http.HttpResponse;
import org.jclouds.rest.ResourceNotFoundException;
import org.jclouds.rest.annotations.SinceApiVersion; import org.jclouds.rest.annotations.SinceApiVersion;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
@ -51,20 +49,16 @@ public class SubnetApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
return props; return props;
} }
HttpRequest list = HttpRequest.builder() HttpRequest list = HttpRequest.builder().method("POST")
.method("POST")
.endpoint("https://ec2.us-east-1.amazonaws.com/") .endpoint("https://ec2.us-east-1.amazonaws.com/")
.addHeader("Host", "ec2.us-east-1.amazonaws.com") .addHeader("Host", "ec2.us-east-1.amazonaws.com")
.payload( .addFormParam("Action", "DescribeSubnets")
payloadFromStringWithContentType( .addFormParam("Signature", "Uuafp9lnYQmMUcf/JE1epPTQVCSMPqfns%2BwlZssUsi4%3D")
"Action=DescribeSubnets" + .addFormParam("SignatureMethod", "HmacSHA256")
"&Signature=Uuafp9lnYQmMUcf/JE1epPTQVCSMPqfns%2BwlZssUsi4%3D" + .addFormParam("SignatureVersion", "2")
"&SignatureMethod=HmacSHA256" + .addFormParam("Timestamp", "2012-04-16T15%3A54%3A08.897Z")
"&SignatureVersion=2" + .addFormParam("Version", "2011-01-01")
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" + .addFormParam("AWSAccessKeyId", "identity")
"&Version=2011-01-01" +
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build(); .build();
public void testListWhenResponseIs2xx() throws Exception { public void testListWhenResponseIs2xx() throws Exception {
@ -88,23 +82,18 @@ public class SubnetApiExpectTest extends BaseEC2ApiExpectTest<EC2Api> {
assertEquals(apiWhenDontExist.getSubnetApi().get().list().toSet(), ImmutableSet.of()); assertEquals(apiWhenDontExist.getSubnetApi().get().list().toSet(), ImmutableSet.of());
} }
HttpRequest filter = HttpRequest filter = HttpRequest.builder().method("POST")
HttpRequest.builder()
.method("POST")
.endpoint("https://ec2.us-east-1.amazonaws.com/") .endpoint("https://ec2.us-east-1.amazonaws.com/")
.addHeader("Host", "ec2.us-east-1.amazonaws.com") .addHeader("Host", "ec2.us-east-1.amazonaws.com")
.payload(payloadFromStringWithContentType( .addFormParam("Action", "DescribeSubnets")
"Action=DescribeSubnets" + .addFormParam("Filter.1.Name", "subnet-id")
"&Filter.1.Name=subnet-id" + .addFormParam("Filter.1.Value.1", "subnet-9d4a7b6c")
"&Filter.1.Value.1=subnet-9d4a7b6c" + .addFormParam("Signature", "%2Bp34YACfLk9km1H3eALnDmrkst9FhJttojVSf7VztLk%3D")
"&Signature=%2Bp34YACfLk9km1H3eALnDmrkst9FhJttojVSf7VztLk%3D" + .addFormParam("SignatureMethod", "HmacSHA256")
"&SignatureMethod=HmacSHA256" + .addFormParam("SignatureVersion", "2")
"&SignatureVersion=2" + .addFormParam("Timestamp", "2012-04-16T15%3A54%3A08.897Z")
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" + .addFormParam("Version", "2011-01-01")
"&Version=2011-01-01" + .addFormParam("AWSAccessKeyId", "identity").build();
"&AWSAccessKeyId=identity",
"application/x-www-form-urlencoded"))
.build();
public void testFilterWhenResponseIs2xx() throws Exception { public void testFilterWhenResponseIs2xx() throws Exception {

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.ec2.features.internal; package org.jclouds.ec2.features;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static java.lang.String.format; import static java.lang.String.format;
@ -24,24 +24,16 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.logging.Logger.getAnonymousLogger; import static java.util.logging.Logger.getAnonymousLogger;
import static org.jclouds.util.Predicates2.retry; import static org.jclouds.util.Predicates2.retry;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.util.logging.Logger;
import org.jclouds.ec2.domain.Subnet; import org.jclouds.ec2.domain.Subnet;
import org.jclouds.ec2.features.SubnetApi;
import org.jclouds.ec2.internal.BaseEC2ApiLiveTest; import org.jclouds.ec2.internal.BaseEC2ApiLiveTest;
import org.jclouds.ec2.util.SubnetFilterBuilder; import org.jclouds.ec2.util.SubnetFilterBuilder;
import org.testng.SkipException; import org.testng.SkipException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
/** /**
@ -52,8 +44,6 @@ import com.google.common.collect.ImmutableSet;
*/ */
@Test(groups = "live") @Test(groups = "live")
public class SubnetApiLiveTest extends BaseEC2ApiLiveTest { public class SubnetApiLiveTest extends BaseEC2ApiLiveTest {
private Subnet subnet;
private void checkSubnet(Subnet subnet) { private void checkSubnet(Subnet subnet) {
getAnonymousLogger().info(format("subnet %s vpc: %s", subnet.getSubnetId(), subnet.getVpcId())); getAnonymousLogger().info(format("subnet %s vpc: %s", subnet.getSubnetId(), subnet.getVpcId()));

View File

@ -27,6 +27,12 @@ import javax.inject.Singleton;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
import org.jclouds.ec2.config.EC2RestClientModule; 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.AMIAsyncClient;
import org.jclouds.ec2.services.AMIClient; import org.jclouds.ec2.services.AMIClient;
import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient; import org.jclouds.ec2.services.AvailabilityZoneAndRegionAsyncClient;
@ -76,6 +82,9 @@ public class NovaEC2RestClientModule extends EC2RestClientModule<NovaEC2Client,
.put(WindowsClient.class, WindowsAsyncClient.class)// .put(WindowsClient.class, WindowsAsyncClient.class)//
.put(AvailabilityZoneAndRegionClient.class, AvailabilityZoneAndRegionAsyncClient.class)// .put(AvailabilityZoneAndRegionClient.class, AvailabilityZoneAndRegionAsyncClient.class)//
.put(ElasticBlockStoreClient.class, ElasticBlockStoreAsyncClient.class)// .put(ElasticBlockStoreClient.class, ElasticBlockStoreAsyncClient.class)//
.put(WindowsApi.class, WindowsAsyncApi.class)//
.put(TagApi.class, TagAsyncApi.class)//
.put(SubnetApi.class, SubnetAsyncApi.class)//
.build(); .build();
public NovaEC2RestClientModule() { public NovaEC2RestClientModule() {

View File

@ -0,0 +1,33 @@
/**
* 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.ec2.features;
import org.jclouds.ec2.features.SubnetApiLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", testName = "NovaSubnetApiLiveTest")
public class NovaSubnetApiLiveTest extends SubnetApiLiveTest {
public NovaSubnetApiLiveTest() {
provider = "cloudstack-ec2";
}
}

View File

@ -0,0 +1,33 @@
/**
* 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.cloudstack.ec2.features;
import org.jclouds.ec2.features.SubnetApiLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", testName = "CloudStackSubnetApiLiveTest")
public class CloudStackSubnetApiLiveTest extends SubnetApiLiveTest {
public CloudStackSubnetApiLiveTest() {
provider = "cloudstack-ec2";
}
}

View File

@ -46,6 +46,8 @@ import org.jclouds.aws.ec2.services.SpotInstanceClient;
import org.jclouds.ec2.EC2AsyncClient; import org.jclouds.ec2.EC2AsyncClient;
import org.jclouds.ec2.EC2Client; import org.jclouds.ec2.EC2Client;
import org.jclouds.ec2.config.EC2RestClientModule; 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.TagApi;
import org.jclouds.ec2.features.TagAsyncApi; import org.jclouds.ec2.features.TagAsyncApi;
import org.jclouds.ec2.features.WindowsApi; import org.jclouds.ec2.features.WindowsApi;
@ -94,6 +96,7 @@ public class AWSEC2RestClientModule extends EC2RestClientModule<AWSEC2Client, AW
.put(SpotInstanceClient.class, SpotInstanceAsyncClient.class)// .put(SpotInstanceClient.class, SpotInstanceAsyncClient.class)//
.put(WindowsApi.class, WindowsAsyncApi.class)// .put(WindowsApi.class, WindowsAsyncApi.class)//
.put(TagApi.class, TagAsyncApi.class)// .put(TagApi.class, TagAsyncApi.class)//
.put(SubnetApi.class, SubnetAsyncApi.class)//
.build(); .build();
public AWSEC2RestClientModule() { public AWSEC2RestClientModule() {

View File

@ -0,0 +1,33 @@
/**
* 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.aws.ec2.features;
import org.jclouds.ec2.features.SubnetApiLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", testName = "AWSSubnetApiLiveTest")
public class AWSSubnetApiLiveTest extends SubnetApiLiveTest {
public AWSSubnetApiLiveTest() {
provider = "aws-ec2";
}
}