From 04841893195939a8692d07599f44b68ce9ff2c72 Mon Sep 17 00:00:00 2001 From: Sxci Date: Tue, 30 Oct 2018 12:56:44 +0800 Subject: [PATCH 1/2] upgrade dependents --- build.gradle | 4 ++-- src/main/java/com/qiniu/storage/model/BucketInfo.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index f8a47d1a1..13bc67916 100755 --- a/build.gradle +++ b/build.gradle @@ -12,8 +12,8 @@ repositories { } dependencies { - compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.9.1' - compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2' + compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.11.0' + compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5' testCompile group: 'com.qiniu', name: 'happy-dns-java', version: '0.1.6' testCompile group: 'junit', name: 'junit', version: '4.12' } diff --git a/src/main/java/com/qiniu/storage/model/BucketInfo.java b/src/main/java/com/qiniu/storage/model/BucketInfo.java index 7070c6165..195930d7b 100644 --- a/src/main/java/com/qiniu/storage/model/BucketInfo.java +++ b/src/main/java/com/qiniu/storage/model/BucketInfo.java @@ -9,10 +9,12 @@ public class BucketInfo { private String imageSource; @SerializedName("host") private String imageHost; + // CHECKSTYLE:OFF @SerializedName("protected") private int _protected; @SerializedName("private") private int _private; + // CHECKSTYLE:ON @SerializedName("no_index_page") private int noIndexPage; private int imgsft; From 1edb9cbaf2a44d0cb8ef42b8ba6cac8076851f7c Mon Sep 17 00:00:00 2001 From: Sxci Date: Tue, 30 Oct 2018 13:16:28 +0800 Subject: [PATCH 2/2] update test [ci skip] --- .../test/com/qiniu/storage/BucketTest.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/test/java/test/com/qiniu/storage/BucketTest.java b/src/test/java/test/com/qiniu/storage/BucketTest.java index 939fb9962..0d67e2328 100644 --- a/src/test/java/test/com/qiniu/storage/BucketTest.java +++ b/src/test/java/test/com/qiniu/storage/BucketTest.java @@ -21,6 +21,11 @@ public class BucketTest extends TestCase { private BucketManager bucketManagerNa0; private BucketManager dummyBucketManager; + ArrayList batchStatusCode = new ArrayList(){{ + this.add(200); + this.add(298); + }}; + @Override protected void setUp() throws Exception { //default config @@ -353,7 +358,7 @@ public void testBatchCopy() { try { Response r = bucketManager.batch(ops); BatchStatus[] bs = r.jsonToObject(BatchStatus[].class); - assertEquals(200, bs[0].code); + Assert.assertTrue("200 or 298", batchStatusCode.contains(bs[0].code)); } catch (QiniuException e) { fail(e.response.toString()); } @@ -361,7 +366,7 @@ public void testBatchCopy() { try { Response r = bucketManager.batch(ops); BatchStatus[] bs = r.jsonToObject(BatchStatus[].class); - assertEquals(200, bs[0].code); + Assert.assertTrue("200 or 298", batchStatusCode.contains(bs[0].code)); } catch (QiniuException e) { fail(e.response.toString()); } @@ -388,7 +393,7 @@ public void testBatchMove() { try { Response r = bucketManager.batch(ops); BatchStatus[] bs = r.jsonToObject(BatchStatus[].class); - assertEquals(200, bs[0].code); + Assert.assertTrue("200 or 298", batchStatusCode.contains(bs[0].code)); } catch (QiniuException e) { fail(e.response.toString()); } @@ -420,7 +425,7 @@ public void testBatchRename() { try { Response r = bucketManager.batch(ops); BatchStatus[] bs = r.jsonToObject(BatchStatus[].class); - assertEquals(200, bs[0].code); + Assert.assertTrue("200 or 298", batchStatusCode.contains(bs[0].code)); } catch (QiniuException e) { fail(e.response.toString()); } @@ -449,7 +454,7 @@ public void testBatchStat() { try { Response r = bucketManager.batch(ops); BatchStatus[] bs = r.jsonToObject(BatchStatus[].class); - assertEquals(200, bs[0].code); + Assert.assertTrue("200 or 298", batchStatusCode.contains(bs[0].code)); } catch (QiniuException e) { fail(e.response.toString()); } @@ -485,7 +490,7 @@ public void testBatchChangeType() { try { Response r = bucketManager.batch(ops); BatchStatus[] bs = r.jsonToObject(BatchStatus[].class); - assertEquals(200, bs[0].code); + Assert.assertTrue("200 or 298", batchStatusCode.contains(bs[0].code)); } catch (QiniuException e) { fail(e.response.toString()); } finally { @@ -519,9 +524,10 @@ public void testBatchCopyChgmDelete() { ops.addCopyOp(bucket, key, bucket, keyArray[i]); } + try { Response response = bucketManager.batch(ops); - Assert.assertEquals(200, response.statusCode); + Assert.assertTrue("200 or 298", batchStatusCode.contains(response.statusCode)); //clear ops ops.clearOps(); @@ -531,14 +537,14 @@ public void testBatchCopyChgmDelete() { ops.addChgmOp(bucket, keyArray[i], "image/png"); } response = bucketManager.batch(ops); - Assert.assertEquals(200, response.statusCode); + Assert.assertTrue("200 or 298", batchStatusCode.contains(response.statusCode)); //clear ops for (int i = 0; i < keyArray.length; i++) { ops.addDeleteOp(bucket, keyArray[i]); } response = bucketManager.batch(ops); - Assert.assertEquals(200, response.statusCode); + Assert.assertTrue("200 or 298", batchStatusCode.contains(response.statusCode)); } catch (QiniuException e) { fail(e.response.toString()); @@ -580,7 +586,7 @@ public void testBatch() { Response r = bucketManager.batch(ops); BatchStatus[] bs = r.jsonToObject(BatchStatus[].class); for (BatchStatus b : bs) { - assertEquals(200, b.code); + Assert.assertTrue("200 or 298", batchStatusCode.contains(b.code)); } } catch (QiniuException e) { fail(e.response.toString());