kopia lustrzana https://github.com/gaul/s3proxy
Remove unused s3Context
This test uses AmazonS3Client instead of jclouds client.pull/50/head
rodzic
58800de7bf
commit
6b5f9fd7f3
|
@ -56,11 +56,8 @@ public final class S3AwsSdkTest {
|
||||||
private URI s3Endpoint;
|
private URI s3Endpoint;
|
||||||
private S3Proxy s3Proxy;
|
private S3Proxy s3Proxy;
|
||||||
private BlobStoreContext context;
|
private BlobStoreContext context;
|
||||||
private BlobStoreContext s3Context;
|
|
||||||
private BlobStore s3BlobStore;
|
|
||||||
private String containerName;
|
private String containerName;
|
||||||
private String s3Identity;
|
private BasicAWSCredentials awsCreds;
|
||||||
private String s3Credential;
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -78,10 +75,11 @@ public final class S3AwsSdkTest {
|
||||||
Constants.PROPERTY_CREDENTIAL);
|
Constants.PROPERTY_CREDENTIAL);
|
||||||
String endpoint = s3ProxyProperties.getProperty(
|
String endpoint = s3ProxyProperties.getProperty(
|
||||||
Constants.PROPERTY_ENDPOINT);
|
Constants.PROPERTY_ENDPOINT);
|
||||||
s3Identity = s3ProxyProperties.getProperty(
|
String s3Identity = s3ProxyProperties.getProperty(
|
||||||
S3ProxyConstants.PROPERTY_IDENTITY);
|
S3ProxyConstants.PROPERTY_IDENTITY);
|
||||||
s3Credential = s3ProxyProperties.getProperty(
|
String s3Credential = s3ProxyProperties.getProperty(
|
||||||
S3ProxyConstants.PROPERTY_CREDENTIAL);
|
S3ProxyConstants.PROPERTY_CREDENTIAL);
|
||||||
|
awsCreds = new BasicAWSCredentials(s3Identity, s3Credential);
|
||||||
s3Endpoint = new URI(s3ProxyProperties.getProperty(
|
s3Endpoint = new URI(s3ProxyProperties.getProperty(
|
||||||
S3ProxyConstants.PROPERTY_ENDPOINT));
|
S3ProxyConstants.PROPERTY_ENDPOINT));
|
||||||
String keyStorePath = s3ProxyProperties.getProperty(
|
String keyStorePath = s3ProxyProperties.getProperty(
|
||||||
|
@ -129,16 +127,6 @@ public final class S3AwsSdkTest {
|
||||||
s3Endpoint = new URI(s3Endpoint.getScheme(), s3Endpoint.getUserInfo(),
|
s3Endpoint = new URI(s3Endpoint.getScheme(), s3Endpoint.getUserInfo(),
|
||||||
s3Endpoint.getHost(), s3Proxy.getPort(), s3Endpoint.getPath(),
|
s3Endpoint.getHost(), s3Proxy.getPort(), s3Endpoint.getPath(),
|
||||||
s3Endpoint.getQuery(), s3Endpoint.getFragment());
|
s3Endpoint.getQuery(), s3Endpoint.getFragment());
|
||||||
|
|
||||||
Properties s3Properties = new Properties();
|
|
||||||
s3Properties.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
|
|
||||||
s3Context = ContextBuilder
|
|
||||||
.newBuilder("s3")
|
|
||||||
.credentials(s3Identity, s3Credential)
|
|
||||||
.endpoint(s3Endpoint.toString())
|
|
||||||
.overrides(s3Properties)
|
|
||||||
.build(BlobStoreContext.class);
|
|
||||||
s3BlobStore = s3Context.getBlobStore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -146,9 +134,6 @@ public final class S3AwsSdkTest {
|
||||||
if (s3Proxy != null) {
|
if (s3Proxy != null) {
|
||||||
s3Proxy.stop();
|
s3Proxy.stop();
|
||||||
}
|
}
|
||||||
if (s3Context != null) {
|
|
||||||
s3Context.close();
|
|
||||||
}
|
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
context.getBlobStore().deleteContainer(containerName);
|
context.getBlobStore().deleteContainer(containerName);
|
||||||
context.close();
|
context.close();
|
||||||
|
@ -157,8 +142,6 @@ public final class S3AwsSdkTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAwsV4Failure() throws Exception {
|
public void testAwsV4Failure() throws Exception {
|
||||||
BasicAWSCredentials awsCreds = new BasicAWSCredentials(s3Identity,
|
|
||||||
s3Credential);
|
|
||||||
AmazonS3 client = new AmazonS3Client(awsCreds);
|
AmazonS3 client = new AmazonS3Client(awsCreds);
|
||||||
client.setEndpoint(s3Endpoint.toString());
|
client.setEndpoint(s3Endpoint.toString());
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue