Skip to content

Release 6.1.7 #132

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

Merged
merged 6 commits into from
Jul 11, 2014
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
2 changes: 1 addition & 1 deletion src/main/java/com/qiniu/api/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 0 additions & 2 deletions src/test/java/com/examples/client/PutFileDemo.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/test/java/com/qiniu/testing/BatchCopyTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.qiniu.testing;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

Expand Down
1 change: 0 additions & 1 deletion src/test/java/com/qiniu/testing/BatchMoveTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.qiniu.testing;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

Expand Down
1 change: 0 additions & 1 deletion src/test/java/com/qiniu/testing/BatchStatTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.qiniu.testing;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

Expand Down
3 changes: 0 additions & 3 deletions src/test/java/com/qiniu/testing/CopyTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.qiniu.testing;

import java.io.File;

import junit.framework.TestCase;

import com.qiniu.api.auth.AuthException;
Expand Down Expand Up @@ -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());
}

Expand Down
8 changes: 0 additions & 8 deletions src/test/java/com/qiniu/testing/HttpClientTimeOutTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
Expand All @@ -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());
Expand Down
13 changes: 5 additions & 8 deletions src/test/java/com/qiniu/testing/IOTest.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
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;
import org.apache.http.client.HttpClient;
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;

Expand Down Expand Up @@ -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 {
Expand All @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions src/test/java/com/qiniu/testing/MoveTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.qiniu.testing;

import java.io.File;

import junit.framework.TestCase;

import com.qiniu.api.auth.AuthException;
Expand Down Expand Up @@ -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());
}

Expand Down
5 changes: 0 additions & 5 deletions src/test/java/com/qiniu/testing/RSFTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.qiniu.testing;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -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);
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/test/java/com/qiniu/testing/RSStatTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.qiniu.testing;

import java.io.File;

import junit.framework.TestCase;

import com.qiniu.api.auth.AuthException;
Expand All @@ -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
Expand Down Expand Up @@ -95,4 +93,4 @@ public void tearDown() {
assertTrue(!sr.ok());
}
}
}
}
10 changes: 2 additions & 8 deletions src/test/java/com/qiniu/testing/ResumeableioTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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{
Expand All @@ -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!");
}

/**
Expand Down