change test

This commit is contained in:
Looly
2020-12-02 22:21:21 +08:00
parent cc43e39515
commit 6c76e9258b
10 changed files with 55 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
package cn.hutool.http.test;
package cn.hutool.http;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IORuntimeException;

View File

@@ -1,4 +1,4 @@
package cn.hutool.http.test;
package cn.hutool.http;
import org.junit.Assert;
import org.junit.Test;

View File

@@ -1,4 +1,4 @@
package cn.hutool.http.test;
package cn.hutool.http;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.TimeInterval;

View File

@@ -1,4 +1,4 @@
package cn.hutool.http.test;
package cn.hutool.http;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Console;

View File

@@ -1,4 +1,4 @@
package cn.hutool.http.test;
package cn.hutool.http;
import cn.hutool.core.lang.Console;
import cn.hutool.core.thread.ThreadUtil;

View File

@@ -1,4 +1,4 @@
package cn.hutool.http.test;
package cn.hutool.http;
import cn.hutool.core.lang.Console;
import cn.hutool.http.Header;

View File

@@ -1,23 +1,23 @@
package cn.hutool.http.test;
package cn.hutool.http;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import org.junit.Ignore;
import org.junit.Test;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
/**
* 文件上传单元测试
* @author looly
*
* @author looly
*/
public class UploadTest {
/**
* 多文件上传测试
*/
@@ -35,7 +35,7 @@ public class UploadTest {
HttpResponse response = request.execute();
Console.log(response.body());
}
@Test
@Ignore
public void uploadFileTest() {
@@ -48,4 +48,24 @@ public class UploadTest {
String result = HttpUtil.post("http://wthrcdn.etouch.cn/weather_mini", paramMap);
System.out.println(result);
}
@Test
@Ignore
public void uploadTest() {
//客户端
String url = "http://localhost:8888/file";
Path file = Paths.get("D:\\testBigData_upload.xlsx");
Map<String, String> headers = new HashMap<>(16);
headers.put("md5", "aaaaaaaa");
Map<String, Object> params = new HashMap<>(16);
params.put("fileName", file.toFile().getName());
params.put("file", file.toFile());
HttpRequest httpRequest = HttpRequest.post(url)
.setChunkedStreamingMode(1024 * 1024)
.headerMap(headers, false)
.form(params);
HttpResponse httpResponse = httpRequest.execute();
Console.log(httpResponse);
}
}