feat: 接口定义、批量场景转性能测试一键更新
This commit is contained in:
parent
f262d7a146
commit
4f17a1dd58
|
@ -58,8 +58,6 @@ public class APITestController {
|
|||
private ScheduleService scheduleService;
|
||||
@Resource
|
||||
private HistoricalDataUpgradeService historicalDataUpgradeService;
|
||||
@Resource
|
||||
private ApiTestEnvironmentService environmentService;
|
||||
|
||||
@GetMapping("recent/{count}")
|
||||
public List<APITestResult> recentTest(@PathVariable int count) {
|
||||
|
@ -373,27 +371,7 @@ public class APITestController {
|
|||
|
||||
@PostMapping(value = "/genPerformanceTestXml", consumes = {"multipart/form-data"})
|
||||
public JmxInfoDTO genPerformanceTest(@RequestPart("request") RunDefinitionRequest runRequest, @RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws Exception {
|
||||
|
||||
ParameterConfig config = new ParameterConfig();
|
||||
config.setProjectId(runRequest.getProjectId());
|
||||
|
||||
Map<String, EnvironmentConfig> envConfig = new HashMap<>();
|
||||
Map<String, String> map = runRequest.getEnvironmentMap();
|
||||
if (map != null && map.size() > 0) {
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(map.get(runRequest.getProjectId()));
|
||||
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
envConfig.put(runRequest.getProjectId(), env);
|
||||
config.setConfig(envConfig);
|
||||
}
|
||||
HashTree hashTree = runRequest.getTestElement().generateHashTree(config);
|
||||
String jmxString = runRequest.getTestElement().getJmx(hashTree);
|
||||
|
||||
String testName = runRequest.getName();
|
||||
|
||||
//将jmx处理封装为通用方法
|
||||
JmxInfoDTO dto = apiTestService.updateJmxString(jmxString, testName, false);
|
||||
dto.setName(runRequest.getName() + ".jmx");
|
||||
return dto;
|
||||
return apiTestService.getJmxInfoDTO(runRequest, bodyFiles);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ public class JmxInfoDTO {
|
|||
private String name;
|
||||
private String xml;
|
||||
private String id;
|
||||
private Integer version;
|
||||
private Map<String, String> attachFiles;
|
||||
private List<FileMetadata> fileMetadataList;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.List;
|
|||
@Setter
|
||||
public class ApiScenrioExportJmx {
|
||||
private String name;
|
||||
private String id;
|
||||
private String jmx;
|
||||
private Integer version;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package io.metersphere.api.dto.definition;
|
||||
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
import io.metersphere.base.domain.ApiTestCase;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
@ -8,36 +9,18 @@ import java.util.List;
|
|||
|
||||
@Setter
|
||||
@Getter
|
||||
public class SaveApiTestCaseRequest {
|
||||
|
||||
private String id;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private String name;
|
||||
|
||||
private String priority;
|
||||
|
||||
private String apiDefinitionId;
|
||||
|
||||
private String description;
|
||||
public class SaveApiTestCaseRequest extends ApiTestCase {
|
||||
|
||||
private MsTestElement request;
|
||||
|
||||
private String description;
|
||||
|
||||
private String response;
|
||||
|
||||
private String crateUserId;
|
||||
|
||||
private String updateUserId;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private List<String> bodyUploadIds;
|
||||
|
||||
private String tags;
|
||||
|
||||
//ESB参数。 可为null
|
||||
private String esbDataStruct;
|
||||
private String backEsbDataStruct;
|
||||
|
|
|
@ -8,6 +8,7 @@ import io.metersphere.jmeter.utils.ScriptEngineUtils;
|
|||
import lombok.Data;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy;
|
||||
import org.apache.jmeter.protocol.http.util.HTTPFileArg;
|
||||
|
||||
|
@ -137,6 +138,9 @@ public class Body {
|
|||
path = FileUtils.BODY_FILE_DIR + '/' + requestId + '/' + file.getName();
|
||||
}
|
||||
String mimetype = keyValue.getContentType();
|
||||
if (StringUtils.isBlank(mimetype)) {
|
||||
mimetype = ContentType.APPLICATION_OCTET_STREAM.getMimeType();
|
||||
}
|
||||
list.add(new HTTPFileArg(path, paramName, mimetype));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.alibaba.nacos.client.utils.StringUtils;
|
||||
import io.github.ningyu.jmeter.plugin.dubbo.sample.ProviderService;
|
||||
import io.metersphere.api.dto.*;
|
||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
||||
import io.metersphere.api.dto.definition.request.ParameterConfig;
|
||||
import io.metersphere.api.dto.parse.ApiImport;
|
||||
import io.metersphere.api.dto.scenario.environment.EnvironmentConfig;
|
||||
import io.metersphere.api.dto.scenario.request.dubbo.RegistryCenter;
|
||||
import io.metersphere.api.jmeter.JMeterService;
|
||||
import io.metersphere.api.parse.old.ApiImportParser;
|
||||
|
@ -28,10 +31,10 @@ import io.metersphere.job.sechedule.ApiTestJob;
|
|||
import io.metersphere.service.FileService;
|
||||
import io.metersphere.service.QuotaService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import io.metersphere.service.UserService;
|
||||
import io.metersphere.track.service.TestCaseService;
|
||||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.constants.CommonConstants;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentHelper;
|
||||
|
@ -50,7 +53,7 @@ import java.util.stream.Collectors;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class APITestService {
|
||||
@Resource
|
||||
private UserService userService;
|
||||
private ApiTestEnvironmentService apiTestEnvironmentService;
|
||||
@Resource
|
||||
private ApiTestMapper apiTestMapper;
|
||||
@Resource
|
||||
|
@ -676,4 +679,27 @@ public class APITestService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JmxInfoDTO getJmxInfoDTO(RunDefinitionRequest runRequest, List<MultipartFile> bodyFiles) {
|
||||
ParameterConfig config = new ParameterConfig();
|
||||
config.setProjectId(runRequest.getProjectId());
|
||||
|
||||
Map<String, EnvironmentConfig> envConfig = new HashMap<>();
|
||||
Map<String, String> map = runRequest.getEnvironmentMap();
|
||||
if (map != null && map.size() > 0) {
|
||||
ApiTestEnvironmentWithBLOBs environment = apiTestEnvironmentService.get(map.get(runRequest.getProjectId()));
|
||||
EnvironmentConfig env = JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class);
|
||||
envConfig.put(runRequest.getProjectId(), env);
|
||||
config.setConfig(envConfig);
|
||||
}
|
||||
HashTree hashTree = runRequest.getTestElement().generateHashTree(config);
|
||||
String jmxString = runRequest.getTestElement().getJmx(hashTree);
|
||||
|
||||
String testName = runRequest.getName();
|
||||
|
||||
//将jmx处理封装为通用方法
|
||||
JmxInfoDTO dto = updateJmxString(jmxString, testName, false);
|
||||
dto.setName(runRequest.getName() + ".jmx");
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1961,6 +1961,7 @@ public class ApiAutomationService {
|
|||
if (StringUtils.isNotEmpty(jmx)) {
|
||||
ApiScenrioExportJmx scenrioExportJmx = new ApiScenrioExportJmx(item.getName(), apiTestService.updateJmxString(jmx, null, true).getXml());
|
||||
JmxInfoDTO dto = apiTestService.updateJmxString(jmx, item.getName(), true);
|
||||
scenrioExportJmx.setId(item.getId());
|
||||
scenrioExportJmx.setVersion(item.getVersion());
|
||||
//扫描需要哪些文件
|
||||
scenrioExportJmx.setFileMetadataList(dto.getFileMetadataList());
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.metersphere.api.dto.ApiCaseBatchRequest;
|
||||
import io.metersphere.api.dto.DeleteCheckResult;
|
||||
import io.metersphere.api.dto.JmxInfoDTO;
|
||||
import io.metersphere.api.dto.datacount.ApiDataCountResult;
|
||||
import io.metersphere.api.dto.definition.*;
|
||||
import io.metersphere.api.dto.definition.request.MsTestElement;
|
||||
|
@ -40,6 +41,7 @@ import org.apache.ibatis.session.SqlSessionFactory;
|
|||
import org.apache.jorphan.collections.HashTree;
|
||||
import org.apache.jorphan.collections.ListedHashTree;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -86,6 +88,9 @@ public class ApiTestCaseService {
|
|||
private ApiScenarioReferenceIdService apiScenarioReferenceIdService;
|
||||
@Resource
|
||||
private ExtApiScenarioMapper extApiScenarioMapper;
|
||||
@Resource
|
||||
@Lazy
|
||||
private APITestService apiTestService;
|
||||
|
||||
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
|
||||
|
||||
|
@ -289,6 +294,7 @@ public class ApiTestCaseService {
|
|||
test.setPriority(request.getPriority());
|
||||
test.setUpdateTime(System.currentTimeMillis());
|
||||
test.setDescription(request.getDescription());
|
||||
test.setVersion(request.getVersion() == null ? 0 : request.getVersion() + 1);
|
||||
if (StringUtils.equals("[]", request.getTags())) {
|
||||
test.setTags("");
|
||||
} else {
|
||||
|
@ -930,4 +936,55 @@ public class ApiTestCaseService {
|
|||
result.setCheckMsg(checkMsgList);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<JmxInfoDTO> exportJmx(List<String> caseIds, String envId) {
|
||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||
example.createCriteria().andIdIn(caseIds);
|
||||
List<ApiTestCaseWithBLOBs> apiTestCases = apiTestCaseMapper.selectByExampleWithBLOBs(example);
|
||||
List<JmxInfoDTO> list = new ArrayList<>();
|
||||
apiTestCases.forEach(item -> {
|
||||
list.add(parse2Jmx(item, envId));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
private JmxInfoDTO parse2Jmx(ApiTestCaseWithBLOBs apiTestCase, String envId) {
|
||||
String request = apiTestCase.getRequest();
|
||||
MsHTTPSamplerProxy msHTTPSamplerProxy = JSONObject.parseObject(request, MsHTTPSamplerProxy.class);
|
||||
msHTTPSamplerProxy.setName(apiTestCase.getId());
|
||||
msHTTPSamplerProxy.setUseEnvironment(envId);
|
||||
|
||||
LinkedList<MsTestElement> hashTree = new LinkedList<>();
|
||||
hashTree.add(msHTTPSamplerProxy);
|
||||
MsThreadGroup msThreadGroup = new MsThreadGroup();
|
||||
msThreadGroup.setHashTree(hashTree);
|
||||
msThreadGroup.setName("ThreadGroup");
|
||||
msThreadGroup.setLabel("ThreadGroup");
|
||||
msThreadGroup.setId(UUID.randomUUID().toString());
|
||||
|
||||
LinkedList<MsTestElement> planHashTree = new LinkedList<>();
|
||||
planHashTree.add(msThreadGroup);
|
||||
MsTestPlan msTestPlan = new MsTestPlan();
|
||||
msTestPlan.setHashTree(planHashTree);
|
||||
msTestPlan.setId(UUID.randomUUID().toString());
|
||||
msTestPlan.setName("TestPlan");
|
||||
msTestPlan.setLabel("TestPlan");
|
||||
|
||||
HashMap<String, String> envMap = new HashMap<>();
|
||||
envMap.put(apiTestCase.getProjectId(), envId);
|
||||
|
||||
RunDefinitionRequest runRequest = new RunDefinitionRequest();
|
||||
runRequest.setEnvironmentMap(envMap);
|
||||
runRequest.setEnvironmentId(envId);
|
||||
runRequest.setId(apiTestCase.getId());
|
||||
runRequest.setTestElement(msTestPlan);
|
||||
runRequest.setProjectId(apiTestCase.getProjectId());
|
||||
|
||||
JmxInfoDTO jmxInfoDTO = apiTestService.getJmxInfoDTO(runRequest, new ArrayList<>());
|
||||
jmxInfoDTO.setId(apiTestCase.getId());
|
||||
jmxInfoDTO.setVersion(apiTestCase.getVersion());
|
||||
jmxInfoDTO.setName(apiTestCase.getName());
|
||||
return jmxInfoDTO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiLoadTest implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String apiId;
|
||||
|
||||
private String loadTestId;
|
||||
|
||||
private String envId;
|
||||
|
||||
private String type;
|
||||
|
||||
private Integer apiVersion;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
|
@ -0,0 +1,610 @@
|
|||
package io.metersphere.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ApiLoadTestExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public ApiLoadTestExample() {
|
||||
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(String value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(String value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(String value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(String value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLike(String value) {
|
||||
addCriterion("id like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotLike(String value) {
|
||||
addCriterion("id not like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<String> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<String> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(String value1, String value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(String value1, String value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdIsNull() {
|
||||
addCriterion("api_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdIsNotNull() {
|
||||
addCriterion("api_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdEqualTo(String value) {
|
||||
addCriterion("api_id =", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdNotEqualTo(String value) {
|
||||
addCriterion("api_id <>", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdGreaterThan(String value) {
|
||||
addCriterion("api_id >", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("api_id >=", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdLessThan(String value) {
|
||||
addCriterion("api_id <", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("api_id <=", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdLike(String value) {
|
||||
addCriterion("api_id like", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdNotLike(String value) {
|
||||
addCriterion("api_id not like", value, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdIn(List<String> values) {
|
||||
addCriterion("api_id in", values, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdNotIn(List<String> values) {
|
||||
addCriterion("api_id not in", values, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdBetween(String value1, String value2) {
|
||||
addCriterion("api_id between", value1, value2, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiIdNotBetween(String value1, String value2) {
|
||||
addCriterion("api_id not between", value1, value2, "apiId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdIsNull() {
|
||||
addCriterion("load_test_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdIsNotNull() {
|
||||
addCriterion("load_test_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdEqualTo(String value) {
|
||||
addCriterion("load_test_id =", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdNotEqualTo(String value) {
|
||||
addCriterion("load_test_id <>", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdGreaterThan(String value) {
|
||||
addCriterion("load_test_id >", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("load_test_id >=", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdLessThan(String value) {
|
||||
addCriterion("load_test_id <", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("load_test_id <=", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdLike(String value) {
|
||||
addCriterion("load_test_id like", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdNotLike(String value) {
|
||||
addCriterion("load_test_id not like", value, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdIn(List<String> values) {
|
||||
addCriterion("load_test_id in", values, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdNotIn(List<String> values) {
|
||||
addCriterion("load_test_id not in", values, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdBetween(String value1, String value2) {
|
||||
addCriterion("load_test_id between", value1, value2, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLoadTestIdNotBetween(String value1, String value2) {
|
||||
addCriterion("load_test_id not between", value1, value2, "loadTestId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdIsNull() {
|
||||
addCriterion("env_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdIsNotNull() {
|
||||
addCriterion("env_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdEqualTo(String value) {
|
||||
addCriterion("env_id =", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdNotEqualTo(String value) {
|
||||
addCriterion("env_id <>", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdGreaterThan(String value) {
|
||||
addCriterion("env_id >", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("env_id >=", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdLessThan(String value) {
|
||||
addCriterion("env_id <", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("env_id <=", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdLike(String value) {
|
||||
addCriterion("env_id like", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdNotLike(String value) {
|
||||
addCriterion("env_id not like", value, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdIn(List<String> values) {
|
||||
addCriterion("env_id in", values, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdNotIn(List<String> values) {
|
||||
addCriterion("env_id not in", values, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdBetween(String value1, String value2) {
|
||||
addCriterion("env_id between", value1, value2, "envId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnvIdNotBetween(String value1, String value2) {
|
||||
addCriterion("env_id not between", value1, value2, "envId");
|
||||
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 andApiVersionIsNull() {
|
||||
addCriterion("api_version is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionIsNotNull() {
|
||||
addCriterion("api_version is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionEqualTo(Integer value) {
|
||||
addCriterion("api_version =", value, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionNotEqualTo(Integer value) {
|
||||
addCriterion("api_version <>", value, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionGreaterThan(Integer value) {
|
||||
addCriterion("api_version >", value, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("api_version >=", value, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionLessThan(Integer value) {
|
||||
addCriterion("api_version <", value, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("api_version <=", value, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionIn(List<Integer> values) {
|
||||
addCriterion("api_version in", values, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionNotIn(List<Integer> values) {
|
||||
addCriterion("api_version not in", values, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionBetween(Integer value1, Integer value2) {
|
||||
addCriterion("api_version between", value1, value2, "apiVersion");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andApiVersionNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("api_version not between", value1, value2, "apiVersion");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -37,5 +37,7 @@ public class ApiTestCase implements Serializable {
|
|||
|
||||
private String deleteUserId;
|
||||
|
||||
private Integer version;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1183,6 +1183,66 @@ public class ApiTestCaseExample {
|
|||
addCriterion("delete_user_id not between", value1, value2, "deleteUserId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionIsNull() {
|
||||
addCriterion("version is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionIsNotNull() {
|
||||
addCriterion("version is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionEqualTo(Integer value) {
|
||||
addCriterion("version =", value, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionNotEqualTo(Integer value) {
|
||||
addCriterion("version <>", value, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionGreaterThan(Integer value) {
|
||||
addCriterion("version >", value, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("version >=", value, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionLessThan(Integer value) {
|
||||
addCriterion("version <", value, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("version <=", value, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionIn(List<Integer> values) {
|
||||
addCriterion("version in", values, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionNotIn(List<Integer> values) {
|
||||
addCriterion("version not in", values, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionBetween(Integer value1, Integer value2) {
|
||||
addCriterion("version between", value1, value2, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVersionNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("version not between", value1, value2, "version");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
@ -1277,4 +1337,4 @@ public class ApiTestCaseExample {
|
|||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ public class TestPlanTestCase implements Serializable {
|
|||
|
||||
private String caseId;
|
||||
|
||||
private String reportId;
|
||||
|
||||
private String executor;
|
||||
|
||||
private String status;
|
||||
|
@ -21,11 +23,9 @@ public class TestPlanTestCase implements Serializable {
|
|||
|
||||
private Long updateTime;
|
||||
|
||||
private String reportId;
|
||||
|
||||
private String createUser;
|
||||
|
||||
private Integer issuesCount;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,6 +314,76 @@ public class TestPlanTestCaseExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNull() {
|
||||
addCriterion("report_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNotNull() {
|
||||
addCriterion("report_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdEqualTo(String value) {
|
||||
addCriterion("report_id =", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotEqualTo(String value) {
|
||||
addCriterion("report_id <>", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThan(String value) {
|
||||
addCriterion("report_id >", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("report_id >=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThan(String value) {
|
||||
addCriterion("report_id <", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("report_id <=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLike(String value) {
|
||||
addCriterion("report_id like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotLike(String value) {
|
||||
addCriterion("report_id not like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIn(List<String> values) {
|
||||
addCriterion("report_id in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotIn(List<String> values) {
|
||||
addCriterion("report_id not in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdBetween(String value1, String value2) {
|
||||
addCriterion("report_id between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotBetween(String value1, String value2) {
|
||||
addCriterion("report_id not between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andExecutorIsNull() {
|
||||
addCriterion("executor is null");
|
||||
return (Criteria) this;
|
||||
|
@ -644,76 +714,6 @@ public class TestPlanTestCaseExample {
|
|||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNull() {
|
||||
addCriterion("report_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIsNotNull() {
|
||||
addCriterion("report_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdEqualTo(String value) {
|
||||
addCriterion("report_id =", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotEqualTo(String value) {
|
||||
addCriterion("report_id <>", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThan(String value) {
|
||||
addCriterion("report_id >", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("report_id >=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThan(String value) {
|
||||
addCriterion("report_id <", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("report_id <=", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdLike(String value) {
|
||||
addCriterion("report_id like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotLike(String value) {
|
||||
addCriterion("report_id not like", value, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdIn(List<String> values) {
|
||||
addCriterion("report_id in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotIn(List<String> values) {
|
||||
addCriterion("report_id not in", values, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdBetween(String value1, String value2) {
|
||||
addCriterion("report_id between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andReportIdNotBetween(String value1, String value2) {
|
||||
addCriterion("report_id not between", value1, value2, "reportId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateUserIsNull() {
|
||||
addCriterion("create_user is null");
|
||||
return (Criteria) this;
|
||||
|
@ -937,4 +937,4 @@ public class TestPlanTestCaseExample {
|
|||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package io.metersphere.base.mapper;
|
||||
|
||||
import io.metersphere.base.domain.ApiLoadTest;
|
||||
import io.metersphere.base.domain.ApiLoadTestExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface ApiLoadTestMapper {
|
||||
long countByExample(ApiLoadTestExample example);
|
||||
|
||||
int deleteByExample(ApiLoadTestExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(ApiLoadTest record);
|
||||
|
||||
int insertSelective(ApiLoadTest record);
|
||||
|
||||
List<ApiLoadTest> selectByExample(ApiLoadTestExample example);
|
||||
|
||||
ApiLoadTest selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") ApiLoadTest record, @Param("example") ApiLoadTestExample example);
|
||||
|
||||
int updateByExample(@Param("record") ApiLoadTest record, @Param("example") ApiLoadTestExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(ApiLoadTest record);
|
||||
|
||||
int updateByPrimaryKey(ApiLoadTest record);
|
||||
}
|
|
@ -0,0 +1,228 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.base.mapper.ApiLoadTestMapper">
|
||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiLoadTest">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="api_id" jdbcType="VARCHAR" property="apiId" />
|
||||
<result column="load_test_id" jdbcType="VARCHAR" property="loadTestId" />
|
||||
<result column="env_id" jdbcType="VARCHAR" property="envId" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="api_version" jdbcType="INTEGER" property="apiVersion" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, api_id, load_test_id, env_id, `type`, api_version
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiLoadTestExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from api_load_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from api_load_test
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from api_load_test
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiLoadTestExample">
|
||||
delete from api_load_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.ApiLoadTest">
|
||||
insert into api_load_test (id, api_id, load_test_id,
|
||||
env_id, `type`, api_version
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{apiId,jdbcType=VARCHAR}, #{loadTestId,jdbcType=VARCHAR},
|
||||
#{envId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{apiVersion,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiLoadTest">
|
||||
insert into api_load_test
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="apiId != null">
|
||||
api_id,
|
||||
</if>
|
||||
<if test="loadTestId != null">
|
||||
load_test_id,
|
||||
</if>
|
||||
<if test="envId != null">
|
||||
env_id,
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type`,
|
||||
</if>
|
||||
<if test="apiVersion != null">
|
||||
api_version,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="apiId != null">
|
||||
#{apiId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="loadTestId != null">
|
||||
#{loadTestId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="envId != null">
|
||||
#{envId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
#{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="apiVersion != null">
|
||||
#{apiVersion,jdbcType=INTEGER},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiLoadTestExample" resultType="java.lang.Long">
|
||||
select count(*) from api_load_test
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update api_load_test
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.apiId != null">
|
||||
api_id = #{record.apiId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.loadTestId != null">
|
||||
load_test_id = #{record.loadTestId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.envId != null">
|
||||
env_id = #{record.envId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.apiVersion != null">
|
||||
api_version = #{record.apiVersion,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update api_load_test
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
api_id = #{record.apiId,jdbcType=VARCHAR},
|
||||
load_test_id = #{record.loadTestId,jdbcType=VARCHAR},
|
||||
env_id = #{record.envId,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
api_version = #{record.apiVersion,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiLoadTest">
|
||||
update api_load_test
|
||||
<set>
|
||||
<if test="apiId != null">
|
||||
api_id = #{apiId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="loadTestId != null">
|
||||
load_test_id = #{loadTestId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="envId != null">
|
||||
env_id = #{envId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="apiVersion != null">
|
||||
api_version = #{apiVersion,jdbcType=INTEGER},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiLoadTest">
|
||||
update api_load_test
|
||||
set api_id = #{apiId,jdbcType=VARCHAR},
|
||||
load_test_id = #{loadTestId,jdbcType=VARCHAR},
|
||||
env_id = #{envId,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
api_version = #{apiVersion,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
|
@ -18,6 +18,7 @@
|
|||
<result column="original_status" jdbcType="VARCHAR" property="originalStatus" />
|
||||
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
|
||||
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
|
||||
<result column="version" jdbcType="INTEGER" property="version" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
<result column="description" jdbcType="LONGVARCHAR" property="description" />
|
||||
|
@ -82,9 +83,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
|
||||
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
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
description, request
|
||||
|
@ -120,7 +121,7 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
|
@ -138,20 +139,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, 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}, #{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, 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>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestCaseWithBLOBs">
|
||||
insert into api_test_case
|
||||
|
@ -204,6 +205,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
delete_user_id,
|
||||
</if>
|
||||
<if test="version != null">
|
||||
version,
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description,
|
||||
</if>
|
||||
|
@ -260,6 +264,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
#{deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="version != null">
|
||||
#{version,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
#{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -325,6 +332,9 @@
|
|||
<if test="record.deleteUserId != null">
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.version != null">
|
||||
version = #{record.version,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.description != null">
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -354,6 +364,7 @@
|
|||
original_status = #{record.originalStatus,jdbcType=VARCHAR},
|
||||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{record.version,jdbcType=INTEGER},
|
||||
description = #{record.description,jdbcType=LONGVARCHAR},
|
||||
request = #{record.request,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
|
@ -377,7 +388,8 @@
|
|||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
original_status = #{record.originalStatus,jdbcType=VARCHAR},
|
||||
delete_time = #{record.deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}
|
||||
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{record.version,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
|
@ -430,6 +442,9 @@
|
|||
<if test="deleteUserId != null">
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="version != null">
|
||||
version = #{version,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="description != null">
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
|
@ -456,6 +471,7 @@
|
|||
original_status = #{originalStatus,jdbcType=VARCHAR},
|
||||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{version,jdbcType=INTEGER},
|
||||
description = #{description,jdbcType=LONGVARCHAR},
|
||||
request = #{request,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
|
@ -476,7 +492,8 @@
|
|||
`status` = #{status,jdbcType=VARCHAR},
|
||||
original_status = #{originalStatus,jdbcType=VARCHAR},
|
||||
delete_time = #{deleteTime,jdbcType=BIGINT},
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}
|
||||
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
|
||||
version = #{version,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="plan_id" jdbcType="VARCHAR" property="planId" />
|
||||
<result column="case_id" jdbcType="VARCHAR" property="caseId" />
|
||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
||||
<result column="executor" jdbcType="VARCHAR" property="executor" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
||||
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
||||
<result column="issues_count" jdbcType="INTEGER" property="issuesCount" />
|
||||
</resultMap>
|
||||
|
@ -78,7 +78,7 @@
|
|||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, plan_id, case_id, executor, `status`, remark, create_time, update_time, report_id,
|
||||
id, plan_id, case_id, report_id, executor, `status`, remark, create_time, update_time,
|
||||
create_user, issues_count
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
|
@ -115,7 +115,7 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
|
@ -133,15 +133,15 @@
|
|||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
|
||||
insert into test_plan_test_case (id, plan_id, case_id,
|
||||
executor, `status`, remark,
|
||||
create_time, update_time, report_id,
|
||||
create_user, issues_count, results,
|
||||
insert into test_plan_test_case (id, plan_id, case_id,
|
||||
report_id, executor, `status`,
|
||||
remark, create_time, update_time,
|
||||
create_user, issues_count, results,
|
||||
issues, actual_result)
|
||||
values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
|
||||
#{executor,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{reportId,jdbcType=VARCHAR},
|
||||
#{createUser,jdbcType=VARCHAR}, #{issuesCount,jdbcType=INTEGER}, #{results,jdbcType=LONGVARCHAR},
|
||||
values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
|
||||
#{reportId,jdbcType=VARCHAR}, #{executor,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||
#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{createUser,jdbcType=VARCHAR}, #{issuesCount,jdbcType=INTEGER}, #{results,jdbcType=LONGVARCHAR},
|
||||
#{issues,jdbcType=LONGVARCHAR}, #{actualResult,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
|
||||
|
@ -156,6 +156,9 @@
|
|||
<if test="caseId != null">
|
||||
case_id,
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
report_id,
|
||||
</if>
|
||||
<if test="executor != null">
|
||||
executor,
|
||||
</if>
|
||||
|
@ -171,9 +174,6 @@
|
|||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
report_id,
|
||||
</if>
|
||||
<if test="createUser != null">
|
||||
create_user,
|
||||
</if>
|
||||
|
@ -200,6 +200,9 @@
|
|||
<if test="caseId != null">
|
||||
#{caseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
#{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executor != null">
|
||||
#{executor,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -215,9 +218,6 @@
|
|||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
#{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createUser != null">
|
||||
#{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -253,6 +253,9 @@
|
|||
<if test="record.caseId != null">
|
||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.reportId != null">
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.executor != null">
|
||||
executor = #{record.executor,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -268,9 +271,6 @@
|
|||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.reportId != null">
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createUser != null">
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -296,12 +296,12 @@
|
|||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
plan_id = #{record.planId,jdbcType=VARCHAR},
|
||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
executor = #{record.executor,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
issues_count = #{record.issuesCount,jdbcType=INTEGER},
|
||||
results = #{record.results,jdbcType=LONGVARCHAR},
|
||||
|
@ -316,12 +316,12 @@
|
|||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
plan_id = #{record.planId,jdbcType=VARCHAR},
|
||||
case_id = #{record.caseId,jdbcType=VARCHAR},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
executor = #{record.executor,jdbcType=VARCHAR},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
remark = #{record.remark,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||
create_user = #{record.createUser,jdbcType=VARCHAR},
|
||||
issues_count = #{record.issuesCount,jdbcType=INTEGER}
|
||||
<if test="_parameter != null">
|
||||
|
@ -337,6 +337,9 @@
|
|||
<if test="caseId != null">
|
||||
case_id = #{caseId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="executor != null">
|
||||
executor = #{executor,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -352,9 +355,6 @@
|
|||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="reportId != null">
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createUser != null">
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -377,12 +377,12 @@
|
|||
update test_plan_test_case
|
||||
set plan_id = #{planId,jdbcType=VARCHAR},
|
||||
case_id = #{caseId,jdbcType=VARCHAR},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
executor = #{executor,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
issues_count = #{issuesCount,jdbcType=INTEGER},
|
||||
results = #{results,jdbcType=LONGVARCHAR},
|
||||
|
@ -394,14 +394,14 @@
|
|||
update test_plan_test_case
|
||||
set plan_id = #{planId,jdbcType=VARCHAR},
|
||||
case_id = #{caseId,jdbcType=VARCHAR},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
executor = #{executor,jdbcType=VARCHAR},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
report_id = #{reportId,jdbcType=VARCHAR},
|
||||
create_user = #{createUser,jdbcType=VARCHAR},
|
||||
issues_count = #{issuesCount,jdbcType=INTEGER}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package io.metersphere.base.mapper.ext;
|
||||
|
||||
public interface ExtApiLoadTestMapper {
|
||||
|
||||
int countNeedUpdateApiCase(String loadTestId);
|
||||
|
||||
int countNeedUpdateApiScenario(String loadTestId);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiLoadTestMapper">
|
||||
|
||||
<select id="countNeedUpdateApiCase" resultType="java.lang.Integer">
|
||||
select COUNT(1) from api_load_test alt
|
||||
inner join api_test_case atc
|
||||
on alt.type = 'API_CASE'
|
||||
and alt.load_test_id = #{loadTestId}
|
||||
and alt.api_id = atc.id and alt.api_version < atc.version;
|
||||
</select>
|
||||
<select id="countNeedUpdateApiScenario" resultType="java.lang.Integer">
|
||||
select COUNT(1) from api_load_test alt
|
||||
inner join api_scenario
|
||||
on alt.type = 'SCENARIO'
|
||||
and alt.load_test_id = #{loadTestId}
|
||||
and alt.api_id = api_scenario.id and alt.api_version < api_scenario.version;
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum ApiLoadType {
|
||||
API_CASE, SCENARIO
|
||||
}
|
|
@ -79,6 +79,11 @@ public class FileUtils {
|
|||
return new File(path);
|
||||
}
|
||||
|
||||
public static File getBodyFileByName(String name, String requestId) {
|
||||
String path = BODY_FILE_DIR + "/" + requestId + "/" + name;
|
||||
return new File(path);
|
||||
}
|
||||
|
||||
public static void copyBdyFile(String originId, String toId) {
|
||||
try {
|
||||
FileUtil.copyDir(new File(FileUtils.BODY_FILE_DIR + "/" + originId),
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.api.service.ApiAutomationService;
|
|||
import io.metersphere.base.domain.JarConfig;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.RunInterface;
|
||||
import io.metersphere.performance.service.PerformanceTestService;
|
||||
import io.metersphere.service.JarConfigService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
|
@ -36,6 +37,8 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
|
|||
private SystemParameterService systemParameterService;
|
||||
@Resource
|
||||
private IssuesService issuesService;
|
||||
@Resource
|
||||
private PerformanceTestService performanceTestService;
|
||||
@Value("${jmeter.home}")
|
||||
private String jmeterHome;
|
||||
|
||||
|
@ -54,6 +57,7 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
|
|||
initOperate(apiAutomationService::checkApiScenarioReferenceId, "init.scenario.referenceId");
|
||||
initOperate(issuesService::syncThirdPartyIssues, "init.issue");
|
||||
initOperate(issuesService::issuesCount, "init.issueCount");
|
||||
initOperate(performanceTestService::initScenarioLoadTest, "init.scenario.load.test");
|
||||
|
||||
try {
|
||||
Thread.sleep(1 * 60 * 1000);
|
||||
|
@ -65,6 +69,12 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理初始化数据、兼容数据
|
||||
* 只在第一次升级的时候执行一次
|
||||
* @param initFuc
|
||||
* @param key
|
||||
*/
|
||||
private void initOperate(RunInterface initFuc, final String key) {
|
||||
try {
|
||||
String value = systemParameterService.getValue(key);
|
||||
|
|
|
@ -88,7 +88,7 @@ public class PerformanceTestController {
|
|||
@PostMapping(value = "/sync/scenario")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_PERFORMANCE_TEST_READ_CREATE)
|
||||
public void syncScenario(@RequestBody EditTestPlanRequest request) {
|
||||
performanceTestService.syncScenario(request);
|
||||
performanceTestService.syncApi(request);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/edit", consumes = {"multipart/form-data"})
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.performance.request;
|
||||
|
||||
import io.metersphere.base.domain.ApiLoadTest;
|
||||
import io.metersphere.base.domain.FileMetadata;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -13,4 +14,5 @@ public class SaveTestPlanRequest extends TestPlanRequest {
|
|||
private List<FileMetadata> updatedFileList;
|
||||
private Map<String, Integer> fileSorts;
|
||||
private List<String> conversionFileIdList;
|
||||
private List<ApiLoadTest> apiList;
|
||||
}
|
||||
|
|
|
@ -26,10 +26,6 @@ public class TestPlanRequest {
|
|||
|
||||
private String runtimeConfiguration;
|
||||
|
||||
private Integer scenarioVersion;
|
||||
|
||||
private String scenarioId;
|
||||
|
||||
private Schedule schedule;
|
||||
|
||||
private String testResourcePoolId;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package io.metersphere.performance.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.metersphere.api.dto.JmxInfoDTO;
|
||||
import io.metersphere.api.dto.automation.ApiScenarioBatchRequest;
|
||||
import io.metersphere.api.dto.automation.ApiScenrioExportJmx;
|
||||
import io.metersphere.api.service.ApiAutomationService;
|
||||
import io.metersphere.api.service.ApiTestCaseService;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.*;
|
||||
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
|
||||
|
@ -29,12 +31,16 @@ import io.metersphere.performance.dto.LoadTestExportJmx;
|
|||
import io.metersphere.performance.engine.Engine;
|
||||
import io.metersphere.performance.engine.EngineFactory;
|
||||
import io.metersphere.performance.request.*;
|
||||
import io.metersphere.service.ApiPerformanceService;
|
||||
import io.metersphere.service.FileService;
|
||||
import io.metersphere.service.QuotaService;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import io.metersphere.track.service.TestCaseService;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.aspectj.util.FileUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -87,6 +93,12 @@ public class PerformanceTestService {
|
|||
private TestResourcePoolMapper testResourcePoolMapper;
|
||||
@Resource
|
||||
private ApiAutomationService apiAutomationService;
|
||||
@Resource
|
||||
private ApiTestCaseService apiTestCaseService;
|
||||
@Resource
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
@Resource
|
||||
private ApiPerformanceService apiPerformanceService;
|
||||
|
||||
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
|
@ -213,8 +225,8 @@ public class PerformanceTestService {
|
|||
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
|
||||
loadTest.setStatus(PerformanceTestStatus.Saved.name());
|
||||
loadTest.setNum(getNextNum(request.getProjectId()));
|
||||
loadTest.setScenarioVersion(request.getScenarioVersion());
|
||||
loadTest.setScenarioId(request.getScenarioId());
|
||||
List<ApiLoadTest> apiList = request.getApiList();
|
||||
apiPerformanceService.add(apiList, loadTest.getId());
|
||||
loadTestMapper.insert(loadTest);
|
||||
return loadTest;
|
||||
}
|
||||
|
@ -261,8 +273,6 @@ public class PerformanceTestService {
|
|||
loadTest.setAdvancedConfiguration(request.getAdvancedConfiguration());
|
||||
loadTest.setTestResourcePoolId(request.getTestResourcePoolId());
|
||||
loadTest.setStatus(PerformanceTestStatus.Saved.name());
|
||||
loadTest.setScenarioVersion(request.getScenarioVersion());
|
||||
loadTest.setScenarioId(request.getScenarioId());
|
||||
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
||||
|
||||
return testId;
|
||||
|
@ -396,7 +406,7 @@ public class PerformanceTestService {
|
|||
List<LoadTestDTO> testDTOS = extLoadTestMapper.list(request);
|
||||
if (!CollectionUtils.isEmpty(testDTOS)) {
|
||||
LoadTestDTO loadTestDTO = testDTOS.get(0);
|
||||
isNeedUpdate(loadTestDTO);
|
||||
loadTestDTO.setIsNeedUpdate(apiPerformanceService.isNeedUpdate(loadTestDTO.getId()));
|
||||
Schedule schedule = scheduleService.getScheduleByResource(loadTestDTO.getId(), ScheduleGroup.PERFORMANCE_TEST.name());
|
||||
loadTestDTO.setSchedule(schedule);
|
||||
return loadTestDTO;
|
||||
|
@ -404,21 +414,6 @@ public class PerformanceTestService {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void isNeedUpdate(LoadTestDTO loadTestDTO) {
|
||||
String scenarioId = loadTestDTO.getScenarioId();
|
||||
if (StringUtils.isNotBlank(scenarioId)) {
|
||||
ApiScenarioWithBLOBs apiScenario = apiAutomationService.getApiScenario(scenarioId);
|
||||
if (apiScenario == null) {
|
||||
loadTestDTO.setScenarioId(null);
|
||||
} else {
|
||||
if (apiScenario.getVersion() != null && loadTestDTO.getScenarioVersion() != null
|
||||
&& apiScenario.getVersion() > loadTestDTO.getScenarioVersion()) {
|
||||
loadTestDTO.setIsNeedUpdate(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getAdvancedConfiguration(String testId) {
|
||||
LoadTestWithBLOBs loadTestWithBLOBs = loadTestMapper.selectByPrimaryKey(testId);
|
||||
return Optional.ofNullable(loadTestWithBLOBs).orElse(new LoadTestWithBLOBs()).getAdvancedConfiguration();
|
||||
|
@ -652,35 +647,66 @@ public class PerformanceTestService {
|
|||
return null;
|
||||
}
|
||||
|
||||
public void syncScenario(EditTestPlanRequest request) {
|
||||
ApiScenarioBatchRequest scenarioRequest = new ApiScenarioBatchRequest();
|
||||
scenarioRequest.setIds(Arrays.asList(request.getScenarioId()));
|
||||
List<ApiScenrioExportJmx> apiScenrioExportJmxes = apiAutomationService.exportJmx(scenarioRequest);
|
||||
ApiScenrioExportJmx apiScenrioExportJmx = apiScenrioExportJmxes.get(0);
|
||||
|
||||
String testId = request.getId();
|
||||
LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(testId);
|
||||
/**
|
||||
* 一键更新由接口用例或者场景用例转换的性能测试
|
||||
* @param request
|
||||
*/
|
||||
public void syncApi(EditTestPlanRequest request) {
|
||||
String lostTestId = request.getId();
|
||||
LoadTestWithBLOBs loadTest = loadTestMapper.selectByPrimaryKey(lostTestId);
|
||||
if (loadTest == null) {
|
||||
MSException.throwException(Translator.get("edit_load_test_not_found") + testId);
|
||||
MSException.throwException(Translator.get("edit_load_test_not_found") + lostTestId);
|
||||
}
|
||||
if (StringUtils.containsAny(loadTest.getStatus(), PerformanceTestStatus.Running.name(), PerformanceTestStatus.Starting.name())) {
|
||||
MSException.throwException(Translator.get("cannot_edit_load_test_running"));
|
||||
}
|
||||
|
||||
loadTest.setScenarioVersion(apiScenrioExportJmx.getVersion());
|
||||
loadTest.setUpdateTime(System.currentTimeMillis());
|
||||
loadTestMapper.updateByPrimaryKeySelective(loadTest);
|
||||
|
||||
deleteLoadTestFiles(testId);
|
||||
saveJmxFile(apiScenrioExportJmx, loadTest.getProjectId(), loadTest.getId());
|
||||
saveOtherFile(apiScenrioExportJmx.getFileMetadataList(), loadTest.getId());
|
||||
|
||||
List<ApiLoadTest> apiLoadTests = apiPerformanceService.getByLoadTestId(loadTest.getId());
|
||||
syncScenario(loadTest, apiLoadTests);
|
||||
syncApiCase(loadTest, apiLoadTests);
|
||||
}
|
||||
|
||||
private void saveJmxFile(ApiScenrioExportJmx apiScenrioExportJmx, String projectId, String loadTestId) {
|
||||
String jmx = apiScenrioExportJmx.getJmx();
|
||||
public void syncScenario(LoadTestWithBLOBs loadTest, List<ApiLoadTest> apiLoadTests) {
|
||||
List<String> scenarioIds = apiLoadTests.stream()
|
||||
.filter(i -> i.getType().equals(ApiLoadType.SCENARIO.name()))
|
||||
.map(ApiLoadTest::getApiId)
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(scenarioIds)) {
|
||||
ApiScenarioBatchRequest scenarioRequest = new ApiScenarioBatchRequest();
|
||||
scenarioRequest.setIds(scenarioIds);
|
||||
List<ApiScenrioExportJmx> apiScenrioExportJmxes = apiAutomationService.exportJmx(scenarioRequest);
|
||||
|
||||
deleteLoadTestFiles(loadTest.getId());
|
||||
|
||||
apiScenrioExportJmxes.forEach(item -> {
|
||||
apiPerformanceService.UpdateVersion(loadTest.getId(), item.getId(), item.getVersion());
|
||||
saveJmxFile(item.getJmx(), item.getName(), loadTest.getProjectId(), loadTest.getId());
|
||||
saveOtherFile(item.getFileMetadataList(), loadTest.getId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void syncApiCase(LoadTestWithBLOBs loadTest, List<ApiLoadTest> apiLoadTests) {
|
||||
List<String> caseIds = apiLoadTests.stream()
|
||||
.filter(i -> i.getType().equals(ApiLoadType.API_CASE.name()))
|
||||
.map(ApiLoadTest::getApiId)
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(caseIds)) {
|
||||
ApiScenarioBatchRequest scenarioRequest = new ApiScenarioBatchRequest();
|
||||
scenarioRequest.setIds(caseIds);
|
||||
|
||||
List<JmxInfoDTO> jmxInfoDTOS = apiTestCaseService.exportJmx(caseIds, apiLoadTests.get(0).getEnvId());
|
||||
deleteLoadTestFiles(loadTest.getId());
|
||||
jmxInfoDTOS.forEach(item -> {
|
||||
apiPerformanceService.UpdateVersion(loadTest.getId(), item.getId(), item.getVersion());
|
||||
saveJmxFile(item.getXml(), item.getName(), loadTest.getProjectId(), loadTest.getId());
|
||||
saveBodyFile(item.getFileMetadataList(), loadTest.getId(), item.getId());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void saveJmxFile(String jmx, String name, String projectId, String loadTestId) {
|
||||
byte[] jmxBytes = jmx.getBytes(StandardCharsets.UTF_8);
|
||||
String jmxName = apiScenrioExportJmx.getName() + "_" + System.currentTimeMillis() + ".jmx";
|
||||
String jmxName = name + "_" + System.currentTimeMillis() + ".jmx";
|
||||
FileMetadata fileMetadata = fileService.saveFile(jmxBytes, jmxName, (long) jmxBytes.length);
|
||||
fileMetadata.setProjectId(projectId);
|
||||
saveLoadTestFile(fileMetadata, loadTestId, 0);
|
||||
|
@ -695,6 +721,14 @@ public class PerformanceTestService {
|
|||
}
|
||||
}
|
||||
|
||||
private void saveBodyFile(List<FileMetadata> fileNames, String loadTestId, String requestId) {
|
||||
for (int i = 0; i < fileNames.size(); i++) {
|
||||
String fileName = fileNames.get(i).getName();
|
||||
File file = FileUtils.getBodyFileByName(fileName, requestId);
|
||||
saveUploadFile(file, loadTestId, i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteLoadTestFiles(String testId) {
|
||||
List<FileMetadata> originFiles = getFileMetadataByTestId(testId);
|
||||
List<String> originFileIds = originFiles.stream().map(FileMetadata::getId).collect(Collectors.toList());
|
||||
|
@ -726,4 +760,24 @@ public class PerformanceTestService {
|
|||
loadTestFileMapper.insert(loadTestFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化场景与性能测试的关联关系
|
||||
*/
|
||||
public void initScenarioLoadTest() {
|
||||
LoadTestExample example = new LoadTestExample();
|
||||
example.createCriteria().andScenarioIdIsNotNull();
|
||||
List<LoadTest> loadTests = loadTestMapper.selectByExample(example);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ApiLoadTestMapper mapper = sqlSession.getMapper(ApiLoadTestMapper.class);
|
||||
loadTests.forEach(item -> {
|
||||
ApiLoadTest scenarioLoadTest = new ApiLoadTest();
|
||||
scenarioLoadTest.setType(ApiLoadType.SCENARIO.name());
|
||||
scenarioLoadTest.setApiId(item.getScenarioId());
|
||||
scenarioLoadTest.setApiVersion(item.getScenarioVersion() == null ? 0 : item.getScenarioVersion());
|
||||
scenarioLoadTest.setLoadTestId(item.getId());
|
||||
scenarioLoadTest.setId(UUID.randomUUID().toString());
|
||||
mapper.insert(scenarioLoadTest);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package io.metersphere.service;
|
||||
|
||||
import io.metersphere.base.domain.ApiLoadTest;
|
||||
import io.metersphere.base.domain.ApiLoadTestExample;
|
||||
import io.metersphere.base.mapper.ApiLoadTestMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiLoadTestMapper;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiPerformanceService {
|
||||
|
||||
@Resource
|
||||
private ApiLoadTestMapper apiLoadTestMapper;
|
||||
@Resource
|
||||
private ExtApiLoadTestMapper extApiLoadTestMapper;
|
||||
|
||||
public boolean isNeedUpdate(String loadTestId) {
|
||||
int count = extApiLoadTestMapper.countNeedUpdateApiCase(loadTestId);
|
||||
if (count > 0) {
|
||||
return true;
|
||||
}
|
||||
count = extApiLoadTestMapper.countNeedUpdateApiScenario(loadTestId);
|
||||
return count > 0 ? true : false;
|
||||
}
|
||||
|
||||
public List<ApiLoadTest> getByLoadTestId(String loadTestId) {
|
||||
ApiLoadTestExample example = new ApiLoadTestExample();
|
||||
example.createCriteria().andLoadTestIdEqualTo(loadTestId);
|
||||
return apiLoadTestMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public int UpdateVersion(String loadTestId, String apiId, int version) {
|
||||
ApiLoadTest apiLoadTest = new ApiLoadTest();
|
||||
apiLoadTest.setApiVersion(version);
|
||||
ApiLoadTestExample example = new ApiLoadTestExample();
|
||||
example.createCriteria()
|
||||
.andLoadTestIdEqualTo(loadTestId)
|
||||
.andApiIdEqualTo(apiId);
|
||||
return apiLoadTestMapper.updateByExampleSelective(apiLoadTest, example);
|
||||
}
|
||||
|
||||
public void add(List<ApiLoadTest> apiList, String loadTestId) {
|
||||
if (CollectionUtils.isNotEmpty(apiList)) {
|
||||
apiList.forEach(item -> {
|
||||
item.setId(UUID.randomUUID().toString());
|
||||
item.setLoadTestId(loadTestId);
|
||||
item.setApiVersion(0);
|
||||
apiLoadTestMapper.insert(item);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,4 +26,20 @@ CREATE TABLE `load_test_report_detail`
|
|||
)
|
||||
ENGINE = MyISAM
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE utf8mb4_general_ci;
|
||||
COLLATE utf8mb4_general_ci;
|
||||
|
||||
|
||||
-- 关联场景测试和性能测试,一键更新性能测试
|
||||
CREATE TABLE IF NOT EXISTS `api_load_test` (
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`api_id` varchar(255) NOT NULL COMMENT 'Relate resource id',
|
||||
`load_test_id` varchar(50) NOT NULL COMMENT 'Load Test id',
|
||||
`env_id` varchar(50) NULL COMMENT 'Api case env id',
|
||||
`type` varchar(20) NOT NULL COMMENT 'Api Type',
|
||||
`api_version` int(10) DEFAULT 0 NULL COMMENT 'Relate Scenario Version',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
|
||||
-- 添加版本号
|
||||
ALTER TABLE api_test_case
|
||||
ADD version INT(10) DEFAULT 0 NULL COMMENT '版本号';
|
||||
|
|
|
@ -979,6 +979,7 @@ export default {
|
|||
jmxObj.attachFiles = item.attachFiles;
|
||||
jmxObj.attachByteFiles = item.attachByteFiles;
|
||||
jmxObj.scenarioId = item.id;
|
||||
jmxObj.version = item.version;
|
||||
jmxObjList.push(jmxObj);
|
||||
});
|
||||
this.$store.commit('setScenarioJmxs', {
|
||||
|
|
|
@ -968,6 +968,8 @@ export default {
|
|||
jmxObj.attachFiles = response.data.attachFiles;
|
||||
jmxObj.attachByteFiles = response.data.attachByteFiles;
|
||||
jmxObj.caseId = reqObj.id;
|
||||
jmxObj.version = row.version;
|
||||
jmxObj.envId = environment.id;
|
||||
this.$store.commit('setTest', {
|
||||
name: row.name,
|
||||
jmx: jmxObj
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</el-link>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="ref">{{ $t('api_test.automation.view_ref') }}</el-dropdown-item>
|
||||
<el-dropdown-item :disabled="isCaseEdit" command="create_performance">{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
|
||||
<el-dropdown-item command="create_performance">{{ $t('api_test.create_performance_test') }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
<ms-reference-view ref="viewRef"/>
|
||||
</el-dropdown>
|
||||
|
@ -93,6 +93,8 @@
|
|||
jmxObj.attachFiles = response.data.attachFiles;
|
||||
jmxObj.attachByteFiles = response.data.attachByteFiles;
|
||||
jmxObj.caseId = reqObj.id;
|
||||
jmxObj.version = row.version;
|
||||
jmxObj.envId = this.environment;
|
||||
this.$store.commit('setTest', {
|
||||
name: row.name,
|
||||
jmx: jmxObj
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
v-permission="['PROJECT_PERFORMANCE_TEST:READ+SCHEDULE']"
|
||||
:check-open="checkScheduleEdit" :test-id="testId" :custom-validate="durationValidate"/>
|
||||
|
||||
<ms-tip-button v-if="test.scenarioId"
|
||||
<ms-tip-button v-if="test.isNeedUpdate"
|
||||
class="sync-btn" type="primary" size="small" circle
|
||||
icon="el-icon-connection"
|
||||
@click="syncScenario"
|
||||
|
@ -156,11 +156,24 @@ export default {
|
|||
if (apiTest.jmx.scenarioId) {
|
||||
this.$refs.basicConfig.importScenario(apiTest.jmx.scenarioId);
|
||||
this.$refs.basicConfig.handleUpload();
|
||||
this.$set(this.test, "scenarioId", apiTest.jmx.scenarioId);
|
||||
this.$set(this.test, "scenarioVersion", apiTest.jmx.version);
|
||||
let relateApiList = [];
|
||||
relateApiList.push({
|
||||
apiId : apiTest.jmx.scenarioId,
|
||||
apiVersion: apiTest.jmx.version,
|
||||
type: 'SCENARIO'
|
||||
});
|
||||
this.$set(this.test, "apiList", relateApiList);
|
||||
}
|
||||
if (apiTest.jmx.caseId) {
|
||||
this.$refs.basicConfig.importCase(apiTest.jmx);
|
||||
let relateApiList = [];
|
||||
relateApiList.push({
|
||||
apiId : apiTest.jmx.caseId,
|
||||
apiVersion: apiTest.jmx.version,
|
||||
envId: apiTest.jmx.envId,
|
||||
type: 'API_CASE'
|
||||
});
|
||||
this.$set(this.test, "apiList", relateApiList);
|
||||
}
|
||||
if (JSON.stringify(apiTest.jmx.attachFiles) !== "{}") {
|
||||
let attachFiles = [];
|
||||
|
@ -177,11 +190,17 @@ export default {
|
|||
let scenarioJmxs = this.$store.state.scenarioJmxs;
|
||||
if (scenarioJmxs && scenarioJmxs.name) {
|
||||
this.$set(this.test, "name", scenarioJmxs.name);
|
||||
let relateApiList = [];
|
||||
if (scenarioJmxs.jmxs) {
|
||||
scenarioJmxs.jmxs.forEach(item => {
|
||||
if (item.scenarioId) {
|
||||
this.$refs.basicConfig.importScenario(item.scenarioId);
|
||||
this.$refs.basicConfig.handleUpload();
|
||||
relateApiList.push({
|
||||
apiId : item.scenarioId,
|
||||
apiVersion: item.version,
|
||||
type: 'SCENARIO'
|
||||
});
|
||||
}
|
||||
if (item.caseId) {
|
||||
this.$refs.basicConfig.importCase(item);
|
||||
|
@ -195,6 +214,7 @@ export default {
|
|||
this.$refs.basicConfig.selectAttachFileById(attachFiles);
|
||||
}
|
||||
}
|
||||
this.$set(this.test, "apiList", relateApiList);
|
||||
});
|
||||
this.active = '1';
|
||||
this.$store.commit("clearScenarioJmxs");
|
||||
|
|
Loading…
Reference in New Issue