Merge pull request #268 from theambidextrousboy/Issue-789-Add-Elastichosts-tor-p

Issue 789: elastichost-tor-p provider
This commit is contained in:
Adrian Cole 2011-12-20 09:33:30 -08:00
commit b7ab393b10
12 changed files with 580 additions and 0 deletions

View File

@ -114,6 +114,9 @@ elastichosts-lon-b.contextbuilder=org.jclouds.elasticstack.ElasticStackContextBu
elastichosts-sat-p.propertiesbuilder=org.jclouds.elastichosts.ElasticHostsPeer1SanAntonioPropertiesBuilder
elastichosts-sat-p.contextbuilder=org.jclouds.elasticstack.ElasticStackContextBuilder
elastichosts-tor-p.propertiesbuilder=org.jclouds.elastichosts.ElasticHostsPeer1TorontoPropertiesBuilder
elastichosts-tor-p.contextbuilder=org.jclouds.elasticstack.ElasticStackContextBuilder
skalicloud-sdg-my.propertiesbuilder=org.jclouds.skalicloud.SkaliCloudMalaysiaPropertiesBuilder
skalicloud-sdg-my.contextbuilder=org.jclouds.skalicloud.SkaliCloudMalaysiaContextBuilder

View File

@ -0,0 +1,27 @@
====
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 ElasticHosts' Peer1 Toronto ElasticStack (http://www.elastichosts.com/).
#
# Expects the jclouds elasticstack API to be present on your application's classpath.
#
# TODO: Implementation status.
# TODO: Supported features.
# TODO: Usage example.

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.provider</groupId>
<artifactId>elastichosts-tor-p</artifactId>
<name>jclouds ElasticHosts Peer1 Toronto provider</name>
<description>ElasticHosts implementation targeted to Peer1 Toronto</description>
<packaging>bundle</packaging>
<properties>
<test.elastichosts-tor-p.endpoint>https://api.tor-p.elastichosts.com</test.elastichosts-tor-p.endpoint>
<test.elastichosts-tor-p.apiversion>2.0</test.elastichosts-tor-p.apiversion>
<test.elastichosts-tor-p.identity>FIXME_IDENTITY</test.elastichosts-tor-p.identity>
<test.elastichosts-tor-p.credential>FIXME_CREDENTIAL</test.elastichosts-tor-p.credential>
<test.elastichosts-tor-p.image-id></test.elastichosts-tor-p.image-id>
</properties>
<dependencies>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.api</groupId>
<artifactId>elasticstack</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds</groupId>
<artifactId>jclouds-compute</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-log4j</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jclouds.driver</groupId>
<artifactId>jclouds-sshj</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>live</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<test.elastichosts-tor-p.endpoint>${test.elastichosts-tor-p.endpoint}</test.elastichosts-tor-p.endpoint>
<test.elastichosts-tor-p.apiversion>${test.elastichosts-tor-p.apiversion}</test.elastichosts-tor-p.apiversion>
<test.elastichosts-tor-p.identity>${test.elastichosts-tor-p.identity}</test.elastichosts-tor-p.identity>
<test.elastichosts-tor-p.credential>${test.elastichosts-tor-p.credential}</test.elastichosts-tor-p.credential>
<test.elastichosts-tor-p.image-id>${test.elastichosts-tor-p.image-id}</test.elastichosts-tor-p.image-id>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>org.jclouds.elastichosts.*;version="${project.version}"</Export-Package>
<Import-Package>org.jclouds.*;version="${project.version}",*</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -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 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.elastichosts;
import org.jclouds.elasticstack.ElasticStackPropertiesBuilder;
import java.util.Properties;
import static org.jclouds.Constants.*;
/**
*
* @author Adrian Cole
*/
public class ElasticHostsPeer1TorontoPropertiesBuilder extends ElasticStackPropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_ISO3166_CODES, "CA-ON");
properties.setProperty(PROPERTY_ENDPOINT, "https://api.tor-p.elastichosts.com");
properties.setProperty(PROPERTY_API_VERSION, "2.0");
return properties;
}
public ElasticHostsPeer1TorontoPropertiesBuilder(Properties properties) {
super(properties);
}
}

View File

@ -0,0 +1,114 @@
/**
* 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.elastichosts;
import com.google.common.collect.ImmutableSet;
import org.jclouds.providers.BaseProviderMetadata;
import org.jclouds.providers.ProviderMetadata;
import java.net.URI;
import java.util.Set;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for ElasticHosts Toronto Peer 1.
*
* @author Adrian Cole
*/
public class ElasticHostsPeer1TorontoProviderMetadata extends BaseProviderMetadata {
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return "elastichosts-tor-p";
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return ProviderMetadata.COMPUTE_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "ElasticHosts Toronto Peer 1";
}
/**
* {@inheritDoc}
*/
@Override
public String getIdentityName() {
return "UUID";
}
/**
* {@inheritDoc}
*/
@Override
public String getCredentialName() {
return "Secret API key";
}
/**
* {@inheritDoc}
*/
@Override
public URI getHomepage() {
return URI.create("https://tor-p.elastichosts.com");
}
/**
* {@inheritDoc}
*/
@Override
public URI getConsole() {
return URI.create("https://tor-p.elastichosts.com/accounts");
}
/**
* {@inheritDoc}
*/
@Override
public URI getApiDocumentation() {
return URI.create("http://www.elastichosts.com/cloud-hosting/api");
}
/**
* {@inheritDoc}
*/
@Override
public Set<String> getLinkedServices() {
return ImmutableSet.of("elastichosts-tor-p");
}
/**
* {@inheritDoc}
*/
@Override
public Set<String> getIso3166Codes() {
return ImmutableSet.of("CA-ON");
}
}

View File

@ -0,0 +1 @@
org.jclouds.elastichosts.ElasticHostsPeer1TorontoProviderMetadata

View File

@ -0,0 +1,65 @@
[
{
"uuid": "73f7cc6a-1c48-418a-80de-886b28a56a4d",
"description": "CentOS Linux 6.0",
"osFamily": "CENTOS",
"osVersion": "6.0",
"size": "3"
},
{
"uuid": "9405cddf-8d01-472c-b7e3-e8c062dcde51",
"description": "Debian Linux 6.0",
"osFamily": "DEBIAN",
"osVersion": "6.0",
"size": "1"
},
{
"uuid": "aee5589a-88c3-43ef-bb0a-9cab6e64192d",
"description": "Ubuntu Linux 10.04",
"osFamily": "UBUNTU",
"osVersion": "10.04",
"size": "1"
},
{
"uuid": "8d8aee18-8744-452c-94b2-69a2a34b8460",
"description": "Ubuntu Linux 11.10",
"osFamily": "UBUNTU",
"osVersion": "11.10",
"size": "1"
},
{
"uuid": "b9d0eb72-d273-43f1-98e3-0d4b87d372c0",
"description": "Windows Web Server 2008",
"osFamily": "WINDOWS",
"osVersion": "2008",
"size": "13"
},
{
"uuid": "b405b598-4ae4-4ba8-8a2b-a9487d693f34",
"description": "Windows Web Server 2008 R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "9397d327-3bf6-46a2-abf6-69553dbb6927",
"description": "Windows Web Server 2008 R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "b17ebce6-61b4-4dcc-9654-41c9fc847e01",
"description": "Windows Server 2008 Standard R2",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
},
{
"uuid": "662c5b3f-9828-4aa2-a866-7cfa53798cdf",
"description": "Windows Server 2008 Standard R2 + SQL Server",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -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.elastichosts;
import org.jclouds.elasticstack.ElasticStackClientLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true)
public class ElasticHostsPeer1TorontoClientLiveTest extends ElasticStackClientLiveTest {
public ElasticHostsPeer1TorontoClientLiveTest() {
provider = "elastichosts-tor-p";
bootDrive = "aee5589a-88c3-43ef-bb0a-9cab6e64192d";
}
}

View File

@ -0,0 +1,35 @@
/**
* 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.elastichosts;
import org.jclouds.providers.BaseProviderMetadataTest;
import org.jclouds.providers.ProviderMetadata;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "ElasticHostsPeer1TorontoProviderTest")
public class ElasticHostsPeer1TorontoProviderTest extends BaseProviderMetadataTest {
public ElasticHostsPeer1TorontoProviderTest() {
super(new ElasticHostsPeer1TorontoProviderMetadata(), ProviderMetadata.COMPUTE_TYPE);
}
}

View File

@ -0,0 +1,36 @@
/**
* 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.elastichosts.compute;
import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true, testName = "ElasticHostsPeer1TorontoComputeServiceLiveTest")
public class ElasticHostsPeer1TorontoComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
public ElasticHostsPeer1TorontoComputeServiceLiveTest() {
provider = "elastichosts-tor-p";
group = "elastichosts";
}
}

View File

@ -0,0 +1,84 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.elastichosts.compute;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableSet;
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 java.util.Set;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live")
public class ElasticHostsPeer1TorontoTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
public ElasticHostsPeer1TorontoTemplateBuilderLiveTest() {
provider = "elastichosts-tor-p";
}
@Override
protected Predicate<OsFamilyVersion64Bit> defineUnsupportedOperatingSystems() {
return Predicates.not(new Predicate<OsFamilyVersion64Bit>() {
@Override
public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return (input.version.equals("") || ImmutableSet.of("11.10", "10.04").contains(input.version)) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2") || input.version.equals("2008"))
&& 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(), "elastichosts-tor-p");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override
protected Set<String> getIso3166Codes() {
return ImmutableSet.<String> of("CA-ON");
}
}

View File

@ -57,6 +57,7 @@
<module>elastichosts-lon-p</module>
<module>elastichosts-sat-p</module>
<module>elastichosts-lon-b</module>
<module>elastichosts-tor-p</module>
<module>rimuhosting</module>
<module>openhosting-east1</module>
<module>serverlove-z1-man</module>