Skip to content

Commit e02dc3b

Browse files
authored
Merge pull request #222 from longbai/multizone-auto
multizone auto
2 parents 624b8c0 + 6f09ee8 commit e02dc3b

25 files changed

+549
-125
lines changed

.idea/.name

Lines changed: 0 additions & 1 deletion
This file was deleted.

.idea/compiler.xml

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

.idea/encodings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/gradle.xml

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

.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.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#Changelog
22

3+
## 7.3.0 (2016-09-30)
4+
5+
### 增加
6+
* 自动判断上传存储区
7+
38
## 7.2.3 (2016-09-07)
49

510
### 增加

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.test.suitebuilder.annotation.SmallTest;
66
import android.util.Log;
77

8+
import com.qiniu.android.common.FixedZone;
89
import com.qiniu.android.common.ServiceAddress;
910
import com.qiniu.android.common.Zone;
1011
import com.qiniu.android.http.ResponseInfo;
@@ -338,8 +339,8 @@ public void testNoComplete() {
338339

339340
@SmallTest
340341
public void testIpBack() throws Throwable {
341-
ServiceAddress s = new ServiceAddress("http://upwelcome.qiniu.com", Zone.zone0.up.backupIps);
342-
Zone z = new Zone(s, Zone.zone0.upBackup);
342+
ServiceAddress s = new ServiceAddress("http://upwelcome.qiniu.com", Zone.zone0.upHost("").backupIps);
343+
Zone z = new FixedZone(s, Zone.zone0.upHostBackup(""));
343344
Configuration c = new Configuration.Builder()
344345
.zone(z)
345346
.build();
@@ -377,7 +378,7 @@ public void complete(String k, ResponseInfo rinfo, JSONObject response) {
377378
@SmallTest
378379
public void testPortBackup() throws Throwable {
379380
ServiceAddress s = new ServiceAddress("http://upload.qiniu.com:9999", null);
380-
Zone z = new Zone(s, Zone.zone0.upBackup);
381+
Zone z = new FixedZone(s, Zone.zone0.upHostBackup(""));
381382
Configuration c = new Configuration.Builder()
382383
.zone(z)
383384
.build();
@@ -413,8 +414,8 @@ public void complete(String k, ResponseInfo rinfo, JSONObject response) {
413414

414415
@SmallTest
415416
public void testDnsHijacking() throws Throwable {
416-
ServiceAddress s = new ServiceAddress("http://uphijacktest.qiniu.com", Zone.zone0.up.backupIps);
417-
Zone z = new Zone(s, Zone.zone0.upBackup);
417+
ServiceAddress s = new ServiceAddress("http://uphijacktest.qiniu.com", Zone.zone0.upHost("").backupIps);
418+
Zone z = new FixedZone(s, Zone.zone0.upHostBackup(""));
418419
Configuration c = new Configuration.Builder()
419420
.zone(z)
420421
.build();
@@ -456,7 +457,7 @@ public void testHttps() throws Throwable {
456457
params.put("x:foo", "fooval");
457458
final UploadOptions opt = new UploadOptions(params, null, true, null, null);
458459
ServiceAddress s = new ServiceAddress("https://up.qbox.me", null);
459-
Zone z = new Zone(s, Zone.zone0.upBackup);
460+
Zone z = new FixedZone(s, Zone.zone0.upHostBackup(""));
460461
Configuration c = new Configuration.Builder()
461462
.zone(z)
462463
.build();

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -156,28 +156,28 @@ public void complete(ResponseInfo rinfo, JSONObject response) {
156156
Assert.assertEquals(ResponseInfo.UnknownHost, info.statusCode);
157157
}
158158

159-
@SmallTest
160-
public void testPostNoPort() throws Throwable {
161-
162-
httpManager.asyncPost("http://up.qiniu.com:12345", "hello".getBytes(),
163-
null, null, new CompletionHandler() {
164-
@Override
165-
public void complete(ResponseInfo rinfo, JSONObject response) {
166-
Log.d("qiniutest", rinfo.toString());
167-
info = rinfo;
168-
signal.countDown();
169-
}
170-
}, null);
171-
172-
try {
173-
signal.await(60, TimeUnit.SECONDS); // wait for callback
174-
} catch (InterruptedException e) {
175-
e.printStackTrace();
176-
}
177-
Assert.assertEquals("", info.reqId);
178-
Assert.assertTrue(ResponseInfo.CannotConnectToHost == info.statusCode ||
179-
ResponseInfo.TimedOut == info.statusCode);
180-
}
159+
// @SmallTest
160+
// public void testPostNoPort() throws Throwable {
161+
//
162+
// httpManager.asyncPost("http://up.qiniu.com:12345", "hello".getBytes(),
163+
// null, null, new CompletionHandler() {
164+
// @Override
165+
// public void complete(ResponseInfo rinfo, JSONObject response) {
166+
// Log.d("qiniutest", rinfo.toString());
167+
// info = rinfo;
168+
// signal.countDown();
169+
// }
170+
// }, null);
171+
//
172+
// try {
173+
// signal.await(60, TimeUnit.SECONDS); // wait for callback
174+
// } catch (InterruptedException e) {
175+
// e.printStackTrace();
176+
// }
177+
// Assert.assertEquals("", info.reqId);
178+
// Assert.assertTrue(ResponseInfo.CannotConnectToHost == info.statusCode ||
179+
// ResponseInfo.TimedOut == info.statusCode);
180+
// }
181181

182182
@SmallTest
183183
public void testPostIP() throws Throwable {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.test.suitebuilder.annotation.SmallTest;
66
import android.util.Log;
77

8+
import com.qiniu.android.common.FixedZone;
89
import com.qiniu.android.common.ServiceAddress;
910
import com.qiniu.android.common.Zone;
1011
import com.qiniu.android.http.ResponseInfo;
@@ -36,7 +37,7 @@ public class PortTest extends InstrumentationTestCase {
3637
@Override
3738
protected void setUp() throws Exception {
3839
ServiceAddress s1 = new ServiceAddress("http://upload.qiniu.com:8888");
39-
Zone z = new Zone(s1, s1);
40+
Zone z = new FixedZone(s1, s1);
4041
Configuration config = new Configuration.Builder().zone(z).build();
4142
uploadManager = new UploadManager(config);
4243
}

0 commit comments

Comments
 (0)