testplan -> performance
This commit is contained in:
parent
1db8c03a42
commit
3612b9b2c7
|
@ -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<LoadTestDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
|
||||
Page<Object> 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<MultipartFile> 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<MultipartFile> 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.");
|
||||
}
|
|
@ -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<TestResource> 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<LoadTestWithBLOBs> loadTests = loadTestService.selectByTestResourcePoolId(loadTest.getTestResourcePoolId());
|
||||
List<LoadTestWithBLOBs> loadTests = performanceTestService.selectByTestResourcePoolId(loadTest.getTestResourcePoolId());
|
||||
// 使用当前资源池正在运行的测试占用的并发数
|
||||
return loadTests.stream()
|
||||
.filter(t -> TestStatus.Running.name().equals(t.getStatus()))
|
||||
|
|
|
@ -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
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@
|
|||
data() {
|
||||
return {
|
||||
result: {},
|
||||
queryPath: "/testplan/list",
|
||||
deletePath: "/testplan/delete",
|
||||
queryPath: "/performance/list",
|
||||
deletePath: "/performance/delete",
|
||||
condition: "",
|
||||
projectId: null,
|
||||
tableData: [],
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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: [],
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue