diff --git a/core/src/main/resources/rest.properties b/core/src/main/resources/rest.properties index c8442950b8..ec8471e594 100644 --- a/core/src/main/resources/rest.properties +++ b/core/src/main/resources/rest.properties @@ -242,3 +242,6 @@ filesystem.propertiesbuilder=org.jclouds.filesystem.FilesystemBlobStorePropertie hpcloud-objectstorage-lvs.contextbuilder=org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasContextBuilder hpcloud-objectstorage-lvs.propertiesbuilder=org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasPropertiesBuilder + +hpcloud-compute.contextbuilder=org.jclouds.openstack.nova.v1_1.NovaContextBuilder +hpcloud-compute.propertiesbuilder=org.jclouds.hpcloud.compute.HPCloudComputePropertiesBuilder diff --git a/labs/hpcloud-compute/pom.xml b/labs/hpcloud-compute/pom.xml new file mode 100644 index 0000000000..84901469c0 --- /dev/null +++ b/labs/hpcloud-compute/pom.xml @@ -0,0 +1,145 @@ + + + + 4.0.0 + + org.jclouds + jclouds-project + 1.5.0-SNAPSHOT + ../../project/pom.xml + + org.jclouds.labs + hpcloud-compute + jclouds HP Cloud Compute provider + OpenStack Nova implementation targeted to HP Cloud Compute + bundle + + + https://region-a.geo-1.identity.hpcloudsvc.com:35357 + 1.1 + + ${test.hpcloud-us.identity} + ${test.hpcloud-us.credential} + + + + + + + + org.jclouds.labs + openstack-nova + ${project.version} + + + org.jclouds + jclouds-core + ${project.version} + test-jar + test + + + org.jclouds + jclouds-compute + ${project.version} + test-jar + test + + + org.jclouds.labs + openstack-nova + ${project.version} + test-jar + test + + + org.jclouds.driver + jclouds-slf4j + ${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.hpcloud-compute.endpoint} + ${test.hpcloud-compute.api-version} + ${test.hpcloud-compute.build-version} + ${test.hpcloud-compute.identity} + ${test.hpcloud-compute.credential} + ${test.hpcloud-compute.image-id} + ${test.hpcloud-compute.image.login-user} + ${test.hpcloud-compute.image.authenticate-sudo} + + + + + + + + + + + + + + org.apache.felix + maven-bundle-plugin + + + ${project.artifactId} + org.jclouds.hpcloud.compute*;version="${project.version}" + + org.jclouds.compute.internal;version="${project.version}", + org.jclouds.rest.internal;version="${project.version}", + org.jclouds*;version="${project.version}", + * + + + + + + + + diff --git a/labs/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputePropertiesBuilder.java b/labs/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputePropertiesBuilder.java new file mode 100644 index 0000000000..27a6d3aa47 --- /dev/null +++ b/labs/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputePropertiesBuilder.java @@ -0,0 +1,46 @@ +/** + * 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 computee 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.hpcloud.compute; + +import static org.jclouds.Constants.PROPERTY_ENDPOINT; +import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; + +import java.util.Properties; + +import org.jclouds.openstack.nova.v1_1.NovaPropertiesBuilder; + +/** + * + * @author Adrian Cole + */ +public class HPCloudComputePropertiesBuilder extends NovaPropertiesBuilder { + + @Override + protected Properties defaultProperties() { + Properties properties = super.defaultProperties(); + properties.setProperty(PROPERTY_ISO3166_CODES, "US-NV"); + properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.identity.hpcloudsvc.com:35357"); + return properties; + } + + public HPCloudComputePropertiesBuilder(Properties properties) { + super(properties); + } + +} diff --git a/labs/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderMetadata.java b/labs/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderMetadata.java new file mode 100644 index 0000000000..37e5f808cb --- /dev/null +++ b/labs/hpcloud-compute/src/main/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderMetadata.java @@ -0,0 +1,117 @@ +/** + * 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 computee 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.hpcloud.compute; + +import java.net.URI; +import java.util.Set; + +import org.jclouds.providers.BaseProviderMetadata; +import org.jclouds.providers.ProviderMetadata; + +import com.google.common.collect.ImmutableSet; + + +/** + * Implementation of {@link org.jclouds.types.ProviderMetadata} for HP Cloud Compute Services. + * + * @author Adrian Cole + */ +public class HPCloudComputeProviderMetadata extends BaseProviderMetadata { + + /** + * {@inheritDoc} + */ + @Override + public String getId() { + return "hpcloud-compute"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getType() { + return ProviderMetadata.COMPUTE_TYPE; + } + + /** + * {@inheritDoc} + */ + @Override + public String getIdentityName() { + return "email:tenantId"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getCredentialName() { + return "API Key"; + } + + /** + * {@inheritDoc} + */ + @Override + public String getName() { + return "HP Cloud Compute Services"; + } + + /** + * {@inheritDoc} + */ + @Override + public URI getHomepage() { + return URI.create("http://hpcloud.com"); + } + + /** + * {@inheritDoc} + */ + @Override + public URI getConsole() { + return URI.create("https://manage.hpcloud.com/compute"); + } + + /** + * {@inheritDoc} + */ + @Override + public URI getApiDocumentation() { + return URI.create("TODO"); + } + + /** + * {@inheritDoc} + */ + @Override + public Set getLinkedServices() { + return ImmutableSet.of("hpcloud-compute", "hpcloud-objectstorage-lvs"); + } + + /** + * {@inheritDoc} + */ + @Override + public Set getIso3166Codes() { + return ImmutableSet.of("US-NV"); + } + +} diff --git a/labs/hpcloud-compute/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata b/labs/hpcloud-compute/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata new file mode 100644 index 0000000000..c25bb188ee --- /dev/null +++ b/labs/hpcloud-compute/src/main/resources/META-INF/services/org.jclouds.providers.ProviderMetadata @@ -0,0 +1 @@ +org.jclouds.hpcloud.compute.HPCloudComputeProviderMetadata diff --git a/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderTest.java b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderTest.java new file mode 100644 index 0000000000..783b8d65ba --- /dev/null +++ b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/HPCloudComputeProviderTest.java @@ -0,0 +1,52 @@ +/** + * 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 computee 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. + */ +/** + * + * + * ==================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not computee 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.hpcloud.compute; + +import org.jclouds.providers.BaseProviderMetadataTest; +import org.jclouds.providers.ProviderMetadata; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "unit", testName = "HPCloudComputeProviderTest") +public class HPCloudComputeProviderTest extends BaseProviderMetadataTest { + + public HPCloudComputeProviderTest() { + super(new HPCloudComputeProviderMetadata(), ProviderMetadata.COMPUTE_TYPE); + } +} diff --git a/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/compute/HPCloudComputeComputeServiceLiveTest.java b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/compute/HPCloudComputeComputeServiceLiveTest.java new file mode 100644 index 0000000000..bbd5dd87f8 --- /dev/null +++ b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/compute/HPCloudComputeComputeServiceLiveTest.java @@ -0,0 +1,43 @@ +/** + * 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 computee 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.hpcloud.compute.compute; + +import org.jclouds.compute.BaseComputeServiceLiveTest; +import org.jclouds.sshj.config.SshjSshClientModule; +import org.testng.annotations.Test; + +import com.google.inject.Module; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", singleThreaded = true, testName = "HPCloudComputeComputeServiceLiveTest") +public class HPCloudComputeComputeServiceLiveTest extends BaseComputeServiceLiveTest { + + public HPCloudComputeComputeServiceLiveTest() { + provider = "hpcloud-compute"; + } + + @Override + protected Module getSshModule() { + return new SshjSshClientModule(); + } + +} diff --git a/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/compute/HPCloudComputeTemplateBuilderLiveTest.java b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/compute/HPCloudComputeTemplateBuilderLiveTest.java new file mode 100644 index 0000000000..80fa8d4df8 --- /dev/null +++ b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/compute/HPCloudComputeTemplateBuilderLiveTest.java @@ -0,0 +1,83 @@ +/** + * 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 computee 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.hpcloud.compute.compute; + +import static org.jclouds.compute.util.ComputeServiceUtils.getCores; +import static org.testng.Assert.assertEquals; + +import java.util.Set; + +import org.jclouds.compute.BaseTemplateBuilderLiveTest; +import org.jclouds.compute.domain.OsFamily; +import org.jclouds.compute.domain.OsFamilyVersion64Bit; +import org.jclouds.compute.domain.Template; +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 HPCloudComputeTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest { + + public HPCloudComputeTemplateBuilderLiveTest() { + provider = "hpcloud-compute"; + } + + @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.matches("^1[01].*")) && input.is64Bit; + case DEBIAN: + return input.is64Bit && !input.version.equals("5.0"); + case CENTOS: + return (input.version.equals("") || input.version.equals("5.6") || input.version.equals("6.0")) + && input.is64Bit; + default: + return false; + } + } + + }); + } + + @Test + public void testTemplateBuilder() { + Template defaultTemplate = this.context.getComputeService().templateBuilder().build(); + assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10"); + assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU); + assertEquals(defaultTemplate.getLocation().getId(), "az-1.region-a.geo-1"); + assertEquals(getCores(defaultTemplate.getHardware()), 1.0d); + } + + @Override + protected Set getIso3166Codes() { + return ImmutableSet. of("US-NV"); + } +} diff --git a/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeFlavorClientLiveTest.java b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeFlavorClientLiveTest.java new file mode 100644 index 0000000000..279a92a173 --- /dev/null +++ b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeFlavorClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.compute.features; + +import org.jclouds.openstack.nova.v1_1.features.FlavorClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "HPCloudComputeFlavorClientLiveTest") +public class HPCloudComputeFlavorClientLiveTest extends FlavorClientLiveTest { + public HPCloudComputeFlavorClientLiveTest() { + provider = "hpcloud-compute"; + } + +} diff --git a/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeFloatingIPClientLiveTest.java b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeFloatingIPClientLiveTest.java new file mode 100644 index 0000000000..81856da6b1 --- /dev/null +++ b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeFloatingIPClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.compute.features; + +import org.jclouds.openstack.nova.v1_1.features.FloatingIPClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "HPCloudComputeFloatingIPClientLiveTest") +public class HPCloudComputeFloatingIPClientLiveTest extends FloatingIPClientLiveTest { + public HPCloudComputeFloatingIPClientLiveTest() { + provider = "hpcloud-compute"; + } + +} diff --git a/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeServerClientLiveTest.java b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeServerClientLiveTest.java new file mode 100644 index 0000000000..dceb42173f --- /dev/null +++ b/labs/hpcloud-compute/src/test/java/org/jclouds/hpcloud/compute/features/HPCloudComputeServerClientLiveTest.java @@ -0,0 +1,34 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.compute.features; + +import org.jclouds.openstack.nova.v1_1.features.ServerClientLiveTest; +import org.testng.annotations.Test; + +/** + * + * @author Adrian Cole + */ +@Test(groups = "live", testName = "HPCloudComputeServerClientLiveTest") +public class HPCloudComputeServerClientLiveTest extends ServerClientLiveTest { + public HPCloudComputeServerClientLiveTest() { + provider = "hpcloud-compute"; + } + +}