fix(接口自动化): 修复导入jmx JSON 提取参数问题
This commit is contained in:
parent
eae9359892
commit
a30c790a41
|
@ -48,6 +48,7 @@ import io.metersphere.commons.utils.BeanUtils;
|
|||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.assertions.*;
|
||||
import org.apache.jmeter.config.ConfigTestElement;
|
||||
import org.apache.jmeter.control.ForeachController;
|
||||
|
@ -439,11 +440,20 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
extract.getXpath().add(xPath);
|
||||
} else if (key instanceof JSONPostProcessor) {
|
||||
JSONPostProcessor jsonPostProcessor = (JSONPostProcessor) key;
|
||||
MsExtractJSONPath jsonPath = new MsExtractJSONPath();
|
||||
jsonPath.setVariable(jsonPostProcessor.getRefNames());
|
||||
jsonPath.setExpression(jsonPostProcessor.getJsonPathExpressions());
|
||||
extract.setName(jsonPostProcessor.getName());
|
||||
extract.getJson().add(jsonPath);
|
||||
String[] names = StringUtils.isNotEmpty(jsonPostProcessor.getRefNames()) ? jsonPostProcessor.getRefNames().split(";") : null;
|
||||
String[] values = StringUtils.isNotEmpty(jsonPostProcessor.getJsonPathExpressions()) ? jsonPostProcessor.getJsonPathExpressions().split(";") : null;
|
||||
if (names != null) {
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
MsExtractJSONPath jsonPath = new MsExtractJSONPath();
|
||||
jsonPath.setVariable(names[i]);
|
||||
if (values != null && values.length > i) {
|
||||
jsonPath.setExpression(values[i]);
|
||||
}
|
||||
jsonPath.setMultipleMatching(jsonPostProcessor.getComputeConcatenation());
|
||||
extract.setName(jsonPostProcessor.getName());
|
||||
extract.getJson().add(jsonPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue