Skip to content

Commit 19c4ca4

Browse files
authored
Merge pull request aliyun#59 from aliyun/console_dev
Console dev
2 parents 961fdd6 + 852d6d4 commit 19c4ca4

File tree

5 files changed

+57
-15
lines changed

5 files changed

+57
-15
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>com.aliyun.oss</groupId>
1313
<artifactId>aliyun-sdk-oss</artifactId>
14-
<version>2.4.0</version>
14+
<version>2.4.1-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616
<name>Aliyun OSS SDK for Java</name>
1717
<description>The Aliyun OSS SDK for Java used for accessing Aliyun Object Storage Service</description>

src/main/java/com/aliyun/oss/common/parser/RequestMarshallers.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,21 @@ public FixedLengthInputStream marshall(ImageProcess imageProcessConf) {
132132
StringBuffer xmlBody = new StringBuffer();
133133
xmlBody.append("<BucketProcessConfiguration>");
134134
xmlBody.append("<CompliedHost>" + imageProcessConf.getCompliedHost() + "</CompliedHost>");
135-
if (imageProcessConf.isSourceFileProtect() ) {
135+
if (imageProcessConf.isSourceFileProtect() != null &&
136+
imageProcessConf.isSourceFileProtect().booleanValue() ) {
136137
xmlBody.append("<SourceFileProtect>Enabled</SourceFileProtect>");
137138
} else {
138139
xmlBody.append("<SourceFileProtect>Disabled</SourceFileProtect>");
139140
}
140141
xmlBody.append("<SourceFileProtectSuffix>" + imageProcessConf.getSourceFileProtectSuffix()
141142
+ "</SourceFileProtectSuffix>");
142143
xmlBody.append("<StyleDelimiters>" + imageProcessConf.getStyleDelimiters() + "</StyleDelimiters>");
144+
if (imageProcessConf.isDomainSupportProcess() != null &&
145+
imageProcessConf.isDomainSupportProcess().booleanValue()) {
146+
xmlBody.append("<OssDomainSupportAtProcess>Enabled</OssDomainSupportAtProcess>");
147+
} else {
148+
xmlBody.append("<OssDomainSupportAtProcess>Disabled</OssDomainSupportAtProcess>");
149+
}
143150
xmlBody.append("</BucketProcessConfiguration>");
144151
return stringMarshaller.marshall(xmlBody.toString());
145152
}

src/main/java/com/aliyun/oss/model/ImageProcess.java

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,23 @@
2121

2222
public class ImageProcess {
2323

24-
public ImageProcess(String compliedHost, boolean sourceFileProtect,
24+
public ImageProcess(String compliedHost, Boolean sourceFileProtect,
2525
String sourceFileProtectSuffix, String styleDelimiters) {
2626
this.compliedHost = compliedHost;
2727
this.sourceFileProtect = sourceFileProtect;
2828
this.sourceFileProtectSuffix = sourceFileProtectSuffix;
2929
this.styleDelimiters = styleDelimiters;
3030
}
31+
32+
public ImageProcess(String compliedHost, Boolean sourceFileProtect,
33+
String sourceFileProtectSuffix, String styleDelimiters,
34+
Boolean domainSupportProcess) {
35+
this.compliedHost = compliedHost;
36+
this.sourceFileProtect = sourceFileProtect;
37+
this.sourceFileProtectSuffix = sourceFileProtectSuffix;
38+
this.styleDelimiters = styleDelimiters;
39+
this.domainSupportProcess = domainSupportProcess;
40+
}
3141

3242
public String getCompliedHost() {
3343
return compliedHost;
@@ -37,11 +47,11 @@ public void setCompliedHost(String compliedHost) {
3747
this.compliedHost = compliedHost;
3848
}
3949

40-
public boolean isSourceFileProtect() {
50+
public Boolean isSourceFileProtect() {
4151
return sourceFileProtect;
4252
}
4353

44-
public void setSourceFileProtect(boolean sourceFileProtect) {
54+
public void setSourceFileProtect(Boolean sourceFileProtect) {
4555
this.sourceFileProtect = sourceFileProtect;
4656
}
4757

@@ -68,10 +78,26 @@ public Integer getVersion() {
6878
public void setVersion(Integer version) {
6979
this.version = version;
7080
}
81+
82+
public Boolean isDomainSupportProcess() {
83+
return domainSupportProcess;
84+
}
85+
86+
public void setDomainSupportProcess(Boolean domainSupportProcess) {
87+
this.domainSupportProcess = domainSupportProcess;
88+
}
7189

90+
// Img表示设置的样式分隔符,只有Img能用;Both表示oss也能用Img的样式分隔符
7291
private String compliedHost;
73-
private boolean sourceFileProtect;
92+
// 是否开启原图保护
93+
private Boolean sourceFileProtect;
94+
// 原图保护的后缀,*表示所有
7495
private String sourceFileProtectSuffix;
96+
// 自定义样式分隔符
7597
private String styleDelimiters;
98+
// 图片服务的版本目前是2,只能读取不能设置
7699
private Integer version;
100+
// 用户是否能够通过OSS域名使用老版图片处理接口。默认Disabled
101+
private Boolean domainSupportProcess;
102+
77103
}

src/test/java/com/aliyun/oss/integrationtests/BucketProcesTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import junit.framework.Assert;
2323

24-
import org.junit.Ignore;
2524
import org.junit.Test;
2625

2726
import com.aliyun.oss.OSSErrorCode;
@@ -31,7 +30,6 @@
3130
import com.aliyun.oss.model.ImageProcess;
3231
import com.aliyun.oss.model.SetBucketProcessRequest;
3332

34-
@Ignore
3533
public class BucketProcesTest extends TestBase {
3634

3735
@Test
@@ -44,6 +42,7 @@ public void testBucketImageProcessConf() {
4442
Assert.assertEquals(bucketProcess.getImageProcess().getSourceFileProtectSuffix(), "");
4543
Assert.assertEquals(bucketProcess.getImageProcess().getStyleDelimiters(), "");
4644
Assert.assertEquals(bucketProcess.getImageProcess().getVersion().intValue(), 2);
45+
Assert.assertEquals(bucketProcess.getImageProcess().isDomainSupportProcess(), null);
4746

4847
// put 1
4948
ImageProcess imageProcess = new ImageProcess("Img", true, "jpg,png", "/,-");
@@ -57,6 +56,7 @@ public void testBucketImageProcessConf() {
5756
Assert.assertEquals(bucketProcess.getImageProcess().getSourceFileProtectSuffix(), "jpg,png");
5857
Assert.assertEquals(bucketProcess.getImageProcess().getStyleDelimiters(), "-,/");
5958
Assert.assertEquals(bucketProcess.getImageProcess().getVersion().intValue(), 2);
59+
Assert.assertEquals(bucketProcess.getImageProcess().isDomainSupportProcess(), null);
6060

6161
// put 2
6262
imageProcess = new ImageProcess("Both", false, "gif", "-");
@@ -70,9 +70,10 @@ public void testBucketImageProcessConf() {
7070
Assert.assertEquals(bucketProcess.getImageProcess().getSourceFileProtectSuffix(), "");
7171
Assert.assertEquals(bucketProcess.getImageProcess().getStyleDelimiters(), "-");
7272
Assert.assertEquals(bucketProcess.getImageProcess().getVersion().intValue(), 2);
73+
Assert.assertEquals(bucketProcess.getImageProcess().isDomainSupportProcess(), null);
7374

7475
// put 3
75-
imageProcess = new ImageProcess("Img", true, "*", "/");
76+
imageProcess = new ImageProcess("Img", true, "*", "/", true);
7677
request = new SetBucketProcessRequest(bucketName, imageProcess);
7778
ossClient.setBucketProcess(request);
7879

@@ -83,6 +84,7 @@ public void testBucketImageProcessConf() {
8384
Assert.assertEquals(bucketProcess.getImageProcess().getSourceFileProtectSuffix(), "*");
8485
Assert.assertEquals(bucketProcess.getImageProcess().getStyleDelimiters(), "/");
8586
Assert.assertEquals(bucketProcess.getImageProcess().getVersion().intValue(), 2);
87+
Assert.assertEquals(bucketProcess.getImageProcess().isDomainSupportProcess(), null);
8688

8789
} catch (Exception e) {
8890
Assert.fail(e.getMessage());

src/test/java/com/aliyun/oss/integrationtests/TestConfig.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,20 @@
2222
public final class TestConfig {
2323

2424
// OSS test configuration
25-
public static String OSS_TEST_ENDPOINT = null;
26-
public static String OSS_TEST_REGION = null;
27-
public static String OSS_TEST_ACCESS_KEY_ID = null;
28-
public static String OSS_TEST_ACCESS_KEY_SECRET = null;
29-
public static String OSS_TEST_ACCESS_KEY_ID_1 = null;
30-
public static String OSS_TEST_ACCESS_KEY_SECRET_1 = null;
25+
// public static String OSS_TEST_ENDPOINT = null;
26+
// public static String OSS_TEST_REGION = null;
27+
// public static String OSS_TEST_ACCESS_KEY_ID = null;
28+
// public static String OSS_TEST_ACCESS_KEY_SECRET = null;
29+
// public static String OSS_TEST_ACCESS_KEY_ID_1 = null;
30+
// public static String OSS_TEST_ACCESS_KEY_SECRET_1 = null;
3131

32+
public static String OSS_TEST_ENDPOINT = "http://oss-us-west-1.aliyuncs.com";
33+
public static String OSS_TEST_REGION = null;
34+
public static String OSS_TEST_ACCESS_KEY_ID = "vX6ik2aG3MYYnouB";
35+
public static String OSS_TEST_ACCESS_KEY_SECRET = "MkvsblmKhReBIETFrfmcm92iI479Yl";
36+
public static String OSS_TEST_ACCESS_KEY_ID_1 = null;
37+
public static String OSS_TEST_ACCESS_KEY_SECRET_1 = null;
38+
3239
// OSS replication test configuration
3340
public static String OSS_TEST_REPLICATION_ENDPOINT = null;
3441
public static String OSS_TEST_REPLICATION_ACCESS_KEY_ID = null;

0 commit comments

Comments
 (0)