fix(接口测试): 接口用例附件删除增加校验
This commit is contained in:
parent
39bd9c1fec
commit
0b14520dac
|
@ -347,7 +347,10 @@ public class ApiTestCaseService {
|
||||||
apiTestCaseMapper.deleteByPrimaryKey(testId);
|
apiTestCaseMapper.deleteByPrimaryKey(testId);
|
||||||
esbApiParamService.deleteByResourceId(testId);
|
esbApiParamService.deleteByResourceId(testId);
|
||||||
testPlanApiCaseService.deleteByCaseId(testId);
|
testPlanApiCaseService.deleteByCaseId(testId);
|
||||||
deleteBodyFiles(testId);
|
ApiTestCase apiTestCase = apiTestCaseMapper.selectByPrimaryKey(testId);
|
||||||
|
if (apiTestCase != null) {
|
||||||
|
deleteBodyFiles(apiTestCase.getId());
|
||||||
|
}
|
||||||
// 删除附件关系
|
// 删除附件关系
|
||||||
fileAssociationService.deleteByResourceId(testId);
|
fileAssociationService.deleteByResourceId(testId);
|
||||||
deleteFollows(testId);
|
deleteFollows(testId);
|
||||||
|
@ -388,7 +391,8 @@ public class ApiTestCaseService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteBodyFiles(String testId) {
|
public void deleteBodyFiles(String testId) {
|
||||||
File file = new File(BODY_FILE_DIR + "/" + testId);
|
String path = StringUtils.join(BODY_FILE_DIR, "/", testId);
|
||||||
|
File file = new File(path);
|
||||||
FileUtil.deleteContents(file);
|
FileUtil.deleteContents(file);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
file.delete();
|
file.delete();
|
||||||
|
|
Loading…
Reference in New Issue