use of com.aliyun.oss.model.BucketList in project aliyun-oss-java-sdk by aliyun.
the class CreateBucketTest method testPutWithStorageTypeAndLocation.
@Test
public void testPutWithStorageTypeAndLocation() {
final String bucketName = "bucket-with-storage-and-location";
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
createBucketRequest.setStorageClass(StorageClass.Standard);
createBucketRequest.setLocationConstraint(OSS_TEST_REGION);
try {
ossClient.createBucket(createBucketRequest);
AccessControlList returnedAcl = ossClient.getBucketAcl(bucketName);
Set<Grant> grants = returnedAcl.getGrants();
Assert.assertEquals(0, grants.size());
System.out.println(returnedAcl.toString());
BucketList buckets = ossClient.listBuckets(bucketName, "", 100);
Assert.assertEquals(1, buckets.getBucketList().size());
Assert.assertEquals(StorageClass.Standard, buckets.getBucketList().get(0).getStorageClass());
Assert.assertEquals(OSS_TEST_REGION, buckets.getBucketList().get(0).getLocation());
Assert.assertEquals(buckets.getRequestId().length(), REQUEST_ID_LEN);
} catch (Exception ex) {
Assert.fail(ex.getMessage());
} finally {
ossClient.deleteBucket(bucketName);
}
}
use of com.aliyun.oss.model.BucketList in project aliyun-oss-java-sdk by aliyun.
the class CreateBucketTest method testPutWithStorageTypeCompatibility.
@Test
public void testPutWithStorageTypeCompatibility() {
final String bucketName = "bucket-with-storage-type-compatibility";
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
try {
ossClient.createBucket(createBucketRequest);
BucketList buckets = ossClient.listBuckets(bucketName, "", 100);
Assert.assertEquals(1, buckets.getBucketList().size());
Assert.assertEquals(StorageClass.Standard, buckets.getBucketList().get(0).getStorageClass());
Assert.assertEquals(buckets.getRequestId().length(), REQUEST_ID_LEN);
} catch (Exception ex) {
Assert.fail(ex.getMessage());
} finally {
ossClient.deleteBucket(bucketName);
}
}
use of com.aliyun.oss.model.BucketList in project aliyun-oss-java-sdk by aliyun.
the class CreateBucketTest method testPutWithDefaultStorageType.
@Test
public void testPutWithDefaultStorageType() {
final String bucketName = "bucket-with-default-storage-type";
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
try {
ossClient.createBucket(createBucketRequest);
BucketList buckets = ossClient.listBuckets(bucketName, "", 100);
Assert.assertEquals(1, buckets.getBucketList().size());
Assert.assertEquals(StorageClass.Standard, buckets.getBucketList().get(0).getStorageClass());
Assert.assertEquals(buckets.getRequestId().length(), REQUEST_ID_LEN);
} catch (Exception ex) {
Assert.fail(ex.getMessage());
} finally {
ossClient.deleteBucket(bucketName);
}
}
use of com.aliyun.oss.model.BucketList in project aliyun-oss-java-sdk by aliyun.
the class CreateBucketTest method testPutWithStorageTypeFunc.
@Ignore
public void testPutWithStorageTypeFunc() {
final String bucketName = "bucket-with-storage-type-func";
try {
ossClient.createBucket(new CreateBucketRequest(bucketName).withStorageType(StorageClass.IA));
AccessControlList returnedAcl = ossClient.getBucketAcl(bucketName);
Set<Grant> grants = returnedAcl.getGrants();
Assert.assertEquals(0, grants.size());
BucketList buckets = ossClient.listBuckets(bucketName, "", 100);
Assert.assertEquals(1, buckets.getBucketList().size());
Assert.assertEquals(StorageClass.IA, buckets.getBucketList().get(0).getStorageClass());
} catch (Exception ex) {
Assert.fail(ex.getMessage());
} finally {
ossClient.deleteBucket(bucketName);
}
}
use of com.aliyun.oss.model.BucketList in project aliyun-oss-java-sdk by aliyun.
the class BucketInfoTest method testListBucketWithEndpoint.
@Test
public void testListBucketWithEndpoint() {
try {
ListBucketsRequest listBucketsRequest = new ListBucketsRequest();
listBucketsRequest.setPrefix(bucketName);
listBucketsRequest.setMaxKeys(1);
BucketList buckets = ossClient.listBuckets(listBucketsRequest);
Assert.assertEquals(buckets.getBucketList().size(), 1);
Assert.assertNotNull(buckets.getBucketList().get(0).getExtranetEndpoint());
Assert.assertNotNull(buckets.getBucketList().get(0).getIntranetEndpoint());
Assert.assertEquals(buckets.getRequestId().length(), REQUEST_ID_LEN);
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.getMessage());
}
}
Aggregations