Merge branch 'master' into v1.12
This commit is contained in:
commit
d0f035e19b
|
@ -0,0 +1,180 @@
|
|||
package io.metersphere.api.cache;
|
||||
|
||||
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
import io.metersphere.commons.constants.TestPlanApiExecuteStatus;
|
||||
import io.metersphere.commons.constants.TestPlanResourceType;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author song.tianyang
|
||||
* @Date 2021/8/21 5:15 下午
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class TestPlanExecuteInfo {
|
||||
private String reportId;
|
||||
private Map<String, String> apiCaseExecInfo = new HashMap<>();
|
||||
private Map<String, String> apiScenarioCaseExecInfo = new HashMap<>();
|
||||
private Map<String, String> loadCaseExecInfo = new HashMap<>();
|
||||
|
||||
private Map<String, ApiDefinitionExecResult> apiCaseExecuteReportMap = new HashMap<>();
|
||||
private Map<String, APIScenarioReportResult> apiScenarioReportReportMap = new HashMap<>();
|
||||
private Map<String,String> loadCaseReportIdMap = new HashMap<>();
|
||||
|
||||
private boolean reportDataInDataBase;
|
||||
|
||||
int lastUnFinishedNumCount = 0;
|
||||
long lastFinishedNumCountTime = 0;
|
||||
|
||||
private boolean isApiCaseAllExecuted;
|
||||
private boolean isScenarioAllExecuted;
|
||||
private boolean isLoadCaseAllExecuted;
|
||||
|
||||
public synchronized void updateExecuteInfo(Map<String, String> apiCaseExecInfo, Map<String, String> apiScenarioCaseExecInfo, Map<String, String> loadCaseExecInfo) {
|
||||
if (MapUtils.isNotEmpty(apiCaseExecInfo)) {
|
||||
this.apiCaseExecInfo.putAll(apiCaseExecInfo);
|
||||
}
|
||||
|
||||
if (MapUtils.isNotEmpty(apiScenarioCaseExecInfo)) {
|
||||
this.apiScenarioCaseExecInfo.putAll(apiScenarioCaseExecInfo);
|
||||
}
|
||||
|
||||
if (MapUtils.isNotEmpty(loadCaseExecInfo)) {
|
||||
this.loadCaseExecInfo.putAll(loadCaseExecInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void updateExecuteResult(Map<String, ApiDefinitionExecResult> apiCaseExecResultInfo, Map<String, APIScenarioReportResult> apiScenarioCaseExecResultInfo, Map<String, String> loadCaseExecResultInfo) {
|
||||
if (MapUtils.isNotEmpty(apiCaseExecResultInfo)) {
|
||||
this.apiCaseExecuteReportMap.putAll(apiCaseExecResultInfo);
|
||||
}
|
||||
|
||||
if (MapUtils.isNotEmpty(apiScenarioCaseExecResultInfo)) {
|
||||
this.apiScenarioReportReportMap.putAll(apiScenarioCaseExecResultInfo);
|
||||
}
|
||||
|
||||
if (MapUtils.isNotEmpty(loadCaseExecResultInfo)) {
|
||||
this.loadCaseReportIdMap.putAll(loadCaseExecResultInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized int countUnFinishedNum() {
|
||||
int unFinishedCount = 0;
|
||||
|
||||
this.isApiCaseAllExecuted = true;
|
||||
this.isScenarioAllExecuted = true;
|
||||
this.isLoadCaseAllExecuted = true;
|
||||
|
||||
for (String result : apiCaseExecInfo.values()) {
|
||||
if (StringUtils.equalsIgnoreCase(result, TestPlanApiExecuteStatus.RUNNING.name())) {
|
||||
unFinishedCount++;
|
||||
if (this.isApiCaseAllExecuted) {
|
||||
this.isApiCaseAllExecuted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String result : apiScenarioCaseExecInfo.values()) {
|
||||
if (StringUtils.equalsIgnoreCase(result, TestPlanApiExecuteStatus.RUNNING.name())) {
|
||||
unFinishedCount++;
|
||||
if (this.isScenarioAllExecuted) {
|
||||
isScenarioAllExecuted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String result : loadCaseExecInfo.values()) {
|
||||
if (StringUtils.equalsIgnoreCase(result, TestPlanApiExecuteStatus.RUNNING.name())) {
|
||||
unFinishedCount++;
|
||||
if (this.isLoadCaseAllExecuted) {
|
||||
isLoadCaseAllExecuted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lastUnFinishedNumCount != unFinishedCount) {
|
||||
lastUnFinishedNumCount = unFinishedCount;
|
||||
lastFinishedNumCountTime = System.currentTimeMillis();
|
||||
}
|
||||
return unFinishedCount;
|
||||
}
|
||||
|
||||
public Map<String, Map<String, String>> getExecutedResult() {
|
||||
Map<String, Map<String, String>> resourceTypeMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, String> entry : apiCaseExecInfo.entrySet()) {
|
||||
String resourceId = entry.getKey();
|
||||
String executeResult = entry.getValue();
|
||||
String resourceType = TestPlanResourceType.API_CASE.name();
|
||||
|
||||
if (resourceTypeMap.containsKey(resourceType)) {
|
||||
resourceTypeMap.get(resourceType).put(resourceId, executeResult);
|
||||
} else {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(resourceId, executeResult);
|
||||
resourceTypeMap.put(resourceType, map);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> entry : apiScenarioCaseExecInfo.entrySet()) {
|
||||
String resourceId = entry.getKey();
|
||||
String executeResult = entry.getValue();
|
||||
String resourceType = TestPlanResourceType.SCENARIO_CASE.name();
|
||||
|
||||
if (resourceTypeMap.containsKey(resourceType)) {
|
||||
resourceTypeMap.get(resourceType).put(resourceId, executeResult);
|
||||
} else {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(resourceId, executeResult);
|
||||
resourceTypeMap.put(resourceType, map);
|
||||
}
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> entry : loadCaseExecInfo.entrySet()) {
|
||||
String resourceId = entry.getKey();
|
||||
String executeResult = entry.getValue();
|
||||
String resourceType = TestPlanResourceType.PERFORMANCE_CASE.name();
|
||||
|
||||
if (resourceTypeMap.containsKey(resourceType)) {
|
||||
resourceTypeMap.get(resourceType).put(resourceId, executeResult);
|
||||
} else {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put(resourceId, executeResult);
|
||||
resourceTypeMap.put(resourceType, map);
|
||||
}
|
||||
}
|
||||
|
||||
return resourceTypeMap;
|
||||
}
|
||||
|
||||
public void finishAllTask() {
|
||||
for (Map.Entry<String, String> entry : apiCaseExecInfo.entrySet()) {
|
||||
String resourceId = entry.getKey();
|
||||
String executeResult = entry.getValue();
|
||||
if (StringUtils.equalsIgnoreCase(executeResult, TestPlanApiExecuteStatus.RUNNING.name())) {
|
||||
apiCaseExecInfo.put(resourceId, TestPlanApiExecuteStatus.FAILD.name());
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, String> entry : apiScenarioCaseExecInfo.entrySet()) {
|
||||
String resourceId = entry.getKey();
|
||||
String executeResult = entry.getValue();
|
||||
if (StringUtils.equalsIgnoreCase(executeResult, TestPlanApiExecuteStatus.RUNNING.name())) {
|
||||
apiScenarioCaseExecInfo.put(resourceId, TestPlanApiExecuteStatus.FAILD.name());
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, String> entry : loadCaseExecInfo.entrySet()) {
|
||||
String resourceId = entry.getKey();
|
||||
String executeResult = entry.getValue();
|
||||
if (StringUtils.equalsIgnoreCase(executeResult, TestPlanApiExecuteStatus.RUNNING.name())) {
|
||||
loadCaseExecInfo.put(resourceId, TestPlanApiExecuteStatus.FAILD.name());
|
||||
}
|
||||
}
|
||||
|
||||
this.countUnFinishedNum();
|
||||
}
|
||||
}
|
78
backend/src/main/java/io/metersphere/api/cache/TestPlanReportExecuteCatch.java
vendored
Normal file
78
backend/src/main/java/io/metersphere/api/cache/TestPlanReportExecuteCatch.java
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
package io.metersphere.api.cache;
|
||||
|
||||
import io.metersphere.api.dto.automation.APIScenarioReportResult;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResult;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author song.tianyang
|
||||
* @Date 2021/8/20 3:29 下午
|
||||
*/
|
||||
public class TestPlanReportExecuteCatch {
|
||||
private static Map<String, TestPlanExecuteInfo> testPlanReportMap = new HashMap<>();
|
||||
|
||||
private TestPlanReportExecuteCatch() {
|
||||
}
|
||||
|
||||
public synchronized static void addApiTestPlanExecuteInfo(String reportId,
|
||||
Map<String, String> apiCaseExecInfo, Map<String, String> apiScenarioCaseExecInfo, Map<String, String> loadCaseExecInfo) {
|
||||
if(testPlanReportMap == null){
|
||||
testPlanReportMap = new HashMap<>();
|
||||
}
|
||||
if(apiCaseExecInfo == null){
|
||||
apiCaseExecInfo = new HashMap<>();
|
||||
}
|
||||
if(apiScenarioCaseExecInfo == null){
|
||||
apiScenarioCaseExecInfo = new HashMap<>();
|
||||
}
|
||||
if(loadCaseExecInfo == null){
|
||||
loadCaseExecInfo = new HashMap<>();
|
||||
}
|
||||
|
||||
TestPlanExecuteInfo executeInfo = new TestPlanExecuteInfo();
|
||||
executeInfo.setReportId(reportId);
|
||||
executeInfo.setApiCaseExecInfo(apiCaseExecInfo);
|
||||
executeInfo.setApiScenarioCaseExecInfo(apiScenarioCaseExecInfo);
|
||||
executeInfo.setLoadCaseExecInfo(loadCaseExecInfo);
|
||||
testPlanReportMap.put(reportId,executeInfo);
|
||||
}
|
||||
|
||||
public synchronized static void updateApiTestPlanExecuteInfo(String reportId,
|
||||
Map<String, String> apiCaseExecInfo, Map<String, String> apiScenarioCaseExecInfo, Map<String, String> loadCaseExecInfo) {
|
||||
if(testPlanReportMap != null && testPlanReportMap.containsKey(reportId)){
|
||||
testPlanReportMap.get(reportId).updateExecuteInfo(apiCaseExecInfo,apiScenarioCaseExecInfo,loadCaseExecInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static void updateTestPlanExecuteResultInfo(String reportId,
|
||||
Map<String, ApiDefinitionExecResult> apiCaseExecResultInfo, Map<String, APIScenarioReportResult> apiScenarioCaseExecResultInfo, Map<String, String> loadCaseExecResultInfo) {
|
||||
if(testPlanReportMap != null && testPlanReportMap.containsKey(reportId)){
|
||||
testPlanReportMap.get(reportId).updateExecuteResult(apiCaseExecResultInfo,apiScenarioCaseExecResultInfo,loadCaseExecResultInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static TestPlanExecuteInfo getTestPlanExecuteInfo(String reportId){
|
||||
return testPlanReportMap.get(reportId);
|
||||
}
|
||||
|
||||
public static synchronized void setReportDataCheckResult(String reportId, boolean result) {
|
||||
if(testPlanReportMap.containsKey(reportId)){
|
||||
testPlanReportMap.get(reportId).setReportDataInDataBase(result);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void remove(String reportId){
|
||||
if(testPlanReportMap.containsKey(reportId)){
|
||||
testPlanReportMap.remove(reportId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void finishAllTask(String planReportId) {
|
||||
if(testPlanReportMap.containsKey(planReportId)){
|
||||
testPlanReportMap.get(planReportId).finishAllTask();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,10 +10,12 @@ import io.metersphere.api.dto.automation.ExecuteType;
|
|||
import io.metersphere.api.jmeter.TestResult;
|
||||
import io.metersphere.api.service.ApiScenarioReportService;
|
||||
import io.metersphere.api.service.MsResultService;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.notice.annotation.SendNotice;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -47,6 +49,8 @@ public class APIScenarioReportController {
|
|||
|
||||
@PostMapping("/delete")
|
||||
@MsAuditLog(module = "api_automation_report", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#request.id)", msClass = ApiScenarioReportService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_REPORT_TASK, event = NoticeConstants.Event.DELETE, target = "#targetClass.get(#request.id)", targetClass = ApiScenarioReportService.class,
|
||||
mailTemplate = "api/ReportDelete", subject = "接口报告通知")
|
||||
public void delete(@RequestBody DeleteAPIReportRequest request) {
|
||||
apiReportService.delete(request);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package io.metersphere.api.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.metersphere.api.dto.*;
|
||||
|
@ -11,11 +10,13 @@ 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.definition.RunDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
|
||||
import io.metersphere.api.service.*;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.domain.ApiDefinition;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTest;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.utils.CronUtils;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
|
@ -24,15 +25,19 @@ import io.metersphere.controller.request.BaseQueryRequest;
|
|||
import io.metersphere.controller.request.QueryScheduleRequest;
|
||||
import io.metersphere.controller.request.ScheduleRequest;
|
||||
import io.metersphere.dto.ScheduleDao;
|
||||
import io.metersphere.notice.annotation.SendNotice;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
|
||||
|
||||
|
@ -41,6 +46,7 @@ import static io.metersphere.commons.utils.JsonPathUtils.getListJson;
|
|||
@RequestMapping(value = "/api")
|
||||
public class APITestController {
|
||||
@Resource
|
||||
@Lazy
|
||||
private APITestService apiTestService;
|
||||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
|
@ -250,7 +256,7 @@ public class APITestController {
|
|||
apiCountResult.setThisWeekAddedCount(dateCountByCreateInThisWeek);
|
||||
long executedInThisWeekCountNumber = apiScenarioReportService.countByProjectIdAndCreateInThisWeek(projectId);
|
||||
apiCountResult.setThisWeekExecutedCount(executedInThisWeekCountNumber);
|
||||
long executedCountNumber = apiScenarioReportService.countByProjectID(projectId);
|
||||
long executedCountNumber = apiAutomationService.countExecuteTimesByProjectID(projectId);
|
||||
apiCountResult.setExecutedCount(executedCountNumber);
|
||||
|
||||
//未执行、未通过、已通过
|
||||
|
@ -359,10 +365,12 @@ public class APITestController {
|
|||
}
|
||||
|
||||
@PostMapping(value = "/schedule/updateEnableByPrimyKey")
|
||||
public void updateScheduleEnableByPrimyKey(@RequestBody ScheduleInfoRequest request) {
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_HOME_TASK, event = NoticeConstants.Event.CLOSE_SCHEDULE, mailTemplate = "api/ScheduleClose", subject = "接口测试通知")
|
||||
public Schedule updateScheduleEnableByPrimyKey(@RequestBody ScheduleInfoRequest request) {
|
||||
Schedule schedule = scheduleService.getSchedule(request.getTaskID());
|
||||
schedule.setEnable(request.isEnable());
|
||||
apiAutomationService.updateSchedule(schedule);
|
||||
return schedule;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/historicalDataUpgrade")
|
||||
|
|
|
@ -11,14 +11,12 @@ import io.metersphere.api.service.ApiAutomationService;
|
|||
import io.metersphere.base.domain.ApiScenario;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.constants.PermissionConstants;
|
||||
import io.metersphere.commons.constants.TriggerMode;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.ScheduleRequest;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.notice.annotation.SendNotice;
|
||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||
import io.metersphere.track.request.testplan.FileOperationRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -89,6 +87,7 @@ public class ApiAutomationController {
|
|||
@PostMapping(value = "/create")
|
||||
@MsAuditLog(module = "api_automation", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiAutomationService.class)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ_CREATE)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_AUTOMATION_TASK, event = NoticeConstants.Event.CREATE, mailTemplate = "api/AutomationCreate", subject = "接口自动化通知")
|
||||
public ApiScenario create(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "bodyFiles", required = false) List<MultipartFile> bodyFiles,
|
||||
@RequestPart(value = "scenarioFiles", required = false) List<MultipartFile> scenarioFiles) {
|
||||
return apiAutomationService.create(request, bodyFiles, scenarioFiles);
|
||||
|
@ -97,9 +96,10 @@ public class ApiAutomationController {
|
|||
@PostMapping(value = "/update")
|
||||
@MsAuditLog(module = "api_automation", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiAutomationService.class)
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_SCENARIO_READ_EDIT)
|
||||
public void update(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "bodyFiles", required = false) List<MultipartFile> bodyFiles,
|
||||
@RequestPart(value = "scenarioFiles", required = false) List<MultipartFile> scenarioFiles) {
|
||||
apiAutomationService.update(request, bodyFiles, scenarioFiles);
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_AUTOMATION_TASK, event = NoticeConstants.Event.UPDATE, mailTemplate = "api/AutomationUpdate", subject = "接口自动化通知")
|
||||
public ApiScenario update(@RequestPart("request") SaveApiScenarioRequest request, @RequestPart(value = "bodyFiles", required = false) List<MultipartFile> bodyFiles,
|
||||
@RequestPart(value = "scenarioFiles", required = false) List<MultipartFile> scenarioFiles) {
|
||||
return apiAutomationService.update(request, bodyFiles, scenarioFiles);
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{id}")
|
||||
|
@ -123,12 +123,16 @@ public class ApiAutomationController {
|
|||
|
||||
@PostMapping("/removeToGc")
|
||||
@MsAuditLog(module = "api_automation", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiAutomationService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_AUTOMATION_TASK, target = "#targetClass.getApiScenarios(#ids)", targetClass = ApiAutomationService.class,
|
||||
event = NoticeConstants.Event.DELETE, mailTemplate = "api/AutomationDelete", subject = "接口自动化通知")
|
||||
public void removeToGc(@RequestBody List<String> ids) {
|
||||
apiAutomationService.removeToGc(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/removeToGcByBatch")
|
||||
@MsAuditLog(module = "api_automation", type = OperLogConstants.BATCH_GC, beforeEvent = "#msClass.getLogDetails(#request.ids)", msClass = ApiAutomationService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_AUTOMATION_TASK, target = "#targetClass.getApiScenarios(#request.ids)", targetClass = ApiAutomationService.class,
|
||||
event = NoticeConstants.Event.DELETE, mailTemplate = "api/AutomationDelete", subject = "接口自动化通知")
|
||||
public void removeToGcByBatch(@RequestBody ApiScenarioBatchRequest request) {
|
||||
apiAutomationService.removeToGcByBatch(request);
|
||||
}
|
||||
|
@ -267,8 +271,9 @@ public class ApiAutomationController {
|
|||
}
|
||||
|
||||
@PostMapping("/batchCopy")
|
||||
public void batchCopy(@RequestBody ApiScenarioBatchRequest request) {
|
||||
apiAutomationService.batchCopy(request);
|
||||
public BatchOperaResponse batchCopy(@RequestBody ApiScenarioBatchRequest request) {
|
||||
BatchOperaResponse response = apiAutomationService.batchCopy(request);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import io.metersphere.base.domain.ApiDefinition;
|
|||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.base.domain.Schedule;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.constants.PermissionConstants;
|
||||
import io.metersphere.commons.json.JSONSchemaGenerator;
|
||||
|
@ -25,6 +26,7 @@ import io.metersphere.commons.utils.PageUtils;
|
|||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.controller.request.ScheduleRequest;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.notice.annotation.SendNotice;
|
||||
import io.metersphere.service.CheckPermissionService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||
|
@ -89,6 +91,7 @@ public class ApiDefinitionController {
|
|||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_CREATE_API)
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CREATE, mailTemplate = "api/DefinitionCreate", subject = "接口定义通知")
|
||||
public ApiDefinitionWithBLOBs create(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
checkPermissionService.checkProjectOwner(request.getProjectId());
|
||||
return apiDefinitionService.create(request, bodyFiles);
|
||||
|
@ -97,6 +100,7 @@ public class ApiDefinitionController {
|
|||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_EDIT_API)
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = ApiDefinitionService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.UPDATE, mailTemplate = "api/DefinitionUpdate", subject = "接口定义通知")
|
||||
public ApiDefinitionWithBLOBs update(@RequestPart("request") SaveApiDefinitionRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
checkPermissionService.checkProjectOwner(request.getProjectId());
|
||||
return apiDefinitionService.update(request, bodyFiles);
|
||||
|
@ -134,6 +138,8 @@ public class ApiDefinitionController {
|
|||
@PostMapping("/removeToGc")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_DELETE_API)
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiDefinitionService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, target = "#targetClass.getBLOBs(#ids)", targetClass = ApiDefinitionService.class,
|
||||
event = NoticeConstants.Event.DELETE, mailTemplate = "api/DefinitionDelete", subject = "接口定义通知")
|
||||
public void removeToGc(@RequestBody List<String> ids) {
|
||||
apiDefinitionService.removeToGc(ids);
|
||||
}
|
||||
|
@ -189,6 +195,11 @@ public class ApiDefinitionController {
|
|||
return apiDefinitionService.getDbResult(testId, type);
|
||||
}
|
||||
|
||||
@GetMapping("/report/plan/getReport/{testId}/{type}")
|
||||
public APIReportResult getTestPlanApiCaseReport(@PathVariable String testId, @PathVariable String type) {
|
||||
return apiDefinitionService.getTestPlanApiCaseReport(testId, type);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/import", consumes = {"multipart/form-data"})
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_API_DEFINITION_READ_IMPORT_API)
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.IMPORT, sourceId = "#request.id", title = "#request.name", project = "#request.projectId")
|
||||
|
@ -281,12 +292,7 @@ public class ApiDefinitionController {
|
|||
|
||||
@GetMapping("/getMockEnvironment/{projectId}/{protocal}")
|
||||
public ApiTestEnvironmentWithBLOBs getMockEnvironment(@PathVariable String projectId, @PathVariable String protocal, HttpServletRequest request) {
|
||||
String requestUrl = request.getRequestURL().toString();
|
||||
String baseUrl = "";
|
||||
if (requestUrl.contains("/api/definition")) {
|
||||
baseUrl = requestUrl.split("/api/definition")[0];
|
||||
}
|
||||
return apiTestEnvironmentService.getMockEnvironmentByProjectId(projectId, protocal, baseUrl);
|
||||
return apiTestEnvironmentService.getMockEnvironmentByProjectId(projectId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ import io.metersphere.api.dto.definition.*;
|
|||
import io.metersphere.api.service.ApiTestCaseService;
|
||||
import io.metersphere.base.domain.ApiTestCase;
|
||||
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.OperLogConstants;
|
||||
import io.metersphere.commons.utils.PageUtils;
|
||||
import io.metersphere.commons.utils.Pager;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.notice.annotation.SendNotice;
|
||||
import io.metersphere.track.request.testcase.ApiCaseRelevanceRequest;
|
||||
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -81,12 +83,14 @@ public class ApiTestCaseController {
|
|||
|
||||
@PostMapping(value = "/create", consumes = {"multipart/form-data"})
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.CREATE, title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_CREATE, mailTemplate = "api/CaseCreate", subject = "接口用例通知")
|
||||
public ApiTestCase create(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
return apiTestCaseService.create(request, bodyFiles);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request)", title = "#request.name", content = "#msClass.getLogDetails(#request)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_UPDATE, mailTemplate = "api/CaseUpdate", subject = "接口用例通知")
|
||||
public ApiTestCase update(@RequestPart("request") SaveApiTestCaseRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) {
|
||||
return apiTestCaseService.update(request, bodyFiles);
|
||||
}
|
||||
|
@ -99,9 +103,12 @@ public class ApiTestCaseController {
|
|||
|
||||
@GetMapping("/deleteToGc/{id}")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.DELETE, beforeEvent = "#msClass.getLogDetails(#id)", msClass = ApiTestCaseService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.API_DEFINITION_TASK, event = NoticeConstants.Event.CASE_DELETE,target = "#targetClass.get(#id)", targetClass = ApiTestCaseService.class,
|
||||
mailTemplate = "api/CaseDelete", subject = "接口用例通知")
|
||||
public void deleteToGc(@PathVariable String id) {
|
||||
apiTestCaseService.deleteToGc(id);
|
||||
}
|
||||
|
||||
@PostMapping("/removeToGc")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.GC, beforeEvent = "#msClass.getLogDetails(#ids)", msClass = ApiTestCaseService.class)
|
||||
public void removeToGc(@RequestBody List<String> ids) {
|
||||
|
@ -123,6 +130,7 @@ public class ApiTestCaseController {
|
|||
public void editApiBathByParam(@RequestBody ApiTestBatchRequest request) {
|
||||
apiTestCaseService.editApiBathByParam(request);
|
||||
}
|
||||
|
||||
@PostMapping("/reduction")
|
||||
@MsAuditLog(module = "api_definition", type = OperLogConstants.RESTORE, beforeEvent = "#msClass.getLogDetails(#request.ids)", content = "#msClass.getLogDetails(#request.ids)", msClass = ApiTestCaseService.class)
|
||||
public List<String> reduction(@RequestBody ApiTestBatchRequest request) {
|
||||
|
@ -147,6 +155,7 @@ public class ApiTestCaseController {
|
|||
public void deleteToGcByParam(@RequestBody ApiTestBatchRequest request) {
|
||||
apiTestCaseService.deleteToGcByParam(request);
|
||||
}
|
||||
|
||||
@PostMapping("/checkDeleteDatas")
|
||||
public DeleteCheckResult checkDeleteDatas(@RequestBody ApiTestBatchRequest request) {
|
||||
return apiTestCaseService.checkDeleteDatas(request);
|
||||
|
|
|
@ -86,4 +86,8 @@ public class ApiTestEnvironmentController {
|
|||
apiTestEnvironmentService.delete(id);
|
||||
}
|
||||
|
||||
@GetMapping("/getTcpMockInfo/{projectId}")
|
||||
public String getMockInfo(@PathVariable(value = "projectId") String projectId) {
|
||||
return apiTestEnvironmentService.getMockInfo(projectId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.api.controller;
|
|||
|
||||
import io.metersphere.api.service.ApiDefinitionService;
|
||||
import io.metersphere.api.service.MockConfigService;
|
||||
import io.metersphere.api.tcp.TCPPool;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.controller.handler.annotation.NoResultHolder;
|
||||
import io.metersphere.service.ProjectService;
|
||||
|
@ -79,4 +80,9 @@ public class MockApiController {
|
|||
Project project = projectService.findBySystemId(projectSystemId);
|
||||
mockConfigService.checkReturnWithMockExpectByUrlParam("HEAD", project, request, response);
|
||||
}
|
||||
|
||||
@GetMapping("/getTcpMockPortStatus/")
|
||||
public String genTcpMockPort(){
|
||||
return TCPPool.getTcpStatus();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package io.metersphere.api.controller;
|
||||
|
||||
import io.metersphere.api.dto.document.ApiDocumentInfoDTO;
|
||||
import io.metersphere.api.dto.document.ApiDocumentRequest;
|
||||
import io.metersphere.api.dto.document.ApiDocumentShareDTO;
|
||||
import io.metersphere.api.dto.document.ApiDocumentShareRequest;
|
||||
import io.metersphere.api.service.APITestService;
|
||||
import io.metersphere.api.dto.share.ApiDocumentInfoDTO;
|
||||
import io.metersphere.api.dto.share.ApiDocumentRequest;
|
||||
import io.metersphere.api.dto.share.ApiDocumentShareRequest;
|
||||
import io.metersphere.api.dto.share.ShareInfoDTO;
|
||||
import io.metersphere.api.service.ApiDefinitionService;
|
||||
import io.metersphere.api.service.ApiDocumentService;
|
||||
import io.metersphere.api.service.ShareInfoService;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiDocumentShare;
|
||||
import io.metersphere.base.domain.ShareInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -23,21 +22,24 @@ import java.util.stream.Collectors;
|
|||
* @Description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/document")
|
||||
public class ApiDocumentController {
|
||||
@RequestMapping(value = "/share/info")
|
||||
public class ShareInfoController {
|
||||
@Resource
|
||||
ApiDocumentService apiDocumentService;
|
||||
ShareInfoService shareInfoService;
|
||||
@Resource
|
||||
ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
APITestService apiTestService;
|
||||
|
||||
@PostMapping("/selectApiSimpleInfo")
|
||||
public List<ApiDocumentInfoDTO> list(@RequestBody ApiDocumentRequest request) {
|
||||
List<ApiDocumentInfoDTO> returnList = apiDocumentService.findApiDocumentSimpleInfoByRequest(request);
|
||||
List<ApiDocumentInfoDTO> returnList = shareInfoService.findApiDocumentSimpleInfoByRequest(request);
|
||||
return returnList;
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
public ShareInfo get(@PathVariable String id) {
|
||||
return shareInfoService.get(id);
|
||||
}
|
||||
|
||||
@PostMapping("/selectApiInfoByParam")
|
||||
public List<ApiDocumentInfoDTO> selectApiInfoByParam(@RequestBody ApiDocumentRequest request) {
|
||||
List<ApiDocumentInfoDTO> returnList = new ArrayList<>();
|
||||
|
@ -52,7 +54,7 @@ public class ApiDocumentController {
|
|||
model.setId(id);
|
||||
model.setName(id);
|
||||
}
|
||||
ApiDocumentInfoDTO returnDTO = apiDocumentService.conversionModelToDTO(model);
|
||||
ApiDocumentInfoDTO returnDTO = shareInfoService.conversionModelToDTO(model);
|
||||
returnList.add(returnDTO);
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +66,7 @@ public class ApiDocumentController {
|
|||
ApiDefinitionWithBLOBs apiModel = apiDefinitionService.getBLOBs(id);
|
||||
ApiDocumentInfoDTO returnDTO = new ApiDocumentInfoDTO();
|
||||
try{
|
||||
returnDTO = apiDocumentService.conversionModelToDTO(apiModel);
|
||||
returnDTO = shareInfoService.conversionModelToDTO(apiModel);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -73,9 +75,16 @@ public class ApiDocumentController {
|
|||
}
|
||||
|
||||
@PostMapping("/generateApiDocumentShareInfo")
|
||||
public ApiDocumentShareDTO generateApiDocumentShareInfo(@RequestBody ApiDocumentShareRequest request) {
|
||||
ApiDocumentShare apiShare = apiDocumentService.generateApiDocumentShare(request);
|
||||
ApiDocumentShareDTO returnDTO = apiDocumentService.conversionApiDocumentShareToDTO(apiShare);
|
||||
public ShareInfoDTO generateApiDocumentShareInfo(@RequestBody ApiDocumentShareRequest request) {
|
||||
ShareInfo apiShare = shareInfoService.generateApiDocumentShareInfo(request);
|
||||
ShareInfoDTO returnDTO = shareInfoService.conversionShareInfoToDTO(apiShare);
|
||||
return returnDTO;
|
||||
}
|
||||
|
||||
@PostMapping("/generateShareInfo")
|
||||
public ShareInfoDTO generateShareInfo(@RequestBody ShareInfo request) {
|
||||
ShareInfo apiShare = shareInfoService.generateShareInfo(request);
|
||||
ShareInfoDTO returnDTO = shareInfoService.conversionShareInfoToDTO(apiShare);
|
||||
return returnDTO;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package io.metersphere.api.dto;
|
||||
|
||||
/**
|
||||
* @author song.tianyang
|
||||
* @Date 2021/8/23 4:17 下午
|
||||
*/
|
||||
public class BatchOperaResponse {
|
||||
public boolean result = false;
|
||||
public String errorMsg;
|
||||
}
|
|
@ -16,7 +16,6 @@ public class ApiScenarioDTO extends ApiScenarioWithBLOBs {
|
|||
private String principalName;
|
||||
private List<String> tagNames;
|
||||
private String deleteUser;
|
||||
private Long deleteTime;
|
||||
|
||||
/**
|
||||
* 场景跨项目ID
|
||||
|
@ -24,4 +23,5 @@ public class ApiScenarioDTO extends ApiScenarioWithBLOBs {
|
|||
private List<String> projectIds;
|
||||
|
||||
private String caseId;
|
||||
private String environment;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.api.dto.automation;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
|
@ -177,4 +178,22 @@ public class EsbDataStruct {
|
|||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<String> getNameDeep() {
|
||||
List<String> returnList = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(this.name)){
|
||||
returnList.add(this.name);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(this.children)){
|
||||
for (EsbDataStruct child :this.children) {
|
||||
List<String> itemNameList = child.getNameDeep();
|
||||
for (String itemName :itemNameList) {
|
||||
if(!returnList.contains(itemName)){
|
||||
returnList.add(itemName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package io.metersphere.api.dto.automation;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class RunModeConfig {
|
||||
private String mode;
|
||||
|
@ -10,4 +12,9 @@ public class RunModeConfig {
|
|||
private String reportId;
|
||||
private boolean onSampleError;
|
||||
private String resourcePoolId;
|
||||
|
||||
/**
|
||||
* 运行环境
|
||||
*/
|
||||
private Map<String, String> envMap;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.api.dto.automation;
|
|||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
|
@ -11,7 +12,7 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //ESB数据格式
|
||||
* 树形表格数据格式
|
||||
*
|
||||
* @author song.tianyang
|
||||
* @Date 2021/3/15 4:37 下午
|
||||
|
@ -181,4 +182,22 @@ public class TcpTreeTableDataStruct {
|
|||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
public List<String> getNameDeep() {
|
||||
List<String> returnList = new ArrayList<>();
|
||||
if(StringUtils.isNotEmpty(this.name)){
|
||||
returnList.add(this.name);
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(this.children)){
|
||||
for (TcpTreeTableDataStruct child :this.children) {
|
||||
List<String> itemNameList = child.getNameDeep();
|
||||
for (String itemName :itemNameList) {
|
||||
if(!returnList.contains(itemName)){
|
||||
returnList.add(itemName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.metersphere.api.dto.definition.TestPlanApiCaseDTO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class TestPlanFailureApiDTO extends TestPlanApiCaseDTO {
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String response;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package io.metersphere.api.dto.automation;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class TestPlanFailureScenarioDTO extends ApiScenarioDTO {
|
||||
private APIScenarioReportResult response;
|
||||
}
|
|
@ -333,6 +333,7 @@ public class MsJmeterParser extends ApiImportAbstractParser<ScenarioImport> {
|
|||
msTCPSampler.setRequest(tcpSampler.getRequestData());
|
||||
msTCPSampler.setUsername(tcpSampler.getProperty(ConfigTestElement.USERNAME).getStringValue());
|
||||
msTCPSampler.setPassword(tcpSampler.getProperty(ConfigTestElement.PASSWORD).getStringValue());
|
||||
msTCPSampler.setClassname(tcpSampler.getClassname());
|
||||
}
|
||||
|
||||
private void convertDubboSample(MsDubboSampler elementNode, DubboSample sampler) {
|
||||
|
|
|
@ -65,6 +65,20 @@ public class MsScenarioParser extends MsAbstractParser<ScenarioImport> {
|
|||
return scenarioWithBLOBs;
|
||||
}
|
||||
|
||||
private void formatHashTree(JSONArray hashTree) {
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
for (int i = 0; i < hashTree.size(); i++) {
|
||||
JSONObject object = (JSONObject) hashTree.get(i);
|
||||
object.put("index", i + 1);
|
||||
object.put("resourceId", UUID.randomUUID().toString());
|
||||
hashTree.set(i, object);
|
||||
if (CollectionUtils.isNotEmpty(object.getJSONArray("hashTree"))) {
|
||||
formatHashTree(object.getJSONArray("hashTree"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ScenarioImport parseMsFormat(String testStr, ApiTestImportRequest importRequest) {
|
||||
ScenarioImport scenarioImport = JSON.parseObject(testStr, ScenarioImport.class);
|
||||
List<ApiScenarioWithBLOBs> data = scenarioImport.getData();
|
||||
|
@ -88,6 +102,7 @@ public class MsScenarioParser extends MsAbstractParser<ScenarioImport> {
|
|||
JSONObject scenarioDefinition = JSONObject.parseObject(scenarioDefinitionStr);
|
||||
if (scenarioDefinition != null) {
|
||||
JSONArray hashTree = scenarioDefinition.getJSONArray("hashTree");
|
||||
formatHashTree(hashTree);
|
||||
setCopy(hashTree);
|
||||
JSONObject environmentMap = scenarioDefinition.getJSONObject("environmentMap");
|
||||
if (environmentMap != null) {
|
||||
|
|
|
@ -14,6 +14,7 @@ public class ApiTestBatchRequest extends ApiTestCaseWithBLOBs {
|
|||
private List<String> ids;
|
||||
private List<OrderRequest> orders;
|
||||
private String projectId;
|
||||
private Map<String, Object> combine;
|
||||
|
||||
/**
|
||||
* isSelectAllDate:选择的数据是否是全部数据(全部数据是不受分页影响的数据)
|
||||
|
|
|
@ -42,6 +42,8 @@ public class SaveApiDefinitionRequest {
|
|||
|
||||
private String userId;
|
||||
|
||||
private String followPeople;
|
||||
|
||||
private Schedule schedule;
|
||||
|
||||
private String triggerMode;
|
||||
|
|
|
@ -13,4 +13,5 @@ public class TestPlanApiCaseDTO extends ApiTestCaseDTO {
|
|||
private String creatorName;
|
||||
private String principalName;
|
||||
private String updateName;
|
||||
private String environmentName;
|
||||
}
|
||||
|
|
|
@ -165,7 +165,8 @@ public class MsScenario extends MsTestElement {
|
|||
this.addCounter(tree, variables);
|
||||
this.addRandom(tree, variables);
|
||||
if (CollectionUtils.isNotEmpty(this.headers)) {
|
||||
setHeader(tree, this.headers);
|
||||
//setHeader(tree, this.headers);
|
||||
config.setHeaders(this.headers);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
for (MsTestElement el : hashTree) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.dto.definition.request;
|
||||
|
||||
import io.metersphere.api.dto.definition.request.variable.ScenarioVariable;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.ssl.MsKeyStore;
|
||||
import io.metersphere.jmeter.utils.ScriptEngineUtils;
|
||||
|
@ -26,6 +27,12 @@ public class ParameterConfig {
|
|||
* 公共场景参数
|
||||
*/
|
||||
private List<ScenarioVariable> variables;
|
||||
|
||||
/**
|
||||
* 公共场景参数
|
||||
*/
|
||||
private List<KeyValue> headers;
|
||||
|
||||
/**
|
||||
* 公共Cookie
|
||||
*/
|
||||
|
@ -55,7 +62,7 @@ public class ParameterConfig {
|
|||
}
|
||||
|
||||
static public Arguments valueSupposeMock(Arguments arguments) {
|
||||
for(int i = 0; i < arguments.getArguments().size(); ++i) {
|
||||
for (int i = 0; i < arguments.getArguments().size(); ++i) {
|
||||
String argValue = arguments.getArgument(i).getValue();
|
||||
arguments.getArgument(i).setValue(ScriptEngineUtils.buildFunctionCallString(argValue));
|
||||
}
|
||||
|
|
|
@ -67,11 +67,11 @@ public class MsAssertions extends MsTestElement {
|
|||
private ResponseAssertion responseAssertion(MsAssertionRegex assertionRegex) {
|
||||
ResponseAssertion assertion = new ResponseAssertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(assertionRegex.getDescription());
|
||||
if(StringUtils.isEmpty(assertionRegex.getDescription())){
|
||||
assertion.setName("AssertionRegex");
|
||||
if (StringUtils.isNotEmpty(assertionRegex.getDescription())) {
|
||||
assertion.setName(this.getName() + "==" + assertionRegex.getDescription());
|
||||
} else {
|
||||
assertion.setName(this.getName() + "==" + "AssertionRegex");
|
||||
}
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionRegex.getDescription()) ? assertionRegex.getDescription() : this.getName());
|
||||
assertion.setProperty(TestElement.TEST_CLASS, ResponseAssertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("AssertionGui"));
|
||||
assertion.setAssumeSuccess(assertionRegex.isAssumeSuccess());
|
||||
|
@ -96,11 +96,11 @@ public class MsAssertions extends MsTestElement {
|
|||
private JSONPathAssertion jsonPathAssertion(MsAssertionJsonPath assertionJsonPath) {
|
||||
JSONPathAssertion assertion = new JSONPathAssertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionJsonPath.getDescription()) ? assertionJsonPath.getDescription() : this.getName());
|
||||
if(StringUtils.isEmpty(assertion.getName())){
|
||||
assertion.setName("JSONPathAssertion");
|
||||
if (StringUtils.isNotEmpty(assertionJsonPath.getDescription())) {
|
||||
assertion.setName(this.getName() + "==" + assertionJsonPath.getDescription());
|
||||
} else {
|
||||
assertion.setName(this.getName() + "==" + "JSONPathAssertion");
|
||||
}
|
||||
/* assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSONPathAssertion");*/
|
||||
assertion.setProperty(TestElement.TEST_CLASS, JSONPathAssertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("JSONPathAssertionGui"));
|
||||
assertion.setJsonPath(assertionJsonPath.getExpression());
|
||||
|
@ -120,11 +120,11 @@ public class MsAssertions extends MsTestElement {
|
|||
private XPath2Assertion xPath2Assertion(MsAssertionXPath2 assertionXPath2) {
|
||||
XPath2Assertion assertion = new XPath2Assertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionXPath2.getExpression()) ? assertionXPath2.getExpression() : this.getName());
|
||||
if(StringUtils.isEmpty(assertion.getName())){
|
||||
assertion.setName("XPath2Assertion");
|
||||
if (StringUtils.isNotEmpty(assertionXPath2.getExpression())) {
|
||||
assertion.setName(this.getName() + "==" + assertionXPath2.getExpression());
|
||||
} else {
|
||||
assertion.setName(this.getName() + "==" + "XPath2Assertion");
|
||||
}
|
||||
/*assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "XPath2Assertion");*/
|
||||
assertion.setProperty(TestElement.TEST_CLASS, XPath2Assertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("XPath2AssertionGui"));
|
||||
assertion.setXPathString(assertionXPath2.getExpression());
|
||||
|
@ -135,8 +135,10 @@ public class MsAssertions extends MsTestElement {
|
|||
private DurationAssertion durationAssertion(MsAssertionDuration assertionDuration) {
|
||||
DurationAssertion assertion = new DurationAssertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName("Response In Time: " + assertionDuration.getValue());
|
||||
/* assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "Response In Time: " + assertionDuration.getValue());*/
|
||||
assertion.setName("" + "==" + "Response In Time: " + assertionDuration.getValue());
|
||||
if (StringUtils.isNotEmpty(this.getName())) {
|
||||
assertion.setName(this.getName() + "==" + "Response In Time: " + assertionDuration.getValue());
|
||||
}
|
||||
assertion.setProperty(TestElement.TEST_CLASS, DurationAssertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DurationAssertionGui"));
|
||||
assertion.setAllowedDuration(assertionDuration.getValue());
|
||||
|
@ -146,11 +148,11 @@ public class MsAssertions extends MsTestElement {
|
|||
private JSR223Assertion jsr223Assertion(MsAssertionJSR223 assertionJSR223) {
|
||||
JSR223Assertion assertion = new JSR223Assertion();
|
||||
assertion.setEnabled(this.isEnable());
|
||||
assertion.setName(StringUtils.isNotEmpty(assertionJSR223.getDesc()) ? assertionJSR223.getDesc() : this.getName());
|
||||
if(StringUtils.isEmpty(assertion.getName())){
|
||||
assertion.setName("JSR223Assertion");
|
||||
if (StringUtils.isNotEmpty(assertionJSR223.getDesc())) {
|
||||
assertion.setName(this.getName() + "==" + assertionJSR223.getDesc());
|
||||
} else {
|
||||
assertion.setName(this.getName() + "==" + "JSR223Assertion");
|
||||
}
|
||||
/*assertion.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() : "JSR223Assertion");*/
|
||||
assertion.setProperty(TestElement.TEST_CLASS, JSR223Assertion.class.getName());
|
||||
assertion.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
|
||||
assertion.setProperty("cacheKey", "true");
|
||||
|
|
|
@ -38,7 +38,9 @@ public class MsDNSCacheManager extends MsTestElement {
|
|||
|
||||
public static void addEnvironmentVariables(HashTree samplerHashTree, String name, EnvironmentConfig config) {
|
||||
name += "Environment Variables";
|
||||
samplerHashTree.add(arguments(name, config.getCommonConfig().getVariables()));
|
||||
if (CollectionUtils.isNotEmpty(config.getCommonConfig().getVariables())) {
|
||||
samplerHashTree.add(arguments(name, config.getCommonConfig().getVariables()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addEnvironmentDNS(HashTree samplerHashTree, String name, EnvironmentConfig config, HttpConfig httpConfig) {
|
||||
|
@ -54,7 +56,9 @@ public class MsDNSCacheManager extends MsTestElement {
|
|||
}
|
||||
}
|
||||
});
|
||||
samplerHashTree.add(dnsCacheManager(name + " DNSCacheManager", hosts));
|
||||
if (CollectionUtils.isNotEmpty(hosts)) {
|
||||
samplerHashTree.add(dnsCacheManager(name + " DNSCacheManager", hosts));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,6 +82,7 @@ public class MsDNSCacheManager extends MsTestElement {
|
|||
dnsCacheManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("DNSCachePanel"));
|
||||
dnsCacheManager.setCustomResolver(true);
|
||||
hosts.forEach(host -> dnsCacheManager.addHost(host.getDomain(), host.getIp()));
|
||||
hosts.forEach(host -> dnsCacheManager.addServer(host.getIp()));
|
||||
|
||||
return dnsCacheManager;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ public class MsJDBCPostProcessor extends MsTestElement {
|
|||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ public class MsJDBCPreProcessor extends MsTestElement {
|
|||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ public class MsDubboSampler extends MsTestElement {
|
|||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import io.metersphere.api.dto.scenario.Body;
|
|||
import io.metersphere.api.dto.scenario.HttpConfig;
|
||||
import io.metersphere.api.dto.scenario.HttpConfigCondition;
|
||||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.environment.CommonConfig;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.ssl.KeyStoreConfig;
|
||||
import io.metersphere.api.dto.ssl.KeyStoreFile;
|
||||
|
@ -56,6 +57,7 @@ import java.net.URLEncoder;
|
|||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Data
|
||||
|
@ -152,7 +154,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,8 +192,6 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
|
||||
sampler.setMethod(this.getMethod());
|
||||
sampler.setContentEncoding("UTF-8");
|
||||
sampler.setConnectTimeout(this.getConnectTimeout() == null ? "6000" : this.getConnectTimeout());
|
||||
sampler.setResponseTimeout(this.getResponseTimeout() == null ? "6000" : this.getResponseTimeout());
|
||||
sampler.setFollowRedirects(this.isFollowRedirects());
|
||||
sampler.setUseKeepAlive(true);
|
||||
sampler.setDoMultipart(this.isDoMultipartPost());
|
||||
|
@ -203,8 +203,13 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
|
||||
compatible(config);
|
||||
|
||||
this.initConnectAndResponseTimeout(config);
|
||||
sampler.setConnectTimeout(this.getConnectTimeout() == null ? "60000" : this.getConnectTimeout());
|
||||
sampler.setResponseTimeout(this.getResponseTimeout() == null ? "60000" : this.getResponseTimeout());
|
||||
|
||||
HttpConfig httpConfig = getHttpConfig(config);
|
||||
|
||||
|
||||
setSamplerPath(config, httpConfig, sampler);
|
||||
|
||||
// 请求体
|
||||
|
@ -233,7 +238,10 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
setHeader(httpSamplerTree, httpConfig.getHeaders());
|
||||
}
|
||||
}
|
||||
|
||||
// 场景头
|
||||
if (config != null && CollectionUtils.isNotEmpty(config.getHeaders())) {
|
||||
setHeader(httpSamplerTree, config.getHeaders());
|
||||
}
|
||||
// 环境通用请求头
|
||||
Arguments arguments = getConfigArguments(config);
|
||||
if (arguments != null) {
|
||||
|
@ -254,10 +262,10 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
|
||||
if (CollectionUtils.isNotEmpty(hashTree)) {
|
||||
for (MsTestElement el : hashTree) {
|
||||
if(el.getEnvironmentId() == null){
|
||||
if(this.getEnvironmentId() == null){
|
||||
if (el.getEnvironmentId() == null) {
|
||||
if (this.getEnvironmentId() == null) {
|
||||
el.setEnvironmentId(useEnvironment);
|
||||
}else{
|
||||
} else {
|
||||
el.setEnvironmentId(this.getEnvironmentId());
|
||||
}
|
||||
}
|
||||
|
@ -267,6 +275,28 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
|
||||
}
|
||||
|
||||
private void initConnectAndResponseTimeout(ParameterConfig config) {
|
||||
if (config.isEffective(this.getProjectId())) {
|
||||
String useEvnId = config.getConfig().get(this.getProjectId()).getApiEnvironmentid();
|
||||
if (StringUtils.isNotEmpty(useEvnId) && !StringUtils.equals(useEvnId, this.getEnvironmentId())) {
|
||||
this.setEnvironmentId(useEvnId);
|
||||
}
|
||||
CommonConfig commonConfig = config.getConfig().get(this.getProjectId()).getCommonConfig();
|
||||
if(commonConfig != null){
|
||||
if(this.getConnectTimeout() == null || StringUtils.equals(this.getConnectTimeout(),"60000")){
|
||||
if(commonConfig.getRequestTimeout() != 0){
|
||||
this.setConnectTimeout(String.valueOf(commonConfig.getRequestTimeout()));
|
||||
}
|
||||
}
|
||||
if(this.getResponseTimeout() == null || StringUtils.equals(this.getResponseTimeout(),"60000")){
|
||||
if(commonConfig.getResponseTimeout() != 0){
|
||||
this.setResponseTimeout(String.valueOf(commonConfig.getResponseTimeout()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private EnvironmentConfig getEnvironmentConfig(ParameterConfig config) {
|
||||
return config.getConfig().get(this.getProjectId());
|
||||
}
|
||||
|
@ -604,16 +634,25 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
}
|
||||
|
||||
public void setHeader(HashTree tree, List<KeyValue> headers) {
|
||||
// 合并header
|
||||
HeaderManager headerManager = new HeaderManager();
|
||||
headerManager.setEnabled(true);
|
||||
headerManager.setName(StringUtils.isNotEmpty(this.getName()) ? this.getName() + "HeaderManager" : "HeaderManager");
|
||||
headerManager.setProperty(TestElement.TEST_CLASS, HeaderManager.class.getName());
|
||||
headerManager.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("HeaderPanel"));
|
||||
boolean isAdd = true;
|
||||
for (Object key : tree.keySet()) {
|
||||
if (key instanceof HeaderManager) {
|
||||
headerManager = (HeaderManager) key;
|
||||
isAdd = false;
|
||||
}
|
||||
}
|
||||
// header 也支持 mock 参数
|
||||
headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).forEach(keyValue ->
|
||||
headerManager.add(new Header(keyValue.getName(), ScriptEngineUtils.buildFunctionCallString(keyValue.getValue())))
|
||||
);
|
||||
if (headerManager.getHeaders().size() > 0) {
|
||||
List<KeyValue> keyValues = headers.stream().filter(KeyValue::isValid).filter(KeyValue::isEnable).collect(Collectors.toList());
|
||||
for (KeyValue keyValue : keyValues) {
|
||||
headerManager.add(new Header(keyValue.getName(), ScriptEngineUtils.buildFunctionCallString(keyValue.getValue())));
|
||||
}
|
||||
if (headerManager.getHeaders().size() > 0 && isAdd) {
|
||||
tree.add(headerManager);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ public class MsJDBCSampler extends MsTestElement {
|
|||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ public class MsTCPSampler extends MsTestElement {
|
|||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package io.metersphere.api.dto.document;
|
||||
|
||||
public enum ApiDocumentShareType {
|
||||
Single,Batch
|
||||
}
|
|
@ -10,4 +10,6 @@ public class CommonConfig {
|
|||
private List<KeyValue> variables;
|
||||
private boolean enableHost;
|
||||
private List<Host> hosts;
|
||||
private int requestTimeout;
|
||||
private int responseTimeout;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.document;
|
||||
package io.metersphere.api.dto.share;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.document;
|
||||
package io.metersphere.api.dto.share;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.dto.document;
|
||||
package io.metersphere.api.dto.share;
|
||||
|
||||
import io.metersphere.base.domain.ShareInfo;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -12,7 +13,6 @@ import java.util.List;
|
|||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiDocumentShareRequest {
|
||||
private String shareType;
|
||||
public class ApiDocumentShareRequest extends ShareInfo {
|
||||
private List<String> shareApiIdList;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.document;
|
||||
package io.metersphere.api.dto.share;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
|
@ -1,4 +1,4 @@
|
|||
package io.metersphere.api.dto.document;
|
||||
package io.metersphere.api.dto.share;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -10,7 +10,7 @@ import lombok.Setter;
|
|||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiDocumentShareDTO {
|
||||
public class ShareInfoDTO {
|
||||
private String id;
|
||||
private String shareUrl;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package io.metersphere.api.dto.share;
|
||||
|
||||
public enum ShareInfoType {
|
||||
Single,Batch
|
||||
}
|
|
@ -1,20 +1,15 @@
|
|||
package io.metersphere.api.jmeter;
|
||||
|
||||
|
||||
import io.metersphere.api.dto.RunningParamKeys;
|
||||
import io.metersphere.api.service.ApiEnvironmentRunningParamService;
|
||||
import io.metersphere.api.service.MsResultService;
|
||||
import io.metersphere.api.service.TestResultService;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.samplers.SampleResult;
|
||||
import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient;
|
||||
import org.apache.jmeter.visualizers.backend.BackendListenerContext;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* JMeter BackendListener扩展, jmx脚本中使用
|
||||
|
@ -23,20 +18,10 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
|
||||
public final static String TEST_ID = "ms.test.id";
|
||||
|
||||
private final static String THREAD_SPLIT = " ";
|
||||
|
||||
private final static String ID_SPLIT = "-";
|
||||
public String runMode = ApiRunMode.RUN.name();
|
||||
|
||||
private final List<SampleResult> queue = new ArrayList<>();
|
||||
|
||||
private TestResultService testResultService;
|
||||
|
||||
private ApiEnvironmentRunningParamService apiEnvironmentRunningParamService;
|
||||
|
||||
private MsResultService resultService;
|
||||
|
||||
public String runMode = ApiRunMode.RUN.name();
|
||||
|
||||
// 测试ID
|
||||
private String testId;
|
||||
|
||||
|
@ -45,19 +30,6 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
@Override
|
||||
public void setupTest(BackendListenerContext context) throws Exception {
|
||||
setParam(context);
|
||||
testResultService = CommonBeanFactory.getBean(TestResultService.class);
|
||||
if (testResultService == null) {
|
||||
LogUtil.error("testResultService is required");
|
||||
}
|
||||
resultService = CommonBeanFactory.getBean(MsResultService.class);
|
||||
if (resultService == null) {
|
||||
LogUtil.error("MsResultService is required");
|
||||
}
|
||||
|
||||
apiEnvironmentRunningParamService = CommonBeanFactory.getBean(ApiEnvironmentRunningParamService.class);
|
||||
if (apiEnvironmentRunningParamService == null) {
|
||||
LogUtil.error("apiEnvironmentRunningParamService is required");
|
||||
}
|
||||
super.setupTest(context);
|
||||
}
|
||||
|
||||
|
@ -68,39 +40,19 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
|||
|
||||
@Override
|
||||
public void teardownTest(BackendListenerContext context) throws Exception {
|
||||
TestResult testResult = new TestResult();
|
||||
testResult.setTestId(testId);
|
||||
MessageCache.runningEngine.remove(testId);
|
||||
testResult.setTotal(0);
|
||||
// 一个脚本里可能包含多个场景(ThreadGroup),所以要区分开,key: 场景Id
|
||||
final Map<String, ScenarioResult> scenarios = new LinkedHashMap<>();
|
||||
queue.forEach(result -> {
|
||||
// 线程名称: <场景名> <场景Index>-<请求Index>, 例如:Scenario 2-1
|
||||
if (StringUtils.equals(result.getSampleLabel(), RunningParamKeys.RUNNING_DEBUG_SAMPLER_NAME)) {
|
||||
String evnStr = result.getResponseDataAsString();
|
||||
apiEnvironmentRunningParamService.parseEvn(evnStr);
|
||||
} else {
|
||||
resultService.formatTestResult(testResult, scenarios, result);
|
||||
}
|
||||
});
|
||||
queue.clear();
|
||||
APIBackendListenerHandler apiBackendListenerHandler =
|
||||
CommonBeanFactory.getBean(APIBackendListenerHandler.class);
|
||||
apiBackendListenerHandler.handleTeardownTest(queue, this.runMode, this.testId, this.debugReportId);
|
||||
super.teardownTest(context);
|
||||
testResult.getScenarios().addAll(scenarios.values());
|
||||
testResult.getScenarios().sort(Comparator.comparing(ScenarioResult::getId));
|
||||
testResult.setConsole(resultService.getJmeterLogger(testId, true));
|
||||
testResultService.saveResult(testResult, this.runMode, this.debugReportId, this.testId);
|
||||
// 清除已经中断的过程数据
|
||||
if (!MessageCache.reportCache.containsKey(testId) && resultService.processCache.containsKey(testId)) {
|
||||
resultService.processCache.remove(testId);
|
||||
}
|
||||
}
|
||||
|
||||
private void setParam(BackendListenerContext context) {
|
||||
this.testId = context.getParameter(TEST_ID);
|
||||
this.testId = context.getParameter(APIBackendListenerClient.TEST_ID);
|
||||
this.runMode = context.getParameter("runMode");
|
||||
this.debugReportId = context.getParameter("debugReportId");
|
||||
if (StringUtils.isBlank(this.runMode)) {
|
||||
this.runMode = ApiRunMode.RUN.name();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package io.metersphere.api.jmeter;
|
||||
|
||||
|
||||
import io.metersphere.api.dto.RunningParamKeys;
|
||||
import io.metersphere.api.service.ApiEnvironmentRunningParamService;
|
||||
import io.metersphere.api.service.MsResultService;
|
||||
import io.metersphere.api.service.TestResultService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.samplers.SampleResult;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 获取结果和数据库操作分离
|
||||
* 减少占用的数据库连接
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class APIBackendListenerHandler {
|
||||
|
||||
@Resource
|
||||
private TestResultService testResultService;
|
||||
@Resource
|
||||
private ApiEnvironmentRunningParamService apiEnvironmentRunningParamService;
|
||||
@Resource
|
||||
private MsResultService resultService;
|
||||
|
||||
public void handleTeardownTest(List<SampleResult> queue, String runMode, String testId, String debugReportId) throws Exception {
|
||||
TestResult testResult = new TestResult();
|
||||
testResult.setTestId(testId);
|
||||
MessageCache.runningEngine.remove(testId);
|
||||
testResult.setTotal(0);
|
||||
// 一个脚本里可能包含多个场景(ThreadGroup),所以要区分开,key: 场景Id
|
||||
final Map<String, ScenarioResult> scenarios = new LinkedHashMap<>();
|
||||
queue.forEach(result -> {
|
||||
// 线程名称: <场景名> <场景Index>-<请求Index>, 例如:Scenario 2-1
|
||||
if (StringUtils.equals(result.getSampleLabel(), RunningParamKeys.RUNNING_DEBUG_SAMPLER_NAME)) {
|
||||
String evnStr = result.getResponseDataAsString();
|
||||
apiEnvironmentRunningParamService.parseEvn(evnStr);
|
||||
} else {
|
||||
resultService.formatTestResult(testResult, scenarios, result);
|
||||
}
|
||||
});
|
||||
queue.clear();
|
||||
testResult.getScenarios().addAll(scenarios.values());
|
||||
testResult.getScenarios().sort(Comparator.comparing(ScenarioResult::getId));
|
||||
testResult.setConsole(resultService.getJmeterLogger(testId, true));
|
||||
testResultService.saveResult(testResult, runMode, debugReportId, testId);
|
||||
// 清除已经中断的过程数据
|
||||
if (!MessageCache.reportCache.containsKey(testId) && resultService.getProcessCache().containsKey(testId)) {
|
||||
resultService.getProcessCache().remove(testId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ import org.apache.jorphan.collections.HashTree;
|
|||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
@ -39,6 +40,7 @@ import java.io.InputStream;
|
|||
import java.lang.reflect.Field;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class JMeterService {
|
||||
private static final String BASE_URL = "http://%s:%d";
|
||||
@Resource
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.jmeter;
|
||||
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.classic.spi.StackTraceElementProxy;
|
||||
import ch.qos.logback.core.UnsynchronizedAppenderBase;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
|
@ -23,6 +24,16 @@ public class JmeterLoggerAppender extends UnsynchronizedAppenderBase<ILoggingEve
|
|||
.append(event.getLevel()).append(" ")
|
||||
.append(event.getThreadName()).append(" ")
|
||||
.append(event.getFormattedMessage()).append("\n");
|
||||
|
||||
if (event.getThrowableProxy() != null) {
|
||||
message.append(event.getThrowableProxy().getMessage()).append("\n");
|
||||
message.append(event.getThrowableProxy().getClassName()).append("\n");
|
||||
if (event.getThrowableProxy().getStackTraceElementProxyArray() != null) {
|
||||
for (StackTraceElementProxy stackTraceElementProxy : event.getThrowableProxy().getStackTraceElementProxyArray()) {
|
||||
message.append(" ").append(stackTraceElementProxy.getSTEAsString()).append("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logger.containsKey(event.getTimeStamp())) {
|
||||
logger.get(event.getTimeStamp()).append(message);
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package io.metersphere.api.jmeter;
|
||||
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import org.apache.jmeter.engine.JMeterEngine;
|
||||
import org.apache.jmeter.engine.JMeterEngineException;
|
||||
import org.apache.jmeter.engine.StandardJMeterEngine;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
@ -17,7 +16,7 @@ public class LocalRunner {
|
|||
}
|
||||
|
||||
public void run(String report) {
|
||||
JMeterEngine engine = new StandardJMeterEngine();
|
||||
StandardJMeterEngine engine = new StandardJMeterEngine();
|
||||
engine.configure(jmxTree);
|
||||
try {
|
||||
engine.runTest();
|
||||
|
@ -29,13 +28,13 @@ public class LocalRunner {
|
|||
|
||||
public void stop(String report) {
|
||||
try {
|
||||
JMeterEngine engine = MessageCache.runningEngine.get(report);
|
||||
StandardJMeterEngine engine = MessageCache.runningEngine.get(report);
|
||||
if (engine != null) {
|
||||
engine.stopTest();
|
||||
MessageCache.runningEngine.remove(report);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package io.metersphere.api.jmeter;
|
||||
|
||||
import org.apache.jmeter.engine.JMeterEngine;
|
||||
import org.apache.jmeter.engine.StandardJMeterEngine;
|
||||
|
||||
import javax.websocket.Session;
|
||||
import java.util.HashMap;
|
||||
|
@ -12,6 +12,6 @@ public class MessageCache {
|
|||
|
||||
public static ConcurrentHashMap<String, Session> reportCache = new ConcurrentHashMap<>();
|
||||
|
||||
public static ConcurrentHashMap<String, JMeterEngine> runningEngine = new ConcurrentHashMap<>();
|
||||
public static ConcurrentHashMap<String, StandardJMeterEngine> runningEngine = new ConcurrentHashMap<>();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,10 +10,12 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
import org.springframework.kafka.annotation.KafkaListener;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MsKafkaListener {
|
||||
public static final String TOPICS = "ms-api-exec-topic";
|
||||
public static final String CONSUME_ID = "ms-api-exec-consume";
|
||||
|
@ -47,7 +49,7 @@ public class MsKafkaListener {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,6 @@ public class MsResultCollector extends AbstractListenerElement implements Sample
|
|||
|
||||
@Override
|
||||
public void sampleStarted(SampleEvent e) {
|
||||
System.out.println("start ====");
|
||||
try {
|
||||
MsgDto dto = new MsgDto();
|
||||
dto.setContent(e.getThreadGroup());
|
||||
|
|
|
@ -12,6 +12,7 @@ import io.metersphere.commons.exception.MSException;
|
|||
import io.metersphere.dto.NodeDTO;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -19,6 +20,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ResourcePoolCalculation {
|
||||
@Resource
|
||||
TestResourcePoolMapper testResourcePoolMapper;
|
||||
|
|
|
@ -7,6 +7,8 @@ public class ResponseAssertionResult {
|
|||
|
||||
private String name;
|
||||
|
||||
private String content;
|
||||
|
||||
private String message;
|
||||
|
||||
private boolean pass;
|
||||
|
|
|
@ -30,7 +30,7 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
|
|||
}
|
||||
requestDesc.getAuth(); // todo 认证方式等待优化
|
||||
PostmanUrl url = requestDesc.getUrl();
|
||||
MsHTTPSamplerProxy request = buildRequest(requestItem.getName(), url.getRaw(), requestDesc.getMethod());
|
||||
MsHTTPSamplerProxy request = buildRequest(requestItem.getName(), url == null ? "" : url.getRaw(), requestDesc.getMethod());
|
||||
if (StringUtils.isNotBlank(request.getPath())) {
|
||||
String path = request.getPath().split("\\?")[0];
|
||||
path = parseVariable(path);
|
||||
|
@ -39,7 +39,7 @@ public abstract class PostmanAbstractParserParser<T> extends ApiImportAbstractPa
|
|||
request.setPath("/");
|
||||
}
|
||||
parseBody(request.getBody(), requestDesc);
|
||||
request.setArguments(parseKeyValue(url.getQuery()));
|
||||
request.setArguments(parseKeyValue(url == null ? new ArrayList<>() : url.getQuery()));
|
||||
request.setHeaders(parseKeyValue(requestDesc.getHeader()));
|
||||
addBodyHeader(request);
|
||||
addPreScript(request, requestItem.getEvent());
|
||||
|
|
|
@ -33,6 +33,7 @@ import io.metersphere.commons.constants.*;
|
|||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.controller.request.ScheduleRequest;
|
||||
import io.metersphere.dto.ApiReportCountDTO;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.job.sechedule.ApiScenarioTestJob;
|
||||
|
@ -342,7 +343,7 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
|
||||
public void update(SaveApiScenarioRequest request, List<MultipartFile> bodyFiles, List<MultipartFile> scenarioFiles) {
|
||||
public ApiScenario update(SaveApiScenarioRequest request, List<MultipartFile> bodyFiles, List<MultipartFile> scenarioFiles) {
|
||||
checkNameExist(request);
|
||||
checkScenarioNum(request);
|
||||
|
||||
|
@ -367,6 +368,7 @@ public class ApiAutomationService {
|
|||
apiScenarioReferenceIdService.saveByApiScenario(scenario);
|
||||
extScheduleMapper.updateNameByResourceID(request.getId(), request.getName());// 修改场景name,同步到修改首页定时任务
|
||||
uploadFiles(request, bodyFiles, scenarioFiles);
|
||||
return scenario;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -806,7 +808,7 @@ public class ApiAutomationService {
|
|||
}
|
||||
return bos.toByteArray();
|
||||
} catch (Exception ex) {
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -869,7 +871,7 @@ public class ApiAutomationService {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1384,7 +1386,7 @@ public class ApiAutomationService {
|
|||
HashTree hashTree = generateHashTree(apiScenarios, request, reportIds);
|
||||
jMeterService.runLocal(reportIds.size() == 1 ? reportIds.get(0) : JSON.toJSONString(reportIds), hashTree, request.getReportId(), runMode);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(e.getMessage());
|
||||
}
|
||||
return request.getId();
|
||||
|
@ -2362,11 +2364,12 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
|
||||
public void batchCopy(ApiScenarioBatchRequest batchRequest) {
|
||||
public BatchOperaResponse batchCopy(ApiScenarioBatchRequest batchRequest) {
|
||||
|
||||
ServiceUtils.getSelectAllIds(batchRequest, batchRequest.getCondition(),
|
||||
(query) -> extApiScenarioMapper.selectIdsByQuery((ApiScenarioRequest) query));
|
||||
List<ApiScenarioWithBLOBs> apiScenarioList = extApiScenarioMapper.selectIds(batchRequest.getIds());
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (ApiScenarioWithBLOBs apiModel : apiScenarioList) {
|
||||
long time = System.currentTimeMillis();
|
||||
ApiScenarioWithBLOBs newModel = apiModel;
|
||||
|
@ -2380,6 +2383,7 @@ public class ApiAutomationService {
|
|||
example.createCriteria().andNameEqualTo(newModel.getName()).
|
||||
andProjectIdEqualTo(newModel.getProjectId()).andStatusNotEqualTo("Trash").andIdNotEqualTo(newModel.getId());
|
||||
if (apiScenarioMapper.countByExample(example) > 0) {
|
||||
stringBuffer.append(newModel.getName()+";");
|
||||
continue;
|
||||
} else {
|
||||
boolean insertFlag = true;
|
||||
|
@ -2410,6 +2414,15 @@ public class ApiAutomationService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
BatchOperaResponse result = new BatchOperaResponse();
|
||||
if(stringBuffer.length() == 0){
|
||||
result.result = true;
|
||||
}else {
|
||||
result.result = false;
|
||||
result.errorMsg = stringBuffer.substring(0,stringBuffer.length()-1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public DeleteCheckResult checkBeforeDelete(ApiScenarioBatchRequest request) {
|
||||
|
@ -2462,4 +2475,44 @@ public class ApiAutomationService {
|
|||
result.setCheckMsg(checkMsgList);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ApiScenario> getScenarioCaseByIds(List<String> ids) {
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
return apiScenarioMapper.selectByExample(example);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public void initExecuteTimes() {
|
||||
List<String> apiScenarioIds = extApiScenarioMapper.selectIdsByExecuteTimeIsNull();
|
||||
Map<String,Long> scenarioIdMap = new HashMap<>();
|
||||
List<ApiReportCountDTO> reportCount = apiScenarioReportService.countByApiScenarioId();
|
||||
for (ApiReportCountDTO dto : reportCount) {
|
||||
scenarioIdMap.put(dto.getId(),dto.getCountNum());
|
||||
}
|
||||
for (String id:apiScenarioIds) {
|
||||
int count = 0;
|
||||
if(scenarioIdMap.containsKey(id)){
|
||||
Long countNum = scenarioIdMap.get(id);
|
||||
if(countNum != null){
|
||||
count = countNum.intValue();
|
||||
}
|
||||
}
|
||||
ApiScenarioWithBLOBs apiScenario = new ApiScenarioWithBLOBs();
|
||||
apiScenario.setId(id);
|
||||
apiScenario.setExecuteTimes(count);
|
||||
apiScenarioMapper.updateByPrimaryKeySelective(apiScenario);
|
||||
}
|
||||
}
|
||||
|
||||
public long countExecuteTimesByProjectID(String projectId) {
|
||||
Long result = extApiScenarioMapper.countExecuteTimesByProjectID(projectId);
|
||||
if(result == null){
|
||||
return 0;
|
||||
}else {
|
||||
return result.longValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,13 @@ public class ApiDefinitionEnvService {
|
|||
env.setId(UUID.randomUUID().toString());
|
||||
env.setCreateTime(System.currentTimeMillis());
|
||||
env.setUpdateTime(System.currentTimeMillis());
|
||||
if (this.get(env.getUserId()) == null) {
|
||||
ApiDefinitionEnv apiDefinitionEnv = this.get(env.getUserId());
|
||||
if (apiDefinitionEnv == null) {
|
||||
apiDefinitionEnvMapper.insert(env);
|
||||
} else {
|
||||
apiDefinitionEnv.setEnvId(env.getEnvId());
|
||||
apiDefinitionEnv.setUpdateTime(System.currentTimeMillis());
|
||||
apiDefinitionEnvMapper.updateByPrimaryKey(apiDefinitionEnv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.metersphere.api.service;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.cache.TestPlanReportExecuteCatch;
|
||||
import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult;
|
||||
import io.metersphere.api.jmeter.TestResult;
|
||||
import io.metersphere.base.domain.*;
|
||||
|
@ -11,15 +12,16 @@ import io.metersphere.base.mapper.ApiTestCaseMapper;
|
|||
import io.metersphere.base.mapper.TestCaseReviewApiCaseMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.notice.sender.NoticeModel;
|
||||
import io.metersphere.notice.service.NoticeSendService;
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||
import io.metersphere.track.service.TestCaseReviewApiCaseService;
|
||||
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||
import io.metersphere.track.service.TestPlanReportService;
|
||||
import io.metersphere.track.service.TestPlanService;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
|
@ -56,6 +58,8 @@ public class ApiDefinitionExecResultService {
|
|||
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private NoticeSendService noticeSendService;
|
||||
|
||||
public ApiDefinitionExecResult getInfo(String id) {
|
||||
return apiDefinitionExecResultMapper.selectByPrimaryKey(id);
|
||||
|
@ -92,7 +96,7 @@ public class ApiDefinitionExecResultService {
|
|||
saved = false;
|
||||
}
|
||||
String status = item.isSuccess() ? "success" : "error";
|
||||
saveResult.setName(getName(type, item.getName(), status, saveResult.getCreateTime()));
|
||||
saveResult.setName(getName(type, item.getName(), status, saveResult.getCreateTime(), saveResult.getId()));
|
||||
saveResult.setStatus(status);
|
||||
saveResult.setCreateTime(item.getStartTime());
|
||||
saveResult.setResourceId(item.getName());
|
||||
|
@ -106,13 +110,7 @@ public class ApiDefinitionExecResultService {
|
|||
prevResult.setContent(null);
|
||||
definitionExecResultMapper.updateByPrimaryKeyWithBLOBs(prevResult);
|
||||
}
|
||||
// 更新用例最后执行结果
|
||||
ApiTestCase apiTestCase = apiTestCaseMapper.selectByPrimaryKey(saveResult.getResourceId());
|
||||
if (apiTestCase != null) {
|
||||
apiTestCase.setLastResultId(saveResult.getId());
|
||||
apiTestCase.setStatus(status);
|
||||
apiTestCaseMapper.updateByPrimaryKey(apiTestCase);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(saveResult.getTriggerMode()) && saveResult.getTriggerMode().equals("CASE")) {
|
||||
saveResult.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
}
|
||||
|
@ -121,6 +119,8 @@ public class ApiDefinitionExecResultService {
|
|||
} else {
|
||||
definitionExecResultMapper.updateByPrimaryKeyWithBLOBs(saveResult);
|
||||
}
|
||||
// 发送通知
|
||||
sendNotice(saveResult);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -128,7 +128,45 @@ public class ApiDefinitionExecResultService {
|
|||
}
|
||||
}
|
||||
|
||||
private String getName(String type, String id, String status, Long time) {
|
||||
private void sendNotice(ApiDefinitionExecResult result) {
|
||||
String resourceId = result.getResourceId();
|
||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(resourceId);
|
||||
// 接口定义直接执行不发通知
|
||||
if (apiTestCaseWithBLOBs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
BeanMap beanMap = new BeanMap(apiTestCaseWithBLOBs);
|
||||
|
||||
String event;
|
||||
String status;
|
||||
if (StringUtils.equals(result.getStatus(), "success")) {
|
||||
event = NoticeConstants.Event.EXECUTE_SUCCESSFUL;
|
||||
status = "成功";
|
||||
} else {
|
||||
event = NoticeConstants.Event.EXECUTE_FAILED;
|
||||
status = "失败";
|
||||
}
|
||||
|
||||
Map paramMap = new HashMap<>(beanMap);
|
||||
paramMap.put("operator", SessionUtils.getUserId());
|
||||
paramMap.put("status", result.getStatus());
|
||||
String context = "${operator}执行接口用例" + status + ": ${name}";
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(SessionUtils.getUserId())
|
||||
.context(context)
|
||||
.subject("接口用例通知")
|
||||
.successMailTemplate("api/CaseResult")
|
||||
.failedMailTemplate("api/CaseResult")
|
||||
.paramMap(paramMap)
|
||||
.event(event)
|
||||
.build();
|
||||
|
||||
String taskType = NoticeConstants.TaskType.API_DEFINITION_TASK;
|
||||
noticeSendService.send(taskType, noticeModel);
|
||||
}
|
||||
|
||||
private String getName(String type, String id, String status, Long time, String resourceId) {
|
||||
if (id.indexOf(DelimiterConstants.SEPARATOR.toString()) != -1) {
|
||||
return id.substring(0, id.indexOf(DelimiterConstants.SEPARATOR.toString()));
|
||||
}
|
||||
|
@ -138,11 +176,17 @@ public class ApiDefinitionExecResultService {
|
|||
if (testPlanApiCase != null) {
|
||||
testPlanApiCaseService.setExecResult(id, status, time);
|
||||
caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(testPlanApiCase.getApiCaseId());
|
||||
testPlanApiCase.setStatus(status);
|
||||
testPlanApiCase.setUpdateTime(System.currentTimeMillis());
|
||||
testPlanApiCaseService.updateByPrimaryKeySelective(testPlanApiCase);
|
||||
}
|
||||
TestCaseReviewApiCase testCaseReviewApiCase = testCaseReviewApiCaseMapper.selectByPrimaryKey(id);
|
||||
if (testCaseReviewApiCase != null) {
|
||||
testCaseReviewApiCaseService.setExecResult(id, status, time);
|
||||
caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(testCaseReviewApiCase.getApiCaseId());
|
||||
testCaseReviewApiCase.setStatus(status);
|
||||
testCaseReviewApiCase.setUpdateTime(System.currentTimeMillis());
|
||||
testCaseReviewApiCaseService.updateByPrimaryKeySelective(testCaseReviewApiCase);
|
||||
}
|
||||
if (caseWithBLOBs != null) {
|
||||
return caseWithBLOBs.getName();
|
||||
|
@ -154,6 +198,10 @@ public class ApiDefinitionExecResultService {
|
|||
} else {
|
||||
ApiTestCaseWithBLOBs caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(id);
|
||||
if (caseWithBLOBs != null) {
|
||||
// 更新用例最后执行结果
|
||||
caseWithBLOBs.setLastResultId(resourceId);
|
||||
caseWithBLOBs.setStatus(status);
|
||||
apiTestCaseMapper.updateByPrimaryKey(caseWithBLOBs);
|
||||
return caseWithBLOBs.getName();
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +216,7 @@ public class ApiDefinitionExecResultService {
|
|||
* @param result
|
||||
* @param type
|
||||
*/
|
||||
public void saveApiResultByScheduleTask(TestResult result, String testPlanReportId, String type, String trigeMode) {
|
||||
public void saveApiResultByScheduleTask(TestResult result, String testPlanReportId, String type) {
|
||||
testPlanLog.info("TestPlanReportId[" + testPlanReportId + "] APICASE OVER.");
|
||||
String saveResultType = type;
|
||||
if (StringUtils.equalsAny(saveResultType, ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
|
@ -177,6 +225,7 @@ public class ApiDefinitionExecResultService {
|
|||
String finalSaveResultType = saveResultType;
|
||||
|
||||
Map<String, String> apiIdResultMap = new HashMap<>();
|
||||
Map<String,ApiDefinitionExecResult> caseReportMap = new HashMap<>();
|
||||
|
||||
if (CollectionUtils.isNotEmpty(result.getScenarios())) {
|
||||
result.getScenarios().forEach(scenarioResult -> {
|
||||
|
@ -186,27 +235,33 @@ public class ApiDefinitionExecResultService {
|
|||
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
|
||||
saveResult.setId(UUID.randomUUID().toString());
|
||||
saveResult.setCreateTime(System.currentTimeMillis());
|
||||
// saveResult.setName(item.getName());
|
||||
saveResult.setName(getName(type, item.getName(), status, saveResult.getCreateTime()));
|
||||
saveResult.setName(getName(type, item.getName(), status, saveResult.getCreateTime(),saveResult.getId()));
|
||||
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = apiDefinitionMapper.selectByPrimaryKey(item.getName());
|
||||
String caseId = null;
|
||||
if (apiDefinitionWithBLOBs != null) {
|
||||
saveResult.setName(apiDefinitionWithBLOBs.getName());
|
||||
apiIdResultMap.put(apiDefinitionWithBLOBs.getId(), item.isSuccess() ? TestPlanApiExecuteStatus.SUCCESS.name() : TestPlanApiExecuteStatus.FAILD.name());
|
||||
caseId = apiDefinitionWithBLOBs.getId();
|
||||
} else {
|
||||
ApiTestCaseWithBLOBs caseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(item.getName());
|
||||
if (caseWithBLOBs != null) {
|
||||
caseId = caseWithBLOBs.getId();
|
||||
saveResult.setName(caseWithBLOBs.getName());
|
||||
apiIdResultMap.put(caseWithBLOBs.getId(), item.isSuccess() ? TestPlanApiExecuteStatus.SUCCESS.name() : TestPlanApiExecuteStatus.FAILD.name());
|
||||
} else {
|
||||
caseWithBLOBs = testPlanApiCaseService.getApiTestCaseById(item.getName());
|
||||
if (caseWithBLOBs != null) {
|
||||
saveResult.setName(caseWithBLOBs.getName());
|
||||
apiIdResultMap.put(caseWithBLOBs.getId(), item.isSuccess() ? TestPlanApiExecuteStatus.SUCCESS.name() : TestPlanApiExecuteStatus.FAILD.name());
|
||||
caseId = caseWithBLOBs.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(caseId)){
|
||||
apiIdResultMap.put(caseId, item.isSuccess() ? TestPlanApiExecuteStatus.SUCCESS.name() : TestPlanApiExecuteStatus.FAILD.name());
|
||||
}
|
||||
|
||||
if (StringUtils.equals(type, ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
saveResult.setTriggerMode(TriggerMode.API.name());
|
||||
} else if (StringUtils.equals(type, ApiRunMode.MANUAL_PLAN.name())) {
|
||||
saveResult.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
} else {
|
||||
saveResult.setTriggerMode(TriggerMode.SCHEDULE.name());
|
||||
}
|
||||
|
@ -227,7 +282,7 @@ public class ApiDefinitionExecResultService {
|
|||
apiCase.setStatus(status);
|
||||
apiCase.setUpdateTime(System.currentTimeMillis());
|
||||
testPlanApiCaseService.updateByPrimaryKeySelective(apiCase);
|
||||
} else if (StringUtils.equals(type, ApiRunMode.JENKINS_SCENARIO_PLAN.name())) {
|
||||
} else if (StringUtils.equals(type, ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
TestPlanApiCase apiCase = testPlanApiCaseService.getById(item.getName());
|
||||
userID = Objects.requireNonNull(SessionUtils.getUser()).getId();
|
||||
apiCase.setStatus(status);
|
||||
|
@ -246,13 +301,14 @@ public class ApiDefinitionExecResultService {
|
|||
apiDefinitionExecResultMapper.updateByPrimaryKeyWithBLOBs(prevResult);
|
||||
}
|
||||
apiDefinitionExecResultMapper.insert(saveResult);
|
||||
caseReportMap.put(caseId,saveResult);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
testPlanLog.info("TestPlanReportId[" + testPlanReportId + "] APICASE OVER. API CASE STATUS:" + JSONObject.toJSONString(apiIdResultMap));
|
||||
TestPlanReportService testPlanReportService = CommonBeanFactory.getBean(TestPlanReportService.class);
|
||||
testPlanReportService.updateExecuteApis(testPlanReportId, apiIdResultMap, null, null);
|
||||
TestPlanReportExecuteCatch.updateApiTestPlanExecuteInfo(testPlanReportId, apiIdResultMap, null, null);
|
||||
TestPlanReportExecuteCatch.updateTestPlanExecuteResultInfo(testPlanReportId,caseReportMap,null,null);
|
||||
}
|
||||
|
||||
public void deleteByResourceId(String resourceId) {
|
||||
|
|
|
@ -368,6 +368,7 @@ public class ApiDefinitionService {
|
|||
test.setResponse(JSONObject.toJSONString(request.getResponse()));
|
||||
test.setEnvironmentId(request.getEnvironmentId());
|
||||
test.setUserId(request.getUserId());
|
||||
test.setFollowPeople(request.getFollowPeople());
|
||||
if (StringUtils.isNotEmpty(request.getTags()) && !StringUtils.equals(request.getTags(), "[]")) {
|
||||
test.setTags(request.getTags());
|
||||
} else {
|
||||
|
@ -404,6 +405,7 @@ public class ApiDefinitionService {
|
|||
test.setStatus(APITestStatus.Underway.name());
|
||||
test.setModulePath(request.getModulePath());
|
||||
test.setModuleId(request.getModuleId());
|
||||
test.setFollowPeople(request.getFollowPeople());
|
||||
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
|
||||
ApiModuleExample example = new ApiModuleExample();
|
||||
example.createCriteria().andProjectIdEqualTo(test.getProjectId()).andProtocolEqualTo(test.getProtocol()).andNameEqualTo("默认模块");
|
||||
|
@ -545,31 +547,18 @@ public class ApiDefinitionService {
|
|||
return request;
|
||||
}
|
||||
|
||||
private void importMsCase(ApiDefinitionImport apiImport, SqlSession sqlSession, ApiTestCaseMapper apiTestCaseMapper) {
|
||||
private void importMsCase(ApiDefinitionImport apiImport, SqlSession sqlSession, ApiTestCaseMapper apiTestCaseMapper,
|
||||
ApiTestImportRequest request) {
|
||||
List<ApiTestCaseWithBLOBs> cases = apiImport.getCases();
|
||||
SaveApiTestCaseRequest checkRequest = new SaveApiTestCaseRequest();
|
||||
if (CollectionUtils.isNotEmpty(cases)) {
|
||||
int batchCount = 0;
|
||||
int nextNum = 0;
|
||||
for (int i = 0; i < cases.size(); i++) {
|
||||
ApiTestCaseWithBLOBs item = cases.get(i);
|
||||
ApiDefinitionWithBLOBs apiDefinitionWithBLOBs = apiDefinitionMapper.selectByPrimaryKey(item.getApiDefinitionId());
|
||||
if (apiDefinitionWithBLOBs == null) {
|
||||
continue;
|
||||
}
|
||||
nextNum = apiTestCaseService.getNextNum(item.getApiDefinitionId());
|
||||
checkRequest.setName(item.getName());
|
||||
checkRequest.setApiDefinitionId(item.getApiDefinitionId());
|
||||
if (!apiTestCaseService.hasSameCase(checkRequest)) {
|
||||
item.setId(UUID.randomUUID().toString());
|
||||
item.setCreateTime(System.currentTimeMillis());
|
||||
item.setUpdateTime(System.currentTimeMillis());
|
||||
item.setCreateUserId(SessionUtils.getUserId());
|
||||
item.setUpdateUserId(SessionUtils.getUserId());
|
||||
item.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
item.setNum(nextNum);
|
||||
apiTestCaseMapper.insert(item);
|
||||
}
|
||||
insertOrUpdateImportCase(item, request);
|
||||
}
|
||||
if (batchCount % 300 == 0) {
|
||||
sqlSession.flushStatements();
|
||||
|
@ -587,30 +576,45 @@ public class ApiDefinitionService {
|
|||
if (StringUtils.equalsAnyIgnoreCase(apiTestImportRequest.getPlatform(), ApiImportPlatform.Plugin.name(), ApiImportPlatform.Postman.name())) {
|
||||
ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs();
|
||||
BeanUtils.copyBean(apiTestCase, apiDefinition);
|
||||
apiTestCase.setId(UUID.randomUUID().toString());
|
||||
apiTestCase.setApiDefinitionId(apiDefinition.getId());
|
||||
apiTestCase.setCreateTime(System.currentTimeMillis());
|
||||
apiTestCase.setUpdateTime(System.currentTimeMillis());
|
||||
apiTestCase.setCreateUserId(SessionUtils.getUserId());
|
||||
apiTestCase.setUpdateUserId(SessionUtils.getUserId());
|
||||
apiTestCase.setNum(getNextNum(apiTestCase.getApiDefinitionId()));
|
||||
apiTestCase.setPriority("P0");
|
||||
if (apiTestCase.getName().length() > 255) {
|
||||
apiTestCase.setName(apiTestCase.getName().substring(0, 255));
|
||||
}
|
||||
/* if (!isInsert) {
|
||||
apiTestCase.setName(apiTestCase.getName() + "_" + apiTestCase.getId().substring(0, 5));
|
||||
}*/
|
||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||
example.createCriteria().andApiDefinitionIdEqualTo(apiDefinition.getId());
|
||||
apiTestCaseMapper.deleteByExample(example);
|
||||
apiTestCaseMapper.insert(apiTestCase);
|
||||
insertOrUpdateImportCase(apiTestCase, apiTestImportRequest);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("导入创建用例异常", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void insertOrUpdateImportCase(ApiTestCaseWithBLOBs apiTestCase, ApiTestImportRequest apiTestImportRequest) {
|
||||
SaveApiTestCaseRequest checkRequest = new SaveApiTestCaseRequest();
|
||||
checkRequest.setName(apiTestCase.getName());
|
||||
checkRequest.setApiDefinitionId(apiTestCase.getApiDefinitionId());
|
||||
ApiTestCase sameCase = apiTestCaseService.getSameCase(checkRequest);
|
||||
apiTestCase.setUpdateUserId(SessionUtils.getUserId());
|
||||
if (sameCase == null) {
|
||||
apiTestCase.setId(UUID.randomUUID().toString());
|
||||
apiTestCase.setNum(getNextNum(apiTestCase.getApiDefinitionId()));
|
||||
apiTestCase.setCreateTime(System.currentTimeMillis());
|
||||
apiTestCase.setUpdateTime(System.currentTimeMillis());
|
||||
apiTestCase.setCreateUserId(SessionUtils.getUserId());
|
||||
apiTestCase.setProjectId(SessionUtils.getCurrentProjectId());
|
||||
apiTestCaseMapper.insert(apiTestCase);
|
||||
} else if (StringUtils.equals("fullCoverage", apiTestImportRequest.getModeId())) {
|
||||
apiTestCase.setId(sameCase.getId());
|
||||
apiTestCase.setUpdateTime(System.currentTimeMillis());
|
||||
apiTestCase.setCreateTime(null);
|
||||
apiTestCase.setPriority(sameCase.getPriority());
|
||||
apiTestCase.setCreateUserId(sameCase.getCreateUserId());
|
||||
apiTestCase.setNum(sameCase.getNum());
|
||||
apiTestCase.setProjectId(sameCase.getProjectId());
|
||||
apiTestCase.setVersion((sameCase.getVersion() == null ? 0 : sameCase.getVersion()) + 1);
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteFileByTestId(String apiId) {
|
||||
ApiTestFileExample apiTestFileExample = new ApiTestFileExample();
|
||||
apiTestFileExample.createCriteria().andTestIdEqualTo(apiId);
|
||||
|
@ -731,12 +735,17 @@ public class ApiDefinitionService {
|
|||
return buildAPIReportResult(result);
|
||||
}
|
||||
|
||||
public APIReportResult getByResultId(String reportId) {
|
||||
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(reportId);
|
||||
return buildAPIReportResult(result);
|
||||
}
|
||||
|
||||
public APIReportResult getReportById(String testId) {
|
||||
ApiDefinitionExecResult result = apiDefinitionExecResultMapper.selectByPrimaryKey(testId);
|
||||
return buildAPIReportResult(result);
|
||||
}
|
||||
|
||||
private APIReportResult buildAPIReportResult(ApiDefinitionExecResult result) {
|
||||
public APIReportResult buildAPIReportResult(ApiDefinitionExecResult result) {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -786,6 +795,7 @@ public class ApiDefinitionService {
|
|||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("url", request.getSwaggerUrl());
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(SessionUtils.getUserId())
|
||||
.context(context)
|
||||
.testId(scheduleId)
|
||||
.subject(Translator.get("swagger_url_scheduled_import_notification"))
|
||||
|
@ -810,6 +820,7 @@ public class ApiDefinitionService {
|
|||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("url", request.getSwaggerUrl());
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(SessionUtils.getUserId())
|
||||
.context(context)
|
||||
.testId(scheduleId)
|
||||
.subject(Translator.get("swagger_url_scheduled_import_notification"))
|
||||
|
@ -875,7 +886,7 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(apiImport.getCases())) {
|
||||
importMsCase(apiImport, sqlSession, apiTestCaseMapper);
|
||||
importMsCase(apiImport, sqlSession, apiTestCaseMapper, request);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1342,4 +1353,9 @@ public class ApiDefinitionService {
|
|||
});
|
||||
this.removeToGc(apiIdList);
|
||||
}
|
||||
|
||||
public APIReportResult getTestPlanApiCaseReport(String testId, String type) {
|
||||
ApiDefinitionExecResult result = extApiDefinitionExecResultMapper.selectPlanApiMaxResultByTestIdAndType(testId, type);
|
||||
return buildAPIReportResult(result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.commons.collections.CollectionUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -30,6 +31,7 @@ import java.util.zip.ZipEntry;
|
|||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiJmeterFileService {
|
||||
|
||||
@Resource
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.cache.TestPlanReportExecuteCatch;
|
||||
import io.metersphere.api.dto.APIReportBatchRequest;
|
||||
import io.metersphere.api.dto.DeleteAPIReportRequest;
|
||||
import io.metersphere.api.dto.QueryAPIReportRequest;
|
||||
|
@ -22,19 +23,21 @@ import io.metersphere.base.mapper.ApiScenarioMapper;
|
|||
import io.metersphere.base.mapper.ApiScenarioReportDetailMapper;
|
||||
import io.metersphere.base.mapper.ApiScenarioReportMapper;
|
||||
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportDetailMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.constants.TestPlanApiExecuteStatus;
|
||||
import io.metersphere.commons.constants.TriggerMode;
|
||||
import io.metersphere.commons.constants.*;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.dto.ApiReportCountDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.log.utils.ReflexObjectUtil;
|
||||
import io.metersphere.log.vo.DetailColumn;
|
||||
import io.metersphere.log.vo.OperatingLogDetails;
|
||||
import io.metersphere.log.vo.api.ModuleReference;
|
||||
import io.metersphere.notice.sender.NoticeModel;
|
||||
import io.metersphere.notice.service.NoticeSendService;
|
||||
import io.metersphere.track.service.TestPlanReportService;
|
||||
import org.apache.commons.beanutils.BeanMap;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
|
@ -61,12 +64,17 @@ public class ApiScenarioReportService {
|
|||
private ApiScenarioReportMapper apiScenarioReportMapper;
|
||||
@Resource
|
||||
private ApiScenarioReportDetailMapper apiScenarioReportDetailMapper;
|
||||
@Resource
|
||||
private ExtApiScenarioReportDetailMapper extApiScenarioReportDetailMapper;
|
||||
|
||||
@Resource
|
||||
private ApiScenarioMapper apiScenarioMapper;
|
||||
@Resource
|
||||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private NoticeSendService noticeSendService;
|
||||
|
||||
public ApiScenarioReport complete(TestResult result, String runMode) {
|
||||
// 更新场景
|
||||
|
@ -142,7 +150,7 @@ public class ApiScenarioReportService {
|
|||
if (report != null) {
|
||||
report.setId(report.getId());
|
||||
report.setName(report.getScenarioName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis()));
|
||||
report.setCreateTime(startTime);
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
report.setUpdateTime(startTime);
|
||||
String status = test.getError() == 0 ? "Success" : "Error";
|
||||
report.setStatus(status);
|
||||
|
@ -164,7 +172,7 @@ public class ApiScenarioReportService {
|
|||
report.setScenarioId(test.getScenarioId());
|
||||
report.setTriggerMode(test.getTriggerMode());
|
||||
report.setDescription(test.getDescription());
|
||||
report.setCreateTime(System.currentTimeMillis());
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
report.setUpdateTime(System.currentTimeMillis());
|
||||
report.setStatus(test.getStatus());
|
||||
report.setUserId(test.getUserId());
|
||||
|
@ -234,6 +242,7 @@ public class ApiScenarioReportService {
|
|||
if (StringUtils.isNotEmpty(report.getTriggerMode()) && report.getTriggerMode().equals("CASE")) {
|
||||
report.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
}
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
if (scenarioResult.getError() > 0) {
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Fail.name());
|
||||
|
@ -243,9 +252,31 @@ public class ApiScenarioReportService {
|
|||
String passRate = new DecimalFormat("0%").format((float) scenarioResult.getSuccess() / (scenarioResult.getSuccess() + scenarioResult.getError()));
|
||||
testPlanApiScenario.setPassRate(passRate);
|
||||
testPlanApiScenario.setReportId(report.getId());
|
||||
testPlanApiScenario.setUpdateTime(report.getCreateTime());
|
||||
report.setTestPlanScenarioId(testPlanApiScenario.getId());
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
testPlanApiScenario.setUpdateTime(report.getCreateTime());
|
||||
testPlanApiScenarioMapper.updateByPrimaryKeySelective(testPlanApiScenario);
|
||||
|
||||
// 更新场景状态
|
||||
ApiScenario scenario = apiScenarioMapper.selectByPrimaryKey(testPlanApiScenario.getApiScenarioId());
|
||||
if (scenario != null) {
|
||||
if (scenarioResult.getError() > 0) {
|
||||
scenario.setLastResult("Fail");
|
||||
} else {
|
||||
scenario.setLastResult("Success");
|
||||
}
|
||||
scenario.setPassRate(passRate);
|
||||
scenario.setReportId(report.getId());
|
||||
int executeTimes = 0;
|
||||
if (scenario.getExecuteTimes() != null) {
|
||||
executeTimes = scenario.getExecuteTimes().intValue();
|
||||
}
|
||||
scenario.setExecuteTimes(executeTimes + 1);
|
||||
|
||||
apiScenarioMapper.updateByPrimaryKey(scenario);
|
||||
// 发送通知
|
||||
sendNotice(scenario);
|
||||
}
|
||||
}
|
||||
returnReport = report;
|
||||
reportIds.add(report.getId());
|
||||
|
@ -265,6 +296,7 @@ public class ApiScenarioReportService {
|
|||
List<String> reportIds = new ArrayList<>();
|
||||
List<String> scenarioIdList = new ArrayList<>();
|
||||
Map<String, String> scenarioAndErrorMap = new HashMap<>();
|
||||
Map<String,APIScenarioReportResult> caseReportMap = new HashMap<>();
|
||||
for (ScenarioResult scenarioResult : scenarioResultList) {
|
||||
|
||||
// 存储场景报告
|
||||
|
@ -299,8 +331,10 @@ public class ApiScenarioReportService {
|
|||
TestPlanApiScenario testPlanApiScenario = testPlanApiScenarioMapper.selectByPrimaryKey(planScenarioId);
|
||||
report.setScenarioId(testPlanApiScenario.getApiScenarioId());
|
||||
report.setTestPlanScenarioId(planScenarioId);
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
apiScenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
|
||||
|
||||
if (scenarioResult.getError() > 0) {
|
||||
scenarioAndErrorMap.put(testPlanApiScenario.getApiScenarioId(), TestPlanApiExecuteStatus.FAILD.name());
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Fail.name());
|
||||
|
@ -308,6 +342,7 @@ public class ApiScenarioReportService {
|
|||
scenarioAndErrorMap.put(testPlanApiScenario.getApiScenarioId(), TestPlanApiExecuteStatus.SUCCESS.name());
|
||||
testPlanApiScenario.setLastResult(ScenarioStatus.Success.name());
|
||||
}
|
||||
|
||||
String passRate = new DecimalFormat("0%").format((float) scenarioResult.getSuccess() / (scenarioResult.getSuccess() + scenarioResult.getError()));
|
||||
testPlanApiScenario.setPassRate(passRate);
|
||||
// 报告详情内容
|
||||
|
@ -322,20 +357,46 @@ public class ApiScenarioReportService {
|
|||
apiScenarioReportDetailMapper.insert(detail);
|
||||
|
||||
testPlanApiScenario.setReportId(report.getId());
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
testPlanApiScenario.setUpdateTime(System.currentTimeMillis());
|
||||
testPlanApiScenarioMapper.updateByPrimaryKeySelective(testPlanApiScenario);
|
||||
scenarioIdList.add(testPlanApiScenario.getApiScenarioId());
|
||||
scenarioNames.append(report.getName()).append(",");
|
||||
|
||||
// 更新场景状态
|
||||
ApiScenario scenario = apiScenarioMapper.selectByPrimaryKey(testPlanApiScenario.getApiScenarioId());
|
||||
if (scenario != null) {
|
||||
if (scenarioResult.getError() > 0) {
|
||||
scenario.setLastResult("Fail");
|
||||
} else {
|
||||
scenario.setLastResult("Success");
|
||||
}
|
||||
scenario.setPassRate(passRate);
|
||||
scenario.setReportId(report.getId());
|
||||
int executeTimes = 0;
|
||||
if (scenario.getExecuteTimes() != null) {
|
||||
executeTimes = scenario.getExecuteTimes().intValue();
|
||||
}
|
||||
scenario.setExecuteTimes(executeTimes + 1);
|
||||
|
||||
apiScenarioMapper.updateByPrimaryKey(scenario);
|
||||
// 发送通知
|
||||
sendNotice(scenario);
|
||||
}
|
||||
|
||||
lastReport = report;
|
||||
|
||||
APIScenarioReportResult reportResult = this.get(report.getId());
|
||||
caseReportMap.put(testPlanApiScenario.getApiScenarioId(),reportResult);
|
||||
reportIds.add(report.getId());
|
||||
}
|
||||
TestPlanReportService testPlanReportService = CommonBeanFactory.getBean(TestPlanReportService.class);
|
||||
|
||||
testPlanLog.info("TestPlanReportId" + JSONArray.toJSONString(testPlanReportIdList) + " EXECUTE OVER. SCENARIO STATUS : " + JSONObject.toJSONString(scenarioAndErrorMap));
|
||||
|
||||
for (String planId : testPlanReportIdList) {
|
||||
testPlanReportService.updateExecuteApis(planId, null, scenarioAndErrorMap, null);
|
||||
for (String reportId : testPlanReportIdList) {
|
||||
TestPlanReportExecuteCatch.updateApiTestPlanExecuteInfo(reportId,null,scenarioAndErrorMap,null);
|
||||
TestPlanReportExecuteCatch.updateTestPlanExecuteResultInfo(reportId,null,caseReportMap,null);
|
||||
}
|
||||
|
||||
return lastReport;
|
||||
|
@ -363,6 +424,7 @@ public class ApiScenarioReportService {
|
|||
if (CollectionUtils.isNotEmpty(reportList)) {
|
||||
reportList.forEach(report -> {
|
||||
report.setUpdateTime(System.currentTimeMillis());
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
String status = "Error";
|
||||
report.setStatus(status);
|
||||
scenarioReportMapper.updateByPrimaryKeySelective(report);
|
||||
|
@ -385,9 +447,12 @@ public class ApiScenarioReportService {
|
|||
if (CollectionUtils.isNotEmpty(reportIds)) {
|
||||
TestResult testResult = new TestResult();
|
||||
testResult.setTestId(UUID.randomUUID().toString());
|
||||
ApiScenarioReportDetailExample example = new ApiScenarioReportDetailExample();
|
||||
example.createCriteria().andReportIdIn(reportIds);
|
||||
List<ApiScenarioReportDetail> details = apiScenarioReportDetailMapper.selectByExampleWithBLOBs(example);
|
||||
|
||||
StringBuilder idStr = new StringBuilder();
|
||||
reportIds.forEach(item -> {
|
||||
idStr.append("\"").append(item).append("\"").append(",");
|
||||
});
|
||||
List<ApiScenarioReportDetail> details = extApiScenarioReportDetailMapper.selectByIds(idStr.toString().substring(0, idStr.toString().length() - 1), "\"" + StringUtils.join(reportIds, ",") + "\"");
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
// 记录单场景通过率
|
||||
|
@ -413,7 +478,7 @@ public class ApiScenarioReportService {
|
|||
String passRate = new DecimalFormat("0%").format((float) scenarioResult.getSuccess() / (scenarioResult.getSuccess() + scenarioResult.getError()));
|
||||
passRateMap.put(detail.getReportId(), passRate);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -424,6 +489,7 @@ public class ApiScenarioReportService {
|
|||
if (StringUtils.isNotEmpty(report.getTriggerMode()) && report.getTriggerMode().equals("CASE")) {
|
||||
report.setTriggerMode(TriggerMode.MANUAL.name());
|
||||
}
|
||||
report.setEndTime(System.currentTimeMillis());
|
||||
apiScenarioReportMapper.updateByPrimaryKey(report);
|
||||
|
||||
ApiScenarioReportDetail detail = new ApiScenarioReportDetail();
|
||||
|
@ -516,7 +582,15 @@ public class ApiScenarioReportService {
|
|||
String passRate = new DecimalFormat("0%").format((float) item.getSuccess() / (item.getSuccess() + item.getError()));
|
||||
scenario.setPassRate(passRate);
|
||||
scenario.setReportId(report.getId());
|
||||
int executeTimes = 0;
|
||||
if (scenario.getExecuteTimes() != null) {
|
||||
executeTimes = scenario.getExecuteTimes().intValue();
|
||||
}
|
||||
scenario.setExecuteTimes(executeTimes + 1);
|
||||
|
||||
apiScenarioMapper.updateByPrimaryKey(scenario);
|
||||
// 发送通知
|
||||
sendNotice(scenario);
|
||||
}
|
||||
lastReport = report;
|
||||
}
|
||||
|
@ -533,6 +607,39 @@ public class ApiScenarioReportService {
|
|||
return lastReport;
|
||||
}
|
||||
|
||||
|
||||
private void sendNotice(ApiScenario result) {
|
||||
|
||||
BeanMap beanMap = new BeanMap(result);
|
||||
|
||||
String event;
|
||||
String status;
|
||||
if (StringUtils.equals(result.getLastResult(), "Success")) {
|
||||
event = NoticeConstants.Event.EXECUTE_SUCCESSFUL;
|
||||
status = "成功";
|
||||
} else {
|
||||
event = NoticeConstants.Event.EXECUTE_FAILED;
|
||||
status = "失败";
|
||||
}
|
||||
|
||||
Map paramMap = new HashMap<>(beanMap);
|
||||
paramMap.put("operator", SessionUtils.getUserId());
|
||||
paramMap.put("status", result.getLastResult());
|
||||
String context = "${operator}执行接口自动化" + status + ": ${name}";
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(SessionUtils.getUserId())
|
||||
.context(context)
|
||||
.subject("接口自动化通知")
|
||||
.successMailTemplate("api/ScenarioResult")
|
||||
.failedMailTemplate("api/ScenarioResult")
|
||||
.paramMap(paramMap)
|
||||
.event(event)
|
||||
.build();
|
||||
|
||||
String taskType = NoticeConstants.TaskType.API_AUTOMATION_TASK;
|
||||
noticeSendService.send(taskType, noticeModel);
|
||||
}
|
||||
|
||||
public String update(APIScenarioReportResult test) {
|
||||
ApiScenarioReport report = updateReport(test);
|
||||
ApiScenarioReportDetail detail = apiScenarioReportDetailMapper.selectByPrimaryKey(test.getId());
|
||||
|
@ -709,4 +816,8 @@ public class ApiScenarioReportService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ApiReportCountDTO> countByApiScenarioId() {
|
||||
return extApiScenarioReportMapper.countByApiScenarioId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,8 +193,7 @@ public class ApiTestCaseService {
|
|||
}
|
||||
|
||||
public ApiTestCase create(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
ApiTestCase test = createTest(request);
|
||||
FileUtils.createBodyFiles(request.getId(), bodyFiles);
|
||||
ApiTestCase test = createTest(request, bodyFiles);
|
||||
return test;
|
||||
}
|
||||
|
||||
|
@ -265,16 +264,24 @@ public class ApiTestCaseService {
|
|||
}
|
||||
|
||||
public Boolean hasSameCase(SaveApiTestCaseRequest request) {
|
||||
if (getSameCase(request) != null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ApiTestCase getSameCase(SaveApiTestCaseRequest request) {
|
||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||
ApiTestCaseExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andNameEqualTo(request.getName()).andApiDefinitionIdEqualTo(request.getApiDefinitionId());
|
||||
if (StringUtils.isNotBlank(request.getId())) {
|
||||
criteria.andIdNotEqualTo(request.getId());
|
||||
}
|
||||
if (apiTestCaseMapper.countByExample(example) > 0) {
|
||||
return true;
|
||||
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(apiTestCases)) {
|
||||
return apiTestCases.get(0);
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
private ApiTestCase updateTest(SaveApiTestCaseRequest request) {
|
||||
|
@ -295,25 +302,29 @@ public class ApiTestCaseService {
|
|||
test.setUpdateTime(System.currentTimeMillis());
|
||||
test.setDescription(request.getDescription());
|
||||
test.setVersion(request.getVersion() == null ? 0 : request.getVersion() + 1);
|
||||
test.setFollowPeople(request.getFollowPeople());
|
||||
if (StringUtils.equals("[]", request.getTags())) {
|
||||
test.setTags("");
|
||||
} else {
|
||||
test.setTags(request.getTags());
|
||||
}
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(test);
|
||||
return test;
|
||||
return apiTestCaseMapper.selectByPrimaryKey(request.getId());
|
||||
}
|
||||
|
||||
private ApiTestCase createTest(SaveApiTestCaseRequest request) {
|
||||
private ApiTestCase createTest(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
|
||||
checkNameExist(request);
|
||||
FileUtils.createBodyFiles(request.getId(), bodyFiles);
|
||||
|
||||
if (StringUtils.isNotEmpty(request.getEsbDataStruct()) || StringUtils.isNotEmpty(request.getBackEsbDataStruct())) {
|
||||
request = esbApiParamService.handleEsbRequest(request);
|
||||
}
|
||||
FileUtils.copyBdyFile(request.getApiDefinitionId(), request.getId());
|
||||
|
||||
final ApiTestCaseWithBLOBs test = new ApiTestCaseWithBLOBs();
|
||||
test.setId(request.getId());
|
||||
test.setName(request.getName());
|
||||
test.setStatus("");
|
||||
test.setApiDefinitionId(request.getApiDefinitionId());
|
||||
test.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
test.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
|
||||
|
@ -324,13 +335,18 @@ public class ApiTestCaseService {
|
|||
test.setUpdateTime(System.currentTimeMillis());
|
||||
test.setDescription(request.getDescription());
|
||||
test.setNum(getNextNum(request.getApiDefinitionId()));
|
||||
test.setFollowPeople(request.getFollowPeople());
|
||||
if (StringUtils.equals("[]", request.getTags())) {
|
||||
test.setTags("");
|
||||
} else {
|
||||
test.setTags(request.getTags());
|
||||
}
|
||||
FileUtils.copyBdyFile(request.getApiDefinitionId(), request.getId());
|
||||
apiTestCaseMapper.insert(test);
|
||||
ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = apiTestCaseMapper.selectByPrimaryKey(test.getId());
|
||||
if (apiTestCaseWithBLOBs != null) {
|
||||
apiTestCaseMapper.updateByPrimaryKey(apiTestCaseWithBLOBs);
|
||||
} else {
|
||||
apiTestCaseMapper.insert(test);
|
||||
}
|
||||
return test;
|
||||
}
|
||||
|
||||
|
@ -512,7 +528,7 @@ public class ApiTestCaseService {
|
|||
public void deleteBatchByParam(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null);
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null, request.getCombine());
|
||||
}
|
||||
this.deleteBatch(ids);
|
||||
}
|
||||
|
@ -520,7 +536,7 @@ public class ApiTestCaseService {
|
|||
public void editApiBathByParam(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null);
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null, request.getCombine());
|
||||
}
|
||||
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
|
||||
apiDefinitionExample.createCriteria().andIdIn(ids);
|
||||
|
@ -575,7 +591,7 @@ public class ApiTestCaseService {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
String requestStr = JSON.toJSONString(req);
|
||||
apiTestCase.setRequest(requestStr);
|
||||
|
@ -585,7 +601,7 @@ public class ApiTestCaseService {
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> getAllApiCaseIdsByFontedSelect(Map<String, List<String>> filters, List<String> moduleIds, String name, String projectId, String protocol, List<String> unSelectIds, String status, String apiId) {
|
||||
private List<String> getAllApiCaseIdsByFontedSelect(Map<String, List<String>> filters, List<String> moduleIds, String name, String projectId, String protocol, List<String> unSelectIds, String status, String apiId, Map<String, Object> combine) {
|
||||
ApiTestCaseRequest selectRequest = new ApiTestCaseRequest();
|
||||
selectRequest.setFilters(filters);
|
||||
selectRequest.setModuleIds(moduleIds);
|
||||
|
@ -595,6 +611,9 @@ public class ApiTestCaseService {
|
|||
selectRequest.setStatus(status);
|
||||
selectRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
|
||||
selectRequest.setApiDefinitionId(apiId);
|
||||
if (combine != null) {
|
||||
selectRequest.setCombine(combine);
|
||||
}
|
||||
List<ApiTestCaseDTO> list = extApiTestCaseMapper.listSimple(selectRequest);
|
||||
List<String> allIds = list.stream().map(ApiTestCaseDTO::getId).collect(Collectors.toList());
|
||||
List<String> ids = allIds.stream().filter(id -> !unSelectIds.contains(id)).collect(Collectors.toList());
|
||||
|
@ -688,7 +707,7 @@ public class ApiTestCaseService {
|
|||
// 调用执行方法
|
||||
jMeterService.runLocal(id, jmeterHashTree, debugReportId, runMode);
|
||||
} catch (Exception ex) {
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
}
|
||||
}
|
||||
return id;
|
||||
|
@ -846,7 +865,7 @@ public class ApiTestCaseService {
|
|||
public void deleteToGcByParam(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId());
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId(), request.getCombine());
|
||||
}
|
||||
this.deleteToGc(ids);
|
||||
}
|
||||
|
@ -854,7 +873,7 @@ public class ApiTestCaseService {
|
|||
public List<String> reduction(ApiTestBatchRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null);
|
||||
ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null, request.getCombine());
|
||||
}
|
||||
|
||||
List<String> cannotReductionAPiName = new ArrayList<>();
|
||||
|
@ -870,7 +889,6 @@ public class ApiTestCaseService {
|
|||
cannotReductionApiCaseList.stream().map(ApiTestCaseDTO::getId).collect(Collectors.toList());
|
||||
List<String> deleteIds = ids.stream().filter(id -> !cannotReductionCaseId.contains(id)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(deleteIds)) {
|
||||
extApiTestCaseMapper.checkOriginalStatusByIds(deleteIds);
|
||||
extApiTestCaseMapper.reduction(deleteIds);
|
||||
}
|
||||
}
|
||||
|
@ -888,7 +906,7 @@ public class ApiTestCaseService {
|
|||
public DeleteCheckResult checkDeleteDatas(ApiTestBatchRequest request) {
|
||||
List<String> deleteIds = request.getIds();
|
||||
if (request.isSelectAll()) {
|
||||
deleteIds = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId());
|
||||
deleteIds = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), request.getApiDefinitionId(), request.getCombine());
|
||||
}
|
||||
DeleteCheckResult result = new DeleteCheckResult();
|
||||
List<String> checkMsgList = new ArrayList<>();
|
||||
|
@ -987,4 +1005,12 @@ public class ApiTestCaseService {
|
|||
return jmxInfoDTO;
|
||||
}
|
||||
|
||||
public List<ApiTestCase> getApiCaseByIds(List<String> apiCaseIds) {
|
||||
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
|
||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||
example.createCriteria().andIdIn(apiCaseIds);
|
||||
return apiTestCaseMapper.selectByExample(example);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.ApiTestEnvironmentDTO;
|
||||
import io.metersphere.api.dto.mockconfig.MockConfigStaticData;
|
||||
import io.metersphere.api.tcp.TCPPool;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentExample;
|
||||
import io.metersphere.base.domain.ApiTestEnvironmentWithBLOBs;
|
||||
import io.metersphere.base.domain.Project;
|
||||
|
@ -138,10 +139,12 @@ public class ApiTestEnvironmentService {
|
|||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
public synchronized ApiTestEnvironmentWithBLOBs getMockEnvironmentByProjectId(String projectId, String protocal, String baseUrl) {
|
||||
//创建的时候检查当前站点
|
||||
public synchronized ApiTestEnvironmentWithBLOBs getMockEnvironmentByProjectId(String projectId) {
|
||||
|
||||
SystemParameterService systemParameterService = CommonBeanFactory.getBean(SystemParameterService.class);
|
||||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
String baseUrl = baseSystemConfigDTO.getUrl();
|
||||
String protocal = "http";
|
||||
if (baseSystemConfigDTO != null && StringUtils.isNotEmpty(baseSystemConfigDTO.getUrl())) {
|
||||
baseUrl = baseSystemConfigDTO.getUrl();
|
||||
if (baseUrl.startsWith("http:")) {
|
||||
|
@ -170,6 +173,8 @@ public class ApiTestEnvironmentService {
|
|||
|
||||
private ApiTestEnvironmentWithBLOBs checkMockEvnIsRightful(ApiTestEnvironmentWithBLOBs returnModel, String protocal, String projectId,String projectNumber, String name, String url) {
|
||||
boolean needUpdate = false;
|
||||
ProjectService projectService = CommonBeanFactory.getBean(ProjectService.class);
|
||||
Project project = projectService.getProjectById(projectId);
|
||||
if (returnModel.getConfig() != null) {
|
||||
try {
|
||||
JSONObject configObj = JSONObject.parseObject(returnModel.getConfig());
|
||||
|
@ -207,6 +212,26 @@ public class ApiTestEnvironmentService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0){
|
||||
if(configObj.containsKey("tcpConfig")){
|
||||
if(configObj.containsKey("port")){
|
||||
if(configObj.getInteger("port").intValue() != project.getMockTcpPort().intValue()){
|
||||
needUpdate = true;
|
||||
}
|
||||
}else {
|
||||
needUpdate = true;
|
||||
}
|
||||
|
||||
if(configObj.containsKey("server")){
|
||||
if(!StringUtils.equals(configObj.getString("server"),url)){
|
||||
needUpdate = true;
|
||||
}
|
||||
}else {
|
||||
needUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
needUpdate = true;
|
||||
e.printStackTrace();
|
||||
|
@ -214,21 +239,35 @@ public class ApiTestEnvironmentService {
|
|||
}
|
||||
if (needUpdate) {
|
||||
String id = returnModel.getId();
|
||||
returnModel = this.genHttpApiTestEnvironmentByUrl(projectId,projectNumber, protocal, name, url);
|
||||
returnModel = this.genHttpApiTestEnvironmentByUrl(project,projectNumber, protocal, name, url);
|
||||
returnModel.setId(id);
|
||||
apiTestEnvironmentMapper.updateByPrimaryKeyWithBLOBs(returnModel);
|
||||
}
|
||||
return returnModel;
|
||||
}
|
||||
|
||||
private ApiTestEnvironmentWithBLOBs genHttpApiTestEnvironmentByUrl(String projectId,String projectNumber, String protocal, String name, String url) {
|
||||
private ApiTestEnvironmentWithBLOBs genHttpApiTestEnvironmentByUrl(String projectId,String projectNumber, String protocal, String name, String baseUrl) {
|
||||
ProjectService projectService = CommonBeanFactory.getBean(ProjectService.class);
|
||||
Project project = projectService.getProjectById(projectId);
|
||||
if(project != null){
|
||||
return this.genHttpApiTestEnvironmentByUrl(project,projectNumber, protocal, name, baseUrl);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ApiTestEnvironmentWithBLOBs genHttpApiTestEnvironmentByUrl(Project project,String projectNumber, String protocal, String name, String baseUrl) {
|
||||
String socket = "";
|
||||
String url = baseUrl;
|
||||
if (url.startsWith("http://")) {
|
||||
url = url.substring(7);
|
||||
} else if (url.startsWith("https://")) {
|
||||
url = url.substring(8);
|
||||
}
|
||||
socket = url;
|
||||
String tcpSocket = socket;
|
||||
if(StringUtils.isNotEmpty(tcpSocket) && tcpSocket.contains(":")){
|
||||
tcpSocket = socket.split(":")[0];
|
||||
}
|
||||
|
||||
String portStr = "";
|
||||
String ipStr = url;
|
||||
|
@ -301,6 +340,12 @@ public class ApiTestEnvironmentService {
|
|||
tcpConfigObj.put("reUseConnection", false);
|
||||
tcpConfigObj.put("nodelay", false);
|
||||
tcpConfigObj.put("closeConnection", false);
|
||||
if(project != null){
|
||||
if(project.getMockTcpPort() != null && project.getMockTcpPort().intValue() != 0){
|
||||
tcpConfigObj.put("server", tcpSocket);
|
||||
tcpConfigObj.put("port", project.getMockTcpPort().intValue());
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("commonConfig", commonConfigObj);
|
||||
|
@ -309,7 +354,7 @@ public class ApiTestEnvironmentService {
|
|||
object.put("tcpConfig", tcpConfigObj);
|
||||
|
||||
ApiTestEnvironmentWithBLOBs blobs = new ApiTestEnvironmentWithBLOBs();
|
||||
blobs.setProjectId(projectId);
|
||||
blobs.setProjectId(project.getId());
|
||||
blobs.setName(name);
|
||||
blobs.setConfig(object.toString());
|
||||
|
||||
|
@ -353,4 +398,36 @@ public class ApiTestEnvironmentService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMockInfo(String projectId) {
|
||||
String returnStr = "";
|
||||
ApiTestEnvironmentWithBLOBs mockEnv = this.getMockEnvironmentByProjectId(projectId);
|
||||
if (mockEnv != null && mockEnv.getConfig() != null) {
|
||||
try {
|
||||
JSONObject configObj = JSONObject.parseObject(mockEnv.getConfig());
|
||||
|
||||
if(configObj.containsKey("tcpConfig")){
|
||||
JSONObject tcpConfigObj = configObj.getJSONObject("tcpConfig");
|
||||
int tcpPort = 0;
|
||||
if(tcpConfigObj.containsKey("port")){
|
||||
tcpPort = tcpConfigObj.getInteger("port").intValue();
|
||||
if(tcpPort == 0 || !TCPPool.isTcpOpen(tcpPort)){
|
||||
return returnStr;
|
||||
}
|
||||
}else {
|
||||
return returnStr;
|
||||
}
|
||||
if(tcpConfigObj.containsKey("server")){
|
||||
String server = tcpConfigObj.getString("server");
|
||||
returnStr = server +":"+ tcpPort;
|
||||
}else {
|
||||
return returnStr;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return returnStr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.apache.commons.collections.CollectionUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jorphan.exec.SystemCommand;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -19,6 +20,7 @@ import java.io.InputStreamReader;
|
|||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class CommandService {
|
||||
|
||||
public List<KeyStoreEntry> get(String password, MultipartFile file) {
|
||||
|
@ -56,7 +58,7 @@ public class CommandService {
|
|||
FileUtils.deleteFile(path);
|
||||
return dtoList;
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(e.getMessage());
|
||||
}
|
||||
return null;
|
||||
|
@ -146,14 +148,14 @@ public class CommandService {
|
|||
MSException.throwException("合并条目:【" + entry.getOriginalAsName() + " 】失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +177,7 @@ public class CommandService {
|
|||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
LogUtil.error(e);
|
||||
MSException.throwException(e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.JSONValidator;
|
||||
import io.metersphere.api.dto.automation.EsbDataStruct;
|
||||
import io.metersphere.api.dto.automation.TcpTreeTableDataStruct;
|
||||
import io.metersphere.api.dto.automation.parse.TcpTreeTableDataParser;
|
||||
import io.metersphere.api.dto.mockconfig.MockConfigRequest;
|
||||
import io.metersphere.api.dto.mockconfig.MockExpectConfigRequest;
|
||||
import io.metersphere.api.dto.mockconfig.response.JsonSchemaReturnObj;
|
||||
|
@ -12,22 +15,28 @@ import io.metersphere.api.dto.mockconfig.response.MockExpectConfigResponse;
|
|||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.MockConfigMapper;
|
||||
import io.metersphere.base.mapper.MockExpectConfigMapper;
|
||||
import io.metersphere.base.mapper.ProjectMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtMockExpectConfigMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.JsonPathUtils;
|
||||
import io.metersphere.commons.utils.*;
|
||||
import io.metersphere.jmeter.utils.ScriptEngineUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.XML;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
@ -39,7 +48,11 @@ public class MockConfigService {
|
|||
@Resource
|
||||
private MockExpectConfigMapper mockExpectConfigMapper;
|
||||
@Resource
|
||||
private ExtMockExpectConfigMapper extMockExpectConfigMapper;
|
||||
@Resource
|
||||
private ApiDefinitionService apiDefinitionService;
|
||||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
public MockConfigResponse findByApiIdList(List<String> apiIdList) {
|
||||
if (apiIdList.isEmpty()) {
|
||||
|
@ -96,12 +109,14 @@ public class MockConfigService {
|
|||
|
||||
MockConfig config = new MockConfig();
|
||||
config.setProjectId(request.getProjectId());
|
||||
config.setApiId(request.getApiId());
|
||||
config.setId(UUID.randomUUID().toString());
|
||||
config.setCreateUserId(SessionUtils.getUserId());
|
||||
config.setCreateTime(createTimeStmp);
|
||||
config.setUpdateTime(createTimeStmp);
|
||||
mockConfigMapper.insert(config);
|
||||
if(request.getApiId() != null){
|
||||
config.setApiId(request.getApiId());
|
||||
mockConfigMapper.insert(config);
|
||||
}
|
||||
returnRsp = new MockConfigResponse(config, new ArrayList<>());
|
||||
} else {
|
||||
MockConfig config = configList.get(0);
|
||||
|
@ -182,7 +197,7 @@ public class MockConfigService {
|
|||
JSONObject requestObj = model.getRequest();
|
||||
boolean isJsonParam = requestObj.getBoolean("jsonParam");
|
||||
if (isJsonParam) {
|
||||
if(StringUtils.isEmpty(requestObj.getString("jsonData"))){
|
||||
if (StringUtils.isEmpty(requestObj.getString("jsonData"))) {
|
||||
return model;
|
||||
}
|
||||
} else {
|
||||
|
@ -219,13 +234,13 @@ public class MockConfigService {
|
|||
if (isJsonParam) {
|
||||
String jsonParams = requestObj.getString("jsonData");
|
||||
JSONValidator jsonValidator = JSONValidator.from(jsonParams);
|
||||
if(StringUtils.equalsIgnoreCase("Array",jsonValidator.getType().name())){
|
||||
if (StringUtils.equalsIgnoreCase("Array", jsonValidator.getType().name())) {
|
||||
JSONArray mockExpectArr = JSONArray.parseArray(jsonParams);
|
||||
for(int expectIndex = 0;expectIndex < mockExpectArr.size(); expectIndex ++){
|
||||
for (int expectIndex = 0; expectIndex < mockExpectArr.size(); expectIndex++) {
|
||||
JSONObject itemObj = mockExpectArr.getJSONObject(expectIndex);
|
||||
mockExpectJson = itemObj;
|
||||
}
|
||||
}else if(StringUtils.equalsIgnoreCase("Object",jsonValidator.getType().name())){
|
||||
} else if (StringUtils.equalsIgnoreCase("Object", jsonValidator.getType().name())) {
|
||||
JSONObject mockExpectJsonItem = JSONObject.parseObject(jsonParams);
|
||||
mockExpectJson = mockExpectJsonItem;
|
||||
}
|
||||
|
@ -247,7 +262,7 @@ public class MockConfigService {
|
|||
}
|
||||
}
|
||||
|
||||
boolean mathing = JsonPathUtils.checkJsonObjCompliance(reqJsonObj, mockExpectJson);
|
||||
boolean mathing = JsonStructUtils.checkJsonObjCompliance(reqJsonObj, mockExpectJson);
|
||||
if (mathing) {
|
||||
returnModel = model;
|
||||
break;
|
||||
|
@ -271,7 +286,7 @@ public class MockConfigService {
|
|||
boolean isJsonParam = requestObj.getBoolean("jsonParam");
|
||||
|
||||
if (isJsonParam) {
|
||||
if(StringUtils.isEmpty(requestObj.getString("jsonData"))){
|
||||
if (StringUtils.isEmpty(requestObj.getString("jsonData"))) {
|
||||
return model;
|
||||
}
|
||||
} else {
|
||||
|
@ -308,18 +323,18 @@ public class MockConfigService {
|
|||
if (isJsonParam) {
|
||||
String jsonParams = requestObj.getString("jsonData");
|
||||
JSONValidator jsonValidator = JSONValidator.from(jsonParams);
|
||||
if(StringUtils.equalsIgnoreCase("Array",jsonValidator.getType().name())){
|
||||
if (StringUtils.equalsIgnoreCase("Array", jsonValidator.getType().name())) {
|
||||
JSONArray mockExpectArr = JSONArray.parseArray(jsonParams);
|
||||
for(int expectIndex = 0;expectIndex < mockExpectArr.size(); expectIndex ++){
|
||||
for (int expectIndex = 0; expectIndex < mockExpectArr.size(); expectIndex++) {
|
||||
JSONObject itemObj = mockExpectArr.getJSONObject(expectIndex);
|
||||
mathing = JsonPathUtils.checkJsonArrayCompliance(reqJsonArray, itemObj);
|
||||
if(!mathing){
|
||||
mathing = JsonStructUtils.checkJsonArrayCompliance(reqJsonArray, itemObj);
|
||||
if (!mathing) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else if(StringUtils.equalsIgnoreCase("Object",jsonValidator.getType().name())){
|
||||
} else if (StringUtils.equalsIgnoreCase("Object", jsonValidator.getType().name())) {
|
||||
JSONObject mockExpectJson = JSONObject.parseObject(jsonParams);
|
||||
mathing = JsonPathUtils.checkJsonArrayCompliance(reqJsonArray, mockExpectJson);
|
||||
mathing = JsonStructUtils.checkJsonArrayCompliance(reqJsonArray, mockExpectJson);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -339,7 +354,7 @@ public class MockConfigService {
|
|||
mockExpectJson.put(name, value);
|
||||
}
|
||||
}
|
||||
mathing = JsonPathUtils.checkJsonArrayCompliance(reqJsonArray, mockExpectJson);
|
||||
mathing = JsonStructUtils.checkJsonArrayCompliance(reqJsonArray, mockExpectJson);
|
||||
}
|
||||
if (mathing) {
|
||||
returnModel = model;
|
||||
|
@ -393,9 +408,9 @@ public class MockConfigService {
|
|||
public String updateHttpServletResponse(List<ApiDefinitionWithBLOBs> apis, HttpServletResponse response) {
|
||||
String returnStr = "";
|
||||
try {
|
||||
if(CollectionUtils.isEmpty(apis)){
|
||||
if (CollectionUtils.isEmpty(apis)) {
|
||||
response.setStatus(404);
|
||||
}else {
|
||||
} else {
|
||||
for (ApiDefinitionWithBLOBs api : apis) {
|
||||
int status = 404;
|
||||
if (api.getResponse() != null) {
|
||||
|
@ -509,7 +524,7 @@ public class MockConfigService {
|
|||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(returnStr) && status == 404){
|
||||
if (StringUtils.isNotEmpty(returnStr) && status == 404) {
|
||||
status = 200;
|
||||
}
|
||||
response.setStatus(status);
|
||||
|
@ -524,8 +539,8 @@ public class MockConfigService {
|
|||
|
||||
private JSONObject parseJsonSchema(JSONObject bodyReturnObj) {
|
||||
JSONObject returnObj = new JSONObject();
|
||||
if(bodyReturnObj == null){
|
||||
return returnObj;
|
||||
if (bodyReturnObj == null) {
|
||||
return returnObj;
|
||||
}
|
||||
|
||||
Set<String> keySet = bodyReturnObj.keySet();
|
||||
|
@ -556,7 +571,7 @@ public class MockConfigService {
|
|||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
String values = obj.getMockValue();
|
||||
if (StringUtils.isEmpty(values)) {
|
||||
values = "";
|
||||
|
@ -612,9 +627,9 @@ public class MockConfigService {
|
|||
try {
|
||||
String param = this.getRequestPostStr(request);
|
||||
JSONValidator jsonValidator = JSONValidator.from(param);
|
||||
if(StringUtils.equalsIgnoreCase("Array",jsonValidator.getType().name())){
|
||||
if (StringUtils.equalsIgnoreCase("Array", jsonValidator.getType().name())) {
|
||||
returnJson = JSONArray.parseArray(param);
|
||||
}else if(StringUtils.equalsIgnoreCase("Object",jsonValidator.getType().name())){
|
||||
} else if (StringUtils.equalsIgnoreCase("Object", jsonValidator.getType().name())) {
|
||||
returnJson = JSONObject.parseObject(param);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -732,39 +747,51 @@ public class MockConfigService {
|
|||
}
|
||||
}
|
||||
|
||||
// List<String> sendParams = new ArrayList<>();
|
||||
// for (String param : pathArr) {
|
||||
// if (param.startsWith("{") && param.endsWith("}")) {
|
||||
// param = param.substring(1, param.length() - 1);
|
||||
// sendParams.add(param);
|
||||
// }
|
||||
// }
|
||||
// try {
|
||||
// JSONObject requestJson = JSONObject.parseObject(api.getRequest());
|
||||
// if (requestJson.containsKey("rest")) {
|
||||
// JSONArray jsonArray = requestJson.getJSONArray("rest");
|
||||
// for (int i = 0; i < jsonArray.size(); i++) {
|
||||
// JSONObject object = jsonArray.getJSONObject(i);
|
||||
// if (object.containsKey("name") && object.containsKey("enable") && object.getBoolean("enable")) {
|
||||
// String name = object.getString("name");
|
||||
// if (sendParams.contains(name)) {
|
||||
// String value = "";
|
||||
// if (object.containsKey("value")) {
|
||||
// value = object.getString("value");
|
||||
// }
|
||||
// returnJson.put(name, value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
return returnJson;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getApiParamsByApiDefinitionBLOBs(ApiDefinitionWithBLOBs apiModel) {
|
||||
if (apiModel == null) {
|
||||
return new ArrayList<>();
|
||||
} else if (StringUtils.equalsIgnoreCase("tcp", apiModel.getMethod())) {
|
||||
return this.getTCPApiParams(apiModel);
|
||||
} else {
|
||||
return this.getHTTPApiParams(apiModel);
|
||||
}
|
||||
}
|
||||
|
||||
private List<Map<String, String>> getTCPApiParams(ApiDefinitionWithBLOBs apiModel) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
List<String> paramNameList = new ArrayList<>();
|
||||
if (apiModel != null) {
|
||||
if (apiModel.getRequest() != null) {
|
||||
JSONObject requestObj = this.genJSONObject(apiModel.getRequest());
|
||||
if (requestObj != null && requestObj.containsKey("reportType")) {
|
||||
String reportType = requestObj.getString("reportType");
|
||||
if (StringUtils.equalsIgnoreCase(reportType, "xml") && requestObj.containsKey("xmlDataStruct")) {
|
||||
paramNameList = this.parseByTcpTreeDataStruct(requestObj.getString("xmlDataStruct"));
|
||||
} else if (StringUtils.equalsIgnoreCase(reportType, "json") && requestObj.containsKey("jsonDataStruct")) {
|
||||
paramNameList = this.parseByJsonDataStruct(requestObj.getString("jsonDataStruct"));
|
||||
} else if (requestObj.containsKey("protocol")) {
|
||||
String protocol = requestObj.getString("protocol");
|
||||
if (StringUtils.equalsIgnoreCase("ESB", protocol) && requestObj.containsKey("esbDataStruct")) {
|
||||
paramNameList = this.parseByESBDataStruct(requestObj.getString("esbDataStruct"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (String param : paramNameList) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("value", param);
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<Map<String, String>> getHTTPApiParams(ApiDefinitionWithBLOBs apiModel) {
|
||||
List<Map<String, String>> list = new ArrayList<>();
|
||||
List<String> paramNameList = new ArrayList<>();
|
||||
if (apiModel != null) {
|
||||
|
@ -893,15 +920,15 @@ public class MockConfigService {
|
|||
|
||||
if (mockConfigData != null && mockConfigData.getMockExpectConfigList() != null) {
|
||||
JSON paramJson = this.getPostParamMap(request);
|
||||
if(paramJson instanceof JSONObject){
|
||||
JSONObject paramMap = (JSONObject)paramJson;
|
||||
if (paramJson instanceof JSONObject) {
|
||||
JSONObject paramMap = (JSONObject) paramJson;
|
||||
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(mockConfigData.getMockExpectConfigList(), paramMap);
|
||||
if (finalExpectConfig != null) {
|
||||
isMatch = true;
|
||||
returnStr = this.updateHttpServletResponse(finalExpectConfig, response);
|
||||
}
|
||||
}else if(paramJson instanceof JSONArray){
|
||||
JSONArray paramArray = (JSONArray)paramJson;
|
||||
} else if (paramJson instanceof JSONArray) {
|
||||
JSONArray paramArray = (JSONArray) paramJson;
|
||||
MockExpectConfigResponse finalExpectConfig = this.findExpectConfig(mockConfigData.getMockExpectConfigList(), paramArray);
|
||||
if (finalExpectConfig != null) {
|
||||
isMatch = true;
|
||||
|
@ -922,7 +949,7 @@ public class MockConfigService {
|
|||
String returnStr = "";
|
||||
boolean isMatch = false;
|
||||
List<ApiDefinitionWithBLOBs> aualifiedApiList = new ArrayList<>();
|
||||
if(project != null){
|
||||
if (project != null) {
|
||||
String urlSuffix = this.getUrlSuffix(project.getSystemId(), request);
|
||||
aualifiedApiList = apiDefinitionService.preparedUrl(project.getId(), method, null, urlSuffix);
|
||||
|
||||
|
@ -1001,4 +1028,163 @@ public class MockConfigService {
|
|||
}
|
||||
return new String(buffer, charEncoding);
|
||||
}
|
||||
|
||||
private List<String> parseByJsonDataStruct(String dataString) {
|
||||
List<String> returnList = new ArrayList<>();
|
||||
try {
|
||||
JSONValidator validator = JSONValidator.from(dataString);
|
||||
Map<String, String> keyValueMap = new HashMap<>();
|
||||
if (StringUtils.equalsIgnoreCase(validator.getType().name(), "Object")) {
|
||||
JsonStructUtils.deepParseKeyByJsonObject(JSONObject.parseObject(dataString), returnList);
|
||||
} else if (StringUtils.equalsIgnoreCase(validator.getType().name(), "Array")) {
|
||||
JsonStructUtils.deepParseKeyByJsonArray(JSONArray.parseArray(dataString), returnList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage());
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
private List<String> parseByTcpTreeDataStruct(String dataString) {
|
||||
List<TcpTreeTableDataStruct> list = JSONArray.parseArray(dataString, TcpTreeTableDataStruct.class);
|
||||
List<String> returnList = new ArrayList<>();
|
||||
for (TcpTreeTableDataStruct dataStruct : list) {
|
||||
List<String> nameList = dataStruct.getNameDeep();
|
||||
for (String name : nameList) {
|
||||
if (!returnList.contains(nameList)) {
|
||||
returnList.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
private List<String> parseByESBDataStruct(String dataString) {
|
||||
List<EsbDataStruct> list = JSONArray.parseArray(dataString, EsbDataStruct.class);
|
||||
List<String> returnList = new ArrayList<>();
|
||||
for (EsbDataStruct dataStruct : list) {
|
||||
List<String> nameList = dataStruct.getNameDeep();
|
||||
for (String name : nameList) {
|
||||
if (!returnList.contains(nameList)) {
|
||||
returnList.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public MockExpectConfigWithBLOBs matchTcpMockExpect(String message, int port) {
|
||||
ProjectExample projectExample = new ProjectExample();
|
||||
projectExample.createCriteria().andMockTcpPortEqualTo(port).andIsMockTcpOpenEqualTo(true);
|
||||
List<Project> projectList = projectMapper.selectByExample(projectExample);
|
||||
|
||||
boolean isJsonMessage = this.checkMessageIsJson(message);
|
||||
boolean isXMLMessage = this.checkMessageIsXml(message);
|
||||
|
||||
List<MockExpectConfigWithBLOBs> structResult = new ArrayList<>();
|
||||
List<MockExpectConfigWithBLOBs> rawResult = new ArrayList<>();
|
||||
|
||||
for (Project project : projectList) {
|
||||
String projectId = project.getId();
|
||||
List<MockExpectConfigWithBLOBs> mockExpectConfigList = extMockExpectConfigMapper.selectByProjectIdAndStatusIsOpen(projectId);
|
||||
for (MockExpectConfigWithBLOBs expectConfig : mockExpectConfigList) {
|
||||
String requestStr = expectConfig.getRequest();
|
||||
String responseStr = expectConfig.getResponse();
|
||||
if (StringUtils.isEmpty(responseStr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
JSONObject requestJson = JSONObject.parseObject(requestStr);
|
||||
if (requestJson.containsKey("reportType")) {
|
||||
boolean isMatch = false;
|
||||
boolean isRaw = false;
|
||||
String reportType = requestJson.getString("reportType");
|
||||
|
||||
if (isJsonMessage && StringUtils.equalsIgnoreCase(reportType, "json")) {
|
||||
if (requestJson.containsKey("jsonDataStruct")) {
|
||||
isMatch = JsonStructUtils.checkJsonCompliance(message, requestJson.getString("jsonDataStruct"));
|
||||
}
|
||||
} else if (isXMLMessage && StringUtils.equalsIgnoreCase(reportType, "xml")) {
|
||||
if (requestJson.containsKey("xmlDataStruct")) {
|
||||
JSONObject sourceObj = XMLUtils.XmlToJson(message);
|
||||
String xmlStr = "";
|
||||
try {
|
||||
List<TcpTreeTableDataStruct> tcpDataList = JSONArray.parseArray(requestJson.getString("xmlDataStruct"),TcpTreeTableDataStruct.class);
|
||||
xmlStr = TcpTreeTableDataParser.treeTableData2Xml(tcpDataList);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
JSONObject matchObj = XMLUtils.XmlToJson(xmlStr);
|
||||
isMatch = JsonStructUtils.checkJsonObjCompliance(sourceObj, matchObj);
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(reportType, "raw")) {
|
||||
if (requestJson.containsKey("rawDataStruct")) {
|
||||
String rawDataStruct = requestJson.getString("rawDataStruct");
|
||||
if (StringUtils.contains(message, rawDataStruct)) {
|
||||
isMatch = true;
|
||||
isRaw = true;
|
||||
} else {
|
||||
Pattern pattern = Pattern.compile(rawDataStruct);
|
||||
Matcher matcher = pattern.matcher(message);
|
||||
if (matcher.find()) {
|
||||
isMatch = true;
|
||||
isRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isMatch) {
|
||||
JSONObject responseObj = JSONObject.parseObject(responseStr);
|
||||
if (responseObj.containsKey("body")) {
|
||||
if (isRaw) {
|
||||
rawResult.add(expectConfig);
|
||||
} else {
|
||||
structResult.add(expectConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//优先返回结构匹配的数据
|
||||
if(!structResult.isEmpty()){
|
||||
return structResult.get(0);
|
||||
}else {
|
||||
if(!rawResult.isEmpty()){
|
||||
return rawResult.get(0);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkMessageIsXml(String message) {
|
||||
boolean isXml = false;
|
||||
try {
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
|
||||
builder.parse(new InputSource(new ByteArrayInputStream(message.getBytes("utf-8"))));
|
||||
isXml = true;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return isXml;
|
||||
}
|
||||
|
||||
private boolean checkMessageIsJson(String message) {
|
||||
boolean isJson = false;
|
||||
try {
|
||||
JSONValidator validator = JSONValidator.from(message);
|
||||
String type = validator.getType().name();
|
||||
if (!StringUtils.equalsIgnoreCase("value", type)) {
|
||||
isJson = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return isJson;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.apache.jmeter.samplers.SampleResult;
|
|||
import org.apache.jmeter.threads.JMeterVariables;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import sun.security.util.Cache;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -19,10 +20,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class MsResultService {
|
||||
// 零时存放实时结果
|
||||
private Cache cache = Cache.newHardMemoryCache(0, 3600 * 2);
|
||||
public ConcurrentHashMap<String, List<SampleResult>> processCache = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<String, List<SampleResult>> processCache = new ConcurrentHashMap<>();
|
||||
|
||||
public ConcurrentHashMap<String, List<SampleResult>> getProcessCache() {
|
||||
return processCache;
|
||||
}
|
||||
|
||||
private final static String THREAD_SPLIT = " ";
|
||||
|
||||
|
@ -213,7 +219,9 @@ public class MsResultService {
|
|||
}
|
||||
//xpath 提取错误会添加断言错误
|
||||
if (StringUtils.isBlank(responseAssertionResult.getMessage()) ||
|
||||
(StringUtils.isNotBlank(responseAssertionResult.getName()) && !responseAssertionResult.getName().endsWith("XPath2Extractor"))) {
|
||||
(StringUtils.isNotBlank(responseAssertionResult.getName()) && !responseAssertionResult.getName().endsWith("XPath2Extractor"))
|
||||
|| (StringUtils.isNotBlank(responseAssertionResult.getContent()) && !responseAssertionResult.getContent().endsWith("XPath2Extractor"))
|
||||
) {
|
||||
responseResult.getAssertions().add(responseAssertionResult);
|
||||
}
|
||||
}
|
||||
|
@ -246,6 +254,15 @@ public class MsResultService {
|
|||
private ResponseAssertionResult getResponseAssertionResult(AssertionResult assertionResult) {
|
||||
ResponseAssertionResult responseAssertionResult = new ResponseAssertionResult();
|
||||
responseAssertionResult.setName(assertionResult.getName());
|
||||
if (StringUtils.isNotEmpty(assertionResult.getName()) && assertionResult.getName().indexOf("==") != -1) {
|
||||
String array[] = assertionResult.getName().split("==");
|
||||
responseAssertionResult.setName(array[0]);
|
||||
StringBuffer content = new StringBuffer();
|
||||
for (int i = 1; i < array.length; i++) {
|
||||
content.append(array[i]);
|
||||
}
|
||||
responseAssertionResult.setContent(content.toString());
|
||||
}
|
||||
responseAssertionResult.setPass(!assertionResult.isFailure() && !assertionResult.isError());
|
||||
if (!responseAssertionResult.isPass()) {
|
||||
responseAssertionResult.setMessage(assertionResult.getFailureMessage());
|
||||
|
|
|
@ -2,15 +2,18 @@ package io.metersphere.api.service;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.dto.document.*;
|
||||
import io.metersphere.api.dto.share.*;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiDocumentShare;
|
||||
import io.metersphere.base.mapper.ApiDocumentShareMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDocumentMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDocumentShareMapper;
|
||||
import io.metersphere.base.domain.ShareInfo;
|
||||
import io.metersphere.base.domain.TestPlanApiCase;
|
||||
import io.metersphere.base.domain.TestPlanApiScenario;
|
||||
import io.metersphere.base.mapper.ShareInfoMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtShareInfoMapper;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.BeanUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
import io.metersphere.track.service.TestPlanApiCaseService;
|
||||
import io.metersphere.track.service.TestPlanScenarioCaseService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -25,37 +28,41 @@ import java.util.*;
|
|||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiDocumentService {
|
||||
public class ShareInfoService {
|
||||
|
||||
@Resource
|
||||
ExtApiDocumentMapper extApiDocumentMapper;
|
||||
ExtShareInfoMapper extShareInfoMapper;
|
||||
@Resource
|
||||
ApiDocumentShareMapper apiDocumentShareMapper;
|
||||
ShareInfoMapper shareInfoMapper;
|
||||
@Resource
|
||||
ExtApiDocumentShareMapper extApiDocumentShareMapper;
|
||||
TestPlanApiCaseService testPlanApiCaseService;
|
||||
@Resource
|
||||
SystemParameterService systemParameterService;
|
||||
TestPlanScenarioCaseService testPlanScenarioCaseService;
|
||||
|
||||
public List<ApiDocumentInfoDTO> findApiDocumentSimpleInfoByRequest(ApiDocumentRequest request) {
|
||||
if (this.isParamLegitimacy(request)) {
|
||||
if (request.getProjectId() == null) {
|
||||
List<String> shareIdList = this.selectShareIdByApiDocumentShareId(request.getShareId());
|
||||
List<String> shareIdList = this.selectShareIdByShareInfoId(request.getShareId());
|
||||
request.setApiIdList(shareIdList);
|
||||
return extApiDocumentMapper.findApiDocumentSimpleInfoByRequest(request);
|
||||
if(shareIdList.isEmpty()){
|
||||
return new ArrayList<>();
|
||||
}else {
|
||||
return extShareInfoMapper.findApiDocumentSimpleInfoByRequest(request);
|
||||
}
|
||||
} else {
|
||||
return extApiDocumentMapper.findApiDocumentSimpleInfoByRequest(request);
|
||||
return extShareInfoMapper.findApiDocumentSimpleInfoByRequest(request);
|
||||
}
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> selectShareIdByApiDocumentShareId(String shareId) {
|
||||
private List<String> selectShareIdByShareInfoId(String shareId) {
|
||||
List<String> shareApiIdList = new ArrayList<>();
|
||||
ApiDocumentShare share = apiDocumentShareMapper.selectByPrimaryKey(shareId);
|
||||
ShareInfo share = shareInfoMapper.selectByPrimaryKey(shareId);
|
||||
if (share != null) {
|
||||
try {
|
||||
JSONArray jsonArray = JSONArray.parseArray(share.getShareApiId());
|
||||
JSONArray jsonArray = JSONArray.parseArray(share.getCustomData());
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
String apiId = jsonArray.getString(i);
|
||||
shareApiIdList.add(apiId);
|
||||
|
@ -381,40 +388,42 @@ public class ApiDocumentService {
|
|||
* 搜索的到就返回那条数据,搜索不到就新增一条信息
|
||||
*
|
||||
* @param request 入参
|
||||
* @return ApiDocumentShare数据对象
|
||||
* @return ShareInfo数据对象
|
||||
*/
|
||||
public ApiDocumentShare generateApiDocumentShare(ApiDocumentShareRequest request) {
|
||||
ApiDocumentShare apiDocumentShare = null;
|
||||
public ShareInfo generateApiDocumentShareInfo(ApiDocumentShareRequest request) {
|
||||
if (request.getShareApiIdList() != null && !request.getShareApiIdList().isEmpty()
|
||||
&& StringUtils.equalsAny(request.getShareType(), ApiDocumentShareType.Single.name(), ApiDocumentShareType.Batch.name())) {
|
||||
&& StringUtils.equalsAny(request.getShareType(), ShareInfoType.Single.name(), ShareInfoType.Batch.name())) {
|
||||
//将ID进行排序
|
||||
List<ApiDocumentShare> apiDocumentShareList = this.findByShareTypeAndShareApiIdWithBLOBs(request.getShareType(), request.getShareApiIdList());
|
||||
if (apiDocumentShareList.isEmpty()) {
|
||||
String shareApiIdJsonArrayString = this.genShareIdJsonString(request.getShareApiIdList());
|
||||
long createTime = System.currentTimeMillis();
|
||||
|
||||
apiDocumentShare = new ApiDocumentShare();
|
||||
apiDocumentShare.setId(UUID.randomUUID().toString());
|
||||
apiDocumentShare.setShareApiId(shareApiIdJsonArrayString);
|
||||
apiDocumentShare.setCreateUserId(SessionUtils.getUserId());
|
||||
apiDocumentShare.setCreateTime(createTime);
|
||||
apiDocumentShare.setUpdateTime(createTime);
|
||||
apiDocumentShare.setShareType(request.getShareType());
|
||||
apiDocumentShareMapper.insert(apiDocumentShare);
|
||||
} else {
|
||||
return apiDocumentShareList.get(0);
|
||||
}
|
||||
ShareInfo shareInfoRequest = new ShareInfo();
|
||||
BeanUtils.copyBean(shareInfoRequest, request);
|
||||
shareInfoRequest.setCustomData(genShareIdJsonString(request.getShareApiIdList()));
|
||||
return generateShareInfo(shareInfoRequest);
|
||||
}
|
||||
|
||||
if (apiDocumentShare == null) {
|
||||
apiDocumentShare = new ApiDocumentShare();
|
||||
}
|
||||
return apiDocumentShare;
|
||||
return new ShareInfo();
|
||||
}
|
||||
|
||||
private List<ApiDocumentShare> findByShareTypeAndShareApiIdWithBLOBs(String shareType, List<String> shareApiIdList) {
|
||||
public ShareInfo generateShareInfo(ShareInfo request) {
|
||||
ShareInfo shareInfo = null;
|
||||
List<ShareInfo> shareInfos = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(request.getShareType(), request.getCustomData());
|
||||
if (shareInfos.isEmpty()) {
|
||||
long createTime = System.currentTimeMillis();
|
||||
shareInfo = new ShareInfo();
|
||||
shareInfo.setId(UUID.randomUUID().toString());
|
||||
shareInfo.setCustomData(request.getCustomData());
|
||||
shareInfo.setCreateUserId(SessionUtils.getUserId());
|
||||
shareInfo.setCreateTime(createTime);
|
||||
shareInfo.setUpdateTime(createTime);
|
||||
shareInfo.setShareType(request.getShareType());
|
||||
shareInfoMapper.insert(shareInfo);
|
||||
return shareInfo;
|
||||
} else {
|
||||
return shareInfos.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ShareInfo> findByShareTypeAndShareApiIdWithBLOBs(String shareType, List<String> shareApiIdList) {
|
||||
String shareApiIdString = this.genShareIdJsonString(shareApiIdList);
|
||||
return extApiDocumentShareMapper.selectByShareTypeAndShareApiIdWithBLOBs(shareType, shareApiIdString);
|
||||
return extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(shareType, shareApiIdString);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -428,14 +437,46 @@ public class ApiDocumentService {
|
|||
return JSONArray.toJSONString(treeSet);
|
||||
}
|
||||
|
||||
public ApiDocumentShareDTO conversionApiDocumentShareToDTO(ApiDocumentShare apiShare) {
|
||||
ApiDocumentShareDTO returnDTO = new ApiDocumentShareDTO();
|
||||
if (!StringUtils.isEmpty(apiShare.getShareApiId())) {
|
||||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
public ShareInfoDTO conversionShareInfoToDTO(ShareInfo apiShare) {
|
||||
ShareInfoDTO returnDTO = new ShareInfoDTO();
|
||||
if (!StringUtils.isEmpty(apiShare.getCustomData())) {
|
||||
String url = "?" + apiShare.getId();
|
||||
returnDTO.setId(apiShare.getId());
|
||||
returnDTO.setShareUrl(url);
|
||||
}
|
||||
return returnDTO;
|
||||
}
|
||||
|
||||
public ShareInfo get(String id) {
|
||||
return shareInfoMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void validate(String shareId, String customData) {
|
||||
ShareInfo shareInfo = shareInfoMapper.selectByPrimaryKey(shareId);
|
||||
if (shareInfo == null) {
|
||||
MSException.throwException("shareInfo not exist!");
|
||||
} else {
|
||||
if (!StringUtils.equals(customData, shareInfo.getCustomData())) {
|
||||
MSException.throwException("validate failure!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void apiReportValidate(String shareId, String testId) {
|
||||
ShareInfo shareInfo = shareInfoMapper.selectByPrimaryKey(shareId);
|
||||
String planId = shareInfo.getCustomData();
|
||||
TestPlanApiCase testPlanApiCase = testPlanApiCaseService.getById(testId);
|
||||
if (!StringUtils.equals(planId, testPlanApiCase.getTestPlanId())) {
|
||||
MSException.throwException("validate failure!");
|
||||
}
|
||||
}
|
||||
|
||||
public void scenarioReportValidate(String shareId, String reportId) {
|
||||
ShareInfo shareInfo = shareInfoMapper.selectByPrimaryKey(shareId);
|
||||
String planId = shareInfo.getCustomData();
|
||||
TestPlanApiScenario testPlanApiScenario = testPlanScenarioCaseService.selectByReportId(reportId);
|
||||
if (!StringUtils.equals(planId, testPlanApiScenario.getTestPlanId())) {
|
||||
MSException.throwException("validate failure!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import io.metersphere.commons.constants.*;
|
|||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
import io.metersphere.commons.utils.DateUtils;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.notice.sender.NoticeModel;
|
||||
|
@ -21,6 +22,7 @@ import io.metersphere.track.service.TestPlanTestCaseService;
|
|||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
|
@ -28,6 +30,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class TestResultService {
|
||||
|
||||
@Resource
|
||||
|
@ -86,12 +89,10 @@ public class TestResultService {
|
|||
reportTask.setExecutionTime(DateUtils.getTimeString(apiTestCaseWithBLOBs.getCreateTime()));
|
||||
reportTask.setExecutionEnvironment(name);
|
||||
//测试计划用例,定时,jenkins
|
||||
} else if (StringUtils.equalsAny(runMode, ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
} else if (StringUtils.equalsAny(runMode, ApiRunMode.API_PLAN.name(), ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) {
|
||||
//测试计划定时任务-接口执行逻辑的话,需要同步测试计划的报告数据
|
||||
if (StringUtils.equals(runMode, ApiRunMode.SCHEDULE_API_PLAN.name())) {
|
||||
apiDefinitionExecResultService.saveApiResultByScheduleTask(testResult, debugReportId, ApiRunMode.SCHEDULE_API_PLAN.name(), ReportTriggerMode.SCHEDULE.name());
|
||||
} else if (StringUtils.equals(runMode, ApiRunMode.JENKINS_API_PLAN.name())) {
|
||||
apiDefinitionExecResultService.saveApiResultByScheduleTask(testResult, debugReportId, ApiRunMode.JENKINS_API_PLAN.name(), ReportTriggerMode.API.name());
|
||||
if (StringUtils.equalsAny(runMode, ApiRunMode.SCHEDULE_API_PLAN.name(), ApiRunMode.JENKINS_API_PLAN.name(), ApiRunMode.MANUAL_PLAN.name())) {
|
||||
apiDefinitionExecResultService.saveApiResultByScheduleTask(testResult, debugReportId, runMode);
|
||||
} else {
|
||||
apiDefinitionExecResultService.saveApiResult(testResult, ApiRunMode.API_PLAN.name(), TriggerMode.MANUAL.name());
|
||||
}
|
||||
|
@ -242,6 +243,7 @@ public class TestResultService {
|
|||
paramMap.put("executionEnvironment", report.getExecutionEnvironment());
|
||||
paramMap.put("principal", report.getPrincipal());
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(SessionUtils.getUserId())
|
||||
.successContext(successContext)
|
||||
.successMailTemplate("ApiSuccessfulNotification")
|
||||
.failedContext(failedContext)
|
||||
|
|
|
@ -33,7 +33,7 @@ public class ParallelScenarioExecTask<T> implements Callable<T> {
|
|||
}
|
||||
return null;
|
||||
} catch (Exception ex) {
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
MSException.throwException(ex.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ public class SerialScenarioExecTask<T> implements Callable<T> {
|
|||
}
|
||||
return (T) report;
|
||||
} catch (Exception ex) {
|
||||
LogUtil.error(ex.getMessage());
|
||||
LogUtil.error(ex);
|
||||
MSException.throwException(ex.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
package io.metersphere.api.tcp;
|
||||
|
||||
import io.metersphere.api.tcp.server.TCPServer;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author song.tianyang
|
||||
* @Date 2021/8/10 3:04 下午
|
||||
*/
|
||||
public class TCPPool {
|
||||
|
||||
private static HashMap<Integer, TCPServer> serverSockedMap = new HashMap<>();
|
||||
|
||||
private TCPPool(){}
|
||||
|
||||
public static String createTcp(int port){
|
||||
String returnString = "";
|
||||
if(port > 0){
|
||||
TCPServer tcpServer = null;
|
||||
if(serverSockedMap.containsKey(port)){
|
||||
tcpServer = serverSockedMap.get(port);
|
||||
}else {
|
||||
tcpServer = new TCPServer(port);
|
||||
serverSockedMap.put(port,tcpServer);
|
||||
}
|
||||
try {
|
||||
if(!tcpServer.isSocketOpen()){
|
||||
Thread t = new Thread(tcpServer);
|
||||
t.start();
|
||||
}
|
||||
returnString = "OK";
|
||||
}catch (Exception e){
|
||||
returnString = e.getMessage();
|
||||
e.printStackTrace();
|
||||
MSException.throwException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return returnString;
|
||||
}
|
||||
|
||||
public static boolean isTcpOpen(int port){
|
||||
TCPServer server = serverSockedMap.get(port);
|
||||
if(server != null ){
|
||||
return server.isSocketOpen();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getTcpStatus() {
|
||||
if(serverSockedMap.isEmpty()){
|
||||
return "null";
|
||||
}else {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (Map.Entry<Integer, TCPServer> entry:serverSockedMap.entrySet()) {
|
||||
int port = entry.getKey();
|
||||
TCPServer tcpServer = entry.getValue();
|
||||
if(tcpServer == null){
|
||||
stringBuffer.append("Port is "+port + ";");
|
||||
stringBuffer.append("Server is null;");
|
||||
}else {
|
||||
stringBuffer.append("Port is "+port + ";");
|
||||
stringBuffer.append("Server is open: "+ tcpServer.isSocketOpen()+";");
|
||||
}
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static String closeTcp(int portNum) {
|
||||
TCPServer server = serverSockedMap.get(portNum);
|
||||
if(server == null){
|
||||
return "Tcp Is not create!";
|
||||
}else {
|
||||
String returnMsg = null;
|
||||
try {
|
||||
server.closeSocket();
|
||||
returnMsg = "OK";
|
||||
}catch (Exception e){
|
||||
returnMsg = e.getMessage();
|
||||
e.printStackTrace();
|
||||
}
|
||||
return returnMsg;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package io.metersphere.api.tcp.server;
|
||||
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
|
||||
/**
|
||||
* @author song.tianyang
|
||||
* @Date 2021/8/11 10:35 上午
|
||||
*/
|
||||
public class TCPServer implements Runnable {
|
||||
private int port;
|
||||
private ServerSocket serverSocket;
|
||||
|
||||
private TCPServicer servicer;
|
||||
|
||||
public TCPServer(int port){
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public void openSocket() throws Exception {
|
||||
this.serverSocket = new ServerSocket(this.port);
|
||||
int connectIndex = 0;
|
||||
|
||||
while (true) {
|
||||
if (!this.serverSocket.isClosed()) {
|
||||
Socket socket = this.serverSocket.accept();
|
||||
servicer = new TCPServicer(socket,port);
|
||||
servicer.run();
|
||||
}
|
||||
if (this.serverSocket.isClosed()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSocketOpen(){
|
||||
if (this.serverSocket != null && !this.serverSocket.isClosed()) {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void closeSocket() throws Exception {
|
||||
if (this.serverSocket != null && !this.serverSocket.isClosed()) {
|
||||
if(servicer != null){
|
||||
servicer.close();
|
||||
}
|
||||
this.serverSocket.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
this.openSocket();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package io.metersphere.api.tcp.server;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.metersphere.api.service.MockConfigService;
|
||||
import io.metersphere.base.domain.MockExpectConfigWithBLOBs;
|
||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
|
||||
public class TCPServicer {
|
||||
private Socket s;
|
||||
private InputStream is;
|
||||
private OutputStream os;
|
||||
private int port;
|
||||
public TCPServicer(Socket s, int port) {
|
||||
this.s = s;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
byte[] b = new byte[1024];
|
||||
String returnMsg = "";
|
||||
String message = "";
|
||||
try {
|
||||
is = s.getInputStream();
|
||||
os = s.getOutputStream();
|
||||
int len = is.read(b);
|
||||
message = new String(b,0,len);
|
||||
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
returnMsg = this.getReturnMsg(message);
|
||||
|
||||
// try {
|
||||
os.write(returnMsg.getBytes());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
this.close();
|
||||
}
|
||||
|
||||
//关闭资源
|
||||
// this.close();
|
||||
}
|
||||
|
||||
private String getReturnMsg(String message) {
|
||||
MockConfigService mockConfigService = CommonBeanFactory.getBean(MockConfigService.class);
|
||||
MockExpectConfigWithBLOBs matchdMockExpect = mockConfigService.matchTcpMockExpect(message,this.port);
|
||||
String response = matchdMockExpect.getResponse();
|
||||
JSONObject responseObj = JSONObject.parseObject(response);
|
||||
try {
|
||||
int delayed = responseObj.getInteger("delayed");
|
||||
Thread.sleep(delayed);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String returnMsg = responseObj.getString("body");
|
||||
|
||||
return returnMsg;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
//关闭资源
|
||||
try{
|
||||
is.close();
|
||||
}catch (Exception e){}finally {
|
||||
try{
|
||||
os.close();
|
||||
}catch (Exception e){}finally {
|
||||
try{
|
||||
s.close();
|
||||
}catch (Exception e){}finally {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -51,5 +51,7 @@ public class ApiDefinition implements Serializable {
|
|||
|
||||
private String deleteUserId;
|
||||
|
||||
private String followPeople;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -1673,6 +1673,76 @@ public class ApiDefinitionExample {
|
|||
addCriterion("delete_user_id not between", value1, value2, "deleteUserId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNull() {
|
||||
addCriterion("follow_people is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNotNull() {
|
||||
addCriterion("follow_people is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleEqualTo(String value) {
|
||||
addCriterion("follow_people =", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotEqualTo(String value) {
|
||||
addCriterion("follow_people <>", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThan(String value) {
|
||||
addCriterion("follow_people >", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people >=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThan(String value) {
|
||||
addCriterion("follow_people <", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people <=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLike(String value) {
|
||||
addCriterion("follow_people like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotLike(String value) {
|
||||
addCriterion("follow_people not like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIn(List<String> values) {
|
||||
addCriterion("follow_people in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotIn(List<String> values) {
|
||||
addCriterion("follow_people not in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleBetween(String value1, String value2) {
|
||||
addCriterion("follow_people between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotBetween(String value1, String value2) {
|
||||
addCriterion("follow_people not between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -55,5 +55,7 @@ public class ApiScenario implements Serializable {
|
|||
|
||||
private String deleteUserId;
|
||||
|
||||
private Integer executeTimes;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -1793,6 +1793,66 @@ public class ApiScenarioExample {
|
|||
addCriterion("delete_user_id not between", value1, value2, "deleteUserId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesIsNull() {
|
||||
addCriterion("execute_times is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesIsNotNull() {
|
||||
addCriterion("execute_times is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesEqualTo(Integer value) {
|
||||
addCriterion("execute_times =", value, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesNotEqualTo(Integer value) {
|
||||
addCriterion("execute_times <>", value, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesGreaterThan(Integer value) {
|
||||
addCriterion("execute_times >", value, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("execute_times >=", value, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesLessThan(Integer value) {
|
||||
addCriterion("execute_times <", value, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("execute_times <=", value, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesIn(List<Integer> values) {
|
||||
addCriterion("execute_times in", values, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesNotIn(List<Integer> values) {
|
||||
addCriterion("execute_times not in", values, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesBetween(Integer value1, Integer value2) {
|
||||
addCriterion("execute_times between", value1, value2, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteTimesNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("execute_times not between", value1, value2, "executeTimes");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -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;
|
||||
|
@ -35,5 +36,7 @@ public class ApiScenarioReport implements Serializable {
|
|||
|
||||
private String testPlanScenarioId;
|
||||
|
||||
private Long endTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
@ -993,6 +993,66 @@ public class ApiScenarioReportExample {
|
|||
addCriterion("actuator not between", value1, value2, "actuator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeIsNull() {
|
||||
addCriterion("end_time is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeIsNotNull() {
|
||||
addCriterion("end_time is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeEqualTo(Long value) {
|
||||
addCriterion("end_time =", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeNotEqualTo(Long value) {
|
||||
addCriterion("end_time <>", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeGreaterThan(Long value) {
|
||||
addCriterion("end_time >", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("end_time >=", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeLessThan(Long value) {
|
||||
addCriterion("end_time <", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("end_time <=", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeIn(List<Long> values) {
|
||||
addCriterion("end_time in", values, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeNotIn(List<Long> values) {
|
||||
addCriterion("end_time not in", values, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeBetween(Long value1, Long value2) {
|
||||
addCriterion("end_time between", value1, value2, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEndTimeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("end_time not between", value1, value2, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -39,5 +39,7 @@ public class ApiTestCase implements Serializable {
|
|||
|
||||
private Integer version;
|
||||
|
||||
private String followPeople;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
|
@ -1243,6 +1243,76 @@ public class ApiTestCaseExample {
|
|||
addCriterion("version not between", value1, value2, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNull() {
|
||||
addCriterion("follow_people is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNotNull() {
|
||||
addCriterion("follow_people is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleEqualTo(String value) {
|
||||
addCriterion("follow_people =", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotEqualTo(String value) {
|
||||
addCriterion("follow_people <>", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThan(String value) {
|
||||
addCriterion("follow_people >", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people >=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThan(String value) {
|
||||
addCriterion("follow_people <", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people <=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLike(String value) {
|
||||
addCriterion("follow_people like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotLike(String value) {
|
||||
addCriterion("follow_people not like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIn(List<String> values) {
|
||||
addCriterion("follow_people in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotIn(List<String> values) {
|
||||
addCriterion("follow_people not in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleBetween(String value1, String value2) {
|
||||
addCriterion("follow_people between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotBetween(String value1, String value2) {
|
||||
addCriterion("follow_people not between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
@ -1337,4 +1407,4 @@ public class ApiTestCaseExample {
|
|||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,5 +31,7 @@ public class LoadTest implements Serializable {
|
|||
|
||||
private String scenarioId;
|
||||
|
||||
private String followPeople;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -973,6 +973,76 @@ public class LoadTestExample {
|
|||
addCriterion("scenario_id not between", value1, value2, "scenarioId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNull() {
|
||||
addCriterion("follow_people is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIsNotNull() {
|
||||
addCriterion("follow_people is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleEqualTo(String value) {
|
||||
addCriterion("follow_people =", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotEqualTo(String value) {
|
||||
addCriterion("follow_people <>", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThan(String value) {
|
||||
addCriterion("follow_people >", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people >=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThan(String value) {
|
||||
addCriterion("follow_people <", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLessThanOrEqualTo(String value) {
|
||||
addCriterion("follow_people <=", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleLike(String value) {
|
||||
addCriterion("follow_people like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotLike(String value) {
|
||||
addCriterion("follow_people not like", value, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleIn(List<String> values) {
|
||||
addCriterion("follow_people in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotIn(List<String> values) {
|
||||
addCriterion("follow_people not in", values, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleBetween(String value1, String value2) {
|
||||
addCriterion("follow_people between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFollowPeopleNotBetween(String value1, String value2) {
|
||||
addCriterion("follow_people not between", value1, value2, "followPeople");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Notification implements Serializable {
|
||||
private Long id;
|
||||
|
||||
private String type;
|
||||
|
||||
private String receiver;
|
||||
|
||||
private String title;
|
||||
|
||||
private String status;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private String operator;
|
||||
|
||||
private String operation;
|
||||
|
||||
private String resourceId;
|
||||
|
||||
private String resourceType;
|
||||
|
||||
private String resourceName;
|
||||
|
||||
private String content;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,950 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NotificationExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public NotificationExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Long value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Long value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Long value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Long value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Long> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNull() {
|
||||
addCriterion("`type` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNotNull() {
|
||||
addCriterion("`type` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeEqualTo(String value) {
|
||||
addCriterion("`type` =", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotEqualTo(String value) {
|
||||
addCriterion("`type` <>", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThan(String value) {
|
||||
addCriterion("`type` >", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`type` >=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThan(String value) {
|
||||
addCriterion("`type` <", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("`type` <=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLike(String value) {
|
||||
addCriterion("`type` like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotLike(String value) {
|
||||
addCriterion("`type` not like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIn(List<String> values) {
|
||||
addCriterion("`type` in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotIn(List<String> values) {
|
||||
addCriterion("`type` not in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeBetween(String value1, String value2) {
|
||||
addCriterion("`type` between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("`type` not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverIsNull() {
|
||||
addCriterion("receiver is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverIsNotNull() {
|
||||
addCriterion("receiver is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverEqualTo(String value) {
|
||||
addCriterion("receiver =", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverNotEqualTo(String value) {
|
||||
addCriterion("receiver <>", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverGreaterThan(String value) {
|
||||
addCriterion("receiver >", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("receiver >=", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverLessThan(String value) {
|
||||
addCriterion("receiver <", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverLessThanOrEqualTo(String value) {
|
||||
addCriterion("receiver <=", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverLike(String value) {
|
||||
addCriterion("receiver like", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverNotLike(String value) {
|
||||
addCriterion("receiver not like", value, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverIn(List<String> values) {
|
||||
addCriterion("receiver in", values, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverNotIn(List<String> values) {
|
||||
addCriterion("receiver not in", values, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverBetween(String value1, String value2) {
|
||||
addCriterion("receiver between", value1, value2, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReceiverNotBetween(String value1, String value2) {
|
||||
addCriterion("receiver not between", value1, value2, "receiver");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleIsNull() {
|
||||
addCriterion("title is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleIsNotNull() {
|
||||
addCriterion("title is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleEqualTo(String value) {
|
||||
addCriterion("title =", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotEqualTo(String value) {
|
||||
addCriterion("title <>", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleGreaterThan(String value) {
|
||||
addCriterion("title >", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("title >=", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleLessThan(String value) {
|
||||
addCriterion("title <", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleLessThanOrEqualTo(String value) {
|
||||
addCriterion("title <=", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleLike(String value) {
|
||||
addCriterion("title like", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotLike(String value) {
|
||||
addCriterion("title not like", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleIn(List<String> values) {
|
||||
addCriterion("title in", values, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotIn(List<String> values) {
|
||||
addCriterion("title not in", values, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleBetween(String value1, String value2) {
|
||||
addCriterion("title between", value1, value2, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotBetween(String value1, String value2) {
|
||||
addCriterion("title not between", value1, value2, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNull() {
|
||||
addCriterion("`status` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIsNotNull() {
|
||||
addCriterion("`status` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusEqualTo(String value) {
|
||||
addCriterion("`status` =", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotEqualTo(String value) {
|
||||
addCriterion("`status` <>", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusGreaterThan(String value) {
|
||||
addCriterion("`status` >", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`status` >=", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLessThan(String value) {
|
||||
addCriterion("`status` <", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLessThanOrEqualTo(String value) {
|
||||
addCriterion("`status` <=", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusLike(String value) {
|
||||
addCriterion("`status` like", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotLike(String value) {
|
||||
addCriterion("`status` not like", value, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusIn(List<String> values) {
|
||||
addCriterion("`status` in", values, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotIn(List<String> values) {
|
||||
addCriterion("`status` not in", values, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusBetween(String value1, String value2) {
|
||||
addCriterion("`status` between", value1, value2, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andStatusNotBetween(String value1, String value2) {
|
||||
addCriterion("`status` not between", value1, value2, "status");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNotNull() {
|
||||
addCriterion("create_time is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeEqualTo(Long value) {
|
||||
addCriterion("create_time =", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotEqualTo(Long value) {
|
||||
addCriterion("create_time <>", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThan(Long value) {
|
||||
addCriterion("create_time >", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("create_time >=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThan(Long value) {
|
||||
addCriterion("create_time <", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("create_time <=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIn(List<Long> values) {
|
||||
addCriterion("create_time in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotIn(List<Long> values) {
|
||||
addCriterion("create_time not in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeBetween(Long value1, Long value2) {
|
||||
addCriterion("create_time between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("create_time not between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorIsNull() {
|
||||
addCriterion("`operator` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorIsNotNull() {
|
||||
addCriterion("`operator` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorEqualTo(String value) {
|
||||
addCriterion("`operator` =", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorNotEqualTo(String value) {
|
||||
addCriterion("`operator` <>", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorGreaterThan(String value) {
|
||||
addCriterion("`operator` >", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`operator` >=", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorLessThan(String value) {
|
||||
addCriterion("`operator` <", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorLessThanOrEqualTo(String value) {
|
||||
addCriterion("`operator` <=", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorLike(String value) {
|
||||
addCriterion("`operator` like", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorNotLike(String value) {
|
||||
addCriterion("`operator` not like", value, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorIn(List<String> values) {
|
||||
addCriterion("`operator` in", values, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorNotIn(List<String> values) {
|
||||
addCriterion("`operator` not in", values, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorBetween(String value1, String value2) {
|
||||
addCriterion("`operator` between", value1, value2, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperatorNotBetween(String value1, String value2) {
|
||||
addCriterion("`operator` not between", value1, value2, "operator");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationIsNull() {
|
||||
addCriterion("`operation` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationIsNotNull() {
|
||||
addCriterion("`operation` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationEqualTo(String value) {
|
||||
addCriterion("`operation` =", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationNotEqualTo(String value) {
|
||||
addCriterion("`operation` <>", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationGreaterThan(String value) {
|
||||
addCriterion("`operation` >", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`operation` >=", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationLessThan(String value) {
|
||||
addCriterion("`operation` <", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationLessThanOrEqualTo(String value) {
|
||||
addCriterion("`operation` <=", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationLike(String value) {
|
||||
addCriterion("`operation` like", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationNotLike(String value) {
|
||||
addCriterion("`operation` not like", value, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationIn(List<String> values) {
|
||||
addCriterion("`operation` in", values, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationNotIn(List<String> values) {
|
||||
addCriterion("`operation` not in", values, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationBetween(String value1, String value2) {
|
||||
addCriterion("`operation` between", value1, value2, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOperationNotBetween(String value1, String value2) {
|
||||
addCriterion("`operation` not between", value1, value2, "operation");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNull() {
|
||||
addCriterion("resource_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNotNull() {
|
||||
addCriterion("resource_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdEqualTo(String value) {
|
||||
addCriterion("resource_id =", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotEqualTo(String value) {
|
||||
addCriterion("resource_id <>", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThan(String value) {
|
||||
addCriterion("resource_id >", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id >=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThan(String value) {
|
||||
addCriterion("resource_id <", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id <=", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLike(String value) {
|
||||
addCriterion("resource_id like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotLike(String value) {
|
||||
addCriterion("resource_id not like", value, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIn(List<String> values) {
|
||||
addCriterion("resource_id in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotIn(List<String> values) {
|
||||
addCriterion("resource_id not in", values, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdBetween(String value1, String value2) {
|
||||
addCriterion("resource_id between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_id not between", value1, value2, "resourceId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIsNull() {
|
||||
addCriterion("resource_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIsNotNull() {
|
||||
addCriterion("resource_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeEqualTo(String value) {
|
||||
addCriterion("resource_type =", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotEqualTo(String value) {
|
||||
addCriterion("resource_type <>", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeGreaterThan(String value) {
|
||||
addCriterion("resource_type >", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_type >=", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLessThan(String value) {
|
||||
addCriterion("resource_type <", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_type <=", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLike(String value) {
|
||||
addCriterion("resource_type like", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotLike(String value) {
|
||||
addCriterion("resource_type not like", value, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIn(List<String> values) {
|
||||
addCriterion("resource_type in", values, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotIn(List<String> values) {
|
||||
addCriterion("resource_type not in", values, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeBetween(String value1, String value2) {
|
||||
addCriterion("resource_type between", value1, value2, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_type not between", value1, value2, "resourceType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameIsNull() {
|
||||
addCriterion("resource_name is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameIsNotNull() {
|
||||
addCriterion("resource_name is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameEqualTo(String value) {
|
||||
addCriterion("resource_name =", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameNotEqualTo(String value) {
|
||||
addCriterion("resource_name <>", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameGreaterThan(String value) {
|
||||
addCriterion("resource_name >", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_name >=", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameLessThan(String value) {
|
||||
addCriterion("resource_name <", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_name <=", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameLike(String value) {
|
||||
addCriterion("resource_name like", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameNotLike(String value) {
|
||||
addCriterion("resource_name not like", value, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameIn(List<String> values) {
|
||||
addCriterion("resource_name in", values, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameNotIn(List<String> values) {
|
||||
addCriterion("resource_name not in", values, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameBetween(String value1, String value2) {
|
||||
addCriterion("resource_name between", value1, value2, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceNameNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_name not between", value1, value2, "resourceName");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -39,5 +39,9 @@ public class Project implements Serializable {
|
|||
|
||||
private String systemId;
|
||||
|
||||
private Integer mockTcpPort;
|
||||
|
||||
private Boolean isMockTcpOpen;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -1243,6 +1243,126 @@ public class ProjectExample {
|
|||
addCriterion("system_id not between", value1, value2, "systemId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortIsNull() {
|
||||
addCriterion("mock_tcp_port is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortIsNotNull() {
|
||||
addCriterion("mock_tcp_port is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortEqualTo(Integer value) {
|
||||
addCriterion("mock_tcp_port =", value, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortNotEqualTo(Integer value) {
|
||||
addCriterion("mock_tcp_port <>", value, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortGreaterThan(Integer value) {
|
||||
addCriterion("mock_tcp_port >", value, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("mock_tcp_port >=", value, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortLessThan(Integer value) {
|
||||
addCriterion("mock_tcp_port <", value, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("mock_tcp_port <=", value, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortIn(List<Integer> values) {
|
||||
addCriterion("mock_tcp_port in", values, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortNotIn(List<Integer> values) {
|
||||
addCriterion("mock_tcp_port not in", values, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortBetween(Integer value1, Integer value2) {
|
||||
addCriterion("mock_tcp_port between", value1, value2, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMockTcpPortNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("mock_tcp_port not between", value1, value2, "mockTcpPort");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenIsNull() {
|
||||
addCriterion("is_mock_tcp_open is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenIsNotNull() {
|
||||
addCriterion("is_mock_tcp_open is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenEqualTo(Boolean value) {
|
||||
addCriterion("is_mock_tcp_open =", value, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenNotEqualTo(Boolean value) {
|
||||
addCriterion("is_mock_tcp_open <>", value, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenGreaterThan(Boolean value) {
|
||||
addCriterion("is_mock_tcp_open >", value, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_mock_tcp_open >=", value, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenLessThan(Boolean value) {
|
||||
addCriterion("is_mock_tcp_open <", value, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_mock_tcp_open <=", value, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenIn(List<Boolean> values) {
|
||||
addCriterion("is_mock_tcp_open in", values, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenNotIn(List<Boolean> values) {
|
||||
addCriterion("is_mock_tcp_open not in", values, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_mock_tcp_open between", value1, value2, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsMockTcpOpenNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_mock_tcp_open not between", value1, value2, "isMockTcpOpen");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.io.Serializable;
|
|||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiDocumentShare implements Serializable {
|
||||
public class ShareInfo implements Serializable {
|
||||
private String id;
|
||||
|
||||
private Long createTime;
|
||||
|
@ -15,7 +15,7 @@ public class ApiDocumentShare implements Serializable {
|
|||
|
||||
private String shareType;
|
||||
|
||||
private String shareApiId;
|
||||
private String customData;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -3,14 +3,14 @@ package io.metersphere.base.domain;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ApiDocumentShareExample {
|
||||
public class ShareInfoExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public ApiDocumentShareExample() {
|
||||
public ShareInfoExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
|
@ -45,7 +45,5 @@ public class TestPlan implements Serializable {
|
|||
|
||||
private Boolean automaticStatusUpdate;
|
||||
|
||||
private String tags;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -35,5 +35,7 @@ public class TestPlanReport implements Serializable {
|
|||
|
||||
private String components;
|
||||
|
||||
private Boolean isNew;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TestPlanReportContent implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String testPlanReportId;
|
||||
|
||||
private Long startTime;
|
||||
|
||||
private Long caseCount;
|
||||
|
||||
private Long endTime;
|
||||
|
||||
private Double executeRate;
|
||||
|
||||
private Double passRate;
|
||||
|
||||
private Boolean isThirdPartIssue;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -3,14 +3,14 @@ package io.metersphere.base.domain;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestPlanReportResourceExample {
|
||||
public class TestPlanReportContentExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public TestPlanReportResourceExample() {
|
||||
public TestPlanReportContentExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
|
@ -244,213 +244,363 @@ public class TestPlanReportResourceExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNull() {
|
||||
addCriterion("resource_id is null");
|
||||
public Criteria andStartTimeIsNull() {
|
||||
addCriterion("start_time is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIsNotNull() {
|
||||
addCriterion("resource_id is not null");
|
||||
public Criteria andStartTimeIsNotNull() {
|
||||
addCriterion("start_time is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdEqualTo(String value) {
|
||||
addCriterion("resource_id =", value, "resourceId");
|
||||
public Criteria andStartTimeEqualTo(Long value) {
|
||||
addCriterion("start_time =", value, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotEqualTo(String value) {
|
||||
addCriterion("resource_id <>", value, "resourceId");
|
||||
public Criteria andStartTimeNotEqualTo(Long value) {
|
||||
addCriterion("start_time <>", value, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThan(String value) {
|
||||
addCriterion("resource_id >", value, "resourceId");
|
||||
public Criteria andStartTimeGreaterThan(Long value) {
|
||||
addCriterion("start_time >", value, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id >=", value, "resourceId");
|
||||
public Criteria andStartTimeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("start_time >=", value, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThan(String value) {
|
||||
addCriterion("resource_id <", value, "resourceId");
|
||||
public Criteria andStartTimeLessThan(Long value) {
|
||||
addCriterion("start_time <", value, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_id <=", value, "resourceId");
|
||||
public Criteria andStartTimeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("start_time <=", value, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdLike(String value) {
|
||||
addCriterion("resource_id like", value, "resourceId");
|
||||
public Criteria andStartTimeIn(List<Long> values) {
|
||||
addCriterion("start_time in", values, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotLike(String value) {
|
||||
addCriterion("resource_id not like", value, "resourceId");
|
||||
public Criteria andStartTimeNotIn(List<Long> values) {
|
||||
addCriterion("start_time not in", values, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdIn(List<String> values) {
|
||||
addCriterion("resource_id in", values, "resourceId");
|
||||
public Criteria andStartTimeBetween(Long value1, Long value2) {
|
||||
addCriterion("start_time between", value1, value2, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotIn(List<String> values) {
|
||||
addCriterion("resource_id not in", values, "resourceId");
|
||||
public Criteria andStartTimeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("start_time not between", value1, value2, "startTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdBetween(String value1, String value2) {
|
||||
addCriterion("resource_id between", value1, value2, "resourceId");
|
||||
public Criteria andCaseCountIsNull() {
|
||||
addCriterion("case_count is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceIdNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_id not between", value1, value2, "resourceId");
|
||||
public Criteria andCaseCountIsNotNull() {
|
||||
addCriterion("case_count is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIsNull() {
|
||||
addCriterion("resource_type is null");
|
||||
public Criteria andCaseCountEqualTo(Long value) {
|
||||
addCriterion("case_count =", value, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIsNotNull() {
|
||||
addCriterion("resource_type is not null");
|
||||
public Criteria andCaseCountNotEqualTo(Long value) {
|
||||
addCriterion("case_count <>", value, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeEqualTo(String value) {
|
||||
addCriterion("resource_type =", value, "resourceType");
|
||||
public Criteria andCaseCountGreaterThan(Long value) {
|
||||
addCriterion("case_count >", value, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotEqualTo(String value) {
|
||||
addCriterion("resource_type <>", value, "resourceType");
|
||||
public Criteria andCaseCountGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("case_count >=", value, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeGreaterThan(String value) {
|
||||
addCriterion("resource_type >", value, "resourceType");
|
||||
public Criteria andCaseCountLessThan(Long value) {
|
||||
addCriterion("case_count <", value, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("resource_type >=", value, "resourceType");
|
||||
public Criteria andCaseCountLessThanOrEqualTo(Long value) {
|
||||
addCriterion("case_count <=", value, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLessThan(String value) {
|
||||
addCriterion("resource_type <", value, "resourceType");
|
||||
public Criteria andCaseCountIn(List<Long> values) {
|
||||
addCriterion("case_count in", values, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("resource_type <=", value, "resourceType");
|
||||
public Criteria andCaseCountNotIn(List<Long> values) {
|
||||
addCriterion("case_count not in", values, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeLike(String value) {
|
||||
addCriterion("resource_type like", value, "resourceType");
|
||||
public Criteria andCaseCountBetween(Long value1, Long value2) {
|
||||
addCriterion("case_count between", value1, value2, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotLike(String value) {
|
||||
addCriterion("resource_type not like", value, "resourceType");
|
||||
public Criteria andCaseCountNotBetween(Long value1, Long value2) {
|
||||
addCriterion("case_count not between", value1, value2, "caseCount");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeIn(List<String> values) {
|
||||
addCriterion("resource_type in", values, "resourceType");
|
||||
public Criteria andEndTimeIsNull() {
|
||||
addCriterion("end_time is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotIn(List<String> values) {
|
||||
addCriterion("resource_type not in", values, "resourceType");
|
||||
public Criteria andEndTimeIsNotNull() {
|
||||
addCriterion("end_time is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeBetween(String value1, String value2) {
|
||||
addCriterion("resource_type between", value1, value2, "resourceType");
|
||||
public Criteria andEndTimeEqualTo(Long value) {
|
||||
addCriterion("end_time =", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andResourceTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("resource_type not between", value1, value2, "resourceType");
|
||||
public Criteria andEndTimeNotEqualTo(Long value) {
|
||||
addCriterion("end_time <>", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultIsNull() {
|
||||
addCriterion("execute_result is null");
|
||||
public Criteria andEndTimeGreaterThan(Long value) {
|
||||
addCriterion("end_time >", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultIsNotNull() {
|
||||
addCriterion("execute_result is not null");
|
||||
public Criteria andEndTimeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("end_time >=", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultEqualTo(String value) {
|
||||
addCriterion("execute_result =", value, "executeResult");
|
||||
public Criteria andEndTimeLessThan(Long value) {
|
||||
addCriterion("end_time <", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultNotEqualTo(String value) {
|
||||
addCriterion("execute_result <>", value, "executeResult");
|
||||
public Criteria andEndTimeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("end_time <=", value, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultGreaterThan(String value) {
|
||||
addCriterion("execute_result >", value, "executeResult");
|
||||
public Criteria andEndTimeIn(List<Long> values) {
|
||||
addCriterion("end_time in", values, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("execute_result >=", value, "executeResult");
|
||||
public Criteria andEndTimeNotIn(List<Long> values) {
|
||||
addCriterion("end_time not in", values, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultLessThan(String value) {
|
||||
addCriterion("execute_result <", value, "executeResult");
|
||||
public Criteria andEndTimeBetween(Long value1, Long value2) {
|
||||
addCriterion("end_time between", value1, value2, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultLessThanOrEqualTo(String value) {
|
||||
addCriterion("execute_result <=", value, "executeResult");
|
||||
public Criteria andEndTimeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("end_time not between", value1, value2, "endTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultLike(String value) {
|
||||
addCriterion("execute_result like", value, "executeResult");
|
||||
public Criteria andExecuteRateIsNull() {
|
||||
addCriterion("execute_rate is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultNotLike(String value) {
|
||||
addCriterion("execute_result not like", value, "executeResult");
|
||||
public Criteria andExecuteRateIsNotNull() {
|
||||
addCriterion("execute_rate is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultIn(List<String> values) {
|
||||
addCriterion("execute_result in", values, "executeResult");
|
||||
public Criteria andExecuteRateEqualTo(Double value) {
|
||||
addCriterion("execute_rate =", value, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultNotIn(List<String> values) {
|
||||
addCriterion("execute_result not in", values, "executeResult");
|
||||
public Criteria andExecuteRateNotEqualTo(Double value) {
|
||||
addCriterion("execute_rate <>", value, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultBetween(String value1, String value2) {
|
||||
addCriterion("execute_result between", value1, value2, "executeResult");
|
||||
public Criteria andExecuteRateGreaterThan(Double value) {
|
||||
addCriterion("execute_rate >", value, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteResultNotBetween(String value1, String value2) {
|
||||
addCriterion("execute_result not between", value1, value2, "executeResult");
|
||||
public Criteria andExecuteRateGreaterThanOrEqualTo(Double value) {
|
||||
addCriterion("execute_rate >=", value, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteRateLessThan(Double value) {
|
||||
addCriterion("execute_rate <", value, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteRateLessThanOrEqualTo(Double value) {
|
||||
addCriterion("execute_rate <=", value, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteRateIn(List<Double> values) {
|
||||
addCriterion("execute_rate in", values, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteRateNotIn(List<Double> values) {
|
||||
addCriterion("execute_rate not in", values, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteRateBetween(Double value1, Double value2) {
|
||||
addCriterion("execute_rate between", value1, value2, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecuteRateNotBetween(Double value1, Double value2) {
|
||||
addCriterion("execute_rate not between", value1, value2, "executeRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateIsNull() {
|
||||
addCriterion("pass_rate is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateIsNotNull() {
|
||||
addCriterion("pass_rate is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateEqualTo(Double value) {
|
||||
addCriterion("pass_rate =", value, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateNotEqualTo(Double value) {
|
||||
addCriterion("pass_rate <>", value, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateGreaterThan(Double value) {
|
||||
addCriterion("pass_rate >", value, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateGreaterThanOrEqualTo(Double value) {
|
||||
addCriterion("pass_rate >=", value, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateLessThan(Double value) {
|
||||
addCriterion("pass_rate <", value, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateLessThanOrEqualTo(Double value) {
|
||||
addCriterion("pass_rate <=", value, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateIn(List<Double> values) {
|
||||
addCriterion("pass_rate in", values, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateNotIn(List<Double> values) {
|
||||
addCriterion("pass_rate not in", values, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateBetween(Double value1, Double value2) {
|
||||
addCriterion("pass_rate between", value1, value2, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPassRateNotBetween(Double value1, Double value2) {
|
||||
addCriterion("pass_rate not between", value1, value2, "passRate");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueIsNull() {
|
||||
addCriterion("is_third_part_issue is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueIsNotNull() {
|
||||
addCriterion("is_third_part_issue is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueEqualTo(Boolean value) {
|
||||
addCriterion("is_third_part_issue =", value, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueNotEqualTo(Boolean value) {
|
||||
addCriterion("is_third_part_issue <>", value, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueGreaterThan(Boolean value) {
|
||||
addCriterion("is_third_part_issue >", value, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_third_part_issue >=", value, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueLessThan(Boolean value) {
|
||||
addCriterion("is_third_part_issue <", value, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_third_part_issue <=", value, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueIn(List<Boolean> values) {
|
||||
addCriterion("is_third_part_issue in", values, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueNotIn(List<Boolean> values) {
|
||||
addCriterion("is_third_part_issue not in", values, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_third_part_issue between", value1, value2, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsThirdPartIssueNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_third_part_issue not between", value1, value2, "isThirdPartIssue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
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 TestPlanReportContentWithBLOBs extends TestPlanReportContent implements Serializable {
|
||||
private String config;
|
||||
|
||||
private String summary;
|
||||
|
||||
private String functionResult;
|
||||
|
||||
private String apiResult;
|
||||
|
||||
private String loadResult;
|
||||
|
||||
private String functionAllCases;
|
||||
|
||||
private String functionFailureCases;
|
||||
|
||||
private String issueList;
|
||||
|
||||
private String apiAllCases;
|
||||
|
||||
private String apiFailureCases;
|
||||
|
||||
private String scenarioAllCases;
|
||||
|
||||
private String scenarioFailureCases;
|
||||
|
||||
private String loadAllCases;
|
||||
|
||||
private String loadFailureCases;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -774,52 +774,52 @@ public class TestPlanReportExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingEqualTo(Byte value) {
|
||||
public Criteria andIsApiCaseExecutingEqualTo(Boolean value) {
|
||||
addCriterion("is_api_case_executing =", value, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingNotEqualTo(Byte value) {
|
||||
public Criteria andIsApiCaseExecutingNotEqualTo(Boolean value) {
|
||||
addCriterion("is_api_case_executing <>", value, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingGreaterThan(Byte value) {
|
||||
public Criteria andIsApiCaseExecutingGreaterThan(Boolean value) {
|
||||
addCriterion("is_api_case_executing >", value, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingGreaterThanOrEqualTo(Byte value) {
|
||||
public Criteria andIsApiCaseExecutingGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_api_case_executing >=", value, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingLessThan(Byte value) {
|
||||
public Criteria andIsApiCaseExecutingLessThan(Boolean value) {
|
||||
addCriterion("is_api_case_executing <", value, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingLessThanOrEqualTo(Byte value) {
|
||||
public Criteria andIsApiCaseExecutingLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_api_case_executing <=", value, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingIn(List<Byte> values) {
|
||||
public Criteria andIsApiCaseExecutingIn(List<Boolean> values) {
|
||||
addCriterion("is_api_case_executing in", values, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingNotIn(List<Byte> values) {
|
||||
public Criteria andIsApiCaseExecutingNotIn(List<Boolean> values) {
|
||||
addCriterion("is_api_case_executing not in", values, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingBetween(Byte value1, Byte value2) {
|
||||
public Criteria andIsApiCaseExecutingBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_api_case_executing between", value1, value2, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsApiCaseExecutingNotBetween(Byte value1, Byte value2) {
|
||||
public Criteria andIsApiCaseExecutingNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_api_case_executing not between", value1, value2, "isApiCaseExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
@ -834,52 +834,52 @@ public class TestPlanReportExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingEqualTo(Byte value) {
|
||||
public Criteria andIsScenarioExecutingEqualTo(Boolean value) {
|
||||
addCriterion("is_scenario_executing =", value, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingNotEqualTo(Byte value) {
|
||||
public Criteria andIsScenarioExecutingNotEqualTo(Boolean value) {
|
||||
addCriterion("is_scenario_executing <>", value, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingGreaterThan(Byte value) {
|
||||
public Criteria andIsScenarioExecutingGreaterThan(Boolean value) {
|
||||
addCriterion("is_scenario_executing >", value, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingGreaterThanOrEqualTo(Byte value) {
|
||||
public Criteria andIsScenarioExecutingGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_scenario_executing >=", value, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingLessThan(Byte value) {
|
||||
public Criteria andIsScenarioExecutingLessThan(Boolean value) {
|
||||
addCriterion("is_scenario_executing <", value, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingLessThanOrEqualTo(Byte value) {
|
||||
public Criteria andIsScenarioExecutingLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_scenario_executing <=", value, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingIn(List<Byte> values) {
|
||||
public Criteria andIsScenarioExecutingIn(List<Boolean> values) {
|
||||
addCriterion("is_scenario_executing in", values, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingNotIn(List<Byte> values) {
|
||||
public Criteria andIsScenarioExecutingNotIn(List<Boolean> values) {
|
||||
addCriterion("is_scenario_executing not in", values, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingBetween(Byte value1, Byte value2) {
|
||||
public Criteria andIsScenarioExecutingBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_scenario_executing between", value1, value2, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsScenarioExecutingNotBetween(Byte value1, Byte value2) {
|
||||
public Criteria andIsScenarioExecutingNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_scenario_executing not between", value1, value2, "isScenarioExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
@ -894,52 +894,52 @@ public class TestPlanReportExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingEqualTo(Byte value) {
|
||||
public Criteria andIsPerformanceExecutingEqualTo(Boolean value) {
|
||||
addCriterion("is_performance_executing =", value, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingNotEqualTo(Byte value) {
|
||||
public Criteria andIsPerformanceExecutingNotEqualTo(Boolean value) {
|
||||
addCriterion("is_performance_executing <>", value, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingGreaterThan(Byte value) {
|
||||
public Criteria andIsPerformanceExecutingGreaterThan(Boolean value) {
|
||||
addCriterion("is_performance_executing >", value, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingGreaterThanOrEqualTo(Byte value) {
|
||||
public Criteria andIsPerformanceExecutingGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_performance_executing >=", value, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingLessThan(Byte value) {
|
||||
public Criteria andIsPerformanceExecutingLessThan(Boolean value) {
|
||||
addCriterion("is_performance_executing <", value, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingLessThanOrEqualTo(Byte value) {
|
||||
public Criteria andIsPerformanceExecutingLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_performance_executing <=", value, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingIn(List<Byte> values) {
|
||||
public Criteria andIsPerformanceExecutingIn(List<Boolean> values) {
|
||||
addCriterion("is_performance_executing in", values, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingNotIn(List<Byte> values) {
|
||||
public Criteria andIsPerformanceExecutingNotIn(List<Boolean> values) {
|
||||
addCriterion("is_performance_executing not in", values, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingBetween(Byte value1, Byte value2) {
|
||||
public Criteria andIsPerformanceExecutingBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_performance_executing between", value1, value2, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsPerformanceExecutingNotBetween(Byte value1, Byte value2) {
|
||||
public Criteria andIsPerformanceExecutingNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_performance_executing not between", value1, value2, "isPerformanceExecuting");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
@ -1083,6 +1083,66 @@ public class TestPlanReportExample {
|
|||
addCriterion("components not between", value1, value2, "components");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewIsNull() {
|
||||
addCriterion("is_new is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewIsNotNull() {
|
||||
addCriterion("is_new is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewEqualTo(Boolean value) {
|
||||
addCriterion("is_new =", value, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewNotEqualTo(Boolean value) {
|
||||
addCriterion("is_new <>", value, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewGreaterThan(Boolean value) {
|
||||
addCriterion("is_new >", value, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewGreaterThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_new >=", value, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewLessThan(Boolean value) {
|
||||
addCriterion("is_new <", value, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewLessThanOrEqualTo(Boolean value) {
|
||||
addCriterion("is_new <=", value, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewIn(List<Boolean> values) {
|
||||
addCriterion("is_new in", values, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewNotIn(List<Boolean> values) {
|
||||
addCriterion("is_new not in", values, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_new between", value1, value2, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIsNewNotBetween(Boolean value1, Boolean value2) {
|
||||
addCriterion("is_new not between", value1, value2, "isNew");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TestPlanReportResource implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String testPlanReportId;
|
||||
|
||||
private String resourceId;
|
||||
|
||||
private String resourceType;
|
||||
|
||||
private String executeResult;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
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 TestPlanWithBLOBs extends TestPlan implements Serializable {
|
||||
private String tags;
|
||||
|
||||
private String reportSummary;
|
||||
|
||||
private String reportConfig;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
<result column="case_passing_rate" jdbcType="VARCHAR" property="casePassingRate" />
|
||||
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
|
||||
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
|
||||
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
|
@ -92,7 +93,8 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, `method`, module_path, environment_id, schedule, `status`,
|
||||
module_id, user_id, create_time, update_time, protocol, `path`, num, tags, original_state,
|
||||
create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id
|
||||
create_user, case_total, case_status, case_passing_rate, delete_time, delete_user_id,
|
||||
follow_people
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description, request, response
|
||||
|
@ -153,8 +155,9 @@
|
|||
protocol, `path`, num,
|
||||
tags, original_state, create_user,
|
||||
case_total, case_status, case_passing_rate,
|
||||
delete_time, delete_user_id, description,
|
||||
request, response)
|
||||
delete_time, delete_user_id, follow_people,
|
||||
description, request, response
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{method,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
|
||||
#{schedule,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{moduleId,jdbcType=VARCHAR},
|
||||
|
@ -162,8 +165,9 @@
|
|||
#{protocol,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER},
|
||||
#{tags,jdbcType=VARCHAR}, #{originalState,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
|
||||
#{caseTotal,jdbcType=VARCHAR}, #{caseStatus,jdbcType=VARCHAR}, #{casePassingRate,jdbcType=VARCHAR},
|
||||
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
||||
#{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR})
|
||||
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR}, #{response,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiDefinitionWithBLOBs">
|
||||
insert into api_definition
|
||||
|
@ -237,6 +241,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
delete_user_id,
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
|
@ -317,6 +324,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
#{deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
#{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -406,6 +416,9 @@
|
|||
<if test="record.deleteUserId != null">
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.followPeople != null">
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -445,6 +458,7 @@
|
|||
case_passing_rate = #{record.casePassingRate,jdbcType=VARCHAR},
|
||||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
request = #{record.request,jdbcType=LONGVARCHAR},
|
||||
response = #{record.response,jdbcType=LONGVARCHAR}
|
||||
|
@ -476,7 +490,8 @@
|
|||
case_status = #{record.caseStatus,jdbcType=VARCHAR},
|
||||
case_passing_rate = #{record.casePassingRate,jdbcType=VARCHAR},
|
||||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -550,6 +565,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -586,6 +604,7 @@
|
|||
case_passing_rate = #{casePassingRate,jdbcType=VARCHAR},
|
||||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
request = #{request,jdbcType=LONGVARCHAR},
|
||||
response = #{response,jdbcType=LONGVARCHAR}
|
||||
|
@ -614,7 +633,8 @@
|
|||
case_status = #{caseStatus,jdbcType=VARCHAR},
|
||||
case_passing_rate = #{casePassingRate,jdbcType=VARCHAR},
|
||||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -1,36 +0,0 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.ApiDocumentShare;
|
||||
import io.metersphere.base.domain.ApiDocumentShareExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ApiDocumentShareMapper {
|
||||
long countByExample(ApiDocumentShareExample example);
|
||||
|
||||
int deleteByExample(ApiDocumentShareExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(ApiDocumentShare record);
|
||||
|
||||
int insertSelective(ApiDocumentShare record);
|
||||
|
||||
List<ApiDocumentShare> selectByExampleWithBLOBs(ApiDocumentShareExample example);
|
||||
|
||||
List<ApiDocumentShare> selectByExample(ApiDocumentShareExample example);
|
||||
|
||||
ApiDocumentShare selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") ApiDocumentShare record, @Param("example") ApiDocumentShareExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") ApiDocumentShare record, @Param("example") ApiDocumentShareExample example);
|
||||
|
||||
int updateByExample(@Param("record") ApiDocumentShare record, @Param("example") ApiDocumentShareExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(ApiDocumentShare record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(ApiDocumentShare record);
|
||||
|
||||
int updateByPrimaryKey(ApiDocumentShare record);
|
||||
}
|
|
@ -27,6 +27,7 @@
|
|||
<result column="version" jdbcType="INTEGER" property="version" />
|
||||
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
|
||||
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
|
||||
<result column="execute_times" jdbcType="INTEGER" property="executeTimes" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
<result column="scenario_definition" jdbcType="LONGVARCHAR" property="scenarioDefinition" />
|
||||
|
@ -95,7 +96,7 @@
|
|||
id, project_id, tags, user_id, api_scenario_module_id, module_path, `name`, `level`,
|
||||
`status`, principal, step_total, follow_people, schedule, create_time, update_time,
|
||||
pass_rate, last_result, report_id, num, original_state, custom_num, create_user,
|
||||
version, delete_time, delete_user_id
|
||||
version, delete_time, delete_user_id, execute_times
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
scenario_definition, description, use_url
|
||||
|
@ -157,8 +158,8 @@
|
|||
pass_rate, last_result, report_id,
|
||||
num, original_state, custom_num,
|
||||
create_user, version, delete_time,
|
||||
delete_user_id, scenario_definition, description,
|
||||
use_url)
|
||||
delete_user_id, execute_times, scenario_definition,
|
||||
description, use_url)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{apiScenarioModuleId,jdbcType=VARCHAR}, #{modulePath,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{level,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
|
@ -167,8 +168,8 @@
|
|||
#{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||
#{num,jdbcType=INTEGER}, #{originalState,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR},
|
||||
#{createUser,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{deleteTime,jdbcType=BIGINT},
|
||||
#{deleteUserId,jdbcType=VARCHAR}, #{scenarioDefinition,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR},
|
||||
#{useUrl,jdbcType=LONGVARCHAR})
|
||||
#{deleteUserId,jdbcType=VARCHAR}, #{executeTimes,jdbcType=INTEGER}, #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
#{description,jdbcType=LONGVARCHAR}, #{useUrl,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenarioWithBLOBs">
|
||||
insert into api_scenario
|
||||
|
@ -248,6 +249,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
delete_user_id,
|
||||
</if>
|
||||
<if test="executeTimes != null">
|
||||
execute_times,
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
scenario_definition,
|
||||
</if>
|
||||
|
@ -334,6 +338,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
#{deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executeTimes != null">
|
||||
#{executeTimes,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
#{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -429,6 +436,9 @@
|
|||
<if test="record.deleteUserId != null">
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.executeTimes != null">
|
||||
execute_times = #{record.executeTimes,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.scenarioDefinition != null">
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -470,6 +480,7 @@
|
|||
version = #{record.version,jdbcType=INTEGER},
|
||||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
execute_times = #{record.executeTimes,jdbcType=INTEGER},
|
||||
scenario_definition = #{record.scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
use_url = #{record.useUrl,jdbcType=LONGVARCHAR}
|
||||
|
@ -503,7 +514,8 @@
|
|||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
version = #{record.version,jdbcType=INTEGER},
|
||||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
execute_times = #{record.executeTimes,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -583,6 +595,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executeTimes != null">
|
||||
execute_times = #{executeTimes,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="scenarioDefinition != null">
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -621,6 +636,7 @@
|
|||
version = #{version,jdbcType=INTEGER},
|
||||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
execute_times = #{executeTimes,jdbcType=INTEGER},
|
||||
scenario_definition = #{scenarioDefinition,jdbcType=LONGVARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
use_url = #{useUrl,jdbcType=LONGVARCHAR}
|
||||
|
@ -651,7 +667,8 @@
|
|||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
version = #{version,jdbcType=INTEGER},
|
||||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
execute_times = #{executeTimes,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -15,6 +15,7 @@
|
|||
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
|
||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||
<result column="actuator" jdbcType="VARCHAR" property="actuator" />
|
||||
<result column="end_time" jdbcType="BIGINT" property="endTime" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiScenarioReport">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
|
@ -79,7 +80,7 @@
|
|||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, create_time, update_time, `status`, user_id, trigger_mode,
|
||||
execute_type, scenario_name, scenario_id, create_user, actuator
|
||||
execute_type, scenario_name, scenario_id, create_user, actuator, end_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description
|
||||
|
@ -137,12 +138,14 @@
|
|||
create_time, update_time, `status`,
|
||||
user_id, trigger_mode, execute_type,
|
||||
scenario_name, scenario_id, create_user,
|
||||
actuator, description)
|
||||
actuator, end_time, description
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
|
||||
#{userId,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{executeType,jdbcType=VARCHAR},
|
||||
#{scenarioName,jdbcType=VARCHAR}, #{scenarioId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
|
||||
#{actuator,jdbcType=VARCHAR}, #{description,jdbcType=LONGVARCHAR})
|
||||
#{actuator,jdbcType=VARCHAR}, #{endTime,jdbcType=BIGINT}, #{description,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiScenarioReport">
|
||||
insert into api_scenario_report
|
||||
|
@ -186,6 +189,9 @@
|
|||
<if test="actuator != null">
|
||||
actuator,
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
|
@ -230,6 +236,9 @@
|
|||
<if test="actuator != null">
|
||||
#{actuator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
#{endTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -283,6 +292,9 @@
|
|||
<if test="record.actuator != null">
|
||||
actuator = #{record.actuator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.endTime != null">
|
||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -306,6 +318,7 @@
|
|||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
actuator = #{record.actuator,jdbcType=VARCHAR},
|
||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
|
@ -325,7 +338,8 @@
|
|||
scenario_name = #{record.scenarioName,jdbcType=VARCHAR},
|
||||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
actuator = #{record.actuator,jdbcType=VARCHAR}
|
||||
actuator = #{record.actuator,jdbcType=VARCHAR},
|
||||
end_time = #{record.endTime,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -369,6 +383,9 @@
|
|||
<if test="actuator != null">
|
||||
actuator = #{actuator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -389,6 +406,7 @@
|
|||
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
actuator = #{actuator,jdbcType=VARCHAR},
|
||||
end_time = #{endTime,jdbcType=BIGINT},
|
||||
description = #{description,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -405,7 +423,8 @@
|
|||
scenario_name = #{scenarioName,jdbcType=VARCHAR},
|
||||
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
actuator = #{actuator,jdbcType=VARCHAR}
|
||||
actuator = #{actuator,jdbcType=VARCHAR},
|
||||
end_time = #{endTime,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -19,6 +19,7 @@
|
|||
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
|
||||
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
|
||||
<result column="version" jdbcType="INTEGER" property="version" />
|
||||
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
|
@ -83,9 +84,9 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
||||
create_time, update_time, num, tags, last_result_id, `status`, original_status, delete_time,
|
||||
delete_user_id, version
|
||||
id, project_id, `name`, priority, api_definition_id, create_user_id, update_user_id,
|
||||
create_time, update_time, num, tags, last_result_id, `status`, original_status, delete_time,
|
||||
delete_user_id, version, follow_people
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description, request
|
||||
|
@ -121,7 +122,7 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
|
@ -139,20 +140,20 @@
|
|||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
insert into api_test_case (id, project_id, `name`,
|
||||
priority, api_definition_id, create_user_id,
|
||||
update_user_id, create_time, update_time,
|
||||
num, tags, last_result_id,
|
||||
`status`, original_status, delete_time,
|
||||
delete_user_id, version, description,
|
||||
request)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
||||
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{lastResultId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
|
||||
#{deleteUserId,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{description,jdbcType=LONGVARCHAR},
|
||||
#{request,jdbcType=LONGVARCHAR})
|
||||
insert into api_test_case (id, project_id, `name`,
|
||||
priority, api_definition_id, create_user_id,
|
||||
update_user_id, create_time, update_time,
|
||||
num, tags, last_result_id,
|
||||
`status`, original_status, delete_time,
|
||||
delete_user_id, version, follow_people,
|
||||
description, request)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{priority,jdbcType=VARCHAR}, #{apiDefinitionId,jdbcType=VARCHAR}, #{createUserId,jdbcType=VARCHAR},
|
||||
#{updateUserId,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{num,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, #{lastResultId,jdbcType=VARCHAR},
|
||||
#{status,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
|
||||
#{deleteUserId,jdbcType=VARCHAR}, #{version,jdbcType=INTEGER}, #{followPeople,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=LONGVARCHAR}, #{request,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
insert into api_test_case
|
||||
|
@ -208,6 +209,9 @@
|
|||
<if test="version != null">
|
||||
version,
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
|
@ -267,6 +271,9 @@
|
|||
<if test="version != null">
|
||||
#{version,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
#{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -335,6 +342,9 @@
|
|||
<if test="record.version != null">
|
||||
version = #{record.version,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.followPeople != null">
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -365,6 +375,7 @@
|
|||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{record.version,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
request = #{record.request,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -389,7 +400,8 @@
|
|||
original_status = #{record.originalStatus,jdbcType=VARCHAR},
|
||||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{record.version,jdbcType=INTEGER}
|
||||
version = #{record.version,jdbcType=INTEGER},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -445,6 +457,9 @@
|
|||
<if test="version != null">
|
||||
version = #{version,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -472,6 +487,7 @@
|
|||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{version,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
request = #{request,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -493,7 +509,8 @@
|
|||
original_status = #{originalStatus,jdbcType=VARCHAR},
|
||||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{version,jdbcType=INTEGER}
|
||||
version = #{version,jdbcType=INTEGER},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
|
@ -15,6 +15,7 @@
|
|||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||
<result column="scenario_version" jdbcType="INTEGER" property="scenarioVersion" />
|
||||
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
|
||||
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||
<result column="load_configuration" jdbcType="LONGVARCHAR" property="loadConfiguration" />
|
||||
|
@ -80,7 +81,7 @@
|
|||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, `name`, description, create_time, update_time, `status`, test_resource_pool_id,
|
||||
user_id, num, create_user, scenario_version, scenario_id
|
||||
user_id, num, create_user, scenario_version, scenario_id, follow_people
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
load_configuration, advanced_configuration
|
||||
|
@ -138,14 +139,14 @@
|
|||
description, create_time, update_time,
|
||||
`status`, test_resource_pool_id, user_id,
|
||||
num, create_user, scenario_version,
|
||||
scenario_id, load_configuration, advanced_configuration
|
||||
)
|
||||
scenario_id, follow_people, load_configuration,
|
||||
advanced_configuration)
|
||||
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
|
||||
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{status,jdbcType=VARCHAR}, #{testResourcePoolId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
|
||||
#{num,jdbcType=INTEGER}, #{createUser,jdbcType=VARCHAR}, #{scenarioVersion,jdbcType=INTEGER},
|
||||
#{scenarioId,jdbcType=VARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR}, #{advancedConfiguration,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
#{scenarioId,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||
#{advancedConfiguration,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.LoadTestWithBLOBs">
|
||||
insert into load_test
|
||||
|
@ -189,6 +190,9 @@
|
|||
<if test="scenarioId != null">
|
||||
scenario_id,
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people,
|
||||
</if>
|
||||
<if test="loadConfiguration != null">
|
||||
load_configuration,
|
||||
</if>
|
||||
|
@ -236,6 +240,9 @@
|
|||
<if test="scenarioId != null">
|
||||
#{scenarioId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
#{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="loadConfiguration != null">
|
||||
#{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -292,6 +299,9 @@
|
|||
<if test="record.scenarioId != null">
|
||||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.followPeople != null">
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.loadConfiguration != null">
|
||||
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -318,6 +328,7 @@
|
|||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
|
||||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR},
|
||||
load_configuration = #{record.loadConfiguration,jdbcType=LONGVARCHAR},
|
||||
advanced_configuration = #{record.advancedConfiguration,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -338,7 +349,8 @@
|
|||
num = #{record.num,jdbcType=INTEGER},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
scenario_version = #{record.scenarioVersion,jdbcType=INTEGER},
|
||||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR}
|
||||
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
|
||||
follow_people = #{record.followPeople,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -382,6 +394,9 @@
|
|||
<if test="scenarioId != null">
|
||||
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="followPeople != null">
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="loadConfiguration != null">
|
||||
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -405,6 +420,7 @@
|
|||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
|
||||
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR},
|
||||
load_configuration = #{loadConfiguration,jdbcType=LONGVARCHAR},
|
||||
advanced_configuration = #{advancedConfiguration,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -422,7 +438,8 @@
|
|||
num = #{num,jdbcType=INTEGER},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
scenario_version = #{scenarioVersion,jdbcType=INTEGER},
|
||||
scenario_id = #{scenarioId,jdbcType=VARCHAR}
|
||||
scenario_id = #{scenarioId,jdbcType=VARCHAR},
|
||||
follow_people = #{followPeople,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,36 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.Notification;
|
||||
import io.metersphere.base.domain.NotificationExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface NotificationMapper {
|
||||
long countByExample(NotificationExample example);
|
||||
|
||||
int deleteByExample(NotificationExample example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(Notification record);
|
||||
|
||||
int insertSelective(Notification record);
|
||||
|
||||
List<Notification> selectByExampleWithBLOBs(NotificationExample example);
|
||||
|
||||
List<Notification> selectByExample(NotificationExample example);
|
||||
|
||||
Notification selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") Notification record, @Param("example") NotificationExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") Notification record, @Param("example") NotificationExample example);
|
||||
|
||||
int updateByExample(@Param("record") Notification record, @Param("example") NotificationExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(Notification record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(Notification record);
|
||||
|
||||
int updateByPrimaryKey(Notification record);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue