mirror of https://github.com/apache/jclouds.git
Issue 113: signature logger
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2008 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
243ec0d2aa
commit
aa6bb89d75
|
@ -35,6 +35,8 @@ import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.jclouds.atmosonline.saas.reference.AtmosStorageConstants;
|
import org.jclouds.atmosonline.saas.reference.AtmosStorageConstants;
|
||||||
import org.jclouds.atmosonline.saas.reference.AtmosStorageHeaders;
|
import org.jclouds.atmosonline.saas.reference.AtmosStorageHeaders;
|
||||||
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.util.Jsr330;
|
import org.jclouds.util.Jsr330;
|
||||||
import org.jclouds.util.TimeStamp;
|
import org.jclouds.util.TimeStamp;
|
||||||
|
@ -82,13 +84,14 @@ public class SignRequestTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
protected void createFilter() {
|
protected void createFilter() {
|
||||||
injector = Guice.createInjector(new AbstractModule() {
|
injector = Guice.createInjector(new ExecutorServiceModule(new WithinThreadExecutorService()),
|
||||||
|
new AbstractModule() {
|
||||||
|
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_UID))
|
bindConstant().annotatedWith(
|
||||||
.to("user");
|
Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_UID)).to("user");
|
||||||
bindConstant().annotatedWith(Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_KEY))
|
bindConstant().annotatedWith(
|
||||||
.to(KEY);
|
Jsr330.named(AtmosStorageConstants.PROPERTY_EMCSAAS_KEY)).to(KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
|
|
@ -32,6 +32,8 @@ import org.jclouds.aws.s3.handlers.AWSClientErrorRetryHandler;
|
||||||
import org.jclouds.aws.s3.handlers.AWSRedirectionRetryHandler;
|
import org.jclouds.aws.s3.handlers.AWSRedirectionRetryHandler;
|
||||||
import org.jclouds.aws.s3.handlers.ParseAWSErrorFromXmlContent;
|
import org.jclouds.aws.s3.handlers.ParseAWSErrorFromXmlContent;
|
||||||
import org.jclouds.aws.s3.reference.S3Constants;
|
import org.jclouds.aws.s3.reference.S3Constants;
|
||||||
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
import org.jclouds.http.handlers.DelegatingRetryHandler;
|
||||||
|
@ -50,18 +52,18 @@ import com.google.inject.Injector;
|
||||||
public class S3RestClientModuleTest {
|
public class S3RestClientModuleTest {
|
||||||
|
|
||||||
Injector createInjector() {
|
Injector createInjector() {
|
||||||
return Guice.createInjector(new S3RestClientModule(), new ParserModule(),
|
return Guice.createInjector(new S3RestClientModule(), new ExecutorServiceModule(
|
||||||
new AbstractModule() {
|
new WithinThreadExecutorService()), new ParserModule(), new AbstractModule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to(
|
||||||
Jsr330.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to("user");
|
"user");
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY))
|
||||||
Jsr330.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY)).to("key");
|
.to("key");
|
||||||
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_S3_ENDPOINT))
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_S3_ENDPOINT)).to(
|
||||||
.to("http://localhost");
|
"http://localhost");
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_S3_SESSIONINTERVAL)).to(
|
||||||
Jsr330.named(S3Constants.PROPERTY_S3_SESSIONINTERVAL)).to("2");
|
"2");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
import org.jclouds.aws.s3.config.S3RestClientModule;
|
import org.jclouds.aws.s3.config.S3RestClientModule;
|
||||||
import org.jclouds.aws.s3.reference.S3Constants;
|
import org.jclouds.aws.s3.reference.S3Constants;
|
||||||
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.util.Jsr330;
|
import org.jclouds.util.Jsr330;
|
||||||
|
@ -139,18 +141,18 @@ public class RequestAuthorizeSignatureTest {
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
protected void createFilter() {
|
protected void createFilter() {
|
||||||
injector = Guice.createInjector(new S3RestClientModule(), new ParserModule(),
|
injector = Guice.createInjector(new S3RestClientModule(), new ExecutorServiceModule(
|
||||||
new AbstractModule() {
|
new WithinThreadExecutorService()), new ParserModule(), new AbstractModule() {
|
||||||
|
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to(
|
||||||
Jsr330.named(S3Constants.PROPERTY_AWS_ACCESSKEYID)).to("foo");
|
"foo");
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY))
|
||||||
Jsr330.named(S3Constants.PROPERTY_AWS_SECRETACCESSKEY)).to("bar");
|
.to("bar");
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_S3_SESSIONINTERVAL)).to(
|
||||||
Jsr330.named(S3Constants.PROPERTY_S3_SESSIONINTERVAL)).to("2");
|
"2");
|
||||||
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_S3_ENDPOINT))
|
bindConstant().annotatedWith(Jsr330.named(S3Constants.PROPERTY_S3_ENDPOINT)).to(
|
||||||
.to("https://s3.amazonaws.com");
|
"https://s3.amazonaws.com");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
filter = injector.getInstance(RequestAuthorizeSignature.class);
|
filter = injector.getInstance(RequestAuthorizeSignature.class);
|
||||||
|
|
|
@ -29,6 +29,8 @@ import org.jclouds.azure.storage.blob.handlers.AzureBlobClientErrorRetryHandler;
|
||||||
import org.jclouds.azure.storage.blob.reference.AzureBlobConstants;
|
import org.jclouds.azure.storage.blob.reference.AzureBlobConstants;
|
||||||
import org.jclouds.azure.storage.handlers.ParseAzureStorageErrorFromXmlContent;
|
import org.jclouds.azure.storage.handlers.ParseAzureStorageErrorFromXmlContent;
|
||||||
import org.jclouds.azure.storage.reference.AzureStorageConstants;
|
import org.jclouds.azure.storage.reference.AzureStorageConstants;
|
||||||
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
|
@ -48,15 +50,14 @@ import com.google.inject.Injector;
|
||||||
public class RestAzureBlobClientModuleTest {
|
public class RestAzureBlobClientModuleTest {
|
||||||
|
|
||||||
Injector createInjector() {
|
Injector createInjector() {
|
||||||
return Guice.createInjector(new AzureBlobRestClientModule(), new ParserModule(),
|
return Guice.createInjector(new AzureBlobRestClientModule(), new ExecutorServiceModule(
|
||||||
new AbstractModule() {
|
new WithinThreadExecutorService()), new ParserModule(), new AbstractModule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(
|
||||||
Jsr330.named(AzureBlobConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to(
|
Jsr330.named(AzureBlobConstants.PROPERTY_AZURESTORAGE_ACCOUNT)).to("user");
|
||||||
"user");
|
bindConstant()
|
||||||
bindConstant().annotatedWith(
|
.annotatedWith(Jsr330.named(AzureBlobConstants.PROPERTY_AZURESTORAGE_KEY)).to(
|
||||||
Jsr330.named(AzureBlobConstants.PROPERTY_AZURESTORAGE_KEY)).to(
|
|
||||||
HttpUtils.toBase64String("secret".getBytes()));
|
HttpUtils.toBase64String("secret".getBytes()));
|
||||||
bindConstant().annotatedWith(
|
bindConstant().annotatedWith(
|
||||||
Jsr330.named(AzureBlobConstants.PROPERTY_AZUREBLOB_ENDPOINT)).to(
|
Jsr330.named(AzureBlobConstants.PROPERTY_AZUREBLOB_ENDPOINT)).to(
|
||||||
|
|
|
@ -32,6 +32,8 @@ import static org.testng.Assert.assertFalse;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
import org.jclouds.azure.storage.handlers.ParseAzureStorageErrorFromXmlContent;
|
import org.jclouds.azure.storage.handlers.ParseAzureStorageErrorFromXmlContent;
|
||||||
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpRetryHandler;
|
import org.jclouds.http.HttpRetryHandler;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
import org.jclouds.http.handlers.DelegatingErrorHandler;
|
||||||
|
@ -52,16 +54,14 @@ import com.google.inject.Injector;
|
||||||
public class AzureStorageRestClientModuleTest {
|
public class AzureStorageRestClientModuleTest {
|
||||||
|
|
||||||
Injector createInjector() {
|
Injector createInjector() {
|
||||||
return Guice.createInjector(new AzureStorageRestClientModule(), new ParserModule(),
|
return Guice.createInjector(new AzureStorageRestClientModule(), new ExecutorServiceModule(
|
||||||
new AbstractModule() {
|
new WithinThreadExecutorService()), new ParserModule(), new AbstractModule() {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bindConstant().annotatedWith(Jsr330.named(PROPERTY_AZURESTORAGE_ACCOUNT)).to(
|
bindConstant().annotatedWith(Jsr330.named(PROPERTY_AZURESTORAGE_ACCOUNT)).to("user");
|
||||||
"user");
|
bindConstant().annotatedWith(Jsr330.named(PROPERTY_AZURESTORAGE_KEY)).to("secret");
|
||||||
bindConstant().annotatedWith(Jsr330.named(PROPERTY_AZURESTORAGE_KEY)).to(
|
bindConstant().annotatedWith(Jsr330.named(PROPERTY_AZURESTORAGE_SESSIONINTERVAL)).to(
|
||||||
"secret");
|
"2");
|
||||||
bindConstant().annotatedWith(
|
|
||||||
Jsr330.named(PROPERTY_AZURESTORAGE_SESSIONINTERVAL)).to("2");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -102,8 +102,7 @@ public class AzureStorageRestClientModuleTest {
|
||||||
@Test
|
@Test
|
||||||
void testRedirectionRetryHandler() {
|
void testRedirectionRetryHandler() {
|
||||||
DelegatingRetryHandler handler = createInjector().getInstance(DelegatingRetryHandler.class);
|
DelegatingRetryHandler handler = createInjector().getInstance(DelegatingRetryHandler.class);
|
||||||
assertEquals(handler.getRedirectionRetryHandler().getClass(),
|
assertEquals(handler.getRedirectionRetryHandler().getClass(), RedirectionRetryHandler.class);
|
||||||
RedirectionRetryHandler.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -33,6 +33,8 @@ import javax.ws.rs.core.HttpHeaders;
|
||||||
|
|
||||||
import org.jclouds.azure.storage.config.AzureStorageRestClientModule;
|
import org.jclouds.azure.storage.config.AzureStorageRestClientModule;
|
||||||
import org.jclouds.azure.storage.reference.AzureStorageConstants;
|
import org.jclouds.azure.storage.reference.AzureStorageConstants;
|
||||||
|
import org.jclouds.concurrent.WithinThreadExecutorService;
|
||||||
|
import org.jclouds.concurrent.config.ExecutorServiceModule;
|
||||||
import org.jclouds.http.HttpRequest;
|
import org.jclouds.http.HttpRequest;
|
||||||
import org.jclouds.http.HttpUtils;
|
import org.jclouds.http.HttpUtils;
|
||||||
import org.jclouds.http.functions.config.ParserModule;
|
import org.jclouds.http.functions.config.ParserModule;
|
||||||
|
@ -135,7 +137,8 @@ public class SharedKeyAuthenticationTest {
|
||||||
*/
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
protected void createFilter() {
|
protected void createFilter() {
|
||||||
injector = Guice.createInjector(new ParserModule(), new AzureStorageRestClientModule(),
|
injector = Guice.createInjector(new ParserModule(), new ExecutorServiceModule(
|
||||||
|
new WithinThreadExecutorService()), new AzureStorageRestClientModule(),
|
||||||
new AbstractModule() {
|
new AbstractModule() {
|
||||||
|
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
|
|
Loading…
Reference in New Issue