From f1e171f7c74067bf2cad2851d17b116e983fb0a5 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Fri, 30 Oct 2020 10:35:09 +0800 Subject: [PATCH 01/47] =?UTF-8?q?feat:=20=E8=AE=BE=E7=BD=AE=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit fcfc7a2615c1af7023a927abdbb7bd5b87248958) --- .../main/resources/db/migration/V41_modify_message_task_set.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 backend/src/main/resources/db/migration/V41_modify_message_task_set.sql diff --git a/backend/src/main/resources/db/migration/V41_modify_message_task_set.sql b/backend/src/main/resources/db/migration/V41_modify_message_task_set.sql new file mode 100644 index 0000000000..eacbd008d2 --- /dev/null +++ b/backend/src/main/resources/db/migration/V41_modify_message_task_set.sql @@ -0,0 +1,2 @@ +alter table message_task + add create_time bigint(13) default '0' null; \ No newline at end of file From 2b9fa28c0a70d85eb5daf5946c6259f923f6f5db Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Fri, 30 Oct 2020 10:45:38 +0800 Subject: [PATCH 02/47] =?UTF-8?q?feat:flyway=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit e9d13d89d9c4fb02aaea3dd23a1efe2fe56ee527) --- .../resources/db/migration/V41__modify_message_task_set.sql | 3 +++ .../resources/db/migration/V41_modify_message_task_set.sql | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 backend/src/main/resources/db/migration/V41__modify_message_task_set.sql delete mode 100644 backend/src/main/resources/db/migration/V41_modify_message_task_set.sql diff --git a/backend/src/main/resources/db/migration/V41__modify_message_task_set.sql b/backend/src/main/resources/db/migration/V41__modify_message_task_set.sql new file mode 100644 index 0000000000..3e41e45e93 --- /dev/null +++ b/backend/src/main/resources/db/migration/V41__modify_message_task_set.sql @@ -0,0 +1,3 @@ +alter table message_task + alter column create_time set default 0; + diff --git a/backend/src/main/resources/db/migration/V41_modify_message_task_set.sql b/backend/src/main/resources/db/migration/V41_modify_message_task_set.sql deleted file mode 100644 index eacbd008d2..0000000000 --- a/backend/src/main/resources/db/migration/V41_modify_message_task_set.sql +++ /dev/null @@ -1,2 +0,0 @@ -alter table message_task - add create_time bigint(13) default '0' null; \ No newline at end of file From 13fcac4f6a820fc40162e72799e85a95b665fbe9 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Fri, 30 Oct 2020 11:23:00 +0800 Subject: [PATCH 03/47] =?UTF-8?q?Revert=20"feat:=20=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC"=20flyway=20=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=B8=8D=E8=BF=9E=E7=BB=AD=EF=BC=8C=E5=9B=9E=E9=80=80=20This?= =?UTF-8?q?=20reverts=20commit=20f1e171f7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V41__modify_message_task_set.sql | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 backend/src/main/resources/db/migration/V41__modify_message_task_set.sql diff --git a/backend/src/main/resources/db/migration/V41__modify_message_task_set.sql b/backend/src/main/resources/db/migration/V41__modify_message_task_set.sql deleted file mode 100644 index 3e41e45e93..0000000000 --- a/backend/src/main/resources/db/migration/V41__modify_message_task_set.sql +++ /dev/null @@ -1,3 +0,0 @@ -alter table message_task - alter column create_time set default 0; - From a6b61959c26550dab4cdc19dfe6fdd655d8b9eb2 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 30 Oct 2020 11:42:37 +0800 Subject: [PATCH 04/47] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95)?= =?UTF-8?q?:=20=E7=8E=AF=E5=A2=83=E4=B8=AD=E5=8F=98=E9=87=8F=E5=A1=AB?= =?UTF-8?q?=E5=86=99=E6=A0=B7=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/api/test/components/ApiVariableInput.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/api/test/components/ApiVariableInput.vue b/frontend/src/business/components/api/test/components/ApiVariableInput.vue index f9319f713b..53059578a3 100644 --- a/frontend/src/business/components/api/test/components/ApiVariableInput.vue +++ b/frontend/src/business/components/api/test/components/ApiVariableInput.vue @@ -1,5 +1,5 @@ + + + Date: Wed, 4 Nov 2020 11:16:58 +0800 Subject: [PATCH 25/47] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95)?= =?UTF-8?q?:=20xpath=E6=96=AD=E8=A8=80=E4=BF=9D=E5=AD=98=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dto/scenario/assertions/Assertions.java | 2 +- .../api/test/components/assertion/ApiAssertions.vue | 2 +- .../api/test/components/assertion/ApiAssertionsEdit.vue | 6 +++--- .../business/components/api/test/model/ScenarioModel.js | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java index 5a7cac35a8..6a69b59f5a 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/assertions/Assertions.java @@ -9,6 +9,6 @@ public class Assertions { private List regex; private List jsonPath; private List jsr223; - private List xPath2; + private List xpath2; private AssertionDuration duration; } diff --git a/frontend/src/business/components/api/test/components/assertion/ApiAssertions.vue b/frontend/src/business/components/api/test/components/assertion/ApiAssertions.vue index 30d3042f66..b725443de4 100644 --- a/frontend/src/business/components/api/test/components/assertion/ApiAssertions.vue +++ b/frontend/src/business/components/api/test/components/assertion/ApiAssertions.vue @@ -17,7 +17,7 @@ - + diff --git a/frontend/src/business/components/api/test/components/assertion/ApiAssertionsEdit.vue b/frontend/src/business/components/api/test/components/assertion/ApiAssertionsEdit.vue index e46c3d2904..7ea45c873e 100644 --- a/frontend/src/business/components/api/test/components/assertion/ApiAssertionsEdit.vue +++ b/frontend/src/business/components/api/test/components/assertion/ApiAssertionsEdit.vue @@ -20,12 +20,12 @@ -
+
{{ 'XPath' }}
-
- +
diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index 0ca23c0749..e716d26e7c 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -742,11 +742,11 @@ export class Assertions extends BaseConfig { this.regex = []; this.jsonPath = []; this.jsr223 = []; - this.xPath2 = []; + this.xpath2 = []; this.duration = undefined; this.set(options); - this.sets({text: Text, regex: Regex, jsonPath: JSONPath, jsr223: AssertionJSR223, xPath2: XPath2}, options); + this.sets({text: Text, regex: Regex, jsonPath: JSONPath, jsr223: AssertionJSR223, xpath2: XPath2}, options); } initOptions(options) { @@ -1457,8 +1457,8 @@ class JMXGenerator { }) } - if (assertions.xPath2.length > 0) { - assertions.xPath2.filter(this.filter).forEach(item => { + if (assertions.xpath2.length > 0) { + assertions.xpath2.filter(this.filter).forEach(item => { httpSamplerProxy.put(this.getXpathAssertion(item)); }) } From 66fb90d8fb73be934a8166b2a719b7f7a758b3d7 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 4 Nov 2020 12:35:38 +0800 Subject: [PATCH 26/47] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA)?= =?UTF-8?q?:=20=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/track/service/TestCaseService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index b62e5e88df..fc176ad5e1 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -457,7 +457,7 @@ public class TestCaseService { if (t.getMethod().equals("manual")) { String steps = t.getSteps(); String setp = ""; - if (steps.contains("null")) { + if (steps.contains("null") && !steps.contains("\"null\"")) { setp = steps.replace("null", "\"\""); } else { setp = steps; From 24bae7736d1c05f71e8271c28040770cd9080150 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Wed, 4 Nov 2020 11:21:02 +0800 Subject: [PATCH 27/47] =?UTF-8?q?refactor(=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95):=20=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95=E7=94=9F?= =?UTF-8?q?=E6=88=90=E9=94=99=E8=AF=AF=E4=B9=8B=E5=90=8E=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/PerformanceTestService.java | 24 +++++++---- .../performance/service/ReportService.java | 2 +- .../websocket/ReportWebSocket.java | 20 +++++++-- .../report/PerformanceReportView.vue | 42 +++++++++++-------- .../report/PerformanceTestReport.vue | 5 +-- .../report/components/TestOverview.vue | 2 +- .../comonents/test/PerformanceTestResult.vue | 36 ++++++++-------- frontend/src/i18n/en-US.js | 2 +- frontend/src/i18n/zh-CN.js | 2 +- frontend/src/i18n/zh-TW.js | 2 +- 10 files changed, 82 insertions(+), 55 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 96b1123c33..2763afe0ac 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -419,18 +419,28 @@ public class PerformanceTestService { if (forceStop) { reportService.deleteReport(reportId); } else { - LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId); - LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(loadTestReport.getTestId()); - final Engine engine = EngineFactory.createEngine(loadTest); - if (engine == null) { - MSException.throwException(String.format("Stop report fail. create engine fail,report ID:%s", reportId)); - } - reportService.stopEngine(loadTest, engine); + stopEngine(reportId); // 停止测试之后设置报告的状态 reportService.updateStatus(reportId, PerformanceTestStatus.Completed.name()); } } + public void stopErrorTest(String reportId) { + stopEngine(reportId); + // 停止测试之后设置报告的状态 + reportService.updateStatus(reportId, PerformanceTestStatus.Error.name()); + } + + private void stopEngine(String reportId) { + LoadTestReport loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId); + LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(loadTestReport.getTestId()); + final Engine engine = EngineFactory.createEngine(loadTest); + if (engine == null) { + MSException.throwException(String.format("Stop report fail. create engine fail,report ID:%s", reportId)); + } + reportService.stopEngine(loadTest, engine); + } + public List listSchedule(QueryScheduleRequest request) { request.setEnable(true); List schedules = scheduleService.list(request); diff --git a/backend/src/main/java/io/metersphere/performance/service/ReportService.java b/backend/src/main/java/io/metersphere/performance/service/ReportService.java index d3a22c1b26..b50f6d4c23 100644 --- a/backend/src/main/java/io/metersphere/performance/service/ReportService.java +++ b/backend/src/main/java/io/metersphere/performance/service/ReportService.java @@ -241,7 +241,7 @@ public class ReportService { } } - public LoadTestReport getReport(String reportId) { + public LoadTestReportWithBLOBs getReport(String reportId) { return loadTestReportMapper.selectByPrimaryKey(reportId); } diff --git a/backend/src/main/java/io/metersphere/websocket/ReportWebSocket.java b/backend/src/main/java/io/metersphere/websocket/ReportWebSocket.java index 0cca799102..33c072fadf 100644 --- a/backend/src/main/java/io/metersphere/websocket/ReportWebSocket.java +++ b/backend/src/main/java/io/metersphere/websocket/ReportWebSocket.java @@ -1,8 +1,9 @@ package io.metersphere.websocket; -import io.metersphere.base.domain.LoadTestReport; +import io.metersphere.base.domain.LoadTestReportWithBLOBs; import io.metersphere.commons.constants.PerformanceTestStatus; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.performance.service.ReportService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -18,12 +19,18 @@ import java.io.IOException; public class ReportWebSocket { private static ReportService reportService; + private static PerformanceTestService performanceTestService; @Resource public void setReportService(ReportService reportService) { ReportWebSocket.reportService = reportService; } + @Resource + public void setPerformanceTestService(PerformanceTestService performanceTestService) { + ReportWebSocket.performanceTestService = performanceTestService; + } + /** * 开启连接的操作 */ @@ -78,12 +85,19 @@ public class ReportWebSocket { public void run() { while (stopMe) { try { - LoadTestReport report = reportService.getReport(reportId); - if (report == null || StringUtils.equalsAny(report.getStatus(), PerformanceTestStatus.Completed.name(), PerformanceTestStatus.Error.name())) { + LoadTestReportWithBLOBs report = reportService.getReport(reportId); + if (report == null || StringUtils.equalsAny(report.getStatus(), PerformanceTestStatus.Completed.name())) { this.stopMe(); session.close(); break; } + if (StringUtils.equals(report.getStatus(), PerformanceTestStatus.Error.name())) { + this.stopMe(); + session.getBasicRemote().sendText("Error: " + report.getDescription()); + performanceTestService.stopErrorTest(reportId); + session.close(); + break; + } if (!session.isOpen()) { return; } diff --git a/frontend/src/business/components/performance/report/PerformanceReportView.vue b/frontend/src/business/components/performance/report/PerformanceReportView.vue index 28ddde3387..0493330f33 100644 --- a/frontend/src/business/components/performance/report/PerformanceReportView.vue +++ b/frontend/src/business/components/performance/report/PerformanceReportView.vue @@ -23,11 +23,11 @@ {{ $t('report.test_execute_again') }} - {{$t('test_track.plan_view.export_report')}} + {{ $t('test_track.plan_view.export_report') }} - + @@ -65,7 +65,8 @@
- + @@ -91,8 +92,7 @@ import MsPerformancePressureConfig from "./components/PerformancePressureConfig" import MsContainer from "../../common/components/MsContainer"; import MsMainContainer from "../../common/components/MsMainContainer"; -import {checkoutTestManagerOrTestUser} from "@/common/js/utils"; -import {exportPdf} from "../../../../common/js/utils"; +import {checkoutTestManagerOrTestUser, exportPdf} from "@/common/js/utils"; import html2canvas from 'html2canvas'; import MsPerformanceReportExport from "./PerformanceReportExport"; @@ -188,7 +188,8 @@ export default { checkReportStatus(status) { switch (status) { case 'Error': - this.$warning(this.$t('report.generation_error')); + // this.$warning(this.$t('report.generation_error')); + this.active = '4'; break; case 'Starting': this.$alert(this.$t('report.start_status')); @@ -240,6 +241,11 @@ export default { }, onMessage(e) { this.$set(this.report, "refresh", e.data); // 触发刷新 + if (e.data.startsWith('Error')) { + this.$set(this.report, "status", 'Error'); + this.$warning(e.data); + return; + } this.$set(this.report, "status", 'Running'); this.status = 'Running'; this.initReportTimeInfo(); @@ -264,7 +270,7 @@ export default { setTimeout(() => { html2canvas(document.getElementById('performanceReportExport'), { scale: 2 - }).then(function(canvas) { + }).then(function (canvas) { exportPdf(name, [canvas]); reset(); }); @@ -332,18 +338,18 @@ export default { diff --git a/frontend/src/business/components/performance/report/PerformanceTestReport.vue b/frontend/src/business/components/performance/report/PerformanceTestReport.vue index 070c62dea2..03500cad62 100644 --- a/frontend/src/business/components/performance/report/PerformanceTestReport.vue +++ b/frontend/src/business/components/performance/report/PerformanceTestReport.vue @@ -180,10 +180,7 @@ export default { this.multipleSelection = val; }, handleEdit(report) { - if (report.status === "Error") { - this.$warning(this.$t('report.generation_error')); - return false - } else if (report.status === "Starting") { + if (report.status === "Starting") { this.$info(this.$t('report.being_generated')) return false } diff --git a/frontend/src/business/components/performance/report/components/TestOverview.vue b/frontend/src/business/components/performance/report/components/TestOverview.vue index d86d6cf26c..e000e5e5ff 100644 --- a/frontend/src/business/components/performance/report/components/TestOverview.vue +++ b/frontend/src/business/components/performance/report/components/TestOverview.vue @@ -114,7 +114,7 @@ export default { this.avgResponseTime = '0'; this.responseTime90 = '0'; this.avgBandwidth = '0'; - this.$warning(this.$t('report.generation_error')); + // this.$warning(this.$t('report.generation_error')); }) this.getLoadChart(); this.getResChart(); diff --git a/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue b/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue index fcbb1c6de3..46b2f6e11e 100644 --- a/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue +++ b/frontend/src/business/components/track/plan/view/comonents/test/PerformanceTestResult.vue @@ -57,24 +57,24 @@ diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index f6f172c645..fbada3651e 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit f6f172c6451d0f9c51f5e3246a66dde9edcd7a5d +Subproject commit fbada3651ec6a756d416485987e5b9e82a48e49e diff --git a/frontend/src/login/Login.vue b/frontend/src/login/Login.vue index e82767a312..b032a9bac1 100644 --- a/frontend/src/login/Login.vue +++ b/frontend/src/login/Login.vue @@ -4,15 +4,16 @@
- {{$t('commons.login')}} + {{ $t('commons.login') }} MeterSphere
- {{$t('commons.welcome')}} + {{ $t('commons.welcome') }}
@@ -32,241 +33,255 @@
- {{$t('commons.login')}} + {{ $t('commons.login') }}
- {{msg}} + {{ msg }}
- -
+ + + From 9aeed6b027a67aebe2771717efc2ee95444b9f51 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 5 Nov 2020 12:45:12 +0800 Subject: [PATCH 36/47] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE):=20=E6=98=BE=E7=A4=BA=E8=AE=BE=E7=BD=AEi18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/components/xpack | 2 +- frontend/src/i18n/en-US.js | 7 ++++++- frontend/src/i18n/zh-CN.js | 7 ++++++- frontend/src/i18n/zh-TW.js | 7 ++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index fbada3651e..119a689244 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit fbada3651ec6a756d416485987e5b9e82a48e49e +Subproject commit 119a6892443b634a30d0d599ea51274d3c412372 diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index aba963ed85..9d333f33fa 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -181,7 +181,12 @@ export default { expired: 'expired', }, display: { - title: 'Theme' + title: 'Theme', + logo: 'System LOGO', + loginLogo: 'Picture on the right side of the login page', + loginImage: 'Login page upper left corner LOGO', + loginTitle: 'Login page prompt information', + pageTitle: 'Page Title', }, system_config: { base_config: 'Base Config', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index ae58f1510c..6909421332 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -181,7 +181,12 @@ export default { expired: '已过期', }, display: { - title: '显示设置' + title: '显示设置', + logo: '系统 LOGO', + loginLogo: '登陆页面右侧图片', + loginImage: '登录页左上角 LOGO', + loginTitle: '登陆页面提示信息', + pageTitle: '页面 Title', }, system_config: { base_config: '基本配置', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 9427fd6e1d..80dd2fe1b0 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -181,7 +181,12 @@ export default { expired: '已過期', }, display: { - title: '顯示設置' + title: '顯示設置', + logo: '系統 LOGO', + loginLogo: '登陸頁面右側圖片', + loginImage: '登錄頁左上角 LOGO', + loginTitle: '登陸頁面提示信息', + pageTitle: '頁面 Title', }, system_config: { base_config: '基本配置', From 3a311dba44d2e56aeb7f43726f3342e5d8de4c4a Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 5 Nov 2020 14:31:24 +0800 Subject: [PATCH 37/47] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE):=20=E6=98=BE=E7=A4=BA=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/App.vue | 14 +++++--------- frontend/src/business/components/xpack | 2 +- frontend/src/login/Login.vue | 17 +++++++---------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/frontend/src/business/App.vue b/frontend/src/business/App.vue index ff55980514..3cdb8af86a 100644 --- a/frontend/src/business/App.vue +++ b/frontend/src/business/App.vue @@ -34,6 +34,7 @@ import {saveLocalStorage} from "@/common/js/utils"; const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); const header = requireComponent.keys().length > 0 ? requireComponent("./license/LicenseMessage.vue") : {}; +const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {}; export default { name: 'app', @@ -56,6 +57,10 @@ export default { if (header.default !== undefined) { this.licenseHeader = "LicenseMessage"; } + // 是否显示校验信息 + if (display.default !== undefined) { + display.default.valid(this); + } } else { window.location.href = "/login" } @@ -63,15 +68,6 @@ export default { window.location.href = "/login" }); }, - created() { - this.$get("/display/info", response => { - this.logoId = response.data[0].paramValue; - let title = response.data[4].paramValue; - if (title) { - document.title = title; - } - }) - }, components: { MsLanguageSwitch, MsUser, diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 119a689244..b9091a47b1 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 119a6892443b634a30d0d599ea51274d3c412372 +Subproject commit b9091a47b197faef77c72b134b7cf604fe3209f0 diff --git a/frontend/src/login/Login.vue b/frontend/src/login/Login.vue index b032a9bac1..7c4e25cf23 100644 --- a/frontend/src/login/Login.vue +++ b/frontend/src/login/Login.vue @@ -53,6 +53,8 @@ import {saveLocalStorage} from '@/common/js/utils'; import {DEFAULT_LANGUAGE} from "@/common/js/constants"; +const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/); +const display = requireComponent.keys().length > 0 ? requireComponent("./display/Display.vue") : {}; export default { name: "Login", @@ -91,6 +93,11 @@ export default { }, beforeCreate() { this.result = this.$get("/isLogin").then(response => { + + if (display.default !== undefined) { + display.default.valid(this); + } + if (!response.data.success) { if (response.data.message === 'sso') { window.location.href = "/sso/login" @@ -111,16 +118,6 @@ export default { created: function () { // 主页添加键盘事件,注意,不能直接在焦点事件上添加回车 document.addEventListener("keydown", this.watchEnter); - - this.result = this.$get("/display/info", response => { - this.loginLogoId = response.data[1].paramValue; - this.loginImageId = response.data[2].paramValue; - - let loginTitle = response.data[3].paramValue; - if (loginTitle) { - document.title = loginTitle; - } - }) }, destroyed() { From 1625bff625da419f231650aa7ac4c0704203e5d3 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 5 Nov 2020 14:41:13 +0800 Subject: [PATCH 38/47] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=97=B6=E5=BC=BA=E5=88=B6=E5=88=A0=E9=99=A4=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=8B=E7=9A=84=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/controller/APITestController.java | 5 ++--- .../io/metersphere/api/dto/DeleteAPITestRequest.java | 4 ++++ .../java/io/metersphere/api/service/APITestService.java | 7 +++++-- .../performance/service/PerformanceTestService.java | 4 +++- .../main/java/io/metersphere/service/ProjectService.java | 7 ++++++- .../track/request/testplan/DeleteTestPlanRequest.java | 9 +++++++++ backend/src/main/java/io/metersphere/xpack | 2 +- frontend/src/business/components/xpack | 2 +- 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/controller/APITestController.java b/backend/src/main/java/io/metersphere/api/controller/APITestController.java index 0b73d1f183..8a2beaab59 100644 --- a/backend/src/main/java/io/metersphere/api/controller/APITestController.java +++ b/backend/src/main/java/io/metersphere/api/controller/APITestController.java @@ -104,9 +104,8 @@ public class APITestController { @PostMapping("/delete") public void delete(@RequestBody DeleteAPITestRequest request) { - String testId = request.getId(); - checkownerService.checkApiTestOwner(testId); - apiTestService.delete(testId); + checkownerService.checkApiTestOwner(request.getId()); + apiTestService.delete(request); } @PostMapping(value = "/run") diff --git a/backend/src/main/java/io/metersphere/api/dto/DeleteAPITestRequest.java b/backend/src/main/java/io/metersphere/api/dto/DeleteAPITestRequest.java index c05e6d9f05..fa73ae004b 100644 --- a/backend/src/main/java/io/metersphere/api/dto/DeleteAPITestRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/DeleteAPITestRequest.java @@ -8,4 +8,8 @@ import lombok.Setter; public class DeleteAPITestRequest { private String id; + /** + * 是否强制删除(删除项目时不检查关联关系,强制删除资源) + */ + private boolean forceDelete = false; } diff --git a/backend/src/main/java/io/metersphere/api/service/APITestService.java b/backend/src/main/java/io/metersphere/api/service/APITestService.java index cc9238c205..9f4a96bd23 100644 --- a/backend/src/main/java/io/metersphere/api/service/APITestService.java +++ b/backend/src/main/java/io/metersphere/api/service/APITestService.java @@ -193,8 +193,11 @@ public class APITestService { return extApiTestMapper.getApiTestByProjectId(projectId); } - public void delete(String testId) { - testCaseService.checkIsRelateTest(testId); + public void delete(DeleteAPITestRequest request) { + String testId = request.getId(); + if (!request.isForceDelete()) { + testCaseService.checkIsRelateTest(testId); + } deleteFileByTestId(testId); apiReportService.deleteByTestId(testId); scheduleService.deleteByResourceId(testId); diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 251eda42c1..5bd56c5215 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -85,7 +85,9 @@ public class PerformanceTestService { public void delete(DeleteTestPlanRequest request) { String testId = request.getId(); - testCaseService.checkIsRelateTest(testId); + if (!request.isForceDelete()) { + testCaseService.checkIsRelateTest(testId); + } LoadTestReportExample loadTestReportExample = new LoadTestReportExample(); loadTestReportExample.createCriteria().andTestIdEqualTo(testId); diff --git a/backend/src/main/java/io/metersphere/service/ProjectService.java b/backend/src/main/java/io/metersphere/service/ProjectService.java index 292fbf8229..9354f3575d 100644 --- a/backend/src/main/java/io/metersphere/service/ProjectService.java +++ b/backend/src/main/java/io/metersphere/service/ProjectService.java @@ -1,5 +1,6 @@ package io.metersphere.service; +import io.metersphere.api.dto.DeleteAPITestRequest; import io.metersphere.api.dto.QueryAPITestRequest; import io.metersphere.api.service.APITestService; import io.metersphere.base.domain.LoadTest; @@ -96,6 +97,7 @@ public class ProjectService { loadTestIdList.forEach(loadTestId -> { DeleteTestPlanRequest deleteTestPlanRequest = new DeleteTestPlanRequest(); deleteTestPlanRequest.setId(loadTestId); + deleteTestPlanRequest.setForceDelete(true); performanceTestService.delete(deleteTestPlanRequest); }); @@ -122,7 +124,10 @@ public class ProjectService { QueryAPITestRequest request = new QueryAPITestRequest(); request.setProjectId(projectId); apiTestService.list(request).forEach(test -> { - apiTestService.delete(test.getId()); + DeleteAPITestRequest deleteAPITestRequest = new DeleteAPITestRequest(); + deleteAPITestRequest.setId(test.getId()); + deleteAPITestRequest.setForceDelete(true); + apiTestService.delete(deleteAPITestRequest); }); } diff --git a/backend/src/main/java/io/metersphere/track/request/testplan/DeleteTestPlanRequest.java b/backend/src/main/java/io/metersphere/track/request/testplan/DeleteTestPlanRequest.java index 25726bf29a..fff9accc2f 100644 --- a/backend/src/main/java/io/metersphere/track/request/testplan/DeleteTestPlanRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testplan/DeleteTestPlanRequest.java @@ -1,4 +1,13 @@ package io.metersphere.track.request.testplan; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter public class DeleteTestPlanRequest extends TestPlanRequest { + /** + * 是否强制删除(删除项目时不检查关联关系,强制删除资源) + */ + private boolean forceDelete = false; } diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 7238c00412..597a1681d1 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 7238c00412997c529a2a28a47956977ebf83aa13 +Subproject commit 597a1681d1327a622b2a38bac3f17ae9daf95442 diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index b9091a47b1..f6f172c645 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit b9091a47b197faef77c72b134b7cf604fe3209f0 +Subproject commit f6f172c6451d0f9c51f5e3246a66dde9edcd7a5d From e54bd0dc1481e52f543ac8da67fd537b1f42ef39 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Thu, 5 Nov 2020 14:54:39 +0800 Subject: [PATCH 39/47] =?UTF-8?q?fix:=20=E6=80=A7=E8=83=BD=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notice/PerformanceNoticeTask.java | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeTask.java b/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeTask.java index 2daeca53a3..5b041a02b4 100644 --- a/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeTask.java +++ b/backend/src/main/java/io/metersphere/performance/notice/PerformanceNoticeTask.java @@ -47,27 +47,26 @@ public class PerformanceNoticeTask { } public void registerNoticeTask(LoadTestReportWithBLOBs loadTestReport) { - executorService.submit(() -> { - while (isRunning) { - LoadTestReportWithBLOBs loadTestReportFromDatabase = loadTestReportMapper.selectByPrimaryKey(loadTestReport.getId()); - - if (StringUtils.equals(loadTestReportFromDatabase.getStatus(), PerformanceTestStatus.Completed.name())) { - isRunning = false; - sendSuccessNotice(loadTestReportFromDatabase); - return; - } - if (StringUtils.equals(loadTestReportFromDatabase.getStatus(), PerformanceTestStatus.Error.name())) { - isRunning = false; - sendFailNotice(loadTestReportFromDatabase); - return; - } - try { - Thread.sleep(1000 * 60);// 每分钟检查 loadtest 的状态 - } catch (InterruptedException e) { - LogUtil.error(e); - } + int count = 20; + while (count-- > 0) { + LoadTestReportWithBLOBs loadTestReportFromDatabase = loadTestReportMapper.selectByPrimaryKey(loadTestReport.getId()); + if (StringUtils.equals(loadTestReportFromDatabase.getStatus(), PerformanceTestStatus.Completed.name())) { + isRunning = false; + sendSuccessNotice(loadTestReportFromDatabase); + return; } - }); + if (StringUtils.equals(loadTestReportFromDatabase.getStatus(), PerformanceTestStatus.Error.name())) { + isRunning = false; + sendFailNotice(loadTestReportFromDatabase); + return; + } + count--; + try { + Thread.sleep(1000 * 4L);// 每分钟检查 loadtest 的状态 + } catch (InterruptedException e) { + LogUtil.error(e); + } + } } public void sendSuccessNotice(LoadTestReportWithBLOBs loadTestReport) { From b0ac3e021927ddf4591091c50a2ce2dba583fa58 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Thu, 5 Nov 2020 15:02:34 +0800 Subject: [PATCH 40/47] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE)?= =?UTF-8?q?:=E6=89=8B=E6=9C=BA=E5=8F=B7=E8=AE=BE=E7=BD=AE=E4=B8=BA?= =?UTF-8?q?=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/components/settings/system/User.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/business/components/settings/system/User.vue b/frontend/src/business/components/settings/system/User.vue index 52e51fd7f9..58f9ef44bc 100644 --- a/frontend/src/business/components/settings/system/User.vue +++ b/frontend/src/business/components/settings/system/User.vue @@ -368,8 +368,9 @@ export default { } ], phone: [ + {required: true, message: this.$t('user.input_phone'), trigger: 'blur'}, { - required: false, + required: true, pattern: '^1(3|4|5|7|8)\\d{9}$', message: this.$t('user.mobile_number_format_is_incorrect'), trigger: 'blur' From 31ee098a9cf26d0efefb02445fee5ecbe73c99a1 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 5 Nov 2020 15:15:46 +0800 Subject: [PATCH 41/47] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?):=20=E6=98=BE=E7=A4=BA=E8=AE=BE=E7=BD=AE=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=99=A8=E8=BF=87=E6=BB=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/io/metersphere/xpack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index 7238c00412..24047fea95 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit 7238c00412997c529a2a28a47956977ebf83aa13 +Subproject commit 24047fea950a74f7848a9fdaa857a22b884c4ce2 From 6e287d6188de6548e0bb83faee7e7a678dfc6b25 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Thu, 5 Nov 2020 15:30:38 +0800 Subject: [PATCH 42/47] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=B1=A0=E6=97=B6=E6=8F=90=E7=A4=BA=E5=93=AA=E4=BA=9B?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=AD=A3=E5=9C=A8=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/service/TestResourcePoolService.java | 10 ++++++++-- .../io/metersphere/track/service/TestCaseService.java | 2 +- .../src/main/resources/i18n/messages_en_US.properties | 3 ++- .../src/main/resources/i18n/messages_zh_CN.properties | 3 ++- .../src/main/resources/i18n/messages_zh_TW.properties | 3 ++- .../components/settings/system/TestResourcePool.vue | 1 - frontend/src/business/components/xpack | 2 +- 7 files changed, 16 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java b/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java index 8e0501e46a..6f487a37dd 100644 --- a/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java +++ b/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java @@ -73,8 +73,14 @@ public class TestResourcePoolService { LoadTestExample example = new LoadTestExample(); example.createCriteria() .andTestResourcePoolIdEqualTo(testResourcePoolId); - if (loadTestMapper.countByExample(example) > 0) { - MSException.throwException(Translator.get("test_resource_pool_is_use")); + List loadTests = loadTestMapper.selectByExample(example); + StringBuilder loadTestNames = new StringBuilder(); + if (loadTests.size() > 0) { + for (LoadTest loadTest : loadTests) { + loadTestNames = loadTestNames.append(loadTest.getName()).append(","); + } + String str = loadTestNames.substring(0, loadTestNames.length() - 1); + MSException.throwException(Translator.get("load_test") + " " + str + " " + Translator.get("test_resource_pool_is_use")); } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index fc176ad5e1..82c99bff35 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -546,7 +546,7 @@ public class TestCaseService { for (TestCase testCase : testCases) { caseName = caseName.append(testCase.getName()).append(","); } - String str = caseName.toString().substring(0, caseName.length() - 1); + String str = caseName.substring(0, caseName.length() - 1); MSException.throwException(Translator.get("related_case_del_fail_prefix") + " " + str + " " + Translator.get("related_case_del_fail_suffix")); } } diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 9c54d7b580..ea9fe501cc 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -57,7 +57,8 @@ workspace_not_exists=Workspace is not exists test_resource_pool_id_is_null=Test Resource Pool ID cannot be null test_resource_pool_name_is_null=Test Resource Pool name cannot be null test_resource_pool_name_already_exists=The test resource pool name already exists -test_resource_pool_is_use=The test resource pool is in use and cannot be deleted +load_test=Load Test +test_resource_pool_is_use=This resource pool is in use and cannot be deleted #project project_name_is_null=Project name cannot be null project_name_already_exists=The project name already exists diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index e321dcbcf3..7745c3acd2 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -57,7 +57,8 @@ workspace_not_exists=工作空间不存在 test_resource_pool_id_is_null=资源池ID不能为空 test_resource_pool_name_is_null=资源池名称不能为空 test_resource_pool_name_already_exists=资源池名称已存在 -test_resource_pool_is_use=资源池正在使用中,无法删除 +load_test=性能测试 +test_resource_pool_is_use=正在使用此资源池,无法删除 #project project_name_is_null=项目名称不能为空 project_name_already_exists=项目名称已存在 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index a1f7c77210..32411f615d 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -57,7 +57,8 @@ workspace_not_exists=工作空間不存在 test_resource_pool_id_is_null=資源池ID不能為空 test_resource_pool_name_is_null=資源池名稱不能為空 test_resource_pool_name_already_exists=資源池名稱已存在 -test_resource_pool_is_use=資源池正在使用中,無法刪除 +load_test=性能測試 +test_resource_pool_is_use=正在使用此資源池,無法刪除 #project project_name_is_null=項目名稱不能為空 project_name_already_exists=項目名稱已存在 diff --git a/frontend/src/business/components/settings/system/TestResourcePool.vue b/frontend/src/business/components/settings/system/TestResourcePool.vue index fe57e7d68a..a4d755dcff 100644 --- a/frontend/src/business/components/settings/system/TestResourcePool.vue +++ b/frontend/src/business/components/settings/system/TestResourcePool.vue @@ -295,7 +295,6 @@ export default { this.infoList = resources; }, del(row) { - window.console.log(row); this.$confirm(this.$t('test_resource_pool.delete_prompt'), this.$t('commons.prompt'), { confirmButtonText: this.$t('commons.confirm'), cancelButtonText: this.$t('commons.cancel'), diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index f6f172c645..b9091a47b1 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit f6f172c6451d0f9c51f5e3246a66dde9edcd7a5d +Subproject commit b9091a47b197faef77c72b134b7cf604fe3209f0 From 4f7768a8e0d39ec6dec1b1f95b42cff3b2bf2527 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 5 Nov 2020 16:28:39 +0800 Subject: [PATCH 43/47] =?UTF-8?q?feat(=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95?= =?UTF-8?q?):=20=E6=80=A7=E8=83=BD=E6=B5=8B=E8=AF=95=E6=94=AF=E6=8C=81jar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/commons/constants/FileType.java | 2 +- .../performance/engine/EngineContext.java | 10 ++++++++++ .../performance/engine/EngineFactory.java | 10 ++++++++++ .../engine/docker/DockerTestEngine.java | 1 + .../engine/docker/request/TestRequest.java | 1 + docker/jmeter-base/jmeter.properties | 2 +- .../test/components/PerformanceBasicConfig.vue | 14 ++++++++++---- frontend/src/business/components/xpack | 2 +- frontend/src/i18n/en-US.js | 2 +- frontend/src/i18n/zh-CN.js | 2 +- frontend/src/i18n/zh-TW.js | 2 +- 11 files changed, 38 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/commons/constants/FileType.java b/backend/src/main/java/io/metersphere/commons/constants/FileType.java index 47e522a607..191fa1f2cd 100644 --- a/backend/src/main/java/io/metersphere/commons/constants/FileType.java +++ b/backend/src/main/java/io/metersphere/commons/constants/FileType.java @@ -3,7 +3,7 @@ package io.metersphere.commons.constants; public enum FileType { JMX(".jmx"), CSV(".csv"), JSON(".json"), PDF(".pdf"), JPG(".jpg"), PNG(".png"), JPEG(".jpeg"), DOC(".doc"), - XLSX(".xlsx"), DOCX(".docx"); + XLSX(".xlsx"), DOCX(".docx"), JAR(".jar"); // 保存后缀 private String suffix; diff --git a/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java b/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java index f1c3e52ff2..4f13fd3fb6 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java +++ b/backend/src/main/java/io/metersphere/performance/engine/EngineContext.java @@ -17,6 +17,7 @@ public class EngineContext { private Map properties = new HashMap<>(); private Map testData = new HashMap<>(); private Map env = new HashMap<>(); + private Map testJars = new HashMap<>(); public String getTestId() { return testId; @@ -126,4 +127,13 @@ public class EngineContext { public void setResourceIndex(Integer resourceIndex) { this.resourceIndex = resourceIndex; } + + + public Map getTestJars() { + return testJars; + } + + public void setTestJars(Map testJars) { + this.testJars = testJars; + } } diff --git a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java index 835534dc39..478c79fa7d 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java +++ b/backend/src/main/java/io/metersphere/performance/engine/EngineFactory.java @@ -63,6 +63,7 @@ public class EngineFactory { }); List csvFiles = fileMetadataList.stream().filter(f -> StringUtils.equalsIgnoreCase(f.getType(), FileType.CSV.name())).collect(Collectors.toList()); + List jarFiles = fileMetadataList.stream().filter(f -> StringUtils.equalsIgnoreCase(f.getType(), FileType.JAR.name())).collect(Collectors.toList()); final FileContent fileContent = fileService.getFileContent(jmxFile.getId()); if (fileContent == null) { MSException.throwException(Translator.get("run_load_test_file_content_not_found") + loadTest.getId()); @@ -125,6 +126,15 @@ public class EngineFactory { engineContext.setTestData(data); } + if (CollectionUtils.isNotEmpty(jarFiles)) { + Map data = new HashMap<>(); + jarFiles.forEach(jf -> { + FileContent content = fileService.getFileContent(jf.getId()); + data.put(jf.getName(), content.getFile()); + }); + engineContext.setTestJars(data); + } + return engineContext; } diff --git a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java index 9a642bacc8..a10569ba51 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java +++ b/backend/src/main/java/io/metersphere/performance/engine/docker/DockerTestEngine.java @@ -83,6 +83,7 @@ public class DockerTestEngine extends AbstractEngine { testRequest.setFileString(content); testRequest.setImage(JMETER_IMAGE); testRequest.setTestData(context.getTestData()); + testRequest.setTestJars(context.getTestJars()); testRequest.setEnv(context.getEnv()); diff --git a/backend/src/main/java/io/metersphere/performance/engine/docker/request/TestRequest.java b/backend/src/main/java/io/metersphere/performance/engine/docker/request/TestRequest.java index b1bbf8684d..0b548a6e4f 100644 --- a/backend/src/main/java/io/metersphere/performance/engine/docker/request/TestRequest.java +++ b/backend/src/main/java/io/metersphere/performance/engine/docker/request/TestRequest.java @@ -14,4 +14,5 @@ public class TestRequest extends BaseRequest { private String image; private Map testData = new HashMap<>(); private Map env = new HashMap<>(); + private Map testJars = new HashMap<>(); } diff --git a/docker/jmeter-base/jmeter.properties b/docker/jmeter-base/jmeter.properties index e038326e9d..f3fea289f3 100644 --- a/docker/jmeter-base/jmeter.properties +++ b/docker/jmeter-base/jmeter.properties @@ -1215,7 +1215,7 @@ view.results.tree.renderers_order=.RenderAsText,.RenderAsRegexp,.RenderAsBoundar # All entries will be added to the class path of the system class loader # and also to the path of the JMeter internal loader. # Paths with spaces may cause problems for the JVM -#user.classpath=../classes;../lib +user.classpath=/test/ # List of directories (separated by ;) that JMeter will search for utility # and plugin dependency classes. diff --git a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue index a234d26d86..2990f731bc 100644 --- a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue @@ -1,7 +1,7 @@