feat(接口定义): 优化接口类型/请求路径变更 用例同步变更。
This commit is contained in:
parent
d7b1bcd3eb
commit
55f8c30c0c
|
@ -10,7 +10,6 @@ public class ApiTestCaseDTO extends ApiTestCase {
|
|||
private String moduleId;
|
||||
private String path;
|
||||
private String protocol;
|
||||
private String casePath;
|
||||
private String updateUser;
|
||||
private String createUser;
|
||||
private String deleteUser;
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ApiDefinitionService {
|
|||
public List<ApiDefinitionResult> listBatch(ApiBatchRequest request) {
|
||||
ServiceUtils.getSelectAllIds(request, request.getCondition(),
|
||||
(query) -> extApiDefinitionMapper.selectIds(query));
|
||||
if(CollectionUtils.isEmpty(request.getIds())){
|
||||
if (CollectionUtils.isEmpty(request.getIds())) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listByIds(request.getIds());
|
||||
|
@ -213,7 +213,7 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
public void removeToGc(List<String> apiIds) {
|
||||
if(CollectionUtils.isEmpty(apiIds)){
|
||||
if (CollectionUtils.isEmpty(apiIds)) {
|
||||
return;
|
||||
}
|
||||
ApiDefinitionExampleWithOperation example = new ApiDefinitionExampleWithOperation();
|
||||
|
@ -223,7 +223,7 @@ public class ApiDefinitionService {
|
|||
extApiDefinitionMapper.removeToGcByExample(example);
|
||||
|
||||
List<String> apiCaseIds = apiTestCaseService.selectCaseIdsByApiIds(apiIds);
|
||||
if(CollectionUtils.isNotEmpty(apiCaseIds)){
|
||||
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
|
||||
ApiTestBatchRequest apiTestBatchRequest = new ApiTestBatchRequest();
|
||||
apiTestBatchRequest.setIds(apiCaseIds);
|
||||
apiTestBatchRequest.setUnSelectIds(new ArrayList<>());
|
||||
|
@ -237,34 +237,34 @@ public class ApiDefinitionService {
|
|||
if (request.getIds() != null || !request.getIds().isEmpty()) {
|
||||
//检查模块是否还在
|
||||
|
||||
//检查原来模块是否还在
|
||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
example.createCriteria().andIdIn(request.getIds());
|
||||
List<ApiDefinition> reductionCaseList = apiDefinitionMapper.selectByExample(example);
|
||||
Map<String,List<ApiDefinition>> nodeMap = reductionCaseList.stream().collect(Collectors.groupingBy(ApiDefinition :: getModuleId));
|
||||
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
for(Map.Entry<String,List<ApiDefinition>> entry : nodeMap.entrySet()){
|
||||
String nodeId = entry.getKey();
|
||||
long nodeCount = apiModuleService.countById(nodeId);
|
||||
if(nodeCount <= 0){
|
||||
String projectId = request.getProjectId();
|
||||
ApiModule node = apiModuleService.getDefaultNode(projectId,request.getProtocol());
|
||||
List<ApiDefinition> testCaseList = entry.getValue();
|
||||
for (ApiDefinition apiDefinition: testCaseList) {
|
||||
ApiDefinitionWithBLOBs updateCase = new ApiDefinitionWithBLOBs();
|
||||
updateCase.setId(apiDefinition.getId());
|
||||
updateCase.setModuleId(node.getId());
|
||||
updateCase.setModulePath("/"+node.getName());
|
||||
//检查原来模块是否还在
|
||||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
example.createCriteria().andIdIn(request.getIds());
|
||||
List<ApiDefinition> reductionCaseList = apiDefinitionMapper.selectByExample(example);
|
||||
Map<String, List<ApiDefinition>> nodeMap = reductionCaseList.stream().collect(Collectors.groupingBy(ApiDefinition::getModuleId));
|
||||
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
for (Map.Entry<String, List<ApiDefinition>> entry : nodeMap.entrySet()) {
|
||||
String nodeId = entry.getKey();
|
||||
long nodeCount = apiModuleService.countById(nodeId);
|
||||
if (nodeCount <= 0) {
|
||||
String projectId = request.getProjectId();
|
||||
ApiModule node = apiModuleService.getDefaultNode(projectId, request.getProtocol());
|
||||
List<ApiDefinition> testCaseList = entry.getValue();
|
||||
for (ApiDefinition apiDefinition : testCaseList) {
|
||||
ApiDefinitionWithBLOBs updateCase = new ApiDefinitionWithBLOBs();
|
||||
updateCase.setId(apiDefinition.getId());
|
||||
updateCase.setModuleId(node.getId());
|
||||
updateCase.setModulePath("/" + node.getName());
|
||||
|
||||
apiDefinitionMapper.updateByPrimaryKeySelective(updateCase);
|
||||
}
|
||||
apiDefinitionMapper.updateByPrimaryKeySelective(updateCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
extApiDefinitionMapper.checkOriginalStatusByIds(request.getIds());
|
||||
extApiDefinitionMapper.reduction(request.getIds());
|
||||
|
||||
List<String> apiCaseIds = apiTestCaseService.selectCaseIdsByApiIds(request.getIds());
|
||||
if(CollectionUtils.isNotEmpty(apiCaseIds)){
|
||||
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
|
||||
ApiTestBatchRequest apiTestBatchRequest = new ApiTestBatchRequest();
|
||||
apiTestBatchRequest.setIds(apiCaseIds);
|
||||
apiTestBatchRequest.setUnSelectIds(new ArrayList<>());
|
||||
|
@ -330,7 +330,7 @@ public class ApiDefinitionService {
|
|||
if (StringUtils.equals(request.getMethod(), "ESB")) {
|
||||
//ESB的接口类型数据,采用TCP方式去发送。并将方法类型改为TCP。 并修改发送数据
|
||||
request = esbApiParamService.handleEsbRequest(request);
|
||||
}else if(StringUtils.equals(request.getMethod(), "TCP")) {
|
||||
} else if (StringUtils.equals(request.getMethod(), "TCP")) {
|
||||
request = tcpApiParamService.handleTcpRequest(request);
|
||||
}
|
||||
final ApiDefinitionWithBLOBs test = new ApiDefinitionWithBLOBs();
|
||||
|
@ -357,6 +357,11 @@ public class ApiDefinitionService {
|
|||
}
|
||||
this.setModule(test);
|
||||
apiDefinitionMapper.updateByPrimaryKeySelective(test);
|
||||
// 同步修改用例
|
||||
List<String> ids = new ArrayList<>();
|
||||
ids.add(request.getId());
|
||||
apiTestCaseService.updateByApiDefinitionId(ids, test.getPath(), test.getMethod(), test.getProtocol());
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
|
@ -532,7 +537,7 @@ public class ApiDefinitionService {
|
|||
if (i == 0) {
|
||||
nextNum = apiTestCaseService.getNextNum(item.getApiDefinitionId());
|
||||
} else {
|
||||
nextNum ++;
|
||||
nextNum++;
|
||||
}
|
||||
checkRequest.setName(item.getName());
|
||||
checkRequest.setApiDefinitionId(item.getApiDefinitionId());
|
||||
|
@ -644,10 +649,10 @@ public class ApiDefinitionService {
|
|||
}
|
||||
|
||||
|
||||
try{
|
||||
try {
|
||||
//检查TCP数据结构,等其他进行处理
|
||||
tcpApiParamService.checkTestElement(request.getTestElement());
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
HashTree hashTree = request.getTestElement().generateHashTree(config);
|
||||
|
@ -850,6 +855,10 @@ public class ApiDefinitionService {
|
|||
BeanUtils.copyBean(definitionWithBLOBs, request);
|
||||
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||
apiDefinitionMapper.updateByExampleSelective(definitionWithBLOBs, getBatchExample(request));
|
||||
|
||||
// 同步修改用例
|
||||
apiTestCaseService.updateByApiDefinitionId(request.getIds(), request.getPath(), request.getMethod(), request.getProtocol());
|
||||
|
||||
}
|
||||
|
||||
public void testPlanRelevance(ApiCaseRelevanceRequest request) {
|
||||
|
@ -1042,6 +1051,7 @@ public class ApiDefinitionService {
|
|||
|
||||
/**
|
||||
* 列表开关切换
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
public void switchSchedule(Schedule request) {
|
||||
|
@ -1281,7 +1291,7 @@ public class ApiDefinitionService {
|
|||
List<ApiDefinition> apiList = apiDefinitionMapper.selectByExample(apiDefinitionExample);
|
||||
List<String> apiIdList = new ArrayList<>();
|
||||
apiList.forEach(item -> {
|
||||
apiIdList.add(item.getId());
|
||||
apiIdList.add(item.getId());
|
||||
});
|
||||
this.removeToGc(apiIdList);
|
||||
}
|
||||
|
|
|
@ -508,7 +508,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);
|
||||
}
|
||||
this.deleteBatch(ids);
|
||||
}
|
||||
|
@ -516,7 +516,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);
|
||||
}
|
||||
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
|
||||
apiDefinitionExample.createCriteria().andIdIn(ids);
|
||||
|
@ -526,39 +526,6 @@ public class ApiTestCaseService {
|
|||
apiDefinitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||
apiTestCaseMapper.updateByExampleSelective(apiDefinitionWithBLOBs, apiDefinitionExample);
|
||||
}
|
||||
if ((StringUtils.isNotEmpty(request.getMethod()) || StringUtils.isNotEmpty(request.getPath())) && RequestType.HTTP.equals(request.getProtocol())) {
|
||||
List<ApiTestCaseWithBLOBs> bloBs = apiTestCaseMapper.selectByExampleWithBLOBs(apiDefinitionExample);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ApiTestCaseMapper batchMapper = sqlSession.getMapper(ApiTestCaseMapper.class);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
bloBs.forEach(apiTestCase -> {
|
||||
MsHTTPSamplerProxy req = JSON.parseObject(apiTestCase.getRequest(), MsHTTPSamplerProxy.class);
|
||||
try {
|
||||
JSONObject element = JSON.parseObject(apiTestCase.getRequest());
|
||||
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
|
||||
});
|
||||
req.setHashTree(elements);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getMethod())) {
|
||||
req.setMethod(request.getMethod());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getPath())) {
|
||||
req.setPath(request.getPath());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e.getMessage());
|
||||
}
|
||||
String requestStr = JSON.toJSONString(req);
|
||||
apiTestCase.setRequest(requestStr);
|
||||
batchMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
|
||||
}
|
||||
if (StringUtils.isNotEmpty(request.getEnvId())) {
|
||||
List<ApiTestCaseWithBLOBs> bloBs = apiTestCaseMapper.selectByExampleWithBLOBs(apiDefinitionExample);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
|
@ -577,7 +544,44 @@ 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) {
|
||||
public void updateByApiDefinitionId(List<String> ids, String path, String method, String protocol) {
|
||||
if ((StringUtils.isNotEmpty(method) || StringUtils.isNotEmpty(path) && RequestType.HTTP.equals(protocol))) {
|
||||
ApiTestCaseExample apiDefinitionExample = new ApiTestCaseExample();
|
||||
apiDefinitionExample.createCriteria().andApiDefinitionIdIn(ids);
|
||||
List<ApiTestCaseWithBLOBs> bloBs = apiTestCaseMapper.selectByExampleWithBLOBs(apiDefinitionExample);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
ApiTestCaseMapper batchMapper = sqlSession.getMapper(ApiTestCaseMapper.class);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
bloBs.forEach(apiTestCase -> {
|
||||
MsHTTPSamplerProxy req = JSON.parseObject(apiTestCase.getRequest(), MsHTTPSamplerProxy.class);
|
||||
try {
|
||||
JSONObject element = JSON.parseObject(apiTestCase.getRequest());
|
||||
if (element != null && StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
|
||||
});
|
||||
req.setHashTree(elements);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(method)) {
|
||||
req.setMethod(method);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(path)) {
|
||||
req.setPath(path);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e.getMessage());
|
||||
}
|
||||
String requestStr = JSON.toJSONString(req);
|
||||
apiTestCase.setRequest(requestStr);
|
||||
batchMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
ApiTestCaseRequest selectRequest = new ApiTestCaseRequest();
|
||||
selectRequest.setFilters(filters);
|
||||
selectRequest.setModuleIds(moduleIds);
|
||||
|
@ -711,9 +715,9 @@ public class ApiTestCaseService {
|
|||
request.setIds(ids);
|
||||
}
|
||||
List<ApiTestCaseInfo> list = null;
|
||||
if(StringUtils.isEmpty(request.getId()) && CollectionUtils.isEmpty(request.getIds())){
|
||||
if (StringUtils.isEmpty(request.getId()) && CollectionUtils.isEmpty(request.getIds())) {
|
||||
list = new ArrayList<>();
|
||||
}else {
|
||||
} else {
|
||||
list = extApiTestCaseMapper.getCaseInfo(request);
|
||||
}
|
||||
for (ApiTestCaseInfo model : list) {
|
||||
|
@ -784,7 +788,7 @@ public class ApiTestCaseService {
|
|||
}
|
||||
|
||||
public void deleteToGc(List<String> ids) {
|
||||
if(CollectionUtils.isNotEmpty(ids)){
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
ApiTestCaseRequest request = new ApiTestCaseRequest();
|
||||
request.setIds(ids);
|
||||
request.setDeleteUserId(SessionUtils.getUserId());
|
||||
|
@ -796,7 +800,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());
|
||||
}
|
||||
this.deleteToGc(ids);
|
||||
}
|
||||
|
@ -804,22 +808,22 @@ 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);
|
||||
}
|
||||
|
||||
List<String> cannotReductionAPiName = new ArrayList<>();
|
||||
if(CollectionUtils.isNotEmpty(ids)){
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
List<ApiTestCaseDTO> cannotReductionApiCaseList = extApiTestCaseMapper.getCannotReductionApiCaseList(ids);
|
||||
List<String> cannotReductionCaseId = new ArrayList<>();
|
||||
for (ApiTestCaseDTO apiTestCaseDTO:cannotReductionApiCaseList) {
|
||||
if(!cannotReductionAPiName.contains(apiTestCaseDTO.getApiName())){
|
||||
for (ApiTestCaseDTO apiTestCaseDTO : cannotReductionApiCaseList) {
|
||||
if (!cannotReductionAPiName.contains(apiTestCaseDTO.getApiName())) {
|
||||
cannotReductionAPiName.add(apiTestCaseDTO.getApiName());
|
||||
}
|
||||
cannotReductionCaseId.add(apiTestCaseDTO.getId());
|
||||
}
|
||||
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)){
|
||||
if (CollectionUtils.isNotEmpty(deleteIds)) {
|
||||
extApiTestCaseMapper.checkOriginalStatusByIds(deleteIds);
|
||||
extApiTestCaseMapper.reduction(deleteIds);
|
||||
}
|
||||
|
@ -828,9 +832,9 @@ public class ApiTestCaseService {
|
|||
}
|
||||
|
||||
public List<String> selectCaseIdsByApiIds(List<String> apiIds) {
|
||||
if(CollectionUtils.isEmpty(apiIds)){
|
||||
return new ArrayList<>(0);
|
||||
}else {
|
||||
if (CollectionUtils.isEmpty(apiIds)) {
|
||||
return new ArrayList<>(0);
|
||||
} else {
|
||||
return extApiTestCaseMapper.selectCaseIdsByApiIds(apiIds);
|
||||
}
|
||||
}
|
||||
|
@ -838,43 +842,43 @@ 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());
|
||||
}
|
||||
DeleteCheckResult result = new DeleteCheckResult();
|
||||
List<String> checkMsgList = new ArrayList<>();
|
||||
|
||||
if(CollectionUtils.isNotEmpty(deleteIds)){
|
||||
if (CollectionUtils.isNotEmpty(deleteIds)) {
|
||||
List<ApiScenarioReferenceId> apiScenarioReferenceIdList = apiScenarioReferenceIdService.findByReferenceIdsAndRefType(deleteIds, MsTestElementConstants.REF.name());
|
||||
if(CollectionUtils.isNotEmpty(apiScenarioReferenceIdList)){
|
||||
Map<String,List<String>> scenarioDic = new HashMap<>();
|
||||
apiScenarioReferenceIdList.forEach( item ->{
|
||||
if (CollectionUtils.isNotEmpty(apiScenarioReferenceIdList)) {
|
||||
Map<String, List<String>> scenarioDic = new HashMap<>();
|
||||
apiScenarioReferenceIdList.forEach(item -> {
|
||||
String refreceID = item.getReferenceId();
|
||||
String scenarioId = item.getApiScenarioId();
|
||||
if(scenarioDic.containsKey(refreceID)){
|
||||
if (scenarioDic.containsKey(refreceID)) {
|
||||
scenarioDic.get(refreceID).add(scenarioId);
|
||||
}else {
|
||||
} else {
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add(scenarioId);
|
||||
scenarioDic.put(refreceID,list);
|
||||
scenarioDic.put(refreceID, list);
|
||||
}
|
||||
});
|
||||
|
||||
for (Map.Entry<String,List<String>> entry : scenarioDic.entrySet()){
|
||||
for (Map.Entry<String, List<String>> entry : scenarioDic.entrySet()) {
|
||||
String refreceId = entry.getKey();
|
||||
List<String> scenarioIdList = entry.getValue();
|
||||
if(CollectionUtils.isNotEmpty(scenarioIdList)){
|
||||
if (CollectionUtils.isNotEmpty(scenarioIdList)) {
|
||||
List<String> scenarioNameList = extApiScenarioMapper.selectNameByIdIn(scenarioIdList);
|
||||
String deleteCaseName = extApiTestCaseMapper.selectNameById(refreceId);
|
||||
|
||||
if(StringUtils.isNotEmpty(deleteCaseName) && CollectionUtils.isNotEmpty(scenarioNameList)){
|
||||
if (StringUtils.isNotEmpty(deleteCaseName) && CollectionUtils.isNotEmpty(scenarioNameList)) {
|
||||
String nameListStr = "【";
|
||||
for (String name : scenarioNameList) {
|
||||
nameListStr+= name +",";
|
||||
nameListStr += name + ",";
|
||||
}
|
||||
if(nameListStr.length() > 1){
|
||||
nameListStr = nameListStr.substring(0,nameListStr.length()-1) + "】";
|
||||
if (nameListStr.length() > 1) {
|
||||
nameListStr = nameListStr.substring(0, nameListStr.length() - 1) + "】";
|
||||
}
|
||||
String msg = deleteCaseName+" "+Translator.get("delete_check_reference_by")+": "+nameListStr+" ";
|
||||
String msg = deleteCaseName + " " + Translator.get("delete_check_reference_by") + ": " + nameListStr + " ";
|
||||
checkMsgList.add(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@
|
|||
<select id="listSimple" resultType="io.metersphere.api.dto.definition.ApiTestCaseDTO">
|
||||
select
|
||||
t1.id, t1.project_id, t1.name, t1.api_definition_id, t1.priority, t1.description, t1.create_user_id, t1.update_user_id, t1.create_time, t1.update_time, t1.num,
|
||||
a.module_id, a.path, a.protocol, t1.tags,TRIM('"' from JSON_EXTRACT(t1.request, '$.path') )as casePath,
|
||||
a.module_id, a.path, a.protocol, t1.tags,
|
||||
t1.delete_time, deleteUser.name AS deleteUser
|
||||
from
|
||||
api_test_case t1
|
||||
|
|
|
@ -102,9 +102,7 @@ export default {
|
|||
},
|
||||
api: {},
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'path', name: this.$t('api_test.request.path')},
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')}
|
||||
],
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
|
|
|
@ -83,14 +83,6 @@
|
|||
:fields-width="fieldsWidth"
|
||||
:label="'API'+ $t('api_test.definition.api_path')"/>
|
||||
|
||||
<ms-table-column
|
||||
sortable
|
||||
prop="casePath"
|
||||
min-width="180px"
|
||||
:field="item"
|
||||
:fields-width="fieldsWidth"
|
||||
:label="$t('api_test.definition.request.case')+ $t('api_test.definition.api_path')"/>
|
||||
|
||||
<ms-table-column v-if="item.id=='tags'" prop="tags" width="120px" :label="$t('commons.tag')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag v-for="(itemName,index) in scope.row.tags" :key="index" type="success" effect="plain"
|
||||
|
@ -269,9 +261,7 @@ export default {
|
|||
},
|
||||
],
|
||||
typeArr: [
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')},
|
||||
{id: 'method', name: this.$t('api_test.definition.api_type')},
|
||||
{id: 'path', name: this.$t('api_test.request.path')},
|
||||
{id: 'priority', name: this.$t('test_track.case.priority')}
|
||||
],
|
||||
priorityFilters: [
|
||||
{text: 'P0', value: 'P0'},
|
||||
|
|
Loading…
Reference in New Issue