fix(接口测试): 修复导出jmx文件禁用状态未生效问题

This commit is contained in:
fit2-zhao 2022-02-11 18:03:12 +08:00 committed by fit2-zhao
parent 7e9eb47145
commit 5df4e68077
3 changed files with 3 additions and 17 deletions

View File

@ -161,7 +161,7 @@ public class MsScenario extends MsTestElement {
} }
HashTree scenarioTree = tree; HashTree scenarioTree = tree;
if (config != null && !config.getExcludeScenarioIds().contains(this.getId())) { if (config != null && !config.getExcludeScenarioIds().contains(this.getId())) {
scenarioTree = MsCriticalSectionController.createHashTree(tree, this.getName()); scenarioTree = MsCriticalSectionController.createHashTree(tree, this.getName(), this.isEnable());
} }
// 场景变量和环境变量 // 场景变量和环境变量
Arguments arguments = arguments(config); Arguments arguments = arguments(config);

View File

@ -17,12 +17,12 @@ public class MsCriticalSectionController extends MsTestElement {
} }
public static HashTree createHashTree(HashTree tree, String name) { public static HashTree createHashTree(HashTree tree, String name, boolean enable) {
CriticalSectionController criticalSectionController = new CriticalSectionController(); CriticalSectionController criticalSectionController = new CriticalSectionController();
criticalSectionController.setName(StringUtils.isNotEmpty(name) ? "Csc_" + name criticalSectionController.setName(StringUtils.isNotEmpty(name) ? "Csc_" + name
: "Scenario Critical Section Controller"); : "Scenario Critical Section Controller");
criticalSectionController.setLockName("global_lock_" + getUUID(8)); criticalSectionController.setLockName("global_lock_" + getUUID(8));
criticalSectionController.setEnabled(true); criticalSectionController.setEnabled(enable);
criticalSectionController.setProperty(TestElement.TEST_CLASS, CriticalSectionController.class.getName()); criticalSectionController.setProperty(TestElement.TEST_CLASS, CriticalSectionController.class.getName());
criticalSectionController.setProperty(TestElement.GUI_CLASS, "CriticalSectionControllerGui"); criticalSectionController.setProperty(TestElement.GUI_CLASS, "CriticalSectionControllerGui");
return tree.add(criticalSectionController); return tree.add(criticalSectionController);

View File

@ -1342,20 +1342,6 @@ public class ApiAutomationService {
ApiScenarioExample example = new ApiScenarioExample(); ApiScenarioExample example = new ApiScenarioExample();
example.createCriteria().andIdIn(request.getIds()); example.createCriteria().andIdIn(request.getIds());
List<ApiScenarioWithBLOBs> apiScenarioWithBLOBs = apiScenarioMapper.selectByExampleWithBLOBs(example); List<ApiScenarioWithBLOBs> apiScenarioWithBLOBs = apiScenarioMapper.selectByExampleWithBLOBs(example);
// 处理引用数据
if (CollectionUtils.isNotEmpty(apiScenarioWithBLOBs)) {
apiScenarioWithBLOBs.forEach(item -> {
if (StringUtils.isNotEmpty(item.getScenarioDefinition())) {
JSONObject scenario = JSONObject.parseObject(item.getScenarioDefinition());
JSONArray hashTree = scenario.getJSONArray("hashTree");
if (hashTree != null) {
hashTreeService.setHashTree(hashTree);
scenario.put("hashTree", hashTree);
}
item.setScenarioDefinition(JSON.toJSONString(scenario));
}
});
}
return apiScenarioWithBLOBs; return apiScenarioWithBLOBs;
} }