From ca7130a42011c489f6cf54f4e5077922df589dfb Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 1 Apr 2021 10:53:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E6=89=A7=E8=A1=8C=E6=97=B6=E7=BB=99=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E5=9C=BA=E6=99=AF=E6=AD=A5=E9=AA=A4=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=A1=B9=E7=9B=AEID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/api/dto/definition/request/MsScenario.java | 5 +++-- .../api/dto/definition/request/MsTestElement.java | 1 + .../commons/constants/MsTestElementConstants.java | 2 +- 3 files changed, 5 insertions(+), 3 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 02fc8979bd..384a5cd190 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 @@ -14,6 +14,7 @@ import io.metersphere.api.service.ApiAutomationService; import io.metersphere.api.service.ApiTestEnvironmentService; import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs; +import io.metersphere.commons.constants.MsTestElementConstants; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.SessionUtils; @@ -77,9 +78,9 @@ public class MsScenario extends MsTestElement { if (!config.isOperating() && !this.isEnable()) { return; } - if (this.getReferenced() != null && this.getReferenced().equals("Deleted")) { + if (this.getReferenced() != null && this.getReferenced().equals(MsTestElementConstants.Deleted.name())) { return; - } else if (this.getReferenced() != null && this.getReferenced().equals("REF")) { + } else if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) { try { ApiAutomationService apiAutomationService = CommonBeanFactory.getBean(ApiAutomationService.class); ObjectMapper mapper = new ObjectMapper(); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java index 03f2ca46a6..6ca67bba17 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsTestElement.java @@ -160,6 +160,7 @@ public abstract class MsTestElement { mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(element.getId()); if (apiDefinition != null) { + element.setProjectId(apiDefinition.getProjectId()); element = mapper.readValue(apiDefinition.getRequest(), new TypeReference() { }); hashTree.add(element); diff --git a/backend/src/main/java/io/metersphere/commons/constants/MsTestElementConstants.java b/backend/src/main/java/io/metersphere/commons/constants/MsTestElementConstants.java index e3e2dbf232..81f0415d05 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/MsTestElementConstants.java +++ b/backend/src/main/java/io/metersphere/commons/constants/MsTestElementConstants.java @@ -1,5 +1,5 @@ package io.metersphere.commons.constants; public enum MsTestElementConstants { - LoopController,SCENARIO,REF + LoopController,SCENARIO,REF,Deleted }