diff --git a/src/main/java/com/qiniu/api/config/Config.java b/src/main/java/com/qiniu/api/config/Config.java index d2868e505..6567fc186 100644 --- a/src/main/java/com/qiniu/api/config/Config.java +++ b/src/main/java/com/qiniu/api/config/Config.java @@ -25,7 +25,7 @@ public class Config { public static String RS_HOST = "http://rs.qbox.me"; - public static String UP_HOST = "http://up.qiniu.com"; + public static String UP_HOST = "http://upload.qiniu.com"; public static String RSF_HOST = "http://rsf.qbox.me"; diff --git a/src/test/java/com/examples/client/PutFileDemo.java b/src/test/java/com/examples/client/PutFileDemo.java index 6156aa676..29dcf272c 100644 --- a/src/test/java/com/examples/client/PutFileDemo.java +++ b/src/test/java/com/examples/client/PutFileDemo.java @@ -1,7 +1,5 @@ package com.examples.client; -import java.io.File; - import com.qiniu.api.io.IoApi; import com.qiniu.api.io.PutExtra; import com.qiniu.api.io.PutRet; diff --git a/src/test/java/com/qiniu/testing/BatchCopyTest.java b/src/test/java/com/qiniu/testing/BatchCopyTest.java index c2e7fa19e..2fc9e9b1c 100644 --- a/src/test/java/com/qiniu/testing/BatchCopyTest.java +++ b/src/test/java/com/qiniu/testing/BatchCopyTest.java @@ -1,6 +1,5 @@ package com.qiniu.testing; -import java.io.File; import java.util.ArrayList; import java.util.List; diff --git a/src/test/java/com/qiniu/testing/BatchMoveTest.java b/src/test/java/com/qiniu/testing/BatchMoveTest.java index 584a2c41d..cd901dd4b 100644 --- a/src/test/java/com/qiniu/testing/BatchMoveTest.java +++ b/src/test/java/com/qiniu/testing/BatchMoveTest.java @@ -1,6 +1,5 @@ package com.qiniu.testing; -import java.io.File; import java.util.ArrayList; import java.util.List; diff --git a/src/test/java/com/qiniu/testing/BatchStatTest.java b/src/test/java/com/qiniu/testing/BatchStatTest.java index 093351d3f..482293cda 100644 --- a/src/test/java/com/qiniu/testing/BatchStatTest.java +++ b/src/test/java/com/qiniu/testing/BatchStatTest.java @@ -1,6 +1,5 @@ package com.qiniu.testing; -import java.io.File; import java.util.ArrayList; import java.util.List; diff --git a/src/test/java/com/qiniu/testing/CopyTest.java b/src/test/java/com/qiniu/testing/CopyTest.java index 2627d08f4..8fa8287b7 100644 --- a/src/test/java/com/qiniu/testing/CopyTest.java +++ b/src/test/java/com/qiniu/testing/CopyTest.java @@ -1,7 +1,5 @@ package com.qiniu.testing; -import java.io.File; - import junit.framework.TestCase; import com.qiniu.api.auth.AuthException; @@ -64,7 +62,6 @@ public void testCopy() throws Exception { { RSClient rs = new RSClient(mac); CallRet ret = rs.copy(srcBucket, key, destBucket, key); - System.out.println(ret); assertTrue(ret.ok()); } diff --git a/src/test/java/com/qiniu/testing/HttpClientTimeOutTest.java b/src/test/java/com/qiniu/testing/HttpClientTimeOutTest.java index c6cd84670..9ef2efb25 100644 --- a/src/test/java/com/qiniu/testing/HttpClientTimeOutTest.java +++ b/src/test/java/com/qiniu/testing/HttpClientTimeOutTest.java @@ -32,7 +32,6 @@ public void tearDown() { public void testCONNECTION_TIMEOUT() { Throwable tx = null; - long s = 0; try { Config.CONNECTION_TIMEOUT = 5; Config.SO_TIMEOUT = 20 * 1000; @@ -42,13 +41,10 @@ public void testCONNECTION_TIMEOUT() { HttpGet httpget = new HttpGet("http://www.qiniu.com"); - s = System.currentTimeMillis(); HttpResponse ret = client.execute(httpget); fail("应该按预期抛出异常 ConnectTimeoutException,测试失败"); } catch (Exception e) { - long end = System.currentTimeMillis(); - System.out.println("CONNECTION_TIMEOUT test : " + (end - s)); tx = e; } @@ -58,7 +54,6 @@ public void testCONNECTION_TIMEOUT() { public void testSO_TIMEOUT() { Throwable tx = null; - long s = 0; try { Config.CONNECTION_TIMEOUT = 20 * 1000; Config.SO_TIMEOUT = 5; @@ -68,12 +63,9 @@ public void testSO_TIMEOUT() { HttpGet httpget = new HttpGet("http://www.qiniu.com"); - s = System.currentTimeMillis(); HttpResponse ret = client.execute(httpget); fail("应该按预期抛出异常 SocketTimeoutException,测试失败"); } catch (Exception e) { - long end = System.currentTimeMillis(); - System.out.println("SO_TIMEOUT test : " + (end - s)); tx = e; } assertNotNull(tx.getMessage()); diff --git a/src/test/java/com/qiniu/testing/IOTest.java b/src/test/java/com/qiniu/testing/IOTest.java index 74101216b..007f9087f 100644 --- a/src/test/java/com/qiniu/testing/IOTest.java +++ b/src/test/java/com/qiniu/testing/IOTest.java @@ -1,10 +1,14 @@ package com.qiniu.testing; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import junit.framework.TestCase; + import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; @@ -12,15 +16,12 @@ import org.apache.http.client.methods.HttpGet; import org.json.JSONObject; -import junit.framework.TestCase; - import com.qiniu.api.auth.digest.Mac; import com.qiniu.api.config.Config; import com.qiniu.api.io.IoApi; import com.qiniu.api.io.PutExtra; import com.qiniu.api.io.PutRet; import com.qiniu.api.net.Http; -import com.qiniu.api.resumableio.ResumeableIoApi; import com.qiniu.api.rs.PutPolicy; import com.qiniu.api.rs.RSClient; @@ -139,9 +140,7 @@ public void close() throws IOException { PutRet ret = IoApi.Put(upToken, key, new MyInputStream(en.getContent()), null); - System.out.println(ret); assertTrue(ret.ok()); - System.out.println("is.available() = " + en.getContent().available()); } public void testSetLengthStream() throws Exception { @@ -154,9 +153,7 @@ public void testSetLengthStream() throws Exception { extra.mimeType = en.getContentType().getValue(); PutRet ret = IoApi.Put(upToken, key, en.getContent(), extra, en.getContentLength()); - System.out.println(ret); assertTrue(ret.ok()); - System.out.println("is.available() = " + en.getContent().available()); } private HttpEntity getHttpEntity(String url) throws ClientProtocolException, IOException{ diff --git a/src/test/java/com/qiniu/testing/MoveTest.java b/src/test/java/com/qiniu/testing/MoveTest.java index 7eb0412e8..b1bd5f3cd 100644 --- a/src/test/java/com/qiniu/testing/MoveTest.java +++ b/src/test/java/com/qiniu/testing/MoveTest.java @@ -1,7 +1,5 @@ package com.qiniu.testing; -import java.io.File; - import junit.framework.TestCase; import com.qiniu.api.auth.AuthException; @@ -66,7 +64,6 @@ public void testMove() throws Exception { { RSClient rs = new RSClient(mac); CallRet ret = rs.move(srcBucket, key, destBucket, key); - System.out.println(ret); assertTrue(ret.ok()); } diff --git a/src/test/java/com/qiniu/testing/RSFTest.java b/src/test/java/com/qiniu/testing/RSFTest.java index 4eb6ca9b1..872b5717d 100644 --- a/src/test/java/com/qiniu/testing/RSFTest.java +++ b/src/test/java/com/qiniu/testing/RSFTest.java @@ -1,6 +1,5 @@ package com.qiniu.testing; -import java.io.File; import java.util.ArrayList; import java.util.List; @@ -78,12 +77,8 @@ public void testRSF() throws Exception { } if (ret.exception.getClass() != RSFEofException.class) { // error handler - System.out.println(ret.exception); } - // 防止该bucket有别人在用 - System.out.println(ret.exception); - System.out.println(all.size()); assertTrue(all.size() >= 3); } } diff --git a/src/test/java/com/qiniu/testing/RSStatTest.java b/src/test/java/com/qiniu/testing/RSStatTest.java index 5e0c15c50..43e193196 100644 --- a/src/test/java/com/qiniu/testing/RSStatTest.java +++ b/src/test/java/com/qiniu/testing/RSStatTest.java @@ -1,7 +1,5 @@ package com.qiniu.testing; -import java.io.File; - import junit.framework.TestCase; import com.qiniu.api.auth.AuthException; @@ -17,12 +15,12 @@ public class RSStatTest extends TestCase { - public final String domain = "http://junit-bucket.qiniudn.com"; + public final String domain = System.getenv("QINIU_TEST_DOMAIN"); public final String expectedHash = "FmDZwqadA4-ib_15hYfQpb7UXUYR"; public String bucketName; public final String key = "RSTest-key"; - + public Mac mac; @Override @@ -95,4 +93,4 @@ public void tearDown() { assertTrue(!sr.ok()); } } -} \ No newline at end of file +} diff --git a/src/test/java/com/qiniu/testing/ResumeableioTest.java b/src/test/java/com/qiniu/testing/ResumeableioTest.java index f9b90324a..4081ddfc9 100644 --- a/src/test/java/com/qiniu/testing/ResumeableioTest.java +++ b/src/test/java/com/qiniu/testing/ResumeableioTest.java @@ -7,6 +7,8 @@ import java.io.IOException; import java.util.UUID; +import junit.framework.TestCase; + import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; @@ -15,8 +17,6 @@ import org.json.JSONException; import org.json.JSONObject; -import junit.framework.TestCase; - import com.qiniu.api.auth.AuthException; import com.qiniu.api.auth.digest.Mac; import com.qiniu.api.config.Config; @@ -90,7 +90,6 @@ private void uploadFile() throws AuthException, JSONException{ p.returnBody = "{\"key\": $(key), \"hash\": $(etag),\"mimeType\": $(mimeType)}"; String upToken = p.token(mac); PutRet ret = ResumeableIoApi.put(file, upToken, currentKey, mimeType); - System.out.println(ret); assertTrue(ret.ok()); if(mimeType != null){ JSONObject jsonObject = new JSONObject(ret.response); @@ -106,7 +105,6 @@ private void uploadStream() throws AuthException, JSONException, FileNotFoundExc String upToken = p.token(mac); FileInputStream fis = new FileInputStream(file); PutRet ret = ResumeableIoApi.put(fis, upToken, currentKey, mimeType); - System.out.println(ret); assertTrue(ret.ok()); if(mimeType != null){ JSONObject jsonObject = new JSONObject(ret.response); @@ -123,9 +121,7 @@ public void testStream() throws Exception { HttpEntity en = getHttpEntity("http://qiniuphotos.qiniudn.com/gogopher.jpg"); PutRet ret = ResumeableIoApi.put(en.getContent(), upToken, currentKey, en.getContentType().getValue(), en.getContentLength()); - System.out.println(ret); assertTrue(ret.ok()); - System.out.println("is.available() = " + en.getContent().available()); } private HttpEntity getHttpEntity(String url) throws ClientProtocolException, IOException{ @@ -146,9 +142,7 @@ public void tearDown() { } RSClient rs = new RSClient(mac); - System.out.println("try to delete: " + currentKey); CallRet cr = rs.delete(bucketName, currentKey); - System.out.println("delete " + currentKey + " successed!"); } /**