Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove region: ap-northeast-1 #500

Merged
merged 7 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Setup Java Version
uses: actions/setup-java@v2
with:
java-version: 11
distribution: temurin
cache: gradle
- name: Run Cases
uses: reactivecircus/android-emulator-runner@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.android.tools.build:gradle:7.0.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Sep 20 17:18:12 CST 2022
#Thu Jul 06 18:09:15 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
5 changes: 4 additions & 1 deletion library/src/androidTest/java/com/qiniu/android/BaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import android.content.Context;

import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.qiniu.android.utils.LogUtil;

import org.junit.Assert;
import org.junit.Before;
Expand All @@ -23,6 +24,8 @@ public class BaseTest {

@Before
public void setUp() throws Exception {
LogUtil.enableLog(true);
LogUtil.enableDate(true);
context = ApplicationProvider.getApplicationContext();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

import com.qiniu.android.BaseTest;
import com.qiniu.android.http.ResponseInfo;

import junit.framework.Assert;
Expand All @@ -10,6 +11,7 @@
import org.junit.runner.RunWith;

import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
Expand All @@ -22,7 +24,7 @@
*/

@RunWith(AndroidJUnit4.class)
public class PipelineTest {
public class PipelineTest extends BaseTest {
final CountDownLatch signal = new CountDownLatch(1);
private volatile ResponseInfo info = null;

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

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

try {
signal.await(1200, TimeUnit.SECONDS); // wait for callback
Assert.assertNotNull("timeout", info);
assertNotNull("timeout", info);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(info);
// Assert.assertTrue(info.isOK());
// assertTrue(info.isOK());
}

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

try {
signal.await(1200, TimeUnit.SECONDS); // wait for callback
Assert.assertNotNull("timeout", info);
assertNotNull("timeout", info);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Assert.assertTrue(info.isOK());
// assertTrue(info.isOK());
}

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

try {
signal.await(1200, TimeUnit.SECONDS); // wait for callback
Assert.assertNotNull("timeout", info);
assertNotNull("timeout", info);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(info);
// Assert.assertTrue(info.isOK());
// assertTrue(info.isOK());
}

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

try {
signal.await(1200, TimeUnit.SECONDS); // wait for callback
Assert.assertNotNull("timeout", info);
assertNotNull("timeout", info);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Assert.assertTrue(info.isOK());
// assertTrue(info.isOK());
}

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

try {
signal.await(1200, TimeUnit.SECONDS); // wait for callback
Assert.assertNotNull("timeout", info);
assertNotNull("timeout", info);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Assert.assertTrue(info.isOK());
// assertTrue(info.isOK());
}

static class A {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void complete(boolean isSuccess) {
// public void testSplitE() {
// String s1 = "bkt:key";
// String s2 = "bkt";
// Assert.assertEquals(s1.split(":")[0], s2.split(":")[0]);
// assertEquals(s1.split(":")[0], s2.split(":")[0]);
// }

private boolean isTestUCServerComplete = false;
Expand Down
32 changes: 16 additions & 16 deletions library/src/androidTest/java/com/qiniu/android/http/HttpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testPost1() throws Throwable {
null, new CompletionHandler() {
@Override
public void complete(ResponseInfo rinfo, JSONObject response) {
Assert.assertNotNull(rinfo);
assertNotNull(rinfo);
LogUtil.d(rinfo.toString());
info = rinfo;
}
Expand Down Expand Up @@ -100,7 +100,7 @@ public boolean shouldWait() {
}
}, 60);

Assert.assertNotNull(info.reqId);
assertNotNull(info.reqId);
}

@Test
Expand Down Expand Up @@ -131,8 +131,8 @@ public boolean shouldWait() {
}
}, 60);

Assert.assertEquals(500, info.statusCode);
Assert.assertNotNull(info.error);
assertEquals(500, info.statusCode);
assertNotNull(info.error);
}

@Test
Expand Down Expand Up @@ -163,8 +163,9 @@ public boolean shouldWait() {
}
}, 60);

Assert.assertEquals(418, info.statusCode);
Assert.assertNotNull(info.error);
assertTrue("status code:" + info.statusCode, info.statusCode == 418 || info.statusCode % 100 == 5);
assertEquals(418, info.statusCode);
assertNotNull(info.error);
}

private void testPostNoDomain() throws Throwable {
Expand All @@ -190,8 +191,8 @@ public boolean shouldWait() {
}
}
}, 60);
Assert.assertEquals("", info.reqId);
Assert.assertEquals(ResponseInfo.UnknownHost, info.statusCode);
assertEquals("", info.reqId);
assertEquals(ResponseInfo.UnknownHost, info.statusCode);
}

// @SmallTest
Expand All @@ -212,8 +213,8 @@ public boolean shouldWait() {
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// Assert.assertEquals("", info.reqId);
// Assert.assertTrue(ResponseInfo.CannotConnectToHost == info.statusCode ||
// assertEquals("", info.reqId);
// assertTrue(ResponseInfo.CannotConnectToHost == info.statusCode ||
// ResponseInfo.TimedOut == info.statusCode);
// }

Expand Down Expand Up @@ -243,12 +244,11 @@ public boolean shouldWait() {
}
}, 60);

Assert.assertTrue(!"".equals(info.reqId));
Assert.assertEquals(400, info.statusCode);
assertTrue(!"".equals(info.reqId));
assertEquals(400, info.statusCode);
}

@Test
public void testProxy() throws Throwable {
private void testProxy() throws Throwable {
StringMap x = new StringMap();
ProxyConfiguration p = new ProxyConfiguration("115.238.101.32", 80);
Client c = new Client(p, 10, 30, null, null);
Expand All @@ -274,8 +274,8 @@ public boolean shouldWait() {
}
}, 60);

Assert.assertTrue(info.reqId.length() > 0);
Assert.assertEquals(400, info.statusCode);
assertTrue(info.reqId.length() > 0);
assertEquals(400, info.statusCode);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ public boolean shouldWait() {
// e.printStackTrace();
// }
// // cert is not match
// Assert.assertEquals(info.error, -1, info.statusCode);
// assertEquals(info.error, -1, info.statusCode);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testUCQuery(){
requestTransaction.queryUploadHosts(true, new RequestTransaction.RequestCompleteHandler() {
@Override
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
Assert.assertTrue("pass", responseInfo.isOK());
assertTrue("pass", responseInfo.isOK());
waitCondition.shouldWait = false;
}
});
Expand Down Expand Up @@ -71,7 +71,7 @@ public void progress(long totalBytesWritten, long totalBytesExpectedToWrite) {
}, new RequestTransaction.RequestCompleteHandler() {
@Override
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
Assert.assertTrue("pass", responseInfo.isOK());
assertTrue("pass", responseInfo.isOK());
waitCondition.shouldWait = false;
}
});
Expand All @@ -97,7 +97,7 @@ public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics reque
} catch (JSONException e) {}

if (ct == null) {
Assert.assertTrue("pass", false);
assertTrue("pass", false);
waitCondition.shouldWait = false;
return;
}
Expand All @@ -114,26 +114,26 @@ public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics reque
} catch (JSONException e) {}

if (ct_02 == null) {
Assert.assertTrue("pass", false);
assertTrue("pass", false);
waitCondition.shouldWait = false;
return;
}

makeFile(new String[]{ct_02}, new RequestTransaction.RequestCompleteHandler() {
@Override
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
Assert.assertTrue("pass", responseInfo.isOK());
assertTrue("pass", responseInfo.isOK());
waitCondition.shouldWait = false;
}
});
} else {
Assert.assertTrue("pass", false);
assertTrue("pass", false);
waitCondition.shouldWait = false;
}
}
});
} else {
Assert.fail("fail");
fail("fail");
waitCondition.shouldWait = false;
}
}
Expand Down Expand Up @@ -191,7 +191,7 @@ public void testMakeFileError(){
makeFile(null, new RequestTransaction.RequestCompleteHandler() {
@Override
public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) {
Assert.assertTrue("pass", !responseInfo.isOK());
assertTrue("pass", !responseInfo.isOK());
waitCondition.shouldWait = false;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void checkTemp(Temp[] ts, String type) {
LogUtil.d(type + " " + failedCount);
if (failedCount > ts.length / 2) {
String info = type + ": 共 " + ts.length + "个测试,至多允许 " + ts.length / 2 + " 失败,实际失败 " + failedCount + " 个: " + tt.info.toString();
Assert.assertEquals(info, tt.expectKey, tt.key);
assertEquals(info, tt.expectKey, tt.key);
}
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public void complete(String k, ResponseInfo rinfo, JSONObject response) {

try {
signal.await(570, TimeUnit.SECONDS); // wait for callback
Assert.assertNotNull("timeout", temp.info);
assertNotNull("timeout", temp.info);
} catch (InterruptedException e) {
e.printStackTrace();
}
Expand Down
Loading