use of com.aliyun.oss.model.GetImageStyleResult in project aliyun-oss-java-sdk by aliyun.
the class TestForImg method testPutGetDeleteImageStyle.
public void testPutGetDeleteImageStyle() {
PutBucketImageRequest request = new PutBucketImageRequest(bucketName);
clientImg.putBucketImage(request);
sleepSecond(10);
PutImageStyleRequest requestStyle = new PutImageStyleRequest();
requestStyle.SetBucketName(bucketName);
String styleName = "myStyle";
String style = "200w";
requestStyle.SetStyle(style);
requestStyle.SetStyleName(styleName);
clientImg.putImageStyle(requestStyle);
sleepSecond(10);
GetImageStyleResult result = clientImg.getImageStyle(bucketName, styleName);
Assert.assertEquals(result.GetStyle(), style);
Assert.assertEquals(result.GetStyleName(), styleName);
clientImg.deleteImageStyle(bucketName, styleName);
sleepSecond(20);
try {
clientImg.getImageStyle(bucketName, styleName);
Assert.assertTrue(false);
} catch (Exception e) {
// Do Nothing
}
}
use of com.aliyun.oss.model.GetImageStyleResult in project aliyun-oss-java-sdk by aliyun.
the class ResponseParsers method parseImageStyle.
/**
* Unmarshall get image style response body to corresponding result.
*/
public static GetImageStyleResult parseImageStyle(InputStream responseBody) throws ResponseParseException {
try {
Element root = getXmlRootElement(responseBody);
GetImageStyleResult result = new GetImageStyleResult();
result.SetStyleName(root.getChildText("Name"));
result.SetStyle(root.getChildText("Content"));
result.SetLastModifyTime(DateUtil.parseRfc822Date(root.getChildText("LastModifyTime")));
result.SetCreationDate(DateUtil.parseRfc822Date(root.getChildText("CreateTime")));
return result;
} catch (JDOMParseException e) {
throw new ResponseParseException(e.getPartialDocument() + ": " + e.getMessage(), e);
} catch (Exception e) {
throw new ResponseParseException(e.getMessage(), e);
}
}
Aggregations