Merge branch 'main' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
a463c879e7
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.dto.definition.request;
|
||||
|
||||
import io.metersphere.api.dto.EnvironmentType;
|
||||
import io.metersphere.api.dto.RunningParamKeys;
|
||||
import io.metersphere.api.dto.definition.request.assertions.MsAssertions;
|
||||
import io.metersphere.api.dto.definition.request.auth.MsAuthManager;
|
||||
import io.metersphere.api.dto.definition.request.controller.MsIfController;
|
||||
|
@ -18,16 +19,21 @@ import io.metersphere.api.dto.definition.request.timer.MsConstantTimer;
|
|||
import io.metersphere.api.dto.definition.request.unknown.MsJmeterElement;
|
||||
import io.metersphere.api.dto.definition.request.variable.ScenarioVariable;
|
||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.scenario.environment.item.EnvAssertions;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.base.domain.FileMetadata;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.constants.PropertyConstant;
|
||||
import io.metersphere.commons.constants.StorageConstants;
|
||||
import io.metersphere.commons.enums.StorageEnums;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.commons.vo.JDBCProcessorVO;
|
||||
import io.metersphere.commons.vo.ScriptProcessorVO;
|
||||
import io.metersphere.constants.RunModeConstants;
|
||||
import io.metersphere.environment.service.BaseEnvGroupProjectService;
|
||||
import io.metersphere.environment.service.BaseEnvironmentService;
|
||||
|
@ -46,8 +52,10 @@ import org.apache.jmeter.config.RandomVariableConfig;
|
|||
import org.apache.jmeter.modifiers.CounterConfig;
|
||||
import org.apache.jmeter.modifiers.UserParameters;
|
||||
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy;
|
||||
import org.apache.jmeter.protocol.java.sampler.BeanShellSampler;
|
||||
import org.apache.jmeter.protocol.jdbc.AbstractJDBCTestElement;
|
||||
import org.apache.jmeter.protocol.jdbc.config.DataSourceElement;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.AbstractTestElement;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jmeter.testelement.TestPlan;
|
||||
import org.apache.jmeter.threads.ThreadGroup;
|
||||
|
@ -67,6 +75,7 @@ public class ElementUtil {
|
|||
private static final String POST = "POST";
|
||||
private static final String ASSERTIONS = ElementConstants.ASSERTIONS;
|
||||
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
||||
private static final String TEST_BEAN_GUI = "TestBeanGUI";
|
||||
|
||||
|
||||
public static Map<String, EnvironmentConfig> getEnvironmentConfig(String environmentId, String projectId) {
|
||||
|
@ -101,7 +110,7 @@ public class ElementUtil {
|
|||
CSVDataSet csvDataSet = new CSVDataSet();
|
||||
csvDataSet.setEnabled(true);
|
||||
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
|
||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
|
||||
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? StandardCharsets.UTF_8.name() : item.getEncoding());
|
||||
if (CollectionUtils.isEmpty(item.getFiles())) {
|
||||
|
@ -150,7 +159,7 @@ public class ElementUtil {
|
|||
CSVDataSet csvDataSet = new CSVDataSet();
|
||||
csvDataSet.setEnabled(true);
|
||||
csvDataSet.setProperty(TestElement.TEST_CLASS, CSVDataSet.class.getName());
|
||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName());
|
||||
csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? StandardCharsets.UTF_8.name() : item.getEncoding());
|
||||
if (CollectionUtils.isEmpty(item.getFiles())) {
|
||||
|
@ -219,7 +228,7 @@ public class ElementUtil {
|
|||
RandomVariableConfig randomVariableConfig = new RandomVariableConfig();
|
||||
randomVariableConfig.setEnabled(true);
|
||||
randomVariableConfig.setProperty(TestElement.TEST_CLASS, RandomVariableConfig.class.getName());
|
||||
randomVariableConfig.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
randomVariableConfig.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
randomVariableConfig.setName(item.getName());
|
||||
randomVariableConfig.setProperty("variableName", item.getName());
|
||||
randomVariableConfig.setProperty("outputFormat", item.getValue());
|
||||
|
@ -590,7 +599,7 @@ public class ElementUtil {
|
|||
return processor;
|
||||
}
|
||||
|
||||
public static void setBaseParams(AbstractTestElement sampler, MsTestElement parent, ParameterConfig config, String id, String indexPath) {
|
||||
public static void setBaseParams(TestElement sampler, MsTestElement parent, ParameterConfig config, String id, String indexPath) {
|
||||
sampler.setProperty("MS-ID", id);
|
||||
sampler.setProperty("MS-RESOURCE-ID", ElementUtil.getResourceId(id, config, parent, indexPath));
|
||||
}
|
||||
|
@ -866,4 +875,127 @@ public class ElementUtil {
|
|||
public static String getDataSourceName(String name) {
|
||||
return StringUtils.join(name, "-", UUID.randomUUID().toString());
|
||||
}
|
||||
|
||||
|
||||
public static void initScript(TestElement testElement, ScriptProcessorVO vo) {
|
||||
testElement.setEnabled(vo.isEnabled());
|
||||
if (StringUtils.isNotEmpty(vo.getName())) {
|
||||
testElement.setName(vo.getName());
|
||||
} else {
|
||||
testElement.setName(testElement.getClass().getSimpleName());
|
||||
}
|
||||
//替换环境变量
|
||||
if (StringUtils.isNotEmpty(vo.getScript())) {
|
||||
vo.setScript(StringUtils.replace(vo.getScript(), RunningParamKeys.API_ENVIRONMENT_ID, "\"" + RunningParamKeys.RUNNING_PARAMS_PREFIX + vo.getEnvironmentId() + ".\""));
|
||||
}
|
||||
testElement.setProperty(TestElement.TEST_CLASS, testElement.getClass().getSimpleName());
|
||||
testElement.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
String scriptLanguage = vo.getScriptLanguage();
|
||||
if (StringUtils.equals(scriptLanguage, "nashornScript")) {
|
||||
scriptLanguage = "nashorn";
|
||||
}
|
||||
if (StringUtils.equalsAny(scriptLanguage, "rhinoScript", "javascript")) {
|
||||
scriptLanguage = "rhino";
|
||||
}
|
||||
testElement.setProperty("scriptLanguage", scriptLanguage);
|
||||
|
||||
if (testElement instanceof BeanShellSampler) {
|
||||
testElement.setProperty("BeanShellSampler.query", vo.getScript());
|
||||
testElement.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("BeanShellSamplerGui"));
|
||||
} else {
|
||||
testElement.setProperty("scriptLanguage", vo.getScriptLanguage());
|
||||
testElement.setProperty("script", vo.getScript());
|
||||
}
|
||||
}
|
||||
|
||||
public static String getScriptEnv(String environmentId, ParameterConfig config) {
|
||||
if (StringUtils.isEmpty(environmentId)) {
|
||||
if (config.getConfig() != null) {
|
||||
if (config.getProjectId() != null && config.getConfig().containsKey(config.getProjectId())) {
|
||||
return config.getConfig().get(config.getProjectId()).getEnvironmentId();
|
||||
} else {
|
||||
if (CollectionUtils.isNotEmpty(config.getConfig().values())) {
|
||||
Optional<EnvironmentConfig> values = config.getConfig().entrySet().stream().findFirst().map(Map.Entry::getValue);
|
||||
return values.get().getEnvironmentId();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return environmentId;
|
||||
}
|
||||
|
||||
public static void jdbcArguments(String name, List<KeyValue> variables, HashTree tree) {
|
||||
if (CollectionUtils.isNotEmpty(variables)) {
|
||||
Arguments arguments = new Arguments();
|
||||
arguments.setEnabled(true);
|
||||
name = StringUtils.isNotEmpty(name) ? name : "Arguments";
|
||||
arguments.setName(name + "JDBC_Argument");
|
||||
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
|
||||
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
|
||||
variables.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
arguments.addArgument(keyValue.getName(), ElementUtil.getEvlValue(keyValue.getValue()), "=")
|
||||
);
|
||||
if (!arguments.getArguments().isEmpty()) {
|
||||
tree.add(arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void jdbcProcessor(AbstractJDBCTestElement jdbcProcessor, ParameterConfig config, JDBCProcessorVO vo) {
|
||||
jdbcProcessor.setEnabled(vo.isEnable());
|
||||
jdbcProcessor.setName(vo.getName() == null ? jdbcProcessor.getClass().getSimpleName() : vo.getName());
|
||||
jdbcProcessor.setProperty(TestElement.TEST_CLASS, jdbcProcessor.getClass().getSimpleName());
|
||||
jdbcProcessor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
|
||||
ElementUtil.setBaseParams(jdbcProcessor, vo.getParent(), config, vo.getId(), vo.getIndex());
|
||||
jdbcProcessor.setDataSource(ElementUtil.getDataSourceName(vo.getDataSource().getName()));
|
||||
jdbcProcessor.setProperty("dataSource", jdbcProcessor.getDataSource());
|
||||
jdbcProcessor.setProperty("query", vo.getQuery());
|
||||
jdbcProcessor.setProperty("queryTimeout", String.valueOf(vo.getQueryTimeout()));
|
||||
jdbcProcessor.setProperty("resultVariable", vo.getResultVariable());
|
||||
jdbcProcessor.setProperty("variableNames", vo.getVariableNames());
|
||||
jdbcProcessor.setProperty("resultSetHandler", "Store as String");
|
||||
jdbcProcessor.setProperty("queryType", "Callable Statement");
|
||||
}
|
||||
|
||||
public static DataSourceElement jdbcDataSource(String sourceName, DatabaseConfig dataSource) {
|
||||
DataSourceElement dataSourceElement = new DataSourceElement();
|
||||
dataSourceElement.setEnabled(true);
|
||||
dataSourceElement.setName(sourceName + " JDBCDataSource");
|
||||
dataSourceElement.setProperty(TestElement.TEST_CLASS, DataSourceElement.class.getName());
|
||||
dataSourceElement.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass(TEST_BEAN_GUI));
|
||||
dataSourceElement.setProperty("autocommit", true);
|
||||
dataSourceElement.setProperty("keepAlive", true);
|
||||
dataSourceElement.setProperty("preinit", false);
|
||||
dataSourceElement.setProperty("dataSource", sourceName);
|
||||
dataSourceElement.setProperty("dbUrl", dataSource.getDbUrl());
|
||||
dataSourceElement.setProperty("driver", dataSource.getDriver());
|
||||
dataSourceElement.setProperty("username", dataSource.getUsername());
|
||||
dataSourceElement.setProperty("password", dataSource.getPassword());
|
||||
dataSourceElement.setProperty("poolMax", dataSource.getPoolMax());
|
||||
dataSourceElement.setProperty("timeout", String.valueOf(dataSource.getTimeout()));
|
||||
dataSourceElement.setProperty("connectionAge", 5000);
|
||||
dataSourceElement.setProperty("trimInterval", 6000);
|
||||
dataSourceElement.setProperty("transactionIsolation", "DEFAULT");
|
||||
return dataSourceElement;
|
||||
}
|
||||
|
||||
|
||||
public static DatabaseConfig initDataSource(String environmentId, String dataSourceId) {
|
||||
if (StringUtils.isNotBlank(environmentId) && StringUtils.isNotBlank(dataSourceId)) {
|
||||
BaseEnvironmentService service = CommonBeanFactory.getBean(BaseEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = service.get(environmentId);
|
||||
if (environment != null && environment.getConfig() != null) {
|
||||
EnvironmentConfig envConfig = JSONUtil.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
if (CollectionUtils.isNotEmpty(envConfig.getDatabaseConfigs())) {
|
||||
List<DatabaseConfig> configs = envConfig.getDatabaseConfigs().stream().filter(item ->
|
||||
StringUtils.equals(item.getId(), dataSourceId)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(configs)) {
|
||||
return configs.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class MsAssertionJSR223 extends MsAssertionType {
|
|||
private String name;
|
||||
private String script;
|
||||
private String scriptLanguage;
|
||||
private Boolean jsrEnable;
|
||||
|
||||
public MsAssertionJSR223() {
|
||||
setType(MsAssertionType.JSR223);
|
||||
|
|
|
@ -2,16 +2,17 @@ package io.metersphere.api.dto.definition.request.assertions;
|
|||
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.definition.request.assertions.document.MsAssertionDocument;
|
||||
import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.constants.PropertyConstant;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.ErrorReportLibraryUtil;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.commons.utils.ErrorReportLibraryUtil;
|
||||
import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.assertions.*;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
|
@ -196,8 +197,11 @@ public class MsAssertions extends MsTestElement {
|
|||
return assertion;
|
||||
}
|
||||
|
||||
private JSR223Assertion jsr223Assertion(MsAssertionJSR223 assertionJSR223) {
|
||||
JSR223Assertion assertion = new JSR223Assertion();
|
||||
private TestElement jsr223Assertion(MsAssertionJSR223 assertionJSR223) {
|
||||
TestElement assertion = new BeanShellAssertion();
|
||||
if (assertionJSR223.getJsrEnable() == null || BooleanUtils.isTrue(assertionJSR223.getJsrEnable())) {
|
||||
assertion = new JSR223Assertion();
|
||||
}
|
||||
assertion.setEnabled(this.isEnable());
|
||||
if (StringUtils.isNotEmpty(assertionJSR223.getDesc())) {
|
||||
assertion.setName("JSR223" + delimiter + this.getName() + delimiter + assertionJSR223.getDesc() + delimiterScript + assertionJSR223.getScript());
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
package io.metersphere.api.dto.definition.request.processors;
|
||||
|
||||
import io.metersphere.api.dto.RunningParamKeys;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.shell.filter.ScriptFilter;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.vo.ScriptProcessorVO;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.utils.JMeterVars;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.protocol.java.sampler.BeanShellSampler;
|
||||
import org.apache.jmeter.protocol.java.sampler.JSR223Sampler;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -27,32 +28,15 @@ public class MsJSR223Processor extends MsTestElement {
|
|||
private String clazzName = MsJSR223Processor.class.getCanonicalName();
|
||||
private String script;
|
||||
private String scriptLanguage;
|
||||
private Boolean jsrEnable;
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, MsParameter msParameter) {
|
||||
ScriptFilter.verify(this.getScriptLanguage(), this.getName(), script);
|
||||
ParameterConfig config = (ParameterConfig) msParameter;
|
||||
//替换Metersphere环境变量
|
||||
if (StringUtils.isEmpty(this.getEnvironmentId())) {
|
||||
if (config.getConfig() != null) {
|
||||
if (config.getProjectId() != null) {
|
||||
String evnId = config.getConfig().get(config.getProjectId()).getEnvironmentId();
|
||||
this.setEnvironmentId(evnId);
|
||||
} else {
|
||||
Collection<EnvironmentConfig> evnConfigList = config.getConfig().values();
|
||||
if (evnConfigList != null && !evnConfigList.isEmpty()) {
|
||||
for (EnvironmentConfig configItem : evnConfigList) {
|
||||
String evnId = configItem.getEnvironmentId();
|
||||
this.setEnvironmentId(evnId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
script = StringUtils.replace(script, RunningParamKeys.API_ENVIRONMENT_ID, "\"" + RunningParamKeys.RUNNING_PARAMS_PREFIX + this.getEnvironmentId() + ".\"");
|
||||
|
||||
if (config.isOperating()) {
|
||||
if (StringUtils.isNotEmpty(script) && script.startsWith("io.metersphere.utils.JMeterVars.addVars")) {
|
||||
if (StringUtils.isNotEmpty(script) && script.startsWith(JMeterVars.class.getCanonicalName())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -60,28 +44,20 @@ public class MsJSR223Processor extends MsTestElement {
|
|||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
JSR223Sampler processor = new JSR223Sampler();
|
||||
processor.setEnabled(this.isEnable());
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
processor.setName(this.getName());
|
||||
} else {
|
||||
processor.setName(ElementConstants.JSR223);
|
||||
this.setEnvironmentId(ElementUtil.getScriptEnv(this.getEnvironmentId(), config));
|
||||
|
||||
TestElement processor = new BeanShellSampler();
|
||||
if (jsrEnable == null || BooleanUtils.isTrue(jsrEnable)) {
|
||||
processor = new JSR223Sampler();
|
||||
}
|
||||
ScriptProcessorVO vo = new ScriptProcessorVO();
|
||||
BeanUtils.copyBean(vo, this);
|
||||
vo.setEnabled(this.isEnable());
|
||||
ElementUtil.initScript(processor, vo);
|
||||
|
||||
String resourceId = StringUtils.isNotEmpty(this.getId()) ? this.getId() : this.getResourceId();
|
||||
ElementUtil.setBaseParams(processor, this.getParent(), config, resourceId, this.getIndex());
|
||||
processor.setProperty(TestElement.TEST_CLASS, JSR223Sampler.class.getName());
|
||||
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
processor.setProperty("scriptLanguage", this.getScriptLanguage());
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) {
|
||||
processor.setProperty("scriptLanguage", "nashorn");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) {
|
||||
processor.setProperty("scriptLanguage", "rhino");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("javascript")) {
|
||||
processor.setProperty("scriptLanguage", "rhino");
|
||||
}
|
||||
processor.setProperty("script", this.getScript());
|
||||
|
||||
final HashTree jsr223PreTree = tree.add(processor);
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
|
|
@ -1,40 +1,23 @@
|
|||
package io.metersphere.api.dto.definition.request.processors.post;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.commons.constants.CommonConstants;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.constants.MsTestElementConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.JSONUtil;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.environment.service.BaseEnvironmentService;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.vo.JDBCProcessorVO;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import io.metersphere.service.definition.ApiTestCaseService;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.config.Arguments;
|
||||
import org.apache.jmeter.protocol.jdbc.config.DataSourceElement;
|
||||
import org.apache.jmeter.protocol.jdbc.processor.JDBCPostProcessor;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -70,17 +53,12 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||
this.setRefElement();
|
||||
}
|
||||
if (config.getConfig() == null) {
|
||||
// 单独接口执行
|
||||
this.setProjectId(config.getProjectId());
|
||||
config.setConfig(ElementUtil.getEnvironmentConfig(StringUtils.isNotEmpty(useEnvironment) ? useEnvironment : environmentId, this.getProjectId()));
|
||||
}
|
||||
|
||||
//如果当前数据源为null,则获取已选环境的数据源
|
||||
if (this.dataSource == null) {
|
||||
// 自选了数据源
|
||||
if (config.isEffective(this.getProjectId()) && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())
|
||||
&& isDataSource(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())) {
|
||||
|
@ -88,7 +66,7 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
if (environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getEnvironmentId())) {
|
||||
this.environmentId = environmentConfig.getEnvironmentId();
|
||||
}
|
||||
this.initDataSource();
|
||||
this.dataSource = ElementUtil.initDataSource(this.environmentId, this.dataSourceId);
|
||||
} else {
|
||||
// 取当前环境下默认的一个数据源
|
||||
if (config.isEffective(this.getProjectId()) && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())) {
|
||||
|
@ -100,12 +78,10 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.dataSource == null) {
|
||||
// 用自身的数据
|
||||
if (StringUtils.isNotEmpty(dataSourceId)) {
|
||||
this.dataSource = null;
|
||||
this.initDataSource();
|
||||
this.dataSource = ElementUtil.initDataSource(this.environmentId, this.dataSourceId);
|
||||
}
|
||||
if (this.dataSource == null) {
|
||||
String message = "数据源为空请选择数据源";
|
||||
|
@ -114,11 +90,9 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
}
|
||||
JDBCPostProcessor jdbcPostProcessor = jdbcPostProcessor(config);
|
||||
final HashTree samplerHashTree = tree.add(jdbcPostProcessor);
|
||||
tree.add(jdbcDataSource(jdbcPostProcessor.getDataSource()));
|
||||
Arguments arguments = arguments(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Arguments", this.getVariables());
|
||||
if (arguments != null) {
|
||||
tree.add(arguments);
|
||||
}
|
||||
|
||||
tree.add(ElementUtil.jdbcDataSource(jdbcPostProcessor.getDataSource(), this.dataSource));
|
||||
ElementUtil.jdbcArguments(this.getName(), this.getVariables(), tree);
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
el.toHashTree(samplerHashTree, el.getHashTree(), config);
|
||||
|
@ -134,117 +108,11 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void setRefElement() {
|
||||
try {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
MsJDBCPostProcessor proxy = null;
|
||||
if (StringUtils.equals(this.getRefType(), CommonConstants.CASE)) {
|
||||
ApiTestCaseService apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||
ApiTestCaseWithBLOBs bloBs = apiTestCaseService.get(this.getId());
|
||||
if (bloBs != null) {
|
||||
this.setName(bloBs.getName());
|
||||
this.setProjectId(bloBs.getProjectId());
|
||||
JSONObject element = JSONUtil.parseObject(bloBs.getRequest());
|
||||
ElementUtil.dataFormatting(element);
|
||||
proxy = mapper.readValue(element.toString(), new TypeReference<MsJDBCPostProcessor>() {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
|
||||
if (apiDefinition != null) {
|
||||
this.setProjectId(apiDefinition.getProjectId());
|
||||
proxy = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsJDBCPostProcessor>() {
|
||||
});
|
||||
this.setName(apiDefinition.getName());
|
||||
}
|
||||
}
|
||||
if (proxy != null) {
|
||||
this.setHashTree(proxy.getHashTree());
|
||||
this.setDataSource(proxy.getDataSource());
|
||||
this.setDataSourceId(proxy.getDataSourceId());
|
||||
this.setQuery(proxy.getQuery());
|
||||
this.setVariables(proxy.getVariables());
|
||||
this.setVariableNames(proxy.getVariableNames());
|
||||
this.setResultVariable(proxy.getResultVariable());
|
||||
this.setQueryTimeout(proxy.getQueryTimeout());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void initDataSource() {
|
||||
BaseEnvironmentService apiTestEnvironmentService = CommonBeanFactory.getBean(BaseEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = apiTestEnvironmentService.get(environmentId);
|
||||
if (environment != null && environment.getConfig() != null) {
|
||||
EnvironmentConfig envConfig = JSONUtil.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
if (CollectionUtils.isNotEmpty(envConfig.getDatabaseConfigs())) {
|
||||
envConfig.getDatabaseConfigs().forEach(item -> {
|
||||
if (item.getId().equals(this.dataSourceId)) {
|
||||
this.dataSource = item;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Arguments arguments(String name, List<KeyValue> variables) {
|
||||
if (CollectionUtils.isNotEmpty(variables)) {
|
||||
Arguments arguments = new Arguments();
|
||||
arguments.setEnabled(true);
|
||||
arguments.setName(name + "JDBC_Argument");
|
||||
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
|
||||
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
|
||||
variables.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
arguments.addArgument(keyValue.getName(), ElementUtil.getEvlValue(keyValue.getValue()), "=")
|
||||
);
|
||||
return arguments;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JDBCPostProcessor jdbcPostProcessor(ParameterConfig config) {
|
||||
JDBCPostProcessor jdbcPostProcessor = new JDBCPostProcessor();
|
||||
jdbcPostProcessor.setEnabled(this.isEnable());
|
||||
jdbcPostProcessor.setName(this.getName() == null ? ElementConstants.JDBC_POST : this.getName());
|
||||
jdbcPostProcessor.setProperty(TestElement.TEST_CLASS, JDBCPostProcessor.class.getName());
|
||||
jdbcPostProcessor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
|
||||
ElementUtil.setBaseParams(jdbcPostProcessor, this.getParent(), config, this.getId(), this.getIndex());
|
||||
// request.getDataSource() 是ID,需要转换为Name
|
||||
jdbcPostProcessor.setDataSource(ElementUtil.getDataSourceName(this.dataSource.getName()));
|
||||
jdbcPostProcessor.setProperty("dataSource", jdbcPostProcessor.getDataSource());
|
||||
jdbcPostProcessor.setProperty("query", this.getQuery());
|
||||
jdbcPostProcessor.setProperty("queryTimeout", String.valueOf(this.getQueryTimeout()));
|
||||
jdbcPostProcessor.setProperty("resultVariable", this.getResultVariable());
|
||||
jdbcPostProcessor.setProperty("variableNames", this.getVariableNames());
|
||||
jdbcPostProcessor.setProperty("resultSetHandler", "Store as String");
|
||||
jdbcPostProcessor.setProperty("queryType", "Callable Statement");
|
||||
JDBCProcessorVO vo = new JDBCProcessorVO();
|
||||
BeanUtils.copyBean(vo, this);
|
||||
ElementUtil.jdbcProcessor(jdbcPostProcessor, config, vo);
|
||||
return jdbcPostProcessor;
|
||||
}
|
||||
|
||||
private DataSourceElement jdbcDataSource(String sourceName) {
|
||||
DataSourceElement dataSourceElement = new DataSourceElement();
|
||||
dataSourceElement.setEnabled(true);
|
||||
dataSourceElement.setName(this.getName() + " JDBCDataSource");
|
||||
dataSourceElement.setProperty(TestElement.TEST_CLASS, DataSourceElement.class.getName());
|
||||
dataSourceElement.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
dataSourceElement.setProperty("autocommit", true);
|
||||
dataSourceElement.setProperty("keepAlive", true);
|
||||
dataSourceElement.setProperty("preinit", false);
|
||||
dataSourceElement.setProperty("dataSource", sourceName);
|
||||
dataSourceElement.setProperty("dbUrl", dataSource.getDbUrl());
|
||||
dataSourceElement.setProperty("driver", dataSource.getDriver());
|
||||
dataSourceElement.setProperty("username", dataSource.getUsername());
|
||||
dataSourceElement.setProperty("password", dataSource.getPassword());
|
||||
dataSourceElement.setProperty("poolMax", dataSource.getPoolMax());
|
||||
dataSourceElement.setProperty("timeout", String.valueOf(dataSource.getTimeout()));
|
||||
dataSourceElement.setProperty("connectionAge", 5000);
|
||||
dataSourceElement.setProperty("trimInterval", 6000);
|
||||
dataSourceElement.setProperty("transactionIsolation", "DEFAULT");
|
||||
return dataSourceElement;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
package io.metersphere.api.dto.definition.request.processors.post;
|
||||
|
||||
import io.metersphere.api.dto.RunningParamKeys;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.shell.filter.ScriptFilter;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.vo.ScriptProcessorVO;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.utils.JMeterVars;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.extractor.BeanShellPostProcessor;
|
||||
import org.apache.jmeter.extractor.JSR223PostProcessor;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -26,31 +28,14 @@ public class MsJSR223PostProcessor extends MsTestElement {
|
|||
private String clazzName = MsJSR223PostProcessor.class.getCanonicalName();
|
||||
private String script;
|
||||
private String scriptLanguage;
|
||||
private Boolean jsrEnable;
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, MsParameter msParameter) {
|
||||
ScriptFilter.verify(this.getScriptLanguage(), this.getName(), script);
|
||||
ParameterConfig config = (ParameterConfig) msParameter;
|
||||
if (StringUtils.isEmpty(this.getEnvironmentId())) {
|
||||
if (config.getConfig() != null) {
|
||||
if (config.getProjectId() != null && config.getConfig().containsKey(config.getProjectId())) {
|
||||
String evnId = config.getConfig().get(config.getProjectId()).getEnvironmentId();
|
||||
this.setEnvironmentId(evnId);
|
||||
} else {
|
||||
Collection<EnvironmentConfig> evnConfigList = config.getConfig().values();
|
||||
if (evnConfigList != null && !evnConfigList.isEmpty()) {
|
||||
for (EnvironmentConfig configItem : evnConfigList) {
|
||||
String evnId = configItem.getEnvironmentId();
|
||||
this.setEnvironmentId(evnId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
script = StringUtils.replace(script, RunningParamKeys.API_ENVIRONMENT_ID, "\"" + RunningParamKeys.RUNNING_PARAMS_PREFIX + this.getEnvironmentId() + ".\"");
|
||||
ScriptFilter.verify(this.getScriptLanguage(), this.getName(), script);
|
||||
if (config.isOperating()) {
|
||||
if (StringUtils.isNotEmpty(script) && script.startsWith("io.metersphere.utils.JMeterVars.addVars")) {
|
||||
if (StringUtils.isNotEmpty(script) && script.startsWith(JMeterVars.class.getCanonicalName())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -58,26 +43,17 @@ public class MsJSR223PostProcessor extends MsTestElement {
|
|||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
JSR223PostProcessor processor = new JSR223PostProcessor();
|
||||
processor.setEnabled(this.isEnable());
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
processor.setName(this.getName());
|
||||
} else {
|
||||
processor.setName(ElementConstants.JSR223_POST);
|
||||
this.setEnvironmentId(ElementUtil.getScriptEnv(this.getEnvironmentId(), config));
|
||||
|
||||
TestElement processor = new BeanShellPostProcessor();
|
||||
if (jsrEnable == null || BooleanUtils.isTrue(jsrEnable)) {
|
||||
processor = new JSR223PostProcessor();
|
||||
}
|
||||
processor.setProperty(TestElement.TEST_CLASS, JSR223PostProcessor.class.getName());
|
||||
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
processor.setProperty("scriptLanguage", this.getScriptLanguage());
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) {
|
||||
processor.setProperty("scriptLanguage", "nashorn");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) {
|
||||
processor.setProperty("scriptLanguage", "rhino");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("javascript")) {
|
||||
processor.setProperty("scriptLanguage", "rhino");
|
||||
}
|
||||
processor.setProperty("script", this.getScript());
|
||||
ScriptProcessorVO vo = new ScriptProcessorVO();
|
||||
BeanUtils.copyBean(vo, this);
|
||||
vo.setEnabled(this.isEnable());
|
||||
ElementUtil.initScript(processor, vo);
|
||||
|
||||
final HashTree jsr223PostTree = tree.add(processor);
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
|
|
|
@ -1,41 +1,24 @@
|
|||
package io.metersphere.api.dto.definition.request.processors.pre;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.commons.constants.CommonConstants;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.constants.MsTestElementConstants;
|
||||
import io.metersphere.commons.constants.RequestTypeConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.JSONUtil;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.environment.service.BaseEnvironmentService;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.vo.JDBCProcessorVO;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.service.definition.ApiDefinitionService;
|
||||
import io.metersphere.service.definition.ApiTestCaseService;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.config.Arguments;
|
||||
import org.apache.jmeter.protocol.jdbc.config.DataSourceElement;
|
||||
import org.apache.jmeter.protocol.jdbc.processor.JDBCPreProcessor;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -70,17 +53,12 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (this.getReferenced() != null && MsTestElementConstants.REF.name().equals(this.getReferenced())) {
|
||||
this.setRefElement();
|
||||
}
|
||||
if (config.getConfig() == null) {
|
||||
// 单独接口执行
|
||||
this.setProjectId(config.getProjectId());
|
||||
config.setConfig(ElementUtil.getEnvironmentConfig(StringUtils.isNotEmpty(useEnvironment) ? useEnvironment : environmentId, this.getProjectId()));
|
||||
}
|
||||
|
||||
//如果当前数据源为null,则获取已选环境的数据源
|
||||
if (this.dataSource == null) {
|
||||
// 自选了数据源
|
||||
if (config.isEffective(this.getProjectId()) && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())
|
||||
&& isDataSource(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())) {
|
||||
|
@ -88,7 +66,7 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
if (environmentConfig.getDatabaseConfigs() != null && StringUtils.isNotEmpty(environmentConfig.getEnvironmentId())) {
|
||||
this.environmentId = environmentConfig.getEnvironmentId();
|
||||
}
|
||||
this.initDataSource();
|
||||
this.dataSource = ElementUtil.initDataSource(this.environmentId, this.dataSourceId);
|
||||
} else {
|
||||
// 取当前环境下默认的一个数据源
|
||||
if (config.isEffective(this.getProjectId()) && CollectionUtils.isNotEmpty(config.getConfig().get(this.getProjectId()).getDatabaseConfigs())) {
|
||||
|
@ -100,25 +78,23 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.dataSource == null) {
|
||||
// 用自身的数据
|
||||
if (StringUtils.isNotEmpty(dataSourceId)) {
|
||||
this.dataSource = null;
|
||||
this.initDataSource();
|
||||
this.dataSource = ElementUtil.initDataSource(this.environmentId, this.dataSourceId);
|
||||
}
|
||||
if (this.dataSource == null) {
|
||||
String message = "数据源为空请选择数据源";
|
||||
MSException.throwException(StringUtils.isNotEmpty(this.getName()) ? this.getName() + ":" + message : message);
|
||||
}
|
||||
}
|
||||
|
||||
JDBCPreProcessor jdbcPreProcessor = jdbcPreProcessor(config);
|
||||
final HashTree samplerHashTree = tree.add(jdbcPreProcessor);
|
||||
tree.add(jdbcDataSource(jdbcPreProcessor.getDataSource()));
|
||||
Arguments arguments = arguments(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Arguments", this.getVariables());
|
||||
if (arguments != null) {
|
||||
tree.add(arguments);
|
||||
}
|
||||
// 数据源
|
||||
tree.add(ElementUtil.jdbcDataSource(jdbcPreProcessor.getDataSource(), this.dataSource));
|
||||
// 参数
|
||||
ElementUtil.jdbcArguments(this.getName(), this.getVariables(), tree);
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
el.toHashTree(samplerHashTree, el.getHashTree(), config);
|
||||
|
@ -134,117 +110,11 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void setRefElement() {
|
||||
try {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
MsJDBCPreProcessor proxy = null;
|
||||
if (StringUtils.equals(this.getRefType(), CommonConstants.CASE)) {
|
||||
ApiTestCaseService apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||
ApiTestCaseWithBLOBs bloBs = apiTestCaseService.get(this.getId());
|
||||
if (bloBs != null) {
|
||||
this.setName(bloBs.getName());
|
||||
this.setProjectId(bloBs.getProjectId());
|
||||
JSONObject element = JSONUtil.parseObject(bloBs.getRequest());
|
||||
ElementUtil.dataFormatting(element);
|
||||
proxy = mapper.readValue(element.toString(), new TypeReference<MsJDBCPreProcessor>() {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
|
||||
if (apiDefinition != null) {
|
||||
this.setProjectId(apiDefinition.getProjectId());
|
||||
proxy = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsJDBCPreProcessor>() {
|
||||
});
|
||||
this.setName(apiDefinition.getName());
|
||||
}
|
||||
}
|
||||
if (proxy != null) {
|
||||
this.setHashTree(proxy.getHashTree());
|
||||
this.setDataSource(proxy.getDataSource());
|
||||
this.setDataSourceId(proxy.getDataSourceId());
|
||||
this.setQuery(proxy.getQuery());
|
||||
this.setVariables(proxy.getVariables());
|
||||
this.setVariableNames(proxy.getVariableNames());
|
||||
this.setResultVariable(proxy.getResultVariable());
|
||||
this.setQueryTimeout(proxy.getQueryTimeout());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void initDataSource() {
|
||||
BaseEnvironmentService apiTestEnvironmentService = CommonBeanFactory.getBean(BaseEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = apiTestEnvironmentService.get(environmentId);
|
||||
if (environment != null && environment.getConfig() != null) {
|
||||
EnvironmentConfig envConfig = JSONUtil.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
if (CollectionUtils.isNotEmpty(envConfig.getDatabaseConfigs())) {
|
||||
envConfig.getDatabaseConfigs().forEach(item -> {
|
||||
if (item.getId().equals(this.dataSourceId)) {
|
||||
this.dataSource = item;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Arguments arguments(String name, List<KeyValue> variables) {
|
||||
if (CollectionUtils.isNotEmpty(variables)) {
|
||||
Arguments arguments = new Arguments();
|
||||
arguments.setEnabled(true);
|
||||
arguments.setName(name + "JDBC_Argument");
|
||||
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
|
||||
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
|
||||
variables.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
arguments.addArgument(keyValue.getName(), ElementUtil.getEvlValue(keyValue.getValue()), "=")
|
||||
);
|
||||
return arguments;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JDBCPreProcessor jdbcPreProcessor(ParameterConfig config) {
|
||||
JDBCPreProcessor jdbcPreProcessor = new JDBCPreProcessor();
|
||||
jdbcPreProcessor.setEnabled(this.isEnable());
|
||||
jdbcPreProcessor.setName(this.getName() == null ? ElementConstants.JDBC_PRE : this.getName());
|
||||
jdbcPreProcessor.setProperty(TestElement.TEST_CLASS, JDBCPreProcessor.class.getName());
|
||||
jdbcPreProcessor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
|
||||
ElementUtil.setBaseParams(jdbcPreProcessor, this.getParent(), config, this.getId(), this.getIndex());
|
||||
jdbcPreProcessor.setDataSource(ElementUtil.getDataSourceName(this.dataSource.getName()));
|
||||
jdbcPreProcessor.setProperty("dataSource", jdbcPreProcessor.getDataSource());
|
||||
jdbcPreProcessor.setProperty("query", this.getQuery());
|
||||
jdbcPreProcessor.setProperty("queryTimeout", String.valueOf(this.getQueryTimeout()));
|
||||
jdbcPreProcessor.setProperty("resultVariable", this.getResultVariable());
|
||||
jdbcPreProcessor.setProperty("variableNames", this.getVariableNames());
|
||||
jdbcPreProcessor.setProperty("resultSetHandler", "Store as String");
|
||||
jdbcPreProcessor.setProperty("queryType", "Callable Statement");
|
||||
JDBCProcessorVO vo = new JDBCProcessorVO();
|
||||
BeanUtils.copyBean(vo, this);
|
||||
ElementUtil.jdbcProcessor(jdbcPreProcessor, config, vo);
|
||||
return jdbcPreProcessor;
|
||||
}
|
||||
|
||||
private DataSourceElement jdbcDataSource(String sourceName) {
|
||||
DataSourceElement dataSourceElement = new DataSourceElement();
|
||||
dataSourceElement.setEnabled(true);
|
||||
dataSourceElement.setName(this.getName() + " JDBCDataSource");
|
||||
dataSourceElement.setProperty(TestElement.TEST_CLASS, DataSourceElement.class.getName());
|
||||
dataSourceElement.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
dataSourceElement.setProperty("autocommit", true);
|
||||
dataSourceElement.setProperty("keepAlive", true);
|
||||
dataSourceElement.setProperty("preinit", false);
|
||||
dataSourceElement.setProperty("dataSource", sourceName);
|
||||
dataSourceElement.setProperty("dbUrl", dataSource.getDbUrl());
|
||||
dataSourceElement.setProperty("driver", dataSource.getDriver());
|
||||
dataSourceElement.setProperty("username", dataSource.getUsername());
|
||||
dataSourceElement.setProperty("password", dataSource.getPassword());
|
||||
dataSourceElement.setProperty("poolMax", dataSource.getPoolMax());
|
||||
dataSourceElement.setProperty("timeout", String.valueOf(dataSource.getTimeout()));
|
||||
dataSourceElement.setProperty("connectionAge", 5000);
|
||||
dataSourceElement.setProperty("trimInterval", 6000);
|
||||
dataSourceElement.setProperty("transactionIsolation", "DEFAULT");
|
||||
return dataSourceElement;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
package io.metersphere.api.dto.definition.request.processors.pre;
|
||||
|
||||
import io.metersphere.api.dto.RunningParamKeys;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.shell.filter.ScriptFilter;
|
||||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.vo.ScriptProcessorVO;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import io.metersphere.utils.JMeterVars;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.modifiers.BeanShellPreProcessor;
|
||||
import org.apache.jmeter.modifiers.JSR223PreProcessor;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -27,6 +28,7 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
private String clazzName = MsJSR223PreProcessor.class.getCanonicalName();
|
||||
private String script;
|
||||
private String scriptLanguage;
|
||||
private Boolean jsrEnable;
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, MsParameter msParameter) {
|
||||
|
@ -35,34 +37,15 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
if (!config.isOperating() && !this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
ScriptFilter.verify(this.getScriptLanguage(), this.getName(), script);
|
||||
if (StringUtils.isEmpty(this.getEnvironmentId())) {
|
||||
if (config.getConfig() != null) {
|
||||
if (config.getProjectId() != null) {
|
||||
String evnId = config.getConfig().get(config.getProjectId()).getEnvironmentId();
|
||||
this.setEnvironmentId(evnId);
|
||||
} else {
|
||||
Collection<EnvironmentConfig> evnConfigList = config.getConfig().values();
|
||||
if (evnConfigList != null && !evnConfigList.isEmpty()) {
|
||||
for (EnvironmentConfig configItem : evnConfigList) {
|
||||
String evnId = configItem.getEnvironmentId();
|
||||
this.setEnvironmentId(evnId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//替换环境变量
|
||||
if (StringUtils.isNotEmpty(script)) {
|
||||
script = StringUtils.replace(script, RunningParamKeys.API_ENVIRONMENT_ID, "\"" + RunningParamKeys.RUNNING_PARAMS_PREFIX + this.getEnvironmentId() + ".\"");
|
||||
}
|
||||
if (config.isOperating()) {
|
||||
if (StringUtils.isNotEmpty(script) && script.startsWith(JMeterVars.class.getCanonicalName())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
final HashTree jsr223PreTree = tree.add(getJSR223PreProcessor());
|
||||
ScriptFilter.verify(this.getScriptLanguage(), this.getName(), script);
|
||||
this.setEnvironmentId(ElementUtil.getScriptEnv(this.getEnvironmentId(), config));
|
||||
|
||||
final HashTree jsr223PreTree = tree.add(getShellProcessor());
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
el.toHashTree(jsr223PreTree, el.getHashTree(), config);
|
||||
|
@ -70,28 +53,15 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
}
|
||||
}
|
||||
|
||||
public JSR223PreProcessor getJSR223PreProcessor() {
|
||||
JSR223PreProcessor processor = new JSR223PreProcessor();
|
||||
processor.setEnabled(this.isEnable());
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
processor.setName(this.getName());
|
||||
} else {
|
||||
processor.setName(ElementConstants.JSR223_PRE);
|
||||
public TestElement getShellProcessor() {
|
||||
TestElement processor = new BeanShellPreProcessor();
|
||||
if (jsrEnable == null || BooleanUtils.isTrue(jsrEnable)) {
|
||||
processor = new JSR223PreProcessor();
|
||||
}
|
||||
processor.setProperty(TestElement.TEST_CLASS, JSR223PreProcessor.class.getName());
|
||||
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
/*processor.setProperty("cacheKey", "true");*/
|
||||
processor.setProperty("scriptLanguage", this.getScriptLanguage());
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) {
|
||||
processor.setProperty("scriptLanguage", "nashorn");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("rhinoScript")) {
|
||||
processor.setProperty("scriptLanguage", "rhino");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("javascript")) {
|
||||
processor.setProperty("scriptLanguage", "rhino");
|
||||
}
|
||||
processor.setProperty("script", this.getScript());
|
||||
ScriptProcessorVO vo = new ScriptProcessorVO();
|
||||
BeanUtils.copyBean(vo, this);
|
||||
vo.setEnabled(this.isEnable());
|
||||
ElementUtil.initScript(processor, vo);
|
||||
return processor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@ package io.metersphere.api.dto.definition.request.sampler;
|
|||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.github.ningyu.jmeter.plugin.dubbo.sample.DubboSample;
|
||||
import io.github.ningyu.jmeter.plugin.dubbo.sample.MethodArgument;
|
||||
import io.github.ningyu.jmeter.plugin.util.Constants;
|
||||
|
@ -113,9 +110,6 @@ public class MsDubboSampler extends MsTestElement {
|
|||
|
||||
private boolean setRefElement() {
|
||||
try {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
MsDubboSampler proxy = null;
|
||||
if (StringUtils.equals(this.getRefType(), CommonConstants.CASE)) {
|
||||
ApiTestCaseService apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||
|
@ -124,16 +118,15 @@ public class MsDubboSampler extends MsTestElement {
|
|||
this.setProjectId(bloBs.getProjectId());
|
||||
JSONObject element = JSONUtil.parseObject(bloBs.getRequest());
|
||||
ElementUtil.dataFormatting(element);
|
||||
proxy = mapper.readValue(element.toString(), new TypeReference<MsDubboSampler>() {
|
||||
});
|
||||
proxy = JSONUtil.parseObject(element.toString(), MsDubboSampler.class);
|
||||
this.setName(bloBs.getName());
|
||||
}
|
||||
} else {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
|
||||
if (apiDefinition != null) {
|
||||
this.setProjectId(apiDefinition.getProjectId());
|
||||
proxy = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsDubboSampler>() {
|
||||
});
|
||||
proxy = JSONUtil.parseObject(apiDefinition.getRequest(), MsDubboSampler.class);
|
||||
this.setName(apiDefinition.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package io.metersphere.api.dto.definition.request.sampler;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.definition.request.assertions.MsAssertions;
|
||||
|
@ -85,6 +82,8 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
private String alias;
|
||||
private boolean customizeReq;
|
||||
private final static String DEF_TIME_OUT = "60000";
|
||||
//客户端实现
|
||||
private String implementation;
|
||||
|
||||
@Override
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, MsParameter msParameter) {
|
||||
|
@ -125,6 +124,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
sampler.setContentEncoding(StandardCharsets.UTF_8.name());
|
||||
sampler.setFollowRedirects(this.isFollowRedirects());
|
||||
sampler.setAutoRedirects(this.isAutoRedirects());
|
||||
sampler.setImplementation(this.getImplementation());
|
||||
sampler.setUseKeepAlive(true);
|
||||
sampler.setDoMultipart(this.isDoMultipartPost());
|
||||
if (config.getConfig() == null) {
|
||||
|
@ -247,8 +247,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
|
||||
private boolean setRefElement() {
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
MsHTTPSamplerProxy proxy = null;
|
||||
if (StringUtils.equals(this.getRefType(), CommonConstants.CASE)) {
|
||||
ApiTestCaseWithBLOBs bloBs = CommonBeanFactory.getBean(ApiTestCaseService.class).get(this.getId());
|
||||
|
@ -256,8 +254,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
this.setProjectId(bloBs.getProjectId());
|
||||
JSONObject element = JSONUtil.parseObject(bloBs.getRequest());
|
||||
ElementUtil.dataFormatting(element);
|
||||
proxy = mapper.readValue(element.toString(), new TypeReference<MsHTTPSamplerProxy>() {
|
||||
});
|
||||
proxy = JSONUtil.parseObject(element.toString(), MsHTTPSamplerProxy.class);
|
||||
this.setName(bloBs.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package io.metersphere.api.dto.definition.request.sampler;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||
|
@ -17,10 +14,8 @@ import io.metersphere.commons.constants.CommonConstants;
|
|||
import io.metersphere.commons.constants.ElementConstants;
|
||||
import io.metersphere.commons.constants.MsTestElementConstants;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.HashTreeUtil;
|
||||
import io.metersphere.commons.utils.JSONUtil;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.commons.vo.JDBCProcessorVO;
|
||||
import io.metersphere.environment.service.BaseEnvironmentService;
|
||||
import io.metersphere.plugin.core.MsParameter;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
|
@ -32,10 +27,7 @@ import lombok.EqualsAndHashCode;
|
|||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.config.Arguments;
|
||||
import org.apache.jmeter.protocol.jdbc.config.DataSourceElement;
|
||||
import org.apache.jmeter.protocol.jdbc.sampler.JDBCSampler;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
@ -123,11 +115,9 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
}
|
||||
JDBCSampler jdbcSampler = jdbcSampler(config);
|
||||
final HashTree samplerHashTree = tree.add(jdbcSampler);
|
||||
tree.add(jdbcDataSource(jdbcSampler.getDataSource()));
|
||||
Arguments arguments = arguments(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Arguments", this.getVariables());
|
||||
if (arguments != null) {
|
||||
tree.add(arguments);
|
||||
}
|
||||
tree.add(ElementUtil.jdbcDataSource(jdbcSampler.getDataSource(), this.dataSource));
|
||||
ElementUtil.jdbcArguments(this.getName(), this.getVariables(), tree);
|
||||
|
||||
// 环境通用请求头
|
||||
Arguments envArguments = ElementUtil.getConfigArguments(config, this.getName(), this.getProjectId(), null);
|
||||
if (envArguments != null) {
|
||||
|
@ -162,22 +152,8 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
return false;
|
||||
}
|
||||
|
||||
private String getParentProjectId() {
|
||||
MsTestElement parent = this.getParent();
|
||||
while (parent != null) {
|
||||
if (StringUtils.isNotBlank(parent.getProjectId())) {
|
||||
return parent.getProjectId();
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private boolean setRefElement() {
|
||||
try {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
MsJDBCSampler proxy = null;
|
||||
if (StringUtils.equals(this.getRefType(), CommonConstants.CASE)) {
|
||||
ApiTestCaseService apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||
|
@ -187,15 +163,14 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
this.setProjectId(bloBs.getProjectId());
|
||||
JSONObject element = JSONUtil.parseObject(bloBs.getRequest());
|
||||
ElementUtil.dataFormatting(element);
|
||||
proxy = mapper.readValue(element.toString(), new TypeReference<MsJDBCSampler>() {
|
||||
});
|
||||
proxy = JSONUtil.parseObject(element.toString(), MsJDBCSampler.class);
|
||||
}
|
||||
} else {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
|
||||
if (apiDefinition != null) {
|
||||
this.setProjectId(apiDefinition.getProjectId());
|
||||
proxy = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsJDBCSampler>() {
|
||||
});
|
||||
proxy = JSONUtil.parseObject(apiDefinition.getRequest(), MsJDBCSampler.class);
|
||||
this.setName(apiDefinition.getName());
|
||||
}
|
||||
}
|
||||
|
@ -230,7 +205,6 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
envConfig.getDatabaseConfigs().forEach(item -> {
|
||||
if (item.getId().equals(this.dataSourceId)) {
|
||||
this.dataSource = item;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -238,23 +212,12 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
return envConfig;
|
||||
}
|
||||
|
||||
private Arguments arguments(String name, List<KeyValue> variables) {
|
||||
if (CollectionUtils.isNotEmpty(variables)) {
|
||||
Arguments arguments = new Arguments();
|
||||
arguments.setEnabled(true);
|
||||
arguments.setName(name + "JDBC_Argument");
|
||||
arguments.setProperty(TestElement.TEST_CLASS, Arguments.class.getName());
|
||||
arguments.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("ArgumentsPanel"));
|
||||
variables.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
arguments.addArgument(keyValue.getName(), keyValue.getValue(), "=")
|
||||
);
|
||||
return arguments;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private JDBCSampler jdbcSampler(ParameterConfig config) {
|
||||
JDBCSampler sampler = new JDBCSampler();
|
||||
JDBCProcessorVO vo = new JDBCProcessorVO();
|
||||
BeanUtils.copyBean(vo, this);
|
||||
ElementUtil.jdbcProcessor(sampler, config, vo);
|
||||
sampler.setEnabled(this.isEnable());
|
||||
sampler.setName(this.getName());
|
||||
if (config.isOperating()) {
|
||||
|
@ -264,39 +227,6 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
sampler.setName(testName);
|
||||
}
|
||||
}
|
||||
sampler.setProperty(TestElement.TEST_CLASS, JDBCSampler.class.getName());
|
||||
sampler.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
ElementUtil.setBaseParams(sampler, this.getParent(), config, this.getId(), this.getIndex());
|
||||
sampler.setDataSource(ElementUtil.getDataSourceName(this.dataSource.getName()));
|
||||
sampler.setProperty("dataSource", sampler.getDataSource());
|
||||
sampler.setProperty("query", this.getQuery());
|
||||
sampler.setProperty("queryTimeout", String.valueOf(this.getQueryTimeout()));
|
||||
sampler.setProperty("resultVariable", this.getResultVariable());
|
||||
sampler.setProperty("variableNames", this.getVariableNames());
|
||||
sampler.setProperty("resultSetHandler", "Store as String");
|
||||
sampler.setProperty("queryType", "Callable Statement");
|
||||
return sampler;
|
||||
}
|
||||
|
||||
private DataSourceElement jdbcDataSource(String dataSourceName) {
|
||||
DataSourceElement dataSourceElement = new DataSourceElement();
|
||||
dataSourceElement.setEnabled(true);
|
||||
dataSourceElement.setName(this.getName() + " JDBCDataSource");
|
||||
dataSourceElement.setProperty(TestElement.TEST_CLASS, DataSourceElement.class.getName());
|
||||
dataSourceElement.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
dataSourceElement.setProperty("autocommit", true);
|
||||
dataSourceElement.setProperty("keepAlive", true);
|
||||
dataSourceElement.setProperty("preinit", false);
|
||||
dataSourceElement.setProperty("dataSource", dataSourceName);
|
||||
dataSourceElement.setProperty("dbUrl", dataSource.getDbUrl());
|
||||
dataSourceElement.setProperty("driver", dataSource.getDriver());
|
||||
dataSourceElement.setProperty("username", dataSource.getUsername());
|
||||
dataSourceElement.setProperty("password", dataSource.getPassword());
|
||||
dataSourceElement.setProperty("poolMax", dataSource.getPoolMax());
|
||||
dataSourceElement.setProperty("timeout", String.valueOf(dataSource.getTimeout()));
|
||||
dataSourceElement.setProperty("connectionAge", 5000);
|
||||
dataSourceElement.setProperty("trimInterval", 6000);
|
||||
dataSourceElement.setProperty("transactionIsolation", "DEFAULT");
|
||||
return dataSourceElement;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package io.metersphere.api.dto.definition.request.sampler;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.automation.EsbDataStruct;
|
||||
import io.metersphere.api.dto.automation.TcpTreeTableDataStruct;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
|
@ -151,7 +148,7 @@ public class MsTCPSampler extends MsTestElement {
|
|||
tree.set(tcpSampler(config), samplerHashTree);
|
||||
setUserParameters(samplerHashTree);
|
||||
if (tcpPreProcessor != null && StringUtils.isNotBlank(tcpPreProcessor.getScript())) {
|
||||
samplerHashTree.add(tcpPreProcessor.getJSR223PreProcessor());
|
||||
samplerHashTree.add(tcpPreProcessor.getShellProcessor());
|
||||
}
|
||||
//增加误报、全局断言
|
||||
HashTreeUtil.addPositive(envConfig, samplerHashTree, config, this.getProjectId());
|
||||
|
@ -180,9 +177,6 @@ public class MsTCPSampler extends MsTestElement {
|
|||
|
||||
private boolean setRefElement() {
|
||||
try {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
MsTCPSampler proxy = null;
|
||||
if (StringUtils.equals(this.getRefType(), CommonConstants.CASE)) {
|
||||
ApiTestCaseService apiTestCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||
|
@ -192,16 +186,15 @@ public class MsTCPSampler extends MsTestElement {
|
|||
this.setProjectId(bloBs.getProjectId());
|
||||
JSONObject element = JSONUtil.parseObject(bloBs.getRequest());
|
||||
ElementUtil.dataFormatting(element);
|
||||
proxy = mapper.readValue(element.toString(), new TypeReference<MsTCPSampler>() {
|
||||
});
|
||||
proxy = JSONUtil.parseObject(element.toString(), MsTCPSampler.class);
|
||||
}
|
||||
} else {
|
||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||
ApiDefinitionWithBLOBs apiDefinition = apiDefinitionService.getBLOBs(this.getId());
|
||||
if (apiDefinition != null) {
|
||||
this.setName(apiDefinition.getName());
|
||||
this.setProjectId(apiDefinition.getProjectId());
|
||||
proxy = mapper.readValue(apiDefinition.getRequest(), new TypeReference<MsTCPSampler>() {
|
||||
});
|
||||
proxy = JSONUtil.parseObject(apiDefinition.getRequest(), MsTCPSampler.class);
|
||||
}
|
||||
}
|
||||
if (proxy != null) {
|
||||
|
|
|
@ -55,4 +55,6 @@ public class BaseEnvElement {
|
|||
|
||||
// 步骤别名
|
||||
private String stepName;
|
||||
|
||||
private Boolean jsrEnable;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package io.metersphere.api.exec.api;
|
|||
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.definition.RunCaseRequest;
|
||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.request.ElementUtil;
|
||||
|
@ -68,8 +67,6 @@ public class ApiExecuteService {
|
|||
@Resource
|
||||
private ExtApiTestCaseMapper extApiTestCaseMapper;
|
||||
@Resource
|
||||
private ObjectMapper mapper;
|
||||
@Resource
|
||||
private TestPlanApiCaseMapper testPlanApiCaseMapper;
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
|
@ -276,8 +273,7 @@ public class ApiExecuteService {
|
|||
JSONObject elementObj = JSONUtil.parseObject(testCaseWithBLOBs.getRequest());
|
||||
ElementUtil.dataFormatting(elementObj);
|
||||
|
||||
MsTestElement element = mapper.readValue(elementObj.toString(), new TypeReference<MsTestElement>() {
|
||||
});
|
||||
MsTestElement element = JSON.parseObject(elementObj.toString(), new TypeReference<MsTestElement>() {});
|
||||
element.setProjectId(testCaseWithBLOBs.getProjectId());
|
||||
if (StringUtils.isBlank(request.getEnvironmentId())) {
|
||||
TestPlanApiCaseExample example = new TestPlanApiCaseExample();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package io.metersphere.api.jmeter;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.exec.queue.PoolExecBlockingQueueUtil;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ExtendedParameter;
|
||||
import io.metersphere.commons.utils.JSON;
|
||||
import io.metersphere.dto.ResultDTO;
|
||||
import io.metersphere.service.ApiExecutionQueueService;
|
||||
import io.metersphere.service.TestResultService;
|
||||
|
@ -22,8 +22,6 @@ public class KafkaListenerTask implements Runnable {
|
|||
private ConsumerRecord<?, String> record;
|
||||
private ApiExecutionQueueService apiExecutionQueueService;
|
||||
private TestResultService testResultService;
|
||||
private ObjectMapper mapper;
|
||||
|
||||
private static final Map<String, String> RUN_MODE_MAP = new HashMap<String, String>() {{
|
||||
this.put(ApiRunMode.SCHEDULE_API_PLAN.name(), "schedule-task");
|
||||
this.put(ApiRunMode.JENKINS_API_PLAN.name(), "schedule-task");
|
||||
|
@ -99,9 +97,8 @@ public class KafkaListenerTask implements Runnable {
|
|||
|
||||
private ResultDTO formatResult() {
|
||||
try {
|
||||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||
if (StringUtils.isNotEmpty(record.value())) {
|
||||
return mapper.readValue(record.value(), new TypeReference<ResultDTO>() {
|
||||
return JSON.parseObject(record.value(), new TypeReference<ResultDTO>() {
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.metersphere.api.jmeter;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.MsgDTO;
|
||||
import io.metersphere.commons.constants.KafkaTopicConstants;
|
||||
import io.metersphere.commons.utils.JSONUtil;
|
||||
|
@ -30,8 +29,6 @@ public class MsKafkaListener {
|
|||
private ApiExecutionQueueService apiExecutionQueueService;
|
||||
@Resource
|
||||
private TestResultService testResultService;
|
||||
@Resource
|
||||
private ObjectMapper mapper;
|
||||
// 线程池维护线程的最少数量
|
||||
private final static int CORE_POOL_SIZE = 20;
|
||||
// 线程池维护线程的最大数量
|
||||
|
@ -57,7 +54,6 @@ public class MsKafkaListener {
|
|||
KafkaListenerTask task = new KafkaListenerTask();
|
||||
task.setApiExecutionQueueService(apiExecutionQueueService);
|
||||
task.setTestResultService(testResultService);
|
||||
task.setMapper(mapper);
|
||||
task.setRecord(item);
|
||||
threadPool.execute(task);
|
||||
this.outKafkaPoolLogger();
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package io.metersphere.commons.vo;
|
||||
|
||||
import io.metersphere.api.dto.scenario.DatabaseConfig;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.commons.constants.RequestTypeConstants;
|
||||
import io.metersphere.plugin.core.MsTestElement;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class JDBCProcessorVO {
|
||||
private boolean enable;
|
||||
private String name;
|
||||
private String id;
|
||||
private String index;
|
||||
|
||||
private DatabaseConfig dataSource;
|
||||
private String query;
|
||||
private long queryTimeout;
|
||||
private String resultVariable;
|
||||
private String variableNames;
|
||||
private List<KeyValue> variables;
|
||||
private String environmentId;
|
||||
private String dataSourceId;
|
||||
private String protocol = RequestTypeConstants.SQL;
|
||||
private String useEnvironment;
|
||||
private MsTestElement parent;
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package io.metersphere.commons.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ScriptProcessorVO {
|
||||
private String name;
|
||||
private String scriptLanguage;
|
||||
private String script;
|
||||
private Boolean jsrEnable;
|
||||
private boolean enabled;
|
||||
private String environmentId;
|
||||
}
|
|
@ -31,7 +31,6 @@ import io.metersphere.api.parse.scenario.TcpTreeTableDataParser;
|
|||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.*;
|
||||
import io.metersphere.base.mapper.plan.ext.ExtTestPlanApiCaseMapper;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.enums.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
|
@ -158,8 +157,6 @@ public class ApiDefinitionService {
|
|||
@Resource
|
||||
private ExtApiScenarioMapper extApiScenarioMapper;
|
||||
@Resource
|
||||
private ExtTestPlanApiCaseMapper extTestPlanApiCaseMapper;
|
||||
@Resource
|
||||
private ApiCustomFieldService customFieldApiService;
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
|
@ -298,51 +295,6 @@ public class ApiDefinitionService {
|
|||
}
|
||||
}
|
||||
|
||||
public void initDefaultModuleId() {
|
||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
example.createCriteria().andModuleIdIsNull();
|
||||
List<ApiDefinition> updateApiList = apiDefinitionMapper.selectByExample(example);
|
||||
Map<String, Map<String, List<ApiDefinition>>> projectIdMap = new HashMap<>();
|
||||
for (ApiDefinition api : updateApiList) {
|
||||
String projectId = api.getProjectId();
|
||||
String protocol = api.getProtocol();
|
||||
if (projectIdMap.containsKey(projectId)) {
|
||||
if (projectIdMap.get(projectId).containsKey(protocol)) {
|
||||
projectIdMap.get(projectId).get(protocol).add(api);
|
||||
} else {
|
||||
List<ApiDefinition> list = new ArrayList<>();
|
||||
list.add(api);
|
||||
projectIdMap.get(projectId).put(protocol, list);
|
||||
}
|
||||
} else {
|
||||
List<ApiDefinition> list = new ArrayList<>();
|
||||
list.add(api);
|
||||
Map<String, List<ApiDefinition>> map = new HashMap<>();
|
||||
map.put(protocol, list);
|
||||
projectIdMap.put(projectId, map);
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, Map<String, List<ApiDefinition>>> entry : projectIdMap.entrySet()) {
|
||||
String projectId = entry.getKey();
|
||||
Map<String, List<ApiDefinition>> map = entry.getValue();
|
||||
|
||||
for (Map.Entry<String, List<ApiDefinition>> itemEntry : map.entrySet()) {
|
||||
String protocol = itemEntry.getKey();
|
||||
ApiModule node = apiModuleService.getDefaultNodeUnCreateNew(projectId, protocol);
|
||||
if (node != null) {
|
||||
List<ApiDefinition> testCaseList = itemEntry.getValue();
|
||||
for (ApiDefinition apiDefinition : testCaseList) {
|
||||
ApiDefinitionWithBLOBs updateCase = new ApiDefinitionWithBLOBs();
|
||||
updateCase.setId(apiDefinition.getId());
|
||||
updateCase.setModuleId(node.getId());
|
||||
updateCase.setModulePath("/" + node.getName());
|
||||
|
||||
apiDefinitionMapper.updateByPrimaryKeySelective(updateCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<ApiDefinitionResult> listBatch(ApiBatchRequest request) {
|
||||
ServiceUtils.getSelectAllIds(request, request.getCondition(), (query) -> extApiDefinitionMapper.selectIds(query));
|
||||
|
@ -2926,27 +2878,6 @@ public class ApiDefinitionService {
|
|||
return envIdList;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getProjectEnvNameByEnvConfig(String projectId, String envConfig) {
|
||||
Map<String, List<String>> returnMap = new HashMap<>();
|
||||
RunModeConfigDTO runModeConfigDTO = null;
|
||||
try {
|
||||
runModeConfigDTO = JSON.parseObject(envConfig, RunModeConfigDTO.class);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("解析" + envConfig + "为RunModeConfigDTO时失败!", e);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(projectId) && runModeConfigDTO != null && MapUtils.isNotEmpty(runModeConfigDTO.getEnvMap())) {
|
||||
String envId = runModeConfigDTO.getEnvMap().get(projectId);
|
||||
String envName = apiTestEnvironmentService.selectNameById(envId);
|
||||
Project project = baseProjectService.getProjectById(projectId);
|
||||
String projectName = project == null ? null : project.getName();
|
||||
if (StringUtils.isNoneEmpty(envName, projectName)) {
|
||||
returnMap.put(projectName, new ArrayList<>() {{
|
||||
this.add(envName);
|
||||
}});
|
||||
}
|
||||
}
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
public Map<String, List<String>> getProjectEnvNameByEnvConfig(Map<String, List<String>> projectEnvConfigMap) {
|
||||
Map<String, List<String>> returnMap = new HashMap<>();
|
||||
|
|
|
@ -2332,6 +2332,12 @@ export default {
|
|||
}
|
||||
return [];
|
||||
},
|
||||
getAllCheckedNodes() {
|
||||
if (this.$refs.stepTree) {
|
||||
return this.$refs.stepTree.getCheckedNodes();
|
||||
}
|
||||
return [];
|
||||
},
|
||||
checkALevelChecked() {
|
||||
let resourceIds = [];
|
||||
if (this.$refs.stepTree) {
|
||||
|
@ -2404,7 +2410,7 @@ export default {
|
|||
confirmButtonText: this.$t('commons.confirm'),
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
this.getAllResourceIds().forEach((item) => {
|
||||
this.getAllCheckedNodes().forEach((item) => {
|
||||
this.recursionDelete(item, this.scenarioDefinition);
|
||||
});
|
||||
this.sort();
|
||||
|
@ -2417,14 +2423,15 @@ export default {
|
|||
},
|
||||
});
|
||||
},
|
||||
recursionDelete(resourceId, nodes) {
|
||||
recursionDelete(item, nodes) {
|
||||
for (let i in nodes) {
|
||||
if (nodes[i]) {
|
||||
if (resourceId === nodes[i].resourceId) {
|
||||
//复制的case的断言的resourceId是一样的,所以要加上parentIndex做唯一标识
|
||||
if (item.resourceId === nodes[i].resourceId && item.parentIndex === nodes[i].parentIndex) {
|
||||
nodes.splice(i, 1);
|
||||
} else {
|
||||
if (nodes[i].hashTree != undefined && nodes[i].hashTree.length > 0) {
|
||||
this.recursionDelete(resourceId, nodes[i].hashTree);
|
||||
this.recursionDelete(item, nodes[i].hashTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
:commands="languages"
|
||||
style="margin-bottom: 5px; margin-left: 15px"
|
||||
@command="languageChange" />
|
||||
<el-checkbox
|
||||
v-model="jsr223ProcessorData.jsrEnable"
|
||||
style="padding-left: 10px"
|
||||
:disabled="jsr223ProcessorData.scriptLanguage !== 'beanshell'">
|
||||
JSR223
|
||||
</el-checkbox>
|
||||
<script-nav-menu
|
||||
ref="scriptNavMenu"
|
||||
:language="jsr223ProcessorData.scriptLanguage"
|
||||
|
@ -164,6 +170,9 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
if (this.jsr223Processor.jsrEnable === null || this.jsr223Processor.jsrEnable === undefined) {
|
||||
this.$set(this.jsr223Processor, 'jsrEnable', true);
|
||||
}
|
||||
this.jsr223ProcessorData = this.jsr223Processor;
|
||||
},
|
||||
props: {
|
||||
|
@ -206,6 +215,9 @@ export default {
|
|||
},
|
||||
languageChange(language) {
|
||||
this.jsr223ProcessorData.scriptLanguage = language;
|
||||
if (language !== 'beanshell') {
|
||||
this.jsr223ProcessorData.jsrEnable = true;
|
||||
}
|
||||
this.$emit('languageChange');
|
||||
},
|
||||
addCustomFuncScript(script) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<mavon-editor :id="id" :editable="!disabled" @imgAdd="imgAdd" :default-open="defaultOpenValue"
|
||||
<mavon-editor v-loading="loading" :id="id" :editable="!disabled" @imgAdd="imgAdd" :default-open="defaultOpenValue"
|
||||
:xss-options="xssOptions" :style="{'min-height': customMinHeight + 'px', 'min-width': '100px'}"
|
||||
@change="change" :image-click="imageClick"
|
||||
:subfield="false" :toolbars="toolbars" :language="language" :toolbarsFlag="!disabled"
|
||||
|
@ -80,7 +80,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
result: {loading: false},
|
||||
loading: false,
|
||||
id: getUUID(),
|
||||
xssOptions: {
|
||||
whiteList: {
|
||||
|
@ -183,13 +183,13 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
imgAdd(pos, file) {
|
||||
this.result.loading = true;
|
||||
this.loading = true;
|
||||
uploadMarkDownImg(file)
|
||||
.then((r) => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
let url = '/resource/md/get?fileName=' + r.data;
|
||||
this.$refs.md.$img2Url(pos, url);
|
||||
this.result.loading = false;
|
||||
this.loading = false;
|
||||
});
|
||||
this.$emit('imgAdd', file);
|
||||
},
|
||||
|
|
|
@ -2,24 +2,52 @@
|
|||
<div>
|
||||
<el-row type="flex" :gutter="10">
|
||||
<el-col :span="codeSpan" class="script-content">
|
||||
<ms-code-edit v-if="isCodeEditAlive" :mode="codeEditModeMap[jsr223ProcessorData.scriptLanguage]"
|
||||
<ms-code-edit
|
||||
v-if="isCodeEditAlive"
|
||||
:mode="codeEditModeMap[jsr223ProcessorData.scriptLanguage]"
|
||||
:read-only="isReadOnly"
|
||||
:data.sync="jsr223ProcessorData.script" theme="eclipse" :modes="['java','python']"
|
||||
ref="codeEdit"/>
|
||||
:data.sync="jsr223ProcessorData.script"
|
||||
theme="eclipse"
|
||||
:modes="['java', 'python']"
|
||||
ref="codeEdit"
|
||||
/>
|
||||
</el-col>
|
||||
<div style="width: 14px;margin-right: 5px;">
|
||||
<div style="height: 12px;width: 12px; line-height:12px;">
|
||||
<i :class="showMenu ? 'el-icon-remove-outline' : 'el-icon-circle-plus-outline'"
|
||||
<div style="width: 14px; margin-right: 5px">
|
||||
<div style="height: 12px; width: 12px; line-height: 12px">
|
||||
<i
|
||||
:class="
|
||||
showMenu
|
||||
? 'el-icon-remove-outline'
|
||||
: 'el-icon-circle-plus-outline'
|
||||
"
|
||||
class="show-menu"
|
||||
@click="switchMenu"></i>
|
||||
@click="switchMenu"
|
||||
></i>
|
||||
</div>
|
||||
</div>
|
||||
<el-col :span="menuSpan" class="script-index" v-if="isReadOnly !== true">
|
||||
<ms-dropdown :default-command="jsr223ProcessorData.scriptLanguage" :commands="languages"
|
||||
style="margin-bottom: 5px;margin-left: 15px;"
|
||||
@command="languageChange"/>
|
||||
<script-nav-menu ref="scriptNavMenu" :language="jsr223ProcessorData.scriptLanguage" :menus="codeTemplates"
|
||||
@handleCode="handleCodeTemplate"/>
|
||||
<ms-dropdown
|
||||
:default-command="jsr223ProcessorData.scriptLanguage"
|
||||
:commands="languages"
|
||||
style="margin-bottom: 5px; margin-left: 15px"
|
||||
@command="languageChange"
|
||||
/>
|
||||
<el-checkbox
|
||||
v-model="jsr223ProcessorData.jsrEnable"
|
||||
style="padding-left: 10px"
|
||||
:disabled="
|
||||
jsr223ProcessorData.scriptLanguage &&
|
||||
jsr223ProcessorData.scriptLanguage !== 'beanshell'
|
||||
"
|
||||
>
|
||||
JSR223
|
||||
</el-checkbox>
|
||||
<script-nav-menu
|
||||
ref="scriptNavMenu"
|
||||
:language="jsr223ProcessorData.scriptLanguage"
|
||||
:menus="codeTemplates"
|
||||
@handleCode="handleCodeTemplate"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -38,129 +66,159 @@ export default {
|
|||
jsr223ProcessorData: {},
|
||||
codeTemplates: [
|
||||
{
|
||||
title: this.$t('project.code_segment.api_test'),
|
||||
title: this.$t("project.code_segment.api_test"),
|
||||
children: [
|
||||
{
|
||||
title: this.$t('project.code_segment.import_api_test'),
|
||||
title: this.$t("project.code_segment.import_api_test"),
|
||||
command: "api_definition",
|
||||
},
|
||||
{
|
||||
title: this.$t('project.code_segment.new_api_test'),
|
||||
title: this.$t("project.code_segment.new_api_test"),
|
||||
command: "new_api_request",
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: this.$t('project.code_segment.custom_value'),
|
||||
title: this.$t("project.code_segment.custom_value"),
|
||||
children: [
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_variable'),
|
||||
title: this.$t(
|
||||
"api_test.request.processor.code_template_get_variable"
|
||||
),
|
||||
value: 'vars.get("variable_name")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_set_variable'),
|
||||
title: this.$t(
|
||||
"api_test.request.processor.code_template_set_variable"
|
||||
),
|
||||
value: 'vars.put("variable_name", "variable_value")',
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_header'),
|
||||
value: 'prev.getResponseHeaders()',
|
||||
disabled: this.isPreProcessor
|
||||
title: this.$t(
|
||||
"api_test.request.processor.code_template_get_response_header"
|
||||
),
|
||||
value: "prev.getResponseHeaders()",
|
||||
disabled: this.isPreProcessor,
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_code'),
|
||||
value: 'prev.getResponseCode()',
|
||||
disabled: this.isPreProcessor
|
||||
title: this.$t(
|
||||
"api_test.request.processor.code_template_get_response_code"
|
||||
),
|
||||
value: "prev.getResponseCode()",
|
||||
disabled: this.isPreProcessor,
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_template_get_response_result'),
|
||||
value: 'prev.getResponseDataAsString()',
|
||||
disabled: this.isPreProcessor
|
||||
title: this.$t(
|
||||
"api_test.request.processor.code_template_get_response_result"
|
||||
),
|
||||
value: "prev.getResponseDataAsString()",
|
||||
disabled: this.isPreProcessor,
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
title: this.$t('project.code_segment.project_env'),
|
||||
title: this.$t("project.code_segment.project_env"),
|
||||
children: [
|
||||
{
|
||||
title: this.$t('api_test.request.processor.param_environment_set_global_variable'),
|
||||
value: 'vars.put(${__metersphere_env_id}+"key","value");\n' + 'vars.put("key","value")',
|
||||
title: this.$t(
|
||||
"api_test.request.processor.param_environment_set_global_variable"
|
||||
),
|
||||
value:
|
||||
'vars.put(${__metersphere_env_id}+"key","value");\n' +
|
||||
'vars.put("key","value")',
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
title: this.$t('project.code_segment.code_segment'),
|
||||
title: this.$t("project.code_segment.code_segment"),
|
||||
children: [
|
||||
{
|
||||
title: this.$t('project.code_segment.insert_segment'),
|
||||
title: this.$t("project.code_segment.insert_segment"),
|
||||
command: "custom_function",
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: this.$t('project.code_segment.exception_handle'),
|
||||
title: this.$t("project.code_segment.exception_handle"),
|
||||
children: [
|
||||
{
|
||||
title: this.$t('project.code_segment.stop_test'),
|
||||
value: 'ctx.getEngine().stopThreadNow(ctx.getThread().getThreadName());'
|
||||
title: this.$t("project.code_segment.stop_test"),
|
||||
value:
|
||||
"ctx.getEngine().stopThreadNow(ctx.getThread().getThreadName());",
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
title: this.$t('project.code_segment.report_handle'),
|
||||
title: this.$t("project.code_segment.report_handle"),
|
||||
hideScript: this.isHideScript(),
|
||||
children: [
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_add_report_length'),
|
||||
value: 'String report = ctx.getCurrentSampler().getRequestData();\n' +
|
||||
'if(report!=null){\n' +
|
||||
' //补足8位长度,前置补0\n' +
|
||||
title: this.$t(
|
||||
"api_test.request.processor.code_add_report_length"
|
||||
),
|
||||
value:
|
||||
"String report = ctx.getCurrentSampler().getRequestData();\n" +
|
||||
"if(report!=null){\n" +
|
||||
" //补足8位长度,前置补0\n" +
|
||||
' String reportlengthStr = String.format("%08d",report.length());\n' +
|
||||
' report = reportlengthStr+report;\n' +
|
||||
' ctx.getCurrentSampler().setRequestData(report);\n' +
|
||||
'}',
|
||||
" report = reportlengthStr+report;\n" +
|
||||
" ctx.getCurrentSampler().setRequestData(report);\n" +
|
||||
"}",
|
||||
},
|
||||
{
|
||||
title: this.$t('api_test.request.processor.code_hide_report_length'),
|
||||
value: '//Get response data\n' +
|
||||
'String returnData = prev.getResponseDataAsString();\n' +
|
||||
'if(returnData!=null&&returnData.length()>8){\n' +
|
||||
'//remove 8 report length \n' +
|
||||
' String subStringData = returnData.substring(8,returnData.length());\n' +
|
||||
title: this.$t(
|
||||
"api_test.request.processor.code_hide_report_length"
|
||||
),
|
||||
value:
|
||||
"//Get response data\n" +
|
||||
"String returnData = prev.getResponseDataAsString();\n" +
|
||||
"if(returnData!=null&&returnData.length()>8){\n" +
|
||||
"//remove 8 report length \n" +
|
||||
" String subStringData = returnData.substring(8,returnData.length());\n" +
|
||||
' if(subStringData.startsWith("<")){\n' +
|
||||
' returnData = subStringData;\n' +
|
||||
' prev.setResponseData(returnData);\n' +
|
||||
' }\n' +
|
||||
'}',
|
||||
" returnData = subStringData;\n" +
|
||||
" prev.setResponseData(returnData);\n" +
|
||||
" }\n" +
|
||||
"}",
|
||||
disabled: this.isPreProcessor,
|
||||
},
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
isCodeEditAlive: true,
|
||||
languages: [
|
||||
'beanshell', "python", "groovy", "javascript"
|
||||
],
|
||||
languages: ["beanshell", "python", "groovy", "javascript"],
|
||||
codeEditModeMap: {
|
||||
beanshell: 'java',
|
||||
python: 'python',
|
||||
groovy: 'java',
|
||||
nashornScript: 'javascript',
|
||||
rhinoScript: 'javascript',
|
||||
javascript: 'javascript',
|
||||
beanshell: "java",
|
||||
python: "python",
|
||||
groovy: "java",
|
||||
nashornScript: "javascript",
|
||||
rhinoScript: "javascript",
|
||||
javascript: "javascript",
|
||||
},
|
||||
codeSpan: 20,
|
||||
menuSpan: 4,
|
||||
showMenu: true,
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if (
|
||||
this.jsr223Processor.jsrEnable === null ||
|
||||
this.jsr223Processor.jsrEnable === undefined
|
||||
) {
|
||||
this.$set(this.jsr223Processor, "jsrEnable", true);
|
||||
}
|
||||
if (
|
||||
this.jsr223Processor.scriptLanguage === null ||
|
||||
this.jsr223Processor.scriptLanguage === undefined
|
||||
) {
|
||||
this.$set(this.jsr223Processor, "scriptLanguage", "beanshell");
|
||||
}
|
||||
this.jsr223ProcessorData = this.jsr223Processor;
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
default: false,
|
||||
},
|
||||
jsr223Processor: {
|
||||
type: Object,
|
||||
|
@ -168,15 +226,14 @@ export default {
|
|||
protocol: String,
|
||||
isPreProcessor: {
|
||||
type: Boolean,
|
||||
default:
|
||||
false
|
||||
default: false,
|
||||
},
|
||||
node: {},
|
||||
},
|
||||
watch: {
|
||||
jsr223Processor() {
|
||||
this.reload();
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addTemplate(template) {
|
||||
|
@ -184,25 +241,29 @@ export default {
|
|||
this.jsr223ProcessorData.script = "";
|
||||
}
|
||||
this.jsr223ProcessorData.script += template.value;
|
||||
if (this.jsr223ProcessorData.scriptLanguage === 'beanshell') {
|
||||
this.jsr223ProcessorData.script += ';';
|
||||
if (this.jsr223ProcessorData.scriptLanguage === "beanshell") {
|
||||
this.jsr223ProcessorData.script += ";";
|
||||
}
|
||||
this.reload();
|
||||
},
|
||||
isHideScript() {
|
||||
return this.protocol !== 'TCP';
|
||||
return this.protocol !== "TCP";
|
||||
},
|
||||
reload() {
|
||||
this.isCodeEditAlive = false;
|
||||
this.$nextTick(() => (this.isCodeEditAlive = true));
|
||||
},
|
||||
languageChange(language) {
|
||||
if (language !== "beanshell") {
|
||||
this.jsr223ProcessorData.jsrEnable = true;
|
||||
}
|
||||
this.jsr223ProcessorData.scriptLanguage = language;
|
||||
this.$emit("languageChange");
|
||||
},
|
||||
addCustomFuncScript(script) {
|
||||
this.jsr223ProcessorData.script = this.jsr223ProcessorData.script ?
|
||||
this.jsr223ProcessorData.script + '\n\n' + script : script;
|
||||
this.jsr223ProcessorData.script = this.jsr223ProcessorData.script
|
||||
? this.jsr223ProcessorData.script + "\n\n" + script
|
||||
: script;
|
||||
this.reload();
|
||||
},
|
||||
switchMenu() {
|
||||
|
@ -220,8 +281,8 @@ export default {
|
|||
this.$refs.codeEdit.insert(code);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -268,5 +329,4 @@ export default {
|
|||
.show-menu:hover {
|
||||
color: #935aa1;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -1078,7 +1078,8 @@ const message = {
|
|||
avg_response_time: 'Average Response Time',
|
||||
tps: 'Transactions Per Second',
|
||||
plan_share_url: 'Whether the link jump is logged in',
|
||||
rename_report: 'Rename report'
|
||||
rename_report: 'Rename report',
|
||||
run_model: 'Run model'
|
||||
},
|
||||
load_test: {
|
||||
exist_related_file: 'Existed Relate Files',
|
||||
|
|
|
@ -1086,7 +1086,8 @@ const message = {
|
|||
avg_response_time: '平均响应时间',
|
||||
tps: '每秒传输的事物处理个数',
|
||||
plan_share_url: '链接跳转是否登陆',
|
||||
rename_report: '重命名报告'
|
||||
rename_report: '重命名报告',
|
||||
run_model: '运行模式'
|
||||
},
|
||||
load_test: {
|
||||
exist_related_file: '已存在的关联文件',
|
||||
|
|
|
@ -1083,7 +1083,8 @@ const message = {
|
|||
avg_response_time: '平均響應時間',
|
||||
tps: '每秒傳輸的事物處理個數',
|
||||
plan_share_url: '鏈接跳轉是否登陸',
|
||||
rename_report: '重命名報告'
|
||||
rename_report: '重命名報告',
|
||||
run_model: '運行模式'
|
||||
},
|
||||
load_test: {
|
||||
exist_related_file: '已存在的關聯文件',
|
||||
|
|
|
@ -17,7 +17,7 @@ public class IssueProxyResourceController {
|
|||
|
||||
@GetMapping(value = "/md/get/url")
|
||||
public ResponseEntity<byte[]> getFileByUrl(@RequestParam ("url") String url, @RequestParam (value = "platform", required = false) String platform,
|
||||
@RequestParam ("project_id") String projectId, @RequestParam ("workspace_id") String workspaceId) {
|
||||
return issueProxyResourceService.getMdImageByUrl(url, platform, projectId, workspaceId);
|
||||
@RequestParam (value = "workspace_id", required = false) String workspaceId) {
|
||||
return issueProxyResourceService.getMdImageByUrl(url, platform, workspaceId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class IssueProxyResourceService {
|
|||
* @param platform
|
||||
* @return
|
||||
*/
|
||||
public ResponseEntity<byte[]> getMdImageByUrl(String url, String platform, String projectId, String workspaceId) {
|
||||
public ResponseEntity<byte[]> getMdImageByUrl(String url, String platform, String workspaceId) {
|
||||
if (url.contains("md/get/url")) {
|
||||
MSException.throwException(Translator.get("invalid_parameter"));
|
||||
}
|
||||
|
|
|
@ -82,6 +82,10 @@ export function testCasePublicBatchDeleteToGc(param) {
|
|||
return post(BASE_URL + 'batch/movePublic/deleteToGc', param);
|
||||
}
|
||||
|
||||
export function testCaseBatchRelateDemand(param) {
|
||||
return post(BASE_URL + 'batch/relate/demand', param);
|
||||
}
|
||||
|
||||
export function getTestCaseFollow(id) {
|
||||
return get(BASE_URL + `follow/${id}`);
|
||||
}
|
||||
|
|
|
@ -246,9 +246,9 @@ import {
|
|||
getTestCaseStep,
|
||||
getTestCaseVersions, testCaseBatchCopy,
|
||||
testCaseBatchDelete,
|
||||
testCaseBatchDeleteToGc, testCaseBatchEdit,
|
||||
testCaseBatchDeleteToGc, testCaseBatchEdit, testCaseBatchRelateDemand,
|
||||
testCaseDelete,
|
||||
testCaseDeleteToGc, testCaseList, testCasePublicBatchDeleteToGc,
|
||||
testCaseDeleteToGc, testCaseList,
|
||||
testCaseReduction
|
||||
} from "@/api/testCase";
|
||||
import {getGraphByCondition} from "@/api/graph";
|
||||
|
@ -993,7 +993,7 @@ export default {
|
|||
param.condition = this.condition;
|
||||
param.demandId = form.demandId;
|
||||
param.demandName = form.demandName;
|
||||
testCasePublicBatchDeleteToGc(param)
|
||||
testCaseBatchRelateDemand(param)
|
||||
.then(() => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.refresh();
|
||||
|
|
|
@ -80,6 +80,11 @@
|
|||
</span>
|
||||
</span>
|
||||
|
||||
<ms-review-table-item
|
||||
v-else-if="item.id === 'description'"
|
||||
:data="scope.row"
|
||||
prop="description"/>
|
||||
|
||||
<span v-else-if="item.id === 'resourceName'">
|
||||
<el-link v-if="scope.row.resourceName"
|
||||
@click="$router.push('/track/plan/view/' + scope.row.resourceId)">
|
||||
|
@ -103,21 +108,12 @@
|
|||
|
||||
<!-- 自定义字段 -->
|
||||
<span v-else-if="item.isCustom">
|
||||
<span v-if="item.type === 'richText' && scope.row.displayValueMap.get(item.id)">
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="500"
|
||||
trigger="hover"
|
||||
popper-class="issues-popover">
|
||||
<ms-mark-down-text
|
||||
prop="value"
|
||||
:disabled="true"
|
||||
:data="{value: scope.row.displayValueMap.get(item.id)}"/>
|
||||
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
|
||||
</el-popover>
|
||||
<span v-if="item.type === 'richText' && scope.row.displayValueMap[item.id]">
|
||||
<ms-review-table-item
|
||||
:data="scope.row.displayValueMap" :prop="item.id"/>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ scope.row.displayValueMap.get(item.id) }}
|
||||
{{ scope.row.displayValueMap[item.id] }}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
@ -185,10 +181,12 @@ import {
|
|||
} from "metersphere-frontend/src/components/search/custom-component";
|
||||
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
|
||||
import {hasLicense} from "metersphere-frontend/src/utils/permission";
|
||||
import MsReviewTableItem from "@/business/issue/MsReviewTableItem";
|
||||
|
||||
export default {
|
||||
name: "IssueList",
|
||||
components: {
|
||||
MsReviewTableItem,
|
||||
MsMarkDownText,
|
||||
MsMainContainer,
|
||||
MsContainer,
|
||||
|
@ -418,7 +416,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
this.page.data.forEach(item => {
|
||||
let displayValueMap = new Map();
|
||||
let displayValueMap = {};
|
||||
let fieldIdSet = new Set(this.fields.map(i => i.id));
|
||||
this.issueTemplate.customFields.forEach(field => {
|
||||
let displayValue;
|
||||
|
@ -430,7 +428,7 @@ export default {
|
|||
} else {
|
||||
displayValue = this.getCustomFieldValue(item, field);
|
||||
}
|
||||
displayValueMap.set(field.name, displayValue);
|
||||
displayValueMap[field.name] = displayValue;
|
||||
});
|
||||
item.displayValueMap = displayValueMap;
|
||||
});
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<template>
|
||||
<el-popover
|
||||
placement="right"
|
||||
width="500"
|
||||
trigger="hover"
|
||||
popper-class="issues-popover">
|
||||
<ms-mark-down-text :prop="prop" :data="data" :disabled="true"/>
|
||||
<el-button slot="reference" type="text">{{ $t('test_track.issue.preview') }}</el-button>
|
||||
</el-popover>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
|
||||
import MsMarkDownText from "metersphere-frontend/src/components/MsMarkDownText";
|
||||
export default {
|
||||
name: "MsReviewTableItem",
|
||||
components: {MsMarkDownText, MsTableColumn},
|
||||
props: {
|
||||
data: Object,
|
||||
prop: String,
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
Loading…
Reference in New Issue