diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxContextBuilder.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxContextBuilder.java index b9e0a15e96..d5668ec389 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxContextBuilder.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxContextBuilder.java @@ -27,8 +27,6 @@ import org.jclouds.byon.Node; import org.jclouds.byon.config.CacheNodeStoreModule; import org.jclouds.compute.StandaloneComputeServiceContextBuilder; import org.jclouds.compute.domain.OsFamily; -import org.jclouds.concurrent.MoreExecutors; -import org.jclouds.concurrent.config.ExecutorServiceModule; import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule; import com.google.common.base.Predicate; diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java index 771ce60b61..1f15abbb0b 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapter.java @@ -150,7 +150,7 @@ public class VirtualBoxComputeServiceAdapter implements ComputeServiceAdapter { diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java index 3b1bc25fcf..abca1e02b0 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExists.java @@ -24,6 +24,7 @@ import java.util.List; import javax.annotation.Resource; import javax.inject.Named; +import javax.inject.Singleton; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; @@ -47,7 +48,7 @@ import com.google.inject.Inject; /** * CloneAndRegisterMachineFromIMachineIfNotAlreadyExists will take care of the followings: - cloning - * the master - register the clone machine - + * the master - register the clone machine. * * @author Andrea Turli */ diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java index a4ec912af4..900118dc89 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java @@ -56,13 +56,13 @@ public class NodeCreator implements Function apply(NodeSpec nodeSpec) { + public synchronized NodeAndInitialCredentials apply(NodeSpec nodeSpec) { checkNotNull(nodeSpec, "NodeSpec"); @@ -102,6 +107,7 @@ public class NodeCreator implements Function runScriptOnNodeFactory.create(host.get(), Statements.exec(vboxwebsrv), runAsRoot(false).wrapInInitScript(false).blockOnComplete(false).nameTask("vboxwebsrv")).init().call(); + + try { + // wait for a couple of seconds to make sure vbox has correctly started + Thread.sleep(2000L); + } catch (InterruptedException e) { + } } manager = managerForNode.apply(host); manager.connect(provider.toASCIIString(), identity, credential); diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java index a4d330d48b..b4fe0f1577 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java @@ -26,35 +26,47 @@ import java.util.Set; import javax.annotation.Resource; import javax.inject.Named; +import org.jclouds.compute.ComputeServiceContext; +import org.jclouds.compute.ComputeServiceContextFactory; import org.jclouds.compute.RunNodesException; import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.logging.Logger; +import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; import org.jclouds.ssh.SshClient; -import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest; +import org.jclouds.sshj.config.SshjSshClientModule; +import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableSet; +import com.google.inject.Module; /** * * @author Adrian Cole */ @Test(groups = "live", singleThreaded = true, testName = "VirtualBoxExperimentLiveTest") -public class VirtualBoxExperimentLiveTest extends BaseVirtualBoxClientLiveTest { - +public class VirtualBoxExperimentLiveTest { @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; + ComputeServiceContext context; + + @BeforeClass + public void setUp() { + context = new ComputeServiceContextFactory().createContext("virtualbox", "toor", "password", + ImmutableSet. of(new SLF4JLoggingModule(), new SshjSshClientModule())); + } + @Test public void testLaunchCluster() throws RunNodesException { int numNodes = 4; final String clusterName = "test-launch-cluster"; - Set nodes = context.getComputeService().createNodesInGroup(clusterName, - numNodes); + Set nodes = context.getComputeService().createNodesInGroup(clusterName, numNodes); assertEquals(numNodes, nodes.size(), "wrong number of nodes"); for (NodeMetadata node : nodes) { logger.debug("Created Node: %s", node);