下载接口修改,测试用例补齐

This commit is contained in:
even 2025-07-24 15:57:51 +08:00
parent e36d596bc7
commit f1e808bcb7
2 changed files with 6 additions and 3 deletions

View File

@ -10,6 +10,8 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
/** /**
@ -47,11 +49,11 @@ public class SftpFileController {
return CommonResult.success(uploadFilePath); return CommonResult.success(uploadFilePath);
} }
@PostMapping("/download") @GetMapping("/download")
public void downloadFile( public void downloadFile(
@RequestParam String remoteFilePath, @RequestParam String remoteFilePath,
HttpServletResponse response) { HttpServletResponse response) {
remoteFilePath = URLDecoder.decode(remoteFilePath, StandardCharsets.UTF_8);
sftpFileService.downloadFile( sftpFileService.downloadFile(
fileUploadProperties.getRemoteHost(), fileUploadProperties.getRemoteHost(),
fileUploadProperties.getRemotePort(), fileUploadProperties.getRemotePort(),

View File

@ -158,7 +158,7 @@ public class TestCaseGenerationWorker extends DockerWorker {
sftp.connect(); sftp.connect();
String workDir = (String)getGlobalVariable(context,AFL_DOCKER_WORK_DIR_KEY); String workDir = (String)getGlobalVariable(context,AFL_DOCKER_WORK_DIR_KEY);
append(context,"AI测试用例生成开始上传目标文件。。。"); append(context,"AI测试用例生成开始上传目标文件。。。");
String filePath = AFL_DOCKER_BASE_DIR + File.separator + workDir+File.separator+getSourceName(fileName)+File.separator+binaryName; String filePath = AFL_VOLUME_WORK_DIR_PREFIX + File.separator + workDir+File.separator+getSourceName(fileName)+File.separator+binaryName;
append(context,"读取到目标文件路径:"+filePath); append(context,"读取到目标文件路径:"+filePath);
InputStream inputStream = sftp.get(filePath); InputStream inputStream = sftp.get(filePath);
String targetUploadRes = aiGeneratorService.targetUpload("./" + binaryName, inputStream); String targetUploadRes = aiGeneratorService.targetUpload("./" + binaryName, inputStream);
@ -213,6 +213,7 @@ public class TestCaseGenerationWorker extends DockerWorker {
exec.setCommand(cmd); exec.setCommand(cmd);
} catch (Exception e) { } catch (Exception e) {
log.error("ai测试用例生成报错",e);
append(context,"测试用例生成失败"); append(context,"测试用例生成失败");
}finally { }finally {
if (exec!=null) { if (exec!=null) {