prevent credentialstore from leaking across tests

This commit is contained in:
Adrian Cole 2012-05-18 20:56:36 -07:00
parent 38bfb906d1
commit d3ddd57526
2 changed files with 11 additions and 1 deletions

View File

@ -158,7 +158,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseVersionedServiceLiv
context.close();
Properties props = setupProperties();
context = new ComputeServiceContextFactory(setupRestProperties()).createContext(provider,
ImmutableSet.of(new Log4JLoggingModule(), getSshModule()), props);
ImmutableSet.of(new Log4JLoggingModule(), credentialStoreModule, getSshModule()), props);
client = context.getComputeService();
}

View File

@ -18,15 +18,21 @@
*/
package org.jclouds.compute;
import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.domain.LoginCredentials.Builder;
import org.jclouds.io.CopyInputStreamInputSupplierMap;
import org.jclouds.rest.config.CredentialStoreModule;
import org.jclouds.rest.BaseRestClientLiveTest;
import org.testng.annotations.BeforeClass;
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.io.InputSupplier;
import com.google.inject.Module;
/**
*
@ -39,6 +45,10 @@ public abstract class BaseVersionedServiceLiveTest extends BaseRestClientLiveTes
protected String authenticateSudo;
protected LoginCredentials loginCredentials = LoginCredentials.builder().user("root").build();
// isolate tests from eachother, as default credentialStore is static
protected Module credentialStoreModule = new CredentialStoreModule(new CopyInputStreamInputSupplierMap(
new ConcurrentHashMap<String, InputSupplier<InputStream>>()));
@Override
protected Properties setupProperties() {
Properties overrides= super.setupProperties();