fix(测试计划): 脑图保存根节点被删除问题

This commit is contained in:
guoyuqi 2024-06-19 11:00:12 +08:00 committed by Craftsman
parent b5a292e4a3
commit df335e5f89
4 changed files with 116 additions and 37 deletions

View File

@ -621,16 +621,16 @@ public class FunctionalCaseMinderService {
FunctionalCase functionalCase = addCase(request, userId, functionalCaseChangeRequest, caseMapper, sourceIdAndInsertModuleIdMap); FunctionalCase functionalCase = addCase(request, userId, functionalCaseChangeRequest, caseMapper, sourceIdAndInsertModuleIdMap);
String caseId = functionalCase.getId(); String caseId = functionalCase.getId();
sourceIdAndInsertCaseIdMap.put(functionalCaseChangeRequest.getId(), caseId); sourceIdAndInsertCaseIdMap.put(functionalCaseChangeRequest.getId(), caseId);
//保存用例等级
FunctionalCaseCustomField customField = new FunctionalCaseCustomField();
customField.setCaseId(caseId);
customField.setFieldId(defaultCustomFieldValueMap.get("priorityFieldId").toString());
customField.setValue("P"+functionalCaseChangeRequest.getPriority());
caseCustomFieldMapper.insertSelective(customField);
//附属表 //附属表
FunctionalCaseBlob functionalCaseBlob = addCaseBlob(functionalCaseChangeRequest, caseId, caseBlobMapper); FunctionalCaseBlob functionalCaseBlob = addCaseBlob(functionalCaseChangeRequest, caseId, caseBlobMapper);
//保存自定义字段 //保存自定义字段
List<FunctionalCaseCustomField> functionalCaseCustomFields = addCustomFields(functionalCaseChangeRequest, caseId, caseCustomFieldMapper, defaultCustomFieldValueMap); List<FunctionalCaseCustomField> functionalCaseCustomFields = addCustomFields(functionalCaseChangeRequest, caseId, caseCustomFieldMapper, defaultCustomFieldValueMap);
//保存用例等级
FunctionalCaseCustomField customField = new FunctionalCaseCustomField();
customField.setCaseId(caseId);
customField.setFieldId(defaultCustomFieldValueMap.get("priorityFieldId").toString());
customField.setValue("P"+(functionalCaseChangeRequest.getPriority()-1));
caseCustomFieldMapper.insertSelective(customField);
//日志 //日志
FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, functionalCaseBlob, functionalCaseCustomFields, new ArrayList<>(), new ArrayList<>()); FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, functionalCaseBlob, functionalCaseCustomFields, new ArrayList<>(), new ArrayList<>());
LogDTO logDTO = addLog(request, userId, caseId, historyLogDTO, null); LogDTO logDTO = addLog(request, userId, caseId, historyLogDTO, null);
@ -668,7 +668,7 @@ public class FunctionalCaseMinderService {
FunctionalCaseCustomField customField = new FunctionalCaseCustomField(); FunctionalCaseCustomField customField = new FunctionalCaseCustomField();
customField.setCaseId(caseId); customField.setCaseId(caseId);
customField.setFieldId(defaultCustomFieldValueMap.get("priorityFieldId").toString()); customField.setFieldId(defaultCustomFieldValueMap.get("priorityFieldId").toString());
customField.setValue("P"+functionalCaseChangeRequest.getPriority()); customField.setValue("P"+(functionalCaseChangeRequest.getPriority()-1));
caseCustomFieldMapper.updateByPrimaryKeySelective(customField); caseCustomFieldMapper.updateByPrimaryKeySelective(customField);
//日志 //日志
FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, functionalCaseBlob, oldCaseCustomFieldMap.get(caseId), new ArrayList<>(), new ArrayList<>()); FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, functionalCaseBlob, oldCaseCustomFieldMap.get(caseId), new ArrayList<>(), new ArrayList<>());
@ -1060,7 +1060,7 @@ public class FunctionalCaseMinderService {
List<String> list = customFields.stream().map(CaseCustomFieldDTO::getFieldId).toList(); List<String> list = customFields.stream().map(CaseCustomFieldDTO::getFieldId).toList();
List<CaseCustomFieldDTO> customFieldDTOs = new ArrayList<>(); List<CaseCustomFieldDTO> customFieldDTOs = new ArrayList<>();
defaultValueMap.forEach((k, v) -> { defaultValueMap.forEach((k, v) -> {
if (!list.contains(k)) { if (!list.contains(k) && !StringUtils.equalsIgnoreCase(k,"priorityFieldId")) {
CaseCustomFieldDTO customFieldDTO = new CaseCustomFieldDTO(); CaseCustomFieldDTO customFieldDTO = new CaseCustomFieldDTO();
customFieldDTO.setFieldId(k); customFieldDTO.setFieldId(k);
customFieldDTO.setValue(v.toString()); customFieldDTO.setValue(v.toString());

View File

@ -5,10 +5,7 @@ import io.metersphere.functional.dto.CaseCustomFieldDTO;
import io.metersphere.functional.dto.FunctionalCaseStepDTO; import io.metersphere.functional.dto.FunctionalCaseStepDTO;
import io.metersphere.functional.dto.FunctionalMinderTreeDTO; import io.metersphere.functional.dto.FunctionalMinderTreeDTO;
import io.metersphere.functional.dto.MinderOptionDTO; import io.metersphere.functional.dto.MinderOptionDTO;
import io.metersphere.functional.mapper.FunctionalCaseBlobMapper; import io.metersphere.functional.mapper.*;
import io.metersphere.functional.mapper.FunctionalCaseMapper;
import io.metersphere.functional.mapper.FunctionalCaseModuleMapper;
import io.metersphere.functional.mapper.MindAdditionalNodeMapper;
import io.metersphere.functional.request.*; import io.metersphere.functional.request.*;
import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.JSON;
import io.metersphere.sdk.util.Translator; import io.metersphere.sdk.util.Translator;
@ -58,6 +55,8 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
private FunctionalCaseModuleMapper functionalCaseModuleMapper; private FunctionalCaseModuleMapper functionalCaseModuleMapper;
@Resource @Resource
private MindAdditionalNodeMapper mindAdditionalNodeMapper; private MindAdditionalNodeMapper mindAdditionalNodeMapper;
@Resource
private FunctionalCaseCustomFieldMapper functionalCaseCustomFieldMapper;
@Test @Test
@Order(1) @Order(1)
@ -165,7 +164,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
caseChangeRequest.setName("新增用例"); caseChangeRequest.setName("新增用例");
caseChangeRequest.setModuleId("TEST_MINDER_MODULE_ID_GYQ2"); caseChangeRequest.setModuleId("TEST_MINDER_MODULE_ID_GYQ2");
caseChangeRequest.setMoveMode("AFTER"); caseChangeRequest.setMoveMode("AFTER");
caseChangeRequest.setPriority(2); caseChangeRequest.setPriority(3);
caseChangeRequest.setTargetId("TEST_FUNCTIONAL_MINDER_CASE_ID_3"); caseChangeRequest.setTargetId("TEST_FUNCTIONAL_MINDER_CASE_ID_3");
caseChangeRequest.setTemplateId("100001"); caseChangeRequest.setTemplateId("100001");
caseChangeRequest.setType("ADD"); caseChangeRequest.setType("ADD");
@ -183,7 +182,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
caseChangeRequest.setName("TEST_MINDER_MODULE_ID_GYQ_更新"); caseChangeRequest.setName("TEST_MINDER_MODULE_ID_GYQ_更新");
caseChangeRequest.setModuleId("TEST_MINDER_MODULE_ID_GYQ"); caseChangeRequest.setModuleId("TEST_MINDER_MODULE_ID_GYQ");
caseChangeRequest.setTemplateId("100001"); caseChangeRequest.setTemplateId("100001");
caseChangeRequest.setPriority(2); caseChangeRequest.setPriority(3);
caseChangeRequest.setMoveMode("BEFORE"); caseChangeRequest.setMoveMode("BEFORE");
caseChangeRequest.setTargetId("TEST_FUNCTIONAL_MINDER_CASE_ID_2"); caseChangeRequest.setTargetId("TEST_FUNCTIONAL_MINDER_CASE_ID_2");
caseChangeRequest.setType("UPDATE"); caseChangeRequest.setType("UPDATE");
@ -251,6 +250,10 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample); List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
Assertions.assertTrue(functionalCases.get(0).getPos() > 0L); Assertions.assertTrue(functionalCases.get(0).getPos() > 0L);
FunctionalCaseCustomFieldExample customFieldExample = new FunctionalCaseCustomFieldExample();
customFieldExample.createCriteria().andCaseIdEqualTo(functionalCases.get(0).getId()).andFieldIdEqualTo("custom_field_minder_gyq_id_3");
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.get(0).getValue(),"P2"));
FunctionalCaseModuleExample functionalCaseModuleExample = new FunctionalCaseModuleExample(); FunctionalCaseModuleExample functionalCaseModuleExample = new FunctionalCaseModuleExample();
functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9"); functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9");
List<FunctionalCaseModule> functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample); List<FunctionalCaseModule> functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample);

View File

@ -284,13 +284,14 @@ public class TestPlanCollectionMinderService {
} }
private Map<String, List<String>> dealUpdateList(TestPlanCollectionMinderEditRequest request, String userId, Map<String, List<BaseCollectionAssociateRequest>> associateMap, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) { private Map<String, List<String>> dealUpdateList(TestPlanCollectionMinderEditRequest request, String userId, Map<String, List<BaseCollectionAssociateRequest>> associateMap, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
List<TestPlanCollectionMinderEditDTO> updateList = request.getEditList().stream().filter(t -> StringUtils.isNotBlank(t.getId()) && t.getLevel() == 2).toList(); List<TestPlanCollectionMinderEditDTO> updateList = request.getEditList().stream().filter(t -> StringUtils.isNotBlank(t.getId())).toList();
Map<String, List<String>> typeNamesMap = new HashMap<>(); Map<String, List<String>> typeNamesMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(updateList)) { if (CollectionUtils.isNotEmpty(updateList)) {
//处理删除 //处理删除
deleteCollection(updateList, request.getPlanId()); deleteCollection(updateList, request.getPlanId());
//处理更新 //处理更新
for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : updateList) { List<TestPlanCollectionMinderEditDTO> collect = updateList.stream().filter(t -> t.getLevel() == 2).toList();
for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : collect) {
TestPlanCollection testPlanCollection = updateCollection(request, userId, testPlanCollectionMinderEditDTO, parentMap, collectionMapper); TestPlanCollection testPlanCollection = updateCollection(request, userId, testPlanCollectionMinderEditDTO, parentMap, collectionMapper);
checkChangeDataRepeat(typeNamesMap, testPlanCollection); checkChangeDataRepeat(typeNamesMap, testPlanCollection);
setAssociateMap(testPlanCollectionMinderEditDTO, associateMap, testPlanCollection); setAssociateMap(testPlanCollectionMinderEditDTO, associateMap, testPlanCollection);
@ -340,26 +341,35 @@ public class TestPlanCollectionMinderService {
@NotNull @NotNull
private Map<String, List<TestPlanCollection>> getParentMap(TestPlanCollectionMinderEditRequest request) { private Map<String, List<TestPlanCollection>> getParentMap(TestPlanCollectionMinderEditRequest request) {
TestPlanCollectionExample testPlanCollectionExample = new TestPlanCollectionExample(); List<TestPlanCollectionMinderEditDTO> list = request.getEditList().stream().filter(t -> StringUtils.isNotBlank(t.getId()) && t.getLevel() == 1).toList();
testPlanCollectionExample.createCriteria().andTestPlanIdEqualTo(request.getPlanId()).andParentIdEqualTo(ModuleConstants.ROOT_NODE_PARENT_ID); List<TestPlanCollection>parentList = new ArrayList<>();
List<TestPlanCollection> testPlanCollections = testPlanCollectionMapper.selectByExample(testPlanCollectionExample); for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : list) {
return testPlanCollections.stream().collect(Collectors.groupingBy(TestPlanCollection::getType)); TestPlanCollection testPlanCollection = new TestPlanCollection();
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
parentList.add(testPlanCollection);
}
return parentList.stream().collect(Collectors.groupingBy(TestPlanCollection::getType));
} }
@NotNull @NotNull
private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) { private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
TestPlanCollection testPlanCollection = new TestPlanCollection(); TestPlanCollection testPlanCollection = new TestPlanCollection();
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
testPlanCollection.setId(testPlanCollectionMinderEditDTO.getId());
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
testPlanCollection.setTestPlanId(request.getPlanId());
testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());
TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).get(0); TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).get(0);
if (StringUtils.equalsIgnoreCase(parent.getId(), testPlanCollectionMinderEditDTO.getId())) { if (StringUtils.equalsIgnoreCase(parent.getId(), testPlanCollectionMinderEditDTO.getId())) {
testPlanCollection.setParentId(parent.getParentId()); testPlanCollection.setParentId(parent.getParentId());
} else { } else {
testPlanCollection.setParentId(parent.getId()); testPlanCollection.setParentId(parent.getId());
} }
if (testPlanCollectionMinderEditDTO.getExtended()) {
BeanUtils.copyBean(testPlanCollection, parent);
} else {
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
}
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
testPlanCollection.setTestPlanId(request.getPlanId());
testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());
testPlanCollection.setId(testPlanCollectionMinderEditDTO.getId());
testPlanCollection.setCreateUser(userId); testPlanCollection.setCreateUser(userId);
testPlanCollection.setCreateTime(null); testPlanCollection.setCreateTime(null);
testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum()); testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum());
@ -369,19 +379,24 @@ public class TestPlanCollectionMinderService {
@NotNull @NotNull
private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) { private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
TestPlanCollection testPlanCollection = new TestPlanCollection();
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
testPlanCollection.setId(IDGenerator.nextStr());
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
testPlanCollection.setTestPlanId(request.getPlanId());
testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());
List<TestPlanCollection> testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType()); List<TestPlanCollection> testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType());
TestPlanCollection parent = null;
TestPlanCollection testPlanCollection = new TestPlanCollection();
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
if (CollectionUtils.isNotEmpty(testPlanCollections)) { if (CollectionUtils.isNotEmpty(testPlanCollections)) {
TestPlanCollection parent = testPlanCollections.get(0); parent = testPlanCollections.get(0);
testPlanCollection.setParentId(parent.getId()); testPlanCollection.setParentId(parent.getId());
} else { } else {
testPlanCollection.setParentId(CommonConstants.DEFAULT_NULL_VALUE); testPlanCollection.setParentId(CommonConstants.DEFAULT_NULL_VALUE);
} }
if (testPlanCollectionMinderEditDTO.getExtended() && parent!=null) {
BeanUtils.copyBean(testPlanCollection, parent);
} else {
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
}
testPlanCollection.setId(IDGenerator.nextStr());
testPlanCollection.setTestPlanId(request.getPlanId());
testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());
testPlanCollection.setCreateUser(userId); testPlanCollection.setCreateUser(userId);
testPlanCollection.setCreateTime(System.currentTimeMillis()); testPlanCollection.setCreateTime(System.currentTimeMillis());
testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum()); testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum());

View File

@ -59,6 +59,60 @@ public class TestPlanCollectionMinderControllerTests extends BaseTest {
void editMind() throws Exception { void editMind() throws Exception {
TestPlanCollectionMinderEditRequest request = new TestPlanCollectionMinderEditRequest(); TestPlanCollectionMinderEditRequest request = new TestPlanCollectionMinderEditRequest();
request.setPlanId("gyq_plan_1"); request.setPlanId("gyq_plan_1");
List<TestPlanCollectionMinderEditDTO> parentList = new ArrayList<>();
TestPlanCollectionMinderEditDTO funcParent = new TestPlanCollectionMinderEditDTO();
funcParent.setId("gyq_wxxx_2");
funcParent.setText("功能用例");
funcParent.setNum(2L);
funcParent.setExecuteMethod("PARALLEL");
funcParent.setType("FUNCTIONAL");
funcParent.setExtended(false);
funcParent.setGrouped(false);
funcParent.setLevel(1);
funcParent.setEnvironmentId("gyq_123");
funcParent.setTestResourcePoolId("gyq_123_pool");
funcParent.setRetryOnFail(true);
funcParent.setRetryType("SCENARIO");
funcParent.setRetryTimes(5);
funcParent.setRetryInterval(1000);
funcParent.setStopOnFail(true);
parentList.add(funcParent);
TestPlanCollectionMinderEditDTO apiParent = new TestPlanCollectionMinderEditDTO();
apiParent.setId("gyq_wxxx_1");
apiParent.setText("接口用例");
apiParent.setNum(1L);
apiParent.setExecuteMethod("PARALLEL");
apiParent.setType("API");
apiParent.setExtended(false);
apiParent.setGrouped(false);
apiParent.setLevel(1);
apiParent.setEnvironmentId("NONE");
apiParent.setTestResourcePoolId("gyq_123_pool");
apiParent.setRetryOnFail(true);
apiParent.setRetryType("SCENARIO");
apiParent.setRetryTimes(5);
apiParent.setRetryInterval(1000);
apiParent.setStopOnFail(true);
parentList.add(apiParent);
TestPlanCollectionMinderEditDTO scenarioParent = new TestPlanCollectionMinderEditDTO();
scenarioParent.setId("gyq_wxxx_3");
scenarioParent.setText("场景用例");
scenarioParent.setNum(3L);
scenarioParent.setExecuteMethod("PARALLEL");
scenarioParent.setType("SCENARIO");
scenarioParent.setExtended(false);
scenarioParent.setGrouped(false);
scenarioParent.setLevel(1);
scenarioParent.setEnvironmentId("NONE");
scenarioParent.setTestResourcePoolId("gyq_123_pool");
scenarioParent.setRetryOnFail(true);
scenarioParent.setRetryType("SCENARIO");
scenarioParent.setRetryTimes(6);
scenarioParent.setRetryInterval(1000);
scenarioParent.setStopOnFail(true);
parentList.add(scenarioParent);
List<TestPlanCollectionMinderEditDTO> editList = new ArrayList<>(); List<TestPlanCollectionMinderEditDTO> editList = new ArrayList<>();
TestPlanCollectionMinderEditDTO deleteDTO = new TestPlanCollectionMinderEditDTO(); TestPlanCollectionMinderEditDTO deleteDTO = new TestPlanCollectionMinderEditDTO();
TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO = new TestPlanCollectionMinderEditDTO(); TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO = new TestPlanCollectionMinderEditDTO();
@ -67,7 +121,7 @@ public class TestPlanCollectionMinderControllerTests extends BaseTest {
testPlanCollectionMinderEditDTO.setNum(500L); testPlanCollectionMinderEditDTO.setNum(500L);
testPlanCollectionMinderEditDTO.setExecuteMethod("PARALLEL"); testPlanCollectionMinderEditDTO.setExecuteMethod("PARALLEL");
testPlanCollectionMinderEditDTO.setType("API"); testPlanCollectionMinderEditDTO.setType("API");
testPlanCollectionMinderEditDTO.setExtended(false); testPlanCollectionMinderEditDTO.setExtended(true);
testPlanCollectionMinderEditDTO.setGrouped(false); testPlanCollectionMinderEditDTO.setGrouped(false);
testPlanCollectionMinderEditDTO.setLevel(2); testPlanCollectionMinderEditDTO.setLevel(2);
testPlanCollectionMinderEditDTO.setEnvironmentId("gyq_123"); testPlanCollectionMinderEditDTO.setEnvironmentId("gyq_123");
@ -85,12 +139,19 @@ public class TestPlanCollectionMinderControllerTests extends BaseTest {
testPlanCollectionMinderEditDTO.setAssociateDTOS(associateDTOS); testPlanCollectionMinderEditDTO.setAssociateDTOS(associateDTOS);
deleteDTO = testPlanCollectionMinderEditDTO; deleteDTO = testPlanCollectionMinderEditDTO;
editList.add(testPlanCollectionMinderEditDTO); editList.add(testPlanCollectionMinderEditDTO);
editList.addAll(parentList);
request.setEditList(editList); request.setEditList(editList);
this.requestPostWithOkAndReturn(EDIT_MIND, request); this.requestPostWithOkAndReturn(EDIT_MIND, request);
TestPlanCollectionExample testPlanCollectionExample = new TestPlanCollectionExample();
testPlanCollectionExample.createCriteria().andTestPlanIdEqualTo("gyq_plan_1");
List<TestPlanCollection> testPlanCollections1 = testPlanCollectionMapper.selectByExample(testPlanCollectionExample);
Assertions.assertEquals(4, testPlanCollections1.size());
TestPlanCollection testPlanCollection = testPlanCollectionMapper.selectByPrimaryKey("gyq_wxxx_4"); TestPlanCollection testPlanCollection = testPlanCollectionMapper.selectByPrimaryKey("gyq_wxxx_4");
Assertions.assertTrue(StringUtils.equalsIgnoreCase(testPlanCollection.getName(),"更新名称")); Assertions.assertTrue(StringUtils.equalsIgnoreCase(testPlanCollection.getName(),"更新名称"));
Assertions.assertTrue(StringUtils.equalsIgnoreCase(testPlanCollection.getEnvironmentId(),"NONE"));
editList = new ArrayList<>(); editList = new ArrayList<>();
editList.addAll(parentList);
testPlanCollectionMinderEditDTO = new TestPlanCollectionMinderEditDTO(); testPlanCollectionMinderEditDTO = new TestPlanCollectionMinderEditDTO();
testPlanCollectionMinderEditDTO.setId(null); testPlanCollectionMinderEditDTO.setId(null);
testPlanCollectionMinderEditDTO.setText("新建名称"); testPlanCollectionMinderEditDTO.setText("新建名称");
@ -116,11 +177,11 @@ public class TestPlanCollectionMinderControllerTests extends BaseTest {
editList.add(testPlanCollectionMinderEditDTO); editList.add(testPlanCollectionMinderEditDTO);
request.setEditList(editList); request.setEditList(editList);
this.requestPostWithOkAndReturn(EDIT_MIND, request); this.requestPostWithOkAndReturn(EDIT_MIND, request);
TestPlanCollectionExample testPlanCollectionExample = new TestPlanCollectionExample(); testPlanCollectionExample = new TestPlanCollectionExample();
testPlanCollectionExample.createCriteria().andNameEqualTo("新建名称"); testPlanCollectionExample.createCriteria().andNameEqualTo("新建名称");
List<TestPlanCollection> testPlanCollections = testPlanCollectionMapper.selectByExample(testPlanCollectionExample); List<TestPlanCollection> testPlanCollections = testPlanCollectionMapper.selectByExample(testPlanCollectionExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(testPlanCollections)); Assertions.assertTrue(CollectionUtils.isNotEmpty(testPlanCollections));
editList = new ArrayList<>(); editList = new ArrayList<>(parentList);
editList.add(deleteDTO); editList.add(deleteDTO);
editList.add(deleteDTO); editList.add(deleteDTO);
request.setEditList(editList); request.setEditList(editList);
@ -145,7 +206,7 @@ public class TestPlanCollectionMinderControllerTests extends BaseTest {
testPlanCollectionMinderEditDTO.setRetryTimes(5); testPlanCollectionMinderEditDTO.setRetryTimes(5);
testPlanCollectionMinderEditDTO.setRetryInterval(1000); testPlanCollectionMinderEditDTO.setRetryInterval(1000);
testPlanCollectionMinderEditDTO.setStopOnFail(true); testPlanCollectionMinderEditDTO.setStopOnFail(true);
editList = new ArrayList<>(); editList = new ArrayList<>(parentList);
editList.add(testPlanCollectionMinderEditDTO); editList.add(testPlanCollectionMinderEditDTO);
request.setEditList(editList); request.setEditList(editList);
this.requestPostWithOkAndReturn(EDIT_MIND, request); this.requestPostWithOkAndReturn(EDIT_MIND, request);