use of com.aliyun.oss.model.RestoreObjectResult in project aliyun-oss-java-sdk by aliyun.
the class ArchiveTest method testRestoreResultClassSetter.
@Test
public void testRestoreResultClassSetter() {
// update coverage.
RestoreObjectResult result = new RestoreObjectResult(200);
result.setStatusCode(400);
Assert.assertEquals(400, result.getStatusCode());
}
use of com.aliyun.oss.model.RestoreObjectResult in project aliyun-oss-java-sdk by aliyun.
the class ObjectVersionTest method testRestoreObject.
@Test
public void testRestoreObject() {
String key = "version-test-restore-object";
long inputStreamLength = 1024;
try {
// put
InputStream instream = genFixedLengthInputStream(inputStreamLength);
ObjectMetadata metadata = new ObjectMetadata();
metadata.setHeader("x-oss-storage-class", "Archive");
PutObjectResult putResult = ossClient.putObject(bucketName, key, instream, metadata);
Assert.assertNotNull(putResult.getVersionId());
Assert.assertEquals(64, putResult.getVersionId().length());
// restore
GenericRequest genericRequest = new GenericRequest(bucketName, key, putResult.getVersionId());
RestoreObjectResult restoreObjectResult = ossClient.restoreObject(genericRequest);
Assert.assertEquals(202, restoreObjectResult.getStatusCode());
Assert.assertNotNull(restoreObjectResult.getVersionId());
Assert.assertEquals(64, restoreObjectResult.getVersionId().length());
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
Aggregations