mirror of https://github.com/apache/jclouds.git
Merge branch 'master' of https://github.com/jclouds/jclouds
This commit is contained in:
commit
ea148929ff
|
@ -16,7 +16,7 @@ check out our examples site! https://github.com/jclouds/jclouds-examples
|
|||
our compute api supports: aws-ec2, gogrid, cloudservers-us, stub (in-memory), deltacloud,
|
||||
cloudservers-uk, vcloud (generic), ec2 (generic), byon, nova,
|
||||
trmk-ecloud, trmk-vcloudexpress, eucalyptus (generic),
|
||||
cloudsigma-zrh, elasticstack(generic),
|
||||
cloudsigma-zrh, elasticstack(generic), go2cloud-jhb1,
|
||||
bluelock-vcloud-zone01, stratogen-vcloud-mycloud, rimuhosting,
|
||||
slicehost, eucalyptus-partnercloud-ec2, elastichosts-lon-p (Peer 1),
|
||||
elastichosts-sat-p (Peer 1), elastichosts-lon-b (BlueSquare),
|
||||
|
|
|
@ -165,5 +165,10 @@
|
|||
<artifactId>cloudsigma-zrh</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.provider</groupId>
|
||||
<artifactId>go2cloud-jhb1</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", sequential = true, testName = "EucalyptusComputeServiceLiveTest")
|
||||
@Test(groups = "live", singleThreaded = true, testName = "EucalyptusComputeServiceLiveTest")
|
||||
public class EucalyptusComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
|
||||
|
||||
public EucalyptusComputeServiceLiveTest() {
|
||||
|
@ -46,6 +46,12 @@ public class EucalyptusComputeServiceLiveTest extends EC2ComputeServiceLiveTest
|
|||
}
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
package org.jclouds.go2cloud.config;
|
||||
|
||||
import static org.jclouds.compute.domain.OsFamily.DEBIAN;
|
||||
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
|
||||
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.elasticstack.compute.config.ElasticStackComputeServiceContextModule;
|
||||
|
@ -33,6 +33,6 @@ public class Go2CloudJohannesburg1ComputeServiceContextModule extends ElasticSta
|
|||
|
||||
@Override
|
||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||
return template.osFamily(DEBIAN).osVersionMatches("6.0").os64Bit(true);
|
||||
return template.osFamily(UBUNTU).osVersionMatches("10.10").os64Bit(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
[
|
||||
{
|
||||
"uuid": "14c88d27-1f5e-4ad5-9f3a-28e5d2282f61",
|
||||
"description": "Ubuntu 10.10",
|
||||
"osFamily": "UBUNTU",
|
||||
"osVersion": "10.10",
|
||||
"size": "1"
|
||||
},
|
||||
{
|
||||
"uuid": "cc54132d-4912-4106-a91a-7a27e6866c8b",
|
||||
"description": "Debian 6.0.2.1",
|
||||
"osFamily": "DEBIAN",
|
||||
"osVersion": "6.0",
|
||||
"size": "1"
|
||||
},
|
||||
{
|
||||
"uuid": "77ad0ffe-9537-4c64-a8e3-10db185261c0",
|
||||
"description": "Windows 2008 R2 (x64) with SP1",
|
||||
"osFamily": "WINDOWS",
|
||||
"osVersion": "2008 R2",
|
||||
"size": "13"
|
||||
},
|
||||
{
|
||||
"uuid": "d971ddfb-7a69-48f7-8d14-a76ef61b01d8",
|
||||
"description": "Windows 8 Developer Preview (x64)",
|
||||
"osFamily": "WINDOWS",
|
||||
"osVersion": "8",
|
||||
"size": "13"
|
||||
}
|
||||
]
|
|
@ -25,10 +25,10 @@ import org.testng.annotations.Test;
|
|||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", sequential = true)
|
||||
@Test(groups = "live", singleThreaded = true)
|
||||
public class Go2CloudJohannesburg1ClientLiveTest extends ElasticStackClientLiveTest {
|
||||
public Go2CloudJohannesburg1ClientLiveTest() {
|
||||
provider = "go2cloud-jhb1";
|
||||
bootDrive = "5192adbd-046f-4a48-90f9-3db390b1efab";
|
||||
bootDrive = "14c88d27-1f5e-4ad5-9f3a-28e5d2282f61";
|
||||
}
|
||||
}
|
|
@ -52,6 +52,8 @@ public class Go2CloudJohannesburg1TemplateBuilderLiveTest extends BaseTemplateBu
|
|||
@Override
|
||||
public boolean apply(OsFamilyVersion64Bit input) {
|
||||
switch (input.family) {
|
||||
case UBUNTU:
|
||||
return (input.version.equals("") || input.version.equals("10.10")) && input.is64Bit;
|
||||
case DEBIAN:
|
||||
return (input.version.equals("") || input.version.equals("6.0")) && input.is64Bit;
|
||||
case WINDOWS:
|
||||
|
@ -68,8 +70,8 @@ public class Go2CloudJohannesburg1TemplateBuilderLiveTest extends BaseTemplateBu
|
|||
public void testDefaultTemplateBuilder() throws IOException {
|
||||
Template defaultTemplate = this.context.getComputeService().templateBuilder().build();
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "6.0");
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.DEBIAN);
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.10");
|
||||
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(defaultTemplate.getLocation().getId(), "go2cloud-jhb1");
|
||||
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
|
||||
}
|
|
@ -62,5 +62,6 @@
|
|||
<module>savvis-symphonyvpdc</module>
|
||||
<module>greenhousedata-element-vcloud</module>
|
||||
<module>aws-cloudwatch</module>
|
||||
<module>go2cloud-jhb1</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
[
|
||||
{
|
||||
"uuid": "cc54132d-4912-4106-a91a-7a27e6866c8b",
|
||||
"description": "Debian 6.0.2.1",
|
||||
"osFamily": "DEBIAN",
|
||||
"osVersion": "6.0",
|
||||
"size": "1"
|
||||
},
|
||||
{
|
||||
"uuid": "46e305b6-6a49-409c-bd12-eb966cdb3664",
|
||||
"description": "Windows 2008 R2 with SP1 (x64)",
|
||||
"osFamily": "WINDOWS",
|
||||
"osVersion": "2008 R2",
|
||||
"size": "13"
|
||||
}
|
||||
]
|
|
@ -70,14 +70,12 @@ public class SoftLayerComputeServiceAdapter implements
|
|||
@Override
|
||||
public VirtualGuest createNodeWithGroupEncodedIntoNameThenStoreCredentials(String tag, String name,
|
||||
Template template, Map<String, Credentials> credentialStore) {
|
||||
VirtualGuest from = null; // TODO create the backend object using parameters from the
|
||||
// template. ex.
|
||||
// VirtualGuest from =
|
||||
// client.getVirtualGuestClient().createServerInDC(template.getLocation().getId(), name,
|
||||
// Long.parseLong(template.getImage().getProviderId()),
|
||||
// Long.parseLong(template.getHardware().getProviderId()));
|
||||
// store the credentials so that later functions can use them
|
||||
// credentialStore.put("node#"+ from.getId() + "", new Credentials(from.loginUser,
|
||||
VirtualGuest from = null; // from testCancelAndPlaceOrder()
|
||||
// use name for hostname as possible
|
||||
// you can ignore group, unless it is valid to set as domain
|
||||
// get the cpu, mem, datacenter from the template ids
|
||||
// make sure you store the credentials so that later functions can use them
|
||||
// credentialStore.put("node#"+ from.getId() + "", new Credentials(from.loginUser (might be root),
|
||||
// from.password));
|
||||
return from;
|
||||
}
|
||||
|
|
|
@ -20,30 +20,41 @@ package org.jclouds.softlayer.compute;
|
|||
|
||||
import static org.jclouds.softlayer.predicates.ProductItemPredicates.categoryCode;
|
||||
import static org.jclouds.softlayer.predicates.ProductItemPredicates.units;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertFalse;
|
||||
import static org.testng.AssertJUnit.assertEquals;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdapter;
|
||||
import org.jclouds.softlayer.domain.ProductItem;
|
||||
import org.jclouds.softlayer.domain.VirtualGuest;
|
||||
import org.jclouds.softlayer.features.BaseSoftLayerClientLiveTest;
|
||||
import org.jclouds.softlayer.features.ProductPackageClientLiveTest;
|
||||
import org.testng.Assert;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.net.InetAddresses;
|
||||
|
||||
@Test(groups = "live", testName = "SoftLayerComputeServiceAdapterLiveTest")
|
||||
@Test(groups = "live", singleThreaded = true, testName = "SoftLayerComputeServiceAdapterLiveTest")
|
||||
public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientLiveTest {
|
||||
|
||||
private SoftLayerComputeServiceAdapter adapter;
|
||||
private VirtualGuest guest;
|
||||
|
||||
@BeforeGroups(groups = { "live" })
|
||||
public void setupClient() {
|
||||
super.setupClient();
|
||||
adapter = new SoftLayerComputeServiceAdapter(context.getApi(), ProductPackageClientLiveTest.CLOUD_SERVER_PACKAGE_NAME);
|
||||
adapter = new SoftLayerComputeServiceAdapter(context.getApi(),
|
||||
ProductPackageClientLiveTest.CLOUD_SERVER_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -51,6 +62,38 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientL
|
|||
assertFalse(Iterables.isEmpty(adapter.listLocations()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateNodeWithGroupEncodedIntoNameThenStoreCredentials() {
|
||||
String group = "foo";
|
||||
String name = "foo-ef4";
|
||||
Template template = computeContext.getComputeService().templateBuilder().build();
|
||||
Map<String, Credentials> credentialStore = Maps.newLinkedHashMap();
|
||||
guest = adapter.createNodeWithGroupEncodedIntoNameThenStoreCredentials(group, name, template, credentialStore);
|
||||
assertEquals(guest.getHostname(), name);
|
||||
assertEquals(guest.getDomain(), group);
|
||||
// check other things, like cpu correct, mem correct, image/os is correct
|
||||
// (as possible)
|
||||
assert credentialStore.containsKey("node#" + guest.getId()) : "credentials to log into guest not found " + guest;
|
||||
assert InetAddresses.isInetAddress(guest.getPrimaryBackendIpAddress()) : guest;
|
||||
doConnectViaSsh(guest, credentialStore.get("node#" + guest.getId()));
|
||||
}
|
||||
|
||||
protected void doConnectViaSsh(VirtualGuest guest, Credentials creds) {
|
||||
SshClient ssh = computeContext.utils().sshFactory()
|
||||
.create(new IPSocket(guest.getPrimaryBackendIpAddress(), 22), creds);
|
||||
try {
|
||||
ssh.connect();
|
||||
ExecResponse hello = ssh.exec("echo hello");
|
||||
assertEquals(hello.getOutput().trim(), "hello");
|
||||
System.err.println(ssh.exec("df -k").getOutput());
|
||||
System.err.println(ssh.exec("mount").getOutput());
|
||||
System.err.println(ssh.exec("uname -a").getOutput());
|
||||
} finally {
|
||||
if (ssh != null)
|
||||
ssh.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListHardwareProfiles() {
|
||||
Iterable<Set<ProductItem>> profiles = adapter.listHardwareProfiles();
|
||||
|
@ -61,8 +104,14 @@ public class SoftLayerComputeServiceAdapterLiveTest extends BaseSoftLayerClientL
|
|||
assertEquals(profile.size(), 3);
|
||||
ProductItem cpuItem = Iterables.getOnlyElement(Iterables.filter(profile, units("PRIVATE_CORE")));
|
||||
ProductItem ramItem = Iterables.getOnlyElement(Iterables.filter(profile, categoryCode("ram")));
|
||||
Assert.assertEquals(cpuItem.getCapacity(),ramItem.getCapacity());
|
||||
assertEquals(cpuItem.getCapacity(), ramItem.getCapacity());
|
||||
}
|
||||
}
|
||||
|
||||
@AfterGroups(groups = "live")
|
||||
protected void tearDown() {
|
||||
if (guest != null)
|
||||
adapter.destroyNode(guest.getId() + "");
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,13 @@ package org.jclouds.softlayer.features;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.rest.RestContext;
|
||||
import org.jclouds.softlayer.SoftLayerAsyncClient;
|
||||
import org.jclouds.softlayer.SoftLayerClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.testng.annotations.AfterGroups;
|
||||
import org.testng.annotations.BeforeGroups;
|
||||
import org.testng.annotations.Test;
|
||||
|
@ -41,15 +43,16 @@ import com.google.inject.Module;
|
|||
public class BaseSoftLayerClientLiveTest {
|
||||
|
||||
protected RestContext<SoftLayerClient, SoftLayerAsyncClient> context;
|
||||
protected ComputeServiceContext computeContext;
|
||||
|
||||
@BeforeGroups(groups = { "live" })
|
||||
public void setupClient() {
|
||||
String identity = checkNotNull(System.getProperty("test.softlayer.identity"), "test.softlayer.identity");
|
||||
String credential = checkNotNull(System.getProperty("test.softlayer.credential"), "test.softlayer.credential");
|
||||
|
||||
|
||||
context = new ComputeServiceContextFactory().createContext("softlayer", identity, credential,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule())).getProviderSpecificContext();
|
||||
computeContext = new ComputeServiceContextFactory().createContext("softlayer", identity, credential,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()));
|
||||
context = computeContext.getProviderSpecificContext();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue