diff --git a/backend/pom.xml b/backend/pom.xml index c9458fb0af..32c84dedb0 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -133,12 +133,6 @@ opencsv 5.1 - - - org.apache.jmeter - ApacheJMeter_core - ${jmeter.version} - diff --git a/backend/src/main/java/io/metersphere/commons/utils/MsJMeterUtils.java b/backend/src/main/java/io/metersphere/commons/utils/MsJMeterUtils.java deleted file mode 100644 index 85a9b638f4..0000000000 --- a/backend/src/main/java/io/metersphere/commons/utils/MsJMeterUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package io.metersphere.commons.utils; - -import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.jmeter.util.JMeterUtils; -import org.apache.jorphan.util.JOrphanUtils; - -import java.io.InputStream; -import java.util.Properties; - -public class MsJMeterUtils { - /** - * Load the JMeter properties file; if not found, then - * default to "org/apache/jmeter/jmeter.properties" from the classpath - * - *

- * c.f. loadProperties - * - * @param file Name of the file from which the JMeter properties should be loaded - */ - public static void loadJMeterProperties(String file) { - InputStream is = null; - try { - JMeterUtils.loadJMeterProperties(file); - } catch (Exception e) { - try { - Properties p = new Properties(System.getProperties()); - // In jar file classpath is - is = ClassLoader.getSystemResourceAsStream( - "BOOT-INF/classes/org/apache/jmeter/jmeter.properties"); // $NON-NLS-1$ - if (is == null) { - throw new RuntimeException("Could not read JMeter properties file:" + file); - } - p.load(is); - - FieldUtils.writeStaticField(JMeterUtils.class, "appProperties", p, true); - } catch (Exception ex) { - throw new RuntimeException("Could not read JMeter properties file:" + file); - } - } finally { - JOrphanUtils.closeQuietly(is); - } - } - -} diff --git a/frontend/src/business/components/performance/report/PerformanceReportView.vue b/frontend/src/business/components/performance/report/PerformanceReportView.vue index 250af02f20..b739fca73c 100644 --- a/frontend/src/business/components/performance/report/PerformanceReportView.vue +++ b/frontend/src/business/components/performance/report/PerformanceReportView.vue @@ -132,17 +132,11 @@ this.status = data.status; switch (data.status) { case 'Error': - this.$message({ - type: 'warning', - message: "报告生成错误,无法查看!" - }); + this.$warning("报告生成错误,无法查看!"); break; case 'Starting': case 'Reporting': - this.$message({ - type: 'info', - message: "报告生成中...." - }); + this.$info("报告生成中...."); break; case 'Running': this.showTestLogging = true; diff --git a/frontend/src/business/components/performance/report/PerformanceTestReport.vue b/frontend/src/business/components/performance/report/PerformanceTestReport.vue index ed5095415a..78f7dbdd19 100644 --- a/frontend/src/business/components/performance/report/PerformanceTestReport.vue +++ b/frontend/src/business/components/performance/report/PerformanceTestReport.vue @@ -136,16 +136,10 @@ }, handleEdit(report) { if (report.status === "Error") { - this.$message({ - type: 'warning', - message: "报告生成错误,无法查看!" - }); + this.$warning("报告生成错误,无法查看!"); return false } else if (report.status === "Starting") { - this.$message({ - type: 'info', - message: "报告生成中..." - }); + this.$info("报告生成中...") return false } this.$router.push({ @@ -164,10 +158,7 @@ }, _handleDelete(report) { this.result = this.$post(this.deletePath + report.id, {}, () => { - this.$message({ - message: this.$t('commons.delete_success'), - type: 'success' - }); + this.$success(this.$t('commons.delete_success')); this.initTableData(); }); }, diff --git a/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue b/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue index da405548a5..a01ebb56c0 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTestPlan.vue @@ -125,10 +125,7 @@ let options = this.getSaveOption(); this.result = this.$request(options, () => { - this.$message({ - message: this.$t('commons.save_success'), - type: 'success' - }); + this.$success(this.$t('commons.save_success')); this.$refs.advancedConfig.cancelAllEdit(); this.$router.push({path: '/performance/test/all'}) }); @@ -142,16 +139,9 @@ this.result = this.$request(options, (response) => { this.testPlan.id = response.data; - this.$message({ - message: this.$t('commons.save_success'), - type: 'success' - }); - + this.$success(this.$t('commons.save_success')); this.result = this.$post(this.runPath, {id: this.testPlan.id}, () => { - this.$message({ - message: this.$t('load_test.is_running'), - type: 'success' - }); + this.$success(this.$t('load_test.is_running')) this.$router.push({path: '/performance/report/all'}) }) }); @@ -196,20 +186,12 @@ }, validTestPlan() { if (!this.testPlan.name) { - this.$message({ - message: this.$t('load_test.test_name_is_null'), - type: 'error' - }); - + this.$error(this.$t('load_test.test_name_is_null')); return false; } if (!this.testPlan.projectId) { - this.$message({ - message: this.$t('load_test.project_is_null'), - type: 'error' - }); - + this.$error(this.$t('load_test.project_is_null')); return false; } diff --git a/frontend/src/business/components/performance/test/PerformanceTestPlan.vue b/frontend/src/business/components/performance/test/PerformanceTestPlan.vue index 1521b3ddcf..c1abc82e2c 100644 --- a/frontend/src/business/components/performance/test/PerformanceTestPlan.vue +++ b/frontend/src/business/components/performance/test/PerformanceTestPlan.vue @@ -167,10 +167,7 @@ }; this.result = this.$post(this.deletePath, data, () => { - this.$message({ - message: this.$t('commons.delete_success'), - type: 'success' - }); + this.$success(this.$t('commons.delete_success')); this.initTableData(); }); }, diff --git a/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue index 30e5749eb6..85d36b88aa 100644 --- a/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformanceAdvancedConfig.vue @@ -306,23 +306,23 @@ let counts = this.groupBy(this.domains, 'domain'); for (let c in counts) { if (counts[c] > 1) { - this.$message.error(this.$t('load_test.domain_is_duplicate')); + this.$error(this.$t('load_test.domain_is_duplicate')); return false; } } counts = this.groupBy(this.params, 'name'); for (let c in counts) { if (counts[c] > 1) { - this.$message.error(this.$t('load_test.param_is_duplicate')); + this.$error(this.$t('load_test.param_is_duplicate')); return false; } } if (this.domains.filter(d => !d.domain || !d.ip).length > 0) { - this.$message.error(this.$t('load_test.domain_ip_is_empty')); + this.$error(this.$t('load_test.domain_ip_is_empty')); return false; } if (this.params.filter(d => !d.name || !d.value).length > 0) { - this.$message.error(this.$t('load_test.param_name_value_is_empty')); + this.$error(this.$t('load_test.param_name_value_is_empty')); return false; } return true; diff --git a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue index a0417e70b5..ed5e55a26c 100644 --- a/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformanceBasicConfig.vue @@ -107,7 +107,7 @@ } if (this.tableData.filter(f => f.name === file.name).length > 0) { - this.$message.error(this.$t('load_test.delete_file')); + this.$error(this.$t('load_test.delete_file')); return false; } @@ -175,7 +175,7 @@ } }, handleExceed() { - this.$message.error(this.$t('load_test.delete_file')); + this.$error(this.$t('load_test.delete_file')); }, fileValidator(file) { /// todo: 是否需要对文件内容和大小做限制 @@ -193,10 +193,7 @@ oldJmxNum = this.fileList.filter(f => f.name.toLowerCase().endsWith(".jmx")).length; } if (newJmxNum + oldJmxNum !== 1) { - this.$message({ - message: this.$t('load_test.jmx_is_null'), - type: 'error' - }); + this.$error(this.$t('load_test.jmx_is_null')); return false; } return true; diff --git a/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue index ec566028ca..6363dae7b5 100644 --- a/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/test/components/PerformancePressureConfig.vue @@ -281,10 +281,7 @@ }, validConfig() { if (!this.resourcePool) { - this.$message({ - message: this.$t('load_test.resource_pool_is_null'), - type: 'warning' - }); + this.$warning(this.$t('load_test.resource_pool_is_null')); return false; } diff --git a/frontend/src/business/components/project/MsProject.vue b/frontend/src/business/components/project/MsProject.vue index 72c012e6df..ae903fcc7f 100644 --- a/frontend/src/business/components/project/MsProject.vue +++ b/frontend/src/business/components/project/MsProject.vue @@ -107,10 +107,7 @@ create() { let workspaceId = this.currentUser.lastWorkspaceId; if (!workspaceId) { - this.$message({ - type: 'warning', - message: this.$t('project.please_choose_workspace') - }) + this.$warning(this.$t('project.please_choose_workspace')); return false; } this.title = this.$t('project.create'); diff --git a/frontend/src/business/components/settings/organization/OrganizationMember.vue b/frontend/src/business/components/settings/organization/OrganizationMember.vue index fe830ea069..b9814fa6b4 100644 --- a/frontend/src/business/components/settings/organization/OrganizationMember.vue +++ b/frontend/src/business/components/settings/organization/OrganizationMember.vue @@ -189,10 +189,7 @@ organizationId: this.currentUser().lastOrganizationId } this.result = this.$post("/organization/member/update", param, () => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')); this.updateVisible = false; this.initTableData(); }); @@ -204,26 +201,17 @@ type: 'warning' }).then(() => { this.result = this.$get('/user/org/member/delete/' + this.currentUser().lastOrganizationId + '/' + row.id, () => { - this.$message({ - type: 'success', - message: this.$t('commons.delete_success') - }); + this.$success(this.$t('commons.delete_success')); this.initTableData(); }); }).catch(() => { - this.$message({ - type: 'info', - message: this.$t('commons.delete_cancel') - }); + this.$info(this.$t('commons.delete_cancel')) }); }, create() { let orgId = this.currentUser().lastOrganizationId; if (!orgId) { - this.$message({ - type: 'warning', - message: this.$t('organization.select_organization') - }) + this.$warning(this.$t('organization.select_organization')); return false; } this.form = {}; diff --git a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue index 7d6e6010d3..504edb4192 100644 --- a/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue +++ b/frontend/src/business/components/settings/organization/OrganizationWorkspace.vue @@ -345,17 +345,11 @@ type: 'warning' }).then(() => { this.result = this.$get('/user/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + row.id, () => { - this.$message({ - type: 'success', - message: this.$t('commons.delete_success') - }); + this.$success(this.$t('commons.delete_success')); this.cellClick(this.currentWorkspaceRow); }); }).catch(() => { - this.$message({ - type: 'info', - message: this.$t('commons.delete_cancel') - }); + this.$info(this.$t('commons.delete_cancel')); }); }, updateOrgMember() { @@ -368,10 +362,7 @@ workspaceId: this.currentWorkspaceRow.id } this.result = this.$post("/workspace/member/update", param, () => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')); this.updateMemberVisible = false; this.cellClick(this.currentWorkspaceRow); }); diff --git a/frontend/src/business/components/settings/personal/PersonSetting.vue b/frontend/src/business/components/settings/personal/PersonSetting.vue index f2f905bcde..38282cc692 100644 --- a/frontend/src/business/components/settings/personal/PersonSetting.vue +++ b/frontend/src/business/components/settings/personal/PersonSetting.vue @@ -113,10 +113,7 @@ this.$refs[updateUserForm].validate(valide => { if (valide) { this.result = this.$post(this.updatePath, this.form,response => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')); localStorage.setItem(TokenKey, JSON.stringify(response.data)); this.updateVisible = false; this.initTableData(); diff --git a/frontend/src/business/components/settings/system/Organization.vue b/frontend/src/business/components/settings/system/Organization.vue index ac8660a698..33e3cd50ff 100644 --- a/frontend/src/business/components/settings/system/Organization.vue +++ b/frontend/src/business/components/settings/system/Organization.vue @@ -319,17 +319,11 @@ type: 'warning' }).then(() => { this.result = this.$get(this.deletePath + row.id, () => { - this.$message({ - type: 'success', - message: this.$t('commons.delete_success') - }); + this.$success(this.$t('commons.delete_success')); this.initTableData() }); }).catch(() => { - this.$message({ - type: 'info', - message: this.$t('commons.delete_cancel') - }); + this.$info(this.$t('commons.delete_cancel')); }); }, delMember(row) { @@ -339,27 +333,18 @@ type: 'warning' }).then(() => { this.result = this.$get('/user/special/org/member/delete/' + this.currentRow.id + '/' + row.id, () => { - this.$message({ - type: 'success', - message: this.$t('commons.delete_success') - }); + this.$success(this.$t('commons.delete_success')) this.cellClick(this.currentRow); }); }).catch(() => { - this.$message({ - type: 'info', - message: this.$t('commons.delete_cancel') - }); + this.$info(this.$t('commons.delete_cancel')); }); }, createOrganization(createOrganizationForm) { this.$refs[createOrganizationForm].validate(valide => { if (valide) { this.result = this.$post(this.createPath, this.form, () => { - this.$message({ - type: 'success', - message: this.$t('commons.save_success') - }); + this.$success(this.$t('commons.save_success')); this.initTableData(); this.createVisible = false; }); @@ -372,10 +357,7 @@ this.$refs[udpateOrganizationForm].validate(valide => { if (valide) { this.result = this.$post(this.updatePath, this.form, () => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')) this.updateVisible = false; this.initTableData(); }); @@ -442,10 +424,7 @@ organizationId: this.currentRow.id } this.result = this.$post("/organization/member/update", param, () => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')) this.updateMemberVisible = false; this.cellClick(this.currentRow); }); diff --git a/frontend/src/business/components/settings/system/SystemWorkspace.vue b/frontend/src/business/components/settings/system/SystemWorkspace.vue index f6c7cf0d05..5f51ee28b1 100644 --- a/frontend/src/business/components/settings/system/SystemWorkspace.vue +++ b/frontend/src/business/components/settings/system/SystemWorkspace.vue @@ -296,10 +296,7 @@ this.$refs[updateForm].validate(valide => { if (valide) { this.result = this.$post("/workspace/special/update", this.form, () => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')); this.updateVisible = false; this.list(); }); @@ -388,17 +385,11 @@ type: 'warning' }).then(() => { this.result = this.$get('/user/special/ws/member/delete/' + this.currentWorkspaceRow.id + '/' + row.id, () => { - this.$message({ - type: 'success', - message: this.$t('commons.delete_success') - }); + this.$success(this.$t('commons.delete_success')); this.cellClick(this.currentWorkspaceRow); }); }).catch(() => { - this.$message({ - type: 'info', - message: this.$t('commons.delete_cancel') - }); + this.$info(this.$t('commons.delete_cancel')); }); }, updateOrgMember() { @@ -411,10 +402,7 @@ workspaceId: this.currentWorkspaceRow.id } this.result = this.$post("/workspace/member/update", param, () => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')); this.updateMemberVisible = false; this.cellClick(this.currentWorkspaceRow); }); diff --git a/frontend/src/business/components/settings/system/TestResourcePool.vue b/frontend/src/business/components/settings/system/TestResourcePool.vue index 36920f52d2..f10f2906f2 100644 --- a/frontend/src/business/components/settings/system/TestResourcePool.vue +++ b/frontend/src/business/components/settings/system/TestResourcePool.vue @@ -280,10 +280,7 @@ if (this.infoList.length > 1) { this.infoList.splice(index, 1) } else { - this.$message({ - type: 'warning', - message: this.$t('test_resource_pool.cannot_remove_all_node') - }); + this.$warning(this.$t('test_resource_pool.cannot_remove_all_node')) } }, validateResourceInfo() { @@ -341,15 +338,9 @@ this.result = this.$get(`/testresourcepool/delete/${row.id}`).then(() => { this.initTableData(); }); - this.$message({ - type: 'success', - message: this.$t('commons.delete_success') - }); + this.$success(this.$t('commons.delete_success')); }).catch(() => { - this.$message({ - type: 'info', - message: this.$t('commons.delete_cancel') - }); + this.$info(this.$t('commons.delete_cancel')); }); }, createTestResourcePool(createTestResourcePoolForm) { @@ -370,10 +361,7 @@ this.initTableData()); }); } else { - this.$message({ - type: 'warning', - message: vri.msg - }); + this.$warning(vri.msg); return false; } @@ -413,10 +401,7 @@ self.loading = false); }); } else { - this.$message({ - type: 'warning', - message: vri.msg - }); + this.$warning(vri.msg); return false; } } else { @@ -429,10 +414,7 @@ }, changeSwitch(row) { this.result = this.$post('/testresourcepool/update', row).then(() => { - this.$message({ - type: 'success', - message: this.$t('test_resource_pool.status_change_success') - }); + this.$success(this.$t('test_resource_pool.status_change_success')); }) } } diff --git a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue index 22b45de4b0..715bff670c 100644 --- a/frontend/src/business/components/settings/workspace/WorkspaceMember.vue +++ b/frontend/src/business/components/settings/workspace/WorkspaceMember.vue @@ -185,16 +185,10 @@ this.initTableData(); this.loading = false; }); - this.$message({ - type: 'success', - message: this.$t('commons.delete_success') - }); + this.$success(this.$t('commons.delete_success')); }).catch(() => { this.loading = false; - this.$message({ - type: 'info', - message: this.$t('commons.delete_cancel') - }); + this.$info(this.$t('commons.delete_cancel')); }); }, edit(row) { @@ -217,10 +211,7 @@ workspaceId: this.currentUser().lastWorkspaceId } this.result = this.$post("/workspace/member/update", param, () => { - this.$message({ - type: 'success', - message: this.$t('commons.modify_success') - }); + this.$success(this.$t('commons.modify_success')); this.updateVisible = false; this.initTableData(); }); @@ -233,10 +224,7 @@ }; let wsId = this.currentUser().lastWorkspaceId; if (typeof wsId == "undefined" || wsId == null || wsId == "") { - this.$message({ - message: '请先选择工作空间!', - type: 'warning' - }); + this.$warning("请先选择工作空间!"); return false; } this.$post('/user/org/member/list/all', param, response => {