kopia lustrzana https://github.com/gaul/s3proxy
wrapped some lines so code example doesn't require scroll bards
rodzic
79ff85b99e
commit
762d7609be
|
@ -87,9 +87,11 @@ public void example() {
|
||||||
.standard()
|
.standard()
|
||||||
.withCredentials(
|
.withCredentials(
|
||||||
new AWSStaticCredentialsProvider(
|
new AWSStaticCredentialsProvider(
|
||||||
new BasicAWSCredentials(s3Proxy.getAccessKey(), s3Proxy.getSecretKey())))
|
new BasicAWSCredentials(s3Proxy.getAccessKey(),
|
||||||
|
s3Proxy.getSecretKey())))
|
||||||
.withEndpointConfiguration(
|
.withEndpointConfiguration(
|
||||||
new EndpointConfiguration(s3Proxy.getUri().toString(), Regions.US_EAST_1.getName()))
|
new EndpointConfiguration(s3Proxy.getUri().toString(),
|
||||||
|
Regions.US_EAST_1.getName()))
|
||||||
.build();
|
.build();
|
||||||
s3Client.createBucket("test_bucket");
|
s3Client.createBucket("test_bucket");
|
||||||
|
|
||||||
|
@ -97,7 +99,8 @@ public void example() {
|
||||||
myS3Uploader.uploadFile(s3Client, someFile);
|
myS3Uploader.uploadFile(s3Client, someFile);
|
||||||
|
|
||||||
//verify the expected results of the above code
|
//verify the expected results of the above code
|
||||||
List<S3ObjectSummary> summaries = s3Client.listObjects("test_bucket").getObjectSummaries();
|
List<S3ObjectSummary> summaries = s3Client.listObjects("test_bucket")
|
||||||
|
.getObjectSummaries();
|
||||||
assertThat(summaries).hasSize(1);
|
assertThat(summaries).hasSize(1);
|
||||||
assertThat(summaries.get(0).getSize()).isEqualTo(someFile.length());
|
assertThat(summaries.get(0).getSize()).isEqualTo(someFile.length());
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue