some changes to facilitate subclassed client tests which access generic compute service functionality

This commit is contained in:
Alex Heneveld 2011-12-02 14:38:07 +00:00
parent 723dd61c33
commit 3a2b34665c
1 changed files with 9 additions and 5 deletions

View File

@ -49,6 +49,7 @@ import org.jclouds.cloudstack.predicates.VirtualMachineDestroyed;
import org.jclouds.cloudstack.predicates.VirtualMachineRunning;
import org.jclouds.cloudstack.strategy.BlockUntilJobCompletesAndReturnResult;
import org.jclouds.compute.BaseVersionedServiceLiveTest;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.ExecResponse;
import org.jclouds.domain.Credentials;
@ -130,6 +131,7 @@ public class BaseCloudStackClientLiveTest extends BaseVersionedServiceLiveTest {
protected String prefix = System.getProperty("user.name");
protected CloudStackContext computeContext;
protected ComputeService computeClient;
protected RestContext<CloudStackClient, CloudStackAsyncClient> context;
protected CloudStackClient client;
protected CloudStackClient adminClient;
@ -173,8 +175,10 @@ public class BaseCloudStackClientLiveTest extends BaseVersionedServiceLiveTest {
public void setupClient() {
setupCredentials();
computeContext = CloudStackContext.class.cast(new ComputeServiceContextFactory().createContext(provider,
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()), setupProperties()));
computeContext = CloudStackContext.class.cast(new ComputeServiceContextFactory(setupRestProperties()).
createContext(provider, ImmutableSet.<Module> of(
new Log4JLoggingModule(), new SshjSshClientModule()), setupProperties()));
computeClient = computeContext.getComputeService();
context = computeContext.getProviderSpecificContext();
client = context.getApi();
user = verifyCurrentUserIsOfType(context, Account.Type.USER);
@ -182,9 +186,9 @@ public class BaseCloudStackClientLiveTest extends BaseVersionedServiceLiveTest {
domainAdminEnabled = setupAdminProperties() != null;
if (domainAdminEnabled) {
domainAdminComputeContext = CloudStackContext.class.cast(new ComputeServiceContextFactory().createContext(
provider, ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule()),
setupAdminProperties()));
domainAdminComputeContext = CloudStackContext.class.cast(new ComputeServiceContextFactory(setupRestProperties()).
createContext(provider, ImmutableSet.<Module> of(
new Log4JLoggingModule(), new SshjSshClientModule()), setupAdminProperties()));
domainAdminContext = domainAdminComputeContext.getDomainContext();
domainAdminClient = domainAdminContext.getApi();
domainAdminUser = verifyCurrentUserIsOfType(domainAdminContext, Account.Type.DOMAIN_ADMIN);