From 7132683cf6093fa0b6206867327e9c270ae2ef73 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sat, 29 Dec 2012 11:25:32 -0800 Subject: [PATCH 1/2] issue #1108: remove eucalyptus and related providers --- allcompute/pom.xml | 5 - apis/eucalyptus/README.txt | 27 ---- apis/eucalyptus/pom.xml | 129 ---------------- .../eucalyptus/EucalyptusApiMetadata.java | 92 ----------- .../config/Iso8601SecondsModule.java | 34 ----- .../DateServiceIso8601SecondsCodec.java | 54 ------- .../services/org.jclouds.apis.ApiMetadata | 1 - .../eucalyptus/EucalyptusApiMetadataTest.java | 34 ----- .../EucalyptusComputeServiceLiveTest.java | 81 ---------- .../EucalyptusRestClientModuleExpectTest.java | 106 ------------- .../internal/BaseEucalyptusExpectTest.java | 88 ----------- .../services/EucalyptusAMIClientLiveTest.java | 34 ----- ...ailabilityZoneAndRegionClientLiveTest.java | 34 ----- ...lyptusElasticBlockStoreClientLiveTest.java | 34 ----- ...alyptusElasticIPAddressClientLiveTest.java | 34 ----- .../EucalyptusInstanceClientLiveTest.java | 34 ----- .../EucalyptusKeyPairClientLiveTest.java | 34 ----- ...EucalyptusSecurityGroupClientLiveTest.java | 34 ----- .../availabilityZones-eucalyptus.xml | 11 -- .../test/resources/regionEndpoints-euca.xml | 12 -- apis/pom.xml | 1 - .../eucalyptus-partnercloud-ec2/README.txt | 27 ---- providers/eucalyptus-partnercloud-ec2/pom.xml | 143 ------------------ ...lyptusPartnerCloudEC2ProviderMetadata.java | 98 ------------ ...rtnerCloudComputeServiceContextModule.java | 37 ----- ...calyptusPartnerCloudReviseParsedImage.java | 89 ----------- .../org.jclouds.providers.ProviderMetadata | 1 - ...EucalyptusPartnerCloudEC2ProviderTest.java | 37 ----- ...CloudEucalyptusComputeServiceLiveTest.java | 36 ----- ...loudEucalyptusTemplateBuilderLiveTest.java | 93 ------------ ...ptusPartnerCloudReviseParsedImageTest.java | 137 ----------------- ...calyptusPartnerCloudAMIClientLiveTest.java | 34 ----- ...ailabilityZoneAndRegionClientLiveTest.java | 34 ----- ...rCloudElasticBlockStoreClientLiveTest.java | 34 ----- ...erCloudElasticIPAddressClientLiveTest.java | 34 ----- ...tusPartnerCloudInstanceClientLiveTest.java | 34 ----- ...ptusPartnerCloudKeyPairClientLiveTest.java | 34 ----- ...rtnerCloudSecurityGroupClientLiveTest.java | 34 ----- .../src/test/resources/eucalyptus_images.xml | 89 ----------- providers/pom.xml | 1 - 40 files changed, 1939 deletions(-) delete mode 100644 apis/eucalyptus/README.txt delete mode 100644 apis/eucalyptus/pom.xml delete mode 100644 apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/EucalyptusApiMetadata.java delete mode 100644 apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/config/Iso8601SecondsModule.java delete mode 100644 apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/internal/DateServiceIso8601SecondsCodec.java delete mode 100644 apis/eucalyptus/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/EucalyptusApiMetadataTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/compute/EucalyptusComputeServiceLiveTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/config/EucalyptusRestClientModuleExpectTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/internal/BaseEucalyptusExpectTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAMIClientLiveTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAvailabilityZoneAndRegionClientLiveTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticBlockStoreClientLiveTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticIPAddressClientLiveTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusInstanceClientLiveTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusKeyPairClientLiveTest.java delete mode 100644 apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusSecurityGroupClientLiveTest.java delete mode 100644 apis/eucalyptus/src/test/resources/availabilityZones-eucalyptus.xml delete mode 100644 apis/eucalyptus/src/test/resources/regionEndpoints-euca.xml delete mode 100644 providers/eucalyptus-partnercloud-ec2/README.txt delete mode 100644 providers/eucalyptus-partnercloud-ec2/pom.xml delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderMetadata.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/config/EucalyptusPartnerCloudComputeServiceContextModule.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/strategy/EucalyptusPartnerCloudReviseParsedImage.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusComputeServiceLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/strategy/EucalyptusPartnerCloudReviseParsedImageTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAMIClientLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAvailabilityZoneAndRegionClientLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticBlockStoreClientLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticIPAddressClientLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudInstanceClientLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudKeyPairClientLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudSecurityGroupClientLiveTest.java delete mode 100644 providers/eucalyptus-partnercloud-ec2/src/test/resources/eucalyptus_images.xml diff --git a/allcompute/pom.xml b/allcompute/pom.xml index 15af0d24b7..c89196929c 100644 --- a/allcompute/pom.xml +++ b/allcompute/pom.xml @@ -35,11 +35,6 @@ greenhousedata-element-vcloud ${project.version} - - org.jclouds.provider - eucalyptus-partnercloud-ec2 - ${project.version} - org.jclouds.api deltacloud diff --git a/apis/eucalyptus/README.txt b/apis/eucalyptus/README.txt deleted file mode 100644 index 394c2529cc..0000000000 --- a/apis/eucalyptus/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -==== - 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. -==== - -# -# The jclouds API for Eucalyptus Systems' EC2 flavour (http://www.eucalyptus.com/). -# -# Expects the jclouds EC2 API to be present on your application's classpath. -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. \ No newline at end of file diff --git a/apis/eucalyptus/pom.xml b/apis/eucalyptus/pom.xml deleted file mode 100644 index 853552197f..0000000000 --- a/apis/eucalyptus/pom.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.6.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.api - eucalyptus - jclouds Eucalyptus api - EC2 implementation based on Eucalyptus - bundle - - - http://ecc.eucalyptus.com:8773/services/Eucalyptus - 2010-06-15 - - FIXME_IDENTITY - FIXME_CREDENTIAL - - - org.jclouds.eucalyptus*;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.eucalyptus.endpoint} - ${test.eucalyptus.api-version} - ${test.eucalyptus.build-version} - ${test.eucalyptus.identity} - ${test.eucalyptus.credential} - ${test.eucalyptus.template} - ${test.eucalyptus.ebs-template} - - - - - - - - - - - - diff --git a/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/EucalyptusApiMetadata.java b/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/EucalyptusApiMetadata.java deleted file mode 100644 index 0f0611044e..0000000000 --- a/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/EucalyptusApiMetadata.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * 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.eucalyptus; - -import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_PORT_OPEN; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; - -import java.util.Properties; - -import org.jclouds.apis.ApiMetadata; -import org.jclouds.ec2.EC2ApiMetadata; -import org.jclouds.ec2.EC2AsyncClient; -import org.jclouds.ec2.EC2Client; -import org.jclouds.eucalyptus.config.Iso8601SecondsModule; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - - -/** - * Implementation of {@link ApiMetadata} for the Eucalyptus (EC2 clone) api. - * - * @author Adrian Cole - */ -public class EucalyptusApiMetadata extends EC2ApiMetadata { - - private static Builder builder() { - return new Builder(); - } - - @Override - public Builder toBuilder() { - return builder().fromApiMetadata(this); - } - - public EucalyptusApiMetadata() { - this(builder()); - } - - protected EucalyptusApiMetadata(Builder builder) { - super(builder); - } - - public static Properties defaultProperties() { - Properties properties = EC2ApiMetadata.defaultProperties(); - // in version 3, lowercase 'e' version 2, uppercase 'E' - properties.setProperty(PROPERTY_REGIONS, "eucalyptus"); - properties.setProperty(TIMEOUT_PORT_OPEN, 5 * 60 * 1000 + ""); - return properties; - } - - public static class Builder extends EC2ApiMetadata.Builder { - protected Builder() { - super(EC2Client.class, EC2AsyncClient.class); - id("eucalyptus") - .defaultEndpoint("http://partnercloud.eucalyptus.com:8773/services/Eucalyptus/") - .name("Eucalyptus (EC2 clone) API") - .defaultProperties(EucalyptusApiMetadata.defaultProperties()) - .defaultModules(ImmutableSet.>builder() - .addAll(defaultModules) - .add(Iso8601SecondsModule.class).build()); - } - - @Override - public EucalyptusApiMetadata build() { - return new EucalyptusApiMetadata(this); - } - - @Override - public Builder fromApiMetadata(ApiMetadata in) { - super.fromApiMetadata(in); - return this; - } - } - -} diff --git a/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/config/Iso8601SecondsModule.java b/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/config/Iso8601SecondsModule.java deleted file mode 100644 index 28d77581ab..0000000000 --- a/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/config/Iso8601SecondsModule.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.config; - - -import org.jclouds.date.internal.DateServiceDateCodecFactory.DateServiceIso8601Codec; -import org.jclouds.eucalyptus.internal.DateServiceIso8601SecondsCodec; - -import com.google.inject.AbstractModule; - -public class Iso8601SecondsModule extends AbstractModule { - - @Override - protected void configure() { - bind(DateServiceIso8601Codec.class).to(DateServiceIso8601SecondsCodec.class); - } - -} diff --git a/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/internal/DateServiceIso8601SecondsCodec.java b/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/internal/DateServiceIso8601SecondsCodec.java deleted file mode 100644 index 42ff3be91f..0000000000 --- a/apis/eucalyptus/src/main/java/org/jclouds/eucalyptus/internal/DateServiceIso8601SecondsCodec.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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.eucalyptus.internal; - -import java.util.Date; - -import javax.inject.Singleton; - -import org.jclouds.date.DateService; -import org.jclouds.date.internal.DateServiceDateCodecFactory.DateServiceIso8601Codec; - -import com.google.inject.Inject; - -@Singleton -public class DateServiceIso8601SecondsCodec extends DateServiceIso8601Codec { - - @Inject - public DateServiceIso8601SecondsCodec(DateService dateService) { - super(dateService); - } - - @Override - public Date toDate(String date) throws IllegalArgumentException { - try { - return super.toDate(date); - } catch (RuntimeException e) { - // Eucalyptus <3.0 didn't include milliseconds - // TODO: see if this is still a problem - return dateService.iso8601SecondsDateParse(date); - } - } - - @Override - public String toString() { - return "iso8601Seconds()"; - } - -} diff --git a/apis/eucalyptus/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata b/apis/eucalyptus/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata deleted file mode 100644 index 2475f3ff9d..0000000000 --- a/apis/eucalyptus/src/main/resources/META-INF/services/org.jclouds.apis.ApiMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.eucalyptus.EucalyptusApiMetadata \ No newline at end of file diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/EucalyptusApiMetadataTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/EucalyptusApiMetadataTest.java deleted file mode 100644 index e2fcff6d83..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/EucalyptusApiMetadataTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus; - -import org.jclouds.compute.internal.BaseComputeServiceApiMetadataTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "EucalyptusApiMetadataTest") -public class EucalyptusApiMetadataTest extends BaseComputeServiceApiMetadataTest { - - public EucalyptusApiMetadataTest() { - super(new EucalyptusApiMetadata()); - } -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/compute/EucalyptusComputeServiceLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/compute/EucalyptusComputeServiceLiveTest.java deleted file mode 100644 index 59cc2b990f..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/compute/EucalyptusComputeServiceLiveTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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.eucalyptus.compute; - -import static org.testng.Assert.fail; - -import org.jclouds.compute.domain.ExecResponse; -import org.jclouds.compute.domain.NodeMetadata; -import org.jclouds.ec2.compute.EC2ComputeServiceLiveTest; -import org.jclouds.http.HttpResponseException; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusComputeServiceLiveTest") -public class EucalyptusComputeServiceLiveTest extends EC2ComputeServiceLiveTest { - - public EucalyptusComputeServiceLiveTest() { - provider = "eucalyptus"; - // security groups must be <30 characters - group = "eu"; - } - - @Override - @Test(enabled = true, dependsOnMethods = "testReboot") - public void testSuspendResume() throws Exception { - try { - super.testSuspendResume(); - fail("Expected HttpResponseException"); - } catch (HttpResponseException e) { - // ebs backed not yet available - } - } - - @Override - @Test(enabled = true) - public void testMapEBS() throws Exception { - // ebs backed not yet available - } - - @Override - @Test(enabled = true, dependsOnMethods = "testSuspendResume") - public void testListNodes() throws Exception { - super.testListNodes(); - } - - @Override - @Test(enabled = true, dependsOnMethods = "testSuspendResume") - public void testGetNodesWithDetails() throws Exception { - super.testGetNodesWithDetails(); - } - - @Override - @Test(enabled = true, dependsOnMethods = { "testListNodes", "testGetNodesWithDetails" }) - public void testDestroyNodes() { - super.testDestroyNodes(); - } - - protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) { - // hostname is not predictable based on node metadata - assert execResponse.getOutput().trim().equals("ubuntu"); - } -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/config/EucalyptusRestClientModuleExpectTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/config/EucalyptusRestClientModuleExpectTest.java deleted file mode 100644 index 722d4b2147..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/config/EucalyptusRestClientModuleExpectTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * 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.eucalyptus.config; - -import static org.testng.Assert.assertEquals; - -import java.net.URI; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.jclouds.eucalyptus.internal.BaseEucalyptusExpectTest; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.location.Region; -import org.jclouds.location.Zone; -import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; -import org.jclouds.location.functions.ZoneToEndpoint; -import org.testng.annotations.Test; - -import com.google.common.base.Function; -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableMap.Builder; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.Module; -import com.google.inject.TypeLiteral; - -/** - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "EucalyptusRestClientModuleExpectTest") -public class EucalyptusRestClientModuleExpectTest extends BaseEucalyptusExpectTest { - private Injector injector; - - public EucalyptusRestClientModuleExpectTest() { - Builder builder = ImmutableMap. builder(); - builder.put(describeRegionsRequest, describeRegionsResponse); - builder.put(describeAZRequest, describeAZResponse); - - injector = requestsSendResponses(builder.build()); - } - - public void testLocationIdAndURIBindings() { - - assertEquals(injector.getInstance(Key.get(new TypeLiteral>>() { - }, Region.class)).get(), ImmutableSet. of("eucalyptus")); - - assertEquals(injector.getInstance(Key.get(new TypeLiteral>>() { - }, Zone.class)).get(), ImmutableSet. of("partner01")); - - Map> regionToURISupplier = injector.getInstance( - Key.get(new TypeLiteral>>>() { - }, Region.class)).get(); - - assertEquals(regionToURISupplier.get("eucalyptus").get(), URI.create("http://eucalyptus.partner.eucalyptus.com:8773/services/Eucalyptus")); - - Map>> regionToZoneIdSupplier = injector.getInstance( - Key.get(new TypeLiteral>>>>() { - }, Zone.class)).get(); - - assertEquals(regionToZoneIdSupplier.get("eucalyptus").get(), ImmutableSet.of("partner01")); - - Map> zoneToURISupplier = injector.getInstance( - Key.get(new TypeLiteral>>>() { - }, Zone.class)).get(); - - assertEquals(zoneToURISupplier.get("partner01").get(), URI.create("http://eucalyptus.partner.eucalyptus.com:8773/services/Eucalyptus")); - - } - - public void testZoneToEndpoint() { - assertEquals(injector.getInstance(ZoneToEndpoint.class).apply("partner01"), - URI.create("http://eucalyptus.partner.eucalyptus.com:8773/services/Eucalyptus")); - - } - - public void testRegionToEndpointOrProviderIfNull() { - assertEquals(injector.getInstance(RegionToEndpointOrProviderIfNull.class).apply("eucalyptus"), - URI.create("http://eucalyptus.partner.eucalyptus.com:8773/services/Eucalyptus")); - } - - @Override - public Injector createClient(Function fn, Module module, Properties props) { - return createInjector(fn, module, props); - } - -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/internal/BaseEucalyptusExpectTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/internal/BaseEucalyptusExpectTest.java deleted file mode 100644 index 9d2c13fc6a..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/internal/BaseEucalyptusExpectTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * 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.eucalyptus.internal; - -import javax.ws.rs.core.MediaType; - -import org.jclouds.date.DateService; -import org.jclouds.date.internal.SimpleDateFormatDateService; -import org.jclouds.ec2.EC2AsyncClient; -import org.jclouds.ec2.EC2Client; -import org.jclouds.ec2.config.EC2RestClientModule; -import org.jclouds.http.HttpRequest; -import org.jclouds.http.HttpResponse; -import org.jclouds.rest.ConfiguresRestClient; -import org.jclouds.rest.internal.BaseRestClientExpectTest; - -import com.google.inject.Module; -import com.google.inject.Provides; - -/** - * - * @author Adrian Cole - */ -public abstract class BaseEucalyptusExpectTest extends BaseRestClientExpectTest { - protected static final String CONSTANT_DATE = "2012-04-16T15:54:08.897Z"; - - protected DateService dateService = new SimpleDateFormatDateService(); - - protected HttpRequest describeRegionsRequest = HttpRequest - .builder() - .method("POST") - .endpoint("http://partnercloud.eucalyptus.com:8773/services/Eucalyptus/") - .addHeader("Host", "partnercloud.eucalyptus.com:8773") - .payload(payloadFromStringWithContentType( - "Action=DescribeRegions&Signature=tp9WpT8503JdxIXYu6Eu2Dmu%2Bd/pqviST7N7Fvr/yQo%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2010-06-15&AWSAccessKeyId=identity", - MediaType.APPLICATION_FORM_URLENCODED)).build(); - - protected HttpResponse describeRegionsResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResourceWithContentType("/regionEndpoints-euca.xml", MediaType.APPLICATION_XML)) - .build(); - - protected HttpRequest describeAZRequest = HttpRequest.builder() - .method("POST") - .endpoint("http://eucalyptus.partner.eucalyptus.com:8773/services/Eucalyptus/") - .addHeader("Host", "eucalyptus.partner.eucalyptus.com:8773") - .payload(payloadFromStringWithContentType( - "Action=DescribeAvailabilityZones&Signature=i4OkMed1sqQV7hlF/l1KdbQwmwJ4Fh4o9W32eVGayPk%3D&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-04-16T15%3A54%3A08.897Z&Version=2010-06-15&AWSAccessKeyId=identity", - MediaType.APPLICATION_FORM_URLENCODED)).build(); - - protected HttpResponse describeAZResponse = HttpResponse.builder().statusCode(200) - .payload(payloadFromResourceWithContentType( - "/availabilityZones-eucalyptus.xml", MediaType.APPLICATION_XML)).build(); - - - public BaseEucalyptusExpectTest() { - provider = "eucalyptus"; - } - - @ConfiguresRestClient - private static final class TestEucalyptusRestClientModule extends EC2RestClientModule { - @Override - @Provides - protected String provideTimeStamp(DateService dateService) { - return CONSTANT_DATE; - } - } - - @Override - protected Module createModule() { - return new TestEucalyptusRestClientModule(); - } -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAMIClientLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAMIClientLiveTest.java deleted file mode 100644 index e543caf7d6..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAMIClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.services; - -import org.jclouds.ec2.services.AMIClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusAMIClientLiveTest") -public class EucalyptusAMIClientLiveTest extends AMIClientLiveTest { - public EucalyptusAMIClientLiveTest() { - provider = "eucalyptus"; - } - -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAvailabilityZoneAndRegionClientLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAvailabilityZoneAndRegionClientLiveTest.java deleted file mode 100644 index 689b5a12fd..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusAvailabilityZoneAndRegionClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.services; - -import org.jclouds.ec2.services.AvailabilityZoneAndRegionClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusAvailabilityZoneAndRegionClientLiveTest") -public class EucalyptusAvailabilityZoneAndRegionClientLiveTest extends AvailabilityZoneAndRegionClientLiveTest { - public EucalyptusAvailabilityZoneAndRegionClientLiveTest() { - provider = "eucalyptus"; - } - -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticBlockStoreClientLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticBlockStoreClientLiveTest.java deleted file mode 100644 index 072d82748a..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticBlockStoreClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.services; - -import org.jclouds.ec2.services.ElasticBlockStoreClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusElasticBlockStoreClientLiveTest") -public class EucalyptusElasticBlockStoreClientLiveTest extends ElasticBlockStoreClientLiveTest { - public EucalyptusElasticBlockStoreClientLiveTest() { - provider = "eucalyptus"; - } - -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticIPAddressClientLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticIPAddressClientLiveTest.java deleted file mode 100644 index c018d4e9c9..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusElasticIPAddressClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.services; - -import org.jclouds.ec2.services.ElasticIPAddressClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusElasticIPAddressClientLiveTest") -public class EucalyptusElasticIPAddressClientLiveTest extends ElasticIPAddressClientLiveTest { - public EucalyptusElasticIPAddressClientLiveTest() { - provider = "eucalyptus"; - } - -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusInstanceClientLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusInstanceClientLiveTest.java deleted file mode 100644 index 4f7a724705..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusInstanceClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.services; - -import org.jclouds.ec2.services.InstanceClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusInstanceClientLiveTest") -public class EucalyptusInstanceClientLiveTest extends InstanceClientLiveTest { - public EucalyptusInstanceClientLiveTest() { - provider = "eucalyptus"; - } - -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusKeyPairClientLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusKeyPairClientLiveTest.java deleted file mode 100644 index 6e7d0882e7..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusKeyPairClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.services; - -import org.jclouds.ec2.services.KeyPairClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusKeyPairClientLiveTest") -public class EucalyptusKeyPairClientLiveTest extends KeyPairClientLiveTest { - public EucalyptusKeyPairClientLiveTest() { - provider = "eucalyptus"; - } - -} diff --git a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusSecurityGroupClientLiveTest.java b/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusSecurityGroupClientLiveTest.java deleted file mode 100644 index 34d4943725..0000000000 --- a/apis/eucalyptus/src/test/java/org/jclouds/eucalyptus/services/EucalyptusSecurityGroupClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.eucalyptus.services; - -import org.jclouds.ec2.services.SecurityGroupClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusSecurityGroupClientLiveTest") -public class EucalyptusSecurityGroupClientLiveTest extends SecurityGroupClientLiveTest { - public EucalyptusSecurityGroupClientLiveTest() { - provider = "eucalyptus"; - } - -} diff --git a/apis/eucalyptus/src/test/resources/availabilityZones-eucalyptus.xml b/apis/eucalyptus/src/test/resources/availabilityZones-eucalyptus.xml deleted file mode 100644 index 0c5a0525ae..0000000000 --- a/apis/eucalyptus/src/test/resources/availabilityZones-eucalyptus.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - partner01 - 173.205.188.7 arn:euca:eucalyptus:partner01:cluster:cc_01/ - - - - - \ No newline at end of file diff --git a/apis/eucalyptus/src/test/resources/regionEndpoints-euca.xml b/apis/eucalyptus/src/test/resources/regionEndpoints-euca.xml deleted file mode 100644 index a3b205c2e6..0000000000 --- a/apis/eucalyptus/src/test/resources/regionEndpoints-euca.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - eucalyptus - http://eucalyptus.partner.eucalyptus.com:8773/services/Eucalyptus - - - walrus - http://walrus.partner.eucalyptus.com:8773/services/Walrus - - - \ No newline at end of file diff --git a/apis/pom.xml b/apis/pom.xml index 080a87a586..e02a695ea8 100644 --- a/apis/pom.xml +++ b/apis/pom.xml @@ -41,7 +41,6 @@ ec2 sqs deltacloud - eucalyptus vcloud elasticstack atmos diff --git a/providers/eucalyptus-partnercloud-ec2/README.txt b/providers/eucalyptus-partnercloud-ec2/README.txt deleted file mode 100644 index 0a18916547..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/README.txt +++ /dev/null @@ -1,27 +0,0 @@ -==== - 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. -==== - -# -# The jclouds provider for Eucalyptus Partner Cloud's EC2 (http://www.eucalyptus.com/resources/AmazonAWS) service. -# -# Expects the jclouds ec2 API to be present on your application's classpath. -# -# TODO: Implementation status. -# TODO: Supported features. -# TODO: Usage example. \ No newline at end of file diff --git a/providers/eucalyptus-partnercloud-ec2/pom.xml b/providers/eucalyptus-partnercloud-ec2/pom.xml deleted file mode 100644 index e1914a3383..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/pom.xml +++ /dev/null @@ -1,143 +0,0 @@ - - - - 4.0.0 - - org.jclouds - jclouds-project - 1.6.0-SNAPSHOT - ../../project/pom.xml - - org.jclouds.provider - eucalyptus-partnercloud-ec2 - jclouds Eucalyptus Partner Cloud EC2 provider - Eucalyptus (EC2) implementation targeted to the Eucalyptus Partner Cloud - bundle - - - http://partnercloud.eucalyptus.com:8773/services/Eucalyptus - 2010-06-15 - - FIXME_IDENTITY - FIXME_CREDENTIAL - - - - org.jclouds.epc*;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 - eucalyptus - ${project.version} - - - org.jclouds.api - ec2 - ${project.version} - - - org.jclouds.api - eucalyptus - ${project.version} - test-jar - test - - - org.jclouds.api - ec2 - ${project.version} - test-jar - test - - - org.jclouds - jclouds-compute - ${project.version} - test-jar - test - - - org.jclouds - jclouds-core - ${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 - - - 1 - - ${test.eucalyptus-partnercloud-ec2.endpoint} - ${test.eucalyptus-partnercloud-ec2.api-version} - ${test.eucalyptus-partnercloud-ec2.build-version} - ${test.eucalyptus-partnercloud-ec2.identity} - ${test.eucalyptus-partnercloud-ec2.credential} - ${test.eucalyptus-partnercloud-ec2.template} - ${test.eucalyptus-partnercloud-ec2.ebs-template} - - - - - - - - - - - - diff --git a/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderMetadata.java b/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderMetadata.java deleted file mode 100644 index 465661fc7e..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderMetadata.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * 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.epc; - -import static org.jclouds.location.reference.LocationConstants.ISO3166_CODES; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGION; -import static org.jclouds.location.reference.LocationConstants.PROPERTY_REGIONS; - -import java.net.URI; -import java.util.Properties; - -import org.jclouds.ec2.compute.config.EC2ResolveImagesModule; -import org.jclouds.ec2.config.EC2RestClientModule; -import org.jclouds.epc.config.EucalyptusPartnerCloudComputeServiceContextModule; -import org.jclouds.eucalyptus.EucalyptusApiMetadata; -import org.jclouds.providers.ProviderMetadata; -import org.jclouds.providers.internal.BaseProviderMetadata; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -/** - * Implementation of {@link org.jclouds.providers.ProviderMetadata} for Eucalyptus Partner Cloud EC2. - * - * @author Adrian Cole - */ -public class EucalyptusPartnerCloudEC2ProviderMetadata extends BaseProviderMetadata { - - public static Builder builder() { - return new Builder(); - } - - @Override - public Builder toBuilder() { - return builder().fromProviderMetadata(this); - } - - public EucalyptusPartnerCloudEC2ProviderMetadata() { - super(builder()); - } - - public EucalyptusPartnerCloudEC2ProviderMetadata(Builder builder) { - super(builder); - } - - public static Properties defaultProperties() { - Properties properties = new Properties(); - properties.setProperty(PROPERTY_REGIONS, "eucalyptus"); - properties.setProperty(PROPERTY_REGION + ".eucalyptus." + ISO3166_CODES, "US-CA"); - return properties; - } - - public static class Builder extends BaseProviderMetadata.Builder { - - protected Builder(){ - id("eucalyptus-partnercloud-ec2") - .name("Eucalyptus Partner Cloud (EC2)") - .apiMetadata( - new EucalyptusApiMetadata().toBuilder() - .defaultModules(ImmutableSet.>of(EC2RestClientModule.class, EC2ResolveImagesModule.class, EucalyptusPartnerCloudComputeServiceContextModule.class)) - .build()) - .homepage(URI.create("http://www.eucalyptus.com/partners")) - .console(URI.create("https://eucalyptus.partner.eucalyptus.com")) - .linkedServices("eucalyptus-partnercloud-ec2", "eucalyptus-partnercloud-s3") - .iso3166Codes("US-CA") - .endpoint("http://partnercloud.eucalyptus.com:8773/services/Eucalyptus") - .defaultProperties(EucalyptusPartnerCloudEC2ProviderMetadata.defaultProperties()); - } - - @Override - public EucalyptusPartnerCloudEC2ProviderMetadata build() { - return new EucalyptusPartnerCloudEC2ProviderMetadata(this); - } - - @Override - public Builder fromProviderMetadata( - ProviderMetadata in) { - super.fromProviderMetadata(in); - return this; - } - } -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/config/EucalyptusPartnerCloudComputeServiceContextModule.java b/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/config/EucalyptusPartnerCloudComputeServiceContextModule.java deleted file mode 100644 index f30683dc4c..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/config/EucalyptusPartnerCloudComputeServiceContextModule.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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.epc.config; - -import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule; -import org.jclouds.ec2.compute.strategy.ReviseParsedImage; -import org.jclouds.epc.strategy.EucalyptusPartnerCloudReviseParsedImage; - -/** - * - * @author Adrian Cole - */ -public class EucalyptusPartnerCloudComputeServiceContextModule extends EC2ComputeServiceContextModule { - - @Override - protected void configure() { - super.configure(); - bind(ReviseParsedImage.class).to(EucalyptusPartnerCloudReviseParsedImage.class); - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/strategy/EucalyptusPartnerCloudReviseParsedImage.java b/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/strategy/EucalyptusPartnerCloudReviseParsedImage.java deleted file mode 100644 index 11a32944dc..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/main/java/org/jclouds/epc/strategy/EucalyptusPartnerCloudReviseParsedImage.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * 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.epc.strategy; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.annotation.Resource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; - -import org.jclouds.compute.domain.ImageBuilder; -import org.jclouds.compute.domain.OperatingSystem; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.compute.util.ComputeServiceUtils; -import org.jclouds.ec2.compute.strategy.ReviseParsedImage; -import org.jclouds.logging.Logger; - -/** - * @author Adrian Cole - */ -@Singleton -public class EucalyptusPartnerCloudReviseParsedImage implements ReviseParsedImage { - - // debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml - public static final Pattern PATTERN = Pattern.compile("^([^-]+)-([^-]+)-.*"); - public static final Pattern WINDOWS = Pattern.compile("^windows-([^/]+)/.*"); - - private final Map> osVersionMap; - - @Resource - @Named(ComputeServiceConstants.COMPUTE_LOGGER) - protected Logger logger = Logger.NULL; - - @Inject - public EucalyptusPartnerCloudReviseParsedImage(Map> osVersionMap) { - this.osVersionMap = checkNotNull(osVersionMap, "osVersionMap"); - } - - @Override - public void reviseParsedImage(org.jclouds.ec2.domain.Image from, ImageBuilder builder, OsFamily family, - OperatingSystem.Builder osBuilder) { - try { - if (from.getImageLocation().startsWith("windows")) { - family = OsFamily.WINDOWS; - osBuilder.family(family); - Matcher matcher = WINDOWS.matcher(from.getImageLocation()); - if (matcher.find()) { - osBuilder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(family, matcher.group(1).replace( - '-', ' ').replace('s', 'S'), osVersionMap)); - } - } else { - Matcher matcher = PATTERN.matcher(from.getImageLocation()); - if (matcher.find()) { - family = OsFamily.fromValue(matcher.group(1)); - osBuilder.family(family); - osBuilder.version(ComputeServiceUtils.parseVersionOrReturnEmptyString(family, matcher.group(2), - osVersionMap)); - } - } - } catch (IllegalArgumentException e) { - logger.debug("<< didn't match os(%s)", from.getImageLocation()); - } catch (NoSuchElementException e) { - logger.debug("<< didn't match at all(%s)", from.getImageLocation()); - } - } -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/providers/eucalyptus-partnercloud-ec2/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata deleted file mode 100644 index 1afa66de43..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata +++ /dev/null @@ -1 +0,0 @@ -org.jclouds.epc.EucalyptusPartnerCloudEC2ProviderMetadata diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderTest.java deleted file mode 100644 index e919eb9818..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/EucalyptusPartnerCloudEC2ProviderTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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.epc; - -import org.jclouds.eucalyptus.EucalyptusApiMetadata; -import org.jclouds.providers.internal.BaseProviderMetadataTest; -import org.testng.annotations.Test; - -/** - * The EucalyptusPartnerCloudEC2ProviderTest tests the {@link EucalyptusPartnerCloudEC2ProviderMetadata} class. - * - * @author Jeremy Whitlock - */ -@Test(groups = "unit", testName = "EucalyptusPartnerCloudEC2ProviderTest") -public class EucalyptusPartnerCloudEC2ProviderTest extends BaseProviderMetadataTest { - - public EucalyptusPartnerCloudEC2ProviderTest() { - super(new EucalyptusPartnerCloudEC2ProviderMetadata(), new EucalyptusApiMetadata()); - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusComputeServiceLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusComputeServiceLiveTest.java deleted file mode 100644 index 242b9e4cb1..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusComputeServiceLiveTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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.epc.compute; - -import org.jclouds.eucalyptus.compute.EucalyptusComputeServiceLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudEucalyptusComputeServiceLiveTest") -public class EucalyptusPartnerCloudEucalyptusComputeServiceLiveTest extends EucalyptusComputeServiceLiveTest { - - public EucalyptusPartnerCloudEucalyptusComputeServiceLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - // security groups must be <30 characters - group = "eu"; - } -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest.java deleted file mode 100644 index e381531755..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * 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.epc.compute; - -import static org.jclouds.compute.util.ComputeServiceUtils.getCores; -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.util.Set; - -import org.jclouds.aws.util.AWSUtils; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.domain.OsFamilyVersion64Bit; -import org.jclouds.compute.domain.Template; -import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest; -import org.jclouds.domain.LocationScope; -import org.jclouds.ec2.compute.util.EC2ComputeUtils; -import org.testng.annotations.Test; - -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableSet; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live") -public class EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { - - public EucalyptusPartnerCloudEucalyptusTemplateBuilderLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - - @Override - protected Predicate defineUnsupportedOperatingSystems() { - return Predicates.not(new Predicate() { - - @Override - public boolean apply(OsFamilyVersion64Bit input) { - switch (input.family) { - case UBUNTU: - return (input.version.equals("") || input.version.equals("10.04")) && input.is64Bit; - case DEBIAN: - return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit; - case CENTOS: - return (input.version.equals("") || input.version.equals("5.0") || input.version.equals("5.5")) - && input.is64Bit; - default: - return false; - } - } - - }); - } - - @Test - public void testDefaultTemplateBuilder() throws IOException { - Template defaultTemplate = view.getComputeService().templateBuilder().build(); - assert (defaultTemplate.getImage().getProviderId().startsWith("emi-")) : defaultTemplate; - assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04"); - assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); - assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); - assertEquals(defaultTemplate.getImage().getUserMetadata().get("rootDeviceType"), "instance-store"); - assertEquals(defaultTemplate.getHardware().getId(), "m1.small"); - assertEquals(defaultTemplate.getLocation().getId(), "kvm-cluster"); - assertEquals(defaultTemplate.getLocation().getScope(), LocationScope.ZONE); - assertEquals(AWSUtils.getRegionFromLocationOrNull(defaultTemplate.getLocation()), "Eucalyptus"); - assertEquals(EC2ComputeUtils.getZoneFromLocationOrNull(defaultTemplate.getLocation()), "kvm-cluster"); - assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); - } - - @Override - protected Set getIso3166Codes() { - return ImmutableSet. of("US-CA"); - } -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/strategy/EucalyptusPartnerCloudReviseParsedImageTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/strategy/EucalyptusPartnerCloudReviseParsedImageTest.java deleted file mode 100644 index 80bdb9d8d8..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/compute/strategy/EucalyptusPartnerCloudReviseParsedImageTest.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * 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.epc.compute.strategy; - -import static org.testng.Assert.assertEquals; - -import java.util.Map; -import java.util.Set; - -import org.jclouds.compute.config.BaseComputeServiceContextModule; -import org.jclouds.compute.domain.ImageBuilder; -import org.jclouds.compute.domain.OperatingSystem; -import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.reference.ComputeServiceConstants; -import org.jclouds.domain.Location; -import org.jclouds.domain.LocationBuilder; -import org.jclouds.domain.LocationScope; -import org.jclouds.domain.LoginCredentials; -import org.jclouds.ec2.compute.config.EC2ComputeServiceDependenciesModule; -import org.jclouds.ec2.compute.functions.EC2ImageParser; -import org.jclouds.ec2.compute.strategy.EC2PopulateDefaultLoginCredentialsForImageStrategy; -import org.jclouds.ec2.domain.Image; -import org.jclouds.ec2.xml.DescribeImagesResponseHandlerTest; -import org.jclouds.epc.strategy.EucalyptusPartnerCloudReviseParsedImage; -import org.jclouds.json.Json; -import org.jclouds.json.config.GsonModule; -import org.testng.annotations.Test; - -import com.google.common.base.Predicates; -import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; -import com.google.inject.Guice; - -/** - * @author Adrian Cole - */ -@Test(groups = "unit", testName = "EucalyptusPartnerCloudReviseParsedImageTest") -public class EucalyptusPartnerCloudReviseParsedImageTest { - - public void testParseEucalyptusImage() { - - Set result = convertImages("/eucalyptus_images.xml"); - assertEquals(result.size(), 3); - - assertEquals( - Iterables.get(result, 0).toString(), - new ImageBuilder() - .operatingSystem( - OperatingSystem.builder().family(OsFamily.DEBIAN).arch("paravirtual").version("6.0") - .description("debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml").is64Bit(true) - .build()) - .description("debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml") - .defaultCredentials(new LoginCredentials("root", false)) - .id("us-east-1/emi-892C130F") - .providerId("emi-892C130F") - .location(defaultLocation) - .userMetadata( - ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store", "virtualizationType", - "paravirtual", "hypervisor", "xen")) - .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString()); - assertEquals(Iterables.get(result, 0).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE); - - assertEquals( - Iterables.get(result, 1).toString(), - new ImageBuilder() - .operatingSystem( - OperatingSystem.builder().family(OsFamily.CENTOS).arch("paravirtual").version("5.5") - .description("centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml").is64Bit(true) - .build()) - .description("centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml") - .defaultCredentials(new LoginCredentials("root", false)) - .id("us-east-1/emi-9B751369") - .providerId("emi-9B751369") - .location(defaultLocation) - .userMetadata( - ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store", "virtualizationType", - "paravirtual", "hypervisor", "xen")) - .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString()); - assertEquals(Iterables.get(result, 1).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE); - - assertEquals( - Iterables.get(result, 2).toString(), - new ImageBuilder() - .operatingSystem( - OperatingSystem.builder().family(OsFamily.UBUNTU).arch("paravirtual").version("10.04") - .description("ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml").is64Bit(true) - .build()) - .description("ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml") - .defaultCredentials(new LoginCredentials("root", false)) - .id("us-east-1/emi-E0641459") - .providerId("emi-E0641459") - .location(defaultLocation) - .userMetadata( - ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store", "virtualizationType", - "paravirtual", "hypervisor", "xen")) - .status(org.jclouds.compute.domain.Image.Status.AVAILABLE).backendStatus("available").build().toString()); - assertEquals(Iterables.get(result, 2).getStatus(), org.jclouds.compute.domain.Image.Status.AVAILABLE); - - } - - static Location defaultLocation = new LocationBuilder().scope(LocationScope.REGION).id("us-east-1").description( - "us-east-1").build(); - - public static Set convertImages(String resource) { - - Map> map = new BaseComputeServiceContextModule() { - }.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule()) - .getInstance(Json.class)); - - Set result = DescribeImagesResponseHandlerTest.parseImages(resource); - EC2ImageParser parser = new EC2ImageParser(EC2ComputeServiceDependenciesModule.toPortableImageStatus, - new EC2PopulateDefaultLoginCredentialsForImageStrategy(), map, Suppliers - .> ofInstance(ImmutableSet. of(defaultLocation)), Suppliers - .ofInstance(defaultLocation), new EucalyptusPartnerCloudReviseParsedImage(map)); - return Sets.newLinkedHashSet(Iterables.filter(Iterables.transform(result, parser), Predicates.notNull())); - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAMIClientLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAMIClientLiveTest.java deleted file mode 100644 index 5aff0b6e62..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAMIClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.epc.services; - -import org.jclouds.eucalyptus.services.EucalyptusAMIClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudAMIClientLiveTest") -public class EucalyptusPartnerCloudAMIClientLiveTest extends EucalyptusAMIClientLiveTest { - public EucalyptusPartnerCloudAMIClientLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAvailabilityZoneAndRegionClientLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAvailabilityZoneAndRegionClientLiveTest.java deleted file mode 100644 index cb43018591..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudAvailabilityZoneAndRegionClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.epc.services; - -import org.jclouds.eucalyptus.services.EucalyptusAvailabilityZoneAndRegionClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudAvailabilityZoneAndRegionClientLiveTest") -public class EucalyptusPartnerCloudAvailabilityZoneAndRegionClientLiveTest extends EucalyptusAvailabilityZoneAndRegionClientLiveTest { - public EucalyptusPartnerCloudAvailabilityZoneAndRegionClientLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticBlockStoreClientLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticBlockStoreClientLiveTest.java deleted file mode 100644 index 99b801522c..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticBlockStoreClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.epc.services; - -import org.jclouds.eucalyptus.services.EucalyptusElasticBlockStoreClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudElasticBlockStoreClientLiveTest") -public class EucalyptusPartnerCloudElasticBlockStoreClientLiveTest extends EucalyptusElasticBlockStoreClientLiveTest { - public EucalyptusPartnerCloudElasticBlockStoreClientLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticIPAddressClientLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticIPAddressClientLiveTest.java deleted file mode 100644 index 5b7a55bef4..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudElasticIPAddressClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.epc.services; - -import org.jclouds.eucalyptus.services.EucalyptusElasticIPAddressClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudElasticIPAddressClientLiveTest") -public class EucalyptusPartnerCloudElasticIPAddressClientLiveTest extends EucalyptusElasticIPAddressClientLiveTest { - public EucalyptusPartnerCloudElasticIPAddressClientLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudInstanceClientLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudInstanceClientLiveTest.java deleted file mode 100644 index 758d4706c8..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudInstanceClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.epc.services; - -import org.jclouds.eucalyptus.services.EucalyptusInstanceClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudInstanceClientLiveTest") -public class EucalyptusPartnerCloudInstanceClientLiveTest extends EucalyptusInstanceClientLiveTest { - public EucalyptusPartnerCloudInstanceClientLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudKeyPairClientLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudKeyPairClientLiveTest.java deleted file mode 100644 index 4b6401d19f..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudKeyPairClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.epc.services; - -import org.jclouds.eucalyptus.services.EucalyptusKeyPairClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudKeyPairClientLiveTest") -public class EucalyptusPartnerCloudKeyPairClientLiveTest extends EucalyptusKeyPairClientLiveTest { - public EucalyptusPartnerCloudKeyPairClientLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudSecurityGroupClientLiveTest.java b/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudSecurityGroupClientLiveTest.java deleted file mode 100644 index ee68f64afd..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/java/org/jclouds/epc/services/EucalyptusPartnerCloudSecurityGroupClientLiveTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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.epc.services; - -import org.jclouds.eucalyptus.services.EucalyptusSecurityGroupClientLiveTest; -import org.testng.annotations.Test; - -/** - * - * @author Adrian Cole - */ -@Test(groups = "live", singleThreaded = true, testName = "EucalyptusPartnerCloudSecurityGroupClientLiveTest") -public class EucalyptusPartnerCloudSecurityGroupClientLiveTest extends EucalyptusSecurityGroupClientLiveTest { - public EucalyptusPartnerCloudSecurityGroupClientLiveTest() { - provider = "eucalyptus-partnercloud-ec2"; - } - -} diff --git a/providers/eucalyptus-partnercloud-ec2/src/test/resources/eucalyptus_images.xml b/providers/eucalyptus-partnercloud-ec2/src/test/resources/eucalyptus_images.xml deleted file mode 100644 index 9b4111490e..0000000000 --- a/providers/eucalyptus-partnercloud-ec2/src/test/resources/eucalyptus_images.xml +++ /dev/null @@ -1,89 +0,0 @@ - - a70893be-64cb-4cee-a6ef-ab1fcea75266 - - - eki-23CD15B0 - kvm-kernel-x86_64/vmlinuz-2.6.28-11-generic.manifest.xml - - available - admin - true - - x86_64 - kernel - linux - - - eri-849A1703 - kvm-ramdisk-x86_64/initrd.img-2.6.28-11-generic.manifest.xml - - available - admin - true - - x86_64 - ramdisk - linux - - - emi-892C130F - debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml - - available - admin - true - - x86_64 - machine - linux - - - emi-9B751369 - centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml - - available - admin - true - - x86_64 - machine - linux - - - eri-042914D2 - xen-ramdisk-x86_64/initrd-2.6.27.21-0.1-xen.manifest.xml - - available - admin - true - - x86_64 - ramdisk - linux - - - emi-E0641459 - ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml - - available - admin - true - - x86_64 - machine - linux - - - eki-08A714DD - xen-kernel-x86_64/vmlinuz-2.6.27.21-0.1-xen.manifest.xml - - available - admin - true - - x86_64 - kernel - linux - - - \ No newline at end of file diff --git a/providers/pom.xml b/providers/pom.xml index 0c99dd4a40..f1fa7b554e 100644 --- a/providers/pom.xml +++ b/providers/pom.xml @@ -43,7 +43,6 @@ synaptic-storage ninefold-storage cloudonestorage - eucalyptus-partnercloud-ec2 bluelock-vcloud-zone01 stratogen-vcloud-mycloud trmk-ecloud From 38152a5cc3667998cc3d926711fd046bb8607c21 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sat, 29 Dec 2012 11:54:19 -0800 Subject: [PATCH 2/2] issue #1108: remove special casing of eucalyptus --- .../RunningInstanceToNodeMetadata.java | 10 +++------ .../ec2/xml/BaseReservationHandler.java | 22 ++----------------- ...cribeAvailabilityZonesResponseHandler.java | 3 ++- .../xml/DescribeImagesResponseHandler.java | 6 +---- .../RunningInstanceToNodeMetadataTest.java | 15 ------------- .../java/org/jclouds/aws/util/AWSUtils.java | 7 ++---- .../org/jclouds/aws/util/AWSUtilsTest.java | 20 +++++++++++++++++ 7 files changed, 30 insertions(+), 53 deletions(-) diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java b/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java index a134ec036e..8dd3315379 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadata.java @@ -20,6 +20,7 @@ package org.jclouds.ec2.compute.functions; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Predicates.not; +import static com.google.common.base.Strings.emptyToNull; import static com.google.common.collect.Iterables.filter; import java.util.List; @@ -55,7 +56,6 @@ import org.jclouds.util.InetAddresses2.IsPrivateIPAddress; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Predicate; -import com.google.common.base.Strings; import com.google.common.base.Supplier; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; @@ -120,13 +120,9 @@ public class RunningInstanceToNodeMetadata implements Function addressesBuilder = ImmutableSet.builder(); - if (Strings.emptyToNull(instance.getIpAddress()) != null) + if (emptyToNull(instance.getIpAddress()) != null) addressesBuilder.add(instance.getIpAddress()); - //Add dnsName (if available) to addresses, when the IPAddress is null - // happens on Eucalyptus sometimes. - else if(Strings.emptyToNull(instance.getDnsName()) != null) - addressesBuilder.add(instance.getDnsName()); - if (Strings.emptyToNull(instance.getPrivateIpAddress()) != null) + if (emptyToNull(instance.getPrivateIpAddress()) != null) addressesBuilder.add(instance.getPrivateIpAddress()); Set addresses = addressesBuilder.build(); diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/xml/BaseReservationHandler.java b/apis/ec2/src/main/java/org/jclouds/ec2/xml/BaseReservationHandler.java index 56ef8201a5..c01805cd77 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/xml/BaseReservationHandler.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/xml/BaseReservationHandler.java @@ -121,10 +121,7 @@ public abstract class BaseReservationHandler extends HandlerForGeneratedReque } else if (equalsOrSuffix(qName, "amiLaunchIndex")) { builder.amiLaunchIndex(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "dnsName")) { - String dnsName = currentOrNull(currentText); - // Eucalyptus - if (!"0.0.0.0".equals(dnsName)) - builder.dnsName(dnsName); + builder.dnsName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "imageId")) { builder.imageId(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "instanceId")) { @@ -152,10 +149,7 @@ public abstract class BaseReservationHandler extends HandlerForGeneratedReque } else if (equalsOrSuffix(qName, "platform")) { builder.platform(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "privateDnsName")) { - String privateDnsName = currentOrNull(currentText); - // Eucalyptus - if (!"0.0.0.0".equals(privateDnsName)) - builder.privateDnsName(privateDnsName); + builder.privateDnsName(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "privateIpAddress")) { builder.privateIpAddress(currentOrNull(currentText)); } else if (equalsOrSuffix(qName, "ramdiskId")) { @@ -197,18 +191,6 @@ public abstract class BaseReservationHandler extends HandlerForGeneratedReque protected void refineBuilderBeforeAddingInstance() { String region = getRequest() != null ? AWSUtils.findRegionInArgsOrNull(getRequest()) : null; - - // Eucalyptus - if (builder.getIpAddress() == null && builder.getDnsName() != null && builder.getDnsName().matches(".*[0-9]$")) { - builder.ipAddress(builder.getDnsName()); - builder.dnsName(null); - } - if (builder.getPrivateIpAddress() == null && builder.getPrivateDnsName() != null - && builder.getPrivateDnsName().matches(".*[0-9]$")) { - builder.privateIpAddress(builder.getPrivateDnsName()); - builder.privateDnsName(null); - } - builder.region((region == null) ? defaultRegion.get() : region); builder.groupNames(groupNames); } diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeAvailabilityZonesResponseHandler.java b/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeAvailabilityZonesResponseHandler.java index a931531c60..aeb8873bff 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeAvailabilityZonesResponseHandler.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeAvailabilityZonesResponseHandler.java @@ -50,7 +50,8 @@ public class DescribeAvailabilityZonesResponseHandler extends ParseSax.HandlerWi private Set messages = Sets.newHashSet(); /** - * Eucalyptus 1.6 doesn't return region in the XML output + * clones like {@code openstack-nova-ec2}, which don't support multiple regions don't return region in the XML + * output. */ @Inject DescribeAvailabilityZonesResponseHandler(@Region Supplier defaultRegion) { diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeImagesResponseHandler.java b/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeImagesResponseHandler.java index ce75bde66a..8c7fa42813 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeImagesResponseHandler.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/xml/DescribeImagesResponseHandler.java @@ -83,9 +83,6 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedR private String ramdiskId; private boolean inProductCodes; private boolean inBlockDeviceMapping; - /** - * Eucalyptus 1.6 doesn't set rootDeviceType - */ private RootDeviceType rootDeviceType = RootDeviceType.INSTANCE_STORE; private Map ebsBlockDevices = Maps.newHashMap(); private String deviceName; @@ -129,8 +126,7 @@ public class DescribeImagesResponseHandler extends ParseSax.HandlerForGeneratedR } else if (qName.equals("imageState")) { rawState = currentOrNull(currentText); imageState = ImageState.fromValue(rawState); - // eucalyptus - } else if (qName.equals("imageType") || qName.equals("type")) { + } else if (qName.equals("imageType")) { imageType = ImageType.fromValue(currentText.toString().trim()); } else if (qName.equals("isPublic")) { isPublic = Boolean.parseBoolean(currentText.toString().trim()); diff --git a/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java b/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java index 75e5016c55..5c272da6e0 100644 --- a/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java +++ b/apis/ec2/src/test/java/org/jclouds/ec2/compute/functions/RunningInstanceToNodeMetadataTest.java @@ -99,21 +99,6 @@ public class RunningInstanceToNodeMetadataTest { "us-east-1/image").providerId("id").build().toString()); } - @Test - public void testIPAddressIsSetToDnsNameWhenIPAddressIsNull() { - RunningInstance instance = RunningInstance.builder().instanceId("id").imageId("image").instanceType("m1.small") - .instanceState(InstanceState.RUNNING).rawState("running").region("us-east-1").dnsName("jclouds-1-1-1-1.jclouds.org").build(); - - RunningInstanceToNodeMetadata parser = createNodeParser(ImmutableSet. of(), ImmutableSet - . of(), ImmutableSet. of(), ImmutableMap. of()); - - assertEquals(parser.apply(instance).toString(), new NodeMetadataBuilder().status(Status.RUNNING).backendStatus("running").privateAddresses( - ImmutableSet. of()).publicAddresses(ImmutableSet.of("jclouds-1-1-1-1.jclouds.org")).id("us-east-1/id").imageId( - "us-east-1/image").providerId("id").build().toString()); - - } - - static Location provider = new LocationBuilder().scope(LocationScope.REGION).id("us-east-1") .description("us-east-1").build(); diff --git a/common/aws/src/main/java/org/jclouds/aws/util/AWSUtils.java b/common/aws/src/main/java/org/jclouds/aws/util/AWSUtils.java index 10fea27e53..2c80e22a51 100644 --- a/common/aws/src/main/java/org/jclouds/aws/util/AWSUtils.java +++ b/common/aws/src/main/java/org/jclouds/aws/util/AWSUtils.java @@ -85,15 +85,12 @@ public class AWSUtils { } public AWSError parseAWSErrorFromContent(HttpRequest request, HttpResponse response) { - // HEAD has no content if (response.getPayload() == null) return null; - // Eucalyptus and Walrus occasionally return text/plain - if (response.getPayload().getContentMetadata().getContentType() != null - && response.getPayload().getContentMetadata().getContentType().indexOf("text/plain") != -1) + if ("text/plain".equals(response.getPayload().getContentMetadata().getContentType())) return null; try { - AWSError error = (AWSError) factory.create(errorHandlerProvider.get()).setContext(request).apply(response); + AWSError error = factory.create(errorHandlerProvider.get()).setContext(request).apply(response); if (error.getRequestId() == null) error.setRequestId(response.getFirstHeaderOrNull(requestId)); error.setRequestToken(response.getFirstHeaderOrNull(requestToken)); diff --git a/common/aws/src/test/java/org/jclouds/aws/util/AWSUtilsTest.java b/common/aws/src/test/java/org/jclouds/aws/util/AWSUtilsTest.java index 97f1610de1..fa9b565981 100644 --- a/common/aws/src/test/java/org/jclouds/aws/util/AWSUtilsTest.java +++ b/common/aws/src/test/java/org/jclouds/aws/util/AWSUtilsTest.java @@ -22,6 +22,7 @@ import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.expect; import static org.easymock.EasyMock.replay; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNull; import java.io.IOException; import java.io.InputStream; @@ -69,6 +70,25 @@ public class AWSUtilsTest { response.getPayload().getContentMetadata().setContentType("text/xml"); return response; } + + /** + * HEAD requests don't have a payload + */ + @Test + public void testNoExceptionWhenNoPayload() { + HttpResponse response = HttpResponse.builder().statusCode(400).build(); + assertNull(utils.parseAWSErrorFromContent(command.getCurrentRequest(), response)); + } + + /** + * clones or proxies can mess up the error message. + */ + @Test + public void testNoExceptionParsingTextPlain() { + HttpResponse response = HttpResponse.builder().statusCode(400).payload("foo bar").build(); + response.getPayload().getContentMetadata().setContentType("text/plain"); + assertNull(utils.parseAWSErrorFromContent(command.getCurrentRequest(), response)); + } @Test public void testParseAWSErrorFromContentHttpCommandHttpResponseInputStream() {