Issue 645:support Go2Cloud Johannesburg

This commit is contained in:
Adrian Cole 2011-07-28 01:37:26 -07:00
parent 85a6e2f90f
commit 6ff1738e8a
15 changed files with 588 additions and 1 deletions

View File

@ -21,7 +21,7 @@ our compute api supports: aws-ec2, gogrid, cloudservers-us, stub (in-memory), de
slicehost, eucalyptus-partnercloud-ec2, elastichosts-lon-p (Peer 1),
elastichosts-sat-p (Peer 1), elastichosts-lon-b (BlueSquare),
openhosting-east1, serverlove-z1-man, skalicloud-sdg-my,
greenhousedata-element-vcloud
greenhousedata-element-vcloud, go2cloud-jhb1
* note * the pom dependency org.jclouds/jclouds-allcompute gives you access to
to all of these providers

View File

@ -159,6 +159,11 @@
<artifactId>openhosting-east1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>go2cloud-jhb1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jclouds.provider</groupId>
<artifactId>serverlove-z1-man</artifactId>

View File

@ -138,6 +138,9 @@ serverlove-z1-man.contextbuilder=org.jclouds.serverlove.ServerloveManchesterCont
openhosting-east1.propertiesbuilder=org.jclouds.openhosting.OpenHostingEast1PropertiesBuilder
openhosting-east1.contextbuilder=org.jclouds.openhosting.OpenHostingEast1ContextBuilder
go2cloud-jhb1.propertiesbuilder=org.jclouds.go2cloud.Go2CloudJohannesburg1PropertiesBuilder
go2cloud-jhb1.contextbuilder=org.jclouds.go2cloud.Go2CloudJohannesburg1ContextBuilder
cloudsigma-zrh.propertiesbuilder=org.jclouds.cloudsigma.CloudSigmaZurichPropertiesBuilder
cloudsigma-zrh.contextbuilder=org.jclouds.cloudsigma.CloudSigmaContextBuilder

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
====================================================================
Licensed 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.1.0-SNAPSHOT</version>
<relativePath>../../project/pom.xml</relativePath>
</parent>
<groupId>org.jclouds.provider</groupId>
<artifactId>go2cloud-jhb1</artifactId>
<name>jclouds Go2Cloud Johannesburg1 provider</name>
<description>Go2Cloud implementation targeted to Johannesburg1</description>
<packaging>bundle</packaging>
<properties>
<test.go2cloud-jhb1.endpoint>http://api.jhb1.go2cloud.co.za</test.go2cloud-jhb1.endpoint>
<test.go2cloud-jhb1.apiversion>1.0</test.go2cloud-jhb1.apiversion>
<test.go2cloud-jhb1.identity>FIXME_IDENTITY</test.go2cloud-jhb1.identity>
<test.go2cloud-jhb1.credential>FIXME_CREDENTIAL</test.go2cloud-jhb1.credential>
</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>
<systemProperties>
<property>
<name>test.go2cloud-jhb1.endpoint</name>
<value>${test.go2cloud-jhb1.endpoint}</value>
</property>
<property>
<name>test.go2cloud-jhb1.apiversion</name>
<value>${test.go2cloud-jhb1.apiversion}</value>
</property>
<property>
<name>test.go2cloud-jhb1.identity</name>
<value>${test.go2cloud-jhb1.identity}</value>
</property>
<property>
<name>test.go2cloud-jhb1.credential</name>
<value>${test.go2cloud-jhb1.credential}</value>
</property>
</systemProperties>
</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.go2cloud.*;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,44 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud;
import java.util.List;
import java.util.Properties;
import org.jclouds.elasticstack.ElasticStackContextBuilder;
import org.jclouds.go2cloud.config.Go2CloudJohannesburg1ComputeServiceContextModule;
import com.google.inject.Module;
/**
*
* @author Adrian Cole
*/
public class Go2CloudJohannesburg1ContextBuilder extends ElasticStackContextBuilder {
public Go2CloudJohannesburg1ContextBuilder(Properties props) {
super(props);
}
@Override
protected void addContextModule(List<Module> modules) {
modules.add(new Go2CloudJohannesburg1ComputeServiceContextModule());
}
}

View File

@ -0,0 +1,48 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_ENDPOINT;
import static org.jclouds.Constants.PROPERTY_ISO3166_CODES;
import java.util.Properties;
import org.jclouds.elasticstack.ElasticStackPropertiesBuilder;
/**
*
* @author Adrian Cole
*/
public class Go2CloudJohannesburg1PropertiesBuilder extends ElasticStackPropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_ISO3166_CODES, "ZA-GP");
properties.setProperty(PROPERTY_ENDPOINT, "http://api.jhb1.go2cloud.co.za");
properties.setProperty(PROPERTY_API_VERSION, "1.0");
return properties;
}
public Go2CloudJohannesburg1PropertiesBuilder(Properties properties) {
super(properties);
}
}

View File

@ -0,0 +1,108 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud;
import com.google.common.collect.ImmutableSet;
import java.net.URI;
import java.util.Set;
import org.jclouds.providers.BaseProviderMetadata;
/**
* Implementation of {@link org.jclouds.types.ProviderMetadata} for Go2Cloud's
* Johannesburg1 provider.
*
* @author Adrian Cole
*/
public class Go2CloudJohannesburg1ProviderMetadata extends BaseProviderMetadata {
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return "go2cloud-jhb1";
}
/**
* {@inheritDoc}
*/
@Override
public String getType() {
return COMPUTE_TYPE;
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return "Go2Cloud Johannesburg1";
}
/**
* {@inheritDoc}
*/
@Override
public String getIdentityName() {
return "User UUID";
}
/**
* {@inheritDoc}
*/
@Override
public String getCredentialName() {
return "Secret API Key";
}
/**
* {@inheritDoc}
*/
@Override
public URI getHomepage() {
return URI.create("http://jhb1.go2cloud.co.za/");
}
/**
* {@inheritDoc}
*/
@Override
public URI getConsole() {
return URI.create("http://jhb1.go2cloud.co.za/accounts");
}
/**
* {@inheritDoc}
*/
@Override
public URI getApiDocumentation() {
return URI.create("http://www.go2cloud.co.za/Home/QuickStart");
}
/**
* {@inheritDoc}
*/
@Override
public Set<String> getIso3166Codes() {
return ImmutableSet.of("ZA-GP");
}
}

View File

@ -0,0 +1,29 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud.config;
import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule;
/**
*
* @author Adrian Cole
*/
public class Go2CloudJohannesburg1ComputeServiceContextModule extends ElasticStackComputeServiceContextModule {
}

View File

@ -0,0 +1 @@
org.jclouds.go2cloud.Go2CloudJohannesburg1ProviderMetadata

View File

@ -0,0 +1,16 @@
[
{
"uuid": "5192adbd-046f-4a48-90f9-3db390b1efab",
"description": "Ubuntu 11.04 Server 64 Bit",
"osFamily": "UBUNTU",
"osVersion": "11.04",
"size": "1"
},
{
"uuid": "757f1074-82bd-453c-8cc1-70c4e697e5fe",
"description": "Windows 2008 R2 with SP1 (x64)",
"osFamily": "WINDOWS",
"osVersion": "2008 R2",
"size": "13"
}
]

View File

@ -0,0 +1,34 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud;
import org.jclouds.elasticstack.ElasticStackClientLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true)
public class Go2CloudJohannesburg1ClientLiveTest extends ElasticStackClientLiveTest {
public Go2CloudJohannesburg1ClientLiveTest() {
provider = "go2cloud-jhb1";
bootDrive = "5192adbd-046f-4a48-90f9-3db390b1efab";
}
}

View File

@ -0,0 +1,37 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud;
import org.jclouds.providers.BaseProviderMetadataTest;
import org.jclouds.providers.ProviderMetadata;
import org.testng.annotations.Test;
/**
* The Go2CloudJohannesburg1ProviderTest tests the {@link Go2CloudJohannesburg1ProviderMetadata} class.
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "Go2CloudJohannesburg1ProviderTest")
public class Go2CloudJohannesburg1ProviderTest extends BaseProviderMetadataTest {
public Go2CloudJohannesburg1ProviderTest() {
super(new Go2CloudJohannesburg1ProviderMetadata(), ProviderMetadata.COMPUTE_TYPE);
}
}

View File

@ -0,0 +1,36 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud.compute;
import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true, testName = "Go2CloudJohannesburg1ComputeServiceLiveTest")
public class Go2CloudJohannesburg1ComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
public Go2CloudJohannesburg1ComputeServiceLiveTest() {
provider = "go2cloud-jhb1";
group = "go2cloud";
}
}

View File

@ -0,0 +1,81 @@
/**
*
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.go2cloud.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.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 Go2CloudJohannesburg1TemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
public Go2CloudJohannesburg1TemplateBuilderLiveTest() {
provider = "go2cloud-jhb1";
}
@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("") || input.version.equals("11.04")) && input.is64Bit;
case WINDOWS:
return (input.version.equals("") || input.version.equals("2008 R2")) && input.is64Bit;
default:
return false;
}
}
});
}
@Test
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = this.context.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "go2cloud-jhb1");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
}
@Override
protected Set<String> getIso3166Codes() {
return ImmutableSet.<String> of("ZA-GP");
}
}

View File

@ -60,6 +60,7 @@
<module>elastichosts-lon-b</module>
<module>rimuhosting</module>
<module>openhosting-east1</module>
<module>go2cloud-jhb1</module>
<module>serverlove-z1-man</module>
<module>skalicloud-sdg-my</module>
<module>savvis-symphonyvpdc</module>