fix(接口自动化) 修复TCP请求兼容性问题

--bug=1006803 --user=赵勇 【测试计划】-关联场景用例后更新步骤,再执行场景用例失败 https://www.tapd.cn/55049933/s/1049299
This commit is contained in:
fit2-zhao 2021-09-22 15:14:57 +08:00 committed by fit2-zhao
parent e56da41ac5
commit 7896af41eb
1 changed files with 9 additions and 0 deletions

View File

@ -271,6 +271,15 @@ public class ElementUtil {
public static void dataFormatting(JSONArray hashTree) { public static void dataFormatting(JSONArray hashTree) {
for (int i = 0; i < hashTree.size(); i++) { for (int i = 0; i < hashTree.size(); i++) {
JSONObject element = hashTree.getJSONObject(i); JSONObject element = hashTree.getJSONObject(i);
if (element != null && element.get("clazzName") == null && element.getString("type").equals("TCPSampler")) {
if (element.getString("tcpPreProcessor") != null) {
JSONObject tcpPreProcessor = JSON.parseObject(element.getString("tcpPreProcessor"));
if (tcpPreProcessor != null && tcpPreProcessor.get("clazzName") == null) {
tcpPreProcessor.fluentPut("clazzName", clazzMap.get(tcpPreProcessor.getString("type")));
element.fluentPut("tcpPreProcessor", tcpPreProcessor);
}
}
}
if (element != null && element.get("clazzName") == null && clazzMap.containsKey(element.getString("type"))) { if (element != null && element.get("clazzName") == null && clazzMap.containsKey(element.getString("type"))) {
element.fluentPut("clazzName", clazzMap.get(element.getString("type"))); element.fluentPut("clazzName", clazzMap.get(element.getString("type")));
} }