From 486be5acc4fe4c3c34625ac2fabc2a4e8327c331 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 2 Aug 2012 17:43:38 -0700 Subject: [PATCH] Issue 1056:create cloudstack-ec2 api --- labs/cloudstack-ec2/pom.xml | 129 ++++++++++++++++++ .../ec2/CloudStackEC2ApiMetadata.java | 84 ++++++++++++ .../services/org.jclouds.apis.ApiMetadata | 1 + .../ec2/CloudStackEC2ApiMetadataTest.java | 34 +++++ .../CloudStackEC2AMIClientLiveTest.java | 34 +++++ ...ailabilityZoneAndRegionClientLiveTest.java | 34 +++++ ...ackEC2ElasticBlockStoreClientLiveTest.java | 34 +++++ ...tackEC2ElasticIPAddressClientLiveTest.java | 34 +++++ .../CloudStackEC2InstanceClientLiveTest.java | 34 +++++ .../CloudStackEC2KeyPairClientLiveTest.java | 34 +++++ ...udStackEC2SecurityGroupClientLiveTest.java | 34 +++++ labs/pom.xml | 1 + 12 files changed, 487 insertions(+) create mode 100644 labs/cloudstack-ec2/pom.xml create mode 100644 labs/cloudstack-ec2/src/main/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadata.java create mode 100644 labs/cloudstack-ec2/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadataTest.java create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AMIClientLiveTest.java create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AvailabilityZoneAndRegionClientLiveTest.java create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticBlockStoreClientLiveTest.java create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticIPAddressClientLiveTest.java create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2InstanceClientLiveTest.java create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2KeyPairClientLiveTest.java create mode 100644 labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2SecurityGroupClientLiveTest.java diff --git a/labs/cloudstack-ec2/pom.xml b/labs/cloudstack-ec2/pom.xml new file mode 100644 index 0000000000..8911b73cfe --- /dev/null +++ b/labs/cloudstack-ec2/pom.xml @@ -0,0 +1,129 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.5.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.labs + cloudstack-ec2 + jclouds CloudStack EC2 api + EC2 implementation based on CloudStack + bundle + + + http://localhost:8090/bridge/rest/AmazonEC2 + 2010-11-15 + + FIXME_IDENTITY + FIXME_CREDENTIAL + imageId=fixme-region/ami-fixme + imageId=fixme-region/ami-fixmeebs + org.jclouds.cloudstack.ec2*;version="${project.version}" + + org.jclouds.compute.internal;version="${project.version}", + org.jclouds.rest.internal;version="${project.version}", + org.jclouds*;version="${project.version}", + * + + + + + + org.jclouds.api + ec2 + ${project.version} + + + org.jclouds.api + ec2 + ${project.version} + test-jar + test + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds + jclouds-compute + ${project.version} + test-jar + test + + + org.jclouds.driver + jclouds-log4j + ${project.version} + test + + + org.jclouds.driver + jclouds-sshj + ${project.version} + test + + + + + + live + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration + integration-test + + test + + + + ${test.cloudstack-ec2.endpoint} + ${test.cloudstack-ec2.api-version} + ${test.cloudstack-ec2.build-version} + ${test.cloudstack-ec2.identity} + ${test.cloudstack-ec2.credential} + ${test.cloudstack-ec2.template} + ${test.cloudstack-ec2.ebs-template} + + + + + + + + + + + + diff --git a/labs/cloudstack-ec2/src/main/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadata.java b/labs/cloudstack-ec2/src/main/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadata.java new file mode 100644 index 0000000000..f2f18c0c7e --- /dev/null +++ b/labs/cloudstack-ec2/src/main/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadata.java @@ -0,0 +1,84 @@ +/** + * 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; + +import java.net.URI; +import java.util.Properties; + +import org.jclouds.apis.ApiMetadata; +import org.jclouds.ec2.EC2ApiMetadata; +import org.jclouds.ec2.EC2AsyncClient; +import org.jclouds.ec2.EC2Client; + + +/** + * Implementation of {@link ApiMetadata} for the CloudStackEC2 (EC2 clone) api. + * + * @author Adrian Cole + */ +public class CloudStackEC2ApiMetadata extends EC2ApiMetadata { + /** The serialVersionUID */ + private static final long serialVersionUID = 3060225665040763827L; + + private static Builder builder() { + return new Builder(); + } + + @Override + public Builder toBuilder() { + return builder().fromApiMetadata(this); + } + + public CloudStackEC2ApiMetadata() { + this(builder()); + } + + protected CloudStackEC2ApiMetadata(Builder builder) { + super(builder); + } + + public static Properties defaultProperties() { + Properties properties = EC2ApiMetadata.defaultProperties(); + return properties; + } + + public static class Builder extends EC2ApiMetadata.Builder { + protected Builder() { + super(EC2Client.class, EC2AsyncClient.class); + id("cloudstack-ec2") + .name("CloudStackEC2 (EC2 clone) API") + .version("2010-11-15") + .defaultEndpoint("http://localhost:8090/bridge/rest/AmazonEC2") + .documentation(URI.create("http://docs.cloudstack.org/CloudBridge_Documentation")) + .defaultProperties(CloudStackEC2ApiMetadata.defaultProperties()); + } + + @Override + public CloudStackEC2ApiMetadata build() { + return new CloudStackEC2ApiMetadata(this); + } + + @Override + public Builder fromApiMetadata(ApiMetadata in) { + super.fromApiMetadata(in); + return this; + } + } + +} diff --git a/labs/cloudstack-ec2/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/labs/cloudstack-ec2/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata new file mode 100644 index 0000000000..f68f5ccf6e --- /dev/null +++ b/labs/cloudstack-ec2/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata @@ -0,0 +1 @@ +org.jclouds.cloudstack.ec2.CloudStackEC2ApiMetadata diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadataTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadataTest.java new file mode 100644 index 0000000000..a62ad5f193 --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/CloudStackEC2ApiMetadataTest.java @@ -0,0 +1,34 @@ +/** + * 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; + +import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "unit", testName = "CloudStackEC2ApiMetadataTest") +public class CloudStackEC2ApiMetadataTest extends BaseComputeServiceApiMetadataTest { + + public CloudStackEC2ApiMetadataTest() { + super(new CloudStackEC2ApiMetadata()); + } +} diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AMIClientLiveTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AMIClientLiveTest.java new file mode 100644 index 0000000000..3855c924b5 --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AMIClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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.services; + +import org.jclouds.ec2.services.AMIClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudStackEC2AMIClientLiveTest") +public class CloudStackEC2AMIClientLiveTest extends AMIClientLiveTest { + public CloudStackEC2AMIClientLiveTest() { + provider = "cloudstack-ec2"; + } + +} diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AvailabilityZoneAndRegionClientLiveTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AvailabilityZoneAndRegionClientLiveTest.java new file mode 100644 index 0000000000..ee031cec02 --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2AvailabilityZoneAndRegionClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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.services; + +import org.jclouds.ec2.services.AvailabilityZoneAndRegionClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudStackEC2AvailabilityZoneAndRegionClientLiveTest") +public class CloudStackEC2AvailabilityZoneAndRegionClientLiveTest extends AvailabilityZoneAndRegionClientLiveTest { + public CloudStackEC2AvailabilityZoneAndRegionClientLiveTest() { + provider = "cloudstack-ec2"; + } + +} diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticBlockStoreClientLiveTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticBlockStoreClientLiveTest.java new file mode 100644 index 0000000000..a7f571414c --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticBlockStoreClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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.services; + +import org.jclouds.ec2.services.ElasticBlockStoreClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudStackEC2ElasticBlockStoreClientLiveTest") +public class CloudStackEC2ElasticBlockStoreClientLiveTest extends ElasticBlockStoreClientLiveTest { + public CloudStackEC2ElasticBlockStoreClientLiveTest() { + provider = "cloudstack-ec2"; + } + +} diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticIPAddressClientLiveTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticIPAddressClientLiveTest.java new file mode 100644 index 0000000000..4d46dab289 --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2ElasticIPAddressClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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.services; + +import org.jclouds.ec2.services.ElasticIPAddressClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudStackEC2ElasticIPAddressClientLiveTest") +public class CloudStackEC2ElasticIPAddressClientLiveTest extends ElasticIPAddressClientLiveTest { + public CloudStackEC2ElasticIPAddressClientLiveTest() { + provider = "cloudstack-ec2"; + } + +} diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2InstanceClientLiveTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2InstanceClientLiveTest.java new file mode 100644 index 0000000000..c11f846efc --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2InstanceClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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.services; + +import org.jclouds.ec2.services.InstanceClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudStackEC2InstanceClientLiveTest") +public class CloudStackEC2InstanceClientLiveTest extends InstanceClientLiveTest { + public CloudStackEC2InstanceClientLiveTest() { + provider = "cloudstack-ec2"; + } + +} diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2KeyPairClientLiveTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2KeyPairClientLiveTest.java new file mode 100644 index 0000000000..8a9f4a9c4b --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2KeyPairClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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.services; + +import org.jclouds.ec2.services.KeyPairClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudStackEC2KeyPairClientLiveTest") +public class CloudStackEC2KeyPairClientLiveTest extends KeyPairClientLiveTest { + public CloudStackEC2KeyPairClientLiveTest() { + provider = "cloudstack-ec2"; + } + +} diff --git a/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2SecurityGroupClientLiveTest.java b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2SecurityGroupClientLiveTest.java new file mode 100644 index 0000000000..bbd1f3e530 --- /dev/null +++ b/labs/cloudstack-ec2/src/test/java/org/jclouds/cloudstack/ec2/services/CloudStackEC2SecurityGroupClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * 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.services; + +import org.jclouds.ec2.services.SecurityGroupClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "CloudStackEC2SecurityGroupClientLiveTest") +public class CloudStackEC2SecurityGroupClientLiveTest extends SecurityGroupClientLiveTest { + public CloudStackEC2SecurityGroupClientLiveTest() { + provider = "cloudstack-ec2"; + } + +} diff --git a/labs/pom.xml b/labs/pom.xml index 6c5b1477d7..7d08d58728 100644 --- a/labs/pom.xml +++ b/labs/pom.xml @@ -56,5 +56,6 @@ rds aws-rds smartos-ssh + cloudstack-ec2