http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandlerTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandlerTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandlerTest.java
new file mode 100644
index 0000000..04de926
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/CloudStackErrorHandlerTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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.cloudstack.handlers;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reportMatcher;
+import static org.easymock.EasyMock.verify;
+
+import java.net.URI;
+
+import org.easymock.IArgumentMatcher;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.rest.AuthorizationException;
+import org.jclouds.rest.InsufficientResourcesException;
+import org.jclouds.rest.ResourceNotFoundException;
+import org.testng.annotations.Test;
+
+import com.google.inject.Guice;
+
+@Test(groups = {"unit"})
+public class CloudStackErrorHandlerTest {
+
+   @Test
+   public void test400MakesIllegalArgumentException() {
+      assertCodeMakes("GET", URI.create("https://cloudstack.com/foo";), 400, 
"", "Bad Request",
+         IllegalArgumentException.class);
+   }
+
+   @Test
+   public void test401MakesAuthorizationException() {
+      assertCodeMakes("GET", URI.create("https://cloudstack.com/foo";), 401, 
"", "Unauthorized",
+         AuthorizationException.class);
+   }
+
+   @Test
+   public void test404MakesResourceNotFoundException() {
+      assertCodeMakes("GET", URI.create("https://cloudstack.com/foo";), 404, 
"", "Not Found",
+         ResourceNotFoundException.class);
+   }
+
+   @Test
+   public void test405MakesIllegalArgumentException() {
+      assertCodeMakes("GET", URI.create("https://cloudstack.com/foo";), 405, 
"", "Method Not Allowed",
+         IllegalArgumentException.class);
+   }
+
+   @Test
+   public void test431MakesIllegalStateException() {
+      assertCodeMakes("GET", URI.create("https://cloudstack.com/foo";), 431, 
"", "Method Not Allowed",
+         IllegalStateException.class);
+   }
+
+   @Test
+   public void test431MakesResourceNotFoundExceptionOnDelete() {
+      assertCodeMakes(
+         "GET",
+         
URI.create("https://api.ninefold.com/compute/v1.0/?response=json&command=deleteSSHKeyPair";),
+         431,
+         "",
+         "{ \"deletekeypairresponse\" : {\"errorcode\" : 431, \"errortext\" : 
\"A key pair with name 'adriancole-adapter-test-keypair' does not exist for 
account jclouds in domain id=457\"}  }",
+         ResourceNotFoundException.class);
+   }
+
+   @Test
+   public void test409MakesIllegalStateException() {
+      assertCodeMakes("GET", URI.create("https://cloudstack.com/foo";), 409, 
"", "Conflict", IllegalStateException.class);
+   }
+
+   @Test
+   public void test531MakesAuthorizationException() {
+      assertCodeMakes("GET", URI.create("https://cloudstack.com/foo";), 531, 
"", "Unauthorized",
+         AuthorizationException.class);
+   }
+
+   @Test
+   void test534WithMaximumResourcesMakesInsufficientResourcesException() {
+      assertCodeMakes(
+         "GET",
+         
URI.create("http://10.26.26.155:8080/client/api?response=json&command=deployVirtualMachine&zoneid=7dbc4787-ec2f-498d-95f0-848c8c81e5da&templateid=240937c8-d695-419c-9908-5c7b2a07e6f1&serviceofferingid=c376102e-b683-4d43-b583-4eeab4627e65&displayname=bousa-4&name=bousa-4";),
+         534,
+         "",
+         "{ \"createipforwardingruleresponse\" : {\"errorcode\" : 534, 
\"errortext\" : \"Maximum number of resources of type 'volume' for account 
name=jarcec in domain id=1 has been exceeded.\"}  }",
+         InsufficientResourcesException.class);
+   }
+
+   @Test
+   void test537MakesIllegalStateException() {
+      assertCodeMakes(
+         "GET",
+         
URI.create("http://10.26.26.155:8080/client/api?response=json&command=createIpForwardingRule&ipaddressid=37&startport=22&protocol=tcp";),
+         537,
+         "",
+         "{ \"createipforwardingruleresponse\" : {\"errorcode\" : 537, 
\"errortext\" : \"There is already firewall rule specified for the ip address 
id=37\"}  }",
+         IllegalStateException.class);
+   }
+
+   private void assertCodeMakes(String method, URI uri, int statusCode, String 
message, String content,
+                                Class<? extends Exception> expected) {
+      assertCodeMakes(method, uri, statusCode, message, "text/xml", content, 
expected);
+   }
+
+   private void assertCodeMakes(String method, URI uri, int statusCode, String 
message, String contentType,
+                                String content, Class<? extends Exception> 
expected) {
+
+      CloudStackErrorHandler function = 
Guice.createInjector().getInstance(CloudStackErrorHandler.class);
+
+      HttpCommand command = createMock(HttpCommand.class);
+      HttpRequest request = 
HttpRequest.builder().method(method).endpoint(uri).build();
+      HttpResponse response = 
HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
+      response.getPayload().getContentMetadata().setContentType(contentType);
+
+      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
+      command.setException(classEq(expected));
+
+      replay(command);
+
+      function.handleError(command, response);
+
+      verify(command);
+   }
+
+   public static Exception classEq(final Class<? extends Exception> in) {
+      reportMatcher(new IArgumentMatcher() {
+
+         @Override
+         public void appendTo(StringBuffer buffer) {
+            buffer.append("classEq(");
+            buffer.append(in);
+            buffer.append(")");
+         }
+
+         @Override
+         public boolean matches(Object arg) {
+            return arg.getClass() == in;
+         }
+
+      });
+      return null;
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java
new file mode 100644
index 0000000..6c82b07
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/handlers/InvalidateSessionAndRetryOn401AndLogoutOnCloseTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.cloudstack.handlers;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.easymock.IAnswer;
+import org.jclouds.cloudstack.domain.LoginResponse;
+import org.jclouds.cloudstack.features.SessionApi;
+import org.jclouds.domain.Credentials;
+import org.jclouds.http.HttpCommand;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.io.Payloads;
+import org.testng.annotations.Test;
+
+import com.google.common.cache.LoadingCache;
+
+/**
+ * Tests behavior of {@code InvalidateSessionAndRetryOn401AndLogoutOnClose} 
handler
+ */
+@Test(groups = "unit", testName = 
"InvalidateSessionAndRetryOn401AndLogoutOnCloseTest")
+public class InvalidateSessionAndRetryOn401AndLogoutOnCloseTest {
+
+   @SuppressWarnings("unchecked")
+   @Test
+   public void test401ShouldRetryAndFailAfterFiveAttempts() {
+      HttpCommand command = createMock(HttpCommand.class);
+      SessionApi sessionClient = createMock(SessionApi.class);
+      LoadingCache<Credentials, LoginResponse> cache = 
createMock(LoadingCache.class);
+
+      cache.invalidateAll();
+      expectLastCall().anyTimes();
+
+      final AtomicInteger counter = new AtomicInteger();
+      expect(command.incrementFailureCount()).andAnswer(new IAnswer<Integer>() 
{
+         @Override
+         public Integer answer() throws Throwable {
+            return counter.incrementAndGet();
+         }
+      }).anyTimes();
+      expect(command.isReplayable()).andReturn(true).anyTimes();
+      expect(command.getFailureCount()).andAnswer(new IAnswer<Integer>() {
+         @Override
+         public Integer answer() throws Throwable {
+            return counter.get();
+         }
+      }).anyTimes();
+
+      replay(cache, command);
+
+      HttpResponse response = HttpResponse.builder().payload(
+         Payloads.newStringPayload("Not relevant")).statusCode(401).build();
+
+      InvalidateSessionAndRetryOn401AndLogoutOnClose retry =
+         new InvalidateSessionAndRetryOn401AndLogoutOnClose(cache, 
sessionClient);
+
+      for (int i = 0; i < 5; i++) {
+         assertTrue(retry.shouldRetryRequest(command, response));
+      }
+      assertFalse(retry.shouldRetryRequest(command, response));
+
+      verify(cache, command);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiLiveTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiLiveTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiLiveTest.java
new file mode 100644
index 0000000..b995ca8
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiLiveTest.java
@@ -0,0 +1,274 @@
+/*
+ * 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.cloudstack.internal;
+
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.get;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.jclouds.cloudstack.domain.Account.Type.ADMIN;
+import static org.jclouds.cloudstack.domain.Account.Type.DOMAIN_ADMIN;
+import static org.jclouds.cloudstack.domain.Account.Type.USER;
+import static org.jclouds.reflect.Reflection2.typeToken;
+import static org.jclouds.util.Predicates2.retry;
+import static org.testng.Assert.assertEquals;
+
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import org.jclouds.cloudstack.CloudStackApi;
+import org.jclouds.cloudstack.CloudStackContext;
+import org.jclouds.cloudstack.CloudStackDomainApi;
+import org.jclouds.cloudstack.CloudStackGlobalApi;
+import org.jclouds.cloudstack.domain.Account;
+import org.jclouds.cloudstack.domain.Template;
+import org.jclouds.cloudstack.domain.User;
+import org.jclouds.cloudstack.domain.VirtualMachine;
+import org.jclouds.cloudstack.features.AccountApi;
+import org.jclouds.cloudstack.functions.ReuseOrAssociateNewPublicIPAddress;
+import org.jclouds.cloudstack.options.ListTemplatesOptions;
+import org.jclouds.cloudstack.predicates.CorrectHypervisorForZone;
+import org.jclouds.cloudstack.predicates.JobComplete;
+import org.jclouds.cloudstack.predicates.OSCategoryIn;
+import org.jclouds.cloudstack.predicates.TemplatePredicates;
+import org.jclouds.cloudstack.predicates.UserPredicates;
+import org.jclouds.cloudstack.predicates.VirtualMachineDestroyed;
+import org.jclouds.cloudstack.predicates.VirtualMachineRunning;
+import org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult;
+import org.jclouds.compute.ComputeService;
+import org.jclouds.compute.domain.ExecResponse;
+import org.jclouds.compute.internal.BaseGenericComputeServiceContextLiveTest;
+import org.jclouds.predicates.SocketOpen;
+import org.jclouds.ssh.SshClient;
+import org.jclouds.sshj.config.SshjSshClientModule;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeGroups;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import com.google.common.net.HostAndPort;
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+
+public class BaseCloudStackApiLiveTest extends 
BaseGenericComputeServiceContextLiveTest<CloudStackContext> {
+   protected String domainAdminIdentity;
+   protected String domainAdminCredential;
+   protected String globalAdminIdentity;
+   protected String globalAdminCredential;
+
+   public BaseCloudStackApiLiveTest() {
+      provider = "cloudstack";
+   }
+   
+   @Override
+   protected TypeToken<CloudStackContext> viewType() {
+      return typeToken(CloudStackContext.class);
+   }
+   
+   @Override
+   protected Properties setupProperties() {
+      Properties overrides = super.setupProperties();
+      domainAdminIdentity = setIfTestSystemPropertyPresent(overrides, provider 
+ ".domainAdminIdentity");
+      domainAdminCredential = setIfTestSystemPropertyPresent(overrides, 
provider + ".domainAdminCredential");
+      globalAdminIdentity = setIfTestSystemPropertyPresent(overrides, provider 
+ ".globalAdminIdentity");
+      globalAdminCredential = setIfTestSystemPropertyPresent(overrides,  
provider + ".globalAdminCredential");
+      return overrides;
+   }
+
+   protected Properties setupDomainAdminProperties() {
+      if (domainAdminIdentity != null && domainAdminCredential != null) {
+         Properties overrides = setupProperties();
+         overrides.setProperty(provider + ".identity", domainAdminIdentity);
+         overrides.setProperty(provider + ".credential", 
domainAdminCredential);
+         return overrides;
+      } else {
+         return null;
+      }
+   }
+
+   protected Properties setupGlobalAdminProperties() {
+      if (globalAdminIdentity != null && globalAdminCredential != null) {
+         Properties overrides = setupProperties();
+         overrides.setProperty(provider + ".identity", globalAdminIdentity);
+         overrides.setProperty(provider + ".credential", 
globalAdminCredential);
+         return overrides;
+      } else {
+         return null;
+      }
+   }
+
+   public static String defaultTemplateOrPreferredInZone(String 
defaultTemplate, CloudStackApi client, String zoneId) {
+      String templateId = defaultTemplate != null ? defaultTemplate : 
getTemplateForZone(client, zoneId);
+      return templateId;
+   }
+
+   public static String getTemplateForZone(CloudStackApi client, String 
zoneId) {
+      // TODO enum, as this is way too easy to mess up.
+      Set<String> acceptableCategories = ImmutableSet.of("Ubuntu", "CentOS");
+
+      final Predicate<Template> hypervisorPredicate = new 
CorrectHypervisorForZone(client).apply(zoneId);
+      final Predicate<Template> osTypePredicate = new 
OSCategoryIn(client).apply(acceptableCategories);
+
+      @SuppressWarnings("unchecked")
+      Predicate<Template> templatePredicate = Predicates.<Template> 
and(TemplatePredicates.isReady(),
+            hypervisorPredicate, osTypePredicate);
+      Iterable<Template> templates = filter(
+            
client.getTemplateApi().listTemplates(ListTemplatesOptions.Builder.zoneId(zoneId)),
 templatePredicate);
+      if (Iterables.any(templates, TemplatePredicates.isPasswordEnabled())) {
+         templates = filter(templates, TemplatePredicates.isPasswordEnabled());
+      }
+      if (Iterables.size(templates) == 0) {
+         throw new NoSuchElementException(templatePredicate.toString());
+      }
+      String templateId = get(templates, 0).getId();
+      return templateId;
+   }
+
+   protected String prefix = System.getProperty("user.name");
+
+   protected ComputeService computeClient;
+   protected CloudStackContext cloudStackContext;
+   protected CloudStackApi client;
+   protected CloudStackApi adminClient;
+   protected User user;
+
+   protected Predicate<HostAndPort> socketTester;
+   protected Predicate<String> jobComplete;
+   protected Predicate<String> adminJobComplete;
+   protected Predicate<VirtualMachine> virtualMachineRunning;
+   protected Predicate<VirtualMachine> adminVirtualMachineRunning;
+   protected Predicate<VirtualMachine> virtualMachineDestroyed;
+   protected Predicate<VirtualMachine> adminVirtualMachineDestroyed;
+   protected SshClient.Factory sshFactory;
+
+   protected Injector injector;
+
+   protected ReuseOrAssociateNewPublicIPAddress reuseOrAssociate;
+
+   protected boolean domainAdminEnabled;
+   protected CloudStackContext domainAdminComputeContext;
+   protected CloudStackDomainApi domainAdminClient;
+   protected User domainAdminUser;
+
+   protected boolean globalAdminEnabled;
+   protected CloudStackContext globalAdminComputeContext;
+   protected CloudStackGlobalApi globalAdminClient;
+   protected User globalAdminUser;
+   
+   protected void checkSSH(HostAndPort socket) {
+      socketTester.apply(socket);
+      SshClient client = sshFactory.create(socket, loginCredentials);
+      try {
+         client.connect();
+         ExecResponse exec = client.exec("echo hello");
+         System.out.println(exec);
+         assertEquals(exec.getOutput().trim(), "hello");
+      } finally {
+         if (client != null)
+            client.disconnect();
+      }
+   }
+
+   @BeforeGroups(groups = { "integration", "live" })
+   @Override
+   public void setupContext() {
+      super.setupContext();
+      computeClient = view.getComputeService();
+      cloudStackContext = CloudStackContext.class.cast(view);
+      client = cloudStackContext.getApi();
+      user = verifyCurrentUserIsOfType(identity, client.getAccountApi(), USER);
+
+      domainAdminEnabled = setupDomainAdminProperties() != null;
+      if (domainAdminEnabled) {
+         domainAdminComputeContext = createView(setupDomainAdminProperties(), 
setupModules());
+         domainAdminClient = domainAdminComputeContext.getDomainApi();
+         domainAdminUser = verifyCurrentUserIsOfType(domainAdminIdentity, 
domainAdminClient.getAccountApi(),
+               DOMAIN_ADMIN);
+         adminClient = domainAdminClient;
+      }
+
+      globalAdminEnabled = setupGlobalAdminProperties() != null;
+      if (globalAdminEnabled) {
+         globalAdminComputeContext = createView(setupGlobalAdminProperties(), 
setupModules());
+         globalAdminClient = globalAdminComputeContext.getGlobalApi();
+         globalAdminUser = verifyCurrentUserIsOfType(globalAdminIdentity, 
globalAdminClient.getAccountApi(), ADMIN);
+         adminClient = globalAdminClient;
+      }
+
+      injector = cloudStackContext.utils().injector();
+      sshFactory = injector.getInstance(SshClient.Factory.class);
+      SocketOpen socketOpen = 
context.utils().injector().getInstance(SocketOpen.class);
+      socketTester = retry(socketOpen, 180, 1, 1, SECONDS);
+      injector.injectMembers(socketTester);
+
+      jobComplete = retry(new JobComplete(client), 1200, 1, 5, SECONDS);
+      injector.injectMembers(jobComplete);
+      adminJobComplete = retry(new JobComplete(adminClient), 1200, 1, 5, 
SECONDS);
+      injector.injectMembers(adminJobComplete);
+      virtualMachineRunning = retry(new VirtualMachineRunning(client), 600, 5, 
5, SECONDS);
+      injector.injectMembers(virtualMachineRunning);
+      adminVirtualMachineRunning = retry(new 
VirtualMachineRunning(adminClient), 600, 5, 5, SECONDS);
+      injector.injectMembers(adminVirtualMachineRunning);
+      virtualMachineDestroyed = retry(new VirtualMachineDestroyed(client), 
600, 5, 5, SECONDS);
+      injector.injectMembers(virtualMachineDestroyed);
+      adminVirtualMachineDestroyed = retry(new 
VirtualMachineDestroyed(adminClient), 600, 5, 5, SECONDS);
+      injector.injectMembers(adminVirtualMachineDestroyed);
+      reuseOrAssociate = new ReuseOrAssociateNewPublicIPAddress(client, new 
BlockUntilJobCompletesAndReturnResult(
+            client, jobComplete));
+      injector.injectMembers(reuseOrAssociate);
+   }
+
+   @Override
+   protected Module getSshModule() {
+      return new SshjSshClientModule();
+   }
+   
+   private static User verifyCurrentUserIsOfType(String identity, AccountApi 
accountClient, Account.Type type) {
+      Iterable<User> users = Iterables.concat(accountClient.listAccounts());
+      Predicate<User> apiKeyMatches = UserPredicates.apiKeyEquals(identity);
+      User currentUser;
+      try {
+         currentUser = Iterables.find(users, apiKeyMatches);
+      } catch (NoSuchElementException e) {
+         throw new NoSuchElementException(String.format("none of the following 
users match %s: %s", apiKeyMatches,
+               users));
+      }
+
+      if (currentUser.getAccountType() != type) {
+         Logger.getAnonymousLogger().warning(
+               String.format("Expecting an user with type %s. Got: %s", 
type.toString(), currentUser.toString()));
+      }
+      return currentUser;
+   }
+
+   protected void skipIfNotDomainAdmin() {
+      if (!domainAdminEnabled) {
+         throw new SkipException("Test cannot run without domain admin 
identity and credentials");
+      }
+   }
+
+   protected void skipIfNotGlobalAdmin() {
+      if (!globalAdminEnabled) {
+         throw new SkipException("Test cannot run without global admin 
identity and credentials");
+      }
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.java
new file mode 100644
index 0000000..664758d
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackApiTest.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.cloudstack.internal;
+
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.cloudstack.CloudStackApiMetadata;
+import org.jclouds.cloudstack.config.CloudStackHttpApiModule;
+import org.jclouds.cloudstack.filters.QuerySigner;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.providers.AnonymousProviderMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.rest.ConfiguresHttpApi;
+import org.jclouds.rest.internal.BaseAsyncApiTest;
+
+import com.google.inject.Module;
+
+public abstract class BaseCloudStackApiTest<T> extends BaseAsyncApiTest<T> {
+
+   @ConfiguresHttpApi
+   public static class CloudStackHttpApiModuleExtension extends 
CloudStackHttpApiModule {
+
+   }
+
+   @Override
+   protected void checkFilters(HttpRequest request) {
+      assertEquals(request.getFilters().size(), 1);
+      assertEquals(request.getFilters().get(0).getClass(), QuerySigner.class);
+   }
+
+   @Override
+   protected Module createModule() {
+      return new CloudStackHttpApiModuleExtension();
+   }
+
+   @Override
+   protected ProviderMetadata createProviderMetadata() {
+      return  AnonymousProviderMetadata.forApiWithEndpoint(new 
CloudStackApiMetadata(),
+            "http://localhost:8080/client/api";);
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackComputeServiceContextExpectTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackComputeServiceContextExpectTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackComputeServiceContextExpectTest.java
new file mode 100644
index 0000000..4a971b2
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackComputeServiceContextExpectTest.java
@@ -0,0 +1,259 @@
+/*
+ * 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.cloudstack.internal;
+
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+
+
+/**
+ * Base class for writing CloudStack Expect tests with the ComputeService
+ * abstraction
+ */
+public abstract class BaseCloudStackComputeServiceContextExpectTest<T> extends 
BaseCloudStackExpectTest<T> {
+   
+   public BaseCloudStackComputeServiceContextExpectTest() {
+      // to match the api key name in listaccountsresponse.json
+      identity = "APIKEY";
+   }
+   
+   protected final HttpRequest listTemplates = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listTemplates")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("templatefilter", "executable")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "Xk6lF/v3SbhrxTKqaC2IWoBPKHo%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   //TODO: update or add new resource files to have more recent data, ex. 
ubuntu template
+   protected final HttpResponse listTemplatesResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listtemplatesresponse.json"))
+      .build();
+
+   protected final HttpRequest listProjects = 
HttpRequest.builder().method("GET")
+           .endpoint("http://localhost:8080/client/api";)
+           .addQueryParam("response", "json")
+           .addQueryParam("command", "listProjects")
+           .addQueryParam("listAll", "true")
+           .addQueryParam("account", "jclouds")
+           .addQueryParam("domainid", "457")
+           .addQueryParam("apiKey", "APIKEY")
+           .addQueryParam("signature", "yAx1XbtjeEhdBQCNP0OLyWWAFCw%3D")
+           .addHeader("Accept", "application/json")
+           .build();
+
+   protected final HttpResponse listProjectsResponse = 
HttpResponse.builder().statusCode(200)
+           .build();
+
+   protected final HttpRequest listOsTypes = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listOsTypes")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "8BsE8MsOAhUzo1Q4Y3UD/e96u84%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse listOsTypesResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listostypesresponse.json"))
+      .build();
+   
+   protected final HttpRequest listOsCategories = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listOsCategories")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "OojW4ssh/RQ3CubAzXue4svlofM%3D")
+//      .addHeader("Accept", "application/json") //TODO: why are we not 
passing this?
+      .build();
+
+   protected final HttpResponse listOsCategoriesResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listoscategoriesresponse.json"))
+      .build();
+   
+   protected final HttpRequest listZones = HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listZones")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "GTUgn/LHDioJRq48kurOdCAYueo%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse listZonesResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listzonesresponse.json"))
+      .build();
+
+   protected final HttpRequest listServiceOfferings = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listServiceOfferings")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "jUien8oeEan7bjKKQbBlzvFuMjw%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse listServiceOfferingsResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listserviceofferingsresponse.json"))
+      .build();
+
+   protected final HttpRequest listAccounts = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listAccounts")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "E4wuKXCkioaNIiL8hL8FD9K5K2c%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse listAccountsResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listaccountsresponse.json"))
+      .build();
+   
+   protected final HttpRequest listNetworks = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listNetworks")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("account", "jclouds") // account and domain came from 
above
+      .addQueryParam("domainid", "457")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "FDiGGBiG/sVj0k6DmZIgMNU8SqI%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse listNetworksResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listnetworksresponse.json"))
+      .build();   
+   
+   protected final HttpResponse listNetworksWithSecurityGroupsResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listnetworksresponse-2.json"))
+      .build();   
+
+   protected final HttpRequest getZone = HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listZones")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("id", "1")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "q5GMO9iUYIFs5S58DdAuYAy8yu0%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse getZoneResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/getzoneresponse.json"))
+      .build();
+
+   protected final HttpRequest getZoneWithSecurityGroups = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listZones")
+      .addQueryParam("listAll", "true")
+      .addQueryParam("id", "2")
+      .addQueryParam("apiKey", "APIKEY")
+      .addQueryParam("signature", "FnYX25207fVLLRz5GhOfRrWuUek%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse getZoneWithSecurityGroupsResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/getzoneresponse-2.json"))
+      .build();
+   
+   protected final HttpRequest listCapabilities = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("listAll", "true")      
+      .addQueryParam("command", "listCapabilities")
+      .addQueryParam("apiKey", "APIKEY")      
+      .addQueryParam("signature", "vVdhtet/zG59FXgkYkAzEQQ4q1o%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse listCapabilitiesResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/listcapabilitiesresponse.json"))
+      .build();   
+         
+   protected final HttpRequest getSecurityGroup = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "listSecurityGroups")
+      .addQueryParam("listAll", "true")      
+      .addQueryParam("securitygroupname", "jclouds-test")      
+      .addQueryParam("apiKey", "APIKEY")      
+      .addQueryParam("signature", "zGp2rfHY6fBIGkgODRxyNzFfPFI%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse getSecurityGroupResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/getsecuritygroupresponse.json"))
+      .build();   
+
+   protected final HttpRequest createSecurityGroup = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "createSecurityGroup")
+      .addQueryParam("name", "jclouds-test")      
+      .addQueryParam("apiKey", "APIKEY")      
+      .addQueryParam("signature", "BdgmqGsvjPmP4PxsEKEpq6buwuA%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse createSecurityGroupResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/createsecuritygroupresponse.json"))
+      .build();   
+
+   protected final HttpRequest authorizeIngress = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "authorizeSecurityGroupIngress")
+      .addQueryParam("securitygroupid", "30")      
+      .addQueryParam("protocol", "TCP")
+      .addQueryParam("startport", "22")
+      .addQueryParam("endport", "22")
+      .addQueryParam("cidrlist", "0.0.0.0/0")
+      .addQueryParam("apiKey", "APIKEY")      
+      .addQueryParam("signature", "GVtXzAl/Q7z4wnvKEHtdV0lxv2o%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse authorizeIngressResponse = 
HttpResponse.builder().statusCode(200)
+      
.payload(payloadFromResource("/authorizesecuritygroupingressresponse.json"))
+      .build();   
+
+   protected final HttpRequest createSSHKeyPair = 
HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "createSSHKeyPair")
+      .addQueryParam("name", "jclouds-test")      
+      .addQueryParam("apiKey", "APIKEY")      
+      .addQueryParam("signature", "er6YjvUjPFwxy/x/aAVNW9Z8yo8%3D")
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final HttpResponse createSSHKeyPairResponse = 
HttpResponse.builder().statusCode(200)
+      .payload(payloadFromResource("/createsshkeypairresponse-2.json"))
+      .build();   
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
new file mode 100644
index 0000000..5237efc
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackExpectTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.cloudstack.internal;
+
+import static com.google.common.base.Charsets.UTF_8;
+import static com.google.common.hash.Hashing.md5;
+import static com.google.common.io.BaseEncoding.base16;
+import static org.jclouds.util.Strings2.urlEncode;
+
+import java.util.Properties;
+
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.cloudstack.CloudStackApiMetadata;
+import org.jclouds.cloudstack.CloudStackContext;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.http.HttpResponse;
+import org.jclouds.rest.internal.BaseRestClientExpectTest;
+
+import com.google.common.base.Function;
+import com.google.inject.Module;
+
+/**
+ * Base class for writing CloudStack Rest Client Expect tests
+ */
+public abstract class BaseCloudStackExpectTest<S> extends 
BaseRestClientExpectTest<S> {
+
+   public BaseCloudStackExpectTest() {
+      provider = "cloudstack";
+   }
+   
+   @Override
+   protected ApiMetadata createApiMetadata() {
+      return new CloudStackApiMetadata();
+   }
+
+   @Override
+   public S createClient(Function<HttpRequest, HttpResponse> fn, Module 
module, Properties props) {
+      return clientFrom(createInjector(fn, module, 
props).getInstance(CloudStackContext.class));
+   }
+
+   protected abstract S clientFrom(CloudStackContext context);
+
+   protected final HttpRequest login = HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "login")
+      .addQueryParam("username", "identity")
+      .addQueryParam("domain", "")
+      .addQueryParam("password", 
base16().lowerCase().encode(md5().hashString("credential", UTF_8).asBytes()))
+      .addHeader("Accept", "application/json")
+      .build();
+
+   protected final String jSessionId = "90DD65D13AEAA590ECCA312D150B9F6D";
+   protected final String sessionKey = "uYT4/MNiglgAKiZRQkvV8QP8gn0=";
+   
+   protected final HttpResponse loginResponse = 
HttpResponse.builder().statusCode(200)
+      .addHeader("Set-Cookie", "JSESSIONID=" + jSessionId + "; Path=/client")
+      .payload(payloadFromResource("/loginresponse.json"))
+      .build();
+
+   protected final HttpRequest logout = HttpRequest.builder().method("GET")
+      .endpoint("http://localhost:8080/client/api";)
+      .addQueryParam("response", "json")
+      .addQueryParam("command", "logout")
+      .addQueryParam("sessionkey", urlEncode(sessionKey))
+      .build();
+   
+   protected final HttpResponse logoutResponse = 
HttpResponse.builder().statusCode(200).build();
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentialsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentialsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentialsTest.java
new file mode 100644
index 0000000..8b13170
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/loaders/LoginWithPasswordCredentialsTest.java
@@ -0,0 +1,78 @@
+/*
+ * 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.cloudstack.loaders;
+
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import org.jclouds.cloudstack.domain.LoginResponse;
+import org.jclouds.cloudstack.features.SessionApi;
+import org.jclouds.domain.Credentials;
+import org.testng.annotations.Test;
+
+public class LoginWithPasswordCredentialsTest {
+
+   /**
+    * This test is different from the single domainname test as it included 
testing on how the 
+    * domainname is rebuild. It is here to prove that this particular test 
fails on systems
+    * with a different path separator.
+    */
+   @Test
+   public void testWithDoubleDomainname() {
+      LoginResponse response = createMock(LoginResponse.class);
+      SessionApi client = createMock(SessionApi.class);
+
+      expect(client.loginUserInDomainWithHashOfPassword(eq("User"), 
eq("Test/Domain"), (String) anyObject())).andReturn(response);
+      replay(client);
+
+      LoginWithPasswordCredentials obj = new 
LoginWithPasswordCredentials(client);
+      Credentials cred = new Credentials("Test/Domain/User", "koffiedik");
+
+      obj.load(cred);
+   }
+
+   @Test
+   public void testWithSingleDomainname() {
+      LoginResponse response = createMock(LoginResponse.class);
+      SessionApi client = createMock(SessionApi.class);
+
+      expect(client.loginUserInDomainWithHashOfPassword(eq("User"), 
eq("Domain"), (String) anyObject())).andReturn(response);
+      replay(client);
+
+      LoginWithPasswordCredentials obj = new 
LoginWithPasswordCredentials(client);
+      Credentials cred = new Credentials("Domain/User", "koffiedik");
+
+      obj.load(cred);
+   }
+
+   @Test
+   public void testWithNoDomainname() {
+       LoginResponse response = createMock(LoginResponse.class);
+       SessionApi client = createMock(SessionApi.class);
+
+       expect(client.loginUserInDomainWithHashOfPassword(eq("User"), eq(""), 
(String) anyObject())).andReturn(response);
+       replay(client);
+
+       LoginWithPasswordCredentials obj = new 
LoginWithPasswordCredentials(client);
+       Credentials cred = new Credentials("User", "koffiedik");
+
+       obj.load(cred);
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddClusterOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddClusterOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddClusterOptionsTest.java
new file mode 100644
index 0000000..39aef2f
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddClusterOptionsTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.AddClusterOptions.Builder.allocationState;
+import static 
org.jclouds.cloudstack.options.AddClusterOptions.Builder.password;
+import static org.jclouds.cloudstack.options.AddClusterOptions.Builder.podId;
+import static org.jclouds.cloudstack.options.AddClusterOptions.Builder.url;
+import static 
org.jclouds.cloudstack.options.AddClusterOptions.Builder.username;
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.cloudstack.domain.AllocationState;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Tests behavior of {@code AddClusterOptions}
+ */
+@Test(groups = "unit")
+public class AddClusterOptionsTest {
+
+   public void testAllocationState() {
+      AddClusterOptions options = new 
AddClusterOptions().allocationState(AllocationState.ENABLED);
+      assertEquals(ImmutableList.of("Enabled"), 
options.buildQueryParameters().get("allocationstate"));
+   }
+
+   public void testAllocationStateStatic() {
+      AddClusterOptions options = allocationState(AllocationState.ENABLED);
+      assertEquals(ImmutableList.of("Enabled"), 
options.buildQueryParameters().get("allocationstate"));
+   }
+
+   public void testPassword() {
+      AddClusterOptions options = new AddClusterOptions().password("sekrit");
+      assertEquals(ImmutableList.of("sekrit"), 
options.buildQueryParameters().get("password"));
+   }
+
+   public void testPasswordStatic() {
+      AddClusterOptions options = password("sekrit");
+      assertEquals(ImmutableList.of("sekrit"), 
options.buildQueryParameters().get("password"));
+   }
+
+   public void testPodId() {
+      AddClusterOptions options = new AddClusterOptions().podId("42");
+      assertEquals(ImmutableList.of("42"), 
options.buildQueryParameters().get("podid"));
+   }
+
+   public void testPodIdStatic() {
+      AddClusterOptions options = podId("42");
+      assertEquals(ImmutableList.of("42"), 
options.buildQueryParameters().get("podid"));
+   }
+
+   public void testUrl() {
+      AddClusterOptions options = new 
AddClusterOptions().url("http://example.com";);
+      assertEquals(ImmutableList.of("http://example.com";), 
options.buildQueryParameters().get("url"));
+   }
+
+   public void testUrlStatic() {
+      AddClusterOptions options = url("http://example.com";);
+      assertEquals(ImmutableList.of("http://example.com";), 
options.buildQueryParameters().get("url"));
+   }
+
+   public void testUsername() {
+      AddClusterOptions options = new AddClusterOptions().username("fred");
+      assertEquals(ImmutableList.of("fred"), 
options.buildQueryParameters().get("username"));
+   }
+
+   public void testUsernameStatic() {
+      AddClusterOptions options = username("fred");
+      assertEquals(ImmutableList.of("fred"), 
options.buildQueryParameters().get("username"));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddHostOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddHostOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddHostOptionsTest.java
new file mode 100644
index 0000000..97f1537
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddHostOptionsTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.AddHostOptions.Builder.allocationState;
+import static org.jclouds.cloudstack.options.AddHostOptions.Builder.clusterId;
+import static 
org.jclouds.cloudstack.options.AddHostOptions.Builder.clusterName;
+import static org.jclouds.cloudstack.options.AddHostOptions.Builder.hostTags;
+import static org.jclouds.cloudstack.options.AddHostOptions.Builder.podId;
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.cloudstack.domain.AllocationState;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code AddHostOptions}
+ */
+@Test(groups = "unit")
+public class AddHostOptionsTest {
+
+   public void testAllocationState() {
+      AddHostOptions options = new 
AddHostOptions().allocationState(AllocationState.ENABLED);
+      assertEquals(ImmutableList.of("Enabled"), 
options.buildQueryParameters().get("allocationstate"));
+   }
+
+   public void testAllocationStateStatic() {
+      AddHostOptions options = allocationState(AllocationState.ENABLED);
+      assertEquals(ImmutableList.of("Enabled"), 
options.buildQueryParameters().get("allocationstate"));
+   }
+
+   public void testClusterId() {
+      AddHostOptions options = new AddHostOptions().clusterId("42");
+      assertEquals(ImmutableList.of("42"), 
options.buildQueryParameters().get("clusterid"));
+   }
+
+   public void testClusterIdStatic() {
+      AddHostOptions options = clusterId("42");
+      assertEquals(ImmutableList.of("42"), 
options.buildQueryParameters().get("clusterid"));
+   }
+
+   public void testClusterName() {
+      AddHostOptions options = new AddHostOptions().clusterName("Cluster 
Name");
+      assertEquals(ImmutableList.of("Cluster Name"), 
options.buildQueryParameters().get("clustername"));
+   }
+
+   public void testClusterNameStatic() {
+      AddHostOptions options = clusterName("Cluster Name");
+      assertEquals(ImmutableList.of("Cluster Name"), 
options.buildQueryParameters().get("clustername"));
+   }
+
+   public void testHostTags() {
+      AddHostOptions options = new 
AddHostOptions().hostTags(ImmutableSet.<String>of("foo", "bar", "baz"));
+      assertEquals(ImmutableList.of("foo,bar,baz"), 
options.buildQueryParameters().get("hosttags"));
+   }
+
+   public void testHostTagsStatic() {
+      AddHostOptions options = hostTags(ImmutableSet.<String>of("foo", "bar", 
"baz"));
+      assertEquals(ImmutableList.of("foo,bar,baz"), 
options.buildQueryParameters().get("hosttags"));
+   }
+
+   public void testPodId() {
+      AddHostOptions options = new AddHostOptions().podId("42");
+      assertEquals(ImmutableList.of("42"), 
options.buildQueryParameters().get("podid"));
+   }
+
+   public void testPodIdStatic() {
+      AddHostOptions options = podId("42");
+      assertEquals(ImmutableList.of("42"), 
options.buildQueryParameters().get("podid"));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddSecondaryStorageOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddSecondaryStorageOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddSecondaryStorageOptionsTest.java
new file mode 100644
index 0000000..4f63aff
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AddSecondaryStorageOptionsTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.AddSecondaryStorageOptions.Builder.zoneId;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Tests behavior of {@code AddSecondaryStorageOptions}
+ */
+@Test(groups = "unit")
+public class AddSecondaryStorageOptionsTest {
+
+   public void testZoneId() {
+      AddSecondaryStorageOptions options = new 
AddSecondaryStorageOptions().zoneId("6");
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("zoneid"));
+   }
+
+   public void testZoneIdStatic() {
+      AddSecondaryStorageOptions options = zoneId("6");
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("zoneid"));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AssociateIPAddressOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AssociateIPAddressOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AssociateIPAddressOptionsTest.java
new file mode 100644
index 0000000..397e94f
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/AssociateIPAddressOptionsTest.java
@@ -0,0 +1,54 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.AssociateIPAddressOptions.Builder.accountInDomain;
+import static 
org.jclouds.cloudstack.options.AssociateIPAddressOptions.Builder.networkId;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Tests behavior of {@code AssociateIPAddressOptions}
+ */
+@Test(groups = "unit")
+public class AssociateIPAddressOptionsTest {
+
+   public void testAccountInDomainId() {
+      AssociateIPAddressOptions options = new 
AssociateIPAddressOptions().accountInDomain("adrian", "6");
+      assertEquals(ImmutableList.of("adrian"), 
options.buildQueryParameters().get("account"));
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("domainid"));
+   }
+
+   public void testAccountInDomainIdStatic() {
+      AssociateIPAddressOptions options = accountInDomain("adrian", "6");
+      assertEquals(ImmutableList.of("adrian"), 
options.buildQueryParameters().get("account"));
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("domainid"));
+   }
+
+   public void testNetworkId() {
+      AssociateIPAddressOptions options = new 
AssociateIPAddressOptions().networkId("6");
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("networkid"));
+   }
+
+   public void testNetworkIdStatic() {
+      AssociateIPAddressOptions options = networkId("6");
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("networkid"));
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateAccountOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateAccountOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateAccountOptionsTest.java
new file mode 100644
index 0000000..c669b3d
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateAccountOptionsTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.CreateAccountOptions.Builder.account;
+import static 
org.jclouds.cloudstack.options.CreateAccountOptions.Builder.domainId;
+import static 
org.jclouds.cloudstack.options.CreateAccountOptions.Builder.networkDomain;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code CreateAccountOptions}
+ */
+@Test(groups = "unit")
+public class CreateAccountOptionsTest {
+
+   public void testNetworkDomain() {
+      CreateAccountOptions options = new 
CreateAccountOptions().networkDomain("net");
+      assertEquals(ImmutableSet.of("net"), 
options.buildQueryParameters().get("networkdomain"));
+   }
+
+   public void testNetworkDomainStatic() {
+      CreateAccountOptions options = networkDomain("net");
+      assertEquals(ImmutableSet.of("net"), 
options.buildQueryParameters().get("networkdomain"));
+   }
+
+   public void testAccount() {
+      CreateAccountOptions options = new 
CreateAccountOptions().account("accountName");
+      assertEquals(ImmutableSet.of("accountName"), 
options.buildQueryParameters().get("account"));
+   }
+
+   public void testAccountStatic() {
+      CreateAccountOptions options = account("accountName");
+      assertEquals(ImmutableSet.of("accountName"), 
options.buildQueryParameters().get("account"));
+   }
+
+   public void testAccountDomain() {
+      CreateAccountOptions options = new CreateAccountOptions().domainId("6");
+      assertEquals(ImmutableSet.of("6"), 
options.buildQueryParameters().get("domainid"));
+   }
+
+   public void testDomainIdStatic() {
+      CreateAccountOptions options = domainId("6");
+      assertEquals(ImmutableSet.of("6"), 
options.buildQueryParameters().get("domainid"));
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateDiskOfferingOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateDiskOfferingOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateDiskOfferingOptionsTest.java
new file mode 100644
index 0000000..e82238e
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateDiskOfferingOptionsTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.CreateDiskOfferingOptions.Builder.customized;
+import static 
org.jclouds.cloudstack.options.CreateDiskOfferingOptions.Builder.diskSizeInGB;
+import static 
org.jclouds.cloudstack.options.CreateDiskOfferingOptions.Builder.tags;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code CreateDiskOfferingOptions}
+ */
+@Test(groups = "unit")
+public class CreateDiskOfferingOptionsTest {
+
+   public void testTags() {
+      CreateDiskOfferingOptions options =
+         new CreateDiskOfferingOptions().tags(ImmutableSet.<String>of("tag1", 
"tag2"));
+      assertEquals(ImmutableSet.of("tag1", "tag2"), 
options.buildQueryParameters().get("tags"));
+   }
+
+   public void testTagsStatic() {
+      CreateDiskOfferingOptions options = tags(ImmutableSet.<String>of("tag1", 
"tag2"));
+      assertEquals(ImmutableSet.of("tag1", "tag2"), 
options.buildQueryParameters().get("tags"));
+   }
+
+   public void testCustomized() {
+      CreateDiskOfferingOptions options =
+         new CreateDiskOfferingOptions().customized(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("customized"));
+   }
+
+   public void testCustomizedStatic() {
+      CreateDiskOfferingOptions options = customized(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("customized"));
+   }
+
+   public void testDiskSizeInGB() {
+      CreateDiskOfferingOptions options =
+         new CreateDiskOfferingOptions().diskSizeInGB(100);
+      assertEquals(ImmutableSet.of("100"), 
options.buildQueryParameters().get("disksize"));
+   }
+
+   public void testDiskSizeInGBStatic() {
+      CreateDiskOfferingOptions options = diskSizeInGB(100);
+      assertEquals(ImmutableSet.of("100"), 
options.buildQueryParameters().get("disksize"));
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateIPForwardingRuleOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateIPForwardingRuleOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateIPForwardingRuleOptionsTest.java
new file mode 100644
index 0000000..df813f2
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateIPForwardingRuleOptionsTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.CreateIPForwardingRuleOptions.Builder.endPort;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Tests behavior of {@code CreateIPForwardingRuleOptions}
+ */
+@Test(groups = "unit")
+public class CreateIPForwardingRuleOptionsTest {
+
+   public void testNetworkId() {
+      CreateIPForwardingRuleOptions options = new 
CreateIPForwardingRuleOptions().endPort(6);
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("endport"));
+   }
+
+   public void testNetworkIdStatic() {
+      CreateIPForwardingRuleOptions options = endPort(6);
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("endport"));
+   }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateNetworkOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateNetworkOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateNetworkOptionsTest.java
new file mode 100644
index 0000000..76bbef4
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateNetworkOptionsTest.java
@@ -0,0 +1,132 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.accountInDomain;
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.endIP;
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.gateway;
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.isDefault;
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.isShared;
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.netmask;
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.networkDomain;
+import static 
org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.startIP;
+import static org.jclouds.cloudstack.options.CreateNetworkOptions.Builder.vlan;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Tests behavior of {@code CreateNetworkOptions}
+ */
+@Test(groups = "unit")
+public class CreateNetworkOptionsTest {
+
+   public void testAccountInDomainId() {
+      CreateNetworkOptions options = new 
CreateNetworkOptions().accountInDomain("adrian", "6");
+      assertEquals(ImmutableList.of("adrian"), 
options.buildQueryParameters().get("account"));
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("domainid"));
+   }
+
+   public void testAccountInDomainIdStatic() {
+      CreateNetworkOptions options = accountInDomain("adrian", "6");
+      assertEquals(ImmutableList.of("adrian"), 
options.buildQueryParameters().get("account"));
+      assertEquals(ImmutableList.of("6"), 
options.buildQueryParameters().get("domainid"));
+   }
+
+   public void testIsDefault() {
+      CreateNetworkOptions options = new 
CreateNetworkOptions().isDefault(true);
+      assertEquals(ImmutableList.of("true"), 
options.buildQueryParameters().get("isdefault"));
+   }
+
+   public void testIsDefaultStatic() {
+      CreateNetworkOptions options = isDefault(true);
+      assertEquals(ImmutableList.of("true"), 
options.buildQueryParameters().get("isdefault"));
+   }
+
+   public void testIsShared() {
+      CreateNetworkOptions options = new CreateNetworkOptions().isShared(true);
+      assertEquals(ImmutableList.of("true"), 
options.buildQueryParameters().get("isshared"));
+   }
+
+   public void testIsSharedStatic() {
+      CreateNetworkOptions options = isShared(true);
+      assertEquals(ImmutableList.of("true"), 
options.buildQueryParameters().get("isshared"));
+   }
+
+   public void testStartIP() {
+      CreateNetworkOptions options = new 
CreateNetworkOptions().startIP("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("startip"));
+   }
+
+   public void testStartIPStatic() {
+      CreateNetworkOptions options = startIP("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("startip"));
+   }
+
+   public void testEndIP() {
+      CreateNetworkOptions options = new 
CreateNetworkOptions().endIP("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("endip"));
+   }
+
+   public void testEndIPStatic() {
+      CreateNetworkOptions options = endIP("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("endip"));
+   }
+
+   public void testGateway() {
+      CreateNetworkOptions options = new 
CreateNetworkOptions().gateway("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("gateway"));
+   }
+
+   public void testGatewayStatic() {
+      CreateNetworkOptions options = gateway("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("gateway"));
+   }
+
+   public void testNetmask() {
+      CreateNetworkOptions options = new 
CreateNetworkOptions().netmask("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("netmask"));
+   }
+
+   public void testNetmaskStatic() {
+      CreateNetworkOptions options = netmask("1.1.1.1");
+      assertEquals(ImmutableList.of("1.1.1.1"), 
options.buildQueryParameters().get("netmask"));
+   }
+
+   public void testNetworkDomain() {
+      CreateNetworkOptions options = new 
CreateNetworkOptions().networkDomain("network.com");
+      assertEquals(ImmutableList.of("network.com"), 
options.buildQueryParameters().get("networkdomain"));
+   }
+
+   public void testNetworkDomainStatic() {
+      CreateNetworkOptions options = networkDomain("network.com");
+      assertEquals(ImmutableList.of("network.com"), 
options.buildQueryParameters().get("networkdomain"));
+   }
+
+   public void testVlan() {
+      CreateNetworkOptions options = new CreateNetworkOptions().vlan("tag");
+      assertEquals(ImmutableList.of("tag"), 
options.buildQueryParameters().get("vlan"));
+   }
+
+   public void testVlanStatic() {
+      CreateNetworkOptions options = vlan("tag");
+      assertEquals(ImmutableList.of("tag"), 
options.buildQueryParameters().get("vlan"));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreatePodOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreatePodOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreatePodOptionsTest.java
new file mode 100644
index 0000000..cae2b06
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreatePodOptionsTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.CreatePodOptions.Builder.allocationState;
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.cloudstack.domain.AllocationState;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableList;
+
+/**
+ * Tests behavior of {@code CreatePodOptions}
+ */
+@Test(groups = "unit")
+public class CreatePodOptionsTest {
+
+   public void testAllocationState() {
+      CreatePodOptions options = new 
CreatePodOptions().allocationState(AllocationState.ENABLED);
+      assertEquals(ImmutableList.of("Enabled"), 
options.buildQueryParameters().get("allocationstate"));
+   }
+
+   public void testAllocationStateStatic() {
+      CreatePodOptions options = allocationState(AllocationState.ENABLED);
+      assertEquals(ImmutableList.of("Enabled"), 
options.buildQueryParameters().get("allocationstate"));
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateServiceOfferingOptionsTest.java
----------------------------------------------------------------------
diff --git 
a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateServiceOfferingOptionsTest.java
 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateServiceOfferingOptionsTest.java
new file mode 100644
index 0000000..3e7ec4b
--- /dev/null
+++ 
b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateServiceOfferingOptionsTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.cloudstack.options;
+
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.highlyAvailable;
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.hostTags;
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.isSystem;
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.limitCpuUse;
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.networkRateInMb;
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.storageType;
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.systemVmType;
+import static 
org.jclouds.cloudstack.options.CreateServiceOfferingOptions.Builder.tags;
+import static org.testng.Assert.assertEquals;
+
+import org.jclouds.cloudstack.domain.StorageType;
+import org.jclouds.cloudstack.domain.SystemVmType;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+/**
+ * Tests behavior of {@code CreateServiceOfferingOptions}
+ */
+@Test(groups = "unit")
+public class CreateServiceOfferingOptionsTest {
+
+   public void testHostTags() {
+      CreateServiceOfferingOptions options =
+         new CreateServiceOfferingOptions().hostTags(ImmutableSet.of("tag1", 
"tag2"));
+      assertEquals(ImmutableSet.of("tag1", "tag2"), 
options.buildQueryParameters().get("hosttags"));
+   }
+
+   public void testHostTagsStatic() {
+      CreateServiceOfferingOptions options = hostTags(ImmutableSet.of("tag1", 
"tag2"));
+      assertEquals(ImmutableSet.of("tag1", "tag2"), 
options.buildQueryParameters().get("hosttags"));
+   }
+
+   public void testIsSystem() {
+      CreateServiceOfferingOptions options = new 
CreateServiceOfferingOptions().isSystem(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("issystem"));
+   }
+
+   public void testIsSystemStatic() {
+      CreateServiceOfferingOptions options = isSystem(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("issystem"));
+   }
+
+   public void testLimitCpuUse() {
+      CreateServiceOfferingOptions options = new 
CreateServiceOfferingOptions().limitCpuUse(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("limitcpuuse"));
+   }
+
+   public void testLimitCpuUseStatic() {
+      CreateServiceOfferingOptions options = limitCpuUse(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("limitcpuuse"));
+   }
+
+   public void testNetworkRate() {
+      CreateServiceOfferingOptions options = new 
CreateServiceOfferingOptions().networkRateInMb(200);
+      assertEquals(ImmutableSet.of("200"), 
options.buildQueryParameters().get("networkrate"));
+   }
+
+   public void testNetworkRateStatic() {
+      CreateServiceOfferingOptions options = networkRateInMb(200);
+      assertEquals(ImmutableSet.of("200"), 
options.buildQueryParameters().get("networkrate"));
+   }
+
+   public void testHighlyAvailable() {
+      CreateServiceOfferingOptions options = new 
CreateServiceOfferingOptions().highlyAvailable(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("offerha"));
+   }
+
+   public void testHighlyAvailableStatic() {
+      CreateServiceOfferingOptions options = highlyAvailable(true);
+      assertEquals(ImmutableSet.of("true"), 
options.buildQueryParameters().get("offerha"));
+   }
+
+   public void testStorageType() {
+      CreateServiceOfferingOptions options = new 
CreateServiceOfferingOptions().storageType(StorageType.LOCAL);
+      assertEquals(ImmutableSet.of("local"), 
options.buildQueryParameters().get("storagetype"));
+   }
+
+   public void testStorageTypeStatic() {
+      CreateServiceOfferingOptions options = storageType(StorageType.LOCAL);
+      assertEquals(ImmutableSet.of("local"), 
options.buildQueryParameters().get("storagetype"));
+   }
+
+   public void testSystemVmType() {
+      CreateServiceOfferingOptions options =
+         new 
CreateServiceOfferingOptions().systemVmType(SystemVmType.DOMAIN_ROUTER);
+      assertEquals(ImmutableSet.of("domainrouter"), 
options.buildQueryParameters().get("systemvmtype"));
+   }
+
+   public void testSystemVmTypeStatic() {
+      CreateServiceOfferingOptions options = 
systemVmType(SystemVmType.DOMAIN_ROUTER);
+      assertEquals(ImmutableSet.of("domainrouter"), 
options.buildQueryParameters().get("systemvmtype"));
+   }
+
+   public void testTags() {
+      CreateServiceOfferingOptions options =
+         new 
CreateServiceOfferingOptions().tags(ImmutableSet.<String>of("tag1", "tag2"));
+      assertEquals(ImmutableSet.of("tag1", "tag2"), 
options.buildQueryParameters().get("tags"));
+   }
+
+   public void testTagsStatic() {
+      CreateServiceOfferingOptions options = 
tags(ImmutableSet.<String>of("tag1", "tag2"));
+      assertEquals(ImmutableSet.of("tag1", "tag2"), 
options.buildQueryParameters().get("tags"));
+   }
+}

Reply via email to