JCLOUDS-1225: Address Guava 18 MoreExecutors changes

Fixed with:

find -name \*.java | xargs sed -i 's/sameThreadExecutor/newDirectExecutorService/g'
This commit is contained in:
Andrew Gaul 2017-08-21 14:02:08 -07:00
parent a493e2ca2f
commit 517323fbd5
24 changed files with 48 additions and 48 deletions

View File

@ -18,7 +18,7 @@ package org.jclouds.ec2.internal;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static javax.ws.rs.core.MediaType.APPLICATION_XML;
import static org.jclouds.util.Strings2.toStringAndClose;
import static org.testng.Assert.assertEquals;
@ -71,7 +71,7 @@ public class BaseEC2ApiMockTest {
.modules(modules);
}
private final Set<Module> modules = ImmutableSet.<Module>of(new ExecutorServiceModule(sameThreadExecutor()));
private final Set<Module> modules = ImmutableSet.<Module>of(new ExecutorServiceModule(newDirectExecutorService()));
@BeforeMethod
public void start() throws IOException {

View File

@ -102,7 +102,7 @@ public class ElasticStackComputeServiceAdapterTest {
replay(api);
ElasticStackComputeServiceAdapter adapter = new ElasticStackComputeServiceAdapter(api, driveNotClaimed,
preInstalledImageSupplier, driveCache, "12345678", MoreExecutors.sameThreadExecutor());
preInstalledImageSupplier, driveCache, "12345678", MoreExecutors.newDirectExecutorService());
try {
adapter.createNodeWithGroupEncodedIntoName("mock-group", "mock-name", template);

View File

@ -18,7 +18,7 @@ package org.jclouds.oauth.v2;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.io.BaseEncoding.base64Url;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
import static org.jclouds.oauth.v2.config.CredentialType.P12_PRIVATE_KEY_CREDENTIALS;
@ -235,7 +235,7 @@ public class AuthorizationApiMockTest {
.credentials("foo", toStringAndClose(OAuthTestUtils.class.getResourceAsStream("/testpk.pem")))
.endpoint(url.toString())
.overrides(overrides)
.modules(ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor()), new OAuthModule(), new Module() {
.modules(ImmutableSet.of(new ExecutorServiceModule(newDirectExecutorService()), new OAuthModule(), new Module() {
@Override public void configure(Binder binder) {
binder.bind(OAuthScopes.class).toInstance(SingleScope.create(SCOPE));
}

View File

@ -16,7 +16,7 @@
*/
package org.jclouds.openstack.v2_0.internal;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
@ -58,7 +58,7 @@ public class BaseOpenStackMockTest<A extends Closeable> {
public static final String accessRackspace = "{\"access\":{\"token\":{\"id\":\"b84f4a37-5126-4603-9521-ccd0665fbde1\",\"expires\":\"2013-04-13T16:49:57.000-05:00\",\"tenant\":{\"id\":\"123123\",\"name\":\"123123\"}},\"serviceCatalog\":[{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudMonitoring\",\"type\":\"rax:monitor\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFilesCDN\",\"type\":\"rax:object-cdn\"},{\"endpoints\":[{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudLoadBalancers\",\"type\":\"rax:load-balancer\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDatabases\",\"type\":\"rax:database\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"},{\"region\":\"ORD\",\"tenantId\":\"MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"publicURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\",\"internalURL\":\"URL/v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9\"}],\"name\":\"cloudFiles\",\"type\":\"object-store\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\",\"versionInfo\":\"URL/v1.0\",\"versionList\":\"URL/\",\"versionId\":\"1.0\"}],\"name\":\"cloudServers\",\"type\":\"compute\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v2/123123\",\"versionInfo\":\"URL/v2\",\"versionList\":\"URL/\",\"versionId\":\"2\"}],\"name\":\"cloudServersOpenStack\",\"type\":\"compute\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudDNS\",\"type\":\"rax:dns\"},{\"endpoints\":[{\"tenantId\":\"123123\",\"publicURL\":\"URL/v1.0/123123\"}],\"name\":\"cloudBackup\",\"type\":\"rax:backup\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\"}],\"name\":\"cloudBlockStorage\",\"type\":\"volume\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"}],\"name\":\"zaqar\",\"type\":\"messaging\"},{\"endpoints\":[{\"region\":\"DFW\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"},{\"region\":\"ORD\",\"tenantId\":\"123123\",\"publicURL\":\"URL/v1/123123\",\"internalURL\":\"URL/v1/123123\"}],\"name\":\"autoscale\",\"type\":\"rax:autoscale\"}],\"user\":{\"id\":\"1234\",\"roles\":[{\"id\":\"3\",\"description\":\"User Admin Role.\",\"name\":\"identity:user-admin\"}],\"name\":\"jclouds-joe\",\"RAX-AUTH:defaultRegion\":\"DFW\"}}}";
private final Set<Module> modules = ImmutableSet.<Module> of(
new ExecutorServiceModule(sameThreadExecutor()));
new ExecutorServiceModule(newDirectExecutorService()));
/**
* Pattern for replacing the URL token with the correct local address.

View File

@ -16,7 +16,7 @@
*/
package org.jclouds.openstack.swift.v1;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.assertj.core.api.Assertions.assertThat;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
@ -93,7 +93,7 @@ public class TempAuthMockTest {
.credentials("user", "password")
.endpoint(authUrl)
.overrides(overrides)
.modules(ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor())))
.modules(ImmutableSet.of(new ExecutorServiceModule(newDirectExecutorService())))
.buildApi(SwiftApi.class);
}

View File

@ -19,7 +19,7 @@ package org.jclouds.s3;
import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
import static com.google.common.net.HttpHeaders.ETAG;
import static com.google.common.net.HttpHeaders.EXPECT;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
import static org.testng.Assert.assertEquals;
@ -46,7 +46,7 @@ import com.squareup.okhttp.mockwebserver.RecordedRequest;
public class S3ClientMockTest {
private static final Set<Module> modules = ImmutableSet.<Module> of(new OkHttpCommandExecutorServiceModule(),
new ExecutorServiceModule(sameThreadExecutor()));
new ExecutorServiceModule(newDirectExecutorService()));
static S3Client getS3Client(URL server) {
Properties overrides = new Properties();

View File

@ -16,7 +16,7 @@
*/
package org.jclouds.s3.blobstore.functions;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.testng.Assert.assertEquals;
import org.jclouds.blobstore.domain.MutableStorageMetadata;
@ -49,7 +49,7 @@ public class BucketsToStorageMetadataTest {
public void test() {
BucketsToStorageMetadata fn = new BucketsToStorageMetadata(
sameThreadExecutor(),
newDirectExecutorService(),
new BucketToResourceMetadata(Functions.forMap(ImmutableMap.<String, Location> of("mycontainer", region))));
MutableStorageMetadata expected = new MutableStorageMetadataImpl();

View File

@ -16,7 +16,7 @@
*/
package org.jclouds.sqs.features;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.jclouds.providers.AnonymousProviderMetadata.forApiOnEndpoint;
import static org.jclouds.sqs.reference.SQSParameters.ACTION;
import static org.testng.Assert.assertEquals;
@ -91,7 +91,7 @@ public class PermissionApiLiveTest extends BaseSQSApiLiveTest {
private AnonymousAttributesApi getAnonymousAttributesApi(URI queue) {
return ContextBuilder.newBuilder(forApiOnEndpoint(AnonymousAttributesApi.class, queue.toASCIIString()))
.modules(ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor())))
.modules(ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService())))
.buildApi(AnonymousAttributesApi.class);
}

View File

@ -43,7 +43,7 @@ public class PutOptions implements Cloneable {
private boolean useCustomExecutor = false;
// TODO: This exposes ListeningExecutorService to the user, instead of a regular ExecutorService
private ListeningExecutorService customExecutor = MoreExecutors.sameThreadExecutor();
private ListeningExecutorService customExecutor = MoreExecutors.newDirectExecutorService();
public PutOptions() {
}

View File

@ -132,7 +132,7 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutputTest {
EventBus eventBus = new EventBus();
public void testExitStatusZeroReturnsExecResponse() throws InterruptedException, ExecutionException {
ListeningExecutorService userExecutor = MoreExecutors.sameThreadExecutor();
ListeningExecutorService userExecutor = MoreExecutors.newDirectExecutorService();
Predicate<String> notRunningAnymore = Predicates.alwaysTrue();
SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction")
.addMockedMethod("getStatement").addMockedMethod("getNode").addMockedMethod("toString")
@ -160,7 +160,7 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutputTest {
public void testFirstExitStatusOneButSecondExitStatusZeroReturnsExecResponse() throws InterruptedException,
ExecutionException {
ListeningExecutorService userExecutor = MoreExecutors.sameThreadExecutor();
ListeningExecutorService userExecutor = MoreExecutors.newDirectExecutorService();
Predicate<String> notRunningAnymore = Predicates.alwaysTrue();
SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction")
@ -194,7 +194,7 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutputTest {
}
public void testCancelInterruptStopsCommand() throws InterruptedException, ExecutionException {
ListeningExecutorService userExecutor = MoreExecutors.sameThreadExecutor();
ListeningExecutorService userExecutor = MoreExecutors.newDirectExecutorService();
Predicate<String> notRunningAnymore = Predicates.alwaysTrue();
SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod(
"refreshAndRunAction").addMockedMethod("runAction").addMockedMethod("getStatement").addMockedMethod(
@ -239,7 +239,7 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutputTest {
public void testCancelDontInterruptLeavesCommandRunningAndReturnsLastStatus() throws InterruptedException,
ExecutionException {
ListeningExecutorService userExecutor = MoreExecutors.sameThreadExecutor();
ListeningExecutorService userExecutor = MoreExecutors.newDirectExecutorService();
Predicate<String> notRunningAnymore = Predicates.alwaysTrue();
SudoAwareInitManager commandRunner = createMockBuilder(SudoAwareInitManager.class).addMockedMethod("runAction")
.addMockedMethod("getStatement").addMockedMethod("getNode").addMockedMethod("toString")

View File

@ -16,7 +16,7 @@
*/
package org.jclouds.compute.callables;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.inject.name.Names.named;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
@ -51,7 +51,7 @@ import com.google.inject.assistedinject.FactoryModuleBuilder;
@Test(groups = "unit", singleThreaded = true, testName = "RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest")
public class RunScriptOnNodeAsInitScriptUsingSshAndBlockUntilCompleteTest {
Injector injector = Guice.createInjector(new ExecutorServiceModule(sameThreadExecutor()),
Injector injector = Guice.createInjector(new ExecutorServiceModule(newDirectExecutorService()),
new AbstractModule() {
protected void configure() {
bindConstant().annotatedWith(named(PROPERTY_USER_THREADS)).to(1);

View File

@ -31,7 +31,7 @@ import static com.google.common.collect.Iterables.transform;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Maps.filterKeys;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.jclouds.Constants.PROPERTY_API;
import static org.jclouds.Constants.PROPERTY_API_VERSION;
import static org.jclouds.Constants.PROPERTY_BUILD_VERSION;
@ -547,7 +547,7 @@ public class ContextBuilder {
return input.getClass().isAnnotationPresent(SingleThreaded.class);
}
})) {
modules.add(new ExecutorServiceModule(sameThreadExecutor()));
modules.add(new ExecutorServiceModule(newDirectExecutorService()));
} else {
modules.add(new ExecutorServiceModule());
}

View File

@ -18,7 +18,7 @@ package org.jclouds.lifecycle.config;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Iterables.filter;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.inject.matcher.Matchers.any;
import static org.jclouds.Constants.PROPERTY_SCHEDULER_THREADS;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
@ -117,7 +117,7 @@ public class LifeCycleModule extends AbstractModule {
invokeOnInjectee(method, injectee);
}
}, sameThreadExecutor());
}, newDirectExecutorService());
}
});
}

View File

@ -18,7 +18,7 @@ package org.jclouds.concurrent;
import static com.google.common.collect.Maps.newHashMap;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.jclouds.concurrent.FutureIterables.transformParallel;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.fail;
@ -53,7 +53,7 @@ public class FutureIterablesTest {
counter.incrementAndGet();
return immediateFailedFuture(new AuthorizationException());
}
}, sameThreadExecutor(), null, Logger.NULL, "");
}, newDirectExecutorService(), null, Logger.NULL, "");
fail("Expected AuthorizationException");
} catch (AuthorizationException e) {
assertEquals(counter.get(), 2);
@ -70,7 +70,7 @@ public class FutureIterablesTest {
counter.incrementAndGet();
return immediateFailedFuture(new RuntimeException());
}
}, sameThreadExecutor(), null, Logger.CONSOLE, "");
}, newDirectExecutorService(), null, Logger.CONSOLE, "");
fail("Expected TransformParallelException");
} catch (TransformParallelException e) {
assertEquals(e.getFromToException().size(), 2);

View File

@ -17,7 +17,7 @@
package org.jclouds.rest.internal;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.inject.name.Names.named;
import static org.jclouds.Constants.PROPERTY_IDEMPOTENT_METHODS;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
@ -226,7 +226,7 @@ public abstract class BaseRestApiExpectTest<S> {
@Override
public void configure() {
bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_USER_THREADS)).toInstance(sameThreadExecutor());
bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_USER_THREADS)).toInstance(newDirectExecutorService());
bind(new TypeLiteral<Function<HttpRequest, HttpResponse>>() {
}).toInstance(fn);
bind(HttpCommandExecutorService.class).to(ExpectHttpCommandExecutorService.class);

View File

@ -18,7 +18,7 @@ package org.jclouds.rest.internal;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.hash.Hashing.md5;
import static com.google.common.net.HttpHeaders.TRANSFER_ENCODING;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.inject.name.Names.named;
import static org.easymock.EasyMock.createMock;
import static org.jclouds.Constants.PROPERTY_USER_THREADS;
@ -77,7 +77,7 @@ public abstract class BaseRestApiTest {
@Override
protected void configure() {
bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_USER_THREADS)).toInstance(sameThreadExecutor());
bind(ListeningExecutorService.class).annotatedWith(named(PROPERTY_USER_THREADS)).toInstance(newDirectExecutorService());
bind(HttpCommandExecutorService.class).toInstance(mock);
}

View File

@ -16,7 +16,7 @@
*/
package org.jclouds.gae.config;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import org.jclouds.concurrent.SingleThreaded;
import org.jclouds.concurrent.config.ConfiguresExecutorService;
@ -46,7 +46,7 @@ public class GoogleAppEngineConfigurationModule extends AbstractModule {
private final Module userExecutorModule;
public GoogleAppEngineConfigurationModule() {
this(new ExecutorServiceModule(sameThreadExecutor()));
this(new ExecutorServiceModule(newDirectExecutorService()));
}
/**

View File

@ -19,7 +19,7 @@ package org.jclouds.aws.ec2.internal;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.net.HttpHeaders.AUTHORIZATION;
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static javax.ws.rs.core.MediaType.APPLICATION_XML;
import static org.assertj.core.api.Assertions.assertThat;
import static org.jclouds.util.Strings2.toStringAndClose;
@ -90,7 +90,7 @@ public class BaseAWSEC2ApiMockTest {
}
private final Set<Module> modules = ImmutableSet
.<Module>of(new MockAWSEC2HttpApiModule(), new ExecutorServiceModule(sameThreadExecutor()));
.<Module>of(new MockAWSEC2HttpApiModule(), new ExecutorServiceModule(newDirectExecutorService()));
@ConfiguresHttpApi
class MockAWSEC2HttpApiModule extends AWSEC2HttpApiModule {

View File

@ -41,7 +41,7 @@ import com.squareup.okhttp.mockwebserver.RecordedRequest;
final class B2TestUtils {
static B2Api api(String uri, String provider, Properties overrides) {
Set<Module> modules = ImmutableSet.<Module> of(
new ExecutorServiceModule(MoreExecutors.sameThreadExecutor()));
new ExecutorServiceModule(MoreExecutors.newDirectExecutorService()));
return ContextBuilder.newBuilder(provider)
.credentials("ACCOUNT_ID", "APPLICATION_KEY")

View File

@ -18,7 +18,7 @@ package org.jclouds.digitalocean2.internal;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
@ -51,7 +51,7 @@ public class BaseDigitalOcean2ApiMockTest {
private static final String MOCK_BEARER_TOKEN = "c5401990f0c24135e8d6b5d260603fc71696d4738da9aa04a720229a01a2521d";
private static final String DEFAULT_ENDPOINT = new DigitalOcean2ProviderMetadata().getEndpoint();
private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor()));
private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService()));
protected MockWebServer server;
protected DigitalOcean2Api api;

View File

@ -16,7 +16,7 @@
*/
package org.jclouds.dynect.v3;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static javax.ws.rs.core.Response.Status.OK;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
@ -39,7 +39,7 @@ import com.squareup.okhttp.mockwebserver.MockWebServer;
public class DynectApiMockTest {
private static final Set<Module> modules = ImmutableSet.<Module> of(
new ExecutorServiceModule(sameThreadExecutor()));
new ExecutorServiceModule(newDirectExecutorService()));
static DynECTApi mockDynectApi(String uri) {
Properties overrides = new Properties();

View File

@ -18,7 +18,7 @@ package org.jclouds.googlecloudstorage.internal;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.googlecloud.config.GoogleCloudProperties.CREDENTIAL_TYPE;
import static org.jclouds.googlecloud.config.GoogleCloudProperties.PROJECT_NAME;
@ -74,7 +74,7 @@ public class BaseGoogleCloudStorageApiMockTest {
}
private final Set<AbstractModule> modules = ImmutableSet
.of(new ExecutorServiceModule(sameThreadExecutor()), new OkHttpCommandExecutorServiceModule());
.of(new ExecutorServiceModule(newDirectExecutorService()), new OkHttpCommandExecutorServiceModule());
final AtomicInteger suffix = new AtomicInteger();

View File

@ -18,7 +18,7 @@ package org.jclouds.googlecomputeengine.internal;
import static com.google.common.base.Charsets.UTF_8;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.jclouds.compute.config.ComputeServiceProperties.TIMEOUT_NODE_TERMINATED;
import static org.jclouds.googlecloud.config.GoogleCloudProperties.CREDENTIAL_TYPE;
@ -83,7 +83,7 @@ public class BaseGoogleComputeEngineApiMockTest {
}
private final Set<Module> modules = ImmutableSet
.of(new ExecutorServiceModule(sameThreadExecutor()), GoogleComputeEngineTestModule.INSTANCE, new OkHttpCommandExecutorServiceModule());
.of(new ExecutorServiceModule(newDirectExecutorService()), GoogleComputeEngineTestModule.INSTANCE, new OkHttpCommandExecutorServiceModule());
final AtomicInteger suffix = new AtomicInteger();

View File

@ -43,7 +43,7 @@ import com.squareup.okhttp.mockwebserver.RecordedRequest;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static org.jclouds.Constants.PROPERTY_MAX_RETRIES;
import static org.testng.Assert.assertEquals;
@ -52,7 +52,7 @@ public class BasePacketApiMockTest {
private static final String X_AUTHORIZATION_TOKEN = "c5401990f0c24135e8d6b5d260603fc71696d4738da9aa04a720229a01a2521d";
private static final String DEFAULT_ENDPOINT = new PacketProviderMetadata().getEndpoint();
private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor()));
private final Set<Module> modules = ImmutableSet.<Module> of(new ExecutorServiceModule(newDirectExecutorService()));
protected MockWebServer server;
protected PacketApi api;