From 5df4e68077f181323cb91f74531ed74cd5f7a784 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 11 Feb 2022 18:03:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BAjmx=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E7=8A=B6=E6=80=81=E6=9C=AA=E7=94=9F=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/definition/request/MsScenario.java | 2 +- .../controller/MsCriticalSectionController.java | 4 ++-- .../api/service/ApiAutomationService.java | 14 -------------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index ba6711da0c..70d835cfa8 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -161,7 +161,7 @@ public class MsScenario extends MsTestElement { } HashTree scenarioTree = tree; 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); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsCriticalSectionController.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsCriticalSectionController.java index 0dd1596585..19047979b0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsCriticalSectionController.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/controller/MsCriticalSectionController.java @@ -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.setName(StringUtils.isNotEmpty(name) ? "Csc_" + name : "Scenario Critical Section Controller"); criticalSectionController.setLockName("global_lock_" + getUUID(8)); - criticalSectionController.setEnabled(true); + criticalSectionController.setEnabled(enable); criticalSectionController.setProperty(TestElement.TEST_CLASS, CriticalSectionController.class.getName()); criticalSectionController.setProperty(TestElement.GUI_CLASS, "CriticalSectionControllerGui"); return tree.add(criticalSectionController); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 7f7302877f..dd7300e09f 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1342,20 +1342,6 @@ public class ApiAutomationService { ApiScenarioExample example = new ApiScenarioExample(); example.createCriteria().andIdIn(request.getIds()); List 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; }