From d3ddd5752649d99aab480c8547b875452e3fba1a Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 18 May 2012 20:56:36 -0700 Subject: [PATCH] prevent credentialstore from leaking across tests --- .../jclouds/compute/BaseComputeServiceLiveTest.java | 2 +- .../jclouds/compute/BaseVersionedServiceLiveTest.java | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java b/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java index f2dd242894..58f986f8d9 100644 --- a/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/BaseComputeServiceLiveTest.java @@ -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(); } diff --git a/compute/src/test/java/org/jclouds/compute/BaseVersionedServiceLiveTest.java b/compute/src/test/java/org/jclouds/compute/BaseVersionedServiceLiveTest.java index c02573e522..941855a541 100644 --- a/compute/src/test/java/org/jclouds/compute/BaseVersionedServiceLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/BaseVersionedServiceLiveTest.java @@ -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>())); + @Override protected Properties setupProperties() { Properties overrides= super.setupProperties();