use of com.qcloud.cos.model.BucketVersioningConfiguration in project cos-java-sdk-v5 by tencentyun.
the class BucketVersioningTest method testBucketVersioningEnabled.
@Test
public void testBucketVersioningEnabled() {
if (!judgeUserInfoValid()) {
return;
}
BucketVersioningConfiguration bucketVersioningEnabled = new BucketVersioningConfiguration(BucketVersioningConfiguration.ENABLED);
cosclient.setBucketVersioningConfiguration(new SetBucketVersioningConfigurationRequest(bucket, bucketVersioningEnabled));
try {
Thread.sleep(5000L);
} catch (InterruptedException e) {
fail(e.toString());
}
BucketVersioningConfiguration bucketVersioningRet = cosclient.getBucketVersioningConfiguration(bucket);
assertEquals(BucketVersioningConfiguration.ENABLED, bucketVersioningRet.getStatus());
}
use of com.qcloud.cos.model.BucketVersioningConfiguration in project cos-java-sdk-v5 by tencentyun.
the class CreateDeleteHeadBucketTest method testCreateDeleteBucketPrivate.
@Test
public void testCreateDeleteBucketPrivate() throws Exception {
if (!judgeUserInfoValid()) {
return;
}
try {
String bucketName = String.format("java-pri-%s", appid);
CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
createBucketRequest.setCannedAcl(CannedAccessControlList.Private);
Bucket bucket = cosclient.createBucket(createBucketRequest);
assertEquals(bucketName, bucket.getName());
assertTrue(cosclient.doesBucketExist(bucketName));
BucketVersioningConfiguration bucketVersioningConfiguration = cosclient.getBucketVersioningConfiguration(bucketName);
assertEquals(BucketVersioningConfiguration.OFF, bucketVersioningConfiguration.getStatus());
cosclient.deleteBucket(bucketName);
// 删除bucket后, 由于server端有缓存 需要稍后查询, 这里sleep 5 秒
Thread.sleep(5000L);
assertFalse(cosclient.doesBucketExist(bucketName));
} catch (CosServiceException cse) {
fail(cse.toString());
}
}
use of com.qcloud.cos.model.BucketVersioningConfiguration in project cos-java-sdk-v5 by tencentyun.
the class BucketVersioningTest method testBucketVersioningSuspended.
@Test
public void testBucketVersioningSuspended() {
if (!judgeUserInfoValid()) {
return;
}
BucketVersioningConfiguration bucketVersioningEnabled = new BucketVersioningConfiguration(BucketVersioningConfiguration.SUSPENDED);
cosclient.setBucketVersioningConfiguration(new SetBucketVersioningConfigurationRequest(bucket, bucketVersioningEnabled));
try {
Thread.sleep(5000L);
} catch (InterruptedException e) {
fail(e.toString());
}
BucketVersioningConfiguration bucketVersioningRet = cosclient.getBucketVersioningConfiguration(bucket);
assertEquals(BucketVersioningConfiguration.SUSPENDED, bucketVersioningRet.getStatus());
}
Aggregations