fix(接口自动化): 修复接口自动化调试引用的TCP案例执行失败的缺陷

--bug=1009775 --user=宋天阳 【接口测试】场景里导入tcp接口执行失败,接口列表执行成功 {#_orginal_url#}
This commit is contained in:
song-tianyang 2022-01-19 17:16:49 +08:00 committed by xiaomeinvG
parent 9d0ba758de
commit 1c1f396b08
2 changed files with 19 additions and 1 deletions

View File

@ -100,6 +100,8 @@ public class ApiTestCaseService {
private ApiTestCaseFollowMapper apiTestCaseFollowMapper;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
@Resource
private TcpApiParamService tcpApiParamService;
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
@ -350,7 +352,7 @@ public class ApiTestCaseService {
private ApiTestCase updateTest(SaveApiTestCaseRequest request) {
checkNameExist(request);
request.setRequest(tcpApiParamService.parseMsTestElement(request.getRequest()));
if (StringUtils.isNotEmpty(request.getEsbDataStruct())) {
request = esbApiParamService.handleEsbRequest(request);
}

View File

@ -30,6 +30,22 @@ public class TcpApiParamService {
return request;
}
public MsTestElement parseMsTestElement(MsTestElement testElement) {
if (testElement == null) {
return null;
}
if (testElement instanceof MsTCPSampler) {
MsTCPSampler tcpSampler = this.handleTcpRequest(testElement);
if (tcpSampler != null) {
return tcpSampler;
} else {
return testElement;
}
} else {
return testElement;
}
}
public MsTCPSampler handleTcpRequest(MsTestElement testElement) {
MsTCPSampler tcpSampler = null;
try {