Merge branch 'refs/heads/zt-test' into test
# Conflicts: # zt-module-infra/zt-module-infra-server/src/main/resources/application.yaml
This commit is contained in:
@@ -2,6 +2,8 @@ package com.zt.plat.module.infra.service.file;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.json.JsonUtils;
|
||||
import com.zt.plat.framework.common.util.validation.ValidationUtils;
|
||||
@@ -14,8 +16,6 @@ import com.zt.plat.module.infra.framework.file.core.client.FileClient;
|
||||
import com.zt.plat.module.infra.framework.file.core.client.FileClientConfig;
|
||||
import com.zt.plat.module.infra.framework.file.core.client.FileClientFactory;
|
||||
import com.zt.plat.module.infra.framework.file.core.enums.FileStorageEnum;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Validator;
|
||||
import lombok.Getter;
|
||||
@@ -172,7 +172,7 @@ public class FileConfigServiceImpl implements FileConfigService {
|
||||
// 校验存在
|
||||
validateFileConfigExists(id);
|
||||
// 上传文件
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
return getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg");
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ spring:
|
||||
servlet:
|
||||
# 文件上传相关配置项
|
||||
multipart:
|
||||
max-file-size: 100MB # 单个文件大小
|
||||
max-request-size: 120MB # 设置总上传的文件大小
|
||||
max-file-size: 128MB # 单个文件大小
|
||||
max-request-size: 512MB # 设置总上传的文件大小
|
||||
|
||||
# Jackson 配置项
|
||||
jackson:
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
@@ -41,7 +41,7 @@ public class FtpFileClientTest {
|
||||
client.init();
|
||||
// 上传文件
|
||||
String path = IdUtil.fastSimpleUUID() + ".jpg";
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
String fullPath = client.upload(content, path, "image/jpeg");
|
||||
System.out.println("访问地址:" + fullPath);
|
||||
if (false) {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class LocalFileClientTest {
|
||||
client.init();
|
||||
// 上传文件
|
||||
String path = IdUtil.fastSimpleUUID() + ".jpg";
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
String fullPath = client.upload(content, path, "image/jpeg");
|
||||
System.out.println("访问地址:" + fullPath);
|
||||
client.delete(path);
|
||||
|
||||
@@ -101,7 +101,7 @@ public class S3FileClientTest {
|
||||
client.init();
|
||||
// 上传文件
|
||||
String path = IdUtil.fastSimpleUUID() + ".jpg";
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
String fullPath = client.upload(content, path, "image/jpeg");
|
||||
System.out.println("访问地址:" + fullPath);
|
||||
// 读取文件
|
||||
|
||||
@@ -34,7 +34,7 @@ public class SftpFileClientTest {
|
||||
client.init();
|
||||
// 上传文件
|
||||
String path = IdUtil.fastSimpleUUID() + ".jpg";
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
String fullPath = client.upload(content, path, "image/jpeg");
|
||||
System.out.println("访问地址:" + fullPath);
|
||||
if (false) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public class FileServiceImplTest extends BaseDbUnitTest {
|
||||
@Test
|
||||
public void testCreateFile_success_01() throws Exception {
|
||||
// 准备参数
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
String name = "单测文件名";
|
||||
String directory = randomString();
|
||||
String type = "image/jpeg";
|
||||
@@ -122,7 +122,7 @@ public class FileServiceImplTest extends BaseDbUnitTest {
|
||||
@Test
|
||||
public void testCreateFile_success_02() throws Exception {
|
||||
// 准备参数
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
// mock Master 文件客户端
|
||||
String type = "image/jpeg";
|
||||
FileClient client = mock(FileClient.class);
|
||||
@@ -318,7 +318,7 @@ public class FileServiceImplTest extends BaseDbUnitTest {
|
||||
@Test
|
||||
public void testCreateFile_withSameHash() throws Exception {
|
||||
// 准备参数
|
||||
byte[] content = ResourceUtil.readBytes("file/erweima.jpg");
|
||||
byte[] content = ResourceUtil.readBytes("file/bg1.png");
|
||||
String name = "单测文件名";
|
||||
String directory = randomString();
|
||||
String type = "image/jpeg";
|
||||
|
||||
Reference in New Issue
Block a user