refactor(接口测试): 重构环境配置数据结构
This commit is contained in:
parent
3d78d116ad
commit
dc8133e19e
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.api.dto.assertion;
|
||||
|
||||
import io.metersphere.project.api.assertion.MsAssertion;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.dto.request;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.request.processors.MsProcessorConfig;
|
||||
import io.metersphere.plugin.api.spi.AbstractMsTestElement;
|
||||
import jakarta.validation.Valid;
|
||||
|
|
|
@ -14,26 +14,35 @@ import java.util.Map;
|
|||
public class MsScenario extends AbstractMsTestElement {
|
||||
/**
|
||||
* 场景配置
|
||||
* 引用的场景才会设置
|
||||
*/
|
||||
private ScenarioConfig scenarioConfig;
|
||||
/**
|
||||
* 场景步骤的配置
|
||||
* 引用的场景才会设置
|
||||
*/
|
||||
private ScenarioStepConfig scenarioStepConfig;
|
||||
/**
|
||||
* 环境 Map
|
||||
* key 为项目ID
|
||||
* value 为环境信息
|
||||
* 引用的场景才会设置
|
||||
*/
|
||||
private Map<String, EnvironmentInfoDTO> projectEnvMap;
|
||||
/**
|
||||
* 环境信息
|
||||
* 引用的场景才会设置
|
||||
*/
|
||||
private EnvironmentInfoDTO environmentInfo;
|
||||
/**
|
||||
* 是否为环境组
|
||||
* 是则使用 projectEnvMap
|
||||
* 否则使用 envInfo
|
||||
* 引用的场景才会设置
|
||||
*/
|
||||
private Boolean grouped;
|
||||
/**
|
||||
* {@link io.metersphere.api.constants.ApiScenarioStepRefType}
|
||||
*/
|
||||
private String refType;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.api.dto.request.controller;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.plugin.api.spi.AbstractMsTestElement;
|
||||
import io.metersphere.project.dto.environment.KeyValueParam;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.request.http;
|
||||
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.request.http;
|
||||
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.request.http;
|
||||
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.dto.request.http.body;
|
||||
|
||||
import io.metersphere.api.dto.request.http.KeyValueEnableParam;
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.request.processors;
|
||||
|
||||
import io.metersphere.project.api.processor.MsProcessor;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.dto.scenario;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.request.processors.MsProcessorConfig;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package io.metersphere.api.parser.jmeter;
|
||||
|
||||
import io.metersphere.api.dto.request.controller.MsCommentScriptElement;
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.api.parser.jmeter.processor.ScriptProcessorConverter;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import io.metersphere.plugin.api.spi.AbstractJmeterElementConverter;
|
||||
import io.metersphere.project.dto.environment.KeyValueParam;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.jmeter.modifiers.UserParameters;
|
||||
import org.apache.jmeter.protocol.java.sampler.BeanShellSampler;
|
||||
|
|
|
@ -2,9 +2,9 @@ package io.metersphere.api.parser.jmeter;
|
|||
|
||||
|
||||
import io.metersphere.api.dto.request.MsCommonElement;
|
||||
import io.metersphere.api.dto.request.assertion.MsAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.request.assertion.MsResponseCodeAssertion;
|
||||
import io.metersphere.project.api.assertion.MsAssertion;
|
||||
import io.metersphere.api.dto.assertion.MsAssertionConfig;
|
||||
import io.metersphere.project.api.assertion.MsResponseCodeAssertion;
|
||||
import io.metersphere.api.dto.request.processors.MsProcessorConfig;
|
||||
import io.metersphere.api.parser.jmeter.processor.MsProcessorConverterFactory;
|
||||
import io.metersphere.api.parser.jmeter.processor.assertion.AssertionConverterFactory;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.ExtractPostProcessor;
|
||||
import io.metersphere.api.dto.request.processors.extract.MsExtract;
|
||||
import io.metersphere.project.api.processor.ExtractPostProcessor;
|
||||
import io.metersphere.project.api.processor.extract.MsExtract;
|
||||
import io.metersphere.api.parser.jmeter.processor.extract.ExtractConverterFactory;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
|
||||
import io.metersphere.api.dto.request.processors.MsProcessor;
|
||||
import io.metersphere.project.api.processor.MsProcessor;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.ExtractPostProcessor;
|
||||
import io.metersphere.api.dto.request.processors.SQLProcessor;
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.api.dto.request.processors.TimeWaitingProcessor;
|
||||
import io.metersphere.project.api.processor.ExtractPostProcessor;
|
||||
import io.metersphere.project.api.processor.SQLProcessor;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.project.api.processor.TimeWaitingProcessor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jmeter.extractor.BeanShellPostProcessor;
|
||||
import org.apache.jmeter.extractor.JSR223PostProcessor;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jmeter.modifiers.BeanShellPreProcessor;
|
||||
import org.apache.jmeter.modifiers.JSR223PreProcessor;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.project.constants.ScriptLanguageType;
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.api.parser.jmeter.constants.JmeterAlias;
|
||||
import io.metersphere.api.parser.jmeter.constants.JmeterProperty;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.SQLProcessor;
|
||||
import io.metersphere.project.api.processor.SQLProcessor;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.SQLProcessor;
|
||||
import io.metersphere.project.api.processor.SQLProcessor;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.SQLProcessor;
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.processor.SQLProcessor;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.TimeWaitingProcessor;
|
||||
import io.metersphere.project.api.processor.TimeWaitingProcessor;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsAssertion;
|
||||
import io.metersphere.project.api.assertion.MsAssertion;
|
||||
import io.metersphere.api.parser.jmeter.validator.EnumValidator;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.*;
|
||||
import io.metersphere.project.api.assertion.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsResponseBodyAssertion;
|
||||
import io.metersphere.project.api.assertion.MsResponseBodyAssertion;
|
||||
import io.metersphere.api.parser.jmeter.processor.assertion.body.ResponseBodyTypeAssertionConverter;
|
||||
import io.metersphere.api.parser.jmeter.processor.assertion.body.ResponseBodyTypeAssertionFactory;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsResponseCodeAssertion;
|
||||
import io.metersphere.project.api.assertion.MsResponseCodeAssertion;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.assertions.ResponseAssertion;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsResponseHeaderAssertion;
|
||||
import io.metersphere.project.api.assertion.MsResponseHeaderAssertion;
|
||||
import io.metersphere.api.parser.jmeter.validator.EnumValidator;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsResponseTimeAssertion;
|
||||
import io.metersphere.project.api.assertion.MsResponseTimeAssertion;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jmeter.assertions.DurationAssertion;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.MsScriptAssertion;
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.assertion.MsScriptAssertion;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.api.parser.jmeter.processor.ScriptProcessorConverter;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion;
|
||||
|
||||
import io.metersphere.project.constants.ScriptLanguageType;
|
||||
import io.metersphere.api.dto.request.assertion.MsVariableAssertion;
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.assertion.MsVariableAssertion;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.api.parser.jmeter.processor.ScriptProcessorConverter;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion.body;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.body.MsDocumentAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsDocumentAssertion;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion.body;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.body.MsJSONPathAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsJSONPathAssertionItem;
|
||||
import io.metersphere.project.api.assertion.body.MsJSONPathAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsJSONPathAssertionItem;
|
||||
import io.metersphere.assertions.JSONPathAssertion;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion.body;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.body.MsRegexAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsRegexAssertionItem;
|
||||
import io.metersphere.project.api.assertion.body.MsRegexAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsRegexAssertionItem;
|
||||
import io.metersphere.api.parser.jmeter.processor.assertion.AssertionConverter;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion.body;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.body.MsBodyAssertionItem;
|
||||
import io.metersphere.project.api.assertion.body.MsBodyAssertionItem;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion.body;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.body.MsDocumentAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsJSONPathAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsRegexAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsXPathAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsDocumentAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsJSONPathAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsRegexAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsXPathAssertion;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.assertion.body;
|
||||
|
||||
import io.metersphere.api.dto.request.assertion.body.MsXPathAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsXPathAssertionItem;
|
||||
import io.metersphere.api.dto.request.processors.extract.XPathExtract;
|
||||
import io.metersphere.project.api.assertion.body.MsXPathAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsXPathAssertionItem;
|
||||
import io.metersphere.project.api.processor.extract.XPathExtract;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.extract;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.extract.MsExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.ResultMatchingExtract;
|
||||
import io.metersphere.project.api.processor.extract.MsExtract;
|
||||
import io.metersphere.project.api.processor.extract.ResultMatchingExtract;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.extract;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.extract.JSONPathExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.RegexExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.XPathExtract;
|
||||
import io.metersphere.project.api.processor.extract.JSONPathExtract;
|
||||
import io.metersphere.project.api.processor.extract.RegexExtract;
|
||||
import io.metersphere.project.api.processor.extract.XPathExtract;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.extract;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.extract.JSONPathExtract;
|
||||
import io.metersphere.project.api.processor.extract.JSONPathExtract;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.jmeter.extractor.json.jsonpath.JSONPostProcessor;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.extract;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.extract.RegexExtract;
|
||||
import io.metersphere.project.api.processor.extract.RegexExtract;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.extractor.RegexExtractor;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.parser.jmeter.processor.extract;
|
||||
|
||||
import io.metersphere.api.dto.request.processors.extract.XPathExtract;
|
||||
import io.metersphere.project.api.processor.extract.XPathExtract;
|
||||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.extractor.XPath2Extractor;
|
||||
|
|
|
@ -19,6 +19,7 @@ public class ApiScenarioStepParser extends StepParser {
|
|||
@Override
|
||||
public AbstractMsTestElement parseTestElement(ApiScenarioStepCommonDTO step, String resourceBlob, String stepDetail) {
|
||||
MsScenario msScenario = new MsScenario();
|
||||
msScenario.setRefType(step.getRefType());
|
||||
if (isRef(step.getRefType())) {
|
||||
if (StringUtils.isNotBlank(resourceBlob)) {
|
||||
msScenario.setScenarioConfig(JSON.parseObject(resourceBlob, ScenarioConfig.class));
|
||||
|
|
|
@ -2,7 +2,7 @@ package io.metersphere.api.parser.step;
|
|||
|
||||
import io.metersphere.api.domain.ApiDefinitionBlob;
|
||||
import io.metersphere.api.domain.ApiScenarioStep;
|
||||
import io.metersphere.api.dto.request.http.KeyValueParam;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import io.metersphere.api.dto.request.http.MsHTTPElement;
|
||||
import io.metersphere.api.dto.request.http.body.Body;
|
||||
import io.metersphere.api.dto.scenario.ApiScenarioStepCommonDTO;
|
||||
|
|
|
@ -1029,6 +1029,7 @@ public class ApiScenarioService {
|
|||
|
||||
// 解析生成待执行的场景树
|
||||
MsScenario msScenario = new MsScenario();
|
||||
msScenario.setRefType(ApiScenarioStepRefType.DIRECT.name());
|
||||
msScenario.setScenarioConfig(getScenarioConfig(request, hasSave));
|
||||
|
||||
// 获取场景环境相关配置
|
||||
|
|
|
@ -6,7 +6,7 @@ import io.metersphere.api.domain.ApiDebugBlob;
|
|||
import io.metersphere.api.domain.ApiFileResource;
|
||||
import io.metersphere.api.dto.debug.*;
|
||||
import io.metersphere.api.dto.request.MsCommonElement;
|
||||
import io.metersphere.api.dto.request.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.request.http.MsHTTPElement;
|
||||
import io.metersphere.api.dto.request.http.body.Body;
|
||||
import io.metersphere.api.mapper.ApiDebugBlobMapper;
|
||||
|
|
|
@ -7,8 +7,8 @@ import io.metersphere.api.constants.ApiScenarioStepType;
|
|||
import io.metersphere.api.domain.*;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionAddRequest;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseAddRequest;
|
||||
import io.metersphere.api.dto.request.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.request.assertion.MsScriptAssertion;
|
||||
import io.metersphere.api.dto.assertion.MsAssertionConfig;
|
||||
import io.metersphere.project.api.assertion.MsScriptAssertion;
|
||||
import io.metersphere.api.dto.request.http.MsHTTPElement;
|
||||
import io.metersphere.api.dto.response.ApiScenarioBatchOperationResponse;
|
||||
import io.metersphere.api.dto.response.OperationDataInfo;
|
||||
|
|
|
@ -5,7 +5,7 @@ import io.metersphere.api.service.BaseResourcePoolTestService;
|
|||
import io.metersphere.plugin.api.dto.ApiPluginSelectOption;
|
||||
import io.metersphere.project.constants.ScriptLanguageType;
|
||||
import io.metersphere.project.dto.customfunction.request.CustomFunctionRunRequest;
|
||||
import io.metersphere.project.dto.environment.KeyValueParam;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import io.metersphere.sdk.constants.PermissionConstants;
|
||||
import io.metersphere.system.base.BasePluginTestService;
|
||||
import io.metersphere.system.base.BaseTest;
|
||||
|
|
|
@ -2,10 +2,9 @@ package io.metersphere.api.controller;
|
|||
|
||||
import io.metersphere.api.dto.ApiFile;
|
||||
import io.metersphere.api.dto.ApiParamConfig;
|
||||
import io.metersphere.api.dto.assertion.MsAssertionConfig;
|
||||
import io.metersphere.api.dto.definition.HttpResponse;
|
||||
import io.metersphere.api.dto.request.MsCommonElement;
|
||||
import io.metersphere.api.dto.request.assertion.*;
|
||||
import io.metersphere.api.dto.request.assertion.body.*;
|
||||
import io.metersphere.api.dto.request.http.*;
|
||||
import io.metersphere.api.dto.request.http.auth.BasicAuth;
|
||||
import io.metersphere.api.dto.request.http.auth.DigestAuth;
|
||||
|
@ -13,10 +12,13 @@ import io.metersphere.api.dto.request.http.auth.HTTPAuth;
|
|||
import io.metersphere.api.dto.request.http.auth.NoAuth;
|
||||
import io.metersphere.api.dto.request.http.body.*;
|
||||
import io.metersphere.api.dto.request.processors.*;
|
||||
import io.metersphere.api.dto.request.processors.extract.JSONPathExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.RegexExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.ResultMatchingExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.XPathExtract;
|
||||
import io.metersphere.project.api.assertion.*;
|
||||
import io.metersphere.project.api.assertion.body.*;
|
||||
import io.metersphere.project.api.processor.extract.JSONPathExtract;
|
||||
import io.metersphere.project.api.processor.extract.RegexExtract;
|
||||
import io.metersphere.project.api.processor.extract.ResultMatchingExtract;
|
||||
import io.metersphere.project.api.processor.extract.XPathExtract;
|
||||
import io.metersphere.project.api.processor.ExtractPostProcessor;
|
||||
import io.metersphere.api.dto.schema.JsonSchemaItem;
|
||||
import io.metersphere.api.parser.TestElementParser;
|
||||
import io.metersphere.api.parser.TestElementParserFactory;
|
||||
|
@ -24,6 +26,10 @@ import io.metersphere.api.utils.ApiDataUtils;
|
|||
import io.metersphere.plugin.api.dto.ParameterConfig;
|
||||
import io.metersphere.plugin.api.spi.AbstractMsTestElement;
|
||||
import io.metersphere.project.constants.ScriptLanguageType;
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import io.metersphere.project.api.processor.SQLProcessor;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import io.metersphere.project.api.processor.TimeWaitingProcessor;
|
||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||
import io.metersphere.sdk.util.BeanUtils;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.http;
|
||||
package io.metersphere.project.api;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.http;
|
||||
package io.metersphere.project.api;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
|
@ -1,10 +1,7 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.project.api.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import io.metersphere.api.dto.request.processors.extract.JSONPathExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.RegexExtract;
|
||||
import io.metersphere.api.dto.request.processors.extract.XPathExtract;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.project.api.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsDocumentAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsJSONPathAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsRegexAssertion;
|
||||
import io.metersphere.api.dto.request.assertion.body.MsXPathAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsDocumentAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsJSONPathAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsRegexAssertion;
|
||||
import io.metersphere.project.api.assertion.body.MsXPathAssertion;
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.project.api.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.system.valid.EnumValue;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.project.api.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.system.valid.EnumValue;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.project.api.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Data;
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.project.api.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.api.dto.request.http.KeyValueParam;
|
||||
import io.metersphere.api.dto.request.processors.ScriptProcessor;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import io.metersphere.project.api.processor.ScriptProcessor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion;
|
||||
package io.metersphere.project.api.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.system.valid.EnumValue;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import jakarta.validation.Valid;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
import io.metersphere.sdk.constants.MsAssertionCondition;
|
||||
import io.metersphere.sdk.constants.ValueEnum;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import jakarta.validation.constraints.NotBlank;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
|
||||
import io.metersphere.system.valid.EnumValue;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.assertion.body;
|
||||
package io.metersphere.project.api.assertion.body;
|
||||
|
||||
|
||||
import lombok.Data;
|
|
@ -1,7 +1,7 @@
|
|||
package io.metersphere.api.dto.request.processors;
|
||||
package io.metersphere.project.api.processor;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.api.dto.request.processors.extract.MsExtract;
|
||||
import io.metersphere.project.api.processor.extract.MsExtract;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
|
@ -1,7 +1,9 @@
|
|||
package io.metersphere.api.dto.request.processors;
|
||||
package io.metersphere.project.api.processor;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import io.metersphere.project.dto.environment.processors.RequestScriptProcessor;
|
||||
import io.metersphere.project.dto.environment.processors.ScenarioScriptProcessor;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
@ -15,6 +17,8 @@ import lombok.Data;
|
|||
* SQL {@link SQLProcessor}
|
||||
* TIME_WAITING {@link TimeWaitingProcessor}
|
||||
* EXTRACT {@link ExtractPostProcessor}
|
||||
* SCENARIO_SCRIPT {@link ScenarioScriptProcessor}
|
||||
* REQUEST_SCRIPT {@link RequestScriptProcessor}
|
||||
* <pre>
|
||||
* @Author: jianxing
|
||||
* @CreateTime: 2023-11-07 10:17
|
||||
|
@ -23,6 +27,8 @@ import lombok.Data;
|
|||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "processorType")
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = ScriptProcessor.class),
|
||||
@JsonSubTypes.Type(value = ScenarioScriptProcessor.class),
|
||||
@JsonSubTypes.Type(value = RequestScriptProcessor.class),
|
||||
@JsonSubTypes.Type(value = SQLProcessor.class),
|
||||
@JsonSubTypes.Type(value = TimeWaitingProcessor.class),
|
||||
@JsonSubTypes.Type(value = ExtractPostProcessor.class),
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.api.dto.request.processors;
|
||||
package io.metersphere.project.api.processor;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.api.dto.request.http.KeyValueEnableParam;
|
||||
import io.metersphere.api.dto.request.http.KeyValueParam;
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
|
@ -1,8 +1,8 @@
|
|||
package io.metersphere.api.dto.request.processors;
|
||||
package io.metersphere.project.api.processor;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.api.dto.request.http.KeyValueParam;
|
||||
import io.metersphere.project.constants.ScriptLanguageType;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
@ -10,6 +10,7 @@ import lombok.Data;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author: jianxing
|
||||
* @CreateTime: 2023-11-06 21:12
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.processors;
|
||||
package io.metersphere.project.api.processor;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.processors.extract;
|
||||
package io.metersphere.project.api.processor.extract;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.processors.extract;
|
||||
package io.metersphere.project.api.processor.extract;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.processors.extract;
|
||||
package io.metersphere.project.api.processor.extract;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.system.valid.EnumValue;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.processors.extract;
|
||||
package io.metersphere.project.api.processor.extract;
|
||||
|
||||
import io.metersphere.system.valid.EnumValue;
|
||||
import jakarta.validation.constraints.Size;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.request.processors.extract;
|
||||
package io.metersphere.project.api.processor.extract;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.system.valid.EnumValue;
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.project.dto.customfunction.request;
|
||||
|
||||
import io.metersphere.project.dto.environment.KeyValueParam;
|
||||
import io.metersphere.project.api.KeyValueParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
package io.metersphere.project.dto.environment;
|
||||
|
||||
import io.metersphere.project.dto.environment.assertion.MsAssertionConfig;
|
||||
import io.metersphere.project.dto.environment.auth.AuthConfig;
|
||||
import io.metersphere.project.dto.environment.common.CommonParams;
|
||||
import io.metersphere.project.dto.environment.datasource.DataSource;
|
||||
import io.metersphere.project.dto.environment.host.HostConfig;
|
||||
import io.metersphere.project.dto.environment.http.HttpConfig;
|
||||
import io.metersphere.project.dto.environment.processors.post.EnvironmentPostScript;
|
||||
import io.metersphere.project.dto.environment.processors.pre.EnvironmentPreScript;
|
||||
import io.metersphere.project.dto.environment.processors.EnvProcessorConfig;
|
||||
import io.metersphere.project.dto.environment.variables.CommonVariables;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -34,11 +32,11 @@ public class EnvironmentConfig implements Serializable {
|
|||
@Schema(description = "认证配置")
|
||||
private AuthConfig authConfig;
|
||||
@Schema(description = "全局前置脚本")
|
||||
private EnvironmentPreScript preScript;
|
||||
private EnvProcessorConfig preProcessorConfig;
|
||||
@Schema(description = "全局后置脚本")
|
||||
private EnvironmentPostScript postScript;
|
||||
private EnvProcessorConfig postProcessorConfig;
|
||||
@Schema(description = "全局断言")
|
||||
private MsAssertionConfig assertions;
|
||||
private MsEnvAssertionConfig assertionConfig;
|
||||
@Schema(description = "插件自定义的配置项,key为插件ID,value 为对应配置")
|
||||
private Map<String, Object> pluginConfigMap;
|
||||
|
||||
|
@ -50,9 +48,9 @@ public class EnvironmentConfig implements Serializable {
|
|||
this.dataSources = List.of(new DataSource());
|
||||
this.hostConfig = new HostConfig();
|
||||
this.authConfig = new AuthConfig();
|
||||
this.preScript = new EnvironmentPreScript();
|
||||
this.postScript = new EnvironmentPostScript();
|
||||
this.assertions = new MsAssertionConfig();
|
||||
this.preProcessorConfig = new EnvProcessorConfig();
|
||||
this.postProcessorConfig = new EnvProcessorConfig();
|
||||
this.assertionConfig = new MsEnvAssertionConfig();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.project.dto.environment;
|
||||
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import io.metersphere.project.dto.environment.variables.CommonVariables;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package io.metersphere.project.dto.environment;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class KeyValueEnableParam extends KeyValueParam {
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enable = true;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package io.metersphere.project.dto.environment;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Data
|
||||
public class KeyValueParam {
|
||||
/**
|
||||
* 键
|
||||
*/
|
||||
private String key;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
public boolean isValid() {
|
||||
return StringUtils.isNotBlank(key);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package io.metersphere.project.dto.environment;
|
||||
|
||||
import io.metersphere.project.api.assertion.MsAssertion;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 断言设置
|
||||
* @Author: jianxing
|
||||
* @CreateTime: 2023-11-23 17:26
|
||||
*/
|
||||
@Data
|
||||
public class MsEnvAssertionConfig {
|
||||
/**
|
||||
* 断言列表
|
||||
*/
|
||||
private List<MsAssertion> assertions;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 断言
|
||||
*/
|
||||
@Data
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "assertionType")
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = MsResponseCodeAssertion.class),
|
||||
@JsonSubTypes.Type(value = MsResponseHeaderAssertion.class),
|
||||
@JsonSubTypes.Type(value = MsResponseBodyAssertion.class),
|
||||
@JsonSubTypes.Type(value = MsResponseTimeAssertion.class),
|
||||
@JsonSubTypes.Type(value = MsScriptAssertion.class),
|
||||
@JsonSubTypes.Type(value = MsVariableAssertion.class),
|
||||
})
|
||||
public abstract class MsAssertion {
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enable = true;
|
||||
/**
|
||||
* 断言名称
|
||||
*/
|
||||
private String name;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MsAssertionConfig {
|
||||
/**
|
||||
* 断言列表
|
||||
*/
|
||||
private List<MsAssertion> assertions;
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.project.dto.environment.assertion.body.MsDocumentAssertion;
|
||||
import io.metersphere.project.dto.environment.assertion.body.MsJSONPathAssertion;
|
||||
import io.metersphere.project.dto.environment.assertion.body.MsRegexAssertion;
|
||||
import io.metersphere.project.dto.environment.assertion.body.MsXPathAssertion;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@JsonTypeName("ENV_RESPONSE_BODY")
|
||||
public class MsResponseBodyAssertion extends MsAssertion {
|
||||
/**
|
||||
* 断言类型
|
||||
* 根据断言类型,选择对应的断言
|
||||
* 这里跟前端数据结构有差异
|
||||
* 后端从设计层面支持多种断言,前端只支持一种
|
||||
* 同时切换可以同时持久化两种类型
|
||||
*
|
||||
* @see MsBodyAssertionType
|
||||
*/
|
||||
private String assertionBodyType;
|
||||
/**
|
||||
* jsonPath断言
|
||||
*/
|
||||
private MsJSONPathAssertion jsonPathAssertion;
|
||||
/**
|
||||
* xpath断言
|
||||
*/
|
||||
private MsXPathAssertion xpathAssertion;
|
||||
/**
|
||||
* 文档断言
|
||||
*/
|
||||
private MsDocumentAssertion documentAssertion;
|
||||
/**
|
||||
* 正则断言
|
||||
*/
|
||||
private MsRegexAssertion regexAssertion;
|
||||
|
||||
private static Map<MsBodyAssertionType, Class> bodyAssertionClassMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
bodyAssertionClassMap.put(MsBodyAssertionType.JSON_PATH, MsJSONPathAssertion.class);
|
||||
bodyAssertionClassMap.put(MsBodyAssertionType.DOCUMENT, MsDocumentAssertion.class);
|
||||
bodyAssertionClassMap.put(MsBodyAssertionType.REGEX, MsRegexAssertion.class);
|
||||
bodyAssertionClassMap.put(MsBodyAssertionType.XPATH, MsXPathAssertion.class);
|
||||
}
|
||||
|
||||
public Class getBodyAssertionClassByType() {
|
||||
return bodyAssertionClassMap.get(MsBodyAssertionType.valueOf(assertionBodyType));
|
||||
}
|
||||
|
||||
public Object getBodyAssertionDataByType() {
|
||||
Map<MsBodyAssertionType, Object> boadyAssertionMap = new HashMap<>();
|
||||
boadyAssertionMap.put(MsBodyAssertionType.JSON_PATH, jsonPathAssertion);
|
||||
boadyAssertionMap.put(MsBodyAssertionType.DOCUMENT, documentAssertion);
|
||||
boadyAssertionMap.put(MsBodyAssertionType.REGEX, regexAssertion);
|
||||
boadyAssertionMap.put(MsBodyAssertionType.XPATH, xpathAssertion);
|
||||
return boadyAssertionMap.get(MsBodyAssertionType.valueOf(assertionBodyType));
|
||||
}
|
||||
|
||||
public enum MsBodyAssertionType {
|
||||
/**
|
||||
* 正则断言
|
||||
*/
|
||||
REGEX,
|
||||
/**
|
||||
* XPath断言
|
||||
*/
|
||||
XPATH,
|
||||
/**
|
||||
* JSONPath断言
|
||||
*/
|
||||
JSON_PATH,
|
||||
/**
|
||||
* 文档断言
|
||||
*/
|
||||
DOCUMENT
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonTypeName("ENV_RESPONSE_CODE")
|
||||
public class MsResponseCodeAssertion extends MsAssertion {
|
||||
/**
|
||||
* 匹配条件
|
||||
* 不校验即忽略状态
|
||||
* 选择其他条件时,也忽略状态
|
||||
* 不校验可搭配其他校验使用
|
||||
*
|
||||
* @see io.metersphere.sdk.constants.MsAssertionCondition
|
||||
*/
|
||||
private String condition;
|
||||
/**
|
||||
* 匹配值
|
||||
*/
|
||||
private String expectedValue;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonTypeName("ENV_RESPONSE_HEADER")
|
||||
public class MsResponseHeaderAssertion extends MsAssertion {
|
||||
|
||||
private List<ResponseHeaderAssertionItem> assertions;
|
||||
|
||||
|
||||
@Data
|
||||
public static class ResponseHeaderAssertionItem {
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enable = true;
|
||||
/**
|
||||
* 响应头
|
||||
*/
|
||||
private String header;
|
||||
/**
|
||||
* 匹配条件
|
||||
* 值为 MsAssertionCondition
|
||||
*/
|
||||
private String condition;
|
||||
/**
|
||||
* 匹配值
|
||||
*/
|
||||
private String expectedValue;
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@JsonTypeName("ENV_RESPONSE_TIME")
|
||||
public class MsResponseTimeAssertion extends MsAssertion {
|
||||
/**
|
||||
* 最大响应时间
|
||||
* 响应时间在xx毫秒内
|
||||
*/
|
||||
private Long expectedValue;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import io.metersphere.project.dto.environment.KeyValueParam;
|
||||
import io.metersphere.project.dto.environment.processors.ScriptProcessor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonTypeName("ENV_SCRIPT_ASSERTION")
|
||||
public class MsScriptAssertion extends MsAssertion {
|
||||
/**
|
||||
* 脚本内容
|
||||
*/
|
||||
private String script;
|
||||
/**
|
||||
* 脚本语言
|
||||
*
|
||||
* @see ScriptProcessor.ScriptLanguageType
|
||||
*/
|
||||
private String scriptLanguage;
|
||||
/**
|
||||
* 是否启用公共脚本
|
||||
*/
|
||||
private Boolean enableCommonScript;
|
||||
/**
|
||||
* 脚本ID
|
||||
*/
|
||||
private String scriptId;
|
||||
/**
|
||||
* 公共脚本入参
|
||||
*/
|
||||
private List<KeyValueParam> params;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonTypeName("ENV_VARIABLE")
|
||||
public class MsVariableAssertion extends MsAssertion {
|
||||
|
||||
private List<VariableAssertionItem> variableAssertionItems;
|
||||
|
||||
@Data
|
||||
public static class VariableAssertionItem {
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enable = true;
|
||||
/**
|
||||
* 变量名
|
||||
*/
|
||||
private String variableName;
|
||||
/**
|
||||
* 匹配条件
|
||||
* 值为 MsAssertionCondition
|
||||
*/
|
||||
private String condition;
|
||||
/**
|
||||
* 匹配值
|
||||
*/
|
||||
private String expectedValue;
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public abstract class MsBodyAssertionItem {
|
||||
private Boolean enable = true;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MsDocumentAssertion extends MsBodyAssertionItem {
|
||||
/**
|
||||
* 跟随定义的apiId
|
||||
* 传空为不跟随接口定义
|
||||
*/
|
||||
private String followApiId;
|
||||
/**
|
||||
* 文档类型
|
||||
* json 或者 xml
|
||||
* 根据文档类型,选择对应的文档
|
||||
* 这里跟前端数据结构有差异
|
||||
* 后端从设计层面支持多种文档格式,前端只支持一种
|
||||
* 同时切换可以同时持久化两种格式
|
||||
*
|
||||
* @see DocumentType
|
||||
*/
|
||||
private String documentType;
|
||||
/**
|
||||
* json格式的文档断言
|
||||
*/
|
||||
private MsDocumentAssertionElement jsonAssertion;
|
||||
/**
|
||||
* xml格式的文档断言
|
||||
*/
|
||||
private MsDocumentAssertionElement xmlAssertion;
|
||||
|
||||
public enum DocumentType {
|
||||
JSON,
|
||||
XML;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class MsDocumentAssertionElement {
|
||||
private String id;
|
||||
/**
|
||||
* 参数名
|
||||
*/
|
||||
private String paramName;
|
||||
/**
|
||||
* 必含
|
||||
*/
|
||||
private Boolean include = false;
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 类型校验
|
||||
*/
|
||||
private Boolean typeVerification = false;
|
||||
/**
|
||||
* 匹配条件
|
||||
*/
|
||||
private String condition;
|
||||
/**
|
||||
* 匹配值
|
||||
* 即预期结果
|
||||
*/
|
||||
private Object expectedResult;
|
||||
/**
|
||||
* 组内校验
|
||||
*/
|
||||
private Boolean arrayVerification;
|
||||
/**
|
||||
* 子对象
|
||||
*/
|
||||
private List<MsDocumentAssertionElement> children;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MsJSONPathAssertion {
|
||||
|
||||
/**
|
||||
* 断言列表
|
||||
*/
|
||||
private List<MsJSONPathAssertionItem> assertions;
|
||||
}
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Data
|
||||
public class MsJSONPathAssertionItem extends MsBodyAssertionItem {
|
||||
private String expression;
|
||||
private String condition;
|
||||
private String expectedValue;
|
||||
|
||||
|
||||
public boolean isValid() {
|
||||
return StringUtils.isNotBlank(expression) && StringUtils.isNotBlank(condition) && StringUtils.isNotBlank(expectedValue);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MsRegexAssertion {
|
||||
/**
|
||||
* 断言列表
|
||||
*/
|
||||
private List<MsRegexAssertionItem> assertions;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Data
|
||||
public class MsRegexAssertionItem extends MsBodyAssertionItem {
|
||||
private String expression;
|
||||
|
||||
public boolean isValid() {
|
||||
return StringUtils.isNotBlank(expression);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MsXPathAssertion {
|
||||
/**
|
||||
* 响应内容格式
|
||||
* xml 或者 html
|
||||
*/
|
||||
private String responseFormat;
|
||||
/**
|
||||
* xpath断言
|
||||
*/
|
||||
private List<MsXPathAssertionItem> assertions;
|
||||
|
||||
public enum ResponseFormat {
|
||||
/**
|
||||
* XML
|
||||
*/
|
||||
XML,
|
||||
/**
|
||||
* HTML
|
||||
*/
|
||||
HTML
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package io.metersphere.project.dto.environment.assertion.body;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Data
|
||||
public class MsXPathAssertionItem extends MsBodyAssertionItem {
|
||||
private String expression;
|
||||
private String expectedValue;
|
||||
|
||||
public boolean isValid() {
|
||||
return StringUtils.isNotBlank(expression) && StringUtils.isNotBlank(expectedValue);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package io.metersphere.project.dto.environment.http;
|
|||
|
||||
|
||||
import io.metersphere.project.dto.environment.KeyValue;
|
||||
import io.metersphere.project.dto.environment.KeyValueEnableParam;
|
||||
import io.metersphere.project.api.KeyValueEnableParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue