diff --git a/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/CommonElasticStackClient.java b/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/CommonElasticStackClient.java
index 6cf1a2916e..5839248f6b 100644
--- a/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/CommonElasticStackClient.java
+++ b/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/CommonElasticStackClient.java
@@ -119,6 +119,8 @@ public interface CommonElasticStackClient {
*
* Sends the server an ACPI power-down event. Server reverts to a stopped status if it is
* persistent and is automatically destroyed otherwise.
+ * note
behaviour on shutdown depends on how your server OS is set up to respond to an
+ * ACPI power button signal.
*
* @param uuid
* what to shutdown
diff --git a/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/domain/Server.java b/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/domain/Server.java
index 7ea0a65b53..018909bee1 100644
--- a/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/domain/Server.java
+++ b/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/domain/Server.java
@@ -130,6 +130,13 @@ public class Server extends Item {
return new Server(uuid, name, cpu, smp, mem, persistent, devices, bootDeviceIds, tags, userMetadata, nics,
vnc, description);
}
+
+ public static Builder fromServer(Server in) {
+ return new Builder().uuid(in.getUuid()).name(in.getName()).cpu(in.getCpu()).mem(in.getMem())
+ .persistent(in.isPersistent()).description(in.getDescription()).devices(in.getDevices())
+ .bootDeviceIds(in.getBootDeviceIds()).tags(in.getTags()).userMetadata(in.getUserMetadata())
+ .nics(in.getNics()).vnc(in.getVnc());
+ }
}
protected final int cpu;
diff --git a/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/util/Servers.java b/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/util/Servers.java
new file mode 100644
index 0000000000..1d8564f0cc
--- /dev/null
+++ b/sandbox/elasticstack/src/main/java/org/jclouds/elasticstack/util/Servers.java
@@ -0,0 +1,54 @@
+/**
+ *
+ * Copyright (C) 2010 Cloud Conscious, LLC.
+ *
+ * ====================================================================
+ * 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.elasticstack.util;
+
+import org.jclouds.elasticstack.domain.IDEDevice;
+import org.jclouds.elasticstack.domain.Model;
+import org.jclouds.elasticstack.domain.NIC;
+import org.jclouds.elasticstack.domain.Server;
+import org.jclouds.elasticstack.domain.VNC;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ *
+ * @author Adrian Cole
+ */
+public class Servers {
+ /**
+ * Helper to create a small persistent server
+ *
+ * @param name
+ * what to name the server
+ * @param driveUuuid
+ * id of the boot drive
+ * @param vncPassword
+ * password for vnc
+ * @return a builder for a persistent 1Ghz 512m server with DHCP enabled network.
+ */
+ public static Server.Builder small(String name, String driveUuuid, String vncPassword) {
+ return new Server.Builder().name(name).cpu(1000).mem(512).persistent(true)
+ .devices(ImmutableMap.of("ide:0:0", new IDEDevice.Builder(0, 0).uuid(driveUuuid).build()))
+ .bootDeviceIds(ImmutableSet.of("ide:0:0"))
+ .nics(ImmutableSet.of(new NIC.Builder().model(Model.E1000).dhcp("auto").build()))
+ .vnc(new VNC(null, vncPassword, false));
+ }
+}
\ No newline at end of file
diff --git a/sandbox/elasticstack/src/test/java/org/jclouds/elasticstack/CommonElasticStackClientLiveTest.java b/sandbox/elasticstack/src/test/java/org/jclouds/elasticstack/CommonElasticStackClientLiveTest.java
index 48be0d32ca..7a08fd4f3f 100644
--- a/sandbox/elasticstack/src/test/java/org/jclouds/elasticstack/CommonElasticStackClientLiveTest.java
+++ b/sandbox/elasticstack/src/test/java/org/jclouds/elasticstack/CommonElasticStackClientLiveTest.java
@@ -26,6 +26,7 @@ import static org.testng.Assert.assertNotNull;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
import org.jclouds.Constants;
import org.jclouds.elasticstack.domain.ClaimType;
@@ -39,17 +40,19 @@ import org.jclouds.elasticstack.domain.NIC;
import org.jclouds.elasticstack.domain.Server;
import org.jclouds.elasticstack.domain.ServerInfo;
import org.jclouds.elasticstack.domain.ServerStatus;
-import org.jclouds.elasticstack.domain.VNC;
import org.jclouds.elasticstack.predicates.DriveClaimed;
+import org.jclouds.elasticstack.util.Servers;
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
+import org.jclouds.net.IPSocket;
+import org.jclouds.predicates.InetSocketAddressConnect;
import org.jclouds.predicates.RetryablePredicate;
import org.jclouds.rest.RestContext;
import org.jclouds.rest.RestContextFactory;
import org.testng.annotations.AfterGroups;
-import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
+import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -68,6 +71,7 @@ public abstract class CommonElasticStackClientLiveTest context;
+ protected Predicate socketTester;
protected String provider = "elasticstack";
protected String identity;
@@ -105,14 +109,9 @@ public abstract class CommonElasticStackClientLiveTest(Predicates.not(new DriveClaimed(client)), 30, 1,
+ driveNotClaimed = new RetryablePredicate(Predicates.not(new DriveClaimed(client)), 120, 1,
TimeUnit.SECONDS);
- }
-
- @AfterGroups(groups = "live")
- void tearDown() {
- if (context != null)
- context.close();
+ socketTester = new RetryablePredicate(new InetSocketAddressConnect(), 120, 1, TimeUnit.SECONDS);
}
@Test
@@ -211,13 +210,12 @@ public abstract class CommonElasticStackClientLiveTest