mirror of https://github.com/apache/jclouds.git
Issue 297: exposed utilities like encryption, logging, date, threads, and ssh to context objects
This commit is contained in:
parent
7c719f206f
commit
714a459796
|
@ -22,6 +22,7 @@ import org.jclouds.blobstore.attr.ConsistencyModel;
|
||||||
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
|
import org.jclouds.blobstore.internal.BlobStoreContextImpl;
|
||||||
import org.jclouds.blobstore.options.ListContainerOptions;
|
import org.jclouds.blobstore.options.ListContainerOptions;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.rest.Utils;
|
||||||
|
|
||||||
import com.google.inject.ImplementedBy;
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
|
@ -105,6 +106,13 @@ public interface BlobStoreContext {
|
||||||
*/
|
*/
|
||||||
<S, A> RestContext<S, A> getProviderSpecificContext();
|
<S, A> RestContext<S, A> getProviderSpecificContext();
|
||||||
|
|
||||||
|
Utils getUtils();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see #getUtils
|
||||||
|
*/
|
||||||
|
Utils utils();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* closes threads and resources related to this connection.
|
* closes threads and resources related to this connection.
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.jclouds.blobstore.InputStreamMap;
|
||||||
import org.jclouds.blobstore.attr.ConsistencyModel;
|
import org.jclouds.blobstore.attr.ConsistencyModel;
|
||||||
import org.jclouds.blobstore.options.ListContainerOptions;
|
import org.jclouds.blobstore.options.ListContainerOptions;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
|
import org.jclouds.rest.Utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
|
@ -43,19 +44,23 @@ public class BlobStoreContextImpl<S, A> implements BlobStoreContext {
|
||||||
private final BlobStore blobStore;
|
private final BlobStore blobStore;
|
||||||
private final RestContext<S, A> providerSpecificContext;
|
private final RestContext<S, A> providerSpecificContext;
|
||||||
private final ConsistencyModel consistencyModel;
|
private final ConsistencyModel consistencyModel;
|
||||||
|
private final Utils utils;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Inject
|
@Inject
|
||||||
public BlobStoreContextImpl(BlobMap.Factory blobMapFactory, ConsistencyModel consistencyModel,
|
public BlobStoreContextImpl(BlobMap.Factory blobMapFactory, Utils utils,
|
||||||
InputStreamMap.Factory inputStreamMapFactory, AsyncBlobStore ablobStore,
|
ConsistencyModel consistencyModel, InputStreamMap.Factory inputStreamMapFactory,
|
||||||
BlobStore blobStore, RestContext providerSpecificContext) {
|
AsyncBlobStore ablobStore, BlobStore blobStore, RestContext providerSpecificContext) {
|
||||||
// unravel guice and avoid passing in a million type args
|
// unravel guice and avoid passing in a million type args by not injecting generic types for
|
||||||
this.providerSpecificContext = checkNotNull(providerSpecificContext, "providerSpecificContext");
|
// rest context
|
||||||
|
this.providerSpecificContext = checkNotNull(providerSpecificContext,
|
||||||
|
"providerSpecificContext");
|
||||||
this.consistencyModel = checkNotNull(consistencyModel, "consistencyModel");
|
this.consistencyModel = checkNotNull(consistencyModel, "consistencyModel");
|
||||||
this.blobMapFactory = checkNotNull(blobMapFactory, "blobMapFactory");
|
this.blobMapFactory = checkNotNull(blobMapFactory, "blobMapFactory");
|
||||||
this.inputStreamMapFactory = checkNotNull(inputStreamMapFactory, "inputStreamMapFactory");
|
this.inputStreamMapFactory = checkNotNull(inputStreamMapFactory, "inputStreamMapFactory");
|
||||||
this.ablobStore = checkNotNull(ablobStore, "ablobStore");
|
this.ablobStore = checkNotNull(ablobStore, "ablobStore");
|
||||||
this.blobStore = checkNotNull(blobStore, "blobStore");
|
this.blobStore = checkNotNull(blobStore, "blobStore");
|
||||||
|
this.utils = utils;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,4 +108,14 @@ public class BlobStoreContextImpl<S, A> implements BlobStoreContext {
|
||||||
public void close() {
|
public void close() {
|
||||||
providerSpecificContext.close();
|
providerSpecificContext.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Utils getUtils() {
|
||||||
|
return utils();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Utils utils() {
|
||||||
|
return utils;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,5 +43,12 @@ public interface ComputeServiceContext {
|
||||||
|
|
||||||
<S, A> RestContext<S, A> getProviderSpecificContext();
|
<S, A> RestContext<S, A> getProviderSpecificContext();
|
||||||
|
|
||||||
|
Utils getUtils();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see #getUtils
|
||||||
|
*/
|
||||||
|
Utils utils();
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
}
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.compute;
|
||||||
|
|
||||||
|
import org.jclouds.compute.internal.UtilsImpl;
|
||||||
|
import org.jclouds.ssh.SshClient;
|
||||||
|
|
||||||
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@ImplementedBy(UtilsImpl.class)
|
||||||
|
public interface Utils extends org.jclouds.rest.Utils {
|
||||||
|
SshClient.Factory getSshClientFactory();
|
||||||
|
|
||||||
|
SshClient.Factory sshFactory();
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ import javax.inject.Singleton;
|
||||||
import org.jclouds.compute.ComputeService;
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
import org.jclouds.compute.ComputeServiceContext;
|
||||||
import org.jclouds.compute.LoadBalancerService;
|
import org.jclouds.compute.LoadBalancerService;
|
||||||
|
import org.jclouds.compute.Utils;
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,11 +39,13 @@ public class ComputeServiceContextImpl<S, A> implements ComputeServiceContext {
|
||||||
private final ComputeService computeService;
|
private final ComputeService computeService;
|
||||||
private final LoadBalancerService loadBalancerService;
|
private final LoadBalancerService loadBalancerService;
|
||||||
private final RestContext<S, A> providerSpecificContext;
|
private final RestContext<S, A> providerSpecificContext;
|
||||||
|
private final Utils utils;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Inject
|
@Inject
|
||||||
public ComputeServiceContextImpl(ComputeService computeService,
|
public ComputeServiceContextImpl(ComputeService computeService, Utils utils,
|
||||||
@Nullable LoadBalancerService loadBalancerService, RestContext providerSpecificContext) {
|
@Nullable LoadBalancerService loadBalancerService, RestContext providerSpecificContext) {
|
||||||
|
this.utils = utils;
|
||||||
this.providerSpecificContext = providerSpecificContext;
|
this.providerSpecificContext = providerSpecificContext;
|
||||||
this.computeService = checkNotNull(computeService, "computeService");
|
this.computeService = checkNotNull(computeService, "computeService");
|
||||||
this.loadBalancerService = loadBalancerService;
|
this.loadBalancerService = loadBalancerService;
|
||||||
|
@ -67,4 +70,14 @@ public class ComputeServiceContextImpl<S, A> implements ComputeServiceContext {
|
||||||
public LoadBalancerService getLoadBalancerService() {
|
public LoadBalancerService getLoadBalancerService() {
|
||||||
return loadBalancerService;
|
return loadBalancerService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Utils getUtils() {
|
||||||
|
return utils();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Utils utils() {
|
||||||
|
return utils;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.compute.internal;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import org.jclouds.Constants;
|
||||||
|
import org.jclouds.compute.Utils;
|
||||||
|
import org.jclouds.date.DateService;
|
||||||
|
import org.jclouds.encryption.EncryptionService;
|
||||||
|
import org.jclouds.logging.Logger.LoggerFactory;
|
||||||
|
import org.jclouds.rest.HttpAsyncClient;
|
||||||
|
import org.jclouds.rest.HttpClient;
|
||||||
|
import org.jclouds.ssh.SshClient;
|
||||||
|
import org.jclouds.ssh.SshClient.Factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Utils {
|
||||||
|
|
||||||
|
private final Factory sshFactory;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
UtilsImpl(HttpClient simpleClient, HttpAsyncClient simpleAsyncClient,
|
||||||
|
EncryptionService encryption, DateService date,
|
||||||
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
|
||||||
|
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads,
|
||||||
|
LoggerFactory loggerFactory, SshClient.Factory sshFactory) {
|
||||||
|
super(simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads,
|
||||||
|
loggerFactory);
|
||||||
|
this.sshFactory = sshFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Factory getSshClientFactory() {
|
||||||
|
return sshFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Factory sshFactory() {
|
||||||
|
return sshFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -53,10 +53,6 @@ public interface RestContext<S, A> {
|
||||||
*/
|
*/
|
||||||
S getApi();
|
S getApi();
|
||||||
|
|
||||||
HttpAsyncClient asyncHttp();
|
|
||||||
|
|
||||||
HttpClient http();
|
|
||||||
|
|
||||||
URI getEndpoint();
|
URI getEndpoint();
|
||||||
|
|
||||||
String getIdentity();
|
String getIdentity();
|
||||||
|
@ -65,6 +61,13 @@ public interface RestContext<S, A> {
|
||||||
|
|
||||||
String getApiVersion();
|
String getApiVersion();
|
||||||
|
|
||||||
|
Utils getUtils();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see #getUtils
|
||||||
|
*/
|
||||||
|
Utils utils();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes all connections to Cloud Files.
|
* Closes all connections to Cloud Files.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.rest;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import org.jclouds.date.DateService;
|
||||||
|
import org.jclouds.encryption.EncryptionService;
|
||||||
|
import org.jclouds.logging.Logger.LoggerFactory;
|
||||||
|
import org.jclouds.rest.internal.UtilsImpl;
|
||||||
|
|
||||||
|
import com.google.inject.ImplementedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Adrian Cole
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ImplementedBy(UtilsImpl.class)
|
||||||
|
public interface Utils {
|
||||||
|
|
||||||
|
HttpAsyncClient getHttpAsyncClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #see #getHttpAsyncClient
|
||||||
|
*/
|
||||||
|
HttpAsyncClient asyncHttp();
|
||||||
|
|
||||||
|
HttpClient getHttpClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #see #getHttpClient
|
||||||
|
*/
|
||||||
|
HttpClient http();
|
||||||
|
|
||||||
|
EncryptionService getEncryptionService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #see #getEncryptionService
|
||||||
|
*/
|
||||||
|
EncryptionService encryption();
|
||||||
|
|
||||||
|
DateService getDateService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #see #getDateService
|
||||||
|
*/
|
||||||
|
DateService date();
|
||||||
|
|
||||||
|
ExecutorService getUserExecutor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #see #getUserExecutor
|
||||||
|
*/
|
||||||
|
ExecutorService userExecutor();
|
||||||
|
|
||||||
|
ExecutorService getIoExecutor();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #see #getIoExecutor
|
||||||
|
*/
|
||||||
|
ExecutorService ioExecutor();
|
||||||
|
|
||||||
|
LoggerFactory getLoggerFactory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* #see #getLoggerFactory
|
||||||
|
*/
|
||||||
|
LoggerFactory loggerFactory();
|
||||||
|
}
|
|
@ -26,12 +26,11 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.lifecycle.Closer;
|
import org.jclouds.lifecycle.Closer;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
import org.jclouds.rest.HttpAsyncClient;
|
|
||||||
import org.jclouds.rest.HttpClient;
|
|
||||||
import org.jclouds.rest.RestContext;
|
import org.jclouds.rest.RestContext;
|
||||||
import org.jclouds.rest.annotations.ApiVersion;
|
import org.jclouds.rest.annotations.ApiVersion;
|
||||||
import org.jclouds.rest.annotations.Identity;
|
import org.jclouds.rest.annotations.Identity;
|
||||||
import org.jclouds.rest.annotations.Provider;
|
import org.jclouds.rest.annotations.Provider;
|
||||||
|
import org.jclouds.rest.Utils;
|
||||||
|
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
|
@ -51,18 +50,15 @@ public class RestContextImpl<S, A> implements RestContext<S, A> {
|
||||||
private final Closer closer;
|
private final Closer closer;
|
||||||
private final URI endpoint;
|
private final URI endpoint;
|
||||||
private final String identity;
|
private final String identity;
|
||||||
private final HttpClient simpleClient;
|
|
||||||
private final HttpAsyncClient simpleAsyncClient;
|
|
||||||
private final String provider;
|
private final String provider;
|
||||||
private final String apiVersion;
|
private final String apiVersion;
|
||||||
|
private final Utils utils;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
RestContextImpl(Closer closer, HttpClient simpleClient, HttpAsyncClient simpleAsyncClient,
|
RestContextImpl(Closer closer, Utils utils, Injector injector, TypeLiteral<S> syncApi,
|
||||||
Injector injector, TypeLiteral<S> syncApi, TypeLiteral<A> asyncApi,
|
TypeLiteral<A> asyncApi, @Provider URI endpoint, @Provider String provider,
|
||||||
@Provider URI endpoint, @Provider String provider, @Identity String identity,
|
@Identity String identity, @ApiVersion String apiVersion) {
|
||||||
@ApiVersion String apiVersion) {
|
this.utils = utils;
|
||||||
this.simpleClient = simpleClient;
|
|
||||||
this.simpleAsyncClient = simpleAsyncClient;
|
|
||||||
this.asyncApi = injector.getInstance(Key.get(asyncApi));
|
this.asyncApi = injector.getInstance(Key.get(asyncApi));
|
||||||
this.syncApi = injector.getInstance(Key.get(syncApi));
|
this.syncApi = injector.getInstance(Key.get(syncApi));
|
||||||
this.closer = closer;
|
this.closer = closer;
|
||||||
|
@ -107,13 +103,13 @@ public class RestContextImpl<S, A> implements RestContext<S, A> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpAsyncClient asyncHttp() {
|
public Utils getUtils() {
|
||||||
return this.simpleAsyncClient;
|
return utils();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpClient http() {
|
public Utils utils() {
|
||||||
return this.simpleClient;
|
return utils;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
|
*
|
||||||
|
* ====================================================================
|
||||||
|
* Licensed 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.rest.internal;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.jclouds.Constants;
|
||||||
|
import org.jclouds.date.DateService;
|
||||||
|
import org.jclouds.encryption.EncryptionService;
|
||||||
|
import org.jclouds.logging.Logger.LoggerFactory;
|
||||||
|
import org.jclouds.rest.HttpAsyncClient;
|
||||||
|
import org.jclouds.rest.HttpClient;
|
||||||
|
import org.jclouds.rest.Utils;
|
||||||
|
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Adrian Cole
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class UtilsImpl implements Utils {
|
||||||
|
|
||||||
|
private final HttpClient simpleClient;
|
||||||
|
private final HttpAsyncClient simpleAsyncClient;
|
||||||
|
private final EncryptionService encryption;
|
||||||
|
private final DateService date;
|
||||||
|
private final ExecutorService userExecutor;
|
||||||
|
private final ExecutorService ioExecutor;
|
||||||
|
private final LoggerFactory loggerFactory;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected UtilsImpl(HttpClient simpleClient, HttpAsyncClient simpleAsyncClient,
|
||||||
|
EncryptionService encryption, DateService date,
|
||||||
|
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads,
|
||||||
|
@Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads,
|
||||||
|
LoggerFactory loggerFactory) {
|
||||||
|
this.simpleClient = simpleClient;
|
||||||
|
this.simpleAsyncClient = simpleAsyncClient;
|
||||||
|
this.encryption = encryption;
|
||||||
|
this.date = date;
|
||||||
|
this.userExecutor = userThreads;
|
||||||
|
this.ioExecutor = ioThreads;
|
||||||
|
this.loggerFactory = loggerFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpAsyncClient asyncHttp() {
|
||||||
|
return simpleAsyncClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DateService date() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EncryptionService encryption() {
|
||||||
|
return encryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DateService getDateService() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EncryptionService getEncryptionService() {
|
||||||
|
return encryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpAsyncClient getHttpAsyncClient() {
|
||||||
|
return simpleAsyncClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpClient getHttpClient() {
|
||||||
|
return simpleClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpClient http() {
|
||||||
|
return simpleClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExecutorService getIoExecutor() {
|
||||||
|
return ioExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExecutorService getUserExecutor() {
|
||||||
|
return userExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExecutorService ioExecutor() {
|
||||||
|
return ioExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExecutorService userExecutor() {
|
||||||
|
return userExecutor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoggerFactory getLoggerFactory() {
|
||||||
|
return loggerFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoggerFactory loggerFactory() {
|
||||||
|
return loggerFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -109,7 +109,7 @@ public abstract class BaseHttpCommandExecutorServiceIntegrationTest extends
|
||||||
public void testGetBigFile() throws MalformedURLException,
|
public void testGetBigFile() throws MalformedURLException,
|
||||||
ExecutionException, InterruptedException, TimeoutException {
|
ExecutionException, InterruptedException, TimeoutException {
|
||||||
assertEquals(encryptionService.toBase64String(encryptionService
|
assertEquals(encryptionService.toBase64String(encryptionService
|
||||||
.md5(context.http().get(
|
.md5(context.utils().http().get(
|
||||||
URI.create(String.format("http://localhost:%d/%s", testPort,
|
URI.create(String.format("http://localhost:%d/%s", testPort,
|
||||||
"101constitutions"))))), md5);
|
"101constitutions"))))), md5);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue