fix: 解决冲突
This commit is contained in:
commit
1b8291bf0d
|
@ -1,6 +1,6 @@
|
|||
[submodule "backend/src/main/java/io/metersphere/xpack"]
|
||||
path = backend/src/main/java/io/metersphere/xpack
|
||||
url = https://github.com/metersphere/xpack-backend.git
|
||||
url = git@github.com:metersphere/xpack-backend.git
|
||||
[submodule "frontend/src/business/components/xpack"]
|
||||
path = frontend/src/business/components/xpack
|
||||
url = https://github.com/metersphere/xpack-frontend.git
|
||||
url = git@github.com:metersphere/xpack-frontend.git
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'metersphere'
|
||||
}
|
||||
}
|
||||
options { quietPeriod(600) }
|
||||
parameters {
|
||||
string(name: 'IMAGE_NAME', defaultValue: 'metersphere', description: '构建后的 Docker 镜像名称')
|
||||
string(name: 'IMAGE_FREFIX', defaultValue: 'registry.cn-qingdao.aliyuncs.com/metersphere', description: '构建后的 Docker 镜像带仓库名的前缀')
|
||||
}
|
||||
stages {
|
||||
stage('Build/Test') {
|
||||
steps {
|
||||
configFileProvider([configFile(fileId: 'metersphere-maven', targetLocation: 'settings.xml')]) {
|
||||
sh "mvn clean package --settings ./settings.xml"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Docker build & push') {
|
||||
steps {
|
||||
sh "docker build --build-arg MS_VERSION=\${TAG_NAME:-\$BRANCH_NAME}-b\${BUILD_NUMBER} -t ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ."
|
||||
sh "docker tag ${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME} ${IMAGE_FREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
|
||||
sh "docker push ${IMAGE_FREFIX}/${IMAGE_NAME}:\${TAG_NAME:-\$BRANCH_NAME}"
|
||||
}
|
||||
}
|
||||
}
|
||||
post('Notification') {
|
||||
always {
|
||||
sh "echo \$WEBHOOK\n"
|
||||
withCredentials([string(credentialsId: 'wechat-bot-webhook', variable: 'WEBHOOK')]) {
|
||||
qyWechatNotification failSend: true, mentionedId: '', mentionedMobile: '', webhookUrl: "$WEBHOOK"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -379,6 +379,12 @@
|
|||
<artifactId>reflections8</artifactId>
|
||||
<version>0.11.7</version>
|
||||
</dependency>
|
||||
<!-- k8s client -->
|
||||
<dependency>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>kubernetes-client</artifactId>
|
||||
<version>4.13.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -2,10 +2,10 @@ package io.metersphere.api.controller;
|
|||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.APIReportResult;
|
||||
import io.metersphere.api.dto.DeleteAPIReportRequest;
|
||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import io.metersphere.api.dto.automation.ExecuteType;
|
||||
import io.metersphere.api.service.ApiScenarioReportService;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
|
@ -27,8 +27,8 @@ public class APIScenarioReportController {
|
|||
private ApiScenarioReportService apiReportService;
|
||||
|
||||
@GetMapping("/get/{reportId}/{infoDb}")
|
||||
public APIReportResult get(@PathVariable String reportId,@PathVariable Boolean infoDb) {
|
||||
if(infoDb){
|
||||
public APIScenarioReportResult get(@PathVariable String reportId, @PathVariable Boolean infoDb) {
|
||||
if (infoDb) {
|
||||
return apiReportService.get(reportId);
|
||||
}
|
||||
return apiReportService.getCacheResult(reportId);
|
||||
|
@ -44,12 +44,14 @@ public class APIScenarioReportController {
|
|||
@PostMapping("/add")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public String add(@RequestBody APIScenarioReportResult node) {
|
||||
return apiReportService.add(node);
|
||||
node.setExecuteType(ExecuteType.Saved.name());
|
||||
return apiReportService.save(node);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public String update(@RequestBody APIScenarioReportResult node) {
|
||||
node.setExecuteType(ExecuteType.Saved.name());
|
||||
return apiReportService.update(node);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,153 +1,297 @@
|
|||
package io.metersphere.api.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.*;
|
||||
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
|
||||
import io.metersphere.api.service.APITestService;
|
||||
import io.metersphere.base.domain.ApiTest;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||
import io.metersphere.dto.ScheduleDao;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/api")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||
public class APITestController {
|
||||
@Resource
|
||||
private APITestService apiTestService;
|
||||
@Resource
|
||||
private CheckOwnerService checkownerService;
|
||||
|
||||
@GetMapping("recent/{count}")
|
||||
public List<APITestResult> recentTest(@PathVariable int count) {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
QueryAPITestRequest request = new QueryAPITestRequest();
|
||||
request.setWorkspaceId(currentWorkspaceId);
|
||||
request.setUserId(SessionUtils.getUserId());
|
||||
PageHelper.startPage(1, count, true);
|
||||
return apiTestService.recentTest(request);
|
||||
}
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<APITestResult>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryAPITestRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return PageUtils.setPageInfo(page, apiTestService.list(request));
|
||||
}
|
||||
|
||||
@PostMapping("/list/ids")
|
||||
public List<ApiTest> listByIds(@RequestBody QueryAPITestRequest request) {
|
||||
return apiTestService.listByIds(request);
|
||||
}
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiTest> list(@PathVariable String projectId) {
|
||||
checkownerService.checkProjectOwner(projectId);
|
||||
return apiTestService.getApiTestByProjectId(projectId);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/schedule/update")
|
||||
public void updateSchedule(@RequestBody Schedule request) {
|
||||
apiTestService.updateSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/schedule/create")
|
||||
public void createSchedule(@RequestBody Schedule request) {
|
||||
apiTestService.createSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
public void create(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
apiTestService.create(request, file, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/create/merge", consumes = {"multipart/form-data"})
|
||||
public void mergeCreate(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "selectIds") List<String> selectIds) {
|
||||
apiTestService.mergeCreate(request, file, selectIds);
|
||||
}
|
||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
public void update(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
checkownerService.checkApiTestOwner(request.getId());
|
||||
apiTestService.update(request, file, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/copy")
|
||||
public void copy(@RequestBody SaveAPITestRequest request) {
|
||||
apiTestService.copy(request);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{testId}")
|
||||
public APITestResult get(@PathVariable String testId) {
|
||||
checkownerService.checkApiTestOwner(testId);
|
||||
return apiTestService.get(testId);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestBody DeleteAPITestRequest request) {
|
||||
checkownerService.checkApiTestOwner(request.getId());
|
||||
apiTestService.delete(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run")
|
||||
public String run(@RequestBody SaveAPITestRequest request) {
|
||||
return apiTestService.run(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run/debug", consumes = {"multipart/form-data"})
|
||||
public String runDebug(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
return apiTestService.runDebug(request, file, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/checkName")
|
||||
public void checkName(@RequestBody SaveAPITestRequest request) {
|
||||
apiTestService.checkName(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/import", consumes = {"multipart/form-data"})
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public ApiTest testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) {
|
||||
return apiTestService.apiTestImport(file, request);
|
||||
}
|
||||
|
||||
@PostMapping("/dubbo/providers")
|
||||
public List<DubboProvider> getProviders(@RequestBody RegistryCenter registry) {
|
||||
return apiTestService.getProviders(registry);
|
||||
}
|
||||
|
||||
@PostMapping("/list/schedule/{goPage}/{pageSize}")
|
||||
public List<ScheduleDao> listSchedule(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return apiTestService.listSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping("/list/schedule")
|
||||
public List<ScheduleDao> listSchedule(@RequestBody QueryScheduleRequest request) {
|
||||
return apiTestService.listSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping("/getJsonPaths")
|
||||
public List<HashMap> getJsonPaths(@RequestBody QueryJsonPathRequest request) {
|
||||
return getListJson(request.getJsonPath());
|
||||
}
|
||||
}
|
||||
package io.metersphere.api.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.*;
|
||||
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.dataCount.ExecutedCaseInfoResult;
|
||||
import io.metersphere.api.dto.dataCount.request.ScheduleInfoRequest;
|
||||
import io.metersphere.api.dto.dataCount.response.ApiDataCountDTO;
|
||||
import io.metersphere.api.dto.dataCount.response.ExecutedCaseInfoDTO;
|
||||
import io.metersphere.api.dto.dataCount.response.TaskInfoResult;
|
||||
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
|
||||
import io.metersphere.api.service.*;
|
||||
import io.metersphere.base.domain.ApiTest;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||
import io.metersphere.dto.ScheduleDao;
|
||||
import io.metersphere.service.CheckOwnerService;
|
||||
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/api")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
|
||||
public class APITestController {
|
||||
@Resource
|
||||
private APITestService apiTestService;
|
||||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
private CheckOwnerService checkownerService;
|
||||
@Resource
|
||||
private ApiTestCaseService apiTestCaseService;
|
||||
@Resource
|
||||
private ApiDefinitionExecResultService apiDefinitionExecResultService;
|
||||
@Resource
|
||||
private ApiAutomationService apiAutomationService;
|
||||
@Resource
|
||||
private ApiScenarioReportService apiScenarioReportService;
|
||||
@Resource
|
||||
private ScheduleService scheduleService;
|
||||
@Resource
|
||||
private APIReportService apiReportService;
|
||||
|
||||
@GetMapping("recent/{count}")
|
||||
public List<APITestResult> recentTest(@PathVariable int count) {
|
||||
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
|
||||
QueryAPITestRequest request = new QueryAPITestRequest();
|
||||
request.setWorkspaceId(currentWorkspaceId);
|
||||
request.setUserId(SessionUtils.getUserId());
|
||||
PageHelper.startPage(1, count, true);
|
||||
return apiTestService.recentTest(request);
|
||||
}
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<APITestResult>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryAPITestRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
request.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
return PageUtils.setPageInfo(page, apiTestService.list(request));
|
||||
}
|
||||
|
||||
@PostMapping("/list/ids")
|
||||
public List<ApiTest> listByIds(@RequestBody QueryAPITestRequest request) {
|
||||
return apiTestService.listByIds(request);
|
||||
}
|
||||
|
||||
@GetMapping("/list/{projectId}")
|
||||
public List<ApiTest> list(@PathVariable String projectId) {
|
||||
checkownerService.checkProjectOwner(projectId);
|
||||
return apiTestService.getApiTestByProjectId(projectId);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/schedule/update")
|
||||
public void updateSchedule(@RequestBody Schedule request) {
|
||||
apiTestService.updateSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/schedule/create")
|
||||
public void createSchedule(@RequestBody Schedule request) {
|
||||
apiTestService.createSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
public void create(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
apiTestService.create(request, file, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/create/merge", consumes = {"multipart/form-data"})
|
||||
public void mergeCreate(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "selectIds") List<String> selectIds) {
|
||||
apiTestService.mergeCreate(request, file, selectIds);
|
||||
}
|
||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
public void update(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
checkownerService.checkApiTestOwner(request.getId());
|
||||
apiTestService.update(request, file, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/copy")
|
||||
public void copy(@RequestBody SaveAPITestRequest request) {
|
||||
apiTestService.copy(request);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{testId}")
|
||||
public APITestResult get(@PathVariable String testId) {
|
||||
checkownerService.checkApiTestOwner(testId);
|
||||
return apiTestService.get(testId);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/delete")
|
||||
public void delete(@RequestBody DeleteAPITestRequest request) {
|
||||
checkownerService.checkApiTestOwner(request.getId());
|
||||
apiTestService.delete(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run")
|
||||
public String run(@RequestBody SaveAPITestRequest request) {
|
||||
return apiTestService.run(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run/debug", consumes = {"multipart/form-data"})
|
||||
public String runDebug(@RequestPart("request") SaveAPITestRequest request, @RequestPart(value = "file") MultipartFile file, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
return apiTestService.runDebug(request, file, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/checkName")
|
||||
public void checkName(@RequestBody SaveAPITestRequest request) {
|
||||
apiTestService.checkName(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/import", consumes = {"multipart/form-data"})
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public ApiTest testCaseImport(@RequestPart(value = "file", required = false) MultipartFile file, @RequestPart("request") ApiTestImportRequest request) {
|
||||
return apiTestService.apiTestImport(file, request);
|
||||
}
|
||||
|
||||
@PostMapping("/dubbo/providers")
|
||||
public List<DubboProvider> getProviders(@RequestBody RegistryCenter registry) {
|
||||
return apiTestService.getProviders(registry);
|
||||
}
|
||||
|
||||
@PostMapping("/list/schedule/{goPage}/{pageSize}")
|
||||
public List<ScheduleDao> listSchedule(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryScheduleRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return apiTestService.listSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping("/list/schedule")
|
||||
public List<ScheduleDao> listSchedule(@RequestBody QueryScheduleRequest request) {
|
||||
return apiTestService.listSchedule(request);
|
||||
}
|
||||
|
||||
@PostMapping("/getJsonPaths")
|
||||
public List<HashMap> getJsonPaths(@RequestBody QueryJsonPathRequest request) {
|
||||
return getListJson(request.getJsonPath());
|
||||
}
|
||||
|
||||
@GetMapping("/apiCount/{projectId}")
|
||||
public ApiDataCountDTO apiCount(@PathVariable String projectId) {
|
||||
|
||||
ApiDataCountDTO apiCountResult = new ApiDataCountDTO();
|
||||
|
||||
List<ApiDataCountResult> countResultList = apiDefinitionService.countProtocolByProjectID(projectId);
|
||||
apiCountResult.countByApiDefinitionCountResult(countResultList);
|
||||
|
||||
long dateCountByCreateInThisWeek = apiDefinitionService.countByProjectIDAndCreateInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekAddedCount(dateCountByCreateInThisWeek);
|
||||
|
||||
return apiCountResult;
|
||||
}
|
||||
|
||||
@GetMapping("/testCaseInfoCount/{projectId}")
|
||||
public ApiDataCountDTO testCaseInfoCount(@PathVariable String projectId) {
|
||||
ApiDataCountDTO apiCountResult = new ApiDataCountDTO();
|
||||
|
||||
List<ApiDataCountResult> countResultList = apiTestCaseService.countProtocolByProjectID(projectId);
|
||||
apiCountResult.countByApiDefinitionCountResult(countResultList);
|
||||
|
||||
long dateCountByCreateInThisWeek = apiTestCaseService.countByProjectIDAndCreateInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekAddedCount(dateCountByCreateInThisWeek);
|
||||
|
||||
long executedInThisWeekCountNumber = apiDefinitionExecResultService.countByTestCaseIDInProjectAndExecutedInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekExecutedCount(executedInThisWeekCountNumber);
|
||||
long executedCountNumber = apiDefinitionExecResultService.countByTestCaseIDInProject(projectId);
|
||||
apiCountResult.setExecutedCount(executedCountNumber);
|
||||
|
||||
return apiCountResult;
|
||||
}
|
||||
|
||||
@GetMapping("/testSceneInfoCount/{projectId}")
|
||||
public ApiDataCountDTO testSceneInfoCount(@PathVariable String projectId) {
|
||||
|
||||
ApiDataCountDTO apiCountResult = new ApiDataCountDTO();
|
||||
|
||||
long scenarioCountNumber = apiAutomationService.countScenarioByProjectID(projectId);
|
||||
apiCountResult.setAllApiDataCountNumber(scenarioCountNumber);
|
||||
|
||||
/**
|
||||
* 本周新增:通过测试场景的createTime
|
||||
* 本周执行: 查询(本周)生成的测试报告
|
||||
* 历史总执行:查询所有的测试报告
|
||||
* */
|
||||
long dateCountByCreateInThisWeek = apiAutomationService.countScenarioByProjectIDAndCreatInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekAddedCount(dateCountByCreateInThisWeek);
|
||||
long executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIDAndCreateInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekExecutedCount(executedInThisWeekCountNumber);
|
||||
long executedCountNumber = apiScenarioReportService.countByProjectID(projectId);
|
||||
apiCountResult.setExecutedCount(executedCountNumber);
|
||||
|
||||
return apiCountResult;
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/scheduleTaskInfoCount/{workSpaceID}")
|
||||
public ApiDataCountDTO scheduleTaskInfoCount(@PathVariable String workSpaceID) {
|
||||
ApiDataCountDTO apiCountResult = new ApiDataCountDTO();
|
||||
|
||||
long allTaskCount = scheduleService.countTaskByWorkspaceIdAndGroup(workSpaceID,ScheduleGroup.API_TEST.name());
|
||||
|
||||
apiCountResult.setAllApiDataCountNumber(allTaskCount);
|
||||
|
||||
long taskCountInThisWeek = scheduleService.countTaskByWorkspaceIdAndGroupInThisWeek(workSpaceID,ScheduleGroup.API_TEST.name());
|
||||
apiCountResult.setThisWeekAddedCount(taskCountInThisWeek);
|
||||
long executedInThisWeekCountNumber = apiReportService.countByWorkspaceIdAndGroupAndCreateInThisWeek(workSpaceID,ScheduleGroup.API_TEST.name());
|
||||
apiCountResult.setThisWeekExecutedCount(executedInThisWeekCountNumber);
|
||||
long executedCountNumber = apiReportService.countByWorkspaceIdAndGroup(workSpaceID,ScheduleGroup.API_TEST.name());
|
||||
apiCountResult.setExecutedCount(executedCountNumber);
|
||||
|
||||
return apiCountResult;
|
||||
}
|
||||
|
||||
@GetMapping("/faliureCaseAboutTestPlan/{projectId}/{limitNumber}")
|
||||
public List<ExecutedCaseInfoDTO> faliureCaseAboutTestPlan(@PathVariable String projectId, @PathVariable int limitNumber) {
|
||||
|
||||
List<ExecutedCaseInfoResult> selectDataList = apiDefinitionExecResultService.findFaliureCaseInfoByProjectIDAndLimitNumberInSevenDays(projectId,limitNumber);
|
||||
|
||||
List<ExecutedCaseInfoDTO> returnList = new ArrayList<>(limitNumber);
|
||||
|
||||
for(int dataIndex = 0;dataIndex < limitNumber;dataIndex ++){
|
||||
|
||||
ExecutedCaseInfoDTO dataDTO = new ExecutedCaseInfoDTO();
|
||||
dataDTO.setSortIndex(dataIndex+1);
|
||||
|
||||
if(dataIndex<selectDataList.size()){
|
||||
ExecutedCaseInfoResult selectData = selectDataList.get(dataIndex);
|
||||
|
||||
dataDTO.setCaseName(selectData.getCaseName());
|
||||
dataDTO.setTestPlan(selectData.getTestPlan());
|
||||
dataDTO.setFailureTimes(selectData.getFailureTimes());
|
||||
}else {
|
||||
dataDTO.setCaseName("");
|
||||
dataDTO.setTestPlan("");
|
||||
}
|
||||
returnList.add(dataDTO);
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
@GetMapping("/runningTask/{workspaceID}")
|
||||
public List<TaskInfoResult> runningTask(@PathVariable String workspaceID) {
|
||||
|
||||
List<TaskInfoResult> resultList = scheduleService.findRunningTaskInfoByWorkspaceID(workspaceID);
|
||||
for (TaskInfoResult taskInfo :
|
||||
resultList) {
|
||||
Date nextExecutionTime = CronUtils.getNextTriggerTime(taskInfo.getRule());
|
||||
if(nextExecutionTime!=null){
|
||||
taskInfo.setNextExecutionTime(nextExecutionTime.getTime());
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/schedule/updateEnableByPrimyKey")
|
||||
public void updateScheduleEnableByPrimyKey(@RequestBody ScheduleInfoRequest request) {
|
||||
Schedule schedule = scheduleService.getSchedule(request.getTaskID());
|
||||
schedule.setEnable(request.isEnable());
|
||||
apiTestService.updateSchedule(schedule);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.api.dto.automation.*;
|
|||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
import io.metersphere.api.service.ApiAutomationService;
|
||||
import io.metersphere.base.domain.ApiScenario;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.commons.constants.RoleConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
|
@ -59,8 +60,8 @@ public class ApiAutomationController {
|
|||
}
|
||||
|
||||
@PostMapping("/reduction")
|
||||
public void reduction(@RequestBody List<String> ids) {
|
||||
apiAutomationService.reduction(ids);
|
||||
public void reduction(@RequestBody List<SaveApiScenarioRequest> requests) {
|
||||
apiAutomationService.reduction(requests);
|
||||
}
|
||||
|
||||
@GetMapping("/getApiScenario/{id}")
|
||||
|
@ -69,17 +70,19 @@ public class ApiAutomationController {
|
|||
}
|
||||
|
||||
@PostMapping("/getApiScenarios")
|
||||
public List<ApiScenario> getApiScenarios(@RequestBody List<String> ids) {
|
||||
public List<ApiScenarioWithBLOBs> getApiScenarios(@RequestBody List<String> ids) {
|
||||
return apiAutomationService.getApiScenarios(ids);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run/debug")
|
||||
public void runDebug(@RequestPart("request") RunDefinitionRequest request, @RequestPart(value = "files") List<MultipartFile> bodyFiles) {
|
||||
request.setExecuteType(ExecuteType.Debug.name());
|
||||
apiAutomationService.run(request, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/run")
|
||||
public void run(@RequestBody RunScenarioRequest request) {
|
||||
request.setExecuteType(ExecuteType.Completed.name());
|
||||
apiAutomationService.run(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ public class ApiDefinitionController {
|
|||
}
|
||||
|
||||
@PostMapping("/reduction")
|
||||
public void reduction(@RequestBody List<String> ids) {
|
||||
apiDefinitionService.reduction(ids);
|
||||
public void reduction(@RequestBody List<SaveApiDefinitionRequest> requests) {
|
||||
apiDefinitionService.reduction(requests);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
|
|
|
@ -4,6 +4,8 @@ import io.metersphere.base.domain.ApiScenarioReport;
|
|||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class APIScenarioReportResult extends ApiScenarioReport {
|
||||
|
@ -12,7 +14,11 @@ public class APIScenarioReportResult extends ApiScenarioReport {
|
|||
|
||||
private String projectName;
|
||||
|
||||
private String testId;
|
||||
|
||||
private String userName;
|
||||
|
||||
private List<String> scenarioIds;
|
||||
|
||||
private String content;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
public enum ExecuteType {
|
||||
Saved, Completed, Debug
|
||||
}
|
|
@ -13,9 +13,13 @@ public class RunScenarioRequest {
|
|||
|
||||
private String reportId;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String environmentId;
|
||||
|
||||
private String triggerMode;
|
||||
|
||||
private String executeType;
|
||||
|
||||
private List<String> scenarioIds;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package io.metersphere.api.dto.dataCount;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* API数据统计查询结果类
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiDataCountResult {
|
||||
//分组统计字段
|
||||
private String groupField;
|
||||
//数据统计
|
||||
private long countNumber;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package io.metersphere.api.dto.dataCount;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 已执行的案例
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ExecutedCaseInfoResult {
|
||||
//案例名称
|
||||
private String caseName;
|
||||
//所属测试计划
|
||||
private String testPlan;
|
||||
//失败次数
|
||||
private Long failureTimes;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package io.metersphere.api.dto.dataCount.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author song.tianyang
|
||||
* @Date 2020/12/17 5:04 下午
|
||||
* @Description
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ScheduleInfoRequest {
|
||||
private String taskID;
|
||||
private boolean enable;
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package io.metersphere.api.dto.dataCount.response;
|
||||
|
||||
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||
import io.metersphere.base.domain.ApiDefinition;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 接口数据统计返回
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiDataCountDTO {
|
||||
|
||||
//接口统计
|
||||
private long allApiDataCountNumber = 0;
|
||||
//http接口统计
|
||||
private long httpApiDataCountNumber = 0;
|
||||
//rpc接口统计
|
||||
private long rpcApiDataCountNumber = 0;
|
||||
//tcp接口统计
|
||||
private long tcpApiDataCountNumber = 0;
|
||||
//sql接口统计
|
||||
private long sqlApiDataCountNumber = 0;
|
||||
|
||||
//本周新增数量
|
||||
private long thisWeekAddedCount = 0;
|
||||
//本周执行数量
|
||||
private long thisWeekExecutedCount = 0;
|
||||
//历史总执行数量
|
||||
private long executedCount = 0;
|
||||
|
||||
public ApiDataCountDTO(){}
|
||||
|
||||
/**
|
||||
* 通过ApiDefinitionCountResult统计查询结果进行数据合计
|
||||
* @param countResultList
|
||||
*/
|
||||
public void countByApiDefinitionCountResult(List<ApiDataCountResult> countResultList){
|
||||
for (ApiDataCountResult countResult :
|
||||
countResultList) {
|
||||
switch (countResult.getGroupField().toUpperCase()){
|
||||
case RequestType.DUBBO:
|
||||
this.rpcApiDataCountNumber += countResult.getCountNumber();
|
||||
break;
|
||||
case RequestType.HTTP:
|
||||
this.httpApiDataCountNumber += countResult.getCountNumber();
|
||||
break;
|
||||
case RequestType.SQL:
|
||||
this.sqlApiDataCountNumber += countResult.getCountNumber();
|
||||
break;
|
||||
case RequestType.TCP:
|
||||
this.tcpApiDataCountNumber += countResult.getCountNumber();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
allApiDataCountNumber += countResult.getCountNumber();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package io.metersphere.api.dto.dataCount.response;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 已执行的案例
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ExecutedCaseInfoDTO {
|
||||
//排名
|
||||
private int sortIndex;
|
||||
//案例名称
|
||||
private String caseName;
|
||||
//所属测试计划
|
||||
private String testPlan;
|
||||
//失败次数
|
||||
private Long failureTimes;
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package io.metersphere.api.dto.dataCount.response;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.python.antlr.ast.Str;
|
||||
|
||||
/**
|
||||
* 任务信息 返回DTO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class TaskInfoResult {
|
||||
//序号
|
||||
private int index;
|
||||
//任务ID
|
||||
private String taskID;
|
||||
//场景名称
|
||||
private String scenario;
|
||||
//规则
|
||||
private String rule;
|
||||
//任务状态
|
||||
private boolean taskStatus;
|
||||
//下次执行时间
|
||||
private Long nextExecutionTime;
|
||||
//创建人
|
||||
private String creator;
|
||||
//更新时间
|
||||
private Long updateTime;
|
||||
|
||||
}
|
|
@ -11,5 +11,6 @@ public class ApiTestCaseResult extends ApiTestCaseWithBLOBs {
|
|||
private String createUser;
|
||||
private String updateUser;
|
||||
private String execResult;
|
||||
private Long execTime;
|
||||
private boolean active = false;
|
||||
}
|
||||
|
|
|
@ -17,10 +17,14 @@ public class RunDefinitionRequest {
|
|||
|
||||
private String type;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String environmentId;
|
||||
|
||||
private MsTestElement testElement;
|
||||
|
||||
private String executeType;
|
||||
|
||||
private Response response;
|
||||
|
||||
private List<String> bodyUploadIds;
|
||||
|
|
|
@ -11,17 +11,17 @@ import io.metersphere.api.dto.scenario.KeyValue;
|
|||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.service.ApiAutomationService;
|
||||
import io.metersphere.api.service.ApiTestEnvironmentService;
|
||||
import io.metersphere.base.domain.ApiScenario;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.config.Arguments;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.apache.jmeter.config.Arguments;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -44,10 +44,14 @@ public class MsScenario extends MsTestElement {
|
|||
@JSONField(ordinal = 23)
|
||||
private List<KeyValue> variables;
|
||||
|
||||
@JSONField(ordinal = 24)
|
||||
private boolean enableCookieShare;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
config.setEnableCookieShare(enableCookieShare);
|
||||
if (StringUtils.isNotEmpty(environmentId)) {
|
||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
|
||||
|
@ -63,7 +67,7 @@ public class MsScenario extends MsTestElement {
|
|||
ApiAutomationService apiAutomationService = CommonBeanFactory.getBean(ApiAutomationService.class);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
ApiScenario scenario = apiAutomationService.getApiScenario(this.getId());
|
||||
ApiScenarioWithBLOBs scenario = apiAutomationService.getApiScenario(this.getId());
|
||||
JSONObject element = JSON.parseObject(scenario.getScenarioDefinition());
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
|
||||
});
|
||||
|
|
|
@ -101,7 +101,7 @@ public abstract class MsTestElement {
|
|||
return baos.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.warn("HashTree error, can't log jmx content");
|
||||
LogUtil.warn("HashTree error, can't log jmx scenarioDefinition");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.jmeter.control.LoopController;
|
||||
import org.apache.jmeter.protocol.http.control.CookieManager;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jmeter.threads.ThreadGroup;
|
||||
|
@ -17,9 +18,20 @@ import java.util.List;
|
|||
@JSONType(typeName = "ThreadGroup")
|
||||
public class MsThreadGroup extends MsTestElement {
|
||||
private String type = "ThreadGroup";
|
||||
private boolean enableCookieShare;
|
||||
|
||||
public void toHashTree(HashTree tree, List<MsTestElement> hashTree, ParameterConfig config) {
|
||||
final HashTree groupTree = tree.add(getThreadGroup());
|
||||
if ((config != null && config.isEnableCookieShare()) || enableCookieShare) {
|
||||
CookieManager cookieManager = new CookieManager();
|
||||
cookieManager.setProperty(TestElement.TEST_CLASS, CookieManager.class.getName());
|
||||
cookieManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("CookiePanel"));
|
||||
cookieManager.setEnabled(true);
|
||||
cookieManager.setName("CookieManager");
|
||||
cookieManager.setClearEachIteration(false);
|
||||
cookieManager.setControlledByThread(false);
|
||||
groupTree.add(cookieManager);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
hashTree.forEach(el -> {
|
||||
el.toHashTree(groupTree, el.getHashTree(), config);
|
||||
|
|
|
@ -12,4 +12,7 @@ public class ParameterConfig {
|
|||
private EnvironmentConfig config;
|
||||
// 公共场景参数
|
||||
private List<KeyValue> variables;
|
||||
// 公共Cookie
|
||||
private boolean enableCookieShare;
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.api.dto.definition.request.ParameterConfig;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.protocol.java.sampler.JSR223Sampler;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
|
@ -32,7 +33,11 @@ public class MsJSR223Processor extends MsTestElement {
|
|||
}
|
||||
JSR223Sampler processor = new JSR223Sampler();
|
||||
processor.setEnabled(true);
|
||||
processor.setName(this.getName() + "JSR223Processor");
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
processor.setName(this.getName());
|
||||
} else {
|
||||
processor.setName("JSR223Processor");
|
||||
}
|
||||
processor.setProperty(TestElement.TEST_CLASS, JSR223Sampler.class.getName());
|
||||
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
processor.setProperty("cacheKey", "true");
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.api.dto.definition.request.ParameterConfig;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.extractor.JSR223PostProcessor;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
|
@ -33,7 +34,11 @@ public class MsJSR223PostProcessor extends MsTestElement {
|
|||
}
|
||||
JSR223PostProcessor processor = new JSR223PostProcessor();
|
||||
processor.setEnabled(true);
|
||||
processor.setName(this.getName() + "JSR223PostProcessor");
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
processor.setName(this.getName());
|
||||
} else {
|
||||
processor.setName("JSR223PostProcessor");
|
||||
}
|
||||
processor.setProperty(TestElement.TEST_CLASS, JSR223PostProcessor.class.getName());
|
||||
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
processor.setProperty("cacheKey", "true");
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.api.dto.definition.request.ParameterConfig;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.modifiers.JSR223PreProcessor;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
|
@ -32,7 +33,11 @@ public class MsJSR223PreProcessor extends MsTestElement {
|
|||
}
|
||||
JSR223PreProcessor processor = new JSR223PreProcessor();
|
||||
processor.setEnabled(true);
|
||||
processor.setName(this.getName() + "JSR223PreProcessor");
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
processor.setName(this.getName());
|
||||
} else {
|
||||
processor.setName("JSR223PreProcessor");
|
||||
}
|
||||
processor.setProperty(TestElement.TEST_CLASS, JSR223PreProcessor.class.getName());
|
||||
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
processor.setProperty("cacheKey", "true");
|
||||
|
|
|
@ -162,6 +162,9 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
// 请求体
|
||||
if (!StringUtils.equals(this.getMethod(), "GET")) {
|
||||
List<KeyValue> bodyParams = this.body.getBodyParams(sampler, this.getId());
|
||||
if (this.body.getType().equals("Form Data")) {
|
||||
sampler.setDoMultipart(true);
|
||||
}
|
||||
sampler.setArguments(httpArguments(bodyParams));
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ public abstract class ApiImportAbstractParser implements ApiImportParser {
|
|||
// }
|
||||
// }
|
||||
// if (!hasContentType) {
|
||||
// headers.add(new KeyValue(key, value));
|
||||
// headers.save(new KeyValue(key, value));
|
||||
// }
|
||||
// request.setHeaders(headers);
|
||||
// }
|
||||
|
|
|
@ -26,7 +26,6 @@ import io.swagger.models.properties.Property;
|
|||
import io.swagger.models.properties.RefProperty;
|
||||
import io.swagger.parser.SwaggerParser;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
@ -80,7 +79,7 @@ public class Swagger2Parser extends ApiImportAbstractParser {
|
|||
headerManager.setName(res.getName() + "Postman MsHeaderManager");
|
||||
headerManager.setHeaders(res.getHeaders());
|
||||
// HashTree tree = new HashTree();
|
||||
// tree.add(headerManager);
|
||||
// tree.save(headerManager);
|
||||
LinkedList<MsTestElement> list = new LinkedList<>();
|
||||
list.add(headerManager);
|
||||
requestElement.setHashTree(list);
|
||||
|
|
|
@ -15,6 +15,7 @@ import io.metersphere.base.mapper.ext.ExtApiTestReportMapper;
|
|||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
|
@ -25,14 +26,12 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
@ -131,7 +130,7 @@ public class APIReportService {
|
|||
String startTime = jsonRequestResults.getJSONObject(j).getString("startTime");
|
||||
String name = jsonRequestResults.getJSONObject(j).getString("name");
|
||||
String url = jsonRequestResults.getJSONObject(j).getString("url");
|
||||
if (StringUtils.isBlank(url)){
|
||||
if (StringUtils.isBlank(url)) {
|
||||
//如果非http请求不入库
|
||||
continue;
|
||||
}
|
||||
|
@ -139,7 +138,7 @@ public class APIReportService {
|
|||
apiDataView.setId(UUID.randomUUID().toString());
|
||||
apiDataView.setReportId(reportId);
|
||||
apiDataView.setApiName(name);
|
||||
apiDataView.setUrl(StringUtils.substringBefore(url,"?"));
|
||||
apiDataView.setUrl(StringUtils.substringBefore(url, "?"));
|
||||
apiDataView.setResponseTime(responseTime);
|
||||
apiDataView.setStartTime(sdf.format(new Date(Long.parseLong(startTime))));
|
||||
apiDataView.setResponseCode(responseCode);
|
||||
|
@ -149,8 +148,9 @@ public class APIReportService {
|
|||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
apiDataViewMapper.insertListApiData(listApiDataView);
|
||||
|
||||
if (listApiDataView.size() > 0) {
|
||||
apiDataViewMapper.insertListApiData(listApiDataView);
|
||||
}
|
||||
}
|
||||
|
||||
public String create(ApiTest test, String triggerMode) {
|
||||
|
@ -210,4 +210,21 @@ public class APIReportService {
|
|||
apiTestReportExample.createCriteria().andIdIn(reportRequest.getIds());
|
||||
apiTestReportMapper.deleteByExample(apiTestReportExample);
|
||||
}
|
||||
|
||||
public long countByWorkspaceIdAndGroupAndCreateInThisWeek(String workspaceID, String group) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if(firstTime==null || lastTime == null){
|
||||
return 0;
|
||||
}else {
|
||||
return extApiTestReportMapper.countByProjectIDAndCreateInThisWeek(workspaceID,group,firstTime.getTime(),lastTime.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
public long countByWorkspaceIdAndGroup(String workspaceID, String group) {
|
||||
return extApiTestReportMapper.countByWorkspaceIdAndGroup(workspaceID,group);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.alibaba.nacos.client.utils.StringUtils;
|
||||
import io.github.ningyu.jmeter.plugin.dubbo.sample.ProviderService;
|
||||
import io.metersphere.api.dto.*;
|
||||
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.parse.ApiImport;
|
||||
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
|
||||
import io.metersphere.api.jmeter.JMeterService;
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import io.metersphere.api.dto.APIReportResult;
|
||||
import io.metersphere.api.dto.automation.*;
|
||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.request.*;
|
||||
|
@ -22,6 +21,7 @@ import io.metersphere.commons.constants.APITestStatus;
|
|||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
|
@ -103,8 +103,8 @@ public class ApiAutomationService {
|
|||
public ApiScenario create(SaveApiScenarioRequest request, List<MultipartFile> bodyFiles) {
|
||||
request.setId(UUID.randomUUID().toString());
|
||||
checkNameExist(request);
|
||||
|
||||
final ApiScenario scenario = new ApiScenario();
|
||||
|
||||
final ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs();
|
||||
scenario.setId(request.getId());
|
||||
scenario.setName(request.getName());
|
||||
scenario.setProjectId(request.getProjectId());
|
||||
|
@ -141,7 +141,7 @@ public class ApiAutomationService {
|
|||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
apiDefinitionService.createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
|
||||
final ApiScenario scenario = new ApiScenario();
|
||||
final ApiScenarioWithBLOBs scenario = new ApiScenarioWithBLOBs();
|
||||
scenario.setId(request.getId());
|
||||
scenario.setName(request.getName());
|
||||
scenario.setProjectId(request.getProjectId());
|
||||
|
@ -178,7 +178,12 @@ public class ApiAutomationService {
|
|||
extApiScenarioMapper.removeToGc(apiIds);
|
||||
}
|
||||
|
||||
public void reduction(List<String> apiIds) {
|
||||
public void reduction(List<SaveApiScenarioRequest> requests) {
|
||||
List<String> apiIds = new ArrayList<>();
|
||||
requests.forEach(item -> {
|
||||
checkNameExist(item);
|
||||
apiIds.add(item.getId());
|
||||
});
|
||||
extApiScenarioMapper.reduction(apiIds);
|
||||
}
|
||||
|
||||
|
@ -190,11 +195,11 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
|
||||
public ApiScenario getApiScenario(String id) {
|
||||
public ApiScenarioWithBLOBs getApiScenario(String id) {
|
||||
return apiScenarioMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<ApiScenario> getApiScenarios(List<String> ids) {
|
||||
public List<ApiScenarioWithBLOBs> getApiScenarios(List<String> ids) {
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
return extApiScenarioMapper.selectIds(ids);
|
||||
}
|
||||
|
@ -202,7 +207,7 @@ public class ApiAutomationService {
|
|||
}
|
||||
|
||||
public void deleteTag(String id) {
|
||||
List<ApiScenario> list = extApiScenarioMapper.selectByTagId(id);
|
||||
List<ApiScenarioWithBLOBs> list = extApiScenarioMapper.selectByTagId(id);
|
||||
if (!list.isEmpty()) {
|
||||
Gson gs = new Gson();
|
||||
list.forEach(item -> {
|
||||
|
@ -214,17 +219,17 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
|
||||
private void createAPIReportResult(String id, String triggerMode) {
|
||||
APIReportResult report = new APIReportResult();
|
||||
private void createAPIScenarioReportResult(String id, String triggerMode, String execType, String projectId) {
|
||||
APIScenarioReportResult report = new APIScenarioReportResult();
|
||||
report.setId(id);
|
||||
report.setTestId(id);
|
||||
report.setName("");
|
||||
report.setTriggerMode(null);
|
||||
report.setName("测试执行结果");
|
||||
report.setCreateTime(System.currentTimeMillis());
|
||||
report.setUpdateTime(System.currentTimeMillis());
|
||||
report.setStatus(APITestStatus.Running.name());
|
||||
report.setUserId(SessionUtils.getUserId());
|
||||
report.setTriggerMode(triggerMode);
|
||||
report.setExecuteType(execType);
|
||||
report.setProjectId(projectId);
|
||||
apiReportService.addResult(report);
|
||||
|
||||
}
|
||||
|
@ -236,11 +241,11 @@ public class ApiAutomationService {
|
|||
* @return
|
||||
*/
|
||||
public String run(RunScenarioRequest request) {
|
||||
List<ApiScenario> apiScenarios = extApiScenarioMapper.selectIds(request.getScenarioIds());
|
||||
List<ApiScenarioWithBLOBs> apiScenarios = extApiScenarioMapper.selectIds(request.getScenarioIds());
|
||||
MsTestPlan testPlan = new MsTestPlan();
|
||||
testPlan.setHashTree(new LinkedList<>());
|
||||
HashTree jmeterTestPlanHashTree = new ListedHashTree();
|
||||
for (ApiScenario item : apiScenarios) {
|
||||
for (ApiScenarioWithBLOBs item : apiScenarios) {
|
||||
MsThreadGroup group = new MsThreadGroup();
|
||||
group.setLabel(item.getName());
|
||||
group.setName(item.getName());
|
||||
|
@ -274,7 +279,8 @@ public class ApiAutomationService {
|
|||
// 调用执行方法
|
||||
jMeterService.runDefinition(request.getId(), jmeterTestPlanHashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
|
||||
|
||||
createAPIReportResult(request.getId(), request.getTriggerMode() == null ? ReportTriggerMode.API.name() : request.getTriggerMode());
|
||||
createAPIScenarioReportResult(request.getId(), request.getTriggerMode() == null ? ReportTriggerMode.MANUAL.name() : request.getTriggerMode(),
|
||||
request.getExecuteType(), request.getProjectId());
|
||||
return request.getId();
|
||||
}
|
||||
|
||||
|
@ -299,7 +305,7 @@ public class ApiAutomationService {
|
|||
HashTree hashTree = request.getTestElement().generateHashTree(config);
|
||||
// 调用执行方法
|
||||
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), ApiRunMode.SCENARIO.name());
|
||||
createAPIReportResult(request.getId(), ReportTriggerMode.MANUAL.name());
|
||||
createAPIScenarioReportResult(request.getId(), ReportTriggerMode.MANUAL.name(), request.getExecuteType(), request.getProjectId());
|
||||
return request.getId();
|
||||
}
|
||||
|
||||
|
@ -355,4 +361,20 @@ public class ApiAutomationService {
|
|||
return "success";
|
||||
}
|
||||
|
||||
public long countScenarioByProjectID(String projectId) {
|
||||
return extApiScenarioMapper.countByProjectID(projectId);
|
||||
}
|
||||
|
||||
public long countScenarioByProjectIDAndCreatInThisWeek(String projectId) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if (firstTime == null || lastTime == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return extApiScenarioMapper.countByProjectIDAndCreatInThisWeek(projectId, firstTime.getTime(), lastTime.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.dataCount.ExecutedCaseInfoResult;
|
||||
import io.metersphere.api.jmeter.TestResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResultExample;
|
||||
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -13,17 +16,24 @@ import javax.annotation.Resource;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiDefinitionExecResultService {
|
||||
@Resource
|
||||
private ApiDefinitionExecResultMapper apiDefinitionExecResultMapper;
|
||||
@Resource
|
||||
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
|
||||
|
||||
|
||||
public void saveApiResult(TestResult result, String type) {
|
||||
result.getScenarios().get(0).getRequestResults().forEach(item -> {
|
||||
// 清理原始资源,每个执行 保留一条结果
|
||||
extApiDefinitionExecResultMapper.deleteByResourceId(item.getName());
|
||||
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
|
||||
saveResult.setId(UUID.randomUUID().toString());
|
||||
saveResult.setCreateTime(System.currentTimeMillis());
|
||||
saveResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
saveResult.setName(item.getName());
|
||||
saveResult.setResourceId(item.getName());
|
||||
|
@ -43,8 +53,44 @@ public class ApiDefinitionExecResultService {
|
|||
}
|
||||
|
||||
public void deleteByResourceIds(List<String> ids) {
|
||||
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
|
||||
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
|
||||
example.createCriteria().andResourceIdIn(ids);
|
||||
apiDefinitionExecResultMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public long countByTestCaseIDInProjectAndExecutedInThisWeek(String projectId) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if(firstTime==null || lastTime == null){
|
||||
return 0;
|
||||
}else {
|
||||
return extApiDefinitionExecResultMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
public long countByTestCaseIDInProject(String projectId) {
|
||||
return extApiDefinitionExecResultMapper.countByTestCaseIDInProject(projectId);
|
||||
|
||||
}
|
||||
|
||||
public List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndLimitNumberInSevenDays(String projectId, int limitNumber) {
|
||||
|
||||
//获取7天之前的日期
|
||||
Date startDay = DateUtils.dateSum(new Date(),-6);
|
||||
//将日期转化为 00:00:00 的时间戳
|
||||
Date startTime = null;
|
||||
try{
|
||||
startTime = DateUtils.getDayStartTime(startDay);
|
||||
}catch (Exception e){
|
||||
}
|
||||
|
||||
if(startTime==null){
|
||||
return new ArrayList<>(0);
|
||||
}else {
|
||||
return extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId,startTime.getTime(),limitNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.api.dto.APIReportResult;
|
|||
import io.metersphere.api.dto.ApiTestImportRequest;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
import io.metersphere.api.dto.automation.ReferenceDTO;
|
||||
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.definition.*;
|
||||
import io.metersphere.api.dto.definition.parse.ApiDefinitionImport;
|
||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||
|
@ -23,10 +24,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
|||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.service.FileService;
|
||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||
|
@ -45,10 +43,7 @@ import sun.security.util.Cache;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -165,7 +160,12 @@ public class ApiDefinitionService {
|
|||
extApiDefinitionMapper.removeToGc(apiIds);
|
||||
}
|
||||
|
||||
public void reduction(List<String> apiIds) {
|
||||
public void reduction(List<SaveApiDefinitionRequest> requests) {
|
||||
List<String> apiIds = new ArrayList<>();
|
||||
requests.forEach(item -> {
|
||||
checkNameExist(item);
|
||||
apiIds.add(item.getId());
|
||||
});
|
||||
extApiDefinitionMapper.reduction(apiIds);
|
||||
}
|
||||
|
||||
|
@ -203,6 +203,7 @@ public class ApiDefinitionService {
|
|||
test.setName(request.getName());
|
||||
test.setPath(request.getPath());
|
||||
test.setProjectId(request.getProjectId());
|
||||
request.getRequest().setId(request.getId());
|
||||
test.setRequest(JSONObject.toJSONString(request.getRequest()));
|
||||
test.setUpdateTime(System.currentTimeMillis());
|
||||
test.setStatus(request.getStatus());
|
||||
|
@ -229,6 +230,7 @@ public class ApiDefinitionService {
|
|||
test.setPath(request.getPath());
|
||||
test.setModuleId(request.getModuleId());
|
||||
test.setProjectId(request.getProjectId());
|
||||
request.getRequest().setId(request.getId());
|
||||
test.setRequest(JSONObject.toJSONString(request.getRequest()));
|
||||
test.setCreateTime(System.currentTimeMillis());
|
||||
test.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -294,6 +296,7 @@ public class ApiDefinitionService {
|
|||
if (StringUtils.isNotBlank(request.getType()) && StringUtils.equals(request.getType(), ApiRunMode.API_PLAN.name())) {
|
||||
runMode = ApiRunMode.API_PLAN.name();
|
||||
}
|
||||
request.getTestElement().getJmx(hashTree);
|
||||
// 调用执行方法
|
||||
jMeterService.runDefinition(request.getId(), hashTree, request.getReportId(), runMode);
|
||||
return request.getId();
|
||||
|
@ -406,4 +409,33 @@ public class ApiDefinitionService {
|
|||
public void testPlanRelevance(ApiCaseRelevanceRequest request) {
|
||||
apiTestCaseService.relevanceByApi(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据统计-接口类型
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return
|
||||
*/
|
||||
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
|
||||
return extApiDefinitionMapper.countProtocolByProjectID(projectId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计本周创建的数据总量
|
||||
*
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
public long countByProjectIDAndCreateInThisWeek(String projectId) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if (firstTime == null || lastTime == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return extApiDefinitionMapper.countByProjectIDAndCreateInThisWeek(projectId, firstTime.getTime(), lastTime.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package io.metersphere.api.service;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.APIReportResult;
|
||||
import io.metersphere.api.dto.DeleteAPIReportRequest;
|
||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import io.metersphere.api.dto.automation.ExecuteType;
|
||||
import io.metersphere.api.jmeter.TestResult;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
|
@ -14,6 +14,7 @@ import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
|||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
||||
import io.metersphere.commons.constants.APITestStatus;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -24,7 +25,9 @@ import sun.security.util.Cache;
|
|||
import javax.annotation.Resource;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
|
@ -46,11 +49,12 @@ public class ApiScenarioReportService {
|
|||
if (obj == null) {
|
||||
MSException.throwException(Translator.get("api_report_is_null"));
|
||||
}
|
||||
APIReportResult report = (APIReportResult) obj;
|
||||
APIScenarioReportResult report = (APIScenarioReportResult) obj;
|
||||
// report detail
|
||||
ApiTestReportDetail detail = new ApiTestReportDetail();
|
||||
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
||||
detail.setReportId(result.getTestId());
|
||||
detail.setTestId(report.getTestId());
|
||||
detail.setProjectId(report.getProjectId());
|
||||
report.setTestId(result.getTestId());
|
||||
detail.setContent(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8));
|
||||
// report
|
||||
report.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -62,11 +66,8 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
}
|
||||
report.setContent(new String(detail.getContent(), StandardCharsets.UTF_8));
|
||||
cache.put(report.getTestId(), report);
|
||||
}
|
||||
|
||||
public void addResult(APIReportResult res) {
|
||||
cache.put(res.getTestId(), res);
|
||||
this.save(report);
|
||||
cache.put(report.getId(), report);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,10 +75,10 @@ public class ApiScenarioReportService {
|
|||
*
|
||||
* @param testId
|
||||
*/
|
||||
public APIReportResult getCacheResult(String testId) {
|
||||
public APIScenarioReportResult getCacheResult(String testId) {
|
||||
Object res = cache.get(testId);
|
||||
if (res != null) {
|
||||
APIReportResult reportResult = (APIReportResult) res;
|
||||
APIScenarioReportResult reportResult = (APIScenarioReportResult) res;
|
||||
if (!reportResult.getStatus().equals(APITestStatus.Running.name())) {
|
||||
cache.remove(testId);
|
||||
}
|
||||
|
@ -86,8 +87,13 @@ public class ApiScenarioReportService {
|
|||
return null;
|
||||
}
|
||||
|
||||
public APIReportResult get(String reportId) {
|
||||
APIReportResult reportResult = extApiScenarioReportMapper.get(reportId);
|
||||
|
||||
public void addResult(APIScenarioReportResult res) {
|
||||
cache.put(res.getId(), res);
|
||||
}
|
||||
|
||||
public APIScenarioReportResult get(String reportId) {
|
||||
APIScenarioReportResult reportResult = extApiScenarioReportMapper.get(reportId);
|
||||
ApiScenarioReportDetail detail = apiScenarioReportDetailMapper.selectByPrimaryKey(reportId);
|
||||
if (detail != null) {
|
||||
reportResult.setContent(new String(detail.getContent(), StandardCharsets.UTF_8));
|
||||
|
@ -102,7 +108,7 @@ public class ApiScenarioReportService {
|
|||
|
||||
private void checkNameExist(APIScenarioReportResult request) {
|
||||
ApiScenarioReportExample example = new ApiScenarioReportExample();
|
||||
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andIdNotEqualTo(request.getId());
|
||||
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId()).andExecuteTypeEqualTo(ExecuteType.Saved.name()).andIdNotEqualTo(request.getId());
|
||||
if (apiScenarioReportMapper.countByExample(example) > 0) {
|
||||
MSException.throwException(Translator.get("load_test_already_exists"));
|
||||
}
|
||||
|
@ -120,6 +126,7 @@ public class ApiScenarioReportService {
|
|||
report.setUpdateTime(System.currentTimeMillis());
|
||||
report.setStatus(test.getStatus());
|
||||
report.setUserId(test.getUserId());
|
||||
report.setExecuteType(test.getExecuteType());
|
||||
apiScenarioReportMapper.insert(report);
|
||||
return report;
|
||||
}
|
||||
|
@ -136,12 +143,13 @@ public class ApiScenarioReportService {
|
|||
report.setUpdateTime(System.currentTimeMillis());
|
||||
report.setStatus(test.getStatus());
|
||||
report.setUserId(test.getUserId());
|
||||
report.setExecuteType(test.getExecuteType());
|
||||
apiScenarioReportMapper.updateByPrimaryKey(report);
|
||||
return report;
|
||||
}
|
||||
|
||||
|
||||
public String add(APIScenarioReportResult test) {
|
||||
public String save(APIScenarioReportResult test) {
|
||||
ApiScenarioReport report = createReport(test);
|
||||
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
||||
TestResult result = JSON.parseObject(test.getContent(), TestResult.class);
|
||||
|
@ -205,4 +213,20 @@ public class ApiScenarioReportService {
|
|||
apiScenarioReportMapper.deleteByExample(apiTestReportExample);
|
||||
}
|
||||
|
||||
public long countByProjectID(String projectId) {
|
||||
return extApiScenarioReportMapper.countByProjectID(projectId);
|
||||
}
|
||||
|
||||
public long countByProjectIDAndCreateInThisWeek(String projectId) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if (firstTime == null || lastTime == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return extApiScenarioReportMapper.countByProjectIDAndCreateInThisWeek(projectId, firstTime.getTime(), lastTime.getTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package io.metersphere.api.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseResult;
|
||||
import io.metersphere.api.dto.definition.SaveApiTestCaseRequest;
|
||||
import io.metersphere.api.dto.ApiCaseBatchRequest;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||
|
@ -299,4 +303,21 @@ public class ApiTestCaseService {
|
|||
return extApiTestCaseMapper.selectIdsNotExistsInPlan(projectId, planId);
|
||||
}
|
||||
|
||||
public List<ApiDataCountResult> countProtocolByProjectID(String projectId) {
|
||||
return extApiTestCaseMapper.countProtocolByProjectID(projectId);
|
||||
}
|
||||
|
||||
public long countByProjectIDAndCreateInThisWeek(String projectId) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if(firstTime==null || lastTime == null){
|
||||
return 0;
|
||||
}else {
|
||||
return extApiTestCaseMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiDefinition implements Serializable {
|
||||
|
@ -16,8 +15,6 @@ public class ApiDefinition implements Serializable {
|
|||
|
||||
private String modulePath;
|
||||
|
||||
private String description;
|
||||
|
||||
private String environmentId;
|
||||
|
||||
private String schedule;
|
||||
|
|
|
@ -454,76 +454,6 @@ public class ApiDefinitionExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNotNull() {
|
||||
addCriterion("description is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionEqualTo(String value) {
|
||||
addCriterion("description =", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotEqualTo(String value) {
|
||||
addCriterion("description <>", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThan(String value) {
|
||||
addCriterion("description >", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("description >=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThan(String value) {
|
||||
addCriterion("description <", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
||||
addCriterion("description <=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLike(String value) {
|
||||
addCriterion("description like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotLike(String value) {
|
||||
addCriterion("description not like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIn(List<String> values) {
|
||||
addCriterion("description in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotIn(List<String> values) {
|
||||
addCriterion("description not in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
||||
addCriterion("description between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
||||
addCriterion("description not between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvironmentIdIsNull() {
|
||||
addCriterion("environment_id is null");
|
||||
return (Criteria) this;
|
||||
|
|
|
@ -9,6 +9,8 @@ import lombok.ToString;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ApiDefinitionWithBLOBs extends ApiDefinition implements Serializable {
|
||||
private String description;
|
||||
|
||||
private String request;
|
||||
|
||||
private String response;
|
||||
|
|
|
@ -31,8 +31,6 @@ public class ApiScenario implements Serializable {
|
|||
|
||||
private String schedule;
|
||||
|
||||
private String description;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
@ -43,7 +41,5 @@ public class ApiScenario implements Serializable {
|
|||
|
||||
private String reportId;
|
||||
|
||||
private String scenarioDefinition;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -1004,76 +1004,6 @@ public class ApiScenarioExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNotNull() {
|
||||
addCriterion("description is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionEqualTo(String value) {
|
||||
addCriterion("description =", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotEqualTo(String value) {
|
||||
addCriterion("description <>", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThan(String value) {
|
||||
addCriterion("description >", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("description >=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThan(String value) {
|
||||
addCriterion("description <", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
||||
addCriterion("description <=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLike(String value) {
|
||||
addCriterion("description like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotLike(String value) {
|
||||
addCriterion("description not like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIn(List<String> values) {
|
||||
addCriterion("description in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotIn(List<String> values) {
|
||||
addCriterion("description not in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
||||
addCriterion("description between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
||||
addCriterion("description not between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ApiScenarioReport implements Serializable {
|
||||
private String id;
|
||||
|
@ -11,8 +12,6 @@ public class ApiScenarioReport implements Serializable {
|
|||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
@ -23,5 +22,9 @@ public class ApiScenarioReport implements Serializable {
|
|||
|
||||
private String triggerMode;
|
||||
|
||||
private String executeType;
|
||||
|
||||
private String description;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -314,76 +314,6 @@ public class ApiScenarioReportExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNotNull() {
|
||||
addCriterion("description is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionEqualTo(String value) {
|
||||
addCriterion("description =", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotEqualTo(String value) {
|
||||
addCriterion("description <>", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThan(String value) {
|
||||
addCriterion("description >", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("description >=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThan(String value) {
|
||||
addCriterion("description <", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
||||
addCriterion("description <=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLike(String value) {
|
||||
addCriterion("description like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotLike(String value) {
|
||||
addCriterion("description not like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIn(List<String> values) {
|
||||
addCriterion("description in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotIn(List<String> values) {
|
||||
addCriterion("description not in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
||||
addCriterion("description between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
||||
addCriterion("description not between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
|
@ -713,6 +643,76 @@ public class ApiScenarioReportExample {
|
|||
addCriterion("trigger_mode not between", value1, value2, "triggerMode");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeIsNull() {
|
||||
addCriterion("execute_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeIsNotNull() {
|
||||
addCriterion("execute_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeEqualTo(String value) {
|
||||
addCriterion("execute_type =", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeNotEqualTo(String value) {
|
||||
addCriterion("execute_type <>", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeGreaterThan(String value) {
|
||||
addCriterion("execute_type >", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("execute_type >=", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeLessThan(String value) {
|
||||
addCriterion("execute_type <", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("execute_type <=", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeLike(String value) {
|
||||
addCriterion("execute_type like", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeNotLike(String value) {
|
||||
addCriterion("execute_type not like", value, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeIn(List<String> values) {
|
||||
addCriterion("execute_type in", values, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeNotIn(List<String> values) {
|
||||
addCriterion("execute_type not in", values, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeBetween(String value1, String value2) {
|
||||
addCriterion("execute_type between", value1, value2, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("execute_type not between", value1, value2, "executeType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ApiScenarioWithBLOBs extends ApiScenario implements Serializable {
|
||||
private String scenarioDefinition;
|
||||
|
||||
private String description;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiTestCase implements Serializable {
|
||||
|
@ -16,8 +15,6 @@ public class ApiTestCase implements Serializable {
|
|||
|
||||
private String apiDefinitionId;
|
||||
|
||||
private String description;
|
||||
|
||||
private String createUserId;
|
||||
|
||||
private String updateUserId;
|
||||
|
|
|
@ -454,76 +454,6 @@ public class ApiTestCaseExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNull() {
|
||||
addCriterion("description is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIsNotNull() {
|
||||
addCriterion("description is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionEqualTo(String value) {
|
||||
addCriterion("description =", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotEqualTo(String value) {
|
||||
addCriterion("description <>", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThan(String value) {
|
||||
addCriterion("description >", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("description >=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThan(String value) {
|
||||
addCriterion("description <", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLessThanOrEqualTo(String value) {
|
||||
addCriterion("description <=", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionLike(String value) {
|
||||
addCriterion("description like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotLike(String value) {
|
||||
addCriterion("description not like", value, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionIn(List<String> values) {
|
||||
addCriterion("description in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotIn(List<String> values) {
|
||||
addCriterion("description not in", values, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionBetween(String value1, String value2) {
|
||||
addCriterion("description between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescriptionNotBetween(String value1, String value2) {
|
||||
addCriterion("description not between", value1, value2, "description");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserIdIsNull() {
|
||||
addCriterion("create_user_id is null");
|
||||
return (Criteria) this;
|
||||
|
|
|
@ -9,6 +9,8 @@ import lombok.ToString;
|
|||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ApiTestCaseWithBLOBs extends ApiTestCase implements Serializable {
|
||||
private String description;
|
||||
|
||||
private String request;
|
||||
|
||||
private String response;
|
||||
|
|
|
@ -3,9 +3,8 @@ package io.metersphere.base.mapper;
|
|||
import io.metersphere.base.domain.ApiDefinition;
|
||||
import io.metersphere.base.domain.ApiDefinitionExample;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ApiDefinitionMapper {
|
||||
long countByExample(ApiDefinitionExample example);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="method" jdbcType="VARCHAR" property="method" />
|
||||
<result column="module_path" jdbcType="VARCHAR" property="modulePath" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
|
||||
<result column="schedule" jdbcType="VARCHAR" property="schedule" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
|
@ -19,6 +18,7 @@
|
|||
<result column="path" jdbcType="VARCHAR" property="path" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
<result column="request" jdbcType="LONGVARCHAR" property="request" />
|
||||
<result column="response" jdbcType="LONGVARCHAR" property="response" />
|
||||
</resultMap>
|
||||
|
@ -81,11 +81,11 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, `method`, module_path, description, environment_id, schedule,
|
||||
`status`, module_id, user_id, create_time, update_time, protocol, `path`
|
||||
id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`,
|
||||
module_id, user_id, create_time, update_time, protocol, `path`
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
request, response
|
||||
description, request, response
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiDefinitionExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
|
@ -137,16 +137,16 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
||||
insert into api_definition (id, project_id, `name`,
|
||||
`method`, module_path, description,
|
||||
environment_id, schedule, `status`,
|
||||
module_id, user_id, create_time,
|
||||
update_time, protocol, `path`,
|
||||
`method`, module_path, environment_id,
|
||||
schedule, `status`, module_id,
|
||||
user_id, create_time, update_time,
|
||||
protocol, `path`, description,
|
||||
request, response)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
||||
#{environmentId,jdbcType=VARCHAR}, #{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{moduleId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=BIGINT}, #{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR},
|
||||
#{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
|
||||
#{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
||||
#{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
||||
|
@ -167,9 +167,6 @@
|
|||
<if test="modulePath != null">
|
||||
module_path,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="environmentId != null">
|
||||
environment_id,
|
||||
</if>
|
||||
|
@ -197,6 +194,9 @@
|
|||
<if test="path != null">
|
||||
`path`,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="request != null">
|
||||
request,
|
||||
</if>
|
||||
|
@ -220,9 +220,6 @@
|
|||
<if test="modulePath != null">
|
||||
#{modulePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="environmentId != null">
|
||||
#{environmentId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -250,6 +247,9 @@
|
|||
<if test="path != null">
|
||||
#{path,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="request != null">
|
||||
#{request,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -282,9 +282,6 @@
|
|||
<if test="record.modulePath != null">
|
||||
module_path = #{record.modulePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.environmentId != null">
|
||||
environment_id = #{record.environmentId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -312,6 +309,9 @@
|
|||
<if test="record.path != null">
|
||||
`path` = #{record.path,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.request != null">
|
||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -330,7 +330,6 @@
|
|||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`method` = #{record.method,jdbcType=VARCHAR},
|
||||
module_path = #{record.modulePath,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
environment_id = #{record.environmentId,jdbcType=VARCHAR},
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
|
@ -340,6 +339,7 @@
|
|||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
protocol = #{record.protocol,jdbcType=VARCHAR},
|
||||
`path` = #{record.path,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||
response = #{record.response,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -353,7 +353,6 @@
|
|||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`method` = #{record.method,jdbcType=VARCHAR},
|
||||
module_path = #{record.modulePath,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
environment_id = #{record.environmentId,jdbcType=VARCHAR},
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
|
@ -382,9 +381,6 @@
|
|||
<if test="modulePath != null">
|
||||
module_path = #{modulePath,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="environmentId != null">
|
||||
environment_id = #{environmentId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -412,6 +408,9 @@
|
|||
<if test="path != null">
|
||||
`path` = #{path,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="request != null">
|
||||
request = #{request,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -427,7 +426,6 @@
|
|||
`name` = #{name,jdbcType=VARCHAR},
|
||||
`method` = #{method,jdbcType=VARCHAR},
|
||||
module_path = #{modulePath,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
environment_id = #{environmentId,jdbcType=VARCHAR},
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
|
@ -437,6 +435,7 @@
|
|||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
protocol = #{protocol,jdbcType=VARCHAR},
|
||||
`path` = #{path,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
request = #{request,jdbcType=LONGVARCHAR},
|
||||
response = #{response,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -447,7 +446,6 @@
|
|||
`name` = #{name,jdbcType=VARCHAR},
|
||||
`method` = #{method,jdbcType=VARCHAR},
|
||||
module_path = #{modulePath,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
environment_id = #{environmentId,jdbcType=VARCHAR},
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.base.mapper;
|
|||
|
||||
import io.metersphere.base.domain.ApiScenario;
|
||||
import io.metersphere.base.domain.ApiScenarioExample;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -12,25 +13,25 @@ public interface ApiScenarioMapper {
|
|||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(ApiScenario record);
|
||||
int insert(ApiScenarioWithBLOBs record);
|
||||
|
||||
int insertSelective(ApiScenario record);
|
||||
int insertSelective(ApiScenarioWithBLOBs record);
|
||||
|
||||
List<ApiScenario> selectByExampleWithBLOBs(ApiScenarioExample example);
|
||||
List<ApiScenarioWithBLOBs> selectByExampleWithBLOBs(ApiScenarioExample example);
|
||||
|
||||
List<ApiScenario> selectByExample(ApiScenarioExample example);
|
||||
|
||||
ApiScenario selectByPrimaryKey(String id);
|
||||
ApiScenarioWithBLOBs selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") ApiScenario record, @Param("example") ApiScenarioExample example);
|
||||
int updateByExampleSelective(@Param("record") ApiScenarioWithBLOBs record, @Param("example") ApiScenarioExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") ApiScenario record, @Param("example") ApiScenarioExample example);
|
||||
int updateByExampleWithBLOBs(@Param("record") ApiScenarioWithBLOBs record, @Param("example") ApiScenarioExample example);
|
||||
|
||||
int updateByExample(@Param("record") ApiScenario record, @Param("example") ApiScenarioExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(ApiScenario record);
|
||||
int updateByPrimaryKeySelective(ApiScenarioWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(ApiScenario record);
|
||||
int updateByPrimaryKeyWithBLOBs(ApiScenarioWithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(ApiScenario record);
|
||||
}
|
|
@ -15,15 +15,15 @@
|
|||
<result column="step_total" jdbcType="INTEGER" property="stepTotal" />
|
||||
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
||||
<result column="schedule" jdbcType="VARCHAR" property="schedule" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="pass_rate" jdbcType="VARCHAR" property="passRate" />
|
||||
<result column="last_result" jdbcType="VARCHAR" property="lastResult" />
|
||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiScenario">
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
<result column="scenario_definition" jdbcType="LONGVARCHAR" property="scenarioDefinition" />
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -85,11 +85,11 @@
|
|||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, tag_id, user_id, api_scenario_module_id, module_path, `name`, `level`,
|
||||
`status`, principal, step_total, follow_people, schedule, description, create_time,
|
||||
update_time, pass_rate, last_result, report_id
|
||||
`status`, principal, step_total, follow_people, schedule, create_time, update_time,
|
||||
pass_rate, last_result, report_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
scenario_definition
|
||||
scenario_definition, description
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiScenarioExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
|
@ -139,23 +139,25 @@
|
|||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiScenario">
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
insert into api_scenario (id, project_id, tag_id,
|
||||
user_id, api_scenario_module_id, module_path,
|
||||
`name`, `level`, `status`,
|
||||
principal, step_total, follow_people,
|
||||
schedule, description, create_time,
|
||||
update_time, pass_rate, last_result,
|
||||
report_id, scenario_definition)
|
||||
schedule, create_time, update_time,
|
||||
pass_rate, last_result, report_id,
|
||||
scenario_definition, description
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tagId,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{principal,jdbcType=VARCHAR}, #{stepTotal,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR},
|
||||
#{schedule,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=BIGINT}, #{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR},
|
||||
#{reportId,jdbcType=VARCHAR}, #{scenarioDefinition,jdbcType=LONGVARCHAR})
|
||||
#{schedule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||
#{scenarioDefinition,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenario">
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
insert into api_scenario
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -197,9 +199,6 @@
|
|||
<if test="schedule != null">
|
||||
schedule,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
|
@ -218,6 +217,9 @@
|
|||
<if test="scenarioDefinition != null">
|
||||
scenario_definition,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -259,9 +261,6 @@
|
|||
<if test="schedule != null">
|
||||
#{schedule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -280,6 +279,9 @@
|
|||
<if test="scenarioDefinition != null">
|
||||
#{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiScenarioExample" resultType="java.lang.Long">
|
||||
|
@ -330,9 +332,6 @@
|
|||
<if test="record.schedule != null">
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -351,6 +350,9 @@
|
|||
<if test="record.scenarioDefinition != null">
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -371,13 +373,13 @@
|
|||
step_total = #{record.stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
||||
last_result = #{record.lastResult,jdbcType=VARCHAR},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR}
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -397,7 +399,6 @@
|
|||
step_total = #{record.stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{record.schedule,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
pass_rate = #{record.passRate,jdbcType=VARCHAR},
|
||||
|
@ -407,7 +408,7 @@
|
|||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiScenario">
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
update api_scenario
|
||||
<set>
|
||||
<if test="projectId != null">
|
||||
|
@ -446,9 +447,6 @@
|
|||
<if test="schedule != null">
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -467,10 +465,13 @@
|
|||
<if test="scenarioDefinition != null">
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiScenario">
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
update api_scenario
|
||||
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||
tag_id = #{tagId,jdbcType=VARCHAR},
|
||||
|
@ -484,13 +485,13 @@
|
|||
step_total = #{stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
pass_rate = #{passRate,jdbcType=VARCHAR},
|
||||
last_result = #{lastResult,jdbcType=VARCHAR},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR}
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiScenario">
|
||||
|
@ -507,7 +508,6 @@
|
|||
step_total = #{stepTotal,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
schedule = #{schedule,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
pass_rate = #{passRate,jdbcType=VARCHAR},
|
||||
|
|
|
@ -2,9 +2,10 @@ package io.metersphere.base.mapper;
|
|||
|
||||
import io.metersphere.base.domain.ApiScenarioReport;
|
||||
import io.metersphere.base.domain.ApiScenarioReportExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ApiScenarioReportMapper {
|
||||
long countByExample(ApiScenarioReportExample example);
|
||||
|
||||
|
@ -16,15 +17,21 @@ public interface ApiScenarioReportMapper {
|
|||
|
||||
int insertSelective(ApiScenarioReport record);
|
||||
|
||||
List<ApiScenarioReport> selectByExampleWithBLOBs(ApiScenarioReportExample example);
|
||||
|
||||
List<ApiScenarioReport> selectByExample(ApiScenarioReportExample example);
|
||||
|
||||
ApiScenarioReport selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") ApiScenarioReport record, @Param("example") ApiScenarioReportExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") ApiScenarioReport record, @Param("example") ApiScenarioReportExample example);
|
||||
|
||||
int updateByExample(@Param("record") ApiScenarioReport record, @Param("example") ApiScenarioReportExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(ApiScenarioReport record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(ApiScenarioReport record);
|
||||
|
||||
int updateByPrimaryKey(ApiScenarioReport record);
|
||||
}
|
|
@ -5,12 +5,15 @@
|
|||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
||||
<result column="trigger_mode" jdbcType="VARCHAR" property="triggerMode" />
|
||||
<result column="execute_type" jdbcType="VARCHAR" property="executeType" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiScenarioReport">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
|
@ -71,9 +74,28 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, description, create_time, update_time, `status`, user_id,
|
||||
trigger_mode
|
||||
id, project_id, `name`, create_time, update_time, `status`, user_id, trigger_mode,
|
||||
execute_type
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiScenarioReportExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from api_scenario_report
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiScenarioReportExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
|
@ -88,9 +110,11 @@
|
|||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from api_scenario_report
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
@ -106,13 +130,13 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiScenarioReport">
|
||||
insert into api_scenario_report (id, project_id, `name`,
|
||||
description, create_time, update_time,
|
||||
`status`, user_id, trigger_mode
|
||||
)
|
||||
create_time, update_time, `status`,
|
||||
user_id, trigger_mode, execute_type,
|
||||
description)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{status,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}
|
||||
)
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{executeType,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenarioReport">
|
||||
insert into api_scenario_report
|
||||
|
@ -126,9 +150,6 @@
|
|||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
|
@ -144,6 +165,12 @@
|
|||
<if test="triggerMode != null">
|
||||
trigger_mode,
|
||||
</if>
|
||||
<if test="executeType != null">
|
||||
execute_type,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -155,9 +182,6 @@
|
|||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -173,6 +197,12 @@
|
|||
<if test="triggerMode != null">
|
||||
#{triggerMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executeType != null">
|
||||
#{executeType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiScenarioReportExample" resultType="java.lang.Long">
|
||||
|
@ -193,9 +223,6 @@
|
|||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -211,22 +238,44 @@
|
|||
<if test="record.triggerMode != null">
|
||||
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.executeType != null">
|
||||
execute_type = #{record.executeType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update api_scenario_report
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
|
||||
execute_type = #{record.executeType,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update api_scenario_report
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
project_id = #{record.projectId,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR}
|
||||
trigger_mode = #{record.triggerMode,jdbcType=VARCHAR},
|
||||
execute_type = #{record.executeType,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -240,9 +289,6 @@
|
|||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
|
@ -258,19 +304,38 @@
|
|||
<if test="triggerMode != null">
|
||||
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executeType != null">
|
||||
execute_type = #{executeType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiScenarioReport">
|
||||
update api_scenario_report
|
||||
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
|
||||
execute_type = #{executeType,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiScenarioReport">
|
||||
update api_scenario_report
|
||||
set project_id = #{projectId,jdbcType=VARCHAR},
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
user_id = #{userId,jdbcType=VARCHAR},
|
||||
trigger_mode = #{triggerMode,jdbcType=VARCHAR}
|
||||
trigger_mode = #{triggerMode,jdbcType=VARCHAR},
|
||||
execute_type = #{executeType,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -3,9 +3,8 @@ package io.metersphere.base.mapper;
|
|||
import io.metersphere.base.domain.ApiTestCase;
|
||||
import io.metersphere.base.domain.ApiTestCaseExample;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ApiTestCaseMapper {
|
||||
long countByExample(ApiTestCaseExample example);
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="priority" jdbcType="VARCHAR" property="priority" />
|
||||
<result column="api_definition_id" jdbcType="VARCHAR" property="apiDefinitionId" />
|
||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
||||
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
|
||||
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
<result column="request" jdbcType="LONGVARCHAR" property="request" />
|
||||
<result column="response" jdbcType="LONGVARCHAR" property="response" />
|
||||
</resultMap>
|
||||
|
@ -76,11 +76,11 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, priority, api_definition_id, description, create_user_id,
|
||||
update_user_id, create_time, update_time
|
||||
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
||||
create_time, update_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
request, response
|
||||
description, request, response
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestCaseExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
|
@ -132,14 +132,14 @@
|
|||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
insert into api_test_case (id, project_id, `name`,
|
||||
priority, api_definition_id, description,
|
||||
create_user_id, update_user_id, create_time,
|
||||
update_time, request, response
|
||||
priority, api_definition_id, create_user_id,
|
||||
update_user_id, create_time, update_time,
|
||||
description, request, response
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
|
||||
#{createUserId,jdbcType=VARCHAR}, #{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
|
||||
#{updateTime,jdbcType=BIGINT}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR}
|
||||
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
||||
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
|
@ -160,9 +160,6 @@
|
|||
<if test="apiDefinitionId != null">
|
||||
api_definition_id,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
create_user_id,
|
||||
</if>
|
||||
|
@ -175,6 +172,9 @@
|
|||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
<if test="request != null">
|
||||
request,
|
||||
</if>
|
||||
|
@ -198,9 +198,6 @@
|
|||
<if test="apiDefinitionId != null">
|
||||
#{apiDefinitionId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
#{createUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -213,6 +210,9 @@
|
|||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="request != null">
|
||||
#{request,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -245,9 +245,6 @@
|
|||
<if test="record.apiDefinitionId != null">
|
||||
api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createUserId != null">
|
||||
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -260,6 +257,9 @@
|
|||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="record.request != null">
|
||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -278,11 +278,11 @@
|
|||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
priority = #{record.priority,jdbcType=VARCHAR},
|
||||
api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
|
||||
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||
response = #{record.response,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -296,7 +296,6 @@
|
|||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
priority = #{record.priority,jdbcType=VARCHAR},
|
||||
api_definition_id = #{record.apiDefinitionId,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=VARCHAR},
|
||||
create_user_id = #{record.createUserId,jdbcType=VARCHAR},
|
||||
update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
|
@ -320,9 +319,6 @@
|
|||
<if test="apiDefinitionId != null">
|
||||
api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createUserId != null">
|
||||
create_user_id = #{createUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -335,6 +331,9 @@
|
|||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
<if test="request != null">
|
||||
request = #{request,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -350,11 +349,11 @@
|
|||
`name` = #{name,jdbcType=VARCHAR},
|
||||
priority = #{priority,jdbcType=VARCHAR},
|
||||
api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
create_user_id = #{createUserId,jdbcType=VARCHAR},
|
||||
update_user_id = #{updateUserId,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
request = #{request,jdbcType=LONGVARCHAR},
|
||||
response = #{response,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -365,7 +364,6 @@
|
|||
`name` = #{name,jdbcType=VARCHAR},
|
||||
priority = #{priority,jdbcType=VARCHAR},
|
||||
api_definition_id = #{apiDefinitionId,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=VARCHAR},
|
||||
create_user_id = #{createUserId,jdbcType=VARCHAR},
|
||||
update_user_id = #{updateUserId,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.metersphere.base.domain.ApiTestReport;
|
|||
import io.metersphere.base.domain.ApiTestReportExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
public interface ApiTestReportMapper {
|
||||
long countByExample(ApiTestReportExample example);
|
||||
|
@ -27,4 +28,5 @@ public interface ApiTestReportMapper {
|
|||
int updateByPrimaryKeySelective(ApiTestReport record);
|
||||
|
||||
int updateByPrimaryKey(ApiTestReport record);
|
||||
|
||||
}
|
|
@ -1,9 +1,13 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.api.dto.dataCount.response.TaskInfoResult;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.base.domain.ScheduleExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.python.antlr.ast.Str;
|
||||
|
||||
public interface ScheduleMapper {
|
||||
long countByExample(ScheduleExample example);
|
||||
|
@ -33,4 +37,5 @@ public interface ScheduleMapper {
|
|||
int updateByPrimaryKeyWithBLOBs(Schedule record);
|
||||
|
||||
int updateByPrimaryKey(Schedule record);
|
||||
|
||||
}
|
|
@ -1,6 +1,11 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.api.dto.dataCount.ExecutedCaseInfoResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtApiDefinitionExecResultMapper {
|
||||
|
||||
|
@ -9,4 +14,40 @@ public interface ExtApiDefinitionExecResultMapper {
|
|||
ApiDefinitionExecResult selectMaxResultByResourceId(String resourceId);
|
||||
|
||||
ApiDefinitionExecResult selectMaxResultByResourceIdAndType(String resourceId, String type);
|
||||
|
||||
@Select({
|
||||
"SELECT count(id) AS countNumber FROM api_definition_exec_result ",
|
||||
"WHERE resource_id IN ( ",
|
||||
"SELECT testCase.id FROM api_test_case testCase ",
|
||||
"WHERE testCase.project_id = #{projectId}) ",
|
||||
"and start_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||
})
|
||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||
|
||||
@Select({
|
||||
"SELECT count(id) AS countNumber FROM api_definition_exec_result ",
|
||||
"WHERE resource_id IN ( ",
|
||||
"SELECT testCase.id FROM api_test_case testCase ",
|
||||
"WHERE testCase.project_id = #{projectId}) ",
|
||||
})
|
||||
long countByTestCaseIDInProject(String projectId);
|
||||
|
||||
@Select({
|
||||
"SELECT testCase.testCaseName AS caseName,testCase.testPlanName AS testPlan ,caseErrorCountData.dataCountNumber AS failureTimes FROM ( ",
|
||||
"SELECT apiCase.id AS testCaseID,apiCase.`name` AS testCaseName,group_concat(testPlan.`name`) AS testPlanName FROM api_test_case apiCase ",
|
||||
"LEFT JOIN test_plan testPlan ON testPlan.api_ids like concat('%\"',apiCase.id,'\"%') ",
|
||||
"GROUP BY apiCase.id ",
|
||||
"ORDER BY apiCase.create_time DESC ",
|
||||
")testCase ",
|
||||
"INNER JOIN ( ",
|
||||
"SELECT resource_id AS testCaseID,COUNT(id) AS dataCountNumber,start_time AS executeTime FROM api_definition_exec_result ",
|
||||
"WHERE resource_id IN ( ",
|
||||
"SELECT id FROM api_test_case WHERE project_id = #{projectId} ",
|
||||
") and `status` = 'error' GROUP BY resource_id ",
|
||||
") caseErrorCountData ON caseErrorCountData.testCaseID =testCase.testCaseID ",
|
||||
"WHERE caseErrorCountData.executeTime >= #{startTimestamp} ",
|
||||
"ORDER BY caseErrorCountData.dataCountNumber DESC ",
|
||||
"limit #{limitNumber} "
|
||||
})
|
||||
List<ExecutedCaseInfoResult> findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(@Param("projectId") String projectId, @Param("startTimestamp") long startTimestamp, @Param("limitNumber") int limitNumber);
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<select id="selectMaxResultByResourceId" parameterType="java.lang.String" resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||
select * from api_definition_exec_result
|
||||
where resource_id = #{resourceId,jdbcType=VARCHAR} ORDER BY start_time DESC LIMIT 1
|
||||
where resource_id = #{resourceId,jdbcType=VARCHAR} ORDER BY create_time DESC LIMIT 1
|
||||
</select>
|
||||
<select id="selectMaxResultByResourceIdAndType"
|
||||
resultType="io.metersphere.base.domain.ApiDefinitionExecResult">
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.definition.ApiComputeResult;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.ApiDefinitionResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -17,4 +19,13 @@ public interface ExtApiDefinitionMapper {
|
|||
|
||||
int reduction(@Param("ids") List<String> ids);
|
||||
|
||||
@Select("SELECT protocol AS groupField,count(id) AS countNumber FROM api_definition WHERE project_id = #{0} GROUP BY protocol;")
|
||||
List<ApiDataCountResult> countProtocolByProjectID(String projectId);
|
||||
|
||||
@Select({
|
||||
"SELECT count(id) AS countNumber FROM api_definition ",
|
||||
"WHERE project_id = #{projectId} ",
|
||||
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||
})
|
||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||
}
|
|
@ -94,20 +94,16 @@
|
|||
when 'error' then '未通过'
|
||||
ELSE '未执行' end as status ,
|
||||
CONCAT(FORMAT(SUM(IF(t2.`status` = 'success', 1, 0))/ COUNT(t1.id)*100, 2), '%') passRate
|
||||
from api_test_case t1 left join (
|
||||
select
|
||||
a.status, a.id, a.resource_id
|
||||
from
|
||||
api_definition_exec_result a
|
||||
from api_test_case t1
|
||||
left join (
|
||||
select
|
||||
max(start_time) start_time , id, resource_id
|
||||
from
|
||||
api_definition_exec_result
|
||||
group by
|
||||
resource_id ) as b on a.id = b.id
|
||||
where
|
||||
a.start_time = b.start_time)as t2 on t1.id = t2.resource_id
|
||||
select
|
||||
max(create_time) create_time ,status ,id, resource_id
|
||||
from
|
||||
api_definition_exec_result
|
||||
group by
|
||||
resource_id
|
||||
)as t2
|
||||
on t1.id = t2.resource_id
|
||||
group by t1.api_definition_id having t1.api_definition_id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
|
|
|
@ -3,20 +3,32 @@ package io.metersphere.base.mapper.ext;
|
|||
import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||
import io.metersphere.base.domain.ApiScenario;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtApiScenarioMapper {
|
||||
List<ApiScenarioDTO> list(@Param("request") ApiScenarioRequest request);
|
||||
|
||||
List<ApiScenario> selectByTagId(@Param("id") String id);
|
||||
List<ApiScenarioWithBLOBs> selectByTagId(@Param("id") String id);
|
||||
|
||||
List<ApiScenario> selectIds(@Param("ids") List<String> ids);
|
||||
List<ApiScenarioWithBLOBs> selectIds(@Param("ids") List<String> ids);
|
||||
|
||||
List<ApiScenario> selectReference(@Param("request") ApiScenarioRequest request);
|
||||
|
||||
int removeToGc(@Param("ids") List<String> ids);
|
||||
|
||||
int reduction(@Param("ids") List<String> ids);
|
||||
|
||||
@Select("SELECT COUNT(id) AS countNumber FROM api_scenario WHERE project_id = #{0} ")
|
||||
long countByProjectID(String projectId);
|
||||
|
||||
@Select({
|
||||
"SELECT count(id) AS countNumber FROM api_scenario ",
|
||||
"WHERE project_id = #{projectId} ",
|
||||
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||
})
|
||||
long countByProjectIDAndCreatInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||
}
|
||||
|
|
|
@ -61,11 +61,11 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectByTagId" resultType="io.metersphere.base.domain.ApiScenario">
|
||||
<select id="selectByTagId" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
select * from api_scenario where tag_id like CONCAT('%', #{id},'%')
|
||||
</select>
|
||||
|
||||
<select id="selectIds" resultType="io.metersphere.base.domain.ApiScenario">
|
||||
<select id="selectIds" resultType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
select * from api_scenario where id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.api.dto.APIReportResult;
|
||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtApiScenarioReportMapper {
|
||||
List<APIScenarioReportResult> list(@Param("request") QueryAPIReportRequest request);
|
||||
|
||||
APIReportResult get(@Param("reportId") String reportId);
|
||||
APIScenarioReportResult get(@Param("reportId") String reportId);
|
||||
|
||||
@Select("SELECT count(id) AS countNumber FROM api_scenario_report WHERE project_id = #{0} ")
|
||||
long countByProjectID(String projectId);
|
||||
|
||||
@Select({
|
||||
"SELECT count(id) AS countNumber FROM api_scenario_report ",
|
||||
"WHERE project_id = #{projectId} ",
|
||||
"AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||
})
|
||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||
|
||||
}
|
|
@ -145,7 +145,7 @@
|
|||
</if>
|
||||
</foreach>
|
||||
</if>
|
||||
AND r.status != 'Debug'
|
||||
AND r.execute_type = 'Saved'
|
||||
</where>
|
||||
<if test="request.orders != null and request.orders.size() > 0">
|
||||
order by
|
||||
|
@ -155,7 +155,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="get" resultType="io.metersphere.api.dto.APIReportResult">
|
||||
<select id="get" resultType="io.metersphere.api.dto.automation.APIScenarioReportResult">
|
||||
SELECT r.*,r.id As testId, r.name AS test_name, project.name AS project_name, user.name AS user_name
|
||||
FROM api_scenario_report r
|
||||
LEFT JOIN project ON project.id = r.project_id
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.api.dto.dataCount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseDTO;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseRequest;
|
||||
import io.metersphere.api.dto.definition.ApiTestCaseResult;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,4 +16,20 @@ public interface ExtApiTestCaseMapper {
|
|||
List<ApiTestCaseDTO> listSimple(@Param("request") ApiTestCaseRequest request);
|
||||
|
||||
List<String> selectIdsNotExistsInPlan(@Param("projectId") String projectId, @Param("planId") String planId);
|
||||
|
||||
@Select({
|
||||
"SELECT apiDef.protocol AS groupField,COUNT(testCase.id) AS countNumber FROM api_test_case testCase ",
|
||||
"INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id ",
|
||||
"WHERE testCase.project_id = #{0} ",
|
||||
"GROUP BY apiDef.protocol "
|
||||
})
|
||||
List<ApiDataCountResult> countProtocolByProjectID(String projectId);
|
||||
|
||||
@Select({
|
||||
"SELECT count(testCase.id) AS countNumber FROM api_test_case testCase ",
|
||||
"INNER JOIN api_definition apiDef ON testCase.api_definition_id = apiDef.id ",
|
||||
"WHERE testCase.project_id = #{projectId} ",
|
||||
"AND testCase.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} "
|
||||
})
|
||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||
}
|
|
@ -161,7 +161,8 @@
|
|||
atc.create_time,
|
||||
atc.update_user_id,
|
||||
atc.update_time,
|
||||
ader.status execResult
|
||||
ader.status execResult,
|
||||
ader.create_time execTime
|
||||
from
|
||||
api_test_case atc
|
||||
left join user u1 on
|
||||
|
@ -170,18 +171,11 @@
|
|||
atc.update_user_id = u2.id
|
||||
left join (
|
||||
select
|
||||
a.status, a.id, a.resource_id
|
||||
max(create_time) create_time ,status ,id, resource_id
|
||||
from
|
||||
api_definition_exec_result a
|
||||
left join (
|
||||
select
|
||||
max(start_time) start_time , id, resource_id
|
||||
from
|
||||
api_definition_exec_result
|
||||
group by
|
||||
resource_id ) as b on a.id = b.id
|
||||
where
|
||||
a.start_time = b.start_time) as ader
|
||||
api_definition_exec_result
|
||||
group by
|
||||
resource_id) as ader
|
||||
on atc.id = ader.resource_id
|
||||
<where>
|
||||
<if test="request.name != null and request.name!=''">
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.metersphere.api.dto.QueryAPIReportRequest;
|
|||
import io.metersphere.dto.ApiReportDTO;
|
||||
import io.metersphere.dto.DashboardTestDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -18,4 +19,21 @@ public interface ExtApiTestReportMapper {
|
|||
|
||||
List<DashboardTestDTO> selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp);
|
||||
|
||||
|
||||
@Select({
|
||||
"SELECT COUNT(testReportDetail.report_id) AS countNumber FROM api_test_report_detail testReportDetail ",
|
||||
"INNER JOIN `schedule` sch ON sch.resource_id = testReportDetail.test_id ",
|
||||
"INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id ",
|
||||
"WHERE workspace_id = #{workspaceID} AND `group` = #{group} ",
|
||||
})
|
||||
long countByWorkspaceIdAndGroup(@Param("workspaceID") String workspaceID, @Param("group")String group);
|
||||
|
||||
@Select({
|
||||
"SELECT COUNT(testReportDetail.report_id) AS countNumber FROM api_test_report_detail testReportDetail ",
|
||||
"INNER JOIN `schedule` sch ON sch.resource_id = testReportDetail.test_id ",
|
||||
"INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id ",
|
||||
"WHERE workspace_id = #{workspaceID} AND `group` = #{group} ",
|
||||
"AND testReport.create_time BETWEEN #{startTime} and #{endTime} ",
|
||||
})
|
||||
long countByProjectIDAndCreateInThisWeek(@Param("workspaceID") String workspaceID, @Param("group")String group, @Param("startTime") long startTime, @Param("endTime")long endTime);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,34 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
import io.metersphere.api.dto.dataCount.response.TaskInfoResult;
|
||||
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||
import io.metersphere.dto.ScheduleDao;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtScheduleMapper {
|
||||
List<ScheduleDao> list(@Param("request") QueryScheduleRequest request);
|
||||
|
||||
|
||||
@Select("SELECT COUNT(id) AS countNumber FROM `schedule` WHERE `workspace_id` = #{workspaceId} AND `group` = #{group} ")
|
||||
long countTaskByWorkspaceIdAndGroup(@Param("workspaceId") String workspaceId,@Param("group") String group);
|
||||
|
||||
@Select({
|
||||
"SELECT COUNT(id) AS countNumber FROM `schedule` ",
|
||||
"WHERE workspace_id = #{workspaceId} ",
|
||||
"AND `group` = #{group} ",
|
||||
"AND create_time BETWEEN #{startTime} and #{endTime}; "
|
||||
})
|
||||
long countTaskByWorkspaceIdAndGroupAndCreateTimeRange(@Param("workspaceId")String workspaceId,@Param("group") String group, @Param("startTime") long startTime, @Param("endTime") long endTime);
|
||||
|
||||
@Select({
|
||||
"SELECT apiTest.`name` AS scenario,sch.id AS taskID,sch.`value` AS rule,sch.`enable` AS `taskStatus`,u.`name` AS creator,sch.update_time AS updateTime ",
|
||||
"FROM api_test apiTest ",
|
||||
"INNER JOIN `schedule` sch ON apiTest.id = sch.resource_id ",
|
||||
"INNER JOIN `user` u ON u.id = sch.user_id ",
|
||||
"WHERE sch.`enable` = true AND sch.workspace_id = #{0,jdbcType=VARCHAR}"
|
||||
})
|
||||
List<TaskInfoResult> findRunningTaskInfoByWorkspaceID(String workspaceID);
|
||||
}
|
|
@ -121,9 +121,11 @@
|
|||
</select>
|
||||
|
||||
<select id="list" resultType="io.metersphere.track.dto.TestPlanCaseDTO">
|
||||
select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority, test_case.type,
|
||||
select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
|
||||
test_case.type,test_case.test_id as testId,
|
||||
test_case.node_path, test_case.method, test_case.num, test_plan_test_case.executor, test_plan_test_case.status,
|
||||
test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName, test_plan_test_case.plan_id as planId
|
||||
test_plan_test_case.update_time, test_case_node.name as model, project.name as projectName,
|
||||
test_plan_test_case.plan_id as planId
|
||||
from test_plan_test_case
|
||||
inner join test_case on test_plan_test_case.case_id = test_case.id
|
||||
left join test_case_node on test_case_node.id=test_case.node_id
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
package io.metersphere.commons.utils;
|
||||
|
||||
import org.quartz.CronExpression;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.TriggerBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author song.tianyang
|
||||
* @Date 2020/12/17 4:06 下午
|
||||
* @Description CRON解析类
|
||||
*/
|
||||
public class CronUtils {
|
||||
|
||||
/**
|
||||
* 解析表达式,获取CronTrigger
|
||||
* @param cron
|
||||
* @return
|
||||
*/
|
||||
public static CronTrigger getCronTrigger(String cron) {
|
||||
if (!CronExpression.isValidExpression(cron)) {
|
||||
throw new RuntimeException("cron :" + cron + "表达式解析错误");
|
||||
}
|
||||
return TriggerBuilder.newTrigger().withIdentity("Caclulate Date").withSchedule(CronScheduleBuilder.cronSchedule(cron)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取以指定时间为开始时间的下一次执行时间
|
||||
* @param cron
|
||||
* @param start
|
||||
* @return
|
||||
*/
|
||||
public static Date getNextTriggerTime(String cron, Date start) {
|
||||
if (start == null) {
|
||||
return getNextTriggerTime(cron);
|
||||
}else{
|
||||
CronTrigger trigger = getCronTrigger(cron);
|
||||
return trigger.getFireTimeAfter(start);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取以当前日期为准的下一次执行时间
|
||||
* @param cron
|
||||
* @return
|
||||
*/
|
||||
public static Date getNextTriggerTime(String cron) {
|
||||
Date date = null;
|
||||
try{
|
||||
CronTrigger trigger = getCronTrigger(cron);
|
||||
Date startDate = trigger.getStartTime();
|
||||
date = trigger.getFireTimeAfter(startDate);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package io.metersphere.commons.utils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class DateUtils {
|
||||
public static final String DATE_PATTERM = "yyyy-MM-dd";
|
||||
public static final String TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
|
||||
public static Date getDate(String dateString) throws Exception {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERM);
|
||||
return dateFormat.parse(dateString);
|
||||
}
|
||||
public static Date getTime(String timeString) throws Exception {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(TIME_PATTERN);
|
||||
return dateFormat.parse(timeString);
|
||||
}
|
||||
|
||||
public static String getDateString(Date date) throws Exception {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERM);
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
public static String getDateString(long timeStamp) throws Exception {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_PATTERM);
|
||||
return dateFormat.format(timeStamp);
|
||||
}
|
||||
|
||||
public static String getTimeString(Date date) throws Exception {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(TIME_PATTERN);
|
||||
return dateFormat.format(date);
|
||||
}
|
||||
|
||||
public static String getTimeString(long timeStamp) throws Exception {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(TIME_PATTERN);
|
||||
return dateFormat.format(timeStamp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Date dateSum (Date date,int countDays){
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DAY_OF_MONTH,countDays);
|
||||
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入参日期所在周的周一周末日期。 日期对应的时间为当日的零点
|
||||
*
|
||||
* @return Map<String, String>(2); key取值范围:firstTime/lastTime
|
||||
*/
|
||||
public static Map<String, Date> getWeedFirstTimeAndLastTime(Date date) {
|
||||
Map<String, Date> returnMap = new HashMap<>();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
//Calendar默认一周的开始是周日。业务需求从周一开始算,所以要"+1"
|
||||
int weekDayAdd = 1;
|
||||
|
||||
try {
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.DAY_OF_WEEK, calendar.getActualMinimum(Calendar.DAY_OF_WEEK));
|
||||
calendar.add(Calendar.DAY_OF_MONTH,weekDayAdd);
|
||||
|
||||
//第一天的时分秒是 00:00:00 这里直接取日期,默认就是零点零分
|
||||
Date thisWeekFirstTime = getDate(getDateString(calendar.getTime()));
|
||||
|
||||
calendar.clear();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.DAY_OF_WEEK, calendar.getActualMaximum(Calendar.DAY_OF_WEEK));
|
||||
calendar.add(Calendar.DAY_OF_MONTH,weekDayAdd);
|
||||
|
||||
//最后一天的时分秒应当是23:59:59。 处理方式是增加一天计算日期再-1
|
||||
calendar.add(Calendar.DAY_OF_MONTH,1);
|
||||
Date nextWeekFirstDay = getDate(getDateString(calendar.getTime()));
|
||||
Date thisWeekLastTime = getTime(getTimeString(nextWeekFirstDay.getTime()-1));
|
||||
|
||||
returnMap.put("firstTime", thisWeekFirstTime);
|
||||
returnMap.put("lastTime", thisWeekLastTime);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return returnMap;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("start:");
|
||||
Date paramTime = getTime(getTimeString(new Long("1607672440731")));
|
||||
|
||||
Map<String, Date> weekDate = getWeedFirstTimeAndLastTime(paramTime);
|
||||
|
||||
for (Map.Entry<String, Date> entry :
|
||||
weekDate.entrySet()) {
|
||||
System.out.println(entry.getKey() + ":" + getTimeString(entry.getValue())+":"+entry.getValue().getTime());
|
||||
}
|
||||
|
||||
long countTimeLong = new Long("1607672440731");
|
||||
|
||||
System.out.println(getTimeString(--countTimeLong));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当天的起始时间Date
|
||||
* @param time 指定日期 例: 2020-12-13 06:12:42
|
||||
* @return 当天起始时间 例: 2020-12-13 00:00:00
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Date getDayStartTime(Date time) throws Exception {
|
||||
return getDate(getDateString(time));
|
||||
}
|
||||
}
|
|
@ -16,4 +16,5 @@ public class JmeterProperties {
|
|||
|
||||
private String home;
|
||||
|
||||
private String heap = "-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m";
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ public class ShiroConfig implements EnvironmentAware {
|
|||
ShiroUtils.loadBaseFilterChain(filterChainDefinitionMap);
|
||||
filterChainDefinitionMap.put("/display/info", "anon");
|
||||
filterChainDefinitionMap.put("/display/file/**", "anon");
|
||||
filterChainDefinitionMap.put("/jmeter/download/**", "anon");
|
||||
filterChainDefinitionMap.put("/**", "apikey, authc");
|
||||
return shiroFilterFactoryBean;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package io.metersphere.performance.controller;
|
||||
|
||||
|
||||
import io.metersphere.performance.service.JmeterFileService;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("jmeter")
|
||||
public class JmeterFileController {
|
||||
@Resource
|
||||
private JmeterFileService jmeterFileService;
|
||||
|
||||
@GetMapping("download")
|
||||
public ResponseEntity<byte[]> downloadJmeterFiles(@RequestParam("testId") String testId, @RequestParam("resourceId") String resourceId,
|
||||
@RequestParam("ratio") double ratio, @RequestParam("startTime") long startTime,
|
||||
@RequestParam("reportId") String reportId, @RequestParam("resourceIndex") int resourceIndex,
|
||||
@RequestParam("threadNum") int threadNum) {
|
||||
byte[] bytes = jmeterFileService.downloadZip(testId, resourceId, ratio, startTime, reportId, resourceIndex, threadNum);
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + testId + ".zip\"")
|
||||
.body(bytes);
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,6 @@ public class EngineContext {
|
|||
private Integer resourceIndex;
|
||||
private Map<String, Object> properties = new HashMap<>();
|
||||
private Map<String, String> testData = new HashMap<>();
|
||||
private Map<String, String> env = new HashMap<>();
|
||||
private Map<String, byte[]> testJars = new HashMap<>();
|
||||
|
||||
public String getTestId() {
|
||||
|
@ -50,14 +49,6 @@ public class EngineContext {
|
|||
this.properties.putAll(props);
|
||||
}
|
||||
|
||||
public Map<String, String> getEnv() {
|
||||
return env;
|
||||
}
|
||||
|
||||
public void setEnv(Map<String, String> env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
public Object getProperty(String key) {
|
||||
return this.properties.get(key);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import io.metersphere.commons.constants.FileType;
|
|||
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.config.KafkaProperties;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.performance.engine.docker.DockerTestEngine;
|
||||
import io.metersphere.performance.parse.EngineSourceParser;
|
||||
|
@ -34,7 +33,6 @@ import java.util.stream.Collectors;
|
|||
public class EngineFactory {
|
||||
private static FileService fileService;
|
||||
private static TestResourcePoolService testResourcePoolService;
|
||||
private static KafkaProperties kafkaProperties;
|
||||
private static Class<? extends KubernetesTestEngine> kubernetesTestEngineClass;
|
||||
|
||||
static {
|
||||
|
@ -99,13 +97,6 @@ public class EngineFactory {
|
|||
engineContext.setStartTime(startTime);
|
||||
engineContext.setReportId(reportId);
|
||||
engineContext.setResourceIndex(resourceIndex);
|
||||
HashMap<String, String> env = new HashMap<String, String>() {{
|
||||
put("BOOTSTRAP_SERVERS", kafkaProperties.getBootstrapServers());
|
||||
put("LOG_TOPIC", kafkaProperties.getLog().getTopic());
|
||||
put("REPORT_ID", reportId);
|
||||
put("RESOURCE_ID", resourceId);
|
||||
}};
|
||||
engineContext.setEnv(env);
|
||||
|
||||
if (StringUtils.isNotEmpty(loadTest.getLoadConfiguration())) {
|
||||
final JSONArray jsonArray = JSONObject.parseArray(loadTest.getLoadConfiguration());
|
||||
|
@ -197,9 +188,4 @@ public class EngineFactory {
|
|||
public void setTestResourcePoolService(TestResourcePoolService testResourcePoolService) {
|
||||
EngineFactory.testResourcePoolService = testResourcePoolService;
|
||||
}
|
||||
|
||||
@Resource
|
||||
public void setKafkaProperties(KafkaProperties kafkaProperties) {
|
||||
EngineFactory.kafkaProperties = kafkaProperties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,17 +6,20 @@ import io.metersphere.base.domain.TestResource;
|
|||
import io.metersphere.commons.constants.ResourceStatusEnum;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.config.JmeterProperties;
|
||||
import io.metersphere.config.KafkaProperties;
|
||||
import io.metersphere.controller.ResultHolder;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.dto.NodeDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.performance.engine.AbstractEngine;
|
||||
import io.metersphere.performance.engine.EngineContext;
|
||||
import io.metersphere.performance.engine.EngineFactory;
|
||||
import io.metersphere.performance.engine.docker.request.TestRequest;
|
||||
import io.metersphere.performance.engine.request.StartTestRequest;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DockerTestEngine extends AbstractEngine {
|
||||
|
@ -60,38 +63,40 @@ public class DockerTestEngine extends AbstractEngine {
|
|||
}
|
||||
|
||||
private void runTest(TestResource resource, double ratio, int resourceIndex) {
|
||||
EngineContext context = null;
|
||||
try {
|
||||
context = EngineFactory.createContext(loadTest, resource.getId(), ratio, this.getStartTime(), this.getReportId(), resourceIndex);
|
||||
} catch (MSException e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException(e);
|
||||
}
|
||||
|
||||
String configuration = resource.getConfiguration();
|
||||
NodeDTO node = JSON.parseObject(configuration, NodeDTO.class);
|
||||
String nodeIp = node.getIp();
|
||||
Integer port = node.getPort();
|
||||
String testId = context.getTestId();
|
||||
String content = context.getContent();
|
||||
|
||||
BaseSystemConfigDTO baseInfo = CommonBeanFactory.getBean(SystemParameterService.class).getBaseInfo();
|
||||
KafkaProperties kafkaProperties = CommonBeanFactory.getBean(KafkaProperties.class);
|
||||
JmeterProperties jmeterProperties = CommonBeanFactory.getBean(JmeterProperties.class);
|
||||
String metersphereUrl = "http://localhost:8081";
|
||||
if (baseInfo != null) {
|
||||
metersphereUrl = baseInfo.getUrl();
|
||||
}
|
||||
|
||||
Map<String, String> env = new HashMap<>();
|
||||
env.put("RATIO", "" + ratio);
|
||||
env.put("RESOURCE_INDEX", "" + resourceIndex);
|
||||
env.put("METERSPHERE_URL", metersphereUrl);
|
||||
env.put("START_TIME", "" + this.getStartTime());
|
||||
env.put("TEST_ID", this.loadTest.getId());
|
||||
env.put("REPORT_ID", this.getReportId());
|
||||
env.put("BOOTSTRAP_SERVERS", kafkaProperties.getBootstrapServers());
|
||||
env.put("LOG_TOPIC", kafkaProperties.getLog().getTopic());
|
||||
env.put("RESOURCE_ID", resource.getId());
|
||||
env.put("THREAD_NUM", "" + threadNum);
|
||||
env.put("HEAP", jmeterProperties.getHeap());
|
||||
|
||||
|
||||
StartTestRequest startTestRequest = new StartTestRequest();
|
||||
startTestRequest.setImage(JMETER_IMAGE);
|
||||
startTestRequest.setEnv(env);
|
||||
|
||||
String uri = String.format(BASE_URL + "/jmeter/container/start", nodeIp, port);
|
||||
|
||||
TestRequest testRequest = new TestRequest();
|
||||
testRequest.setSize(1);
|
||||
testRequest.setTestId(testId);
|
||||
testRequest.setReportId(getReportId());
|
||||
testRequest.setFileString(content);
|
||||
testRequest.setImage(JMETER_IMAGE);
|
||||
testRequest.setTestData(context.getTestData());
|
||||
testRequest.setTestJars(context.getTestJars());
|
||||
testRequest.setEnv(context.getEnv());
|
||||
|
||||
|
||||
ResultHolder result = restTemplate.postForObject(uri, testRequest, ResultHolder.class);
|
||||
ResultHolder result = restTemplate.postForObject(uri, startTestRequest, ResultHolder.class);
|
||||
if (result == null) {
|
||||
MSException.throwException(Translator.get("start_engine_fail"));
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package io.metersphere.performance.engine.docker.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BaseRequest {
|
||||
private String testId;
|
||||
private String reportId;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package io.metersphere.performance.engine.docker.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestRequest extends BaseRequest {
|
||||
private int size;
|
||||
private String fileString;
|
||||
private String image;
|
||||
private Map<String, String> testData = new HashMap<>();
|
||||
private Map<String, String> env = new HashMap<>();
|
||||
private Map<String, byte[]> testJars = new HashMap<>();
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.metersphere.performance.engine.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BaseRequest {
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package io.metersphere.performance.engine.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class StartTestRequest {
|
||||
private String image;
|
||||
private Map<String, String> env = new HashMap<>();
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package io.metersphere.performance.engine.request;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class StopTestRequest {
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package io.metersphere.performance.service;
|
||||
|
||||
|
||||
import com.alibaba.excel.util.CollectionUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.base.domain.LoadTestWithBLOBs;
|
||||
import io.metersphere.base.mapper.LoadTestMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.performance.engine.EngineContext;
|
||||
import io.metersphere.performance.engine.EngineFactory;
|
||||
import org.apache.commons.lang3.SerializationUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@Service
|
||||
public class JmeterFileService {
|
||||
|
||||
@Resource
|
||||
private LoadTestMapper loadTestMapper;
|
||||
|
||||
public byte[] downloadZip(String testId, String resourceId, double ratio, long startTime, String reportId, int resourceIndex, int threadNum) {
|
||||
try {
|
||||
LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(testId);
|
||||
// deep copy
|
||||
LoadTestWithBLOBs subTest = SerializationUtils.clone(loadTest);
|
||||
setThreadNum(subTest, threadNum);
|
||||
EngineContext context = EngineFactory.createContext(subTest, resourceId, ratio, startTime, reportId, resourceIndex);
|
||||
return zipFilesToByteArray(context);
|
||||
} catch (MSException e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
MSException.throwException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void setThreadNum(LoadTestWithBLOBs t, Integer limit) {
|
||||
String loadConfiguration = t.getLoadConfiguration();
|
||||
JSONArray jsonArray = JSON.parseArray(loadConfiguration);
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
if (jsonArray.get(i) instanceof Map) {
|
||||
JSONObject o = jsonArray.getJSONObject(i);
|
||||
if (StringUtils.equals(o.getString("key"), "TargetLevel")) {
|
||||
o.put("value", limit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (jsonArray.get(i) instanceof List) {
|
||||
JSONArray o = jsonArray.getJSONArray(i);
|
||||
for (int j = 0; j < o.size(); j++) {
|
||||
JSONObject b = o.getJSONObject(j);
|
||||
if (StringUtils.equals(b.getString("key"), "TargetLevel")) {
|
||||
b.put("value", limit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 设置线程数
|
||||
t.setLoadConfiguration(jsonArray.toJSONString());
|
||||
}
|
||||
|
||||
private byte[] zipFilesToByteArray(EngineContext context) throws IOException {
|
||||
String testId = context.getTestId();
|
||||
String fileName = testId + ".jmx";
|
||||
|
||||
Map<String, byte[]> files = new HashMap<>();
|
||||
|
||||
// 每个测试生成一个文件夹
|
||||
files.put(fileName, context.getContent().getBytes(StandardCharsets.UTF_8));
|
||||
// 保存测试数据文件
|
||||
Map<String, String> testData = context.getTestData();
|
||||
if (!CollectionUtils.isEmpty(testData)) {
|
||||
for (String k : testData.keySet()) {
|
||||
String v = testData.get(k);
|
||||
files.put("k", v.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
|
||||
// 保存 byte[] jar
|
||||
Map<String, byte[]> jarFiles = context.getTestJars();
|
||||
if (!CollectionUtils.isEmpty(jarFiles)) {
|
||||
for (String k : jarFiles.keySet()) {
|
||||
byte[] v = jarFiles.get(k);
|
||||
files.put("k", v);
|
||||
}
|
||||
}
|
||||
|
||||
return listBytesToZip(files);
|
||||
}
|
||||
|
||||
|
||||
private byte[] listBytesToZip(Map<String, byte[]> mapReport) throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ZipOutputStream zos = new ZipOutputStream(baos);
|
||||
for (Map.Entry<String, byte[]> report : mapReport.entrySet()) {
|
||||
ZipEntry entry = new ZipEntry(report.getKey());
|
||||
entry.setSize(report.getValue().length);
|
||||
zos.putNextEntry(entry);
|
||||
zos.write(report.getValue());
|
||||
}
|
||||
zos.closeEntry();
|
||||
zos.close();
|
||||
return baos.toByteArray();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.dataCount.response.TaskInfoResult;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.base.domain.ScheduleExample;
|
||||
import io.metersphere.base.domain.User;
|
||||
|
@ -9,6 +10,7 @@ import io.metersphere.base.mapper.ScheduleMapper;
|
|||
import io.metersphere.base.mapper.UserMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtScheduleMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
|
@ -25,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
@ -162,4 +165,26 @@ public class ScheduleService {
|
|||
schedule.setUserName(userMap.get(schedule.getUserId()));
|
||||
});
|
||||
}
|
||||
|
||||
public long countTaskByWorkspaceIdAndGroup(String workspaceId,String group) {
|
||||
return extScheduleMapper.countTaskByWorkspaceIdAndGroup(workspaceId,group);
|
||||
}
|
||||
|
||||
public long countTaskByWorkspaceIdAndGroupInThisWeek(String workspaceID, String group) {
|
||||
Map<String, Date> startAndEndDateInWeek = DateUtils.getWeedFirstTimeAndLastTime(new Date());
|
||||
|
||||
Date firstTime = startAndEndDateInWeek.get("firstTime");
|
||||
Date lastTime = startAndEndDateInWeek.get("lastTime");
|
||||
|
||||
if(firstTime==null || lastTime == null){
|
||||
return 0;
|
||||
}else {
|
||||
return extScheduleMapper.countTaskByWorkspaceIdAndGroupAndCreateTimeRange(workspaceID,group,firstTime.getTime(),lastTime.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
public List<TaskInfoResult> findRunningTaskInfoByWorkspaceID(String workspaceID) {
|
||||
List<TaskInfoResult> runningTaskInfoList = extScheduleMapper.findRunningTaskInfoByWorkspaceID(workspaceID);
|
||||
return runningTaskInfoList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,8 +150,8 @@ public class TestPlanService {
|
|||
if (!StringUtils.isBlank(testPlan.getStatus())) {
|
||||
BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId()));
|
||||
String context = getTestPlanContext(testPlans, NoticeConstants.Event.UPDATE);
|
||||
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
|
||||
Map<String, Object> paramMap = getTestPlanParamMap(testPlan);
|
||||
User user = userMapper.selectByPrimaryKey(testPlans.getCreator());
|
||||
Map<String, Object> paramMap = getTestPlanParamMap(testPlans);
|
||||
paramMap.put("creator", user.getName());
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.context(context)
|
||||
|
@ -533,8 +533,8 @@ public class TestPlanService {
|
|||
try {
|
||||
BeanUtils.copyBean(_testPlans, testPlans);
|
||||
String context = getTestPlanContext(_testPlans, NoticeConstants.Event.UPDATE);
|
||||
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
|
||||
Map<String, Object> paramMap = getTestPlanParamMap(testPlan);
|
||||
User user = userMapper.selectByPrimaryKey(_testPlans.getCreator());
|
||||
Map<String, Object> paramMap = getTestPlanParamMap(_testPlans);
|
||||
paramMap.put("creator", user.getName());
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.context(context)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE api_definition_exec_result ADD create_time BIGINT(13) NULL;
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE api_scenario_report ADD execute_type varchar(200) NULL;
|
||||
ALTER TABLE api_definition MODIFY COLUMN description LONGTEXT NULL COMMENT 'Test description';
|
||||
ALTER TABLE api_test_case MODIFY COLUMN description LONGTEXT NULL COMMENT 'Test case description';
|
||||
ALTER TABLE api_scenario MODIFY COLUMN description LONGTEXT NULL COMMENT 'Api scenario description';
|
||||
ALTER TABLE api_scenario_report MODIFY COLUMN description LONGTEXT NULL COMMENT 'Api scenario report description';
|
|
@ -103,6 +103,7 @@
|
|||
if (this.isNotRunning) {
|
||||
try {
|
||||
this.content = JSON.parse(this.report.content);
|
||||
this.$emit('refresh');
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<span v-if="!debug"><el-input size="mini" style="width: 200px" v-model="report.name"/> </span>
|
||||
<span class="time"> {{ report.createTime | timestampFormatDate }}</span>
|
||||
|
||||
<el-button :disabled="isReadOnly" class="export-button" plain type="primary" size="mini" @click="handleExport(report.name)" style="margin-right: 10px">
|
||||
<el-button v-if="!debug" :disabled="isReadOnly" class="export-button" plain type="primary" size="mini" @click="handleExport(report.name)" style="margin-right: 10px">
|
||||
{{$t('test_track.plan_view.export_report')}}
|
||||
</el-button>
|
||||
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
<ms-dropdown v-if="isSqlType" :commands="sqlModes" :default-command="mode" @command="sqlModeChange"/>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_test.definition.request.console')" name="console" class="pane">
|
||||
<pre>{{response.console}}</pre>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-collapse-transition>
|
||||
</div>
|
||||
|
|
|
@ -38,12 +38,13 @@
|
|||
|
||||
<script>
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {getCurrentUser, getUUID,getCurrentProjectID} from "@/common/js/utils";
|
||||
import {getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
import MsTablePagination from "../../../common/pagination/TablePagination";
|
||||
|
||||
export default {
|
||||
name: "MsAddTag",
|
||||
components: {MsDialogFooter,MsTablePagination},
|
||||
components: {MsDialogFooter, MsTablePagination},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
|
@ -84,6 +85,7 @@
|
|||
this.result = this.$post(this.path, this.tagForm, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.initTable();
|
||||
this.tagForm = {};
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -134,12 +134,29 @@
|
|||
this.request.requestResult = requestResult;
|
||||
this.request.id = response.data.id;
|
||||
this.reload();
|
||||
this.sort();
|
||||
} else {
|
||||
this.request.referenced = "Deleted";
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
recursiveSorting(arr) {
|
||||
for (let i in arr) {
|
||||
arr[i].index = Number(i) + 1;
|
||||
if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(arr[i].hashTree);
|
||||
}
|
||||
}
|
||||
},
|
||||
sort() {
|
||||
for (let i in this.request.hashTree) {
|
||||
this.request.hashTree[i].index = Number(i) + 1;
|
||||
if (this.request.hashTree[i].hashTree != undefined && this.request.hashTree[i].hashTree.length > 0) {
|
||||
this.recursiveSorting(this.request.hashTree[i].hashTree);
|
||||
}
|
||||
}
|
||||
},
|
||||
active(item) {
|
||||
item.active = !item.active;
|
||||
this.reload();
|
||||
|
|
|
@ -199,6 +199,7 @@
|
|||
let scenarioIds = this.selection;
|
||||
run.id = getUUID();
|
||||
run.scenarioIds = scenarioIds;
|
||||
run.projectId = getCurrentProjectID();
|
||||
this.$post(url, run, response => {
|
||||
let data = response.data;
|
||||
this.runVisible = true;
|
||||
|
@ -219,8 +220,9 @@
|
|||
this.$emit('edit', row);
|
||||
},
|
||||
reductionApi(row) {
|
||||
let obj = [row.id];
|
||||
this.$post("/api/automation/reduction", obj, response => {
|
||||
row.scenarioDefinition = null;
|
||||
let rows = [row];
|
||||
this.$post("/api/automation/reduction", rows, response => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
})
|
||||
|
@ -232,6 +234,7 @@
|
|||
let scenarioIds = [];
|
||||
scenarioIds.push(row.id);
|
||||
run.id = getUUID();
|
||||
run.projectId = getCurrentProjectID();
|
||||
run.scenarioIds = scenarioIds;
|
||||
this.$post(url, run, response => {
|
||||
let data = response.data;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div></div>
|
||||
</template>
|
||||
<script>
|
||||
import {getUUID} from "@/common/js/utils";
|
||||
import {getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import {createComponent} from "../../definition/components/jmeter/components";
|
||||
|
||||
export default {
|
||||
|
@ -92,10 +92,11 @@
|
|||
let testPlan = createComponent('TestPlan');
|
||||
let threadGroup = createComponent('ThreadGroup');
|
||||
threadGroup.hashTree = [];
|
||||
threadGroup.name = this.runData.name;
|
||||
threadGroup.name = this.runData.name ? this.runData.name : "Debug-Scenario";
|
||||
threadGroup.enableCookieShare = this.runData.enableCookieShare;
|
||||
threadGroup.hashTree.push(this.runData);
|
||||
testPlan.hashTree.push(threadGroup);
|
||||
let reqObj = {id: this.reportId, reportId: this.reportId, environmentId: this.environment, testElement: testPlan};
|
||||
let reqObj = {id: this.reportId, reportId: this.reportId, environmentId: this.environment, testElement: testPlan, projectId: getCurrentProjectID()};
|
||||
let bodyFiles = this.getBodyUploadFiles(reqObj);
|
||||
let url = "/api/automation/run/debug";
|
||||
this.$fileUpload(url, null, bodyFiles, reqObj, response => {
|
||||
|
|
|
@ -1,137 +1,142 @@
|
|||
<template>
|
||||
<el-card class="card-content">
|
||||
<div class="ms-main-div">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<!--操作按钮-->
|
||||
<div class="ms-opt-btn">
|
||||
<el-button type="primary" size="small" @click="editScenario">{{$t('commons.save')}}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div class="tip">{{$t('test_track.plan_view.base_info')}}</div>
|
||||
<el-form :model="currentScenario" label-position="right" label-width="80px" size="small" :rules="rules" ref="currentScenario" style="margin-right: 20px">
|
||||
<!-- 基础信息 -->
|
||||
<div>
|
||||
<div class="ms-main-div" @click="showAll">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input class="ms-scenario-input" size="small" v-model="currentScenario.name"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.module.module')" prop="apiScenarioModuleId">
|
||||
<el-select class="ms-scenario-input" size="small" v-model="currentScenario.apiScenarioModuleId">
|
||||
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-col>
|
||||
<!--操作按钮-->
|
||||
<div class="ms-opt-btn">
|
||||
<el-button type="primary" size="small" @click="editScenario">{{$t('commons.save')}}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.status')" prop="status">
|
||||
<el-select class="ms-scenario-input" size="small" v-model="currentScenario.status">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('api_test.definition.request.responsible')" prop="principal">
|
||||
<el-select v-model="currentScenario.principal"
|
||||
:placeholder="$t('api_test.definition.request.responsible')" filterable size="small"
|
||||
class="ms-scenario-input">
|
||||
<el-option
|
||||
v-for="item in maintainerOptions"
|
||||
:key="item.id"
|
||||
:label="item.id + ' (' + item.name + ')'"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div class="tip">{{$t('test_track.plan_view.base_info')}}</div>
|
||||
<el-form :model="currentScenario" label-position="right" label-width="80px" size="small" :rules="rules" ref="currentScenario" style="margin-right: 20px">
|
||||
<!-- 基础信息 -->
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input class="ms-scenario-input" size="small" v-model="currentScenario.name"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.module.module')" prop="apiScenarioModuleId">
|
||||
<el-select class="ms-scenario-input" size="small" v-model="currentScenario.apiScenarioModuleId">
|
||||
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.status')" prop="status">
|
||||
<el-select class="ms-scenario-input" size="small" v-model="currentScenario.status">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('api_test.definition.request.responsible')" prop="principal">
|
||||
<el-select v-model="currentScenario.principal"
|
||||
:placeholder="$t('api_test.definition.request.responsible')" filterable size="small"
|
||||
class="ms-scenario-input">
|
||||
<el-option
|
||||
v-for="item in maintainerOptions"
|
||||
:key="item.id"
|
||||
:label="item.id + ' (' + item.name + ')'"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.case.priority')" prop="level">
|
||||
<el-select class="ms-scenario-input" size="small" v-model="currentScenario.level">
|
||||
<el-option v-for="item in levels" :key="item.id" :label="item.label" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
|
||||
<el-select v-model="currentScenario.followPeople"
|
||||
:placeholder="$t('api_test.automation.follow_people')" filterable size="small"
|
||||
class="ms-scenario-input">
|
||||
<el-option
|
||||
v-for="item in maintainerOptions"
|
||||
:key="item.id"
|
||||
:label="item.id + ' (' + item.name + ')'"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('test_track.case.priority')" prop="level">
|
||||
<el-select class="ms-scenario-input" size="small" v-model="currentScenario.level">
|
||||
<el-option v-for="item in levels" :key="item.id" :label="item.label" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('api_test.automation.follow_people')" prop="followPeople">
|
||||
<el-select v-model="currentScenario.followPeople"
|
||||
:placeholder="$t('api_test.automation.follow_people')" filterable size="small"
|
||||
class="ms-scenario-input">
|
||||
<el-option
|
||||
v-for="item in maintainerOptions"
|
||||
:key="item.id"
|
||||
:label="item.id + ' (' + item.name + ')'"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="Tag" prop="tagId">
|
||||
<el-select v-model="currentScenario.tagId" size="small" class="ms-scenario-input" placeholder="Tag" :multiple="true">
|
||||
<el-option
|
||||
v-for="item in tags"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
<el-button size="mini" type="primary" @click="openTagConfig" class="ms-scenario-button">
|
||||
{{ $t('api_test.automation.create_tag') }}
|
||||
</el-button>
|
||||
<template v-slot:empty>
|
||||
<div>
|
||||
<el-button size="mini" type="primary" @click="openTagConfig" class="ms-scenario-button">
|
||||
{{ $t('api_test.automation.create_tag') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-select>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="Tag" prop="tagId">
|
||||
<el-select v-model="currentScenario.tagId" size="small" class="ms-scenario-input" placeholder="Tag" :multiple="true">
|
||||
<el-option
|
||||
v-for="item in tags"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"/>
|
||||
<el-button size="mini" type="primary" @click="openTagConfig" class="ms-scenario-button">
|
||||
{{ $t('api_test.automation.create_tag') }}
|
||||
</el-button>
|
||||
<template v-slot:empty>
|
||||
<div>
|
||||
<el-button size="mini" type="primary" @click="openTagConfig" class="ms-scenario-button">
|
||||
{{ $t('api_test.automation.create_tag') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-select>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.description')" prop="description">
|
||||
<el-input class="ms-http-textarea"
|
||||
v-model="currentScenario.description"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 10}"
|
||||
:rows="2" size="small"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label="$t('commons.description')" prop="description">
|
||||
<el-input class="ms-http-textarea"
|
||||
v-model="currentScenario.description"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 10}"
|
||||
:rows="2" size="small"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<!-- 场景步骤-->
|
||||
<div v-loading="loading">
|
||||
<p class="tip">{{$t('api_test.automation.scenario_step')}} </p>
|
||||
<div @click="showAll">
|
||||
<p class="tip">{{$t('api_test.automation.scenario_step')}} </p>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="21">
|
||||
<!-- 调试部分 -->
|
||||
<div class="ms-debug-div">
|
||||
<div class="ms-debug-div" @click="showAll">
|
||||
<el-row style="margin: 5px">
|
||||
<el-col :span="6" class="ms-col-one">
|
||||
{{currentScenario.name ===undefined || ''? $t('api_test.scenario.name') : currentScenario.name}}
|
||||
</el-col>
|
||||
<el-col :span="4" class="ms-col-one">
|
||||
<el-col :span="3" class="ms-col-one">
|
||||
{{$t('api_test.automation.step_total')}}:{{scenarioDefinition.length}}
|
||||
</el-col>
|
||||
<el-col :span="4" class="ms-col-one">
|
||||
<el-link style="font-size: 13px" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}:
|
||||
{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length-1: 0}}
|
||||
</el-link>
|
||||
<el-col :span="3" class="ms-col-one">
|
||||
<el-link class="head" @click="showScenarioParameters">{{$t('api_test.automation.scenario_total')}}</el-link>
|
||||
:{{this.currentScenario.variables!=undefined?this.currentScenario.variables.length-1: 0}}
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="3">
|
||||
<el-checkbox v-model="enableCookieShare" style="margin-top: 5px">{{ '共享cookie' }}</el-checkbox>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
{{$t('api_test.definition.request.run_env')}}:
|
||||
<el-select v-model="currentEnvironmentId" size="small" class="ms-htt-width"
|
||||
:placeholder="$t('api_test.definition.request.run_env')"
|
||||
|
@ -157,7 +162,7 @@
|
|||
</el-row>
|
||||
</div>
|
||||
<!-- 场景步骤内容 -->
|
||||
<div style="margin-top: 10px" v-loading="loading">
|
||||
<div v-loading="loading">
|
||||
<el-tree node-key="resourceId" :props="props" :data="scenarioDefinition"
|
||||
:default-expanded-keys="expandedNode"
|
||||
:expand-on-click-node="false"
|
||||
|
@ -197,37 +202,37 @@
|
|||
<el-col :span="3" class="ms-left-cell">
|
||||
<el-button type="primary" icon="el-icon-refresh" size="small" @click="showAll">{{$t('commons.show_all')}}</el-button>
|
||||
<br/>
|
||||
<div v-if="operatingElements.indexOf('HTTPSamplerProxy')>0 || operatingElements.indexOf('DubboSampler')>0 || operatingElements.indexOf('JDBCSampler')>0 || operatingElements.indexOf('TCPSampler')>0 ">
|
||||
<div v-if="operatingElements.indexOf('HTTPSamplerProxy')!=-1 || operatingElements.indexOf('DubboSampler')!=-1 || operatingElements.indexOf('JDBCSampler')!=-1 || operatingElements.indexOf('TCPSampler')!=-1 ">
|
||||
<el-button class="ms-right-buttion ms-btn-1" size="small" @click="apiListImport">+{{$t('api_test.automation.api_list_import')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('OT_IMPORT')>0">
|
||||
<div v-if="operatingElements.indexOf('OT_IMPORT')!=-1">
|
||||
<el-button class="ms-right-buttion" size="small" style="color: #409EFF;background-color: #EEF5FE" @click="addComponent('OT_IMPORT')">+{{$t('api_test.automation.external_import')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('ConstantTimer')>0">
|
||||
<div v-if="operatingElements.indexOf('ConstantTimer')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-3" size="small" @click="addComponent('ConstantTimer')">+{{$t('api_test.automation.wait_controller')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('IfController')>0">
|
||||
<div v-if="operatingElements.indexOf('IfController')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-4" size="small" @click="addComponent('IfController')">+{{$t('api_test.automation.if_controller')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('scenario')===0">
|
||||
<el-button class="ms-right-buttion ms-btn-5" size="small" @click="addComponent('scenario')">+{{$t('api_test.automation.scenario_import')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('JSR223Processor')>0">
|
||||
<div v-if="operatingElements.indexOf('JSR223Processor')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-6" size="small" @click="addComponent('JSR223Processor')">+{{$t('api_test.automation.customize_script')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('CustomizeReq')>0">
|
||||
<div v-if="operatingElements.indexOf('CustomizeReq')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-7" size="small" @click="addComponent('CustomizeReq')">+{{$t('api_test.automation.customize_req')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('JSR223PreProcessor')>0">
|
||||
<div v-if="operatingElements.indexOf('JSR223PreProcessor')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-8" size="small" @click="addComponent('JSR223PreProcessor')">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('JSR223PostProcessor')>0">
|
||||
<div v-if="operatingElements.indexOf('JSR223PostProcessor')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-9" size="small" @click="addComponent('JSR223PostProcessor')">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('Assertions')>0">
|
||||
<div v-if="operatingElements.indexOf('Assertions')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-10" size="small" @click="addComponent('Assertions')">+{{$t('api_test.definition.request.assertions_rule')}}</el-button>
|
||||
</div>
|
||||
<div v-if="operatingElements.indexOf('Extract')>0">
|
||||
<div v-if="operatingElements.indexOf('Extract')!=-1">
|
||||
<el-button class="ms-right-buttion ms-btn-11" size="small" @click="addComponent('Extract')">+{{$t('api_test.definition.request.extract_param')}}</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
|
@ -236,7 +241,7 @@
|
|||
</div>
|
||||
|
||||
<!--接口列表-->
|
||||
<el-drawer :visible.sync="apiListVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.api_list_import')" :modal="false" size="90%">
|
||||
<el-drawer :visible.sync="apiListVisible" :destroy-on-close="true" direction="ltr" :withHeader="true" :modal="false" size="90%">
|
||||
<ms-api-definition :visible="visibleRef" :currentRow="currentRow"/>
|
||||
<el-button style="float: right;margin: 0px 20px 0px" type="primary" @click="pushApiOrCase('REF')">{{$t('api_test.scenario.reference')}}</el-button>
|
||||
<el-button style="float: right;" type="primary" @click="pushApiOrCase('Copy')">{{ $t('commons.copy') }}</el-button>
|
||||
|
@ -245,7 +250,6 @@
|
|||
<!--自定义接口-->
|
||||
<el-drawer :visible.sync="customizeVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.customize_req')" style="overflow: auto" :modal="false" size="90%">
|
||||
<ms-api-customize :request="customizeRequest" @addCustomizeApi="addCustomizeApi"/>
|
||||
<el-button style="float: right;margin: 20px" @click="addCustomizeApi">{{$t('commons.save')}}</el-button>
|
||||
</el-drawer>
|
||||
<!--场景导入 -->
|
||||
<el-drawer :visible.sync="scenarioVisible" :destroy-on-close="true" direction="ltr" :withHeader="false" :title="$t('api_test.automation.scenario_import')" style="overflow: auto" :modal="false" size="90%">
|
||||
|
@ -360,6 +364,7 @@
|
|||
reportId: "",
|
||||
projectId: "",
|
||||
visibleRef: "",
|
||||
enableCookieShare: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -486,6 +491,9 @@
|
|||
} else {
|
||||
request = item.request;
|
||||
}
|
||||
if (item.protocol) {
|
||||
request.protocol = item.protocol;
|
||||
}
|
||||
request.id = item.id;
|
||||
request.name = item.name;
|
||||
request.refType = refType;
|
||||
|
@ -552,7 +560,7 @@
|
|||
remove(row, node) {
|
||||
const parent = node.parent
|
||||
const hashTree = parent.data.hashTree || parent.data;
|
||||
const index = hashTree.findIndex(d => d.id != undefined && row.id != undefined && d.id === row.id)
|
||||
const index = hashTree.findIndex(d => d.resourceId != undefined && row.resourceId != undefined && d.resourceId === row.resourceId)
|
||||
hashTree.splice(index, 1);
|
||||
this.sort();
|
||||
this.reload();
|
||||
|
@ -581,7 +589,7 @@
|
|||
}
|
||||
this.debugData = {
|
||||
id: this.currentScenario.id, name: this.currentScenario.name, type: "scenario",
|
||||
variables: this.currentScenario.variables, referenced: 'Created',
|
||||
variables: this.currentScenario.variables, referenced: 'Created', enableCookieShare: this.enableCookieShare,
|
||||
environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
|
||||
};
|
||||
this.reportId = getUUID().substring(0, 8);
|
||||
|
@ -606,13 +614,16 @@
|
|||
environmentConfigClose() {
|
||||
this.getEnvironments();
|
||||
},
|
||||
allowDrop(draggingNode, dropNode, type) {
|
||||
if (dropNode.data.type === draggingNode.data.type || ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1) {
|
||||
allowDrop(draggingNode, dropNode, dropType) {
|
||||
if (dropType != "inner") {
|
||||
return true;
|
||||
}
|
||||
else if (dropType === "inner" && ELEMENTS.get(dropNode.data.type).indexOf(draggingNode.data.type) != -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
allowDrag() {
|
||||
allowDrag(draggingNode, dropNode, dropType) {
|
||||
this.sort();
|
||||
this.reload();
|
||||
},
|
||||
|
@ -722,6 +733,7 @@
|
|||
if (obj) {
|
||||
this.currentEnvironmentId = obj.environmentId;
|
||||
this.currentScenario.variables = obj.variables;
|
||||
this.enableCookieShare = obj.enableCookieShare;
|
||||
this.scenarioDefinition = obj.hashTree;
|
||||
}
|
||||
}
|
||||
|
@ -738,7 +750,7 @@
|
|||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||
// 构建一个场景对象 方便引用处理
|
||||
let scenario = {
|
||||
id: this.currentScenario.id, name: this.currentScenario.name, variables: this.currentScenario.variables,
|
||||
id: this.currentScenario.id, enableCookieShare: this.enableCookieShare, name: this.currentScenario.name, variables: this.currentScenario.variables,
|
||||
type: "scenario", referenced: 'Created', environmentId: this.currentEnvironmentId, hashTree: this.scenarioDefinition
|
||||
};
|
||||
this.currentScenario.scenarioDefinition = scenario;
|
||||
|
@ -899,4 +911,9 @@
|
|||
/deep/ .el-drawer__header {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.head {
|
||||
border-bottom: 1px solid #474849;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
export const ELEMENTS = new Map([
|
||||
['ALL', ["scenario", "HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
|
||||
['scenario', ["API", "CASE", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
|
||||
['HTTPSamplerProxy', ["IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['DubboSampler', ["IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['JDBCSampler', ["IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['TCPSampler', ["IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['OT_IMPORT', []],
|
||||
['IfController', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
|
||||
['ConstantTimer', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "IfController", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
|
||||
['JSR223Processor', []],
|
||||
['ALL', ["scenario", "HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "CustomizeReq"]],
|
||||
['scenario', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "CASE", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "CustomizeReq"]],
|
||||
['HTTPSamplerProxy', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['DubboSampler', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['JDBCSampler', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['TCPSampler', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['OT_IMPORT', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['IfController', ["IfController", "HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract", "CustomizeReq"]],
|
||||
['ConstantTimer', []],
|
||||
['JSR223Processor', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['JSR223PreProcessor', []],
|
||||
['JSR223PostProcessor', []],
|
||||
['Assertions', []],
|
||||
['Extract', []],
|
||||
['CustomizeReq', ["HTTPSamplerProxy", "DubboSampler", "JDBCSampler", "TCPSampler", "OT_IMPORT", "IfController", "ConstantTimer", "JSR223Processor", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
['CustomizeReq', ["ConstantTimer", "JSR223PreProcessor", "JSR223PostProcessor", "Assertions", "Extract"]],
|
||||
])
|
||||
|
||||
export const ELEMENT_TYPE = {
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
<div class="variable-combine"> {{api.name}}</div>
|
||||
</el-col>
|
||||
<el-col :span="api.protocol==='HTTP'? 1:3">
|
||||
<ms-tag v-if="api.status == 'Prepare'" type="info" effect="plain" :content="$t('test_track.plan.plan_status_prepare')"/>
|
||||
<ms-tag v-if="api.status == 'Underway'" type="warning" effect="plain" :content="$t('test_track.plan.plan_status_running')"/>
|
||||
<ms-tag v-if="api.status == 'Completed'" type="success" effect="plain" :content="$t('test_track.plan.plan_status_completed')"/>
|
||||
<el-tag size="mini" :style="{'background-color': getColor(true, api.method), border: getColor(true, api.method)}" class="api-el-tag">
|
||||
{{ api.method}}
|
||||
</el-tag>
|
||||
</el-col>
|
||||
<el-col :span="api.protocol==='HTTP'? 4:0">
|
||||
<div class="variable-combine" style="margin-left: 10px">{{api.path ===null ? " " : api.path}}</div>
|
||||
|
@ -151,6 +151,7 @@
|
|||
import MsTcpBasisParameters from "../../../definition/components/request/tcp/BasisParameters";
|
||||
import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters";
|
||||
import MsApiExtendBtns from "../../../definition/components/reference/ApiExtendBtns";
|
||||
import {API_METHOD_COLOUR} from "../../../definition/model/JsonData";
|
||||
|
||||
export default {
|
||||
name: 'ApiCaseList',
|
||||
|
@ -192,7 +193,7 @@
|
|||
reportId: "",
|
||||
projectId: "",
|
||||
checkedCases: new Set(),
|
||||
|
||||
methodColorMap: new Map(API_METHOD_COLOUR),
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
@ -403,6 +404,11 @@
|
|||
environmentConfigClose() {
|
||||
this.getEnvironments();
|
||||
},
|
||||
getColor(enable, method) {
|
||||
if (enable) {
|
||||
return this.methodColorMap.get(method);
|
||||
}
|
||||
},
|
||||
caseChecked(row) {
|
||||
row.protocol = this.api.protocol;
|
||||
row.hashTree = [];
|
||||
|
@ -477,6 +483,9 @@
|
|||
padding: 7px;
|
||||
}
|
||||
|
||||
.api-el-tag {
|
||||
color: white;
|
||||
}
|
||||
.is-selected {
|
||||
background: #EFF7FF;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<ms-container>
|
||||
<ms-aside-container>
|
||||
<ms-node-tree @selectModule="selectModule" @getApiModuleTree="initTree" @changeProtocol="changeProtocol"
|
||||
<ms-node-tree @nodeSelectEvent="selectModule" @getApiModuleTree="initTree" @protocolChange="changeProtocol"
|
||||
@refresh="refresh" @saveAsEdit="editApi" @exportAPI="exportAPI"/>
|
||||
</ms-aside-container>
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
this.isHide = true;
|
||||
},
|
||||
selectModule(data) {
|
||||
this.currentModule = data;
|
||||
this.currentModule = data.data;
|
||||
},
|
||||
exportAPI() {
|
||||
if (!this.$refs.apiList[0].tableData) {
|
||||
|
|
|
@ -76,14 +76,14 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<ms-table-pagination :change="initApiTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
<ms-table-pagination :change="initTable" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
</el-card>
|
||||
</div>
|
||||
<div id="svgResize"/>
|
||||
<div id="svgDown">
|
||||
<ms-bottom-container v-bind:enableAsideHidden="isHide">
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initApiTable" :visible="visible" :currentRow="currentRow" :api="selectApi"/>
|
||||
<ms-api-case-list @apiCaseClose="apiCaseClose" @refresh="initTable" :visible="visible" :currentRow="currentRow" :api="selectApi"/>
|
||||
</ms-bottom-container>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -150,38 +150,35 @@
|
|||
},
|
||||
created: function () {
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
},
|
||||
mounted() {
|
||||
this.dragControllerDiv();
|
||||
},
|
||||
watch: {
|
||||
currentModule() {
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
this.apiCaseClose();
|
||||
},
|
||||
visible() {
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
this.apiCaseClose();
|
||||
},
|
||||
currentProtocol() {
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
this.apiCaseClose();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initApiTable() {
|
||||
initTable() {
|
||||
this.selectRows = new Set();
|
||||
this.condition.filters = ["Prepare", "Underway", "Completed"];
|
||||
if (this.currentModule != null) {
|
||||
if (this.currentModule.id == "root") {
|
||||
this.condition.moduleIds = [];
|
||||
} else if (this.currentModule.id == "gc") {
|
||||
this.condition.moduleIds = [];
|
||||
this.condition.filters = ["Trash"];
|
||||
}
|
||||
else {
|
||||
this.condition.moduleIds = this.currentModule.ids;
|
||||
}
|
||||
if (this.currentModule) {
|
||||
this.condition.moduleIds = [this.currentModule.id];
|
||||
}
|
||||
if (this.trashEnable) {
|
||||
this.condition.filters = ["Trash"];
|
||||
this.condition.moduleIds = [];
|
||||
}
|
||||
if (this.projectId != null) {
|
||||
this.condition.projectId = this.projectId;
|
||||
|
@ -193,7 +190,6 @@
|
|||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
});
|
||||
this.selectRows = new Set();
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
row.hashTree = [];
|
||||
|
@ -241,7 +237,7 @@
|
|||
}
|
||||
},
|
||||
search() {
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
},
|
||||
buildPagePath(path) {
|
||||
return path + "/" + this.currentPage + "/" + this.pageSize;
|
||||
|
@ -268,7 +264,7 @@
|
|||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$post('/api/definition/deleteBatch/', ids, () => {
|
||||
this.selectRows.clear();
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
}
|
||||
|
@ -282,7 +278,7 @@
|
|||
let ids = Array.from(this.selectRows).map(row => row.id);
|
||||
this.$post('/api/definition/removeToGc/', ids, () => {
|
||||
this.selectRows.clear();
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
});
|
||||
}
|
||||
|
@ -307,7 +303,7 @@
|
|||
if (this.currentModule != undefined && this.currentModule.id == "gc") {
|
||||
this.$get('/api/definition/delete/' + api.id, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -318,7 +314,7 @@
|
|||
let ids = [api.id];
|
||||
this.$post('/api/definition/removeToGc/', ids, () => {
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initApiTable();
|
||||
this.initTable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,10 +78,10 @@
|
|||
|
||||
<!-- 测试-->
|
||||
<div v-else-if="item.type=== 'TEST'" class="ms-api-div">
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="runTestData" @saveAsApi="editApi" v-if="currentProtocol==='DUBBO'"/>
|
||||
<ms-run-test-http-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='HTTP'"/>
|
||||
<ms-run-test-tcp-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='TCP'"/>
|
||||
<ms-run-test-sql-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='SQL'"/>
|
||||
<ms-run-test-dubbo-page :currentProtocol="currentProtocol" :api-data="item.api" @saveAsApi="editApi" v-if="currentProtocol==='DUBBO'"/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
|
@ -144,7 +144,6 @@
|
|||
selectNodeIds: [],
|
||||
currentApi: {},
|
||||
moduleOptions: {},
|
||||
runTestData: {},
|
||||
trashEnable: false,
|
||||
apiTabs: [{
|
||||
title: this.$t('api_test.definition.api_title'),
|
||||
|
@ -260,18 +259,17 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
this.runTestData = data;
|
||||
},
|
||||
runTest(data) {
|
||||
this.setTabTitle(data);
|
||||
this.handleCommand("TEST");
|
||||
this.handleTabsEdit(this.$t("commons.api"), "TEST", data);
|
||||
},
|
||||
saveApi(data) {
|
||||
this.setTabTitle(data);
|
||||
this.$refs.apiList[0].initApiTable(data);
|
||||
this.$refs.apiList[0].initTable(data);
|
||||
},
|
||||
|
||||
showExecResult(row){
|
||||
showExecResult(row) {
|
||||
this.debug(row);
|
||||
},
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue