refactor: 修改FileResponse属性bucket为type
This commit is contained in:
@@ -8,6 +8,6 @@ package cn.celess.blog.entity.model;
|
||||
public class FileResponse {
|
||||
public String key;
|
||||
public String hash;
|
||||
public String bucket;
|
||||
public String type;
|
||||
public long size;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class LocalFileServiceImpl implements FileManager {
|
||||
fos.close();
|
||||
is.close();
|
||||
fileResponse.key = URLEncoder.encode(fileName, "UTF-8");
|
||||
fileResponse.bucket = "local";
|
||||
fileResponse.type = "local";
|
||||
return fileResponse;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class QiniuFileServiceImpl implements FileManager {
|
||||
StringMap stringMap = response.jsonToMap();
|
||||
|
||||
fileResponse.key = (String) stringMap.get("key");
|
||||
fileResponse.bucket = "qiniu";
|
||||
fileResponse.type = "qiniu";
|
||||
fileResponse.size = 0;
|
||||
fileResponse.hash = (String) stringMap.get("hash");
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ public class BaseTest {
|
||||
log.debug("上传文件请求,[fileName:{}]", fileName);
|
||||
|
||||
response.key = "key";
|
||||
response.bucket = "bucket";
|
||||
response.type = "test";
|
||||
response.hash = "hash";
|
||||
response.size = 1;
|
||||
return response;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class FileManagerTest extends BaseTest {
|
||||
File file = createFile();
|
||||
FileResponse fileResponse = fileManager.uploadFile(new FileInputStream(file), file.getName());
|
||||
assertEquals(file.getName(), fileResponse.key);
|
||||
assertEquals(System.getProperty(ConfigKeyEnum.FILE_TYPE.getKey()), fileResponse.bucket);
|
||||
assertEquals(System.getProperty(ConfigKeyEnum.FILE_TYPE.getKey()), fileResponse.type);
|
||||
// assertNotNull(fileResponse.hash);
|
||||
fileName = fileResponse.key;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user