From a9d76e666ad47ec5a0b41edc49d0194372f1f7b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Oct 2020 03:34:30 +0000 Subject: [PATCH 01/33] chore(deps): bump zookeeper from 3.4.13 to 3.4.14 in /backend Bumps zookeeper from 3.4.13 to 3.4.14. Signed-off-by: dependabot[bot] --- backend/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/pom.xml b/backend/pom.xml index b4d5c1a4df..cb339a1044 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -205,7 +205,7 @@ org.apache.zookeeper zookeeper - 3.4.13 + 3.4.14 org.apache.curator From 66473ae258351b9b738625ed8a05593d4c0f68f1 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 22 Jan 2021 19:00:36 +0800 Subject: [PATCH 02/33] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/definition/request/MsScenario.java | 2 +- .../api/dto/definition/request/ParameterConfig.java | 2 +- .../api/service/HistoricalDataUpgradeService.java | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java index d6b73cc520..6e9de4f474 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/MsScenario.java @@ -60,7 +60,7 @@ public class MsScenario extends MsTestElement { return; } config.setStep(this.name); - + config.setStepType(""); config.setEnableCookieShare(enableCookieShare); if (StringUtils.isNotEmpty(environmentId)) { ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java index 6f75a54fb6..345d80efcd 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/ParameterConfig.java @@ -17,6 +17,6 @@ public class ParameterConfig { // 步骤 private String step; - private final String stepType = "STEP_GROUP"; + private String stepType; } diff --git a/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java b/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java index 489f5b5133..5190ba6dbd 100644 --- a/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java +++ b/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java @@ -185,6 +185,9 @@ public class HistoricalDataUpgradeService { CollectionUtils.isNotEmpty(request.getAssertions().getRegex()) || CollectionUtils.isNotEmpty(request.getAssertions().getXpath2()))) { String assertions = JSON.toJSONString(request.getAssertions()); MsAssertions msAssertions = JSON.parseObject(assertions, MsAssertions.class); + if (StringUtils.isEmpty(msAssertions.getName())) { + msAssertions.setName("Assertions"); + } msAssertions.setType("Assertions"); msAssertions.setIndex(index + ""); msAssertions.setResourceId(UUID.randomUUID().toString()); @@ -196,6 +199,9 @@ public class HistoricalDataUpgradeService { CollectionUtils.isNotEmpty(request.getExtract().getRegex()) || CollectionUtils.isNotEmpty(request.getExtract().getXpath()))) { String extractJson = JSON.toJSONString(request.getExtract()); MsExtract extract = JSON.parseObject(extractJson, MsExtract.class); + if (StringUtils.isEmpty(extract.getName())) { + extract.setName("Extract"); + } extract.setType("Extract"); extract.setIndex(index + ""); extract.setHashTree(new LinkedList<>()); @@ -206,6 +212,9 @@ public class HistoricalDataUpgradeService { if (request.getJsr223PreProcessor() != null && StringUtils.isNotEmpty(request.getJsr223PreProcessor().getScript())) { String preJson = JSON.toJSONString(request.getJsr223PreProcessor()); MsJSR223PreProcessor preProcessor = JSON.parseObject(preJson, MsJSR223PreProcessor.class); + if (StringUtils.isEmpty(preProcessor.getName())) { + preProcessor.setName("JSR223PreProcessor"); + } preProcessor.setType("JSR223PreProcessor"); preProcessor.setIndex(index + ""); preProcessor.setHashTree(new LinkedList<>()); @@ -216,6 +225,9 @@ public class HistoricalDataUpgradeService { if (request.getJsr223PostProcessor() != null && StringUtils.isNotEmpty(request.getJsr223PostProcessor().getScript())) { String preJson = JSON.toJSONString(request.getJsr223PostProcessor()); MsJSR223PostProcessor preProcessor = JSON.parseObject(preJson, MsJSR223PostProcessor.class); + if (StringUtils.isEmpty(preProcessor.getName())) { + preProcessor.setName("JSR223PostProcessor"); + } preProcessor.setType("JSR223PostProcessor"); preProcessor.setIndex(index + ""); preProcessor.setHashTree(new LinkedList<>()); From e6d2e1bf4d880bf3bd0a76a5799b6fbfb8233dcb Mon Sep 17 00:00:00 2001 From: "song.tianyang" Date: Fri, 22 Jan 2021 19:06:30 +0800 Subject: [PATCH 03/33] =?UTF-8?q?feat:=20=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=8A=B6=E6=80=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试计划定时任务报告增加状态字段 --- .../base/mapper/ext/ExtTestPlanReportMapper.xml | 2 +- .../io/metersphere/track/dto/TestPlanReportDTO.java | 1 + .../track/service/TestPlanReportService.java | 8 +++++++- .../track/report/components/TestPlanReportList.vue | 13 ++++++++++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportMapper.xml index c461efcb04..94c32f0482 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanReportMapper.xml @@ -4,7 +4,7 @@ + + + + - - - + + + + - - - - + - + - + + + + + - - - - - + + + + + - - - - - + + + - - - + - + - + + + - - - + + + + - - - - - - - - + + + - - - + + @@ -94,11 +92,11 @@ import MsApiVariableAdvance from "./ApiVariableAdvance"; import MsApiBodyFileUpload from "./body/ApiBodyFileUpload"; import {REQUIRED} from "../model/JsonData"; - import MsDraggable from 'vuedraggable' + import Vue from 'vue'; export default { name: "MsApiVariable", - components: {MsApiBodyFileUpload, MsApiVariableAdvance, MsDraggable}, + components: {MsApiBodyFileUpload, MsApiVariableAdvance}, props: { keyPlaceholder: String, valuePlaceholder: String, @@ -125,7 +123,6 @@ return { currentItem: null, requireds: REQUIRED, - keyValues: [], } }, computed: { @@ -137,6 +134,25 @@ } }, methods: { + moveBottom(index) { + if (this.parameters.length < 2 || index === this.parameters.length - 2) { + return; + } + let thisRow = this.parameters[index]; + let nextRow = this.parameters[index + 1]; + Vue.set(this.parameters, index + 1, thisRow); + Vue.set(this.parameters, index, nextRow) + }, + moveTop(index) { + if (index === 0) { + return; + } + let thisRow = this.parameters[index]; + let lastRow = this.parameters[index - 1]; + Vue.set(this.parameters, index - 1, thisRow); + Vue.set(this.parameters, index, lastRow) + + }, remove: function (index) { // 移除整行输入控件及内容 this.parameters.splice(index, 1); @@ -204,21 +220,6 @@ item.contentType = 'text/plain'; } }, - endChange(env) { - if (env.newIndex == env.oldIndex) { - return; - } - let newItem = this.keyValues[env.newIndex]; - let oldItem = this.keyValues[env.oldIndex]; - this.$set(this.keyValues, env.oldIndex, oldItem); - this.$set(this.keyValues, env.newIndex, newItem) - this.parameters.forEach(item => { - this.parameters.splice(0); - }) - this.keyValues.forEach(item => { - this.parameters.push(item); - }) - } }, created() { if (this.parameters.length === 0 || this.parameters[this.parameters.length - 1].name) { @@ -230,7 +231,6 @@ contentType: 'text/plain' })); } - this.keyValues = this.parameters; } } diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue index e1cfe6c7e5..2d6a40ffbe 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseItem.vue @@ -85,7 +85,7 @@

{{ $t('api_test.definition.request.req_param') }}

- + diff --git a/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue b/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue index 10b5287bec..7bef849ff2 100644 --- a/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue +++ b/frontend/src/business/components/api/definition/components/debug/DebugHttpPage.vue @@ -26,7 +26,7 @@

{{$t('api_test.definition.request.req_param')}}

- +

{{$t('api_test.definition.request.res_param')}}

diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue index 363ad44b8c..3104935d8a 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue @@ -43,7 +43,7 @@

{{$t('api_test.definition.request.req_param')}}

- + From 75030f1695769370935019accdaf5714a5bc88dd Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Mon, 25 Jan 2021 17:48:46 +0800 Subject: [PATCH 27/33] =?UTF-8?q?refactor:=20=E5=9C=BA=E6=99=AF=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E8=A1=A8=E5=A4=B4=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/automation/ApiScenarioRequest.java | 2 +- .../dto/automation/RunScenarioRequest.java | 2 +- .../dto/automation/SaveApiPlanRequest.java | 3 +- .../automation/SaveApiScenarioRequest.java | 3 +- .../api/service/ApiAutomationService.java | 2 +- .../base/mapper/ext/ExtApiScenarioMapper.xml | 32 +- .../automation/scenario/ApiScenarioList.vue | 919 ++++++++++-------- 7 files changed, 524 insertions(+), 439 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java index 2eb30e0f64..12b85d5a13 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioRequest.java @@ -21,7 +21,7 @@ public class ApiScenarioRequest { private String planId; private boolean recent = false; private List orders; - private List filters; + private Map> filters; private Map combine; private List ids; private boolean isSelectThisWeedData; diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java index 83aff1371a..217787ffe0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/RunScenarioRequest.java @@ -45,7 +45,7 @@ public class RunScenarioRequest { */ private boolean isSelectAllDate; - private List filters; + private Map> filters; private String name; diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiPlanRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiPlanRequest.java index 44fc3d8e17..516efd56e8 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiPlanRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiPlanRequest.java @@ -4,6 +4,7 @@ import lombok.Getter; import lombok.Setter; import java.util.List; +import java.util.Map; @Getter @Setter @@ -23,7 +24,7 @@ public class SaveApiPlanRequest { */ private boolean isSelectAllDate; - private List filters; + private Map> filters; private String name; diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java index 1f73ee1804..bdfa94144b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/SaveApiScenarioRequest.java @@ -5,6 +5,7 @@ import lombok.Getter; import lombok.Setter; import java.util.List; +import java.util.Map; @Setter @Getter @@ -47,7 +48,7 @@ public class SaveApiScenarioRequest { private boolean isSelectAllDate; - private List filters; + private Map> filters; private List moduleIds; diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 6805899a82..96278e134a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -464,7 +464,7 @@ public class ApiAutomationService { * @param unSelectIds 未勾选ID_前台没有勾选的ID * @return */ - private List getAllScenarioIdsByFontedSelect(List moduleIds, String name, String projectId, List filters, List unSelectIds) { + private List getAllScenarioIdsByFontedSelect(List moduleIds, String name, String projectId, Map> filters, List unSelectIds) { ApiScenarioRequest selectRequest = new ApiScenarioRequest(); selectRequest.setModuleIds(moduleIds); selectRequest.setName(name); diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml index c0089a1413..56556c85dd 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioMapper.xml @@ -150,9 +150,35 @@ - and api_scenario.status in - - #{value} + + + + + and api_scenario.status in + + #{value} + + + + and api_scenario.user_id in + + #{value} + + + + and api_scenario.level in + + #{value} + + + + and api_scenario.last_result in + + #{value} + + + + diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 53278e4d8b..431d00ede5 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -6,7 +6,10 @@ :show-create="false"/> - @@ -24,36 +27,53 @@ - - + + + sortable="custom" + column-key="status" + :filters="statusFilters" + show-overflow-tooltip min-width="120px"> - + - - + + - + From 75552fd896620a6fc006368df6b6830be538a188 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 25 Jan 2021 18:02:47 +0800 Subject: [PATCH 28/33] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92)?= =?UTF-8?q?:=20=E6=89=A7=E8=A1=8C=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/track/service/LoadReportStatusEvent.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/track/service/LoadReportStatusEvent.java b/backend/src/main/java/io/metersphere/track/service/LoadReportStatusEvent.java index 62364e0180..4229a5e17e 100644 --- a/backend/src/main/java/io/metersphere/track/service/LoadReportStatusEvent.java +++ b/backend/src/main/java/io/metersphere/track/service/LoadReportStatusEvent.java @@ -32,7 +32,8 @@ public class LoadReportStatusEvent implements LoadTestFinishEvent { @Override public void execute(LoadTestReport loadTestReport) { - if (StringUtils.equals(ReportTriggerMode.CASE.name(), loadTestReport.getTriggerMode())) { + if (StringUtils.equals(ReportTriggerMode.CASE.name(), loadTestReport.getTriggerMode()) + || StringUtils.equals(ReportTriggerMode.TEST_PLAN_SCHEDULE.name(), loadTestReport.getTriggerMode())) { if (StringUtils.equalsAny(loadTestReport.getStatus(), PerformanceTestStatus.Completed.name(), PerformanceTestStatus.Error.name())) { updateLoadCaseStatus(loadTestReport); From fb0af088c562f795149247e8b21328a50d793f83 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 25 Jan 2021 18:04:08 +0800 Subject: [PATCH 29/33] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E5=9C=BA=E6=99=AF=E6=95=B0=E6=8D=AE=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/HistoricalDataUpgradeService.java | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java b/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java index 5190ba6dbd..6bfe58d770 100644 --- a/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java +++ b/backend/src/main/java/io/metersphere/api/service/HistoricalDataUpgradeService.java @@ -65,6 +65,15 @@ public class HistoricalDataUpgradeService { } } + private MsScenario createScenarioByTest(ApiTest test) { + MsScenario scenario = new MsScenario(); + scenario.setName(test.getName()); + scenario.setReferenced("Upgrade"); + scenario.setResourceId(UUID.randomUUID().toString()); + scenario.setId(test.getId()); + return scenario; + } + private MsScenario createScenario(Scenario oldScenario) { MsScenario scenario = new MsScenario(); scenario.setOldVariables(oldScenario.getVariables()); @@ -147,6 +156,9 @@ public class HistoricalDataUpgradeService { BeanUtils.copyBean(element, request1); ((MsHTTPSamplerProxy) element).setProtocol(RequestType.HTTP); ((MsHTTPSamplerProxy) element).setArguments(request1.getParameters()); + List keyValues = new LinkedList<>(); + keyValues.add(new KeyValue("", "")); + ((MsHTTPSamplerProxy) element).setRest(keyValues); if (StringUtils.isEmpty(element.getName())) { element.setName(request1.getPath()); } @@ -251,9 +263,9 @@ public class HistoricalDataUpgradeService { return scenario; } - private ApiScenarioWithBLOBs checkNameExist(Scenario oldScenario, String projectId, ApiScenarioMapper mapper) { + private ApiScenarioWithBLOBs getScenario(String oldScenarioId, ApiScenarioMapper mapper) { ApiScenarioExample example = new ApiScenarioExample(); - example.createCriteria().andIdEqualTo(oldScenario.getId()); + example.createCriteria().andIdEqualTo(oldScenarioId); List list = mapper.selectByExampleWithBLOBs(example); if (list.size() > 0) { return list.get(0); @@ -333,20 +345,20 @@ public class HistoricalDataUpgradeService { copyDir(dir, BODY_FILE_DIR); } - private void createApiScenarioWithBLOBs(SaveHistoricalDataUpgrade saveHistoricalDataUpgrade, Scenario oldScenario, String scenarioDefinition, ApiScenarioMapper mapper, int num) { - if (StringUtils.isEmpty(oldScenario.getName())) { - oldScenario.setName("默认名称-" + DateUtils.getTimeStr(System.currentTimeMillis())); + 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 = checkNameExist(oldScenario, saveHistoricalDataUpgrade.getProjectId(), mapper); + ApiScenarioWithBLOBs scenario = getScenario(id, mapper); if (scenario != null) { - scenario.setName(oldScenario.getName()); + scenario.setName(name); scenario.setProjectId(saveHistoricalDataUpgrade.getProjectId()); scenario.setTags(scenario.getTags()); scenario.setLevel("P0"); scenario.setModulePath(saveHistoricalDataUpgrade.getModulePath()); scenario.setApiScenarioModuleId(saveHistoricalDataUpgrade.getModuleId()); scenario.setPrincipal(Objects.requireNonNull(SessionUtils.getUser()).getId()); - scenario.setStepTotal(oldScenario.getRequests().size()); + scenario.setStepTotal(total); scenario.setScenarioDefinition(scenarioDefinition); scenario.setUpdateTime(System.currentTimeMillis()); scenario.setStatus(ScenarioStatus.Underway.name()); @@ -354,15 +366,15 @@ public class HistoricalDataUpgradeService { mapper.updateByPrimaryKeySelective(scenario); } else { scenario = new ApiScenarioWithBLOBs(); - scenario.setId(oldScenario.getId()); - scenario.setName(oldScenario.getName()); + scenario.setId(id); + scenario.setName(name); scenario.setProjectId(saveHistoricalDataUpgrade.getProjectId()); scenario.setTags(scenario.getTags()); scenario.setLevel("P0"); scenario.setModulePath(saveHistoricalDataUpgrade.getModulePath()); scenario.setApiScenarioModuleId(saveHistoricalDataUpgrade.getModuleId()); scenario.setPrincipal(Objects.requireNonNull(SessionUtils.getUser()).getId()); - scenario.setStepTotal(oldScenario.getRequests().size()); + scenario.setStepTotal(total); scenario.setScenarioDefinition(scenarioDefinition); scenario.setCreateTime(System.currentTimeMillis()); scenario.setUpdateTime(System.currentTimeMillis()); @@ -386,7 +398,9 @@ public class HistoricalDataUpgradeService { for (ApiTest test : blobs) { // 附件迁移 createBodyFiles(test.getId()); - + // 把test 生成一个场景,旧场景数据变成引用步骤 + MsScenario scenarioTest = createScenarioByTest(test); + LinkedList listSteps = new LinkedList<>(); List scenarios = JSON.parseArray(test.getScenarioDefinition(), Scenario.class); if (CollectionUtils.isNotEmpty(scenarios)) { // 批量处理 @@ -394,9 +408,20 @@ public class HistoricalDataUpgradeService { MsScenario scenario1 = createScenario(scenario); String scenarioDefinition = JSON.toJSONString(scenario1); num++; - createApiScenarioWithBLOBs(saveHistoricalDataUpgrade, scenario, scenarioDefinition, mapper, num); + createApiScenarioWithBLOBs(saveHistoricalDataUpgrade, scenario.getId(), scenario.getName(), scenario.getRequests().size(), scenarioDefinition, mapper, num); + MsScenario step = new MsScenario(); + step.setId(scenario1.getId()); + step.setName(scenario1.getName()); + step.setType("scenario"); + step.setResourceId(UUID.randomUUID().toString()); + step.setReferenced("REF"); + listSteps.add(step); } } + num++; + scenarioTest.setHashTree(listSteps); + String scenarioDefinition = JSON.toJSONString(scenarioTest); + createApiScenarioWithBLOBs(saveHistoricalDataUpgrade, scenarioTest.getId(), scenarioTest.getName(), listSteps.size(), scenarioDefinition, mapper, num); } sqlSession.flushStatements(); return null; From d9a4a5bd2a9e0cda87c5a627ba6f644c9945dc3c Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Mon, 25 Jan 2021 18:17:37 +0800 Subject: [PATCH 30/33] =?UTF-8?q?refactor:=20=E5=9C=BA=E6=99=AF=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=BB=84=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/common/tableItems/plan/PlanStatusTableItem.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue b/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue index 0721190c41..caa447aae5 100644 --- a/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue +++ b/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue @@ -3,12 +3,14 @@ +