Skip to content

Commit f3194de

Browse files
committed
trauis untest
1 parent 7508e50 commit f3194de

File tree

4 files changed

+47
-24
lines changed

4 files changed

+47
-24
lines changed

.gitignore

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
# Gradle
2-
build/
3-
.gradle
1+
# built application files
2+
*.apk
3+
*.ap_
4+
5+
# files for the dex VM
6+
*.dex
7+
8+
# Java class files
9+
*.class
410

5-
#Java
6-
.class
11+
# generated files
12+
bin/
13+
gen/
714

8-
#Android
9-
.apk
10-
.dex
15+
# Local configuration file (sdk path, etc)
16+
local.properties
17+
18+
# Eclipse project files
19+
.classpath
20+
.project
21+
.settings
22+
23+
# Gradle
24+
.gradle
25+
build/

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ before_script:
3333

3434
script:
3535
- ./gradlew build
36+
- ./gradlew connectedInstrumentTest

build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,16 @@ android {
2525
}
2626

2727
instrumentTest.setRoot('tests')
28+
instrumentTest {
29+
java.srcDirs = ['tests/src']
30+
res.srcDirs = ['res']
31+
assets.srcDirs = ['assets']
32+
resources.srcDirs = ['tests/src']
33+
}
2834
}
2935

3036
dependencies {
3137
compile fileTree(dir: 'libs', include: '*.jar')
3238
}
3339
}
40+
// if don't find sdk, please set the local.properties

src/test/com/qiniu/test/UploadTest.java renamed to tests/src/com/qiniu/test/UploadTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,35 @@
2424

2525
public class UploadTest extends AndroidTestCase {
2626
private String uptoken = "acmKu7Hie1OQ3t31bAovR6JORFX72MMpTicc2xje:n6I4SuMAxBgZ6o3qh8z1bMWqKow=:eyJzY29wZSI6ImFhYTUiLCJyZXR1cm5Cb2R5Ijoie1wiaGFzaFwiOlwiJChldGFnKVwiLFwia2V5XCI6XCIkKGtleSlcIixcImZuYW1lXCI6XCIgJChmbmFtZSkgXCIsXCJmc2l6ZVwiOlwiJChmc2l6ZSlcIixcImF2aW5mb1wiOlwiJChhdmluZm8pXCIsXCJ4OnRlc3RfbmFtZVwiOlwiJCh4OnRlc3RfbmFtZSlcIixcIm5vbnh0ZXN05Lit5paHX25hbWVcIjpcIiQobm9ueHRlc3TkuK3mlodfbmFtZSlcIn0iLCJkZWFkbGluZSI6MTQzMjg2ODA3NH0=";
27-
27+
2828
private File file;
29-
29+
3030
private boolean uploading;
3131
private boolean success;
3232
private JSONObjectRet jsonRet;
3333
private JSONObject resp;
3434
private Exception e;
35-
35+
3636
private Context context;
3737
private Uri uri;
3838
private com.qiniu.io.PutExtra extra;
3939
private String key = IO.UNDEFINED_KEY;
40-
40+
4141
private com.qiniu.resumableio.PutExtra rextra;
4242

4343
public void setUp() throws Exception {
4444
key = UUID.randomUUID().toString();
4545
uploading = true;
4646
success = false;
47-
47+
4848
extra = new com.qiniu.io.PutExtra();
4949
extra.params = new HashMap<String, String>();
5050
extra.params.put("x:a", "测试中文信息");
51-
51+
5252
rextra = new com.qiniu.resumableio.PutExtra();
5353
rextra.params = new HashMap<String, String>();
5454
rextra.params.put("x:a", "测试中文信息");
55-
55+
5656
context = this.getContext();
5757
jsonRet = new JSONObjectRet() {
5858
@Override
@@ -94,16 +94,16 @@ public void testS() throws IOException, JSONException {
9494
sleepLimit(60);
9595
successCheck();
9696
}
97-
97+
9898
@MediumTest
9999
public void testM() throws IOException, JSONException {
100-
file = createFile(4, ".test");
100+
file = createFile(4, "--—— 地 方.test");
101101
uri = Uri.fromFile(file);
102102
IO.putFile(context, uptoken, key, uri, extra, jsonRet);
103103
sleepLimit(60 * 5);
104104
successCheck();
105105
}
106-
106+
107107
@SmallTest
108108
public void testRS() throws IOException, JSONException {
109109
file = createFile(0.2, ".test");
@@ -112,7 +112,7 @@ public void testRS() throws IOException, JSONException {
112112
sleepLimit(60);
113113
successCheck();
114114
}
115-
115+
116116
@MediumTest
117117
public void testRM() throws IOException, JSONException {
118118
file = createFile(4, ".test");
@@ -121,7 +121,7 @@ public void testRM() throws IOException, JSONException {
121121
sleepLimit(60 * 5);
122122
successCheck();
123123
}
124-
124+
125125
@MediumTest
126126
public void testRL() throws IOException, JSONException {
127127
file = createFile(8.6, ".test");
@@ -130,14 +130,14 @@ public void testRL() throws IOException, JSONException {
130130
sleepLimit(60 * 5);
131131
successCheck();
132132
}
133-
133+
134134

135135
private void successCheck() throws JSONException{
136136
Assert.assertTrue(success);
137137
Assert.assertNotNull(resp.optString("hash"));
138138
Assert.assertEquals(file.length(), resp.getLong("fsize"));
139139
}
140-
140+
141141
private void sleepLimit(int limit){
142142
int t = 5;
143143
while(uploading && t < limit){
@@ -149,7 +149,7 @@ private void sleepLimit(int limit){
149149
}
150150
}
151151
}
152-
152+
153153
private File createFile(double fileSize, String suf) throws IOException {
154154
FileOutputStream fos = null;
155155
try{
@@ -188,4 +188,4 @@ private byte[] getByte(){
188188
return b;
189189
}
190190

191-
}
191+
}

0 commit comments

Comments
 (0)