use of org.talend.components.simplefileio.s3.S3Region in project components by Talend.
the class S3DatasetRuntimeTestIT method listBuckets.
@Test
@Ignore("It's slow (10 or more mins), our account doesn't allow to create this amount of buckets")
public void listBuckets() {
String uuid = UUID.randomUUID().toString().substring(0, 8);
String bucketFormat = "tcomp-s3-dataset-test-%s-" + uuid;
S3DatasetProperties s3DatasetProperties = s3.createS3DatasetProperties();
runtime.initialize(null, s3DatasetProperties);
AmazonS3 client = S3Connection.createClient(s3.createS3DatastoreProperties());
for (S3Region s3Region : getTestableS3Regions()) {
client.setEndpoint(s3Region.toEndpoint());
if (s3Region.equals(S3Region.US_EAST_1)) {
client.createBucket(String.format(bucketFormat, s3Region.getValue()));
} else {
client.createBucket(String.format(bucketFormat, s3Region.getValue()), s3Region.getValue());
}
s3DatasetProperties.region.setValue(s3Region);
Set<String> bucketNames = runtime.listBuckets();
assertTrue(bucketNames.size() > 0);
assertThat(bucketNames, hasItems(String.format(bucketFormat, s3Region.getValue())));
client.setEndpoint(s3Region.toEndpoint());
client.deleteBucket(String.format(bucketFormat, s3Region.getValue()));
}
}
Aggregations