Merge branch 'v1.7'
This commit is contained in:
commit
fcf9c334a9
|
@ -256,25 +256,21 @@ public abstract class MsTestElement {
|
||||||
return getRootParent(element.getParent());
|
return getRootParent(element.getParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getParentName(MsTestElement element, ParameterConfig config) {
|
protected String getParentName(MsTestElement parent, ParameterConfig config) {
|
||||||
if (element != null) {
|
if (parent != null) {
|
||||||
MsTestElement parent = this.getRootParent(element);
|
if (MsTestElementConstants.LoopController.name().equals(parent.getType())) {
|
||||||
if (parent != null) {
|
MsLoopController loopController = (MsLoopController) parent;
|
||||||
if (MsTestElementConstants.LoopController.name().equals(parent.getType())) {
|
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.WHILE.name()) && loopController.getWhileController() != null) {
|
||||||
MsLoopController loopController = (MsLoopController) parent;
|
return "While 循环-" + "${LoopCounterConfigXXX}";
|
||||||
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.WHILE.name()) && loopController.getWhileController() != null) {
|
}
|
||||||
return "While 循环-" + "${LoopCounterConfigXXX}";
|
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.FOREACH.name()) && loopController.getForEachController() != null) {
|
||||||
}
|
return "ForEach 循环-" + "${LoopCounterConfigXXX}";
|
||||||
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.FOREACH.name()) && loopController.getForEachController() != null) {
|
}
|
||||||
return "ForEach 循环-" + "${LoopCounterConfigXXX}";
|
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.LOOP_COUNT.name()) && loopController.getCountController() != null) {
|
||||||
}
|
return "次数循环-" + "${LoopCounterConfigXXX}";
|
||||||
if (StringUtils.equals(loopController.getLoopType(), LoopConstants.LOOP_COUNT.name()) && loopController.getCountController() != null) {
|
|
||||||
return "次数循环-" + "${LoopCounterConfigXXX}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return parent.getName();
|
|
||||||
}
|
}
|
||||||
return element.getName();
|
return parent.getName();
|
||||||
} else if (config != null && StringUtils.isNotEmpty(config.getStep())) {
|
} else if (config != null && StringUtils.isNotEmpty(config.getStep())) {
|
||||||
if (MsTestElementConstants.SCENARIO.name().equals(config.getStepType())) {
|
if (MsTestElementConstants.SCENARIO.name().equals(config.getStepType())) {
|
||||||
return config.getStep();
|
return config.getStep();
|
||||||
|
|
|
@ -661,7 +661,10 @@ public class ApiDefinitionService {
|
||||||
public String getResourceId(SwaggerUrlRequest swaggerUrlRequest) {
|
public String getResourceId(SwaggerUrlRequest swaggerUrlRequest) {
|
||||||
SwaggerUrlProjectExample swaggerUrlProjectExample = new SwaggerUrlProjectExample();
|
SwaggerUrlProjectExample swaggerUrlProjectExample = new SwaggerUrlProjectExample();
|
||||||
SwaggerUrlProjectExample.Criteria criteria = swaggerUrlProjectExample.createCriteria();
|
SwaggerUrlProjectExample.Criteria criteria = swaggerUrlProjectExample.createCriteria();
|
||||||
criteria.andProjectIdEqualTo(swaggerUrlRequest.getProjectId()).andSwaggerUrlEqualTo(swaggerUrlRequest.getSwaggerUrl()).andModuleIdEqualTo(swaggerUrlRequest.getModuleId());
|
criteria.andProjectIdEqualTo(swaggerUrlRequest.getProjectId()).andSwaggerUrlEqualTo(swaggerUrlRequest.getSwaggerUrl());
|
||||||
|
if (StringUtils.isNotBlank(swaggerUrlRequest.getModuleId())) {
|
||||||
|
criteria.andModuleIdEqualTo(swaggerUrlRequest.getModuleId());
|
||||||
|
}
|
||||||
List<SwaggerUrlProject> list = swaggerUrlProjectMapper.selectByExample(swaggerUrlProjectExample);
|
List<SwaggerUrlProject> list = swaggerUrlProjectMapper.selectByExample(swaggerUrlProjectExample);
|
||||||
String resourceId = "";
|
String resourceId = "";
|
||||||
if (list.size() == 1) {
|
if (list.size() == 1) {
|
||||||
|
|
|
@ -28,7 +28,6 @@ import io.metersphere.base.mapper.ApiTestMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
import io.metersphere.base.mapper.ext.ExtApiScenarioMapper;
|
||||||
import io.metersphere.commons.utils.BeanUtils;
|
import io.metersphere.commons.utils.BeanUtils;
|
||||||
import io.metersphere.commons.utils.DateUtils;
|
import io.metersphere.commons.utils.DateUtils;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -42,7 +41,6 @@ import javax.annotation.Resource;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -116,18 +114,6 @@ public class HistoricalDataUpgradeService {
|
||||||
if (request instanceof HttpRequest) {
|
if (request instanceof HttpRequest) {
|
||||||
element = new MsHTTPSamplerProxy();
|
element = new MsHTTPSamplerProxy();
|
||||||
HttpRequest request1 = (HttpRequest) request;
|
HttpRequest request1 = (HttpRequest) request;
|
||||||
if (StringUtils.isEmpty(request1.getPath()) && StringUtils.isNotEmpty(request1.getUrl())) {
|
|
||||||
try {
|
|
||||||
URL urlObject = new URL(request1.getUrl());
|
|
||||||
String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath();
|
|
||||||
request1.setPath(envPath);
|
|
||||||
request1.setUrl(null);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
LogUtil.error(ex.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
request1.setUrl(null);
|
|
||||||
}
|
|
||||||
if (request1.getBody() != null) {
|
if (request1.getBody() != null) {
|
||||||
request1.getBody().setBinary(new ArrayList<>());
|
request1.getBody().setBinary(new ArrayList<>());
|
||||||
if (request1.getBody().isOldKV()) {
|
if (request1.getBody().isOldKV()) {
|
||||||
|
@ -136,21 +122,21 @@ public class HistoricalDataUpgradeService {
|
||||||
if ("json".equals(request1.getBody().getFormat())) {
|
if ("json".equals(request1.getBody().getFormat())) {
|
||||||
if ("Raw".equals(request1.getBody().getType())) {
|
if ("Raw".equals(request1.getBody().getType())) {
|
||||||
request1.getBody().setType(Body.JSON);
|
request1.getBody().setType(Body.JSON);
|
||||||
}
|
if (CollectionUtils.isEmpty(request1.getHeaders())) {
|
||||||
if (CollectionUtils.isEmpty(request1.getHeaders())) {
|
List<KeyValue> headers = new LinkedList<>();
|
||||||
List<KeyValue> headers = new LinkedList<>();
|
headers.add(new KeyValue("Content-Type", "application/json"));
|
||||||
headers.add(new KeyValue("Content-Type", "application/json"));
|
request1.setHeaders(headers);
|
||||||
request1.setHeaders(headers);
|
} else {
|
||||||
} else {
|
boolean isJsonType = false;
|
||||||
boolean isJsonType = false;
|
for (KeyValue keyValue : request1.getHeaders()) {
|
||||||
for (KeyValue keyValue : request1.getHeaders()) {
|
if ("Content-Type".equals(keyValue.getName())) {
|
||||||
if ("Content-Type".equals(keyValue.getName())) {
|
isJsonType = true;
|
||||||
isJsonType = true;
|
break;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
if (!isJsonType) {
|
||||||
|
request1.getHeaders().set(request1.getHeaders().size() - 1, new KeyValue("Content-Type", "application/json"));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!isJsonType) {
|
|
||||||
request1.getHeaders().set(request1.getHeaders().size() - 1, new KeyValue("Content-Type", "application/json"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,6 +147,13 @@ public class HistoricalDataUpgradeService {
|
||||||
BeanUtils.copyBean(element, request1);
|
BeanUtils.copyBean(element, request1);
|
||||||
((MsHTTPSamplerProxy) element).setProtocol(RequestType.HTTP);
|
((MsHTTPSamplerProxy) element).setProtocol(RequestType.HTTP);
|
||||||
((MsHTTPSamplerProxy) element).setArguments(request1.getParameters());
|
((MsHTTPSamplerProxy) element).setArguments(request1.getParameters());
|
||||||
|
if (StringUtils.isNotEmpty(request1.getPath()) && request1.isUseEnvironment()) {
|
||||||
|
((MsHTTPSamplerProxy) element).setPath(request1.getPath());
|
||||||
|
((MsHTTPSamplerProxy) element).setUrl(null);
|
||||||
|
} else {
|
||||||
|
((MsHTTPSamplerProxy) element).setPath(null);
|
||||||
|
((MsHTTPSamplerProxy) element).setUrl(request1.getUrl());
|
||||||
|
}
|
||||||
List<KeyValue> keyValues = new LinkedList<>();
|
List<KeyValue> keyValues = new LinkedList<>();
|
||||||
keyValues.add(new KeyValue("", ""));
|
keyValues.add(new KeyValue("", ""));
|
||||||
((MsHTTPSamplerProxy) element).setRest(keyValues);
|
((MsHTTPSamplerProxy) element).setRest(keyValues);
|
||||||
|
@ -318,9 +311,6 @@ public class HistoricalDataUpgradeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createApiScenarioWithBLOBs(SaveHistoricalDataUpgrade saveHistoricalDataUpgrade, String id, String name, int total, String scenarioDefinition, ApiScenarioMapper mapper, int num) {
|
private void createApiScenarioWithBLOBs(SaveHistoricalDataUpgrade saveHistoricalDataUpgrade, String id, String name, int total, String scenarioDefinition, ApiScenarioMapper mapper, int num) {
|
||||||
if (StringUtils.isEmpty(name)) {
|
|
||||||
name = "默认名称-" + DateUtils.getTimeStr(System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
ApiScenarioWithBLOBs scenario = getScenario(id, mapper);
|
ApiScenarioWithBLOBs scenario = getScenario(id, mapper);
|
||||||
if (scenario != null) {
|
if (scenario != null) {
|
||||||
scenario.setName(name);
|
scenario.setName(name);
|
||||||
|
@ -377,6 +367,11 @@ public class HistoricalDataUpgradeService {
|
||||||
if (CollectionUtils.isNotEmpty(scenarios)) {
|
if (CollectionUtils.isNotEmpty(scenarios)) {
|
||||||
// 批量处理
|
// 批量处理
|
||||||
for (Scenario scenario : scenarios) {
|
for (Scenario scenario : scenarios) {
|
||||||
|
if (StringUtils.isEmpty(scenario.getName())) {
|
||||||
|
scenario.setName("默认名称-" + DateUtils.getTimeStr(System.currentTimeMillis()));
|
||||||
|
}
|
||||||
|
scenario.setId(test.getId() + "=" + scenario.getId());
|
||||||
|
scenario.setName(test.getName() + "_" + scenario.getName());
|
||||||
MsScenario scenario1 = createScenario(scenario);
|
MsScenario scenario1 = createScenario(scenario);
|
||||||
String scenarioDefinition = JSON.toJSONString(scenario1);
|
String scenarioDefinition = JSON.toJSONString(scenario1);
|
||||||
num++;
|
num++;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE api_scenario MODIFY COLUMN id VARCHAR (120);
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE swagger_url_project
|
||||||
|
MODIFY COLUMN id VARCHAR(120);
|
||||||
|
ALTER TABLE swagger_url_project
|
||||||
|
MODIFY COLUMN project_id VARCHAR(120);
|
||||||
|
ALTER TABLE swagger_url_project
|
||||||
|
MODIFY COLUMN mode_id VARCHAR(120);
|
|
@ -113,11 +113,11 @@ export default {
|
||||||
showEnvironmentSelect: true,
|
showEnvironmentSelect: true,
|
||||||
modeOptions: [{
|
modeOptions: [{
|
||||||
id: 'fullCoverage',
|
id: 'fullCoverage',
|
||||||
name: '全量覆盖'
|
name: this.$t('commons.cover')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'incrementalMerge',
|
id: 'incrementalMerge',
|
||||||
name: '增量合并'
|
name: this.$t('commons.not_cover')
|
||||||
}],
|
}],
|
||||||
protocol: "",
|
protocol: "",
|
||||||
platforms: [
|
platforms: [
|
||||||
|
@ -152,8 +152,8 @@ export default {
|
||||||
formData: {
|
formData: {
|
||||||
file: undefined,
|
file: undefined,
|
||||||
swaggerUrl: '',
|
swaggerUrl: '',
|
||||||
modeId: '',
|
modeId: this.$t('commons.not_cover'),
|
||||||
moduleId: ''
|
moduleId: '',
|
||||||
},
|
},
|
||||||
rules: {},
|
rules: {},
|
||||||
currentModule: {},
|
currentModule: {},
|
||||||
|
|
|
@ -274,4 +274,7 @@ export default {
|
||||||
.el-row {
|
.el-row {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
.el-button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -295,4 +295,8 @@ export default {
|
||||||
.el-row {
|
.el-row {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -308,4 +308,7 @@ export default {
|
||||||
.el-row {
|
.el-row {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
.el-button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -313,4 +313,7 @@ export default {
|
||||||
.el-row {
|
.el-row {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
.el-button {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -252,9 +252,6 @@ export default {
|
||||||
activated() {
|
activated() {
|
||||||
this.initTableData();
|
this.initTableData();
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
this.list()
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
create() {
|
create() {
|
||||||
this.dialogOrgAddVisible = true;
|
this.dialogOrgAddVisible = true;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
export default {
|
export default {
|
||||||
commons: {
|
commons: {
|
||||||
|
cover:'Cover',
|
||||||
|
not_cover:'Not Cover',
|
||||||
import_mode: 'Import mode',
|
import_mode: 'Import mode',
|
||||||
import_module: 'Import module',
|
import_module: 'Import module',
|
||||||
please_fill_in_the_template: 'Please fill in the template',
|
please_fill_in_the_template: 'Please fill in the template',
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
export default {
|
export default {
|
||||||
commons: {
|
commons: {
|
||||||
|
cover:'覆盖',
|
||||||
|
not_cover:'不覆盖',
|
||||||
import_mode: '导入模式',
|
import_mode: '导入模式',
|
||||||
import_module: '导入模块',
|
import_module: '导入模块',
|
||||||
please_fill_in_the_template: '请填写模版内容',
|
please_fill_in_the_template: '请填写模版内容',
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
export default {
|
export default {
|
||||||
commons: {
|
commons: {
|
||||||
|
cover:'覆蓋',
|
||||||
|
not_cover:'不覆蓋',
|
||||||
import_mode: '導入模式',
|
import_mode: '導入模式',
|
||||||
import_module: '導入模塊',
|
import_module: '導入模塊',
|
||||||
please_fill_in_the_template: '請填寫模版內容',
|
please_fill_in_the_template: '請填寫模版內容',
|
||||||
|
|
Loading…
Reference in New Issue