http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindPublicIpsToIndexedFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindPublicIpsToIndexedFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindPublicIpsToIndexedFormParamsTest.java
new file mode 100644
index 0000000..9fa6751
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindPublicIpsToIndexedFormParamsTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code BindPublicIpsToIndexedFormParams}
+ */
+@Test(groups = "unit")
+public class BindPublicIpsToIndexedFormParamsTest {
+   Injector injector = Guice.createInjector();
+   BindPublicIpsToIndexedFormParams binder = 
injector.getInstance(BindPublicIpsToIndexedFormParams.class);
+
+   public void test() {
+
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, new String[] { "alpha", "omega" 
});
+      assertEquals(request.getPayload().getRawContent(), 
"PublicIp.1=alpha&PublicIp.2=omega");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeArray() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindResourceIdsToIndexedFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindResourceIdsToIndexedFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindResourceIdsToIndexedFormParamsTest.java
new file mode 100644
index 0000000..ec83682
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindResourceIdsToIndexedFormParamsTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code BindResourceIdsToIndexedFormParams}
+ */
+@Test(groups = "unit")
+public class BindResourceIdsToIndexedFormParamsTest {
+   Injector injector = Guice.createInjector();
+   BindResourceIdsToIndexedFormParams binder = 
injector.getInstance(BindResourceIdsToIndexedFormParams.class);
+
+   public void test() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, 
ImmutableList.builder().add("alpha").add("omega").build());
+      assertEquals(request.getPayload().getRawContent(), 
"ResourceId.1=alpha&ResourceId.2=omega");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeArray() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java
new file mode 100644
index 0000000..ab896ce
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindS3UploadPolicyAndSignatureTest.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.jclouds.ec2.features.BaseEC2ApiTest;
+import org.jclouds.ec2.features.InstanceApi;
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Tests behavior of {@code BindS3UploadPolicyAndSignature}
+ */
+// NOTE:without testName, this will not call @Before* and fail w/NPE during 
surefire
+@Test(groups = "unit", testName = "BindS3UploadPolicyAndSignatureTest")
+public class BindS3UploadPolicyAndSignatureTest extends 
BaseEC2ApiTest<InstanceApi> {
+   private BindS3UploadPolicyAndSignature binder;
+
+   @BeforeClass
+   @Override
+   protected void setupFactory() throws IOException {
+      super.setupFactory();
+      binder = injector.getInstance(BindS3UploadPolicyAndSignature.class);
+   }
+
+   public void testMapping() {
+      String json = "{\"foo\":true}";
+
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, json);
+      assertEquals(
+            request.getPayload().getRawContent(),
+            
"Storage.S3.UploadPolicy=eyJmb28iOnRydWV9&Storage.S3.UploadPolicySignature=UbDQLDM5P3aZ840aqJoH%2B6rwDcRo5KrIfsG7vJWHIVY%3D");
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagKeysToIndexedFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagKeysToIndexedFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagKeysToIndexedFormParamsTest.java
new file mode 100644
index 0000000..93dce11
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagKeysToIndexedFormParamsTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code BindTagKeysToIndexedFormParams}
+ */
+@Test(groups = "unit")
+public class BindTagKeysToIndexedFormParamsTest {
+   BindTagKeysToIndexedFormParams binder = new 
BindTagKeysToIndexedFormParams();
+
+   public void test() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, ImmutableSet.of("one", "two"));
+      assertEquals(request.getPayload().getRawContent(), 
"Tag.1.Key=one&Tag.2.Key=two");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeIterable() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagsToIndexedFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagsToIndexedFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagsToIndexedFormParamsTest.java
new file mode 100644
index 0000000..6616f58
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindTagsToIndexedFormParamsTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code BindTagsToIndexedFormParams}
+ */
+@Test(groups = "unit")
+public class BindTagsToIndexedFormParamsTest {
+   BindTagsToIndexedFormParams binder = new BindTagsToIndexedFormParams();
+
+   public void test() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, ImmutableMap.of("one", "alpha", 
"two", "beta"));
+      assertEquals(request.getPayload().getRawContent(),
+            "Tag.1.Key=one&Tag.1.Value=alpha&Tag.2.Key=two&Tag.2.Value=beta");
+   }
+
+   public void testEmpty() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, ImmutableSet.of("empty"));
+      assertEquals(request.getPayload().getRawContent(), 
"Tag.1.Key=empty&Tag.1.Value=");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeArray() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserGroupsToIndexedFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserGroupsToIndexedFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserGroupsToIndexedFormParamsTest.java
new file mode 100644
index 0000000..1118b93
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserGroupsToIndexedFormParamsTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code BindUserGroupsToIndexedFormParams}
+ */
+@Test(groups = "unit")
+public class BindUserGroupsToIndexedFormParamsTest {
+   Injector injector = Guice.createInjector();
+   BindUserGroupsToIndexedFormParams binder = 
injector.getInstance(BindUserGroupsToIndexedFormParams.class);
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testOnlyAllIsValid() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, ImmutableSet.of("alpha"));
+   }
+
+   public void test() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, ImmutableSet.of("all"));
+      assertEquals(request.getPayload().getRawContent(), "UserGroup.1=all");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeIterable() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdGroupPairToSourceSecurityGroupFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdGroupPairToSourceSecurityGroupFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdGroupPairToSourceSecurityGroupFormParamsTest.java
new file mode 100644
index 0000000..d15b4c4
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdGroupPairToSourceSecurityGroupFormParamsTest.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.ec2.domain.UserIdGroupPair;
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code BindUserIdGroupPairToSourceSecurityGroupFormParams}
+ */
+@Test(groups = "unit")
+public class BindUserIdGroupPairToSourceSecurityGroupFormParamsTest {
+   Injector injector = Guice.createInjector();
+   BindUserIdGroupPairToSourceSecurityGroupFormParams binder = injector
+         
.getInstance(BindUserIdGroupPairToSourceSecurityGroupFormParams.class);
+
+   public void testUserIdGroupPair() {
+      UserIdGroupPair pair = new UserIdGroupPair("id", "group");
+
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, pair);
+      assertEquals(request.getPayload().getRawContent(), 
"SourceSecurityGroupOwnerId=id&SourceSecurityGroupName=group");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeUserIdGroupPair() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdsToIndexedFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdsToIndexedFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdsToIndexedFormParamsTest.java
new file mode 100644
index 0000000..4d9aa41
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindUserIdsToIndexedFormParamsTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code BindUserIdsToIndexedFormParams}
+ */
+@Test(groups = "unit")
+public class BindUserIdsToIndexedFormParamsTest {
+   Injector injector = Guice.createInjector();
+   BindUserIdsToIndexedFormParams binder = 
injector.getInstance(BindUserIdsToIndexedFormParams.class);
+
+   public void test() {
+
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, ImmutableSet.of("alpha", 
"omega"));
+      assertEquals(request.getPayload().getRawContent(), 
"UserId.1=alpha&UserId.2=omega");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeIterable() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindVolumeIdsToIndexedFormParamsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindVolumeIdsToIndexedFormParamsTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindVolumeIdsToIndexedFormParamsTest.java
new file mode 100644
index 0000000..6235608
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/BindVolumeIdsToIndexedFormParamsTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code BindVolumeIdsToIndexedFormParams}
+ */
+@Test(groups = "unit")
+public class BindVolumeIdsToIndexedFormParamsTest {
+   Injector injector = Guice.createInjector();
+   BindVolumeIdsToIndexedFormParams binder = 
injector.getInstance(BindVolumeIdsToIndexedFormParams.class);
+
+   public void test() {
+
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, new String[] { "alpha", "omega" 
});
+      assertEquals(request.getPayload().getRawContent(), 
"VolumeId.1=alpha&VolumeId.2=omega");
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeArray() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+   @Test(expectedExceptions = NullPointerException.class)
+   public void testNullIsBad() {
+      HttpRequest request = 
HttpRequest.builder().method("GET").endpoint("http://momma";).build();
+      binder.bindToRequest(request, null);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/IfNotNullBindAvailabilityZoneToFormParamTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/IfNotNullBindAvailabilityZoneToFormParamTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/IfNotNullBindAvailabilityZoneToFormParamTest.java
new file mode 100644
index 0000000..9833f46
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/binders/IfNotNullBindAvailabilityZoneToFormParamTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.binders;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertSame;
+
+import java.io.File;
+
+import org.jclouds.http.HttpRequest;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+/**
+ * Tests behavior of {@code IfNotNullBindAvailabilityZoneToFormParam}
+ */
+@Test(groups = "unit")
+public class IfNotNullBindAvailabilityZoneToFormParamTest {
+   Injector injector = Guice.createInjector();
+   IfNotNullBindAvailabilityZoneToFormParam binder = injector
+         .getInstance(IfNotNullBindAvailabilityZoneToFormParam.class);
+
+   public void test() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      request = binder.bindToRequest(request, "us-east-1a");
+      assertEquals(request.getPayload().getRawContent(), 
"Placement.AvailabilityZone=us-east-1a");
+   }
+
+   public void testWhenNullReturnsSame() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      HttpRequest request2 = binder.bindToRequest(request, null);
+      assertSame(request, request2);
+   }
+
+   @Test(expectedExceptions = IllegalArgumentException.class)
+   public void testMustBeString() {
+      HttpRequest request = 
HttpRequest.builder().method("POST").endpoint("http://localhost";).build();
+      binder.bindToRequest(request, new File("foo"));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceExpectTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceExpectTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceExpectTest.java
new file mode 100644
index 0000000..4ffad1f
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceExpectTest.java
@@ -0,0 +1,319 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.compute;
+
+import static 
org.jclouds.ec2.compute.options.EC2TemplateOptions.Builder.blockUntilRunning;
+import static 
org.jclouds.ec2.compute.options.EC2TemplateOptions.Builder.maxCount;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import javax.ws.rs.core.MediaType;
+import java.util.Set;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.ec2.compute.internal.BaseEC2ComputeServiceExpectTest;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Tests the compute service abstraction of the EC2 api.
+ */
+@Test(groups = "unit", testName = "EC2ComputeServiceExpectTest")
+public class EC2ComputeServiceExpectTest extends 
BaseEC2ComputeServiceExpectTest {
+   protected HttpRequest createFirstTagRequest;
+   protected HttpRequest createSecondTagRequest;
+   protected HttpRequest createThirdTagRequest;
+
+   @BeforeClass
+   @Override
+   protected void setupDefaultRequests() {
+      super.setupDefaultRequests();
+      createFirstTagRequest =
+              formSigner.filter(HttpRequest.builder()
+                      .method("POST")
+                      .endpoint("https://ec2.us-east-1.amazonaws.com/";)
+                      .addHeader("Host", "ec2.us-east-1.amazonaws.com")
+                      .payload(
+                              payloadFromStringWithContentType(
+                                      "Action=CreateTags" +
+                                              "&ResourceId.1=i-2ba64342" +
+                                              
"&Signature=Trp5e5%2BMqeBeBZbLYa9s9gxahQ9nkx6ETfsGl82IV8Y%3D" +
+                                              "&SignatureMethod=HmacSHA256" +
+                                              "&SignatureVersion=2" +
+                                              "&Tag.1.Key=Name" +
+                                              "&Tag.1.Value=test-2ba64342" +
+                                              
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" +
+                                              "&Version=2010-08-31" +
+                                              "&AWSAccessKeyId=identity",
+                                      "application/x-www-form-urlencoded"))
+                      .build());
+
+      createSecondTagRequest =
+              formSigner.filter(HttpRequest.builder()
+                      .method("POST")
+                      .endpoint("https://ec2.us-east-1.amazonaws.com/";)
+                      .addHeader("Host", "ec2.us-east-1.amazonaws.com")
+                      .payload(
+                              payloadFromStringWithContentType(
+                                      "Action=CreateTags" +
+                                              "&ResourceId.1=i-2bc64242" +
+                                              
"&Signature=Trp5e5%2BMqeBeBZbLYa9s9gxahQ9nkx6ETfsGl82IV8Y%3D" +
+                                              "&SignatureMethod=HmacSHA256" +
+                                              "&SignatureVersion=2" +
+                                              "&Tag.1.Key=Name" +
+                                              "&Tag.1.Value=test-2bc64242" +
+                                              
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" +
+                                              "&Version=2010-08-31" +
+                                              "&AWSAccessKeyId=identity",
+                                      "application/x-www-form-urlencoded"))
+                      .build());
+
+      createThirdTagRequest =
+              formSigner.filter(HttpRequest.builder()
+                      .method("POST")
+                      .endpoint("https://ec2.us-east-1.amazonaws.com/";)
+                      .addHeader("Host", "ec2.us-east-1.amazonaws.com")
+                      .payload(
+                              payloadFromStringWithContentType(
+                                      "Action=CreateTags" +
+                                              "&ResourceId.1=i-2be64332" +
+                                              
"&Signature=Trp5e5%2BMqeBeBZbLYa9s9gxahQ9nkx6ETfsGl82IV8Y%3D" +
+                                              "&SignatureMethod=HmacSHA256" +
+                                              "&SignatureVersion=2" +
+                                              "&Tag.1.Key=Name" +
+                                              "&Tag.1.Value=test-2be64332" +
+                                              
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" +
+                                              "&Version=2010-08-31" +
+                                              "&AWSAccessKeyId=identity",
+                                      "application/x-www-form-urlencoded"))
+                      .build());
+   }
+
+   public void testCreateNodeWithGeneratedKeyPairAndOverriddenLoginUser() 
throws Exception {
+      Builder<HttpRequest, HttpResponse> requestResponseMap = 
ImmutableMap.<HttpRequest, HttpResponse> builder();
+      requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
+      requestResponseMap.put(describeAvailabilityZonesRequest, 
describeAvailabilityZonesResponse);
+      requestResponseMap.put(describeImagesRequest, describeImagesResponse);
+      requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
+      requestResponseMap.put(createSecurityGroupRequest, 
createSecurityGroupResponse);
+      requestResponseMap.put(describeSecurityGroupRequest, 
describeSecurityGroupResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequest22, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(runInstancesRequest, runInstancesResponse);
+      requestResponseMap.put(describeInstanceRequest, 
describeInstanceResponse);
+      requestResponseMap.put(describeInstanceMultiIdsRequest, 
describeInstanceMultiIdsResponse);
+      requestResponseMap.put(describeImageRequest, describeImagesResponse);
+      requestResponseMap.put(createTagsRequest, createTagsResponse);
+
+      ComputeService apiThatCreatesNode = 
requestsSendResponses(requestResponseMap.build());
+
+      NodeMetadata node = 
Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
+              blockUntilRunning(false).overrideLoginUser("ec2-user")));
+      assertEquals(node.getCredentials().getUser(), "ec2-user");
+      System.out.println(node.getImageId());
+      assertTrue(node.getCredentials().getOptionalPrivateKey().isPresent());
+   }
+
+   public void testCreateThreeNodesWithMaxCountThree() throws Exception {
+
+      Builder<HttpRequest, HttpResponse> requestResponseMap = 
ImmutableMap.<HttpRequest, HttpResponse> builder();
+      requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
+      requestResponseMap.put(describeAvailabilityZonesRequest, 
describeAvailabilityZonesResponse);
+      requestResponseMap.put(describeImagesRequest, describeImagesResponse);
+      requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
+      requestResponseMap.put(createSecurityGroupRequest, 
createSecurityGroupResponse);
+      requestResponseMap.put(describeSecurityGroupRequest, 
describeSecurityGroupResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequest22, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(runThreeInstancesRequest, 
runThreeInstancesResponse);
+      requestResponseMap.put(describeInstanceRequest, 
describeInstanceResponse);
+      requestResponseMap.put(describeInstanceThreeIdsRequest, 
describeInstanceThreeIdsResponse);
+      requestResponseMap.put(describeImageRequest, describeImagesResponse);
+      requestResponseMap.put(createFirstTagRequest, createTagsResponse);
+      requestResponseMap.put(createSecondTagRequest, createTagsResponse);
+      requestResponseMap.put(createThirdTagRequest, createTagsResponse);
+
+      ComputeService apiThatCreatesNode = 
requestsSendResponses(requestResponseMap.build());
+
+      NodeMetadata node = 
Iterables.getFirst(apiThatCreatesNode.createNodesInGroup("test", 3,
+              
maxCount(3).blockUntilRunning(false).overrideLoginUser("ec2-user")), null);
+      assertNotNull(node, "Node should exist");
+      assertEquals(node.getCredentials().getUser(), "ec2-user", "User should 
be ec2-user");
+   }
+
+   public void testCreateThreeNodesWithMaxCountFourGetThreeNodes() throws 
Exception {
+
+      Builder<HttpRequest, HttpResponse> requestResponseMap = 
ImmutableMap.<HttpRequest, HttpResponse> builder();
+      requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
+      requestResponseMap.put(describeAvailabilityZonesRequest, 
describeAvailabilityZonesResponse);
+      requestResponseMap.put(describeImagesRequest, describeImagesResponse);
+      requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
+      requestResponseMap.put(createSecurityGroupRequest, 
createSecurityGroupResponse);
+      requestResponseMap.put(describeSecurityGroupRequest, 
describeSecurityGroupResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequest22, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(runThreeToFourInstancesRequest, 
runThreeInstancesResponse);
+      requestResponseMap.put(describeInstanceRequest, 
describeInstanceResponse);
+      requestResponseMap.put(describeInstanceThreeIdsRequest, 
describeInstanceThreeIdsResponse);
+      requestResponseMap.put(describeImageRequest, describeImagesResponse);
+      requestResponseMap.put(createFirstTagRequest, createTagsResponse);
+      requestResponseMap.put(createSecondTagRequest, createTagsResponse);
+      requestResponseMap.put(createThirdTagRequest, createTagsResponse);
+
+      ComputeService apiThatCreatesNode = 
requestsSendResponses(requestResponseMap.build());
+
+      NodeMetadata node = 
Iterables.getFirst(apiThatCreatesNode.createNodesInGroup("test", 3,
+              
maxCount(4).blockUntilRunning(false).overrideLoginUser("ec2-user")), null);
+      assertNotNull(node, "Node should exist");
+      assertEquals(node.getCredentials().getUser(), "ec2-user", "User should 
be ec2-user");
+   }
+
+   public void testCreateThreeNodesWithSpecifiedName() throws Exception {
+      HttpRequest createFirstNamedTagRequest =
+              formSigner.filter(HttpRequest.builder()
+                      .method("POST")
+                      .endpoint("https://ec2.us-east-1.amazonaws.com/";)
+                      .addHeader("Host", "ec2.us-east-1.amazonaws.com")
+                      .payload(
+                              payloadFromStringWithContentType(
+                                      "Action=CreateTags" +
+                                              "&ResourceId.1=i-2ba64342" +
+                                              
"&Signature=Trp5e5%2BMqeBeBZbLYa9s9gxahQ9nkx6ETfsGl82IV8Y%3D" +
+                                              "&SignatureMethod=HmacSHA256" +
+                                              "&SignatureVersion=2" +
+                                              "&Tag.1.Key=Name" +
+                                              "&Tag.1.Value=test-node" +
+                                              
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" +
+                                              "&Version=2010-08-31" +
+                                              "&AWSAccessKeyId=identity",
+                                      "application/x-www-form-urlencoded"))
+                      .build());
+
+      HttpRequest createSecondNamedTagRequest =
+              formSigner.filter(HttpRequest.builder()
+                      .method("POST")
+                      .endpoint("https://ec2.us-east-1.amazonaws.com/";)
+                      .addHeader("Host", "ec2.us-east-1.amazonaws.com")
+                      .payload(
+                              payloadFromStringWithContentType(
+                                      "Action=CreateTags" +
+                                              "&ResourceId.1=i-2bc64242" +
+                                              
"&Signature=Trp5e5%2BMqeBeBZbLYa9s9gxahQ9nkx6ETfsGl82IV8Y%3D" +
+                                              "&SignatureMethod=HmacSHA256" +
+                                              "&SignatureVersion=2" +
+                                              "&Tag.1.Key=Name" +
+                                              "&Tag.1.Value=second-node" +
+                                              
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" +
+                                              "&Version=2010-08-31" +
+                                              "&AWSAccessKeyId=identity",
+                                      "application/x-www-form-urlencoded"))
+                      .build());
+
+      HttpRequest createThirdNamedTagRequest =
+              formSigner.filter(HttpRequest.builder()
+                      .method("POST")
+                      .endpoint("https://ec2.us-east-1.amazonaws.com/";)
+                      .addHeader("Host", "ec2.us-east-1.amazonaws.com")
+                      .payload(
+                              payloadFromStringWithContentType(
+                                      "Action=CreateTags" +
+                                              "&ResourceId.1=i-2be64332" +
+                                              
"&Signature=Trp5e5%2BMqeBeBZbLYa9s9gxahQ9nkx6ETfsGl82IV8Y%3D" +
+                                              "&SignatureMethod=HmacSHA256" +
+                                              "&SignatureVersion=2" +
+                                              "&Tag.1.Key=Name" +
+                                              "&Tag.1.Value=third-node" +
+                                              
"&Timestamp=2012-04-16T15%3A54%3A08.897Z" +
+                                              "&Version=2010-08-31" +
+                                              "&AWSAccessKeyId=identity",
+                                      "application/x-www-form-urlencoded"))
+                      .build());
+
+      HttpResponse describeNamedInstanceResponse =
+              HttpResponse.builder().statusCode(200)
+                      .payload(payloadFromResourceWithContentType(
+                              "/describe_instances_running-named.xml", 
MediaType.APPLICATION_XML)).build();
+
+
+      Builder<HttpRequest, HttpResponse> requestResponseMap = 
ImmutableMap.<HttpRequest, HttpResponse> builder();
+      requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
+      requestResponseMap.put(describeAvailabilityZonesRequest, 
describeAvailabilityZonesResponse);
+      requestResponseMap.put(describeImagesRequest, describeImagesResponse);
+      requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
+      requestResponseMap.put(createSecurityGroupRequest, 
createSecurityGroupResponse);
+      requestResponseMap.put(describeSecurityGroupRequest, 
describeSecurityGroupResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequest22, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(runThreeInstancesRequest, 
runThreeInstancesResponse);
+      requestResponseMap.put(describeInstanceRequest, 
describeNamedInstanceResponse);
+      requestResponseMap.put(describeInstanceThreeIdsRequest, 
describeInstanceThreeIdsResponse);
+      requestResponseMap.put(describeImageRequest, describeImagesResponse);
+      requestResponseMap.put(createFirstNamedTagRequest, createTagsResponse);
+      requestResponseMap.put(createSecondNamedTagRequest, createTagsResponse);
+      requestResponseMap.put(createThirdNamedTagRequest, createTagsResponse);
+
+      ComputeService apiThatCreatesNode = 
requestsSendResponses(requestResponseMap.build());
+
+      Set<? extends NodeMetadata> nodes = 
apiThatCreatesNode.createNodesInGroup("test", 3,
+              
maxCount(3).blockUntilRunning(false).overrideLoginUser("ec2-user").nodeNames(ImmutableSet.of("test-node",
 "second-node", "third-node")));
+
+      NodeMetadata node = Iterables.get(nodes, 0);
+      assertEquals(node.getName(), "test-node");
+
+      NodeMetadata secondNode = Iterables.get(nodes, 1);
+      assertEquals(secondNode.getName(), "second-node");
+
+      NodeMetadata thirdNode = Iterables.get(nodes, 2);
+      assertEquals(thirdNode.getName(), "third-node");
+   }
+
+   //FIXME - issue-1051
+   @Test(enabled = false)
+   public void 
testCreateNodeWithGeneratedKeyPairAndOverriddenLoginUserWithTemplateBuilder() 
throws Exception {
+      Builder<HttpRequest, HttpResponse> requestResponseMap = 
ImmutableMap.<HttpRequest, HttpResponse> builder();
+      requestResponseMap.put(describeRegionsRequest, describeRegionsResponse);
+      requestResponseMap.put(describeAvailabilityZonesRequest, 
describeAvailabilityZonesResponse);
+      requestResponseMap.put(describeImagesRequest, describeImagesResponse);
+      requestResponseMap.put(createKeyPairRequest, createKeyPairResponse);
+      requestResponseMap.put(createSecurityGroupRequest, 
createSecurityGroupResponse);
+      requestResponseMap.put(describeSecurityGroupRequest, 
describeSecurityGroupResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequest22, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(authorizeSecurityGroupIngressRequestGroup, 
authorizeSecurityGroupIngressResponse);
+      requestResponseMap.put(runInstancesRequest, runInstancesResponse);
+      requestResponseMap.put(describeInstanceRequest, 
describeInstanceResponse);
+      requestResponseMap.put(describeInstanceMultiIdsRequest, 
describeInstanceMultiIdsResponse);
+      requestResponseMap.put(describeImageRequest, describeImagesResponse);
+      requestResponseMap.put(createTagsRequest, createTagsResponse);
+
+      ComputeService apiThatCreatesNode = 
requestsSendResponses(requestResponseMap.build());
+
+      NodeMetadata node = Iterables.getOnlyElement(
+            apiThatCreatesNode.createNodesInGroup("test", 1,
+            
apiThatCreatesNode.templateBuilder().from("osDescriptionMatches=.*fedora.*,loginUser=ec2-user").build()));
+      assertEquals(node.getCredentials().getUser(), "ec2-user");
+      assertTrue(node.getCredentials().getOptionalPrivateKey().isPresent());
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
new file mode 100644
index 0000000..1fa7e4b
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java
@@ -0,0 +1,365 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.compute;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.security.SecureRandom;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.compute.domain.NodeMetadata;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.domain.TemplateBuilderSpec;
+import org.jclouds.compute.internal.BaseComputeServiceLiveTest;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.compute.predicates.NodePredicates;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.ec2.EC2Api;
+import org.jclouds.ec2.compute.options.EC2TemplateOptions;
+import org.jclouds.ec2.domain.BlockDevice;
+import org.jclouds.ec2.domain.KeyPair;
+import org.jclouds.ec2.domain.PublicIpInstanceIdPair;
+import org.jclouds.ec2.domain.RunningInstance;
+import org.jclouds.ec2.domain.SecurityGroup;
+import org.jclouds.ec2.domain.Snapshot;
+import org.jclouds.ec2.domain.Volume;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
+import org.jclouds.ec2.features.InstanceApi;
+import org.jclouds.ec2.features.KeyPairApi;
+import org.jclouds.ec2.features.SecurityGroupApi;
+import org.jclouds.ec2.reference.EC2Constants;
+import org.jclouds.net.domain.IpProtocol;
+import org.jclouds.scriptbuilder.domain.Statements;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.jclouds.util.InetAddresses2;
+import org.testng.SkipException;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSortedSet;
+import com.google.common.collect.Iterables;
+import com.google.common.net.HostAndPort;
+import com.google.inject.Module;
+
+@Test(groups = "live", singleThreaded = true)
+public class EC2ComputeServiceLiveTest extends BaseComputeServiceLiveTest {
+
+   protected TemplateBuilderSpec ebsTemplate;
+
+   public EC2ComputeServiceLiveTest() {
+      provider = "ec2";
+   }
+
+   @Override
+   protected Module getSshModule() {
+      return new SshjSshClientModule();
+   }
+
+   @Override
+   protected void checkUserMetadataContains(NodeMetadata node, 
ImmutableMap<String, String> userMetadata) {
+      if (view.unwrapApi(EC2Api.class).getTagApi().isPresent()) {
+         super.checkUserMetadataContains(node, userMetadata);
+      } else {
+         assertTrue(node.getUserMetadata().isEmpty(), "not expecting metadata 
when tag extension isn't present: " + node);
+      }
+   }
+
+   @Override
+   protected void checkTagsInNodeEquals(NodeMetadata node, 
ImmutableSet<String> tags) {
+      if (view.unwrapApi(EC2Api.class).getTagApi().isPresent()) {
+         super.checkTagsInNodeEquals(node, tags);
+      } else {
+         assertTrue(node.getTags().isEmpty(), "not expecting tags when tag 
extension isn't present: " + node);
+      }
+   }
+
+
+   @Test(enabled = true, dependsOnMethods = "testCorrectAuthException")
+   public void testImagesResolveCorrectly() {
+      Template defaultTemplate = client.templateBuilder().build();
+      assertEquals(defaultTemplate.getImage().getId(), 
defaultTemplate.getImage().getLocation().getId() + "/"
+               + defaultTemplate.getImage().getProviderId());
+      Template byId = 
client.templateBuilder().imageId(defaultTemplate.getImage().getId()).build();
+      assertEquals(byId.getImage(), defaultTemplate.getImage());
+   }
+
+   @Test(enabled = true, dependsOnMethods = "testCompareSizes")
+   public void testExtendedOptionsAndLogin() throws Exception {
+      final SecureRandom random = new SecureRandom();
+
+      SecurityGroupApi securityGroupClient = view.unwrapApi(EC2Api.class)
+               .getSecurityGroupApi().get();
+
+      KeyPairApi keyPairClient = view.unwrapApi(EC2Api.class)
+               .getKeyPairApi().get();
+
+      InstanceApi instanceClient = view.unwrapApi(EC2Api.class)
+               .getInstanceApi().get();
+
+      String group = this.group + "o";
+
+      TemplateOptions options = client.templateOptions();
+
+      options.as(EC2TemplateOptions.class).securityGroups(group);
+      
options.as(EC2TemplateOptions.class).clientToken(Integer.toHexString(random.nextInt(65536
 * 1024)));
+
+      String startedId = null;
+      try {
+         cleanupExtendedStuffInRegion(null, securityGroupClient, 
keyPairClient, group);
+
+         // create a security group that allows ssh in so that our scripts 
later
+         // will work
+         securityGroupClient.createSecurityGroupInRegion(null, group, group);
+         securityGroupClient.authorizeSecurityGroupIngressInRegion(null, 
group, IpProtocol.TCP, 22, 22, "0.0.0.0/0");
+
+         // create a keypair to pass in as well
+         KeyPair result = keyPairClient.createKeyPairInRegion(null, group);
+         options.as(EC2TemplateOptions.class).keyPair(result.getKeyName());
+         
+         // pass in the private key, so that we can run a script with it
+         assert result.getKeyMaterial() != null : result;
+         options.overrideLoginPrivateKey(result.getKeyMaterial());
+         
+         // an arbitrary command to run
+         options.runScript(Statements.exec("find /usr"));
+         
+         Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 
1, options);
+         NodeMetadata first = Iterables.get(nodes, 0);
+         assert first.getCredentials() != null : first;
+         assert first.getCredentials().identity != null : first;
+
+         // Verify that the output of createNodesInGroup is the same.
+         assertEquals(client.createNodesInGroup(group, 1, options), nodes, 
"Idempotency failing - got different instances");
+         
+         startedId = Iterables.getOnlyElement(nodes).getProviderId();
+
+         RunningInstance instance = getInstance(instanceClient, startedId);
+
+         assertEquals(instance.getKeyName(), group);
+
+         // make sure we made our dummy group and also let in the user's group
+         assertEquals(ImmutableSortedSet.copyOf(instance.getGroupNames()), 
ImmutableSortedSet.<String> of("jclouds#" + group, group));
+
+         // make sure our dummy group has no rules
+         SecurityGroup secgroup = 
Iterables.getOnlyElement(securityGroupClient.describeSecurityGroupsInRegion(null,
+                  "jclouds#" + group));
+         assert secgroup.size() == 0 : secgroup;
+
+         // try to run a script with the original keyPair
+         runScriptWithCreds(group, first.getOperatingSystem(),
+               
LoginCredentials.builder().user(first.getCredentials().identity).privateKey(result.getKeyMaterial())
+                     .build());
+
+      } finally {
+         client.destroyNodesMatching(NodePredicates.inGroup(group));
+         if (startedId != null) {
+            // ensure we didn't delete these resources!
+            assertEquals(keyPairClient.describeKeyPairsInRegion(null, 
group).size(), 1);
+            
assertEquals(securityGroupClient.describeSecurityGroupsInRegion(null, 
group).size(), 1);
+         }
+         cleanupExtendedStuffInRegion(null, securityGroupClient, 
keyPairClient, group);
+      }
+   }
+
+   @Test(enabled = true) //, dependsOnMethods = "testCompareSizes")
+   public void testAutoIpAllocation() throws Exception {
+      ComputeServiceContext context = null;
+      String group = this.group + "aip";
+      try {
+         Properties overrides = setupProperties();
+         
overrides.setProperty(EC2Constants.PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS, 
"true");
+
+         context = createView(overrides, setupModules());
+
+         TemplateOptions options = client.templateOptions();
+
+         options.blockOnPort(22, 300);
+         options.inboundPorts(22);
+
+         // create a node
+         Set<? extends NodeMetadata> nodes =
+               context.getComputeService().createNodesInGroup(group, 1, 
options);
+         assertEquals(nodes.size(), 1, "One node should have been created");
+
+         // Get public IPs (We should get 1)
+         NodeMetadata node = Iterables.get(nodes, 0);
+         String region = node.getLocation().getParent().getId();
+         Set<String> publicIps = node.getPublicAddresses();
+         assertFalse(Iterables.isEmpty(publicIps), String.format("no public 
addresses attached to node %s", node));
+         assertEquals(Iterables.size(publicIps), 1);
+
+         // Check that the address is public and port 22 is accessible
+         String ip = Iterables.getOnlyElement(publicIps);
+         assertFalse(InetAddresses2.isPrivateIPAddress(ip));
+         HostAndPort socket = HostAndPort.fromParts(ip, 22);
+         assertTrue(socketTester.apply(socket), String.format("failed to open 
socket %s on node %s", socket, node));
+
+         // check that there is an elastic ip correlating to it
+         EC2Api ec2 = context.unwrapApi(EC2Api.class);
+         Set<PublicIpInstanceIdPair> ipidpairs =
+               
ec2.getElasticIPAddressApi().get().describeAddressesInRegion(region, 
publicIps.toArray(new String[0]));
+         assertEquals(ipidpairs.size(), 1, String.format("there should only be 
one address pair (%s)",
+               Iterables.toString(ipidpairs)));
+
+         // check that the elastic ip is in node.publicAddresses
+         PublicIpInstanceIdPair ipidpair = Iterables.get(ipidpairs, 0);
+         assertEquals(region + "/" + ipidpair.getInstanceId(), node.getId());
+         
+         // delete the node
+         
context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
+
+         // check that the ip is deallocated
+         Set<PublicIpInstanceIdPair> ipidcheck =
+                 
ec2.getElasticIPAddressApi().get().describeAddressesInRegion(region, 
ipidpair.getPublicIp());
+         assertTrue(Iterables.isEmpty(ipidcheck), String.format("there should 
be no address pairs (%s)",
+               Iterables.toString(ipidcheck)));
+      } finally {
+         
context.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
+         if (context != null)
+            context.close();
+      }
+   }
+   
+   @Override
+   protected Properties setupProperties() {
+      Properties overrides = super.setupProperties();
+      String ebsSpec = setIfTestSystemPropertyPresent(overrides, provider + 
".ebs-template");
+      if (ebsSpec != null)
+         ebsTemplate = TemplateBuilderSpec.parse(ebsSpec);
+      return overrides;
+   }
+
+   /**
+    * Note we cannot use the micro size as it has no ephemeral space.
+    */
+   @Test
+   public void testMapEBS() throws Exception {
+      if (ebsTemplate == null) {
+         throw new SkipException("Test cannot run without the parameter test." 
+ provider
+               + ".ebs-template; this property should be in the format defined 
in TemplateBuilderSpec");
+      }
+      InstanceApi instanceClient = view.unwrapApi(EC2Api.class)
+               .getInstanceApi().get();
+
+      ElasticBlockStoreApi ebsClient = view.unwrapApi(EC2Api.class)
+               .getElasticBlockStoreApi().get();
+
+      String group = this.group + "e";
+      int volumeSize = 8;
+      
+      final Template template = 
view.getComputeService().templateBuilder().from(ebsTemplate).build();
+
+      Location zone = 
Iterables.find(view.getComputeService().listAssignableLocations(), new 
Predicate<Location>() {
+
+         @Override
+         public boolean apply(Location arg0) {
+            return arg0.getScope() == LocationScope.ZONE
+                     && 
arg0.getParent().getId().equals(template.getLocation().getId());
+         }
+
+      });
+
+      // create volume only to make a snapshot
+      Volume volume = ebsClient.createVolumeInAvailabilityZone(zone.getId(), 
4);
+      // Sleep for 5 seconds to make sure the volume creation finishes.
+      Thread.sleep(5000);
+
+      Snapshot snapshot = ebsClient.createSnapshotInRegion(volume.getRegion(), 
volume.getId());
+      ebsClient.deleteVolumeInRegion(volume.getRegion(), volume.getId());
+
+      template.getOptions().as(EC2TemplateOptions.class)//
+               // .unmapDeviceNamed("/dev/foo)
+               .mapEphemeralDeviceToDeviceName("/dev/sdm", "ephemeral0")//
+               .mapNewVolumeToDeviceName("/dev/sdn", volumeSize, true)//
+               .mapEBSSnapshotToDeviceName("/dev/sdo", snapshot.getId(), 
volumeSize, true);
+
+      try {
+         NodeMetadata node = 
Iterables.getOnlyElement(client.createNodesInGroup(group, 1, template));
+
+         // TODO figure out how to validate the ephemeral drive. perhaps with 
df -k?
+
+         Map<String, BlockDevice> devices = 
instanceClient.getBlockDeviceMappingForInstanceInRegion(node.getLocation()
+                  .getParent().getId(), node.getProviderId());
+
+         BlockDevice device = devices.get("/dev/sdn");
+         // check delete on termination
+         assertTrue(device.isDeleteOnTermination());
+
+         volume = 
Iterables.getOnlyElement(ebsClient.describeVolumesInRegion(node.getLocation().getParent().getId(),
+                  device.getVolumeId()));
+         // check volume size
+         assertEquals(volumeSize, volume.getSize());
+
+         device = devices.get("/dev/sdo");
+         // check delete on termination
+         assertTrue(device.isDeleteOnTermination());
+
+         volume = 
Iterables.getOnlyElement(ebsClient.describeVolumesInRegion(node.getLocation().getParent().getId(),
+                  device.getVolumeId()));
+         // check volume size
+         assertEquals(volumeSize, volume.getSize());
+         // check volume's snapshot id
+         assertEquals(snapshot.getId(), volume.getSnapshotId());
+
+      } finally {
+         client.destroyNodesMatching(NodePredicates.inGroup(group));
+         ebsClient.deleteSnapshotInRegion(snapshot.getRegion(), 
snapshot.getId());
+      }
+   }
+
+   /**
+    * Gets the instance with the given ID from the default region
+    * 
+    * @throws NoSuchElementException If no instance with that id exists, or 
the instance is in a different region
+    */
+   public static RunningInstance getInstance(InstanceApi instanceClient, 
String id) {
+      RunningInstance instance = 
Iterables.getOnlyElement(Iterables.getOnlyElement(instanceClient
+               .describeInstancesInRegion(null, id)));
+      return instance;
+   }
+
+   protected static void cleanupExtendedStuffInRegion(String region, 
SecurityGroupApi securityGroupClient,
+            KeyPairApi keyPairClient, String group) throws 
InterruptedException {
+      try {
+         for (SecurityGroup secgroup : 
securityGroupClient.describeSecurityGroupsInRegion(region))
+            if (secgroup.getName().startsWith("jclouds#" + group) || 
secgroup.getName().equals(group)) {
+               securityGroupClient.deleteSecurityGroupInRegion(region, 
secgroup.getName());
+            }
+      } catch (Exception e) {
+
+      }
+      try {
+         for (KeyPair pair : keyPairClient.describeKeyPairsInRegion(region))
+            if (pair.getKeyName().startsWith("jclouds#" + group) || 
pair.getKeyName().equals(group)) {
+               keyPairClient.deleteKeyPairInRegion(region, pair.getKeyName());
+            }
+      } catch (Exception e) {
+
+      }
+      Thread.sleep(2000);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderLiveTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderLiveTest.java
new file mode 100644
index 0000000..349da8e
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderLiveTest.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.compute;
+
+import static 
org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService.getArgsForRequestAtIndex;
+import static 
org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService.getInvokerOfRequest;
+import static 
org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService.getInvokerOfRequestAtIndex;
+import static org.testng.Assert.assertEquals;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.List;
+
+import org.jclouds.compute.ComputeServiceContext;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
+import org.jclouds.ec2.options.DescribeAvailabilityZonesOptions;
+import org.jclouds.ec2.options.DescribeImagesOptions;
+import org.jclouds.ec2.options.DescribeRegionsOptions;
+import org.jclouds.ec2.features.AMIApi;
+import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.internal.TrackingJavaUrlHttpCommandExecutorService;
+import org.jclouds.logging.log4j.config.Log4JLoggingModule;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.inject.Module;
+
+public abstract class EC2TemplateBuilderLiveTest extends 
BaseTemplateBuilderLiveTest {
+   
+   @Test
+   public void testTemplateBuilderCanUseImageIdWithoutFetchingAllImages() 
throws Exception {
+      Template defaultTemplate = 
view.getComputeService().templateBuilder().build();
+      String defaultImageId = defaultTemplate.getImage().getId();
+      String defaultImageProviderId = 
defaultTemplate.getImage().getProviderId();
+
+      ComputeServiceContext context = null;
+      try {
+         // Track http commands
+         final List<HttpCommand> commandsInvoked = Lists.newArrayList();
+         context = createView(
+               setupProperties(),
+               ImmutableSet.<Module> of(new Log4JLoggingModule(),
+                     
TrackingJavaUrlHttpCommandExecutorService.newTrackingModule(commandsInvoked)));
+         
+         Template template = 
context.getComputeService().templateBuilder().imageId(defaultImageId)
+                  .build();
+         assertEquals(template.getImage(), defaultTemplate.getImage());
+
+         Collection<HttpCommand> filteredCommandsInvoked = 
Collections2.filter(commandsInvoked, new Predicate<HttpCommand>() {
+            private final Collection<Method> ignored = ImmutableSet.of(
+                     
AvailabilityZoneAndRegionApi.class.getMethod("describeRegions", 
DescribeRegionsOptions[].class),
+                     
AvailabilityZoneAndRegionApi.class.getMethod("describeAvailabilityZonesInRegion",
 String.class, DescribeAvailabilityZonesOptions[].class));
+            @Override
+            public boolean apply(HttpCommand input) {
+               return !ignored.contains(getInvokerOfRequest(input));
+            }
+         });
+         
+         assert filteredCommandsInvoked.size() == 1 : commandsInvoked;
+         assertEquals(getInvokerOfRequestAtIndex(filteredCommandsInvoked, 0), 
AMIApi.class
+                  .getMethod("describeImagesInRegion", String.class, 
DescribeImagesOptions[].class));
+         
assertDescribeImagesOptionsEquals((DescribeImagesOptions[])getArgsForRequestAtIndex(filteredCommandsInvoked,
 0).get(1), 
+                  defaultImageProviderId);
+
+      } finally {
+         if (context != null)
+            context.close();
+      }
+   }
+   
+   private static void 
assertDescribeImagesOptionsEquals(DescribeImagesOptions[] actual, String 
expectedImageId) {
+      assertEquals(actual.length, 1);
+      assertEquals(actual[0].getImageIds(), ImmutableSet.of(expectedImageId));
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java
new file mode 100644
index 0000000..0d21500
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/EC2TemplateBuilderTest.java
@@ -0,0 +1,242 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.compute;
+
+import static java.lang.String.format;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_medium;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.c1_xlarge;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.cc1_4xlarge;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.g2_2xlarge;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_large;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_small;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m1_xlarge;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_2xlarge;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_4xlarge;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.m2_xlarge;
+import static org.jclouds.ec2.compute.domain.EC2HardwareBuilder.t1_micro;
+import static org.testng.Assert.assertEquals;
+
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import javax.inject.Provider;
+
+import org.jclouds.compute.domain.ComputeMetadata;
+import org.jclouds.compute.domain.Hardware;
+import org.jclouds.compute.domain.Image;
+import org.jclouds.compute.domain.ImageBuilder;
+import org.jclouds.compute.domain.OperatingSystem;
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.domain.TemplateBuilder;
+import org.jclouds.compute.options.TemplateOptions;
+import org.jclouds.compute.strategy.GetImageStrategy;
+import org.jclouds.compute.suppliers.ImageCacheSupplier;
+import org.jclouds.domain.Location;
+import org.jclouds.domain.LocationBuilder;
+import org.jclouds.domain.LocationScope;
+import org.jclouds.domain.LoginCredentials;
+import org.jclouds.ec2.compute.domain.RegionAndName;
+import org.jclouds.ec2.compute.functions.ImagesToRegionAndIdMap;
+import org.jclouds.ec2.compute.internal.EC2TemplateBuilderImpl;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Function;
+import com.google.common.base.Functions;
+import com.google.common.base.Supplier;
+import com.google.common.base.Suppliers;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests compute service specifically to EC2.
+ * 
+ * These tests are designed to verify the local functionality of jclouds, 
rather than the
+ * interaction with Amazon Web Services.
+ * 
+ * @see EC2ComputeServiceLiveTest
+ */
+@Test(testName = "EC2TemplateBuilderTest")
+public class EC2TemplateBuilderTest {
+   Location provider = new 
LocationBuilder().scope(LocationScope.PROVIDER).id("aws-ec2").description("aws-ec2").build();
+
+   protected Location location = new 
LocationBuilder().scope(LocationScope.REGION).id("us-east-1").description("us-east-1")
+         .parent(provider).build();
+
+   public static final Hardware CC1_4XLARGE = 
cc1_4xlarge().supportsImageIds(ImmutableSet.of("us-east-1/cc-image"))
+         .build();
+
+   /**
+    * Verifies that {@link TemplateBuilderImpl} would choose the correct size 
of the instance, based
+    * on {@link org.jclouds.compute.domain.Hardware} from {@link EC2Hardware}.
+    * 
+    * Expected size: m2.xlarge
+    */
+   @Test
+   public void testTemplateChoiceForInstanceByhardwareId() throws Exception {
+      Template template = 
newTemplateBuilder().os64Bit(true).hardwareId("m2.xlarge").locationId("us-east-1").build();
+
+      assert template != null : "The returned template was null, but it should 
have a value.";
+      // assert m2_xlarge().build().equals(template.getHardware()) : format(
+      // "Incorrect image determined by the template. Expected: %s. Found: 
%s.", "m2.xlarge",
+      // String.valueOf(template.getHardware()));
+      assertEquals(m2_xlarge().build().getId(), 
template.getHardware().getId());
+   }
+
+   @Test
+   public void testTemplateChoiceForInstanceByCChardwareId() throws Exception {
+      Template template = newTemplateBuilder().fastest().build();
+
+      assert template != null : "The returned template was null, but it should 
have a value.";
+      assert CC1_4XLARGE.equals(template.getHardware()) : format(
+               "Incorrect image determined by the template. Expected: %s. 
Found: %s.", CC1_4XLARGE.getId(), template
+                        .getHardware().getId());
+   }
+
+   /**
+    * Verifies that {@link TemplateBuilderImpl} would choose the correct size 
of the instance, based
+    * on physical attributes (# of cores, ram, etc).
+    * 
+    * Expected size: CC1_4XLARGE
+    */
+   @Test
+   public void testTemplateChoiceForInstanceByAttributes() throws Exception {
+      Template template = 
newTemplateBuilder().os64Bit(true).minRam(17510).minCores(6.5).smallest().locationId(
+               "us-east-1").build();
+
+      assert template != null : "The returned template was null, but it should 
have a value.";
+      assertEquals(template.getHardware().getId(), "cc1.4xlarge");
+   }
+
+   /**
+    * Negative test version of {@link 
#testTemplateChoiceForInstanceByAttributes}.
+    * 
+    * Verifies that {@link TemplateBuilderImpl} would not choose the 
insufficient size of the
+    * instance, based on physical attributes (# of cores, ram, etc).
+    * 
+    * Expected size: anything but m2.xlarge
+    */
+   @Test
+   public void testNegativeTemplateChoiceForInstanceByAttributes() throws 
Exception {
+      Template template = 
newTemplateBuilder().os64Bit(true).minRam(17510).minCores(6.7).smallest().locationId(
+               "us-east-1").build();
+
+      assert template != null : "The returned template was null, but it should 
have a value.";
+      assert !m2_xlarge().build().equals(template.getHardware()) : format(
+               "Incorrect image determined by the template. Expected: not %s. 
Found: %s.", "m2.xlarge", template
+                        .getHardware().getId());
+   }
+
+   @Test
+   public void testTemplateChoiceForInstanceByImageId() throws Exception {
+      Template template = 
newTemplateBuilder().imageId("us-east-1/cc-image").build();
+
+      assert template != null : "The returned template was null, but it should 
have a value.";
+      assertEquals(template.getImage().getId(), "us-east-1/cc-image");
+   }
+
+   @Test
+   public void testTemplateChoiceForInstanceByImageIdDoesNotGetAllImages() 
throws Exception {
+      @SuppressWarnings("unchecked")
+      Supplier<Set<? extends Image>> images = createMock(Supplier.class);
+      replay(images);
+      
+      final Image image = new 
ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
+               .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, 
"1.0", "hvm", "ubuntu", true))
+               
.description("description").version("1.0").defaultCredentials(LoginCredentials.builder().user("root").build())
+               .status(Image.Status.AVAILABLE)
+               .build();
+      Map<RegionAndName, Image> imageMap = ImmutableMap.of(
+               new RegionAndName(image.getLocation().getId(), 
image.getProviderId()), image);
+      
+      // weird compilation error means have to declare extra generics for call 
to build() - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818
+      Supplier<LoadingCache<RegionAndName, ? extends Image>> imageCache = 
Suppliers.<LoadingCache<RegionAndName, ? extends Image>> ofInstance(
+               CacheBuilder.newBuilder().<RegionAndName, 
Image>build(CacheLoader.from(Functions.forMap(imageMap))));
+
+      Template template = newTemplateBuilder(images, 
imageCache).imageId("us-east-1/cc-image").build();
+
+      assert template != null : "The returned template was null, but it should 
have a value.";
+      assertEquals(template.getImage().getId(), "us-east-1/cc-image");
+   }
+
+   @Test(expectedExceptions = {NoSuchElementException.class})
+   public void testNegativeTemplateChoiceForInstanceByImageId() throws 
Exception {
+      newTemplateBuilder().imageId("wrongregion/wrongimageid").build();
+   }
+
+   private TemplateBuilder newTemplateBuilder() {
+      final Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends 
Image>> ofInstance(ImmutableSet.<Image> of(
+               new 
ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
+                        .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, 
null, "1.0", "hvm", "ubuntu", true))
+                        
.description("description").version("1.0").defaultCredentials(LoginCredentials.builder().user("root").build())
+                        .status(Image.Status.AVAILABLE)
+                        .build(), 
+               new 
ImageBuilder().providerId("normal-image").name("image").id("us-east-1/normal-image").location(location)
+                        .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, 
null, "1.0", "paravirtual", "ubuntu", true))
+                        
.description("description").version("1.0").defaultCredentials(LoginCredentials.builder().user("root").build())
+                        .status(Image.Status.AVAILABLE)
+                        .build()));
+      
+      // weird compilation error means have to cast this - see 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818
+      @SuppressWarnings("unchecked")
+      ImmutableMap<RegionAndName, Image> imageMap = 
(ImmutableMap<RegionAndName, Image>) 
ImagesToRegionAndIdMap.imagesToMap(images.get());
+      Supplier<LoadingCache<RegionAndName, ? extends Image>> imageCache = 
Suppliers.<LoadingCache<RegionAndName, ? extends Image>> ofInstance(
+               CacheBuilder.newBuilder().<RegionAndName, 
Image>build(CacheLoader.from(Functions.forMap(imageMap))));
+
+      return newTemplateBuilder(images, imageCache);
+   }
+
+   @SuppressWarnings("unchecked")
+   private TemplateBuilder newTemplateBuilder(Supplier<Set<? extends Image>> 
images, Supplier<LoadingCache<RegionAndName, ? extends Image>> imageCache) {
+      Provider<TemplateOptions> optionsProvider = createMock(Provider.class);
+      Provider<TemplateBuilder> templateBuilderProvider = 
createMock(Provider.class);
+      TemplateOptions defaultOptions = createMock(TemplateOptions.class);
+      GetImageStrategy getImageStrategy = createMock(GetImageStrategy.class);
+
+      expect(optionsProvider.get()).andReturn(defaultOptions);
+
+      replay(optionsProvider);
+      replay(templateBuilderProvider);
+      replay(getImageStrategy);
+      Supplier<Set<? extends Location>> locations = Suppliers.<Set<? extends 
Location>> ofInstance(ImmutableSet
+               .<Location> of(location));
+      Supplier<Set<? extends Hardware>> sizes = Suppliers.<Set<? extends 
Hardware>> ofInstance(ImmutableSet
+               .<Hardware> of(t1_micro().build(), c1_medium().build(), 
c1_xlarge().build(), m1_large().build(),
+                        m1_small().build(), m1_xlarge().build(), 
m2_xlarge().build(), m2_2xlarge().build(),
+                             m2_4xlarge().build(), g2_2xlarge().build(), 
CC1_4XLARGE));
+
+      return new EC2TemplateBuilderImpl(locations, new 
ImageCacheSupplier(images, 60), sizes, Suppliers.ofInstance(location), 
optionsProvider,
+               templateBuilderProvider, getImageStrategy, imageCache) {
+      };
+   }
+
+   Function<ComputeMetadata, String> indexer() {
+      return new Function<ComputeMetadata, String>() {
+         @Override
+         public String apply(ComputeMetadata from) {
+            return from.getProviderId();
+         }
+      };
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/397d9926/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/TestCanRecreateGroupLiveTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/TestCanRecreateGroupLiveTest.java
 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/TestCanRecreateGroupLiveTest.java
new file mode 100644
index 0000000..863229a
--- /dev/null
+++ 
b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/compute/TestCanRecreateGroupLiveTest.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.ec2.compute;
+
+import org.jclouds.compute.RunNodesException;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
+import org.jclouds.compute.predicates.NodePredicates;
+import org.testng.annotations.Test;
+
+import com.google.common.base.Throwables;
+
+@Test(groups = "live", testName = "TestCanRecreateGroupLiveTest")
+public class TestCanRecreateGroupLiveTest extends 
BaseComputeServiceContextLiveTest {
+   public TestCanRecreateGroupLiveTest() {
+      provider = "ec2";
+   }
+
+   public void testCanRecreateGroup() throws Exception {
+
+      String tag = PREFIX + "recreate";
+      
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
+
+      try {
+         Template template = 
view.getComputeService().templateBuilder().build();
+         view.getComputeService().createNodesInGroup(tag, 1, template);
+         
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
+         view.getComputeService().createNodesInGroup(tag, 1, template);
+      } catch (RunNodesException e) {
+         System.err.println(e.getNodeErrors().keySet());
+         Throwables.propagate(e);
+      } finally {
+         
view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(tag));
+      }
+   }
+
+   public static final String PREFIX = System.getProperty("user.name") + "ec2";
+
+}

Reply via email to