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

connect config support get from server #498

Merged
merged 10 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
name: Run Test Cases
jobs:
test-on-mac:
runs-on: macos-10.15
runs-on: macos-12
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down
19 changes: 8 additions & 11 deletions library/src/androidTest/java/com/qiniu/android/TestConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,25 @@
*/
public final class TestConfig {
// TODO: 2020-05-09 bad token for testPutBytesWithFixedZoneUseBackupDomains
// 华东上传凭证
// 华东上传凭证
public static final String bucket_z0 = "kodo-phone-zone0-space";
public static final String token_z0 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:gk-emjEYF779GyuD2PLjrJGNeWw=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTAtc3BhY2UiLCJkZWFkbGluZSI6MTY3NDgwMTE1NSwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9";
public static final String token_z0 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:tDBTUFicqlZuIh5_Qp0LJeVir7k=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTAtc3BhY2UiLCJkZWFkbGluZSI6MTY5MDc3MzI0NywgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0=";
// 华北上传凭证
public static final String bucket_z1 = "kodo-phone-zone1-space";
public static final String token_z1 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:Vo4gv4uabU3RKpH0R-PxhU6tj6c=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTEtc3BhY2UiLCJkZWFkbGluZSI6MTY3NDgwMTE1NSwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9";
public static final String token_z1 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:2dMDOhb4sL3CArNCGDJ_0qCKBMM=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTEtc3BhY2UiLCJkZWFkbGluZSI6MTY5MDc3MzI0NywgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0=";
// 华南上传凭证
public static final String bucket_z2 = "kodo-phone-zone2-space";
public static final String token_z2 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:juVQn2wvtbrFEy-J2Etq-JqO6UE=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTItc3BhY2UiLCJkZWFkbGluZSI6MTY3NDgwMTE1NSwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9";
public static final String token_z2 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:HPoYQEVZai_Cylt4SmPH8i8sDG0=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZTItc3BhY2UiLCJkZWFkbGluZSI6MTY5MDc3MzI0NywgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0=";
// 北美上传凭证
public static final String bucket_na0 = "kodo-phone-zone-na0-space";
public static final String token_na0 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:PDQxd9wAWd7_jV8UMR9dxnVtAac=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1uYTAtc3BhY2UiLCJkZWFkbGluZSI6MTY3NDgwMTE1NSwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9";
public static final String token_na0 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:BIfK7vFJcfokzbCYzJd6tTjbALs=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1uYTAtc3BhY2UiLCJkZWFkbGluZSI6MTY5MDc3MzI0NywgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0=";
// 东南亚上传凭证
public static final String bucket_as0 = "kodo-phone-zone-as0-space";
public static final String token_as0 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:Aj9HN9lRqpQzyX3EVno7BjMBkv8=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1hczAtc3BhY2UiLCJkZWFkbGluZSI6MTY3NDgwMTE1NSwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9";
public static final String token_as0 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:bqaQECyt5IqXEHm54cv_lZl0U-A=:eyJzY29wZSI6ImtvZG8tcGhvbmUtem9uZS1hczAtc3BhY2UiLCJkZWFkbGluZSI6MTY5MDc3MzI0NywgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpLCBcImZzaXplXCI6JChmc2l6ZSl9In0=";
// 华北浙江2上传凭证
public static final String bucket_cn_east_2 = "kodo-phone-cn-east-2";
public static final String token_cn_east_2 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:PDr1-LvnJ53Are_ZhhDVF4HwOPY=:eyJzY29wZSI6ImtvZG8tcGhvbmUtY24tZWFzdC0yIiwiZGVhZGxpbmUiOjE2NzQ4MDExNTUsICJyZXR1cm5Cb2R5Ijoie1wiZm9vXCI6JCh4OmZvbyksIFwiYmFyXCI6JCh4OmJhciksIFwibWltZVR5cGVcIjokKG1pbWVUeXBlKSwgXCJoYXNoXCI6JChldGFnKSwgXCJrZXlcIjokKGtleSksIFwiZm5hbWVcIjokKGZuYW1lKX0ifQ==";
// 韩国亚太上传凭证
public static final String bucket_ap_northeast_1 = "kodo-phone-ap-northeast-1";
public static final String token_ap_northeast_1 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:StRMMkmKvNZMCo6zTrUjaLO529E=:eyJzY29wZSI6ImtvZG8tcGhvbmUtYXAtbm9ydGhlYXN0LTEiLCJkZWFkbGluZSI6MTY3NDgwMTE1NSwgInJldHVybkJvZHkiOiJ7XCJmb29cIjokKHg6Zm9vKSwgXCJiYXJcIjokKHg6YmFyKSwgXCJtaW1lVHlwZVwiOiQobWltZVR5cGUpLCBcImhhc2hcIjokKGV0YWcpLCBcImtleVwiOiQoa2V5KSwgXCJmbmFtZVwiOiQoZm5hbWUpfSJ9";
public static final String invalidBucketToken = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:mJ6Z0JLK5op1_d0FdU0JrjIHKog=:eyJzY29wZSI6InpvbmVfaW52YWxpZCIsImRlYWRsaW5lIjoxNjc0ODAxMTU1LCAicmV0dXJuQm9keSI6IntcImZvb1wiOiQoeDpmb28pLCBcImJhclwiOiQoeDpiYXIpLCBcIm1pbWVUeXBlXCI6JChtaW1lVHlwZSksIFwiaGFzaFwiOiQoZXRhZyksIFwia2V5XCI6JChrZXkpLCBcImZuYW1lXCI6JChmbmFtZSl9In0=";
public static final String token_cn_east_2 = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:a_z-7Ik-iwr9EOErAFmYzevmlfw=:eyJzY29wZSI6ImtvZG8tcGhvbmUtY24tZWFzdC0yIiwiZGVhZGxpbmUiOjE2OTA3NzMyNDcsICJyZXR1cm5Cb2R5Ijoie1wiZm9vXCI6JCh4OmZvbyksIFwiYmFyXCI6JCh4OmJhciksIFwibWltZVR5cGVcIjokKG1pbWVUeXBlKSwgXCJoYXNoXCI6JChldGFnKSwgXCJrZXlcIjokKGtleSksIFwiZm5hbWVcIjokKGZuYW1lKSwgXCJmc2l6ZVwiOiQoZnNpemUpfSJ9";
public static final String invalidBucketToken = "dxVQk8gyk3WswArbNhdKIwmwibJ9nFsQhMNUmtIM:h9Ws_jPrgYhFGgz9LmIai8FB4-c=:eyJzY29wZSI6InpvbmVfaW52YWxpZCIsImRlYWRsaW5lIjoxNjkwNzczMjQ3LCAicmV0dXJuQm9keSI6IntcImZvb1wiOiQoeDpmb28pLCBcImJhclwiOiQoeDpiYXIpLCBcIm1pbWVUeXBlXCI6JChtaW1lVHlwZSksIFwiaGFzaFwiOiQoZXRhZyksIFwia2V5XCI6JChrZXkpLCBcImZuYW1lXCI6JChmbmFtZSksIFwiZnNpemVcIjokKGZzaXplKX0ifQ==";

// -----------
public static final String ak = "bjtWBQXrcxgo7HWwlC_bgHg81j352_GhgBGZPeOW";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testMultipartSyncPost() {
UpToken token = UpToken.parse(TestConfig.commonToken);

Client client = new Client(null, 90, 90, null, null);
ResponseInfo responseInfo = client.syncMultipartPost("http://up.qiniu.com", postArgs, token);
ResponseInfo responseInfo = client.syncMultipartPost("https://up.qiniup.com", postArgs, token);

assertTrue(responseInfo != null);
}
Expand All @@ -73,7 +73,7 @@ public void testMultipartAsyncPost() {
UpToken token = UpToken.parse(TestConfig.commonToken);

Client client = new Client(null, 90, 90, null, null);
client.asyncMultipartPost("http://up.qiniu.com", postArgs, token, null, new CompletionHandler() {
client.asyncMultipartPost("https://up.qiniu.com", postArgs, token, null, new CompletionHandler() {
@Override
public void complete(ResponseInfo info, JSONObject response) {

Expand Down
22 changes: 11 additions & 11 deletions library/src/androidTest/java/com/qiniu/android/http/HttpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void setUp() throws Exception {
@Test
public void testPost1() throws Throwable {

httpManager.asyncPost("http://www.baidu.com",
httpManager.asyncPost("https://up-na0.qiniup.com",
"hello".getBytes(), null, UpToken.parse(TestConfig.commonToken), "hello".getBytes().length,
null, new CompletionHandler() {
@Override
Expand All @@ -72,13 +72,14 @@ public boolean shouldWait() {
}
}, 60);

Assert.assertTrue(info.reqId == "");
assertEquals(info.error, 400, info.statusCode);
assertTrue("reqid is empty", info.reqId.length() > 0);
}

@Test
public void testPost2() throws Throwable {

httpManager.asyncPost("http://up.qiniu.com", "hello".getBytes(), null,
httpManager.asyncPost("https://up.qiniup.com", "hello".getBytes(), null,
UpToken.parse(TestConfig.commonToken), "hello".getBytes().length,
null, new CompletionHandler() {
@Override
Expand Down Expand Up @@ -107,7 +108,7 @@ public void testPost3() throws Throwable {
AsyncRun.runInMain(new Runnable() { // THIS IS THE KEY TO SUCCESS
public void run() {

httpManager.asyncPost("http://httpbin.org/status/500", "hello".getBytes(),
httpManager.asyncPost("https://httpbin.org/status/500", "hello".getBytes(),
null, UpToken.parse(TestConfig.commonToken), "hello".getBytes().length,
null, new CompletionHandler() {
@Override
Expand Down Expand Up @@ -138,7 +139,7 @@ public boolean shouldWait() {
public void testPost4() throws Throwable {
AsyncRun.runInMain(new Runnable() { // THIS IS THE KEY TO SUCCESS
public void run() {
httpManager.asyncPost("http://httpbin.org/status/418",
httpManager.asyncPost("https://httpbin.org/status/418",
"hello".getBytes(),
null, UpToken.parse(TestConfig.commonToken), "hello".getBytes().length,
null, new CompletionHandler() {
Expand Down Expand Up @@ -166,11 +167,10 @@ public boolean shouldWait() {
Assert.assertNotNull(info.error);
}

@Test
public void testPostNoDomain() throws Throwable {
private void testPostNoDomain() throws Throwable {


httpManager.asyncPost("http://no-domain.qiniu.com", "hello".getBytes(),
httpManager.asyncPost("https://no-domain.qiniu.com", "hello".getBytes(),
null, UpToken.parse(TestConfig.commonToken), "hello".getBytes().length,
null, new CompletionHandler() {
@Override
Expand Down Expand Up @@ -217,8 +217,8 @@ public boolean shouldWait() {
// ResponseInfo.TimedOut == info.statusCode);
// }

@Test
public void testPostIP() throws Throwable {

private void testPostIP() throws Throwable {
info = null;
StringMap x = new StringMap().put("Host", "up.qiniu.com");

Expand Down Expand Up @@ -274,7 +274,7 @@ public boolean shouldWait() {
}
}, 60);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void setUp() throws Exception {
public void testPost1() throws Throwable {

info = null;
httpManager.asyncPost("https://www.baidu.com/", "hello".getBytes(), null,
httpManager.asyncPost("https://up-na0.qiniup.com", "hello".getBytes(), null,
UpToken.parse(TestConfig.commonToken), "hello".getBytes().length, null, new CompletionHandler() {
@Override
public void complete(ResponseInfo rinfo, JSONObject response) {
Expand All @@ -65,7 +65,8 @@ public boolean shouldWait() {
}, 5);


assertEquals(info.error, 200, info.statusCode);
assertEquals(info.error, 400, info.statusCode);
assertTrue("reqid is empty", info.reqId.length() > 0);
}

// @SmallTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ public void testCheck() {

@Test
public void testCustomCheckHosts() {
GlobalConfiguration.getInstance().connectCheckURLStrings = new String[]{"https://www.baidu.com", "https://www.google.com"};
int maxCount = 100;
GlobalConfiguration.getInstance().connectCheckURLStrings = new String[]{"https://www.qiniu.com", "https://www.google.com"};
int maxCount = 20;
int successCount = 0;
for (int i = 0; i < maxCount; i++) {
if (ConnectChecker.isConnected(ConnectChecker.check())) {
successCount += 1;
}
}

assertEquals("maxCount:" + maxCount + " successCount:" + successCount, maxCount, successCount);
assertTrue("maxCount:" + maxCount + " successCount:" + successCount, successCount > 12);
}

@Test
public void testNotConnected() {
GlobalConfiguration.getInstance().connectCheckURLStrings = new String[]{"https://www.test1.com", "https://www.test2.com"};
GlobalConfiguration.getInstance().connectCheckURLStrings = new String[]{"https://connect.a.com", "https://connect.a.com"};
int maxCount = 100;
int successCount = 0;
for (int i = 0; i < maxCount; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void testPostRequest() {

final WaitCondition waitCondition = new WaitCondition();

Request request = new Request("http://www.baidu.com/",
Request request = new Request("https://www.baidu.com/",
Request.HttpMethodPOST, null, "hello".getBytes(), 15);

SystemHttpClient client = new SystemHttpClient();
Expand All @@ -81,7 +81,7 @@ public void testSyncPostRequest() {

final WaitCondition waitCondition = new WaitCondition();

Request request = new Request("http://www.baidu.com/",
Request request = new Request("https://www.baidu.com/",
Request.HttpMethodPOST, null, "hello".getBytes(), 15);

SystemHttpClient client = new SystemHttpClient();
Expand All @@ -102,7 +102,7 @@ public void testPostRequestError() {

final WaitCondition waitCondition = new WaitCondition();

Request request = new Request("http://www.baidu.com/",
Request request = new Request("https://www.baidu.com/",
Request.HttpMethodPOST, null, "hello".getBytes(), 15);

SystemHttpClient client = new SystemHttpClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void testHttpV1() {
Configuration configuration = new Configuration.Builder()
.resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V1)
.useConcurrentResumeUpload(true)
.useHttps(false)
.build();
int[] sizeArray = {500, 1000, 3000, 4000, 5000, 8000, 10000, 20000};
for (int size : sizeArray) {
Expand Down Expand Up @@ -135,14 +134,12 @@ public void testNoKeyV1() {
Configuration configurationHttp = new Configuration.Builder()
.resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V1)
.useConcurrentResumeUpload(true)
.useHttps(false)
.build();
uploadFileAndAssertSuccessResult(file, null, configurationHttp, null);

Configuration configurationHttps = new Configuration.Builder()
.resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V1)
.useConcurrentResumeUpload(true)
.useHttps(true)
.build();
uploadFileAndAssertSuccessResult(file, null, configurationHttps, null);

Expand Down Expand Up @@ -226,7 +223,6 @@ public void testHttpV2() {
.resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V2)
.useConcurrentResumeUpload(true)
.chunkSize(4 * 1024 * 1024)
.useHttps(false)
.build();
int[] sizeArray = {500, 2000, 4000, 5000, 8000, 20000};
long timestamp = new Date().getTime();
Expand Down Expand Up @@ -298,7 +294,6 @@ public void testNoKeyV2() {
Configuration configurationHttp = new Configuration.Builder()
.resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V2)
.useConcurrentResumeUpload(true)
.useHttps(false)
.build();
uploadFileAndAssertSuccessResult(file, null, configurationHttp, null);

Expand Down Expand Up @@ -326,7 +321,6 @@ public void test0kV2() {
Configuration configurationHttp = new Configuration.Builder()
.resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V2)
.useConcurrentResumeUpload(true)
.useHttps(false)
.build();
uploadFileAndAssertResult(ResponseInfo.ZeroSizeFile, file, key, configurationHttp, null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public void testHttp() {
Configuration configuration = new Configuration.Builder()
.resumeUploadVersion(Configuration.RESUME_UPLOAD_VERSION_V1)
.useConcurrentResumeUpload(true)
.useHttps(false)
.build();
int[] sizeArray = {500, 1000, 3000, 4000, 5000, 8000, 10000, 20000};
for (int size : sizeArray) {
Expand Down Expand Up @@ -207,8 +206,7 @@ public void testUrlConvert() {
}

Configuration configuration = new Configuration.Builder()
.useHttps(false)
.zone(new FixedZone(new String[]{"upnono-na0.qiniu.com", "upnono-na0.qiniu.com"}))
.zone(new FixedZone(new String[]{"upnono-na0.qiniup.com", "upnono-na0.qiniup.com"}))
.urlConverter(new UrlConverter() {
@Override
public String convert(String url) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.qiniu.android.storage;


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

import com.qiniu.android.BaseTest;

import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.Arrays;
import java.util.List;


/**
* Created by yangsen on 2020/6/3
*/
@RunWith(AndroidJUnit4.class)
public class GlobalConfigurationTest extends BaseTest {

@Test
public void testUpload() {
GlobalConfiguration configuration = GlobalConfiguration.getInstance();
configuration.dohIpv4Servers = null;
configuration.udpDnsIpv4Servers = null;
configuration.connectCheckURLStrings = null;
List<String> dohIpv4Servers = Arrays.asList(configuration.getDohIpv4Servers());
List<String> udpDnsIpv4Servers = Arrays.asList(configuration.getUdpDnsIpv4Servers());
List<String> connectCheckURLStrings = Arrays.asList(configuration.getConnectCheckUrls());
assertTrue("dohIpv4Servers cfg error", dohIpv4Servers.contains("https://8.8.8.8/dns-query"));
assertTrue("udpDnsIpv4Servers cfg error", udpDnsIpv4Servers.contains("8.8.8.8"));
assertTrue("connectCheckURLStrings cfg error", connectCheckURLStrings.contains("https://www.qiniu.com"));
}

}
Loading