Skip to content

Commit e021e55

Browse files
authored
Merge branch 'master' into update_mvn_push
2 parents 6cee162 + 6690c4b commit e021e55

File tree

20 files changed

+132
-126
lines changed

20 files changed

+132
-126
lines changed

.github/workflows/ci-test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ jobs:
1414
uses: actions/checkout@v2
1515
with:
1616
ref: ${{ github.ref }}
17+
- name: Setup Java Version
18+
uses: actions/setup-java@v2
19+
with:
20+
java-version: 11
21+
distribution: temurin
22+
cache: gradle
1723
- name: Run Cases
1824
uses: reactivecircus/android-emulator-runner@v2
1925
with:

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ buildscript {
1010
}
1111
dependencies {
1212
classpath 'com.android.tools.build:gradle:7.1.3'
13+
1314
// NOTE: Do not place your application dependencies here; they belong
1415
// in the individual module build.gradle files
1516
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Sep 20 17:18:12 CST 2022
1+
#Thu Jul 06 18:09:15 CST 2023
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

library/src/androidTest/java/com/qiniu/android/BaseTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
import android.content.Context;
44

55
import androidx.test.core.app.ApplicationProvider;
6-
import androidx.test.ext.junit.runners.AndroidJUnit4;
6+
7+
import com.qiniu.android.utils.LogUtil;
78

89
import org.junit.Assert;
910
import org.junit.Before;
@@ -23,6 +24,8 @@ public class BaseTest {
2324

2425
@Before
2526
public void setUp() throws Exception {
27+
LogUtil.enableLog(true);
28+
LogUtil.enableDate(true);
2629
context = ApplicationProvider.getApplicationContext();
2730
}
2831

library/src/androidTest/java/com/qiniu/android/bigdata/pipeline/PipelineTest.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import androidx.test.ext.junit.runners.AndroidJUnit4;
44

5+
import com.qiniu.android.BaseTest;
56
import com.qiniu.android.http.ResponseInfo;
67

78
import junit.framework.Assert;
@@ -10,6 +11,7 @@
1011
import org.junit.runner.RunWith;
1112

1213
import java.util.ArrayList;
14+
import java.util.Base64;
1315
import java.util.Date;
1416
import java.util.HashMap;
1517
import java.util.List;
@@ -22,7 +24,7 @@
2224
*/
2325

2426
@RunWith(AndroidJUnit4.class)
25-
public class PipelineTest {
27+
public class PipelineTest extends BaseTest {
2628
final CountDownLatch signal = new CountDownLatch(1);
2729
private volatile ResponseInfo info = null;
2830

@@ -34,7 +36,7 @@ public void testPoint() {
3436
Map<String, Integer> m = new HashMap<>();
3537
m.put("a", 3);
3638
Points.formatPoint(m, b2);
37-
Assert.assertEquals(b1.toString(), b2.toString());
39+
assertEquals(b1.toString(), b2.toString());
3840
}
3941

4042
@Test
@@ -56,12 +58,12 @@ public void complete(ResponseInfo inf) {
5658

5759
try {
5860
signal.await(1200, TimeUnit.SECONDS); // wait for callback
59-
Assert.assertNotNull("timeout", info);
61+
assertNotNull("timeout", info);
6062
} catch (InterruptedException e) {
6163
e.printStackTrace();
6264
}
6365
System.out.println(info);
64-
// Assert.assertTrue(info.isOK());
66+
// assertTrue(info.isOK());
6567
}
6668

6769
@Test
@@ -77,11 +79,11 @@ public void complete(ResponseInfo inf) {
7779

7880
try {
7981
signal.await(1200, TimeUnit.SECONDS); // wait for callback
80-
Assert.assertNotNull("timeout", info);
82+
assertNotNull("timeout", info);
8183
} catch (InterruptedException e) {
8284
e.printStackTrace();
8385
}
84-
// Assert.assertTrue(info.isOK());
86+
// assertTrue(info.isOK());
8587
}
8688

8789
@Test
@@ -106,12 +108,12 @@ public void complete(ResponseInfo inf) {
106108

107109
try {
108110
signal.await(1200, TimeUnit.SECONDS); // wait for callback
109-
Assert.assertNotNull("timeout", info);
111+
assertNotNull("timeout", info);
110112
} catch (InterruptedException e) {
111113
e.printStackTrace();
112114
}
113115
System.out.println(info);
114-
// Assert.assertTrue(info.isOK());
116+
// assertTrue(info.isOK());
115117
}
116118

117119
@Test
@@ -130,11 +132,11 @@ public void complete(ResponseInfo inf) {
130132

131133
try {
132134
signal.await(1200, TimeUnit.SECONDS); // wait for callback
133-
Assert.assertNotNull("timeout", info);
135+
assertNotNull("timeout", info);
134136
} catch (InterruptedException e) {
135137
e.printStackTrace();
136138
}
137-
// Assert.assertTrue(info.isOK());
139+
// assertTrue(info.isOK());
138140
}
139141

140142
@Test
@@ -153,11 +155,11 @@ public void complete(ResponseInfo inf) {
153155

154156
try {
155157
signal.await(1200, TimeUnit.SECONDS); // wait for callback
156-
Assert.assertNotNull("timeout", info);
158+
assertNotNull("timeout", info);
157159
} catch (InterruptedException e) {
158160
e.printStackTrace();
159161
}
160-
// Assert.assertTrue(info.isOK());
162+
// assertTrue(info.isOK());
161163
}
162164

163165
static class A {

library/src/androidTest/java/com/qiniu/android/common/AutoZoneTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void complete(boolean isSuccess) {
100100
// public void testSplitE() {
101101
// String s1 = "bkt:key";
102102
// String s2 = "bkt";
103-
// Assert.assertEquals(s1.split(":")[0], s2.split(":")[0]);
103+
// assertEquals(s1.split(":")[0], s2.split(":")[0]);
104104
// }
105105

106106
private boolean isTestUCServerComplete = false;

library/src/androidTest/java/com/qiniu/android/http/HttpTest.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void testPost1() throws Throwable {
5555
null, new CompletionHandler() {
5656
@Override
5757
public void complete(ResponseInfo rinfo, JSONObject response) {
58-
Assert.assertNotNull(rinfo);
58+
assertNotNull(rinfo);
5959
LogUtil.d(rinfo.toString());
6060
info = rinfo;
6161
}
@@ -100,7 +100,7 @@ public boolean shouldWait() {
100100
}
101101
}, 60);
102102

103-
Assert.assertNotNull(info.reqId);
103+
assertNotNull(info.reqId);
104104
}
105105

106106
@Test
@@ -131,8 +131,8 @@ public boolean shouldWait() {
131131
}
132132
}, 60);
133133

134-
Assert.assertEquals(500, info.statusCode);
135-
Assert.assertNotNull(info.error);
134+
assertEquals(500, info.statusCode);
135+
assertNotNull(info.error);
136136
}
137137

138138
@Test
@@ -163,8 +163,8 @@ public boolean shouldWait() {
163163
}
164164
}, 60);
165165

166-
Assert.assertEquals(418, info.statusCode);
167-
Assert.assertNotNull(info.error);
166+
assertTrue("status code:" + info.statusCode, info.statusCode == 418 || (info.statusCode / 100 == 5));
167+
assertNotNull(info.error);
168168
}
169169

170170
private void testPostNoDomain() throws Throwable {
@@ -190,8 +190,8 @@ public boolean shouldWait() {
190190
}
191191
}
192192
}, 60);
193-
Assert.assertEquals("", info.reqId);
194-
Assert.assertEquals(ResponseInfo.UnknownHost, info.statusCode);
193+
assertEquals("", info.reqId);
194+
assertEquals(ResponseInfo.UnknownHost, info.statusCode);
195195
}
196196

197197
// @SmallTest
@@ -212,8 +212,8 @@ public boolean shouldWait() {
212212
// } catch (InterruptedException e) {
213213
// e.printStackTrace();
214214
// }
215-
// Assert.assertEquals("", info.reqId);
216-
// Assert.assertTrue(ResponseInfo.CannotConnectToHost == info.statusCode ||
215+
// assertEquals("", info.reqId);
216+
// assertTrue(ResponseInfo.CannotConnectToHost == info.statusCode ||
217217
// ResponseInfo.TimedOut == info.statusCode);
218218
// }
219219

@@ -243,12 +243,11 @@ public boolean shouldWait() {
243243
}
244244
}, 60);
245245

246-
Assert.assertTrue(!"".equals(info.reqId));
247-
Assert.assertEquals(400, info.statusCode);
246+
assertTrue(!"".equals(info.reqId));
247+
assertEquals(400, info.statusCode);
248248
}
249249

250-
@Test
251-
public void testProxy() throws Throwable {
250+
private void testProxy() throws Throwable {
252251
StringMap x = new StringMap();
253252
ProxyConfiguration p = new ProxyConfiguration("115.238.101.32", 80);
254253
Client c = new Client(p, 10, 30, null, null);
@@ -274,8 +273,8 @@ public boolean shouldWait() {
274273
}
275274
}, 60);
276275

277-
Assert.assertTrue(info.reqId.length() > 0);
278-
Assert.assertEquals(400, info.statusCode);
276+
assertTrue(info.reqId.length() > 0);
277+
assertEquals(400, info.statusCode);
279278
}
280279

281280
@Test

library/src/androidTest/java/com/qiniu/android/http/HttpsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ public boolean shouldWait() {
117117
// e.printStackTrace();
118118
// }
119119
// // cert is not match
120-
// Assert.assertEquals(info.error, -1, info.statusCode);
120+
// assertEquals(info.error, -1, info.statusCode);
121121
// }
122122
}

library/src/androidTest/java/com/qiniu/android/http/request/RequestTransactionTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void testUCQuery(){
3939
requestTransaction.queryUploadHosts(true, new RequestTransaction.RequestCompleteHandler() {
4040
@Override
4141
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
42-
Assert.assertTrue("pass", responseInfo.isOK());
42+
assertTrue("pass", responseInfo.isOK());
4343
waitCondition.shouldWait = false;
4444
}
4545
});
@@ -71,7 +71,7 @@ public void progress(long totalBytesWritten, long totalBytesExpectedToWrite) {
7171
}, new RequestTransaction.RequestCompleteHandler() {
7272
@Override
7373
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
74-
Assert.assertTrue("pass", responseInfo.isOK());
74+
assertTrue("pass", responseInfo.isOK());
7575
waitCondition.shouldWait = false;
7676
}
7777
});
@@ -97,7 +97,7 @@ public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics reque
9797
} catch (JSONException e) {}
9898

9999
if (ct == null) {
100-
Assert.assertTrue("pass", false);
100+
assertTrue("pass", false);
101101
waitCondition.shouldWait = false;
102102
return;
103103
}
@@ -114,26 +114,26 @@ public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics reque
114114
} catch (JSONException e) {}
115115

116116
if (ct_02 == null) {
117-
Assert.assertTrue("pass", false);
117+
assertTrue("pass", false);
118118
waitCondition.shouldWait = false;
119119
return;
120120
}
121121

122122
makeFile(new String[]{ct_02}, new RequestTransaction.RequestCompleteHandler() {
123123
@Override
124124
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
125-
Assert.assertTrue("pass", responseInfo.isOK());
125+
assertTrue("pass", responseInfo.isOK());
126126
waitCondition.shouldWait = false;
127127
}
128128
});
129129
} else {
130-
Assert.assertTrue("pass", false);
130+
assertTrue("pass", false);
131131
waitCondition.shouldWait = false;
132132
}
133133
}
134134
});
135135
} else {
136-
Assert.fail("fail");
136+
fail("fail");
137137
waitCondition.shouldWait = false;
138138
}
139139
}
@@ -191,7 +191,7 @@ public void testMakeFileError(){
191191
makeFile(null, new RequestTransaction.RequestCompleteHandler() {
192192
@Override
193193
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
194-
Assert.assertTrue("pass", !responseInfo.isOK());
194+
assertTrue("pass", !responseInfo.isOK());
195195
waitCondition.shouldWait = false;
196196
}
197197
});

0 commit comments

Comments
 (0)