fix(接口自动化): 执行时给引用的场景步骤增加项目ID
This commit is contained in:
parent
30f80ed88c
commit
40ccab83f2
|
@ -14,6 +14,7 @@ import io.metersphere.api.service.ApiAutomationService;
|
||||||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||||
|
import io.metersphere.commons.constants.MsTestElementConstants;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.FileUtils;
|
import io.metersphere.commons.utils.FileUtils;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
|
@ -77,9 +78,9 @@ public class MsScenario extends MsTestElement {
|
||||||
if (!config.isOperating() && !this.isEnable()) {
|
if (!config.isOperating() && !this.isEnable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.getReferenced() != null && this.getReferenced().equals("Deleted")) {
|
if (this.getReferenced() != null && this.getReferenced().equals(MsTestElementConstants.Deleted.name())) {
|
||||||
return;
|
return;
|
||||||
} else if (this.getReferenced() != null && this.getReferenced().equals("REF")) {
|
} else if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||||
try {
|
try {
|
||||||
ApiAutomationService apiAutomationService = CommonBeanFactory.getBean(ApiAutomationService.class);
|
ApiAutomationService apiAutomationService = CommonBeanFactory.getBean(ApiAutomationService.class);
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
|
@ -160,6 +160,7 @@ public abstract class MsTestElement {
|
||||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(element.getId());
|
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(element.getId());
|
||||||
if (apiDefinition != null) {
|
if (apiDefinition != null) {
|
||||||
|
element.setProjectId(apiDefinition.getProjectId());
|
||||||
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {
|
element = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTestElement>() {
|
||||||
});
|
});
|
||||||
hashTree.add(element);
|
hashTree.add(element);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package io.metersphere.commons.constants;
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
public enum MsTestElementConstants {
|
public enum MsTestElementConstants {
|
||||||
LoopController,SCENARIO,REF
|
LoopController,SCENARIO,REF,Deleted
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue