use of com.aliyun.oss.model.SetBucketStorageCapacityRequest in project aliyun-oss-java-sdk by aliyun.
the class BucketUserQosTest method testSetBucketStorageCapacityNegative.
@Test
public void testSetBucketStorageCapacityNegative() {
try {
UserQos userQos = new UserQos(-2);
ossClient.setBucketStorageCapacity(bucketName, userQos);
Assert.fail("Set bucket storage capacity should not be successful");
} catch (OSSException e) {
Assert.assertEquals(OSSErrorCode.INVALID_ARGUMENT, e.getErrorCode());
}
try {
UserQos userQos = new UserQos(-3);
ossClient.setBucketStorageCapacity(new SetBucketStorageCapacityRequest(bucketName).withUserQos(userQos));
Assert.fail("Set bucket storage capacity should not be successful");
} catch (OSSException e) {
Assert.assertEquals(OSSErrorCode.INVALID_ARGUMENT, e.getErrorCode());
}
}
use of com.aliyun.oss.model.SetBucketStorageCapacityRequest in project aliyun-oss-java-sdk by aliyun.
the class BucketUserQosTest method testSetBucketStorageCapacity.
@Test
public void testSetBucketStorageCapacity() {
try {
UserQos userQos = new UserQos(-1);
ossClient.setBucketStorageCapacity(bucketName, userQos);
userQos = ossClient.getBucketStorageCapacity(bucketName);
Assert.assertEquals(userQos.getStorageCapacity(), -1);
Assert.assertEquals(userQos.getRequestId().length(), REQUEST_ID_LEN);
userQos.setStorageCapacity(10000);
ossClient.setBucketStorageCapacity(new SetBucketStorageCapacityRequest(bucketName).withUserQos(userQos));
userQos = ossClient.getBucketStorageCapacity(bucketName);
Assert.assertEquals(userQos.getStorageCapacity(), 10000);
Assert.assertEquals(userQos.getRequestId().length(), REQUEST_ID_LEN);
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
Aggregations