From 3612b9b2c7d72bd119e6b7bffb2b64c38b40261e Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Thu, 2 Apr 2020 17:59:01 +0800 Subject: [PATCH] testplan -> performance --- ...er.java => PerformanceTestController.java} | 26 +++++++++---------- .../io/metersphere/engine/AbstractEngine.java | 8 +++--- ...rvice.java => PerformanceTestService.java} | 2 +- .../plan/FunctionalRecentTestPlan.vue | 2 +- .../plan/EditPerformanceTestPlan.vue | 10 +++---- .../plan/PerformanceRecentTestPlan.vue | 2 +- .../performance/plan/PerformanceTestPlan.vue | 4 +-- .../components/PerformanceAdvancedConfig.vue | 2 +- .../components/PerformanceBasicConfig.vue | 6 ++--- .../components/PerformancePressureConfig.vue | 2 +- .../components/track/case/RecentCasePlan.vue | 2 +- 11 files changed, 33 insertions(+), 33 deletions(-) rename backend/src/main/java/io/metersphere/controller/{LoadTestController.java => PerformanceTestController.java} (82%) rename backend/src/main/java/io/metersphere/service/{LoadTestService.java => PerformanceTestService.java} (99%) diff --git a/backend/src/main/java/io/metersphere/controller/LoadTestController.java b/backend/src/main/java/io/metersphere/controller/PerformanceTestController.java similarity index 82% rename from backend/src/main/java/io/metersphere/controller/LoadTestController.java rename to backend/src/main/java/io/metersphere/controller/PerformanceTestController.java index ef7cd910de..0e50956747 100644 --- a/backend/src/main/java/io/metersphere/controller/LoadTestController.java +++ b/backend/src/main/java/io/metersphere/controller/PerformanceTestController.java @@ -10,7 +10,7 @@ import io.metersphere.commons.utils.Pager; import io.metersphere.controller.request.testplan.*; import io.metersphere.dto.LoadTestDTO; import io.metersphere.service.FileService; -import io.metersphere.service.LoadTestService; +import io.metersphere.service.PerformanceTestService; import io.metersphere.user.SessionUtils; import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.RequiresRoles; @@ -24,11 +24,11 @@ import javax.annotation.Resource; import java.util.List; @RestController -@RequestMapping(value = "/testplan") +@RequestMapping(value = "performance") @RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR) -public class LoadTestController { +public class PerformanceTestController { @Resource - private LoadTestService loadTestService; + private PerformanceTestService performanceTestService; @Resource private FileService fileService; @@ -38,14 +38,14 @@ public class LoadTestController { QueryTestPlanRequest request = new QueryTestPlanRequest(); request.setWorkspaceId(currentWorkspaceId); PageHelper.startPage(1, count, true); - return loadTestService.recentTestPlans(request); + return performanceTestService.recentTestPlans(request); } @PostMapping("/list/{goPage}/{pageSize}") public Pager> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) { Page page = PageHelper.startPage(goPage, pageSize, true); request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); - return PageUtils.setPageInfo(page, loadTestService.list(request)); + return PageUtils.setPageInfo(page, performanceTestService.list(request)); } @PostMapping(value = "/save", consumes = {"multipart/form-data"}) @@ -53,7 +53,7 @@ public class LoadTestController { @RequestPart("request") SaveTestPlanRequest request, @RequestPart(value = "file") List files ) { - return loadTestService.save(request, files); + return performanceTestService.save(request, files); } @PostMapping(value = "/edit", consumes = {"multipart/form-data"}) @@ -61,32 +61,32 @@ public class LoadTestController { @RequestPart("request") EditTestPlanRequest request, @RequestPart(value = "file", required = false) List files ) { - return loadTestService.edit(request, files); + return performanceTestService.edit(request, files); } @GetMapping("/get/{testId}") public LoadTestDTO get(@PathVariable String testId) { - return loadTestService.get(testId); + return performanceTestService.get(testId); } @GetMapping("/get-advanced-config/{testId}") public String getAdvancedConfiguration(@PathVariable String testId) { - return loadTestService.getAdvancedConfiguration(testId); + return performanceTestService.getAdvancedConfiguration(testId); } @GetMapping("/get-load-config/{testId}") public String getLoadConfiguration(@PathVariable String testId) { - return loadTestService.getLoadConfiguration(testId); + return performanceTestService.getLoadConfiguration(testId); } @PostMapping("/delete") public void delete(@RequestBody DeleteTestPlanRequest request) { - loadTestService.delete(request); + performanceTestService.delete(request); } @PostMapping("/run") public void run(@RequestBody RunTestPlanRequest request) { - boolean started = loadTestService.run(request); + boolean started = performanceTestService.run(request); if (!started) { MSException.throwException("Start engine error, please check log."); } diff --git a/backend/src/main/java/io/metersphere/engine/AbstractEngine.java b/backend/src/main/java/io/metersphere/engine/AbstractEngine.java index f04cc74747..cb90d08c1e 100644 --- a/backend/src/main/java/io/metersphere/engine/AbstractEngine.java +++ b/backend/src/main/java/io/metersphere/engine/AbstractEngine.java @@ -11,7 +11,7 @@ import io.metersphere.commons.constants.TestStatus; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.config.JmeterProperties; -import io.metersphere.service.LoadTestService; +import io.metersphere.service.PerformanceTestService; import io.metersphere.service.TestResourcePoolService; import io.metersphere.service.TestResourceService; import org.apache.commons.collections.CollectionUtils; @@ -25,7 +25,7 @@ public abstract class AbstractEngine implements Engine { private Long startTime; private String reportId; protected LoadTestWithBLOBs loadTest; - protected LoadTestService loadTestService; + protected PerformanceTestService performanceTestService; protected Integer threadNum; protected List resourceList; @@ -46,7 +46,7 @@ public abstract class AbstractEngine implements Engine { } this.loadTest = loadTest; - this.loadTestService = CommonBeanFactory.getBean(LoadTestService.class); + this.performanceTestService = CommonBeanFactory.getBean(PerformanceTestService.class); threadNum = getThreadNum(loadTest); String resourcePoolId = loadTest.getTestResourcePoolId(); @@ -67,7 +67,7 @@ public abstract class AbstractEngine implements Engine { } protected Integer getRunningThreadNum() { - List loadTests = loadTestService.selectByTestResourcePoolId(loadTest.getTestResourcePoolId()); + List loadTests = performanceTestService.selectByTestResourcePoolId(loadTest.getTestResourcePoolId()); // 使用当前资源池正在运行的测试占用的并发数 return loadTests.stream() .filter(t -> TestStatus.Running.name().equals(t.getStatus())) diff --git a/backend/src/main/java/io/metersphere/service/LoadTestService.java b/backend/src/main/java/io/metersphere/service/PerformanceTestService.java similarity index 99% rename from backend/src/main/java/io/metersphere/service/LoadTestService.java rename to backend/src/main/java/io/metersphere/service/PerformanceTestService.java index 0dcb7e04e3..e72024a14a 100644 --- a/backend/src/main/java/io/metersphere/service/LoadTestService.java +++ b/backend/src/main/java/io/metersphere/service/PerformanceTestService.java @@ -29,7 +29,7 @@ import java.util.stream.Collectors; @Service @Transactional(rollbackFor = Exception.class) -public class LoadTestService { +public class PerformanceTestService { private static final String HEADERS = "timestamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect"; @Resource diff --git a/frontend/src/business/components/functional/plan/FunctionalRecentTestPlan.vue b/frontend/src/business/components/functional/plan/FunctionalRecentTestPlan.vue index 83ed808bad..5df1992bcd 100644 --- a/frontend/src/business/components/functional/plan/FunctionalRecentTestPlan.vue +++ b/frontend/src/business/components/functional/plan/FunctionalRecentTestPlan.vue @@ -19,7 +19,7 @@ mounted() { if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) { - this.$get('/testplan/recent/5', (response) => { + this.$get('/performance/recent/5', (response) => { this.recentTestPlans = response.data; }); } diff --git a/frontend/src/business/components/performance/plan/EditPerformanceTestPlan.vue b/frontend/src/business/components/performance/plan/EditPerformanceTestPlan.vue index d8161a8e6b..660a22e1af 100644 --- a/frontend/src/business/components/performance/plan/EditPerformanceTestPlan.vue +++ b/frontend/src/business/components/performance/plan/EditPerformanceTestPlan.vue @@ -54,9 +54,9 @@ result: {}, testPlan: {}, listProjectPath: "/project/listAll", - savePath: "/testplan/save", - editPath: "/testplan/edit", - runPath: "/testplan/run", + savePath: "/performance/save", + editPath: "/performance/edit", + runPath: "/performance/run", projects: [], active: '0', tabs: [{ @@ -88,7 +88,7 @@ let testId = to.path.split('/')[4]; // find testId if (testId) { - this.result = this.$get('/testplan/get/' + testId, response => { + this.result = this.$get('/performance/get/' + testId, response => { if (response.data) { this.testPlan = response.data; } @@ -100,7 +100,7 @@ created() { let testId = this.$route.path.split('/')[4]; if (testId) { - this.result = this.$get('/testplan/get/' + testId, response => { + this.result = this.$get('/performance/get/' + testId, response => { this.testPlan = response.data; }); } diff --git a/frontend/src/business/components/performance/plan/PerformanceRecentTestPlan.vue b/frontend/src/business/components/performance/plan/PerformanceRecentTestPlan.vue index b93737b98d..0e9fb87e90 100644 --- a/frontend/src/business/components/performance/plan/PerformanceRecentTestPlan.vue +++ b/frontend/src/business/components/performance/plan/PerformanceRecentTestPlan.vue @@ -20,7 +20,7 @@ const roles = rolesString.split(','); if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) { - this.$get('/testplan/recent/5', (response) => { + this.$get('/performance/recent/5', (response) => { this.recentTestPlans = response.data; }); } diff --git a/frontend/src/business/components/performance/plan/PerformanceTestPlan.vue b/frontend/src/business/components/performance/plan/PerformanceTestPlan.vue index 6cd2c6dcd7..af02024be0 100644 --- a/frontend/src/business/components/performance/plan/PerformanceTestPlan.vue +++ b/frontend/src/business/components/performance/plan/PerformanceTestPlan.vue @@ -81,8 +81,8 @@ data() { return { result: {}, - queryPath: "/testplan/list", - deletePath: "/testplan/delete", + queryPath: "/performance/list", + deletePath: "/performance/delete", condition: "", projectId: null, tableData: [], diff --git a/frontend/src/business/components/performance/plan/components/PerformanceAdvancedConfig.vue b/frontend/src/business/components/performance/plan/components/PerformanceAdvancedConfig.vue index 060ac1c470..30e5749eb6 100644 --- a/frontend/src/business/components/performance/plan/components/PerformanceAdvancedConfig.vue +++ b/frontend/src/business/components/performance/plan/components/PerformanceAdvancedConfig.vue @@ -245,7 +245,7 @@ }); }, getAdvancedConfig(testId) { - this.$get('/testplan/get-advanced-config/' + testId, (response) => { + this.$get('/performance/get-advanced-config/' + testId, (response) => { if (response.data) { let data = JSON.parse(response.data); this.timeout = data.timeout || 10; diff --git a/frontend/src/business/components/performance/plan/components/PerformanceBasicConfig.vue b/frontend/src/business/components/performance/plan/components/PerformanceBasicConfig.vue index dce5d7a9ab..bbd72e93a7 100644 --- a/frontend/src/business/components/performance/plan/components/PerformanceBasicConfig.vue +++ b/frontend/src/business/components/performance/plan/components/PerformanceBasicConfig.vue @@ -58,9 +58,9 @@ data() { return { result: {}, - getFileMetadataPath: "/testplan/file/metadata", - jmxDownloadPath: '/testplan/file/download', - jmxDeletePath: '/testplan/file/delete', + getFileMetadataPath: "/performance/file/metadata", + jmxDownloadPath: '/performance/file/download', + jmxDeletePath: '/performance/file/delete', fileList: [], tableData: [], uploadList: [], diff --git a/frontend/src/business/components/performance/plan/components/PerformancePressureConfig.vue b/frontend/src/business/components/performance/plan/components/PerformancePressureConfig.vue index be8ffb0314..0addfca53c 100644 --- a/frontend/src/business/components/performance/plan/components/PerformancePressureConfig.vue +++ b/frontend/src/business/components/performance/plan/components/PerformancePressureConfig.vue @@ -155,7 +155,7 @@ getLoadConfig(testId) { if (testId) { - this.$get('/testplan/get-load-config/' + testId, (response) => { + this.$get('/performance/get-load-config/' + testId, (response) => { if (response.data) { let data = JSON.parse(response.data); diff --git a/frontend/src/business/components/track/case/RecentCasePlan.vue b/frontend/src/business/components/track/case/RecentCasePlan.vue index b93737b98d..0e9fb87e90 100644 --- a/frontend/src/business/components/track/case/RecentCasePlan.vue +++ b/frontend/src/business/components/track/case/RecentCasePlan.vue @@ -20,7 +20,7 @@ const roles = rolesString.split(','); if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) { - this.$get('/testplan/recent/5', (response) => { + this.$get('/performance/recent/5', (response) => { this.recentTestPlans = response.data; }); }