chore: 获取此集合的第一个元素
This commit is contained in:
parent
de8a216ef0
commit
90dfd84a4e
|
@ -131,7 +131,7 @@ public class XMLUtils {
|
|||
list.add(jsonObject);
|
||||
}
|
||||
if (list.size() == 1) {
|
||||
result.put(node.getName(), list.get(0));
|
||||
result.put(node.getName(), list.getFirst());
|
||||
} else {
|
||||
result.put(node.getName(), list);
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ public abstract class SqlProcessorConverter extends MsProcessorConverter<SQLProc
|
|||
.toList();
|
||||
}
|
||||
|
||||
return CollectionUtils.isEmpty(dataSourceResults) ? null : dataSourceResults.get(0);
|
||||
return CollectionUtils.isEmpty(dataSourceResults) ? null : dataSourceResults.getFirst();
|
||||
}
|
||||
|
||||
protected TestElement getJdbcProcessor(SQLProcessor sqlProcessor, TestElement jdbcProcessor, DataSource dataSource) {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class ApiFileResourceService {
|
|||
if (CollectionUtils.isEmpty(folderFileNames)) {
|
||||
return null;
|
||||
}
|
||||
String[] pathSplit = folderFileNames.get(0).split("/");
|
||||
String[] pathSplit = folderFileNames.getFirst().split("/");
|
||||
return pathSplit[pathSplit.length - 1];
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -407,7 +407,7 @@ public class ApiFileResourceService {
|
|||
throw new MSException("file not found!");
|
||||
}
|
||||
} else {
|
||||
fileName = apiFileResources.get(0).getFileName();
|
||||
fileName = apiFileResources.getFirst().getFileName();
|
||||
}
|
||||
|
||||
folder += "/" + request.getFileId();
|
||||
|
|
|
@ -89,9 +89,6 @@ public class ApiTaskCenterService {
|
|||
@Resource
|
||||
private KafkaTemplate<String, String> kafkaTemplate;
|
||||
private static final String DEFAULT_SORT = "start_time desc";
|
||||
private final static String PROJECT_STOP = "/task/center/api/project/stop";
|
||||
private final static String ORG_STOP = "/task/center/api/org/stop";
|
||||
private final static String SYSTEM_STOP = "/task/center/api/system/stop";
|
||||
|
||||
/**
|
||||
* 任务中心实时任务列表-项目级
|
||||
|
|
|
@ -182,7 +182,7 @@ public class ApiDefinitionImportService {
|
|||
applicationExample.createCriteria().andProjectIdEqualTo(request.getProjectId()).andTypeEqualTo("API_URL_REPEATABLE");
|
||||
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(applicationExample);
|
||||
if (CollectionUtils.isNotEmpty(projectApplications)) {
|
||||
String typeValue = projectApplications.get(0).getTypeValue();
|
||||
String typeValue = projectApplications.getFirst().getTypeValue();
|
||||
}*/
|
||||
//过滤(一次只导入一个协议)
|
||||
List<ApiDefinitionImportDetail> filterData = initData.stream().filter(t -> t.getProtocol().equals(request.getProtocol())).collect(Collectors.toList());
|
||||
|
|
|
@ -947,7 +947,7 @@ public class ApiDefinitionService extends MoveNodeService {
|
|||
if (ApiDefinitionDocType.ALL.name().equals(request.getType()) || ApiDefinitionDocType.MODULE.name().equals(request.getType())) {
|
||||
List<ApiDefinitionDTO> list = extApiDefinitionMapper.listDoc(request);
|
||||
if (!list.isEmpty()) {
|
||||
ApiDefinitionDTO first = list.get(0);
|
||||
ApiDefinitionDTO first = list.getFirst();
|
||||
handleBlob(first.getId(), first);
|
||||
String docTitle;
|
||||
if (ApiDefinitionDocType.ALL.name().equals(request.getType())) {
|
||||
|
|
|
@ -280,7 +280,7 @@ public class ApiTestCaseBatchRunService {
|
|||
reportId = IDGenerator.nextStr();
|
||||
} else {
|
||||
// 独立报告,执行到当前任务时初始化报告
|
||||
reportId = initApiReport(runModeConfig, List.of(apiTestCase), queue.getUserId()).get(0).getApiReportId();
|
||||
reportId = initApiReport(runModeConfig, List.of(apiTestCase), queue.getUserId()).getFirst().getApiReportId();
|
||||
}
|
||||
|
||||
if (apiTestCase == null) {
|
||||
|
|
|
@ -381,7 +381,7 @@ public class ApiDebugControllerTests extends BaseTest {
|
|||
// 校验数据是否正确
|
||||
List<ApiDebugSimpleDTO> apiDebugList = getResultDataArray(mvcResult, ApiDebugSimpleDTO.class);
|
||||
Assertions.assertEquals(apiDebugList.size(), 2);
|
||||
Assertions.assertEquals(apiDebugList.get(0), BeanUtils.copyBean(new ApiDebugSimpleDTO(),
|
||||
Assertions.assertEquals(apiDebugList.getFirst(), BeanUtils.copyBean(new ApiDebugSimpleDTO(),
|
||||
apiDebugMapper.selectByPrimaryKey(addApiDebug.getId())));
|
||||
Assertions.assertEquals(apiDebugList.get(1),
|
||||
BeanUtils.copyBean(new ApiDebugSimpleDTO(), apiDebugMapper.selectByPrimaryKey(anotherAddApiDebug.getId())));
|
||||
|
@ -468,7 +468,7 @@ public class ApiDebugControllerTests extends BaseTest {
|
|||
Assertions.assertFalse(testResourcePools.isEmpty());
|
||||
ProjectTestResourcePool projectTestResourcePool = new ProjectTestResourcePool();
|
||||
projectTestResourcePool.setProjectId(DEFAULT_PROJECT_ID);
|
||||
projectTestResourcePool.setTestResourcePoolId(testResourcePools.get(0).getId());
|
||||
projectTestResourcePool.setTestResourcePoolId(testResourcePools.getFirst().getId());
|
||||
projectTestResourcePoolMapper.insert(projectTestResourcePool);
|
||||
this.requestPost(DEBUG, request);
|
||||
projectTestResourcePoolMapper.deleteByExample(projectTestResourcePoolExample);
|
||||
|
@ -753,7 +753,7 @@ public class ApiDebugControllerTests extends BaseTest {
|
|||
request.setModuleId("root");
|
||||
request.setFileName("test-debug-file1");
|
||||
request.setOriginalName("test-debug-file1.txt");
|
||||
request.setFileId(apiFileResources.get(0).getFileId());
|
||||
request.setFileId(apiFileResources.getFirst().getFileId());
|
||||
this.requestPost(TRANSFER, request).andExpect(status().isOk());
|
||||
}
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ public class ApiDebugModuleControllerTests extends BaseTest {
|
|||
List<ApiDebugModule> apiDebugModules = apiDebugModuleMapper.selectByExample(example);
|
||||
assert CollectionUtils.isNotEmpty(apiDebugModules);
|
||||
updateRequest = new ModuleUpdateRequest();
|
||||
updateRequest.setId(apiDebugModules.get(0).getId());
|
||||
updateRequest.setId(apiDebugModules.getFirst().getId());
|
||||
updateRequest.setName("default-update-Project");
|
||||
requestPostPermissionTest(PermissionConstants.PROJECT_API_DEBUG_UPDATE, URL_MODULE_UPDATE, updateRequest);
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
msHttpElement.setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpElement.getBody(), fileMetadataId));
|
||||
request.setRequest(getMsElementParam(msHttpElement));
|
||||
List<HttpResponse> msHttpResponse = MsHTTPElementTest.getMsHttpResponse();
|
||||
msHttpResponse.get(0).setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpResponse.get(0).getBody(), fileMetadataId));
|
||||
msHttpResponse.getFirst().setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpResponse.getFirst().getBody(), fileMetadataId));
|
||||
request.setResponse(msHttpResponse);
|
||||
|
||||
uploadFileId = doUploadTempFile(getMockMultipartFile("api-add-file_upload.JPG"));
|
||||
|
@ -256,7 +256,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
apiFileResourceExample.createCriteria().andResourceIdEqualTo(apiDefinition.getId());
|
||||
List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample);
|
||||
Assertions.assertFalse(apiFileResources.isEmpty());
|
||||
apiTransferRequest.setFileId(apiFileResources.get(0).getFileId());
|
||||
apiTransferRequest.setFileId(apiFileResources.getFirst().getFileId());
|
||||
apiTransferRequest.setFileName("test-file_upload");
|
||||
apiTransferRequest.setOriginalName("test-file_upload.JPG");
|
||||
this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk());
|
||||
|
@ -899,7 +899,7 @@ public class ApiDefinitionControllerTests extends BaseTest {
|
|||
private void assertPateDate(Pager pageData) {
|
||||
List<ApiDefinitionDTO> apiDefinitions = ApiDataUtils.parseArray(JSON.toJSONString(pageData.getList()), ApiDefinitionDTO.class);
|
||||
if (CollectionUtils.isNotEmpty(apiDefinitions)) {
|
||||
ApiDefinitionDTO apiDefinitionDTO = apiDefinitions.get(0);
|
||||
ApiDefinitionDTO apiDefinitionDTO = apiDefinitions.getFirst();
|
||||
// 判断用例数是否正确
|
||||
ApiTestCaseExample example = new ApiTestCaseExample();
|
||||
example.createCriteria()
|
||||
|
|
|
@ -475,7 +475,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest {
|
|||
List<ApiDefinitionModule> apiDebugModules = apiDefinitionModuleMapper.selectByExample(example);
|
||||
assert CollectionUtils.isNotEmpty(apiDebugModules);
|
||||
updateRequest = new ModuleUpdateRequest();
|
||||
updateRequest.setId(apiDebugModules.get(0).getId());
|
||||
updateRequest.setId(apiDebugModules.getFirst().getId());
|
||||
updateRequest.setName("default-update-Project");
|
||||
requestPostPermissionTest(PermissionConstants.PROJECT_API_DEFINITION_UPDATE, URL_MODULE_UPDATE, updateRequest);
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
schedule.setValue("0 0 0/1 * * ? ");
|
||||
} else {
|
||||
apiScenario.setGrouped(false);
|
||||
apiScenario.setEnvironmentId(environments.get(0).getId());
|
||||
apiScenario.setEnvironmentId(environments.getFirst().getId());
|
||||
schedule.setValue("1111");
|
||||
}
|
||||
scheduleMapper.insertSelective(schedule);
|
||||
|
@ -356,7 +356,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
List<ApiScenarioStepRequest> steps = getApiScenarioStepRequests();
|
||||
Map<String, Object> steptDetailMap = new HashMap<>();
|
||||
steptDetailMap.put(steps.get(1).getId(), getMsHttpElementParam());
|
||||
steptDetailMap.put(steps.get(0).getId(), getMsHttpElementParam());
|
||||
steptDetailMap.put(steps.getFirst().getId(), getMsHttpElementParam());
|
||||
request.setSteps(steps);
|
||||
request.setStepDetails(steptDetailMap);
|
||||
request.setScenarioConfig(getScenarioConfig());
|
||||
|
@ -662,7 +662,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
for (ApiScenarioStepRequest step : steps) {
|
||||
steptDetailMap.put(step.getId(), getMsHttpElementStr(msHttpElement));
|
||||
}
|
||||
fileMetadataStepId = steps.get(0).getId();
|
||||
fileMetadataStepId = steps.getFirst().getId();
|
||||
|
||||
request.setSteps(steps);
|
||||
request.setStepDetails(steptDetailMap);
|
||||
|
@ -675,10 +675,10 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
List<ApiScenarioCsv> apiScenarioCsv = apiScenarioCsvMapper.selectByExample(apiScenarioCsvExample);
|
||||
Map<String, ApiScenarioCsv> collect = apiScenarioCsv.stream().collect(Collectors.toMap(ApiScenarioCsv::getFileId, t -> t));
|
||||
// 验证修改步骤
|
||||
steps.get(0).setName("test name update");
|
||||
CsvVariable csvVariable = request.getScenarioConfig().getVariable().getCsvVariables().get(0);
|
||||
request.getScenarioConfig().getVariable().getCsvVariables().get(0).setId(collect.get(csvVariable.getFile().getFileId()).getId());
|
||||
CsvVariable csvVariable1 = request.getScenarioConfig().getVariable().getCsvVariables().get(0);
|
||||
steps.getFirst().setName("test name update");
|
||||
CsvVariable csvVariable = request.getScenarioConfig().getVariable().getCsvVariables().getFirst();
|
||||
request.getScenarioConfig().getVariable().getCsvVariables().getFirst().setId(collect.get(csvVariable.getFile().getFileId()).getId());
|
||||
CsvVariable csvVariable1 = request.getScenarioConfig().getVariable().getCsvVariables().getFirst();
|
||||
request.getScenarioConfig().getVariable().getCsvVariables().get(1).setId(collect.get(csvVariable1.getFile().getFileId()).getId());
|
||||
this.requestPostWithOk(DEFAULT_UPDATE, request);
|
||||
assertUpdateSteps(steps, steptDetailMap);
|
||||
|
@ -862,7 +862,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
apiFileResourceExample.createCriteria().andResourceIdEqualTo(addApiScenario.getId());
|
||||
List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample);
|
||||
Assertions.assertFalse(apiFileResources.isEmpty());
|
||||
apiTransferRequest.setFileId(apiFileResources.get(0).getFileId());
|
||||
apiTransferRequest.setFileId(apiFileResources.getFirst().getFileId());
|
||||
apiTransferRequest.setFileName("test-scenario-file-1");
|
||||
apiTransferRequest.setOriginalName("test-scenario-file-1.txt");
|
||||
this.requestPost(TRANSFER, apiTransferRequest).andExpect(status().isOk());
|
||||
|
@ -873,7 +873,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
public void testStepTransfer() throws Exception {
|
||||
this.requestGetWithOk(TRANSFER_OPTIONS, DEFAULT_PROJECT_ID);
|
||||
ApiTransferRequest apiTransferRequest = new ApiTransferRequest();
|
||||
apiTransferRequest.setSourceId(addApiScenarioSteps.get(0).getId());
|
||||
apiTransferRequest.setSourceId(addApiScenarioSteps.getFirst().getId());
|
||||
apiTransferRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||
apiTransferRequest.setModuleId("root");
|
||||
apiTransferRequest.setLocal(true);
|
||||
|
@ -1692,11 +1692,11 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
EnvironmentExample environmentExample = new EnvironmentExample();
|
||||
environmentExample.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andMockEqualTo(true);
|
||||
List<Environment> environments = environmentMapper.selectByExample(environmentExample);
|
||||
request.setEnvId(environments.get(0).getId());
|
||||
request.setEnvId(environments.getFirst().getId());
|
||||
requestPostAndReturn(BATCH_EDIT, request);
|
||||
//判断数据的环境是不是environments.get(0).getId()
|
||||
//判断数据的环境是不是environments.getFirst().getId()
|
||||
apiScenarios = apiScenarioMapper.selectByExample(example);
|
||||
apiScenarios.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.get(0).getId()));
|
||||
apiScenarios.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.getFirst().getId()));
|
||||
|
||||
//环境数据为空
|
||||
request.setEnvId(null);
|
||||
|
@ -2558,7 +2558,7 @@ public class ApiScenarioControllerTests extends BaseTest {
|
|||
apiScenario.setEnvironmentId("scenario-environment-group-id");
|
||||
} else if (i <= 100) {
|
||||
apiScenario.setGrouped(false);
|
||||
apiScenario.setEnvironmentId(environments.get(0).getId());
|
||||
apiScenario.setEnvironmentId(environments.getFirst().getId());
|
||||
} else if (i <= 150) {
|
||||
//带blob
|
||||
ApiScenarioBlob apiScenarioBlob = new ApiScenarioBlob();
|
||||
|
|
|
@ -402,7 +402,7 @@ public class ApiScenarioModuleControllerTests extends BaseTest {
|
|||
List<ApiScenarioModule> apiDebugModules = apiScenarioModuleMapper.selectByExample(example);
|
||||
assert CollectionUtils.isNotEmpty(apiDebugModules);
|
||||
updateRequest = new ModuleUpdateRequest();
|
||||
updateRequest.setId(apiDebugModules.get(0).getId());
|
||||
updateRequest.setId(apiDebugModules.getFirst().getId());
|
||||
updateRequest.setName("default-update-Project");
|
||||
requestPostPermissionTest(PermissionConstants.PROJECT_API_SCENARIO_UPDATE, URL_MODULE_UPDATE, updateRequest);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class ApiShareControllerTests extends BaseTest {
|
|||
List<ShareInfo> shareInfos = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.SINGLE.name(), JSON.toJSONString(request).getBytes(), "zh_CN");
|
||||
Assertions.assertNotNull(shareInfos);
|
||||
Assertions.assertEquals(1, shareInfos.size());
|
||||
Assertions.assertEquals(shareInfoDTO.getId(), shareInfos.get(0).getId());
|
||||
Assertions.assertEquals(shareInfoDTO.getId(), shareInfos.getFirst().getId());
|
||||
Assertions.assertTrue(shareInfoDTO.getShareUrl().contains("?shareId="));
|
||||
|
||||
request.setApiId("111");
|
||||
|
@ -96,7 +96,7 @@ public class ApiShareControllerTests extends BaseTest {
|
|||
List<ShareInfo> shareInfosModule = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.BATCH.name(), JSON.toJSONString(request).getBytes(), "zh_CN");
|
||||
Assertions.assertNotNull(shareInfosModule);
|
||||
Assertions.assertEquals(1, shareInfosModule.size());
|
||||
Assertions.assertEquals(shareInfoDTOModule.getId(), shareInfosModule.get(0).getId());
|
||||
Assertions.assertEquals(shareInfoDTOModule.getId(), shareInfosModule.getFirst().getId());
|
||||
Assertions.assertTrue(shareInfoDTOModule.getShareUrl().contains("?shareId="));
|
||||
|
||||
// @@分享全部文档
|
||||
|
@ -111,7 +111,7 @@ public class ApiShareControllerTests extends BaseTest {
|
|||
List<ShareInfo> allShareInfos = extShareInfoMapper.selectByShareTypeAndShareApiIdWithBLOBs(ShareInfoType.BATCH.name(), JSON.toJSONString(request).getBytes(), "zh_CN");
|
||||
Assertions.assertNotNull(allShareInfos);
|
||||
Assertions.assertEquals(1, allShareInfos.size());
|
||||
Assertions.assertEquals(allShareInfoDTO.getId(), allShareInfos.get(0).getId());
|
||||
Assertions.assertEquals(allShareInfoDTO.getId(), allShareInfos.getFirst().getId());
|
||||
Assertions.assertTrue(allShareInfoDTO.getShareUrl().contains("?shareId="));
|
||||
assertTestShareView(allShareInfoDTO.getId());
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
request.setPriority("P0");
|
||||
request.setStatus(ApiDefinitionStatus.PROCESSING.name());
|
||||
request.setTags(new LinkedHashSet<>(List.of("tag1", "tag2")));
|
||||
request.setEnvironmentId(environments.get(0).getId());
|
||||
request.setEnvironmentId(environments.getFirst().getId());
|
||||
MsHTTPElement msHttpElement = MsHTTPElementTest.getMsHttpElement();
|
||||
msHttpElement.setBody(ApiDebugControllerTests.addBodyLinkFile(msHttpElement.getBody(), fileMetadataId));
|
||||
request.setRequest(getMsElementParam(msHttpElement));
|
||||
|
@ -750,7 +750,7 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
apiFileResourceExample.createCriteria().andResourceIdEqualTo(apiTestCase.getId());
|
||||
List<ApiFileResource> apiFileResources = apiFileResourceMapper.selectByExample(apiFileResourceExample);
|
||||
Assertions.assertFalse(apiFileResources.isEmpty());
|
||||
apiTransferRequest.setFileId(apiFileResources.get(0).getFileId());
|
||||
apiTransferRequest.setFileId(apiFileResources.getFirst().getFileId());
|
||||
apiTransferRequest.setFileName("test-api-test-case-1");
|
||||
apiTransferRequest.setOriginalName("test-api-test-case-1.txt");
|
||||
this.requestPost("transfer", apiTransferRequest).andExpect(status().isOk());
|
||||
|
@ -1018,11 +1018,11 @@ public class ApiTestCaseControllerTests extends BaseTest {
|
|||
EnvironmentExample environmentExample = new EnvironmentExample();
|
||||
environmentExample.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andMockEqualTo(true);
|
||||
List<Environment> environments = environmentMapper.selectByExample(environmentExample);
|
||||
request.setEnvironmentId(environments.get(0).getId());
|
||||
request.setEnvironmentId(environments.getFirst().getId());
|
||||
requestPostWithOkAndReturn(BATCH_EDIT, request);
|
||||
//判断数据的环境是不是environments.get(0).getId()
|
||||
//判断数据的环境是不是environments.getFirst().getId()
|
||||
caseList = apiTestCaseMapper.selectByExample(example);
|
||||
caseList.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.get(0).getId()));
|
||||
caseList.forEach(apiTestCase -> Assertions.assertEquals(apiTestCase.getEnvironmentId(), environments.getFirst().getId()));
|
||||
//环境数据为空
|
||||
request.setEnvironmentId(null);
|
||||
this.requestPost(BATCH_EDIT, request, ERROR_REQUEST_MATCHER);
|
||||
|
|
|
@ -57,7 +57,7 @@ public class BaseFileManagementTestService {
|
|||
FileAssociationExample example = new FileAssociationExample();
|
||||
example.createCriteria().andFileIdEqualTo(originFileId)
|
||||
.andSourceIdEqualTo(resourceId);
|
||||
FileAssociation fileAssociation = fileAssociationMapper.selectByExample(example).get(0);
|
||||
FileAssociation fileAssociation = fileAssociationMapper.selectByExample(example).getFirst();
|
||||
return fileAssociationService.upgrade(fileAssociation.getId(), fileLogRecord);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ public class BugAttachmentLogService {
|
|||
BugFileDTO deleteFile;
|
||||
if (request.getAssociated()) {
|
||||
// 关联
|
||||
deleteFile = allBugFiles.stream().filter(file -> !file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().get(0);
|
||||
deleteFile = allBugFiles.stream().filter(file -> !file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().getFirst();
|
||||
} else {
|
||||
// 本地
|
||||
deleteFile = allBugFiles.stream().filter(file -> file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().get(0);
|
||||
deleteFile = allBugFiles.stream().filter(file -> file.getLocal() && StringUtils.equals(request.getRefId(), file.getRefId())).toList().getFirst();
|
||||
}
|
||||
LogDTO dto = buildUpdateLog(bug);
|
||||
dto.setModifiedValue(JSON.toJSONBytes(originalFileNames));
|
||||
|
|
|
@ -510,7 +510,7 @@ public class BugAttachmentService {
|
|||
FileAssociation association = fileAssociationMapper.selectByPrimaryKey(refId);
|
||||
FileMetadataExample example = new FileMetadataExample();
|
||||
example.createCriteria().andIdEqualTo(association.getFileId());
|
||||
FileMetadata fileMetadata = fileMetadataMapper.selectByExample(example).get(0);
|
||||
FileMetadata fileMetadata = fileMetadataMapper.selectByExample(example).getFirst();
|
||||
// 取消关联的附件同步至平台
|
||||
if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) {
|
||||
File deleteTmpFile = new File(FilenameUtils.normalize(LocalRepositoryDir.getBugTmpDir() + File.separator + fileMetadata.getName() + "." + fileMetadata.getType()));
|
||||
|
@ -628,7 +628,7 @@ public class BugAttachmentService {
|
|||
if (CollectionUtils.isEmpty(bugLocalAttachments)) {
|
||||
return null;
|
||||
}
|
||||
return bugLocalAttachments.get(0);
|
||||
return bugLocalAttachments.getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -700,7 +700,7 @@ public class BugAttachmentService {
|
|||
if (CollectionUtils.isEmpty(folderFileNames)) {
|
||||
return null;
|
||||
}
|
||||
String[] pathSplit = folderFileNames.get(0).split("/");
|
||||
String[] pathSplit = folderFileNames.getFirst().split("/");
|
||||
return pathSplit[pathSplit.length - 1];
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -769,7 +769,7 @@ public class BugAttachmentService {
|
|||
bytes = getPreviewImg(fileName, fileId, compressed);
|
||||
} else {
|
||||
//在正式目录获取
|
||||
BugLocalAttachment attachment = bugAttachments.get(0);
|
||||
BugLocalAttachment attachment = bugAttachments.getFirst();
|
||||
fileName = attachment.getFileName();
|
||||
FileRequest fileRequest = buildBugFileRequest(projectId, attachment.getBugId(), attachment.getFileId(), attachment.getFileName(), compressed);
|
||||
try {
|
||||
|
|
|
@ -121,6 +121,6 @@ public class BugLogService {
|
|||
originalBug.setDescription(bugContent.getDescription());
|
||||
}
|
||||
// 缺陷自定义字段
|
||||
return bugService.handleCustomField(List.of(originalBug), originalBug.getProjectId()).get(0);
|
||||
return bugService.handleCustomField(List.of(originalBug), originalBug.getProjectId()).getFirst();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public class BugScheduleServiceImpl implements BaseBugScheduleService {
|
|||
List<ProjectApplication> syncCron = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.BUG_SYNC_CONFIG.CRON_EXPRESSION.name())).toList();
|
||||
List<ProjectApplication> syncEnable = bugSyncConfigs.stream().filter(config -> config.getType().equals(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.BUG_SYNC_CONFIG.SYNC_ENABLE.name())).toList();
|
||||
if (CollectionUtils.isNotEmpty(syncCron)) {
|
||||
Boolean enable = Boolean.valueOf(syncEnable.get(0).getTypeValue());
|
||||
String typeValue = syncCron.get(0).getTypeValue();
|
||||
Boolean enable = Boolean.valueOf(syncEnable.getFirst().getTypeValue());
|
||||
String typeValue = syncCron.getFirst().getTypeValue();
|
||||
Schedule schedule = scheduleService.getScheduleByResource(projectId, BugSyncJob.class.getName());
|
||||
Optional<Schedule> optional = Optional.ofNullable(schedule);
|
||||
optional.ifPresentOrElse(s -> {
|
||||
|
|
|
@ -727,7 +727,7 @@ public class BugService {
|
|||
// 平台默认模板
|
||||
Template pluginDefaultTemplate = projectTemplateService.getPluginBugTemplate(project.getId());
|
||||
List<ProjectTemplateOptionDTO> templateOption = projectTemplateService.getOption(project.getId(), TemplateScene.BUG.name());
|
||||
ProjectTemplateOptionDTO defaultProjectTemplate = templateOption.stream().filter(ProjectTemplateOptionDTO::getEnableDefault).toList().get(0);
|
||||
ProjectTemplateOptionDTO defaultProjectTemplate = templateOption.stream().filter(ProjectTemplateOptionDTO::getEnableDefault).toList().getFirst();
|
||||
if (isPluginDefaultTemplate(defaultProjectTemplate.getId(), pluginDefaultTemplate)) {
|
||||
BeanUtils.copyBean(msDefaultTemplate, pluginDefaultTemplate);
|
||||
} else {
|
||||
|
@ -945,7 +945,7 @@ public class BugService {
|
|||
if (StringUtils.isBlank(statusField.get().getValue()) && StringUtils.equalsIgnoreCase(BugPlatform.LOCAL.getName(), platformName)) {
|
||||
// Local平台设置状态默认值为状态流-开始状态
|
||||
List<SelectOption> localStartStatusItem = bugStatusService.getToStatusItemOptionOnLocal(request.getProjectId(), StringUtils.EMPTY);
|
||||
bug.setStatus(localStartStatusItem.get(0).getValue());
|
||||
bug.setStatus(localStartStatusItem.getFirst().getValue());
|
||||
} else {
|
||||
bug.setStatus(statusField.get().getValue());
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ public class BugService {
|
|||
if (CollectionUtils.isEmpty(bugs)) {
|
||||
throw new MSException(BUG_NOT_EXIST);
|
||||
}
|
||||
return bugs.get(0);
|
||||
return bugs.getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1491,13 +1491,13 @@ public class BugService {
|
|||
.replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + updateBug.getProjectId() + "/" + fileId + "/false\""));
|
||||
if (updateBug.getPlatformDefaultTemplate()) {
|
||||
// 来自富文本自定义字段
|
||||
PlatformCustomFieldItemDTO descriptionField = updateBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().get(0);
|
||||
PlatformCustomFieldItemDTO descriptionField = updateBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().getFirst();
|
||||
descriptionField.setValue(updateBug.getDescription());
|
||||
}
|
||||
} else {
|
||||
// 来自富文本自定义字段
|
||||
PlatformCustomFieldItemDTO richTextField = updateBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getType(), PlatformCustomFieldType.RICH_TEXT.name())
|
||||
&& field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().get(0);
|
||||
&& field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().getFirst();
|
||||
richTextField.setValue(richTextField.getValue().toString().replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + updateBug.getProjectId() + "/" + fileId + "/false\""));
|
||||
}
|
||||
}));
|
||||
|
@ -2002,13 +2002,13 @@ public class BugService {
|
|||
.replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + platformBug.getProjectId() + "/" + fileId + "/false\""));
|
||||
if (platformBug.getPlatformDefaultTemplate()) {
|
||||
// 来自富文本自定义字段
|
||||
PlatformCustomFieldItemDTO descriptionField = platformBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().get(0);
|
||||
PlatformCustomFieldItemDTO descriptionField = platformBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getCustomData(), "description")).toList().getFirst();
|
||||
descriptionField.setValue(platformBug.getDescription());
|
||||
}
|
||||
} else {
|
||||
// 来自富文本自定义字段
|
||||
PlatformCustomFieldItemDTO richTextField = platformBug.getCustomFieldList().stream().filter(field -> StringUtils.equals(field.getType(), PlatformCustomFieldType.RICH_TEXT.name())
|
||||
&& field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().get(0);
|
||||
&& field.getValue() != null && StringUtils.contains(field.getValue().toString(), "alt=\"" + key + "\"")).toList().getFirst();
|
||||
richTextField.setValue(richTextField.getValue().toString().replace("alt=\"" + key + "\"", "src=\"/bug/attachment/preview/md/" + platformBug.getProjectId() + "/" + fileId + "/false\""));
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -113,7 +113,7 @@ public class BugStatusService {
|
|||
example.setOrderByClause("create_time desc");
|
||||
List<Bug> bugs = bugMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(bugs)) {
|
||||
return bugs.get(0).getPlatformBugId();
|
||||
return bugs.getFirst().getPlatformBugId();
|
||||
} else {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class BugAttachmentControllerTests extends BaseTest {
|
|||
BugUploadFileRequest request = new BugUploadFileRequest();
|
||||
request.setBugId("default-attachment-bug-id");
|
||||
request.setProjectId("default-project-for-attachment");
|
||||
request.setSelectIds(List.of(unRelatedFiles.get(0).getId()));
|
||||
request.setSelectIds(List.of(unRelatedFiles.getFirst().getId()));
|
||||
MultiValueMap<String, Object> paramMap1 = getDefaultMultiPartParam(request, null);
|
||||
this.requestMultipartWithOk(BUG_ATTACHMENT_UPLOAD, paramMap1);
|
||||
String filePath = Objects.requireNonNull(this.getClass().getClassLoader().getResource("file/test.xlsx")).getPath();
|
||||
|
@ -105,7 +105,7 @@ public class BugAttachmentControllerTests extends BaseTest {
|
|||
request.setSelectIds(List.of("not-exist-file-id"));
|
||||
MultiValueMap<String, Object> paramMap4 = getDefaultMultiPartParam(request, null);
|
||||
this.requestMultipart(BUG_ATTACHMENT_UPLOAD, paramMap4);
|
||||
request.setSelectIds(List.of(unRelatedFiles.get(0).getId()));
|
||||
request.setSelectIds(List.of(unRelatedFiles.getFirst().getId()));
|
||||
MultiValueMap<String, Object> paramMap5 = getDefaultMultiPartParam(request, null);
|
||||
this.requestMultipart(BUG_ATTACHMENT_UPLOAD, paramMap5);
|
||||
MultiValueMap<String, Object> paramMap6 = getDefaultMultiPartParam(request, file);
|
||||
|
|
|
@ -45,10 +45,10 @@ public class BugCommentControllerTests extends BaseTest {
|
|||
ResultHolder resultHolder = JSON.parseObject(sortData, ResultHolder.class);
|
||||
List<BugCommentDTO> comments = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), BugCommentDTO.class);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(comments));
|
||||
Assertions.assertTrue(StringUtils.equals("default-bug-comment-id-3", comments.get(0).getId()));
|
||||
Assertions.assertTrue(StringUtils.equals("default-bug-comment-id-3", comments.getFirst().getId()));
|
||||
// 第二条评论的子评论不为空且ID为default-bug-comment-id-2
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(comments.get(1).getChildComments()) &&
|
||||
StringUtils.equals("default-bug-comment-id-2", comments.get(1).getChildComments().get(0).getId()));
|
||||
StringUtils.equals("default-bug-comment-id-2", comments.get(1).getChildComments().getFirst().getId()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -155,7 +155,7 @@ public class BugControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= bugRequest.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字default
|
||||
BugDTO bugDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugDTO.class).get(0);
|
||||
BugDTO bugDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(bugDTO.getTitle(), bugRequest.getKeyword())
|
||||
|| StringUtils.contains(bugDTO.getId(), bugRequest.getKeyword()));
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class BugControllerTests extends BaseTest {
|
|||
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
|
||||
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
|
||||
// 返回值中取出第一条ID最大的数据, 并判断是否是default-bug
|
||||
BugDTO maxBugDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), BugDTO.class).get(0);
|
||||
BugDTO maxBugDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), BugDTO.class).getFirst();
|
||||
Assertions.assertTrue(maxBugDTO.getId().contains("default"));
|
||||
|
||||
// 拖拽
|
||||
|
@ -884,7 +884,7 @@ public class BugControllerTests extends BaseTest {
|
|||
private Bug getAddJiraBug() {
|
||||
BugExample example = new BugExample();
|
||||
example.createCriteria().andTitleEqualTo("这是一个系统Jira模板创建的缺陷");
|
||||
return bugMapper.selectByExample(example).get(0);
|
||||
return bugMapper.selectByExample(example).getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -895,7 +895,7 @@ public class BugControllerTests extends BaseTest {
|
|||
private BugLocalAttachment getAddJiraLocalFile() {
|
||||
BugLocalAttachmentExample example = new BugLocalAttachmentExample();
|
||||
example.createCriteria().andBugIdEqualTo(getAddJiraBug().getId());
|
||||
return bugLocalAttachmentMapper.selectByExample(example).get(0);
|
||||
return bugLocalAttachmentMapper.selectByExample(example).getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -906,7 +906,7 @@ public class BugControllerTests extends BaseTest {
|
|||
private FileAssociation getAddJiraAssociateFile() {
|
||||
FileAssociationExample example = new FileAssociationExample();
|
||||
example.createCriteria().andSourceIdEqualTo(getAddJiraBug().getId()).andSourceTypeEqualTo(FileAssociationSourceUtil.SOURCE_TYPE_BUG);
|
||||
return fileAssociationMapper.selectByExample(example).get(0);
|
||||
return fileAssociationMapper.selectByExample(example).getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -117,7 +117,7 @@ public class BugRelateCaseControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字default
|
||||
BugRelateCaseDTO bugRelateCaseDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugRelateCaseDTO.class).get(0);
|
||||
BugRelateCaseDTO bugRelateCaseDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), BugRelateCaseDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(bugRelateCaseDTO.getRelateCaseName(), request.getKeyword()));
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
collect.forEach((caseId, caseList) -> {
|
||||
FunctionalCase functionalCase = new FunctionalCase();
|
||||
functionalCase.setId(caseId);
|
||||
functionalCase.setReviewStatus(caseList.get(0).getStatus());
|
||||
functionalCase.setReviewStatus(caseList.getFirst().getStatus());
|
||||
mapper.updateByPrimaryKeySelective(functionalCase);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ public class CaseReviewFunctionalCaseService {
|
|||
private String getMyStatus(List<CaseReviewHistory> histories, String viewStatusUserId) {
|
||||
List<CaseReviewHistory> list = histories.stream().filter(history -> StringUtils.equalsIgnoreCase(history.getCreateUser(), viewStatusUserId)).toList();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return list.get(0).getStatus();
|
||||
return list.getFirst().getStatus();
|
||||
}
|
||||
|
||||
//重新提审记录
|
||||
|
@ -328,7 +328,7 @@ public class CaseReviewFunctionalCaseService {
|
|||
ProjectApplicationExample example = new ProjectApplicationExample();
|
||||
example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andTypeEqualTo(ProjectApplicationType.CASE.CASE_RE_REVIEW.name());
|
||||
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.get(0).getTypeValue())) {
|
||||
if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.getFirst().getTypeValue())) {
|
||||
if (!StringUtils.equals(name, request.getName())
|
||||
|| !StringUtils.equals(new String(blob.getSteps() == null ? new byte[0] : blob.getSteps(), StandardCharsets.UTF_8), request.getSteps())
|
||||
|| !StringUtils.equals(new String(blob.getTextDescription() == null ? new byte[0] : blob.getTextDescription(), StandardCharsets.UTF_8), request.getTextDescription())
|
||||
|
@ -526,10 +526,10 @@ public class CaseReviewFunctionalCaseService {
|
|||
AtomicInteger passCount = new AtomicInteger();
|
||||
AtomicInteger unPassCount = new AtomicInteger();
|
||||
hasReviewedUserMap.forEach((k, v) -> {
|
||||
if (StringUtils.equalsIgnoreCase(v.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
|
||||
if (StringUtils.equalsIgnoreCase(v.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
|
||||
passCount.set(passCount.get() + 1);
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(v.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) {
|
||||
if (StringUtils.equalsIgnoreCase(v.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) {
|
||||
unPassCount.set(unPassCount.get() + 1);
|
||||
}
|
||||
});
|
||||
|
@ -646,7 +646,7 @@ public class CaseReviewFunctionalCaseService {
|
|||
}
|
||||
|
||||
private String newReviewStatus(List<String> historyUsers, List<String> newUsers, List<CaseReviewHistory> reviewHistories, List<CaseReviewFunctionalCaseUser> newReviewers) {
|
||||
CaseReviewHistory caseReviewHistory = reviewHistories.get(0);
|
||||
CaseReviewHistory caseReviewHistory = reviewHistories.getFirst();
|
||||
if (newUsers.contains(caseReviewHistory.getCreateUser()) && FunctionalCaseReviewStatus.RE_REVIEWED.name().equals(caseReviewHistory.getStatus())) {
|
||||
return FunctionalCaseReviewStatus.RE_REVIEWED.name();
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ public class CaseReviewFunctionalCaseService {
|
|||
Map<String, List<FunctionalCaseModuleDTO>> projectModuleMap = functionalModuleIds.stream().collect(Collectors.groupingBy(FunctionalCaseModule::getProjectId));
|
||||
if (MapUtils.isEmpty(projectModuleMap)) {
|
||||
projectRootMap.forEach((projectId, projectOptionDTOList) -> {
|
||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.get(0).getProjectName(), Project.class.getName());
|
||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.getFirst().getProjectName(), Project.class.getName());
|
||||
returnList.add(projectNode);
|
||||
BaseTreeNode defaultNode = functionalCaseModuleService.getDefaultModule(Translator.get("functional_case.module.default.name"));
|
||||
projectNode.addChild(defaultNode);
|
||||
|
@ -739,7 +739,7 @@ public class CaseReviewFunctionalCaseService {
|
|||
return returnList;
|
||||
}
|
||||
projectModuleMap.forEach((projectId, moduleList) -> {
|
||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.get(0).getProjectName(), Project.class.getName());
|
||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.getFirst().getProjectName(), Project.class.getName());
|
||||
returnList.add(projectNode);
|
||||
List<String> projectModuleIds = moduleList.stream().map(FunctionalCaseModule::getId).toList();
|
||||
List<BaseTreeNode> nodeByNodeIds = functionalCaseModuleService.getNodeByNodeIds(projectModuleIds);
|
||||
|
@ -804,8 +804,8 @@ public class CaseReviewFunctionalCaseService {
|
|||
List<OptionDTO> optionDTOS = new ArrayList<>();
|
||||
collect.forEach((k, v) -> {
|
||||
OptionDTO optionDTO = new OptionDTO();
|
||||
optionDTO.setId(v.get(0).getUserName());
|
||||
optionDTO.setName(v.get(0).getStatus());
|
||||
optionDTO.setId(v.getFirst().getUserName());
|
||||
optionDTO.setName(v.getFirst().getStatus());
|
||||
optionDTOS.add(optionDTO);
|
||||
});
|
||||
return optionDTOS;
|
||||
|
|
|
@ -290,7 +290,7 @@ public class FunctionalCaseAttachmentService {
|
|||
example.createCriteria().andFileIdEqualTo(request.getFileId()).andCaseIdEqualTo(request.getCaseId());
|
||||
List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(caseAttachments)) {
|
||||
FunctionalCaseAttachment attachment = caseAttachments.get(0);
|
||||
FunctionalCaseAttachment attachment = caseAttachments.getFirst();
|
||||
FileRequest fileRequest = new FileRequest();
|
||||
fileRequest.setFileName(attachment.getFileName());
|
||||
fileRequest.setFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), request.getCaseId()) + "/" + attachment.getFileId());
|
||||
|
@ -315,7 +315,7 @@ public class FunctionalCaseAttachmentService {
|
|||
List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example);
|
||||
byte[] bytes = null;
|
||||
if (CollectionUtils.isNotEmpty(caseAttachments)) {
|
||||
FunctionalCaseAttachment attachment = caseAttachments.get(0);
|
||||
FunctionalCaseAttachment attachment = caseAttachments.getFirst();
|
||||
FileRequest fileRequest = new FileRequest();
|
||||
fileRequest.setFileName(attachment.getFileName());
|
||||
fileRequest.setFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), request.getCaseId()) + "/" + attachment.getFileId());
|
||||
|
@ -334,7 +334,7 @@ public class FunctionalCaseAttachmentService {
|
|||
example.createCriteria().andFileIdEqualTo(request.getFileId()).andCaseIdEqualTo(request.getCaseId());
|
||||
List<FunctionalCaseAttachment> caseAttachments = functionalCaseAttachmentMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(caseAttachments)) {
|
||||
return caseAttachments.get(0);
|
||||
return caseAttachments.getFirst();
|
||||
}
|
||||
return new FunctionalCaseAttachment();
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ public class FunctionalCaseAttachmentService {
|
|||
if (CollectionUtils.isEmpty(folderFileNames)) {
|
||||
return null;
|
||||
}
|
||||
String[] pathSplit = folderFileNames.get(0).split("/");
|
||||
String[] pathSplit = folderFileNames.getFirst().split("/");
|
||||
return pathSplit[pathSplit.length - 1];
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -533,7 +533,7 @@ public class FunctionalCaseAttachmentService {
|
|||
bytes = getPreviewImg(fileName, fileId, compressed);
|
||||
} else {
|
||||
//在正式目录获取
|
||||
FunctionalCaseAttachment attachment = caseAttachments.get(0);
|
||||
FunctionalCaseAttachment attachment = caseAttachments.getFirst();
|
||||
fileName = attachment.getFileName();
|
||||
FileRequest fileRequest = new FileRequest();
|
||||
fileRequest.setFileName(attachment.getFileName());
|
||||
|
|
|
@ -60,7 +60,7 @@ public class FunctionalCaseCustomFieldService {
|
|||
example.createCriteria().andCaseIdEqualTo(caseId).andFieldIdEqualTo(fieldId);
|
||||
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(functionalCaseCustomFields)) {
|
||||
return functionalCaseCustomFields.get(0);
|
||||
return functionalCaseCustomFields.getFirst();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class FunctionalCaseDemandService {
|
|||
if (functionalCaseDemandMap.containsKey(demand.getParent())) {
|
||||
FunctionalDemandDTO functionalDemandDTO = new FunctionalDemandDTO();
|
||||
BeanUtils.copyBean(functionalDemandDTO, demand);
|
||||
functionalCaseDemandMap.get(demand.getParent()).stream().filter(t -> StringUtils.equalsIgnoreCase(t.getDemandPlatform(), demand.getDemandPlatform())).toList().get(0).addChild(functionalDemandDTO);
|
||||
functionalCaseDemandMap.get(demand.getParent()).stream().filter(t -> StringUtils.equalsIgnoreCase(t.getDemandPlatform(), demand.getDemandPlatform())).toList().getFirst().addChild(functionalDemandDTO);
|
||||
resetMap(demand, functionalCaseDemandMap, functionalDemandDTO);
|
||||
} else {
|
||||
notMatchedList.add(demand);
|
||||
|
@ -196,7 +196,7 @@ public class FunctionalCaseDemandService {
|
|||
if (functionalCaseDemand == null) {
|
||||
throw new MSException(Translator.get("case.demand.not.exist"));
|
||||
}
|
||||
dealWithDemand(request.getDemandList().get(0), functionalCaseDemand);
|
||||
dealWithDemand(request.getDemandList().getFirst(), functionalCaseDemand);
|
||||
functionalCaseDemand.setCreateTime(null);
|
||||
functionalCaseDemand.setCreateUser(null);
|
||||
functionalCaseDemand.setUpdateUser(userId);
|
||||
|
|
|
@ -252,7 +252,7 @@ public class FunctionalCaseService {
|
|||
private static void copyFile(FunctionalCaseAddRequest request, String caseId, String saveAttachmentFileId, Map<String, List<FunctionalCaseAttachment>> oldFileMap, FunctionalCaseAttachmentDTO functionalCaseAttachmentDTO, FileRepository defaultRepository) {
|
||||
List<FunctionalCaseAttachment> oldFunctionalCaseAttachments = oldFileMap.get(saveAttachmentFileId);
|
||||
if (CollectionUtils.isNotEmpty(oldFunctionalCaseAttachments)) {
|
||||
FunctionalCaseAttachment functionalCaseAttachment = oldFunctionalCaseAttachments.get(0);
|
||||
FunctionalCaseAttachment functionalCaseAttachment = oldFunctionalCaseAttachments.getFirst();
|
||||
// 复制文件
|
||||
FileCopyRequest fileCopyRequest = new FileCopyRequest();
|
||||
fileCopyRequest.setCopyFolder(DefaultRepositoryDir.getFunctionalCaseDir(request.getProjectId(), functionalCaseAttachment.getCaseId()) + "/" + saveAttachmentFileId);
|
||||
|
@ -362,7 +362,7 @@ public class FunctionalCaseService {
|
|||
|
||||
List<ProjectVersion> versions = extBaseProjectVersionMapper.getVersionByIds(List.of(functionalCaseDetailDTO.getVersionId()));
|
||||
if (CollectionUtils.isNotEmpty(versions)) {
|
||||
functionalCaseDetailDTO.setVersionName(versions.get(0).getName());
|
||||
functionalCaseDetailDTO.setVersionName(versions.getFirst().getName());
|
||||
}
|
||||
|
||||
|
||||
|
@ -483,7 +483,7 @@ public class FunctionalCaseService {
|
|||
if (CollectionUtils.isEmpty(functionalCases)) {
|
||||
throw new MSException(CaseManagementResultCode.FUNCTIONAL_CASE_NOT_FOUND);
|
||||
}
|
||||
return functionalCases.get(0);
|
||||
return functionalCases.getFirst();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1061,7 +1061,7 @@ public class FunctionalCaseService {
|
|||
example.createCriteria().andNumEqualTo(Long.valueOf(num)).andProjectIdEqualTo(projectId).andDeletedEqualTo(false);
|
||||
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(functionalCases)) {
|
||||
return functionalCases.get(0).getId();
|
||||
return functionalCases.getFirst().getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1343,8 +1343,8 @@ public class FunctionalCaseService {
|
|||
}
|
||||
|
||||
private void batchHandImportUpdateLog(FunctionalCaseHistoryLogDTO newData, Map<String, List<FunctionalCase>> collect, Map<String, List<FunctionalCaseBlob>> blobsCollect, Map<String, List<FunctionalCaseCustomField>> customFieldMap, List<LogDTO> logDTOS, SessionUser user) {
|
||||
FunctionalCase oldCase = collect.get(newData.getFunctionalCase().getId()).get(0);
|
||||
FunctionalCaseBlob oldBlod = blobsCollect.get(newData.getFunctionalCase().getId()).get(0);
|
||||
FunctionalCase oldCase = collect.get(newData.getFunctionalCase().getId()).getFirst();
|
||||
FunctionalCaseBlob oldBlod = blobsCollect.get(newData.getFunctionalCase().getId()).getFirst();
|
||||
List<FunctionalCaseCustomField> oldCustomFields = customFieldMap.get(newData.getFunctionalCase().getId());
|
||||
batchSaveImportData(newData, new FunctionalCaseHistoryLogDTO(oldCase, oldBlod, oldCustomFields, new ArrayList<>(), new ArrayList<>()), user, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE, logDTOS);
|
||||
}
|
||||
|
@ -1377,7 +1377,7 @@ public class FunctionalCaseService {
|
|||
private void parseUpdateDataToModule(FunctionalCaseExcelData functionalCaseExcelData, FunctionalCaseImportRequest request, String userId, Map<String, String> caseModulePathMap, TemplateDTO defaultTemplateDTO, FunctionalCaseMapper caseMapper, FunctionalCaseBlobMapper caseBlobMapper,
|
||||
FunctionalCaseCustomFieldMapper customFieldMapper, Map<String, TemplateCustomFieldDTO> customFieldsMap, Map<String, List<FunctionalCase>> collect, List<FunctionalCaseHistoryLogDTO> historyLogDTOS) {
|
||||
//用例表
|
||||
FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).get(0);
|
||||
FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).getFirst();
|
||||
|
||||
functionalCase.setName(functionalCaseExcelData.getName());
|
||||
functionalCase.setModuleId(caseModulePathMap.get(functionalCaseExcelData.getModule()));
|
||||
|
@ -1409,9 +1409,9 @@ public class FunctionalCaseService {
|
|||
}
|
||||
|
||||
private void addStatusIds(List<ProjectApplication> projectApplications, List<String> caseIds, Map<String, List<FunctionalCase>> collect, Map<String, List<FunctionalCaseBlob>> blobsCollect, FunctionalCaseExcelData functionalCaseExcelData) {
|
||||
FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).get(0);
|
||||
if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.get(0).getTypeValue())) {
|
||||
FunctionalCaseBlob blob = blobsCollect.get(functionalCaseExcelData.getNum()).get(0);
|
||||
FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).getFirst();
|
||||
if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.getFirst().getTypeValue())) {
|
||||
FunctionalCaseBlob blob = blobsCollect.get(functionalCaseExcelData.getNum()).getFirst();
|
||||
if (!StringUtils.equals(functionalCase.getName(), functionalCaseExcelData.getName())
|
||||
|| !StringUtils.equals(new String(blob.getSteps(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getSteps(), StringUtils.EMPTY))
|
||||
|| !StringUtils.equals(new String(blob.getTextDescription(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getTextDescription(), StringUtils.EMPTY))
|
||||
|
|
|
@ -135,7 +135,7 @@ public class ReviewFunctionalCaseService {
|
|||
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(request.getReviewId()).andCaseIdEqualTo(request.getCaseId());
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
String status = caseReviewFunctionalCases.get(0).getStatus();
|
||||
String status = caseReviewFunctionalCases.getFirst().getStatus();
|
||||
if (StringUtils.equals(request.getReviewPassRule(), CaseReviewPassRule.SINGLE.toString())) {
|
||||
if (StringUtils.equalsIgnoreCase(request.getStatus(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()) || isAdmin) {
|
||||
functionalCaseStatus = status;
|
||||
|
@ -151,10 +151,10 @@ public class ReviewFunctionalCaseService {
|
|||
AtomicInteger unPassCount = new AtomicInteger();
|
||||
hasReviewedUserMap.forEach((k, v) -> {
|
||||
List<CaseReviewHistory> list = v.stream().sorted(Comparator.comparing(CaseReviewHistory::getCreateTime).reversed()).toList();
|
||||
if (StringUtils.equalsIgnoreCase(list.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
|
||||
if (StringUtils.equalsIgnoreCase(list.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
|
||||
passCount.set(passCount.get() + 1);
|
||||
}
|
||||
if (StringUtils.equalsIgnoreCase(list.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) {
|
||||
if (StringUtils.equalsIgnoreCase(list.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString())) {
|
||||
unPassCount.set(unPassCount.get() + 1);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -87,7 +87,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
checkLog(caseReview.getId(), OperationLogType.ADD);
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审1");
|
||||
Assertions.assertEquals(1, caseReviews.size());
|
||||
String caseReviewId = caseReviews.get(0).getId();
|
||||
String caseReviewId = caseReviews.getFirst().getId();
|
||||
CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample();
|
||||
caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId);
|
||||
List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample);
|
||||
|
@ -131,7 +131,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
list = caseReviews.stream().map(CaseReview::getId).distinct().toList();
|
||||
Assertions.assertEquals(1, list.size());
|
||||
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.get(0).getId());
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.getFirst().getId());
|
||||
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
FunctionalCaseExample functionalCaseExample = new FunctionalCaseExample();
|
||||
functionalCaseExample.createCriteria().andProjectIdEqualTo(baseAssociateCaseRequest.getProjectId());
|
||||
|
@ -194,7 +194,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
this.requestPostWithOk(ADD_CASE_REVIEW, caseReviewRequest);
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审2");
|
||||
Assertions.assertEquals(1, caseReviews.size());
|
||||
String caseReviewId = caseReviews.get(0).getId();
|
||||
String caseReviewId = caseReviews.getFirst().getId();
|
||||
CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample();
|
||||
caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId);
|
||||
List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample);
|
||||
|
@ -213,8 +213,8 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
this.requestPostWithOk(ADD_CASE_REVIEW, caseReviewRequest);
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审3");
|
||||
Assertions.assertEquals(1, caseReviews.size());
|
||||
String caseReviewId = caseReviews.get(0).getId();
|
||||
Assertions.assertNotNull(caseReviews.get(0).getTags());
|
||||
String caseReviewId = caseReviews.getFirst().getId();
|
||||
Assertions.assertNotNull(caseReviews.getFirst().getTags());
|
||||
CaseReviewUserExample caseReviewUserExample = new CaseReviewUserExample();
|
||||
caseReviewUserExample.createCriteria().andReviewIdEqualTo(caseReviewId);
|
||||
List<CaseReviewUser> caseReviewUsers = caseReviewUserMapper.selectByExample(caseReviewUserExample);
|
||||
|
@ -245,7 +245,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
@Order(5)
|
||||
public void followCaseReview() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审1");
|
||||
CaseReview caseReview = caseReviews.get(0);
|
||||
CaseReview caseReview = caseReviews.getFirst();
|
||||
CaseReviewFollowerRequest caseReviewFollowerRequest = new CaseReviewFollowerRequest();
|
||||
caseReviewFollowerRequest.setCaseReviewId(caseReview.getId());
|
||||
caseReviewFollowerRequest.setUserId("admin");
|
||||
|
@ -276,14 +276,14 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
@Order(7)
|
||||
public void editCaseReviewSuccess() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审1");
|
||||
CaseReview caseReview = caseReviews.get(0);
|
||||
CaseReview caseReview = caseReviews.getFirst();
|
||||
CaseReviewRequest caseReviewRequest = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), null, true, true, caseReview.getId());
|
||||
this.requestPostWithOk(EDIT_CASE_REVIEW, caseReviewRequest);
|
||||
List<CaseReview> updateCaseReviews = getCaseReviews("创建评审更新1");
|
||||
Assertions.assertEquals(1, updateCaseReviews.size());
|
||||
|
||||
List<CaseReview> caseReviews2 = getCaseReviews("创建评审2");
|
||||
CaseReview caseReview2 = caseReviews2.get(0);
|
||||
CaseReview caseReview2 = caseReviews2.getFirst();
|
||||
CaseReviewRequest caseReviewRequest2 = getCaseReviewAddRequest("创建评审更新2", CaseReviewPassRule.SINGLE.toString(), null, false, true, caseReview2.getId());
|
||||
this.requestPostWithOk(EDIT_CASE_REVIEW, caseReviewRequest2);
|
||||
List<CaseReview> updateCaseReviews2 = getCaseReviews("创建评审更新2");
|
||||
|
@ -299,7 +299,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
caseReviewRequest = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), null, true, true, "XXX");
|
||||
this.requestPost(EDIT_CASE_REVIEW, caseReviewRequest).andExpect(status().is5xxServerError());
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审1");
|
||||
CaseReview caseReview = caseReviews.get(0);
|
||||
CaseReview caseReview = caseReviews.getFirst();
|
||||
CaseReviewRequest caseReviewRequestWidthStartTime = getCaseReviewAddRequest("创建评审更新1", CaseReviewPassRule.SINGLE.toString(), caseReview.getId(), true, true, null);
|
||||
caseReviewRequestWidthStartTime.setStartTime(1678188043000L);
|
||||
caseReviewRequestWidthStartTime.setEndTime(1678188103000L);
|
||||
|
@ -324,7 +324,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
public void associateCaseSuccess() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
|
||||
Assertions.assertEquals(1, caseReviews.size());
|
||||
String caseReviewId = caseReviews.get(0).getId();
|
||||
String caseReviewId = caseReviews.getFirst().getId();
|
||||
CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviewId);
|
||||
|
@ -350,7 +350,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(userIdList.contains("gyq_review_test"));
|
||||
Assertions.assertTrue(userIdList.contains("gyq_review_test2"));
|
||||
List<CaseReview> caseReviews2 = getCaseReviews("创建评审更新1");
|
||||
Assertions.assertTrue( caseReviews.get(0).getCaseCount()<caseReviews2.get(0).getCaseCount());
|
||||
Assertions.assertTrue( caseReviews.getFirst().getCaseCount()<caseReviews2.getFirst().getCaseCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -371,7 +371,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
|
||||
caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviews.get(0).getId());
|
||||
caseReviewAssociateRequest.setReviewId(caseReviews.getFirst().getId());
|
||||
baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId(projectId);
|
||||
baseAssociateCaseRequest.setSelectAll(false);
|
||||
|
@ -385,7 +385,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
|
||||
caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviews.get(0).getId());
|
||||
caseReviewAssociateRequest.setReviewId(caseReviews.getFirst().getId());
|
||||
baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId("project-gyq-case-review-testYY");
|
||||
baseAssociateCaseRequest.setSelectAll(true);
|
||||
|
@ -453,7 +453,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(moduleCount.containsKey("all"));
|
||||
|
||||
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.get(0).getId());
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviews.getFirst().getId());
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Map<String, CaseReviewFunctionalCase> caseReviewFunctionalCaseMap = caseReviewFunctionalCases.stream().collect(Collectors.toMap(CaseReviewFunctionalCase::getCaseId, t -> t));
|
||||
caseReviewFunctionalCaseMap.forEach((k, v) -> {
|
||||
|
@ -491,11 +491,11 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
|
||||
List<CaseReviewDTO> caseReviewDTOS = JSON.parseArray(JSON.toJSONString(pageData.getList()), CaseReviewDTO.class);
|
||||
List<CaseReviewDTO> caseReviewOne = caseReviewDTOS.stream().filter(t -> StringUtils.equals(t.getName(), "创建评审更新1")).toList();
|
||||
Assertions.assertTrue(caseReviewOne.get(0).getPassCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.get(0).getUnPassCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.get(0).getUnderReviewedCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.get(0).getReReviewedCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.get(0).getReviewedCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.getFirst().getPassCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.getFirst().getUnPassCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.getFirst().getUnderReviewedCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.getFirst().getReReviewedCount() > 0);
|
||||
Assertions.assertTrue(caseReviewOne.getFirst().getReviewedCount() > 0);
|
||||
|
||||
request = new CaseReviewPageRequest();
|
||||
filters = new HashMap<>();
|
||||
|
@ -551,26 +551,26 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
public void testPos() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
|
||||
List<CaseReview> caseReviews2 = getCaseReviews("创建评审更新2");
|
||||
Long pos = caseReviews.get(0).getPos();
|
||||
Long pos2 = caseReviews2.get(0).getPos();
|
||||
Long pos = caseReviews.getFirst().getPos();
|
||||
Long pos2 = caseReviews2.getFirst().getPos();
|
||||
PosRequest posRequest = new PosRequest();
|
||||
posRequest.setProjectId(projectId);
|
||||
posRequest.setTargetId(caseReviews.get(0).getId());
|
||||
posRequest.setMoveId(caseReviews2.get(0).getId());
|
||||
posRequest.setTargetId(caseReviews.getFirst().getId());
|
||||
posRequest.setMoveId(caseReviews2.getFirst().getId());
|
||||
posRequest.setMoveMode("AFTER");
|
||||
this.requestPostWithOkAndReturn(EDIT_POS_CASE_REVIEW_URL, posRequest);
|
||||
caseReviews = getCaseReviews("创建评审更新1");
|
||||
caseReviews2 = getCaseReviews("创建评审更新2");
|
||||
Long pos3 = caseReviews.get(0).getPos();
|
||||
Long pos4 = caseReviews2.get(0).getPos();
|
||||
Long pos3 = caseReviews.getFirst().getPos();
|
||||
Long pos4 = caseReviews2.getFirst().getPos();
|
||||
Assertions.assertTrue(Objects.equals(pos, pos3));
|
||||
Assertions.assertTrue(pos2 > pos4);
|
||||
posRequest.setMoveMode("BEFORE");
|
||||
this.requestPostWithOkAndReturn(EDIT_POS_CASE_REVIEW_URL, posRequest);
|
||||
caseReviews = getCaseReviews("创建评审更新1");
|
||||
caseReviews2 = getCaseReviews("创建评审更新2");
|
||||
Long pos5 = caseReviews.get(0).getPos();
|
||||
Long pos6 = caseReviews2.get(0).getPos();
|
||||
Long pos5 = caseReviews.getFirst().getPos();
|
||||
Long pos6 = caseReviews2.getFirst().getPos();
|
||||
Assertions.assertTrue(Objects.equals(pos5, pos3));
|
||||
Assertions.assertTrue(pos6 > pos4);
|
||||
}
|
||||
|
@ -579,7 +579,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
@Order(14)
|
||||
public void testFunctionalCaseDetail() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
|
||||
String id = caseReviews.get(0).getId();
|
||||
String id = caseReviews.getFirst().getId();
|
||||
assertErrorCode(this.requestGet(DETAIL_CASE_REVIEW + "ERROR_TEST_FUNCTIONAL_CASE_ID"), CaseManagementResultCode.CASE_REVIEW_NOT_FOUND);
|
||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(DETAIL_CASE_REVIEW + id);
|
||||
// 获取返回值
|
||||
|
@ -593,17 +593,17 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
@Order(15)
|
||||
public void testBatchMove() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
|
||||
String moduleId = caseReviews.get(0).getModuleId();
|
||||
String moduleId = caseReviews.getFirst().getModuleId();
|
||||
CaseReviewBatchRequest request = new CaseReviewBatchRequest();
|
||||
request.setProjectId(projectId);
|
||||
request.setMoveModuleId("CASE_REVIEW_REAL_MODULE_ID2");
|
||||
request.setSelectAll(false);
|
||||
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
|
||||
request.setSelectAll(true);
|
||||
request.setExcludeIds(List.of(caseReviews.get(0).getId()));
|
||||
request.setExcludeIds(List.of(caseReviews.getFirst().getId()));
|
||||
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
|
||||
caseReviews = getCaseReviews("创建评审更新1");
|
||||
String moduleIdNew = caseReviews.get(0).getModuleId();
|
||||
String moduleIdNew = caseReviews.getFirst().getModuleId();
|
||||
Assertions.assertTrue(StringUtils.equals(moduleId, moduleIdNew));
|
||||
request = new CaseReviewBatchRequest();
|
||||
request.setProjectId(projectId);
|
||||
|
@ -611,7 +611,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
request.setSelectAll(false);
|
||||
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
|
||||
caseReviews = getCaseReviews("创建评审更新1");
|
||||
String moduleIdNewOne = caseReviews.get(0).getModuleId();
|
||||
String moduleIdNewOne = caseReviews.getFirst().getModuleId();
|
||||
Assertions.assertTrue(StringUtils.equals(moduleIdNewOne, moduleIdNew));
|
||||
request.setMoveModuleId(null);
|
||||
request.setSelectAll(false);
|
||||
|
@ -622,7 +622,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
@Order(16)
|
||||
public void testDelete() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新2");
|
||||
delCaseReview(caseReviews.get(0).getId());
|
||||
delCaseReview(caseReviews.getFirst().getId());
|
||||
|
||||
delCaseReview("caseReviewIdX");
|
||||
}
|
||||
|
@ -633,7 +633,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
public void testDisassociate() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
|
||||
Assertions.assertEquals(1, caseReviews.size());
|
||||
String caseReviewId = caseReviews.get(0).getId();
|
||||
String caseReviewId = caseReviews.getFirst().getId();
|
||||
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviewId).andCaseIdEqualTo("CASE_REVIEW_TEST_GYQ_ID6");
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
|
@ -651,7 +651,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
|
||||
caseReviews = getCaseReviews("创建评审3");
|
||||
Assertions.assertEquals(1, caseReviews.size());
|
||||
caseReviewId = caseReviews.get(0).getId();
|
||||
caseReviewId = caseReviews.getFirst().getId();
|
||||
CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviewId);
|
||||
|
@ -680,7 +680,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
@Order(18)
|
||||
public void testDisassociateFalse() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建评审更新1");
|
||||
String caseReviewId = caseReviews.get(0).getId();
|
||||
String caseReviewId = caseReviews.getFirst().getId();
|
||||
mockMvc.perform(MockMvcRequestBuilders.get(DISASSOCIATE_CASE_REVIEW+caseReviewId+"/CASE_REVIEW_TEST_GYQ_IDXX").header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||
.header(SessionConstants.CURRENT_PROJECT, projectId)
|
||||
|
|
|
@ -238,7 +238,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
@Order(7)
|
||||
public void testPos() throws Exception {
|
||||
List<CaseReviewFunctionalCase> caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
|
||||
CaseReviewFunctionalCase caseReviews = caseReviewList.get(0);
|
||||
CaseReviewFunctionalCase caseReviews = caseReviewList.getFirst();
|
||||
CaseReviewFunctionalCase caseReviews2 = caseReviewList.get(1);
|
||||
Long pos = caseReviews.getPos();
|
||||
Long pos2 = caseReviews2.getPos();
|
||||
|
@ -251,7 +251,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_POS, posRequest);
|
||||
caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
|
||||
caseReviews = caseReviewList.get(1);
|
||||
caseReviews2 = caseReviewList.get(0);
|
||||
caseReviews2 = caseReviewList.getFirst();
|
||||
Long pos3 = caseReviews.getPos();
|
||||
Long pos4 = caseReviews2.getPos();
|
||||
Assertions.assertTrue(Objects.equals(pos, pos3));
|
||||
|
@ -259,7 +259,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
posRequest.setMoveMode("BEFORE");
|
||||
this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_POS, posRequest);
|
||||
caseReviewList = getCaseReviewFunctionalCase("wx_review_id_1");
|
||||
caseReviews = caseReviewList.get(0);
|
||||
caseReviews = caseReviewList.getFirst();
|
||||
caseReviews2 = caseReviewList.get(1);
|
||||
Long pos5 = caseReviews.getPos();
|
||||
Long pos6 = caseReviews2.getPos();
|
||||
|
|
|
@ -435,7 +435,7 @@ public class FunctionalCaseCommentControllerTests {
|
|||
FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample();
|
||||
functionalCaseCommentExample.createCriteria().andCaseIdEqualTo("xiaomeinvGTest").andNotifierEqualTo("default-project-member-user-guo;default-project-member-user-guo;default-project-member-user-guo-4;");
|
||||
List<FunctionalCaseComment> functionalCaseComments = functionalCaseCommentMapper.selectByExample(functionalCaseCommentExample);
|
||||
String id = functionalCaseComments.get(0).getId();
|
||||
String id = functionalCaseComments.getFirst().getId();
|
||||
Assertions.assertFalse(functionalCaseComments.isEmpty());
|
||||
delFunctionalCaseComment(id);
|
||||
functionalCaseCommentExample = new FunctionalCaseCommentExample();
|
||||
|
@ -517,7 +517,7 @@ public class FunctionalCaseCommentControllerTests {
|
|||
FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample();
|
||||
functionalCaseCommentExample.createCriteria().andCaseIdEqualTo("xiaomeinvGTest");
|
||||
List<FunctionalCaseComment> functionalCaseComments = functionalCaseCommentMapper.selectByExample(functionalCaseCommentExample);
|
||||
return functionalCaseComments.get(0);
|
||||
return functionalCaseComments.getFirst();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
|
|||
functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
||||
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID");
|
||||
functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
|
||||
Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.get(0).getDemandName(), "手动加入2"));
|
||||
Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.getFirst().getDemandName(), "手动加入2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -292,7 +292,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
|
|||
functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
||||
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID");
|
||||
functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
|
||||
Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.get(0).getDemandName(), "手动加入2"));
|
||||
Assertions.assertTrue(StringUtils.equals(functionalCaseDemands.getFirst().getDemandName(), "手动加入2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -314,7 +314,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
|
|||
functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
||||
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo("DEMAND_TEST_FUNCTIONAL_CASE_ID");
|
||||
functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
|
||||
Assertions.assertNotNull(functionalCaseDemands.get(0).getDemandId());
|
||||
Assertions.assertNotNull(functionalCaseDemands.getFirst().getDemandId());
|
||||
|
||||
functionalCaseDemandRequest = new FunctionalCaseDemandRequest();
|
||||
functionalCaseDemandRequest.setId("hehe");
|
||||
|
@ -344,7 +344,7 @@ public class FunctionalCaseDemandControllerTests extends BaseTest {
|
|||
FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample();
|
||||
functionalCaseDemandExample.createCriteria().andCaseIdEqualTo(caseId);
|
||||
List<FunctionalCaseDemand> functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample);
|
||||
return functionalCaseDemands.get(0).getId();
|
||||
return functionalCaseDemands.getFirst().getId();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -291,7 +291,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
FunctionalCaseCustomFieldExample customFieldExample = new FunctionalCaseCustomFieldExample();
|
||||
customFieldExample.createCriteria().andCaseIdEqualTo("TEST_FUNCTIONAL_MINDER_CASE_ID_1").andFieldIdEqualTo("custom_field_minder_gyq_id_3");
|
||||
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.get(0).getValue(),"P0"));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.getFirst().getValue(),"P0"));
|
||||
|
||||
FunctionalCaseModule functionalCaseModule = functionalCaseModuleMapper.selectByPrimaryKey("TEST_MINDER_MODULE_ID_GYQ7");
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseModule.getName(),"移动7"));
|
||||
|
@ -313,18 +313,18 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
|
|||
functionalCaseExample.createCriteria().andNameEqualTo("新增用例");
|
||||
functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
|
||||
Assertions.assertTrue(functionalCases.get(0).getPos() > 0L);
|
||||
Assertions.assertTrue(functionalCases.getFirst().getPos() > 0L);
|
||||
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
|
||||
customFieldExample = new FunctionalCaseCustomFieldExample();
|
||||
customFieldExample.createCriteria().andCaseIdEqualTo(functionalCases.get(0).getId()).andFieldIdEqualTo("custom_field_minder_gyq_id_3");
|
||||
customFieldExample.createCriteria().andCaseIdEqualTo(functionalCases.getFirst().getId()).andFieldIdEqualTo("custom_field_minder_gyq_id_3");
|
||||
functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.get(0).getValue(),"P2"));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.getFirst().getValue(),"P2"));
|
||||
FunctionalCaseModuleExample functionalCaseModuleExample = new FunctionalCaseModuleExample();
|
||||
functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9");
|
||||
List<FunctionalCaseModule> functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample);
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCaseModules));
|
||||
Assertions.assertTrue(functionalCaseModules.get(0).getPos() > 0L);
|
||||
Assertions.assertTrue(functionalCaseModules.getFirst().getPos() > 0L);
|
||||
request = new FunctionalCaseMinderEditRequest();
|
||||
request.setProjectId("project-case-minder-test");
|
||||
request.setVersionId("ffff");
|
||||
|
|
|
@ -76,7 +76,7 @@ public class FunctionalCaseReviewControllerTests extends BaseTest {
|
|||
caseReviewHistory.setCreateTime(System.currentTimeMillis());
|
||||
caseReviewHistoryMapper.insertSelective(caseReviewHistory);
|
||||
List<CaseReviewHistoryDTO> gyqReviewCaseTest = getCaseReviewHistoryList("gyqReviewCaseTest");
|
||||
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.get(0).getContentText()));
|
||||
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.getFirst().getContentText()));
|
||||
caseReviewHistory = new CaseReviewHistory();
|
||||
caseReviewHistory.setReviewId("用例关系名称2");
|
||||
caseReviewHistory.setCaseId("gyqReviewCaseTest");
|
||||
|
|
|
@ -581,7 +581,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest {
|
|||
testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis());
|
||||
testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory);
|
||||
List<TestPlanCaseExecuteHistoryDTO> gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case");
|
||||
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.get(0).getContentText()));
|
||||
Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.getFirst().getContentText()));
|
||||
testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory();
|
||||
testPlanCaseExecuteHistory.setTestPlanCaseId("test_plan_associate_case_gyq_two");
|
||||
testPlanCaseExecuteHistory.setTestPlanId("associate_case_plan_gyq_two");
|
||||
|
|
|
@ -94,7 +94,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
reviewers.add("admin");
|
||||
reviewers.add("default-project-member-user-gyq");
|
||||
List<CaseReview> caseReviews = addReview("创建用例评审1", caseIds, reviewers, CaseReviewPassRule.SINGLE.toString());
|
||||
String reviewId = caseReviews.get(0).getId();
|
||||
String reviewId = caseReviews.getFirst().getId();
|
||||
ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTest");
|
||||
|
@ -111,7 +111,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTest");
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString()));
|
||||
//单人评审不通过
|
||||
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
|
@ -129,7 +129,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
|
||||
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString()));
|
||||
|
||||
|
||||
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
|
@ -148,7 +148,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
|
||||
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
|
||||
|
||||
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
|
@ -161,7 +161,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
reviewFunctionalCaseService.saveReview(reviewFunctionalCaseRequest, "default-project-member-user-gyq-4");
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
|
||||
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
|
||||
|
||||
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
|
@ -174,7 +174,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
reviewFunctionalCaseService.saveReview(reviewFunctionalCaseRequest, "admin");
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
|
||||
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -187,7 +187,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
reviewers.add("admin");
|
||||
reviewers.add("default-project-member-user-gyq");
|
||||
List<CaseReview> caseReviews = addReview("创建用例评审2", caseIds, reviewers, CaseReviewPassRule.MULTIPLE.toString());
|
||||
String reviewId = caseReviews.get(0).getId();
|
||||
String reviewId = caseReviews.getFirst().getId();
|
||||
CaseReviewHistory caseReviewHistory = new CaseReviewHistory();
|
||||
caseReviewHistory.setReviewId(reviewId);
|
||||
caseReviewHistory.setCaseId("gyqReviewCaseTestTwo");
|
||||
|
@ -213,9 +213,9 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestTwo");
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()));
|
||||
List<CaseReview> caseReviews1 = getCaseReviews("创建用例评审2");
|
||||
System.out.println(caseReviews1.get(0).getStatus());
|
||||
System.out.println(caseReviews1.getFirst().getStatus());
|
||||
|
||||
|
||||
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
|
@ -247,7 +247,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
List<String> reviewers = new ArrayList<>();
|
||||
reviewers.add("admin");
|
||||
List<CaseReview> caseReviews = addReview("创建用例评审3", caseIds, reviewers, CaseReviewPassRule.MULTIPLE.toString());
|
||||
String reviewId = caseReviews.get(0).getId();
|
||||
String reviewId = caseReviews.getFirst().getId();
|
||||
ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTestThree");
|
||||
|
@ -264,7 +264,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
CaseReviewFunctionalCaseExample caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestThree");
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.PASS.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.PASS.toString()));
|
||||
|
||||
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
|
@ -282,7 +282,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestFour");
|
||||
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.getFirst().getStatus(), FunctionalCaseReviewStatus.UN_PASS.toString()));
|
||||
|
||||
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
List<String> reviewers = new ArrayList<>();
|
||||
reviewers.add("admin");
|
||||
List<CaseReview> caseReviews = addReview("创建用例评审4", caseIds, reviewers, CaseReviewPassRule.SINGLE.toString());
|
||||
String reviewId = caseReviews.get(0).getId();
|
||||
String reviewId = caseReviews.getFirst().getId();
|
||||
ReviewFunctionalCaseRequest reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTestFour");
|
||||
|
@ -313,7 +313,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
@Order(4)
|
||||
public void getListSuccess() throws Exception {
|
||||
List<CaseReview> caseReviews = getCaseReviews("创建用例评审1");
|
||||
String reviewId = caseReviews.get(0).getId();
|
||||
String reviewId = caseReviews.getFirst().getId();
|
||||
CaseReviewHistory caseReviewHistory = new CaseReviewHistory();
|
||||
caseReviewHistory.setReviewId(reviewId);
|
||||
caseReviewHistory.setCaseId("gyqReviewCaseTest");
|
||||
|
|
|
@ -19,10 +19,10 @@ public class KeyStoreConfig {
|
|||
if (CollectionUtils.isNotEmpty(entry)) {
|
||||
List<KeyStoreEntry> entryList = this.entry.stream().filter(KeyStoreEntry::isDefault).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(entryList)) {
|
||||
if (StringUtils.isNotEmpty(entryList.get(0).getNewAsName())) {
|
||||
return entryList.get(0).getNewAsName();
|
||||
if (StringUtils.isNotEmpty(entryList.getFirst().getNewAsName())) {
|
||||
return entryList.getFirst().getNewAsName();
|
||||
} else {
|
||||
return entryList.get(0).getOriginalAsName();
|
||||
return entryList.getFirst().getOriginalAsName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class KeyStoreConfig {
|
|||
if (CollectionUtils.isNotEmpty(entry)) {
|
||||
List<KeyStoreEntry> entryList = this.entry.stream().filter(ks -> StringUtils.equals(asName, ks.getNewAsName())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(entryList) && CollectionUtils.isNotEmpty(files) && files.size() == 1) {
|
||||
return entryList.get(0).getOriginalAsName();
|
||||
return entryList.getFirst().getOriginalAsName();
|
||||
}
|
||||
}
|
||||
return asName;
|
||||
|
|
|
@ -60,7 +60,7 @@ public class MessageTaskLogService {
|
|||
dto.setPath("/notice/message/task/save");
|
||||
dto.setMethod(HttpMethodConstants.POST.name());
|
||||
if (CollectionUtils.isNotEmpty(messageTasks)) {
|
||||
dto.setOriginalValue(JSON.toJSONBytes(messageTasks.get(0)));
|
||||
dto.setOriginalValue(JSON.toJSONBytes(messageTasks.getFirst()));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class MessageTaskLogService {
|
|||
ProjectRobotExample projectRobotExample = new ProjectRobotExample();
|
||||
projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andPlatformEqualTo(NoticeConstants.Type.IN_SITE);
|
||||
List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample);
|
||||
robotId = projectRobots.get(0).getId();
|
||||
robotId = projectRobots.getFirst().getId();
|
||||
}
|
||||
return robotId;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public class NoticeMessageTaskService {
|
|||
sqlSession.flushStatements();
|
||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
if (CollectionUtils.isNotEmpty(stringListMap.get(NO_USER_NAMES))) {
|
||||
String message = Translator.get("alert_others") + stringListMap.get(NO_USER_NAMES).get(0) + Translator.get("user.remove");
|
||||
String message = Translator.get("alert_others") + stringListMap.get(NO_USER_NAMES).getFirst() + Translator.get("user.remove");
|
||||
return ResultHolder.successCodeErrorInfo(ProjectResultCode.SAVE_MESSAGE_TASK_USER_NO_EXIST.getCode(), message);
|
||||
}
|
||||
return ResultHolder.success("OK");
|
||||
|
@ -130,7 +130,7 @@ public class NoticeMessageTaskService {
|
|||
ProjectRobotExample projectRobotExample = new ProjectRobotExample();
|
||||
projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andPlatformEqualTo(NoticeConstants.Type.IN_SITE);
|
||||
List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample);
|
||||
return projectRobots.get(0);
|
||||
return projectRobots.getFirst();
|
||||
} else {
|
||||
return projectRobotMapper.selectByPrimaryKey(robotId);
|
||||
}
|
||||
|
@ -503,9 +503,9 @@ public class NoticeMessageTaskService {
|
|||
}
|
||||
Map<String, List<MessageTask>> messageRobotMap = messageTasks.stream().collect(Collectors.groupingBy(MessageTask::getProjectRobotId));
|
||||
if (CollectionUtils.isNotEmpty(messageRobotMap.get(robotId))) {
|
||||
messageTask = messageRobotMap.get(robotId).get(0);
|
||||
messageTask = messageRobotMap.get(robotId).getFirst();
|
||||
} else {
|
||||
messageTask = messageTasks.get(0);
|
||||
messageTask = messageTasks.getFirst();
|
||||
messageTask.setEnable(false);
|
||||
messageTask.setUseDefaultTemplate(true);
|
||||
messageTask.setUseDefaultSubject(true);
|
||||
|
|
|
@ -422,7 +422,7 @@ public class ProjectApplicationService {
|
|||
example.createCriteria().andTypeEqualTo(String.valueOf(module)).andProjectIdEqualTo(projectId);
|
||||
List<ProjectApplication> applications = projectApplicationMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(applications)) {
|
||||
moduleMap.put(String.valueOf(module), Boolean.valueOf(applications.get(0).getTypeValue()));
|
||||
moduleMap.put(String.valueOf(module), Boolean.valueOf(applications.getFirst().getTypeValue()));
|
||||
} else {
|
||||
moduleMap.put(String.valueOf(module), Boolean.TRUE);
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ public class ProjectApplicationService {
|
|||
example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.BUG.BUG_SYNC.name() + "_" + ProjectApplicationType.PLATFORM_BUG_CONFIG.BUG_PLATFORM_CONFIG.name());
|
||||
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return list.get(0).getTypeValue().replaceAll("\\\\", "");
|
||||
return list.getFirst().getTypeValue().replaceAll("\\\\", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ public class ProjectApplicationService {
|
|||
example.createCriteria().andProjectIdEqualTo(projectId).andTypeLike(ProjectApplicationType.CASE_RELATED_CONFIG.CASE_RELATED.name() + "_" + ProjectApplicationType.PLATFORM_DEMAND_CONFIG.DEMAND_PLATFORM_CONFIG.name());
|
||||
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return list.get(0).getTypeValue().replaceAll("\\\\", "");
|
||||
return list.getFirst().getTypeValue().replaceAll("\\\\", "");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ public class ProjectApplicationService {
|
|||
ProjectApplicationExample example = new ProjectApplicationExample();
|
||||
example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(type);
|
||||
List<ProjectApplication> projectApplications = projectApplicationMapper.selectByExample(example);
|
||||
return CollectionUtils.isEmpty(projectApplications) ? null : projectApplications.get(0);
|
||||
return CollectionUtils.isEmpty(projectApplications) ? null : projectApplications.getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -604,7 +604,7 @@ public class ProjectApplicationService {
|
|||
example.createCriteria().andProjectIdEqualTo(projectId).andTypeEqualTo(ProjectApplicationType.BUG.BUG_SYNC.name() + "_MECHANISM");
|
||||
List<ProjectApplication> list = projectApplicationMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
return StringUtils.equals(list.get(0).getTypeValue(), "increment");
|
||||
return StringUtils.equals(list.getFirst().getTypeValue(), "increment");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -128,11 +128,11 @@ public class ProjectRobotService {
|
|||
List<ProjectRobot> newProjectRobots = new ArrayList<>(list.stream().sorted(Comparator.comparing(ProjectRobot::getCreateTime).reversed()).toList());
|
||||
List<ProjectRobot> mailRobot = collect.get(NoticeConstants.Type.MAIL);
|
||||
if (CollectionUtils.isNotEmpty(mailRobot)) {
|
||||
newProjectRobots.add(0, mailRobot.get(0));
|
||||
newProjectRobots.add(0, mailRobot.getFirst());
|
||||
}
|
||||
List<ProjectRobot> inSiteRobot = collect.get(NoticeConstants.Type.IN_SITE);
|
||||
if (CollectionUtils.isNotEmpty(inSiteRobot)) {
|
||||
newProjectRobots.add(0, inSiteRobot.get(0));
|
||||
newProjectRobots.add(0, inSiteRobot.getFirst());
|
||||
}
|
||||
return newProjectRobots;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ public class ProjectTemplateService extends BaseTemplateService {
|
|||
.andScopeIdEqualTo(projectId)
|
||||
.andSceneEqualTo(scene)
|
||||
.andInternalEqualTo(true);
|
||||
return templateMapper.selectByExample(example).get(0);
|
||||
return templateMapper.selectByExample(example).getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ProjectUserRoleLogService {
|
|||
|
||||
UserRoleExample example = new UserRoleExample();
|
||||
example.createCriteria().andIdEqualTo(request.getId());
|
||||
UserRole userRole = userRoleMapper.selectByExample(example).get(0);
|
||||
UserRole userRole = userRoleMapper.selectByExample(example).getFirst();
|
||||
dto.setOriginalValue(JSON.toJSONBytes(userRole.getName()));
|
||||
dto.setModifiedValue(JSON.toJSONBytes(request.getName()));
|
||||
return dto;
|
||||
|
|
|
@ -124,7 +124,7 @@ public class ProjectUserRoleService extends BaseUserRoleService {
|
|||
}
|
||||
|
||||
public void removeMember(ProjectUserRoleMemberEditRequest request) {
|
||||
String removeUserId = request.getUserIds().get(0);
|
||||
String removeUserId = request.getUserIds().getFirst();
|
||||
checkMemberParam(removeUserId, request.getUserRoleId());
|
||||
//检查移除的是不是管理员
|
||||
if (StringUtils.equals(request.getUserRoleId(),InternalUserRole.PROJECT_ADMIN.getValue())) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class CreateEnvironmentTests extends BaseTest {
|
|||
environmentExample.createCriteria().andProjectIdEqualTo(initProject.getId()).andNameEqualTo("Mock环境");
|
||||
List<Environment> environments = environmentMapper.selectByExample(environmentExample);
|
||||
assert environments.size() == 1;
|
||||
EnvironmentBlob environmentBlob = environmentBlobMapper.selectByPrimaryKey(environments.get(0).getId());
|
||||
EnvironmentBlob environmentBlob = environmentBlobMapper.selectByPrimaryKey(environments.getFirst().getId());
|
||||
assert environmentBlob != null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1142,8 +1142,8 @@ public class EnvironmentControllerTests extends BaseTest {
|
|||
MvcResult mvcResult = requestGetWithOkAndReturn(SCRIPTS, DEFAULT_PROJECT_ID);
|
||||
List<EnvironmentPluginScriptDTO> envScripts = getResultDataArray(mvcResult, EnvironmentPluginScriptDTO.class);
|
||||
Assertions.assertEquals(envScripts.size(), 1);
|
||||
Assertions.assertEquals(envScripts.get(0).getPluginId(), "tcp-sampler");
|
||||
Assertions.assertEquals(((Map) envScripts.get(0).getScript()).get("id"), "environment");
|
||||
Assertions.assertEquals(envScripts.getFirst().getPluginId(), "tcp-sampler");
|
||||
Assertions.assertEquals(((Map) envScripts.getFirst().getScript()).get("id"), "environment");
|
||||
|
||||
// 删除环境脚本,测试是否正常执行
|
||||
pluginScriptMapper.deleteByPrimaryKey(plugin.getId(), "environment");
|
||||
|
|
|
@ -111,7 +111,7 @@ public class FakeErrorControllerTests extends BaseTest {
|
|||
List<FakeError> fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
|
||||
List<FakeErrorDTO> dtoList = new ArrayList<>();
|
||||
FakeErrorDTO dto = new FakeErrorDTO();
|
||||
dto.setId(fakeErrors.get(0).getId());
|
||||
dto.setId(fakeErrors.getFirst().getId());
|
||||
dto.setName("测试新增误报规则更新");
|
||||
dto.setExpression("ok");
|
||||
dto.setProjectId(DEFAULT_PROJECT_ID);
|
||||
|
@ -125,7 +125,7 @@ public class FakeErrorControllerTests extends BaseTest {
|
|||
ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class);
|
||||
Assertions.assertNotNull(resultHolder);
|
||||
fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
|
||||
Assertions.assertTrue(fakeErrors.get(0).getEnable());
|
||||
Assertions.assertTrue(fakeErrors.getFirst().getEnable());
|
||||
|
||||
mvcResult = this.requestPostWithOkAndReturn(ADD, dtoList);
|
||||
returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
|
@ -168,7 +168,7 @@ public class FakeErrorControllerTests extends BaseTest {
|
|||
Assertions.assertNotNull(resultHolder);
|
||||
//名字重复不更新
|
||||
fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
|
||||
Assertions.assertFalse(StringUtils.equalsIgnoreCase(fakeErrors.get(0).getName(),fakeErrors.get(1).getName()));
|
||||
Assertions.assertFalse(StringUtils.equalsIgnoreCase(fakeErrors.getFirst().getName(),fakeErrors.get(1).getName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -201,7 +201,7 @@ public class FakeErrorControllerTests extends BaseTest {
|
|||
fakeErrors = fakeErrorMapper.selectByExample(new FakeErrorExample());
|
||||
list = fakeErrors.stream().filter(FakeError::getEnable).toList();
|
||||
Assertions.assertEquals(0,list.size());
|
||||
String oneId = ids.get(0);
|
||||
String oneId = ids.getFirst();
|
||||
fakeErrorStatusRequest = new FakeErrorStatusRequest();
|
||||
fakeErrorStatusRequest.setProjectId(DEFAULT_PROJECT_ID);
|
||||
fakeErrorStatusRequest.setEnable(true);
|
||||
|
@ -237,7 +237,7 @@ public class FakeErrorControllerTests extends BaseTest {
|
|||
FakeErrorExample fakeErrorExample = new FakeErrorExample();
|
||||
fakeErrorExample.createCriteria().andNameLike("用来删除");
|
||||
List<FakeError> fakeErrors = fakeErrorMapper.selectByExample(fakeErrorExample);
|
||||
String deleteId = fakeErrors.get(0).getId();
|
||||
String deleteId = fakeErrors.getFirst().getId();
|
||||
Assertions.assertEquals(1,fakeErrors.size());
|
||||
FakeErrorDelRequest request = new FakeErrorDelRequest();
|
||||
request.setProjectId(DEFAULT_PROJECT_ID);
|
||||
|
|
|
@ -141,8 +141,8 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
|
|||
messageTaskExample.createCriteria()
|
||||
.andProjectIdEqualTo("project-message-test").andProjectRobotIdEqualTo("test_message_robot2").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE);
|
||||
List<MessageTask> messageTasks1 = messageTaskMapper.selectByExample(messageTaskExample);
|
||||
Assertions.assertTrue(messageTasks1.get(0).getEnable());
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(messageTasks1.get(0).getSubject(), "看看改不改"));
|
||||
Assertions.assertTrue(messageTasks1.getFirst().getEnable());
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(messageTasks1.getFirst().getSubject(), "看看改不改"));
|
||||
|
||||
messageTaskExample = new MessageTaskExample();
|
||||
messageTaskExample.createCriteria().andProjectIdEqualTo("project-message-test").andTaskTypeEqualTo(NoticeConstants.TaskType.API_DEFINITION_TASK).andEventEqualTo(NoticeConstants.Event.CREATE);
|
||||
|
@ -267,8 +267,8 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
|
|||
}
|
||||
}
|
||||
|
||||
Assertions.assertEquals("test_message_robot2", messageTasks.get(0).getProjectRobotId());
|
||||
Assertions.assertEquals(false, messageTasks.get(0).getEnable());
|
||||
Assertions.assertEquals("test_message_robot2", messageTasks.getFirst().getProjectRobotId());
|
||||
Assertions.assertEquals(false, messageTasks.getFirst().getEnable());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -364,7 +364,7 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
|
|||
String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
|
||||
ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);
|
||||
List<MessageTaskDTO> messageTaskDetailDTOList = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), MessageTaskDTO.class);
|
||||
MessageTaskDetailDTO messageTaskDetailDTO = messageTaskDetailDTOList.get(0).getMessageTaskTypeDTOList().get(0).getMessageTaskDetailDTOList().get(0);
|
||||
MessageTaskDetailDTO messageTaskDetailDTO = messageTaskDetailDTOList.getFirst().getMessageTaskTypeDTOList().getFirst().getMessageTaskDetailDTOList().getFirst();
|
||||
Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = messageTaskDetailDTO.getProjectRobotConfigMap();
|
||||
System.out.println(projectRobotConfigMap);
|
||||
// Assertions.assertTrue(StringUtils.isBlank(robotId));
|
||||
|
@ -498,11 +498,11 @@ public class NoticeMessageTaskControllerTests extends BaseTest {
|
|||
Assertions.assertTrue(CollectionUtils.isNotEmpty(messageTaskDetailDTOList));
|
||||
System.out.println(messageTaskDetailDTOList);
|
||||
List<MessageTaskDTO> collect = messageTaskDetailDTOList.stream().filter(t -> t.type.equals(NoticeConstants.Module.API_TEST_MANAGEMENT)).toList();
|
||||
List<MessageTaskTypeDTO> messageTaskTypeDTOList = collect.get(0).getMessageTaskTypeDTOList();
|
||||
List<MessageTaskTypeDTO> messageTaskTypeDTOList = collect.getFirst().getMessageTaskTypeDTOList();
|
||||
List<MessageTaskTypeDTO> collect1 = messageTaskTypeDTOList.stream().filter(t -> t.getTaskType().equals(NoticeConstants.TaskType.API_DEFINITION_TASK)).toList();
|
||||
List<MessageTaskDetailDTO> messageTaskDetailDTOList1 = collect1.get(0).getMessageTaskDetailDTOList();
|
||||
List<MessageTaskDetailDTO> messageTaskDetailDTOList1 = collect1.getFirst().getMessageTaskDetailDTOList();
|
||||
List<MessageTaskDetailDTO> collect2 = messageTaskDetailDTOList1.stream().filter(t -> t.event.equals(NoticeConstants.Event.CREATE)).toList();
|
||||
Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = collect2.get(0).getProjectRobotConfigMap();
|
||||
Map<String, ProjectRobotConfigDTO> projectRobotConfigMap = collect2.getFirst().getProjectRobotConfigMap();
|
||||
ProjectRobotConfigDTO projectRobotConfigDTO = projectRobotConfigMap.get("test_message_robot2");
|
||||
Assertions.assertTrue(StringUtils.equals(projectRobotConfigDTO.getTemplate(),"发送消息测试"));
|
||||
}
|
||||
|
|
|
@ -191,12 +191,12 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
|
||||
CustomFieldExample example = new CustomFieldExample();
|
||||
example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_priority");
|
||||
CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).get(0));
|
||||
CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).getFirst());
|
||||
internalRequest.setName("aaaa");
|
||||
this.requestPostWithOk(DEFAULT_UPDATE, internalRequest);
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getInternal(), true);
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getInternal(), true);
|
||||
// 内置字段名称不能修改
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getName(), "functional_priority");
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getName(), "functional_priority");
|
||||
|
||||
// @校验是否开启项目模板
|
||||
changeOrgTemplateEnable(true);
|
||||
|
@ -246,8 +246,8 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
if (StringUtils.equalsAny(resultItem.getType(), CustomFieldType.MEMBER.name(), CustomFieldType.MULTIPLE_MEMBER.name())) {
|
||||
List<CustomFieldOption> options = resultList.get(i).getOptions();
|
||||
Assertions.assertEquals(options.size(), 1);
|
||||
Assertions.assertEquals(options.get(0).getValue(), "CREATE_USER");
|
||||
Assertions.assertEquals(options.get(0).getText(), "创建人");
|
||||
Assertions.assertEquals(options.getFirst().getValue(), "CREATE_USER");
|
||||
Assertions.assertEquals(options.getFirst().getText(), "创建人");
|
||||
} else if (CustomFieldType.getHasOptionValueSet().contains(resultItem.getType())) {
|
||||
// 有下拉框选项的校验选项
|
||||
Assertions.assertEquals(resultList.get(i).getOptions().stream().sorted(Comparator.comparing(CustomFieldOption::getValue)).toList(),
|
||||
|
@ -300,7 +300,7 @@ public class ProjectCustomFieldControllerTests extends BaseTest {
|
|||
CustomFieldExample example = new CustomFieldExample();
|
||||
example.createCriteria()
|
||||
.andInternalEqualTo(true);
|
||||
CustomField internalCustomField = customFieldMapper.selectByExample(example).get(0);
|
||||
CustomField internalCustomField = customFieldMapper.selectByExample(example).getFirst();
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalCustomField.getId()), INTERNAL_CUSTOM_FIELD_PERMISSION);
|
||||
|
||||
// @@校验 NOT_FOUND 异常
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ProjectMemberControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断name, email, phone是否包含关键字default
|
||||
ProjectUserDTO projectUserDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserDTO.class).get(0);
|
||||
ProjectUserDTO projectUserDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(projectUserDTO.getName(), request.getKeyword())
|
||||
|| StringUtils.contains(projectUserDTO.getEmail(), request.getKeyword())
|
||||
|| StringUtils.contains(projectUserDTO.getPhone(), request.getKeyword()));
|
||||
|
|
|
@ -394,7 +394,7 @@ public class ProjectRobotControllerTests extends BaseTest {
|
|||
for (MessageTaskDTO messageTaskDTO : messageTaskDetailDTOList) {
|
||||
for (MessageTaskTypeDTO messageTaskTypeDTO : messageTaskDTO.getMessageTaskTypeDTOList()) {
|
||||
if (StringUtils.equalsIgnoreCase(messageTaskTypeDTO.getTaskType(),NoticeConstants.TaskType.API_DEFINITION_TASK)) {
|
||||
Boolean testRobotMessageRobot1 = messageTaskTypeDTO.getMessageTaskDetailDTOList().get(0).getProjectRobotConfigMap().get(projectRobotId).getEnable();
|
||||
Boolean testRobotMessageRobot1 = messageTaskTypeDTO.getMessageTaskDetailDTOList().getFirst().getProjectRobotConfigMap().get(projectRobotId).getEnable();
|
||||
Assertions.assertTrue(testRobotMessageRobot1);
|
||||
}
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ public class ProjectRobotControllerTests extends BaseTest {
|
|||
ProjectRobotExample projectRobotExample = new ProjectRobotExample();
|
||||
projectRobotExample.createCriteria().andProjectIdEqualTo(projectId).andNameEqualTo(keyWord);
|
||||
List<ProjectRobot> projectRobots = projectRobotMapper.selectByExample(projectRobotExample);
|
||||
return projectRobots.get(0);
|
||||
return projectRobots.getFirst();
|
||||
}
|
||||
|
||||
public void setMessageTask(String projectId, String defaultRobotId) throws Exception {
|
||||
|
|
|
@ -99,7 +99,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
|
|||
// @@校验没有数据的情况
|
||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, DEFAULT_PROJECT_ID, TemplateScene.FUNCTIONAL.name());
|
||||
List<Template> templates = getResultDataArray(mvcResult, Template.class);
|
||||
this.defaultTemplate = templates.get(0);
|
||||
this.defaultTemplate = templates.getFirst();
|
||||
this.requestGetWithOkAndReturn(LIST, DEFAULT_PROJECT_ID, TemplateScene.BUG.name());
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
|
|||
request.setEnableThirdPart(true);
|
||||
request.setCustomFields(new ArrayList<>(0));
|
||||
request.setSystemFields(OrganizationTemplateControllerTests.getTemplateSystemCustomFieldRequests());
|
||||
request.getSystemFields().get(0).setDefaultValue("update");
|
||||
request.getSystemFields().getFirst().setDefaultValue("update");
|
||||
this.requestPostWithOk(DEFAULT_UPDATE, request);
|
||||
Template template = templateMapper.selectByPrimaryKey(request.getId());
|
||||
// 校验请求成功数据
|
||||
|
@ -216,12 +216,12 @@ public class ProjectTemplateControllerTests extends BaseTest {
|
|||
|
||||
TemplateExample example = new TemplateExample();
|
||||
example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_default");
|
||||
TemplateUpdateRequest internalRequest = BeanUtils.copyBean(new TemplateUpdateRequest(), templateMapper.selectByExample(example).get(0));
|
||||
TemplateUpdateRequest internalRequest = BeanUtils.copyBean(new TemplateUpdateRequest(), templateMapper.selectByExample(example).getFirst());
|
||||
internalRequest.setName("aaaa");
|
||||
this.requestPostWithOk(DEFAULT_UPDATE, internalRequest);
|
||||
Assertions.assertEquals(templateMapper.selectByExample(example).get(0).getInternal(), true);
|
||||
Assertions.assertEquals(templateMapper.selectByExample(example).getFirst().getInternal(), true);
|
||||
// 内置字段名称不能修改
|
||||
Assertions.assertEquals(templateMapper.selectByExample(example).get(0).getName(), "functional_default");
|
||||
Assertions.assertEquals(templateMapper.selectByExample(example).getFirst().getName(), "functional_default");
|
||||
|
||||
// 不更新字段
|
||||
request.setCustomFields(null);
|
||||
|
@ -355,7 +355,7 @@ public class ProjectTemplateControllerTests extends BaseTest {
|
|||
|
||||
TemplateExample example = new TemplateExample();
|
||||
example.createCriteria().andScopeIdEqualTo(DEFAULT_PROJECT_ID).andNameEqualTo("functional_default");
|
||||
mvcResult = this.requestGetWithOkAndReturn(DEFAULT_GET, templateMapper.selectByExample(example).get(0).getId());
|
||||
mvcResult = this.requestGetWithOkAndReturn(DEFAULT_GET, templateMapper.selectByExample(example).getFirst().getId());
|
||||
templateDTO = getResultData(mvcResult, TemplateDTO.class);
|
||||
Assertions.assertEquals(templateDTO.getName(), Translator.get("template.default"));
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= request.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字default
|
||||
ProjectUserRoleDTO projectUserRoleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0);
|
||||
ProjectUserRoleDTO projectUserRoleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(projectUserRoleDTO.getName(), request.getKeyword())
|
||||
|| StringUtils.contains(projectUserRoleDTO.getId(), request.getKeyword()));
|
||||
// 权限校验
|
||||
|
@ -130,7 +130,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
|
|||
Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class);
|
||||
// 返回值不为空, 取第一条是否包含关键字
|
||||
Assertions.assertNotNull(pageData);
|
||||
ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0);
|
||||
ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword())
|
||||
|| StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword()));
|
||||
// 权限校验
|
||||
|
@ -199,7 +199,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
|
|||
Pager<?> pageData = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class);
|
||||
// 返回值不为空
|
||||
Assertions.assertNotNull(pageData);
|
||||
ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).get(0);
|
||||
ProjectUserRoleDTO roleDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), ProjectUserRoleDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(roleDTO.getName(), roleRequest.getKeyword())
|
||||
|| StringUtils.contains(roleDTO.getId(), roleRequest.getKeyword()));
|
||||
// 权限校验
|
||||
|
@ -310,7 +310,7 @@ public class ProjectUserRoleControllerTests extends BaseTest {
|
|||
// 返回值中取出第一条数据, 并判断是否包含关键字
|
||||
List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class);
|
||||
if (CollectionUtils.isNotEmpty(userList)) {
|
||||
User user = userList.get(0);
|
||||
User user = userList.getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword())
|
||||
|| StringUtils.contains(user.getId(), request.getKeyword()));
|
||||
}
|
||||
|
|
|
@ -1599,7 +1599,7 @@ public class FileManagementControllerTests extends BaseTest {
|
|||
}
|
||||
|
||||
private void fileAssociationControllerUpgrade() throws Exception {
|
||||
String associationId = sourceAssociationFileMap.get("sty-file-association-bug-id-2").get(0);
|
||||
String associationId = sourceAssociationFileMap.get("sty-file-association-bug-id-2").getFirst();
|
||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(String.format(FileManagementRequestUtils.URL_FILE_ASSOCIATION_UPGRADE, project.getId(), associationId));
|
||||
String fileId = JSON.parseObject(mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData().toString();
|
||||
FileMetadataExample example = new FileMetadataExample();
|
||||
|
@ -1703,7 +1703,7 @@ public class FileManagementControllerTests extends BaseTest {
|
|||
|
||||
FileAssociationExample example = new FileAssociationExample();
|
||||
example.createCriteria().andFileIdEqualTo(fileAssociationOldFileId).andSourceIdEqualTo("sty-file-association-bug-id-4");
|
||||
FileAssociation upgradeFileAssociation = fileAssociationMapper.selectByExample(example).get(0);
|
||||
FileAssociation upgradeFileAssociation = fileAssociationMapper.selectByExample(example).getFirst();
|
||||
Assertions.assertTrue(sourceAssociationFileMap.get("sty-file-association-bug-id-4").contains(upgradeFileAssociation.getId()));
|
||||
//当前文件不是最新的
|
||||
fileAssociationService.upgrade(upgradeFileAssociation.getId(), fileLogRecord);
|
||||
|
@ -1728,7 +1728,7 @@ public class FileManagementControllerTests extends BaseTest {
|
|||
//使用bug-id-2测试: 1.关联表中的文件ID不存在
|
||||
example.clear();
|
||||
example.createCriteria().andFileIdEqualTo(fileAssociationOldFileId).andSourceIdEqualTo("sty-file-association-bug-id-2");
|
||||
FileAssociation upgrade2 = fileAssociationMapper.selectByExample(example).get(0);
|
||||
FileAssociation upgrade2 = fileAssociationMapper.selectByExample(example).getFirst();
|
||||
//先把文件id改成别的,测试完成改回来
|
||||
String originalFileId = upgrade2.getFileId();
|
||||
String originalRefId = upgrade2.getFileRefId();
|
||||
|
@ -1851,7 +1851,7 @@ public class FileManagementControllerTests extends BaseTest {
|
|||
//3.里面包含一条已经文件已经删除了的ID 资源为bug-2
|
||||
example.clear();
|
||||
example.createCriteria().andSourceIdEqualTo("sty-file-association-bug-id-2").andFileIdEqualTo(fileAssociationNewFilesThree);
|
||||
FileAssociation association = fileAssociationMapper.selectByExample(example).get(0);
|
||||
FileAssociation association = fileAssociationMapper.selectByExample(example).getFirst();
|
||||
//先把文件id改成别的,测试完成改回来
|
||||
association.setFileId(IDGenerator.nextStr());
|
||||
association.setFileRefId(association.getFileId());
|
||||
|
|
|
@ -57,7 +57,7 @@ public class CleanUpReportJob {
|
|||
List<ProjectApplication> testPlan = projectApplicationMapper.selectByExample(applicationExample);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(testPlan)) {
|
||||
map.put(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), testPlan.get(0).getTypeValue());
|
||||
map.put(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), testPlan.getFirst().getTypeValue());
|
||||
} else {
|
||||
map.put(ProjectApplicationType.TEST_PLAN.TEST_PLAN_CLEAN_REPORT.name(), "3M");
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public class CleanUpReportJob {
|
|||
applicationExample.createCriteria().andProjectIdEqualTo(project.getId()).andTypeEqualTo(ProjectApplicationType.API.API_CLEAN_REPORT.name());
|
||||
List<ProjectApplication> api = projectApplicationMapper.selectByExample(applicationExample);
|
||||
if (CollectionUtils.isNotEmpty(api)) {
|
||||
map.put(ProjectApplicationType.API.API_CLEAN_REPORT.name(), api.get(0).getTypeValue());
|
||||
map.put(ProjectApplicationType.API.API_CLEAN_REPORT.name(), api.getFirst().getTypeValue());
|
||||
} else {
|
||||
map.put(ProjectApplicationType.API.API_CLEAN_REPORT.name(), "3M");
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ public class OperationLogAspect {
|
|||
mergeLists(beforeValues.get(), (List<LogDTO>) obj);
|
||||
} else if (obj instanceof LogDTO log) {
|
||||
if (CollectionUtils.isNotEmpty(beforeValues.get())) {
|
||||
beforeValues.get().get(0).setModifiedValue(log.getOriginalValue());
|
||||
beforeValues.get().getFirst().setModifiedValue(log.getOriginalValue());
|
||||
} else {
|
||||
beforeValues.set(new ArrayList<>() {{
|
||||
this.add(log);
|
||||
|
@ -231,7 +231,7 @@ public class OperationLogAspect {
|
|||
|
||||
// 单条存储
|
||||
if (logDTOList.size() == 1) {
|
||||
operationLogService.add(logDTOList.get(0));
|
||||
operationLogService.add(logDTOList.getFirst());
|
||||
} else {
|
||||
operationLogService.batchAdd(logDTOList);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ApiPluginService {
|
|||
protocolDTO.setProtocol(protocolPlugin.getProtocol());
|
||||
protocolDTO.setPluginId(pluginWrapper.getPluginId());
|
||||
if (CollectionUtils.isNotEmpty(extensionClasses)) {
|
||||
protocolDTO.setPolymorphicName(extensionClasses.get(0).getSimpleName());
|
||||
protocolDTO.setPolymorphicName(extensionClasses.getFirst().getSimpleName());
|
||||
}
|
||||
if (StringUtils.isNoneBlank(protocolDTO.getProtocol(), protocolDTO.getPolymorphicName())) {
|
||||
protocols.add(protocolDTO);
|
||||
|
|
|
@ -96,7 +96,7 @@ public class BaseStatusItemService {
|
|||
if (CollectionUtils.isEmpty(statusItems)) {
|
||||
return List.of();
|
||||
}
|
||||
int pos = getByScopeIdAndScene(statusItems.get(0).getScopeId(), statusItems.get(0).getScene()).size();
|
||||
int pos = getByScopeIdAndScene(statusItems.getFirst().getScopeId(), statusItems.getFirst().getScene()).size();
|
||||
for (StatusItem statusItem : statusItems) {
|
||||
statusItem.setId(IDGenerator.nextStr());
|
||||
// 设置排序
|
||||
|
|
|
@ -252,11 +252,11 @@ public class BaseUserRoleService {
|
|||
List<UserRoleRelation> addRelations = new ArrayList<>();
|
||||
userRoleRelationMap.forEach((groupId, relations) -> {
|
||||
// 如果当前用户组只有一个用户,并且就是要删除的用户组,则添加组织成员等默认用户组
|
||||
if (relations.size() == 1 && StringUtils.equals(relations.get(0).getRoleId(), roleId)) {
|
||||
if (relations.size() == 1 && StringUtils.equals(relations.getFirst().getRoleId(), roleId)) {
|
||||
UserRoleRelation relation = new UserRoleRelation();
|
||||
relation.setId(IDGenerator.nextStr());
|
||||
relation.setUserId(relations.get(0).getUserId());
|
||||
relation.setSourceId(relations.get(0).getSourceId());
|
||||
relation.setUserId(relations.getFirst().getUserId());
|
||||
relation.setSourceId(relations.getFirst().getSourceId());
|
||||
relation.setRoleId(defaultRoleId);
|
||||
relation.setCreateTime(System.currentTimeMillis());
|
||||
relation.setCreateUser(currentUserId);
|
||||
|
|
|
@ -88,10 +88,10 @@ public class CommonProjectService {
|
|||
List<Project> project = projectMapper.selectByExample(example);
|
||||
ProjectDTO projectDTO = new ProjectDTO();
|
||||
if (CollectionUtils.isNotEmpty(project)) {
|
||||
BeanUtils.copyBean(projectDTO, project.get(0));
|
||||
BeanUtils.copyBean(projectDTO, project.getFirst());
|
||||
projectDTO.setOrganizationName(organizationMapper.selectByPrimaryKey(projectDTO.getOrganizationId()).getName());
|
||||
List<ProjectDTO> projectDTOS = buildUserInfo(List.of(projectDTO));
|
||||
projectDTO = projectDTOS.get(0);
|
||||
projectDTO = projectDTOS.getFirst();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MessageDetailService {
|
|||
messageTaskGroup.forEach((messageTaskId, messageTaskList) -> {
|
||||
//获取同一任务所有的接收人
|
||||
MessageDetail messageDetail = new MessageDetail();
|
||||
MessageTask messageTask = messageTaskList.get(0);
|
||||
MessageTask messageTask = messageTaskList.getFirst();
|
||||
messageDetail.setReceiverIds(messageTask.getReceivers());
|
||||
messageDetail.setTaskType(messageTask.getTaskType());
|
||||
messageDetail.setEvent(messageTask.getEvent());
|
||||
|
|
|
@ -352,7 +352,7 @@ public class OrganizationService {
|
|||
OrganizationExample example = new OrganizationExample();
|
||||
example.createCriteria().andNumEqualTo(100001L);
|
||||
List<Organization> organizations = organizationMapper.selectByExample(example);
|
||||
Organization organization = organizations.get(0);
|
||||
Organization organization = organizations.getFirst();
|
||||
BeanUtils.copyBean(organizationDTO, organization);
|
||||
return organizationDTO;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class OrganizationUserRoleLogService {
|
|||
|
||||
UserRoleExample example = new UserRoleExample();
|
||||
example.createCriteria().andIdEqualTo(request.getId());
|
||||
UserRole userRole = userRoleMapper.selectByExample(example).get(0);
|
||||
UserRole userRole = userRoleMapper.selectByExample(example).getFirst();
|
||||
dto.setOriginalValue(JSON.toJSONBytes(userRole.getName()));
|
||||
dto.setModifiedValue(JSON.toJSONBytes(request.getName()));
|
||||
return dto;
|
||||
|
|
|
@ -99,7 +99,7 @@ public class OrganizationUserRoleService extends BaseUserRoleService {
|
|||
}
|
||||
|
||||
public void removeMember(OrganizationUserRoleMemberEditRequest request) {
|
||||
String removeUserId = request.getUserIds().get(0);
|
||||
String removeUserId = request.getUserIds().getFirst();
|
||||
checkMemberParam(removeUserId, request.getUserRoleId());
|
||||
//检查移除的是不是管理员
|
||||
if (StringUtils.equals(request.getUserRoleId(),InternalUserRole.ORG_ADMIN.getValue())) {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class PlatformPluginService {
|
|||
ServiceIntegrationExample example = new ServiceIntegrationExample();
|
||||
example.createCriteria().andPluginIdEqualTo(pluginId).andOrganizationIdEqualTo(orgId);
|
||||
List<ServiceIntegration> serviceIntegrations = serviceIntegrationMapper.selectByExampleWithBLOBs(example);
|
||||
return CollectionUtils.isEmpty(serviceIntegrations) ? null : serviceIntegrations.get(0);
|
||||
return CollectionUtils.isEmpty(serviceIntegrations) ? null : serviceIntegrations.getFirst();
|
||||
}
|
||||
|
||||
public List<Plugin> getOrgEnabledPlatformPlugins(String orgId) {
|
||||
|
|
|
@ -288,7 +288,7 @@ public class PluginLoadService {
|
|||
*/
|
||||
public <T> Class<? extends T> getExtensionsClass(Class<T> clazz, String pluginId) {
|
||||
List<Class<? extends T>> classes = msPluginManager.getExtensionClasses(clazz, pluginId);
|
||||
return CollectionUtils.isEmpty(classes) ? null : classes.get(0);
|
||||
return CollectionUtils.isEmpty(classes) ? null : classes.getFirst();
|
||||
}
|
||||
|
||||
public MsPluginManager getMsPluginManager() {
|
||||
|
|
|
@ -59,7 +59,7 @@ public class SystemParameterService {
|
|||
List<SystemParameter> baseUrlParameterList = systemParameterMapper.selectByExample(example);
|
||||
String oldBaseUrl = null;
|
||||
if (CollectionUtils.isNotEmpty(baseUrlParameterList)) {
|
||||
SystemParameter parameter = baseUrlParameterList.get(0);
|
||||
SystemParameter parameter = baseUrlParameterList.getFirst();
|
||||
if (!StringUtils.equals(parameter.getParamValue(), param.getParamValue())) {
|
||||
oldBaseUrl = parameter.getParamValue();
|
||||
systemParameterMapper.updateByPrimaryKey(param);
|
||||
|
@ -329,7 +329,7 @@ public class SystemParameterService {
|
|||
public String getApiConcurrentConfig() {
|
||||
List<SystemParameter> paramList = this.getParamList(ParamConstants.ApiConcurrentConfig.API_CONCURRENT_CONFIG.getValue());
|
||||
if (CollectionUtils.isNotEmpty(paramList)) {
|
||||
return paramList.get(0).getParamValue();
|
||||
return paramList.getFirst().getParamValue();
|
||||
}
|
||||
return DEFAULT_API_CONCURRENT_CONFIG;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class UserInviteService {
|
|||
example.createCriteria().andIdEqualTo(id).andInviteTimeGreaterThanOrEqualTo(time);
|
||||
List<UserInvite> userInvites = userInviteMapper.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isNotEmpty(userInvites)) {
|
||||
return userInvites.get(0);
|
||||
return userInvites.getFirst();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class UserKeyService {
|
|||
userKeyExample.createCriteria().andAccessKeyEqualTo(accessKey).andEnableEqualTo(true);
|
||||
List<UserKey> userKeysList = userKeyMapper.selectByExample(userKeyExample);
|
||||
if (!CollectionUtils.isEmpty(userKeysList)) {
|
||||
return userKeysList.get(0);
|
||||
return userKeysList.getFirst();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public class UserLoginService {
|
|||
organizationExample.createCriteria().andIdIn(orgIds).andEnableEqualTo(true);
|
||||
List<Organization> organizationsList = organizationMapper.selectByExample(organizationExample);
|
||||
if (CollectionUtils.isNotEmpty(organizationsList)) {
|
||||
String wsId = organizationsList.get(0).getId();
|
||||
String wsId = organizationsList.getFirst().getId();
|
||||
switchUserResource(wsId, user);
|
||||
}
|
||||
} else {
|
||||
|
@ -178,7 +178,7 @@ public class UserLoginService {
|
|||
}
|
||||
} else {
|
||||
UserRoleRelation userRoleRelation = project.stream().filter(p -> StringUtils.isNotBlank(p.getSourceId()))
|
||||
.toList().get(0);
|
||||
.toList().getFirst();
|
||||
String projectId = userRoleRelation.getSourceId();
|
||||
Project p = projectMapper.selectByPrimaryKey(projectId);
|
||||
String wsId = p.getOrganizationId();
|
||||
|
@ -199,7 +199,7 @@ public class UserLoginService {
|
|||
example.createCriteria().andIdEqualTo(user.getLastProjectId()).andEnableEqualTo(true);
|
||||
List<Project> projects = projectMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(projects)) {
|
||||
Project project = projects.get(0);
|
||||
Project project = projects.getFirst();
|
||||
if (StringUtils.equals(project.getOrganizationId(), user.getLastOrganizationId())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ public class UserLoginService {
|
|||
example.createCriteria().andIdEqualTo(user.getLastProjectId()).andEnableEqualTo(true);
|
||||
List<Project> projects = projectMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(projects)) {
|
||||
Project project = projects.get(0);
|
||||
Project project = projects.getFirst();
|
||||
if (StringUtils.equals(project.getOrganizationId(), user.getLastOrganizationId())) {
|
||||
return true;
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public class UserLoginService {
|
|||
updateUser(user);
|
||||
return true;
|
||||
}
|
||||
Optional<Project> first = projects.stream().filter(p -> StringUtils.equals(intersection.get(0), p.getId())).findFirst();
|
||||
Optional<Project> first = projects.stream().filter(p -> StringUtils.equals(intersection.getFirst(), p.getId())).findFirst();
|
||||
if (first.isPresent()) {
|
||||
Project project = first.get();
|
||||
String wsId = project.getOrganizationId();
|
||||
|
@ -332,7 +332,7 @@ public class UserLoginService {
|
|||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
List<Project> projects = getProjectListByWsAndUserId(sessionUser.getId(), sourceId);
|
||||
if (CollectionUtils.isNotEmpty(projects)) {
|
||||
user.setLastProjectId(projects.get(0).getId());
|
||||
user.setLastProjectId(projects.getFirst().getId());
|
||||
}
|
||||
BeanUtils.copyProperties(user, newUser);
|
||||
// 切换组织或组织之后更新 session 里的 user
|
||||
|
@ -363,7 +363,7 @@ public class UserLoginService {
|
|||
// 如果传入的 last_project_id 是 last_organization_id 下面的
|
||||
boolean present = projects.stream().anyMatch(p -> StringUtils.equals(p.getId(), user.getLastProjectId()));
|
||||
if (!present) {
|
||||
user.setLastProjectId(projects.get(0).getId());
|
||||
user.setLastProjectId(projects.getFirst().getId());
|
||||
}
|
||||
} else {
|
||||
user.setLastProjectId(StringUtils.EMPTY);
|
||||
|
@ -411,7 +411,7 @@ public class UserLoginService {
|
|||
return null;
|
||||
}
|
||||
|
||||
return getUserDTO(users.get(0).getId());
|
||||
return getUserDTO(users.getFirst().getId());
|
||||
}
|
||||
|
||||
public boolean checkUserPassword(String userId, String password) {
|
||||
|
|
|
@ -348,7 +348,7 @@ public abstract class BaseTest {
|
|||
if (CollectionUtils.isEmpty(listObject)) {
|
||||
continue;
|
||||
}
|
||||
if (listObject.get(0) instanceof File || listObject.get(0) instanceof MockMultipartFile) {
|
||||
if (listObject.getFirst() instanceof File || listObject.getFirst() instanceof MockMultipartFile) {
|
||||
// 参数是多个文件时,设置多个文件
|
||||
for (Object subObject : ((List) o)) {
|
||||
multipartFile = getMockMultipartFile(key, subObject);
|
||||
|
@ -594,7 +594,7 @@ public abstract class BaseTest {
|
|||
*/
|
||||
private void requestPermissionsTest(List<String> permissionIds, String url, Supplier<MockHttpServletRequestBuilder> requestBuilderGetFunc) throws Exception {
|
||||
// 相同的用户组
|
||||
String roleId = permissionIds.get(0).split("_")[0];
|
||||
String roleId = permissionIds.getFirst().split("_")[0];
|
||||
for (String permissionId : permissionIds) {
|
||||
// 多个权限插入同一个用户组
|
||||
initUserRolePermission(roleId, permissionId);
|
||||
|
@ -669,15 +669,15 @@ public abstract class BaseTest {
|
|||
}
|
||||
|
||||
protected void requestPostPermissionsTest(List<String> permissionIds, String url, Object param, Object... uriVariables) throws Exception {
|
||||
requestPermissionsTest(permissionIds, url, () -> getPermissionPostRequestBuilder(permissionIds.get(0).split("_")[0], url, param, uriVariables));
|
||||
requestPermissionsTest(permissionIds, url, () -> getPermissionPostRequestBuilder(permissionIds.getFirst().split("_")[0], url, param, uriVariables));
|
||||
}
|
||||
|
||||
protected void requestGetPermissionsTest(List<String> permissionIds, String url, Object... uriVariables) throws Exception {
|
||||
requestPermissionsTest(permissionIds, url, () -> getPermissionRequestBuilder(permissionIds.get(0).split("_")[0], url, uriVariables));
|
||||
requestPermissionsTest(permissionIds, url, () -> getPermissionRequestBuilder(permissionIds.getFirst().split("_")[0], url, uriVariables));
|
||||
}
|
||||
|
||||
protected void requestMultipartPermissionsTest(List<String> permissionIds, String url, MultiValueMap<String, Object> paramMap, Object... uriVariables) throws Exception {
|
||||
requestPermissionsTest(permissionIds, url, () -> getPermissionMultipartRequestBuilder(permissionIds.get(0).split("_")[0], url, paramMap, uriVariables));
|
||||
requestPermissionsTest(permissionIds, url, () -> getPermissionMultipartRequestBuilder(permissionIds.getFirst().split("_")[0], url, paramMap, uriVariables));
|
||||
}
|
||||
|
||||
protected ResultActions requestGetWithNoAdmin(String url, String userRoleType, Object... uriVariables) throws Exception {
|
||||
|
|
|
@ -78,13 +78,13 @@ public class CommonNoticeSendServiceTests extends BaseTest {
|
|||
FunctionalCaseCustomFieldExample functionalCaseCustomFieldExample = new FunctionalCaseCustomFieldExample();
|
||||
functionalCaseCustomFieldExample.createCriteria().andCaseIdEqualTo("aspect_gyq_one");
|
||||
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(functionalCaseCustomFieldExample);
|
||||
String fieldId = functionalCaseCustomFields.get(0).getFieldId();
|
||||
String fieldId = functionalCaseCustomFields.getFirst().getFieldId();
|
||||
CustomField customFields = customFieldMapper.selectByPrimaryKey(fieldId);
|
||||
|
||||
List<OptionDTO>optionDTOList = new ArrayList<>();
|
||||
OptionDTO optionDTO = new OptionDTO();
|
||||
optionDTO.setId(customFields.getName());
|
||||
optionDTO.setName(functionalCaseCustomFields.get(0).getValue());
|
||||
optionDTO.setName(functionalCaseCustomFields.getFirst().getValue());
|
||||
optionDTOList.add(optionDTO);
|
||||
FunctionalCaseDTO functionalCaseDTO = new FunctionalCaseDTO();
|
||||
BeanUtils.copyBean(functionalCaseDTO,functionalCase);
|
||||
|
|
|
@ -320,7 +320,7 @@ class GlobalUserRoleControllerTests extends BaseTest {
|
|||
example.createCriteria().andUserIdEqualTo(userRoleRelation.getUserId());
|
||||
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(example);
|
||||
Assertions.assertTrue(userRoleRelations.size() == 1);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(userRoleRelations.get(0).getRoleId(), MEMBER.getValue()));
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(userRoleRelations.getFirst().getRoleId(), MEMBER.getValue()));
|
||||
clearOneLimitTest(userRoleRelation.getUserId());
|
||||
|
||||
// 删除没有关联用户的用户组
|
||||
|
|
|
@ -121,7 +121,7 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
|
|||
this.requestPostWithOk(DEFAULT_ADD, request);
|
||||
List<UserRoleRelation> userRoleRelations = getUserRoleRelationByRoleIdAndUserId(request.getRoleId(), ADMIN.getValue());
|
||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(userRoleRelations));
|
||||
addUserRoleRelation = userRoleRelations.get(0);
|
||||
addUserRoleRelation = userRoleRelations.getFirst();
|
||||
Assertions.assertEquals(addUserRoleRelation.getOrganizationId(), UserRoleScope.SYSTEM);
|
||||
|
||||
// @@校验日志
|
||||
|
@ -218,7 +218,7 @@ class GlobalUserRoleRelationControllerTests extends BaseTest {
|
|||
|
||||
// @@删除admin系统管理员用户组异常
|
||||
List<UserRoleRelation> userRoleRelations = getUserRoleRelationByRoleIdAndUserId(ADMIN.getValue(), ADMIN.getValue());
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, userRoleRelations.get(0).getId()),
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, userRoleRelations.getFirst().getId()),
|
||||
USER_ROLE_RELATION_REMOVE_ADMIN_USER_PERMISSION);
|
||||
|
||||
// @@校验 NOT_FOUND 异常
|
||||
|
|
|
@ -91,7 +91,7 @@ public class NotificationControllerTests extends BaseTest {
|
|||
NotificationExample notificationExample = new NotificationExample();
|
||||
notificationExample.createCriteria().andStatusEqualTo(NotificationConstants.Status.UNREAD.name());
|
||||
List<Notification> notifications = notificationMapper.selectByExample(notificationExample);
|
||||
this.requestGetWithOkAndReturn(NOTIFICATION_READ + notifications.get(0).getId());
|
||||
this.requestGetWithOkAndReturn(NOTIFICATION_READ + notifications.getFirst().getId());
|
||||
notificationExample = new NotificationExample();
|
||||
notificationExample.createCriteria().andStatusEqualTo(NotificationConstants.Status.READ.name());
|
||||
List<Notification> readNotifications = notificationMapper.selectByExample(notificationExample);
|
||||
|
|
|
@ -500,7 +500,7 @@ public class OrganizationControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字admin
|
||||
OrgUserExtend orgUserExtend = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrgUserExtend.class).get(0);
|
||||
OrgUserExtend orgUserExtend = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrgUserExtend.class).getFirst();
|
||||
if (StringUtils.isNotBlank(keyWord)) {
|
||||
Assertions.assertTrue(StringUtils.contains(orgUserExtend.getName(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(orgUserExtend.getEmail(), organizationRequest.getKeyword())
|
||||
|
|
|
@ -199,12 +199,12 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
|
|||
|
||||
CustomFieldExample example = new CustomFieldExample();
|
||||
example.createCriteria().andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID).andNameEqualTo("functional_priority");
|
||||
CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).get(0));
|
||||
CustomFieldUpdateRequest internalRequest = BeanUtils.copyBean(new CustomFieldUpdateRequest(), customFieldMapper.selectByExample(example).getFirst());
|
||||
internalRequest.setName("aaaa");
|
||||
this.requestPostWithOk(DEFAULT_UPDATE, internalRequest);
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getInternal(), true);
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getInternal(), true);
|
||||
// 内置字段名称不能修改
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).get(0).getName(), "functional_priority");
|
||||
Assertions.assertEquals(customFieldMapper.selectByExample(example).getFirst().getName(), "functional_priority");
|
||||
|
||||
// @校验是否开启组织模板
|
||||
changeOrgTemplateEnable(false);
|
||||
|
@ -261,8 +261,8 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
|
|||
if (StringUtils.equalsAny(resultItem.getType(), CustomFieldType.MEMBER.name(), CustomFieldType.MULTIPLE_MEMBER.name())) {
|
||||
List<CustomFieldOption> options = customFieldDTO.getOptions();
|
||||
Assertions.assertEquals(options.size(), 1);
|
||||
Assertions.assertEquals(options.get(0).getValue(), "CREATE_USER");
|
||||
Assertions.assertEquals(options.get(0).getText(), "创建人");
|
||||
Assertions.assertEquals(options.getFirst().getValue(), "CREATE_USER");
|
||||
Assertions.assertEquals(options.getFirst().getText(), "创建人");
|
||||
} else if (CustomFieldType.getHasOptionValueSet().contains(resultItem.getType())) {
|
||||
// 有下拉框选项的校验选项
|
||||
Assertions.assertEquals(resultList.get(i).getOptions().stream().sorted(Comparator.comparing(CustomFieldOption::getValue)).toList(),
|
||||
|
@ -321,7 +321,7 @@ public class OrganizationCustomFieldControllerTests extends BaseTest {
|
|||
CustomFieldExample example = new CustomFieldExample();
|
||||
example.createCriteria()
|
||||
.andInternalEqualTo(true);
|
||||
CustomField internalCustomField = customFieldMapper.selectByExample(example).get(0);
|
||||
CustomField internalCustomField = customFieldMapper.selectByExample(example).getFirst();
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalCustomField.getId()), INTERNAL_CUSTOM_FIELD_PERMISSION);
|
||||
|
||||
// @@校验 NOT_FOUND 异常
|
||||
|
|
|
@ -213,7 +213,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
TemplateExample example = new TemplateExample();
|
||||
example.createCriteria().andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID)
|
||||
.andSceneEqualTo(TemplateScene.API.name());
|
||||
Template template = templateMapper.selectByExample(example).get(0);
|
||||
Template template = templateMapper.selectByExample(example).getFirst();
|
||||
TemplateUpdateRequest updateRequest = new TemplateUpdateRequest();
|
||||
TemplateCustomFieldRequest templateCustomFieldRequest = new TemplateCustomFieldRequest();
|
||||
templateCustomFieldRequest.setFieldId(customField.getId());
|
||||
|
@ -341,7 +341,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
||||
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
|
@ -367,7 +367,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
Assertions.assertNull(projectExtend.getModuleSetting());
|
||||
|
||||
//设置了模块模版
|
||||
|
@ -386,7 +386,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
userRoleRelationExample = new UserRoleRelationExample();
|
||||
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
|
@ -410,7 +410,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
//校验资源池
|
||||
ProjectTestResourcePoolExample projectTestResourcePoolExample = new ProjectTestResourcePoolExample();
|
||||
projectTestResourcePoolExample.createCriteria().andProjectIdEqualTo(projectId);
|
||||
|
@ -511,7 +511,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
//第一个数据的createTime是最大的
|
||||
assert returnPager != null;
|
||||
List<ProjectDTO> projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
long firstCreateTime = projectDTOS.get(0).getCreateTime();
|
||||
long firstCreateTime = projectDTOS.getFirst().getCreateTime();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getCreateTime() > firstCreateTime);
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
//第一个数据的organizationName是最小的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
String firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
String firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0);
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
//第一个数据的organizationName是最大的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0);
|
||||
}
|
||||
|
@ -812,7 +812,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
//第一个数据的createTime是最大的
|
||||
assert returnPager != null;
|
||||
List<UserExtendDTO> userExtendDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), UserExtendDTO.class);
|
||||
long firstCreateTime = userExtendDTOS.get(0).getCreateTime();
|
||||
long firstCreateTime = userExtendDTOS.getFirst().getCreateTime();
|
||||
for (UserExtendDTO userExtendDTO : userExtendDTOS) {
|
||||
Assertions.assertFalse(userExtendDTO.getCreateTime() > firstCreateTime);
|
||||
}
|
||||
|
@ -863,7 +863,7 @@ public class OrganizationProjectControllerTests extends BaseTest {
|
|||
int count = parseObjectFromMvcResult(mvcResult, Integer.class);
|
||||
Assertions.assertEquals(count, userRoleRelations.size());
|
||||
// 校验日志
|
||||
checkLog(userRoleRelations.get(0).getId(), OperationLogType.DELETE);
|
||||
checkLog(userRoleRelations.getFirst().getId(), OperationLogType.DELETE);
|
||||
// @@校验权限
|
||||
requestGetPermissionTest(PermissionConstants.ORGANIZATION_PROJECT_MEMBER_DELETE, removeProjectMember + projectId + "/" + userId);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ public class OrganizationStatusFlowSettingControllerTest extends BaseTest {
|
|||
.andInternalEqualTo(true).andNameEqualTo(DefaultBugStatusItemName.REJECTED)
|
||||
.andScopeIdEqualTo(DEFAULT_ORGANIZATION_ID);
|
||||
List<StatusItem> statusItems = statusItemMapper.selectByExample(example);
|
||||
return statusItems.size() == 0 ? null : statusItems.get(0);
|
||||
return statusItems.size() == 0 ? null : statusItems.getFirst();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -353,7 +353,7 @@ public class OrganizationStatusFlowSettingControllerTest extends BaseTest {
|
|||
.andNameEqualTo(DefaultBugStatusItemName.NEW)
|
||||
.andScopeIdEqualTo(scopeId);
|
||||
StatusItemMapper statusItemMapper = CommonBeanFactory.getBean(StatusItemMapper.class);
|
||||
return statusItemMapper.selectByExample(example).get(0);
|
||||
return statusItemMapper.selectByExample(example).getFirst();
|
||||
}
|
||||
|
||||
public static void assertUpdateStatusDefinition(StatusDefinitionUpdateRequest request) {
|
||||
|
|
|
@ -86,7 +86,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
|
|||
// @@校验没有数据的情况
|
||||
MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, DEFAULT_ORGANIZATION_ID, TemplateScene.FUNCTIONAL.name());
|
||||
List<Template> templates = getResultDataArray(mvcResult, Template.class);
|
||||
this.defaultTemplate = templates.get(0);
|
||||
this.defaultTemplate = templates.getFirst();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -264,7 +264,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
|
|||
request.setEnableThirdPart(true);
|
||||
request.setCustomFields(new ArrayList<>(0));
|
||||
request.setSystemFields(getTemplateSystemCustomFieldRequests());
|
||||
request.getSystemFields().get(0).setDefaultValue("update");
|
||||
request.getSystemFields().getFirst().setDefaultValue("update");
|
||||
this.requestPostWithOk(DEFAULT_UPDATE, request);
|
||||
Template template = templateMapper.selectByPrimaryKey(request.getId());
|
||||
// 校验请求成功数据
|
||||
|
@ -428,7 +428,7 @@ public class OrganizationTemplateControllerTests extends BaseTest {
|
|||
example.createCriteria()
|
||||
.andScopeTypeEqualTo(TemplateScopeType.ORGANIZATION.name())
|
||||
.andInternalEqualTo(true);
|
||||
Template internalTemplate = templateMapper.selectByExample(example).get(0);
|
||||
Template internalTemplate = templateMapper.selectByExample(example).getFirst();
|
||||
assertErrorCode(this.requestGet(DEFAULT_DELETE, internalTemplate.getId()), INTERNAL_TEMPLATE_PERMISSION);
|
||||
|
||||
// @@校验 NOT_FOUND 异常
|
||||
|
|
|
@ -272,7 +272,7 @@ public class OrganizationUserRoleControllerTests extends BaseTest {
|
|||
// 返回值中取出第一条数据, 并判断是否包含关键字
|
||||
List<User> userList = JSON.parseArray(JSON.toJSONString(pageData.getList()), User.class);
|
||||
if(CollectionUtils.isNotEmpty(userList)) {
|
||||
User user = userList.get(0);
|
||||
User user = userList.getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(user.getName(), request.getKeyword())
|
||||
|| StringUtils.contains(user.getId(), request.getKeyword()));
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ public class ServiceIntegrationControllerTests extends BaseTest {
|
|||
MvcResult mvcResult = this.requestGetWithOkAndReturn(LIST, defaultOrg.getId());
|
||||
// 校验请求成功数据
|
||||
List<ServiceIntegrationDTO> serviceIntegrationList = getResultDataArray(mvcResult, ServiceIntegrationDTO.class);
|
||||
ServiceIntegrationDTO serviceIntegrationDTO = serviceIntegrationList.get(0);
|
||||
ServiceIntegrationDTO serviceIntegrationDTO = serviceIntegrationList.getFirst();
|
||||
ServiceIntegration serviceIntegration = serviceIntegrationMapper.selectByPrimaryKey(serviceIntegrationDTO.getId());
|
||||
Assertions.assertEquals(JSON.parseMap(new String(serviceIntegration.getConfiguration())),
|
||||
serviceIntegrationDTO.getConfiguration());
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字default
|
||||
OrganizationDTO organizationDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrganizationDTO.class).get(0);
|
||||
OrganizationDTO organizationDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), OrganizationDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(organizationDTO.getName(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(organizationDTO.getId(), organizationRequest.getKeyword()));
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
|
|||
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
|
||||
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
|
||||
// 返回值中取出第一条ID最大的数据, 并判断是否是default-organization-6
|
||||
OrganizationDTO organizationDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), OrganizationDTO.class).get(0);
|
||||
OrganizationDTO organizationDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), OrganizationDTO.class).getFirst();
|
||||
Assertions.assertTrue(organizationDTO1.getId().contains("default"));
|
||||
// 权限校验
|
||||
requestPostPermissionTest(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, ORGANIZATION_LIST, organizationRequest);
|
||||
|
@ -241,7 +241,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字admin
|
||||
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).get(0);
|
||||
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword()));
|
||||
|
@ -255,7 +255,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
|
|||
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
|
||||
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
|
||||
// 返回值中取出第一条ID最大的数据, 并判断是否是admin
|
||||
UserExtendDTO userExtendDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), UserExtendDTO.class).get(0);
|
||||
UserExtendDTO userExtendDTO1 = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), UserExtendDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(userExtendDTO1.getId(), "admin"));
|
||||
// 权限校验
|
||||
requestPostPermissionsTest(List.of(PermissionConstants.SYSTEM_ORGANIZATION_PROJECT_READ, PermissionConstants.SYSTEM_USER_READ),
|
||||
|
@ -311,7 +311,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字admin
|
||||
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).get(0);
|
||||
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword()));
|
||||
|
@ -347,7 +347,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
|
|||
// 返回的数据量不超过规定要返回的数据量相同
|
||||
Assertions.assertTrue(JSON.parseArray(JSON.toJSONString(pageData.getList())).size() <= organizationRequest.getPageSize());
|
||||
// 返回值中取出第一条数据, 并判断是否包含关键字admin
|
||||
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).get(0);
|
||||
UserExtendDTO userExtendDTO = JSON.parseArray(JSON.toJSONString(pageData.getList()), UserExtendDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.contains(userExtendDTO.getName(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(userExtendDTO.getEmail(), organizationRequest.getKeyword())
|
||||
|| StringUtils.contains(userExtendDTO.getPhone(), organizationRequest.getKeyword()));
|
||||
|
@ -427,7 +427,7 @@ public class SystemOrganizationControllerTests extends BaseTest {
|
|||
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
|
||||
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
|
||||
// 返回值中取出第一条ID最大的数据, 并判断是否是default-project
|
||||
ProjectDTO projectDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), ProjectDTO.class).get(0);
|
||||
ProjectDTO projectDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), ProjectDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.equals(projectDTO.getId(), "default-project"));
|
||||
|
||||
// 权限校验
|
||||
|
|
|
@ -335,7 +335,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
UserRoleRelationExample userRoleRelationExample = new UserRoleRelationExample();
|
||||
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||
List<UserRoleRelation> userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
|
@ -364,7 +364,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
userRoleRelationExample = new UserRoleRelationExample();
|
||||
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
|
@ -395,7 +395,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
userRoleRelationExample = new UserRoleRelationExample();
|
||||
userRoleRelationExample.createCriteria().andSourceIdEqualTo(projectId).andRoleIdEqualTo(InternalUserRole.PROJECT_ADMIN.getValue());
|
||||
userRoleRelations = userRoleRelationMapper.selectByExample(userRoleRelationExample);
|
||||
|
@ -419,7 +419,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
// 校验日志
|
||||
checkLog(projectId, OperationLogType.ADD);
|
||||
|
||||
compareProjectDTO(projects.get(0), result);
|
||||
compareProjectDTO(projects.getFirst(), result);
|
||||
//校验资源池
|
||||
ProjectTestResourcePoolExample projectTestResourcePoolExample = new ProjectTestResourcePoolExample();
|
||||
projectTestResourcePoolExample.createCriteria().andProjectIdEqualTo(projectId);
|
||||
|
@ -573,7 +573,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
|
||||
// 关联模板
|
||||
TemplateUpdateRequest request = new TemplateUpdateRequest();
|
||||
Template template = baseTemplateService.getTemplates(DEFAULT_ORGANIZATION_ID, scene).get(0);
|
||||
Template template = baseTemplateService.getTemplates(DEFAULT_ORGANIZATION_ID, scene).getFirst();
|
||||
TemplateCustomFieldRequest templateCustomFieldRequest = new TemplateCustomFieldRequest();
|
||||
templateCustomFieldRequest.setFieldId(customField.getId());
|
||||
templateCustomFieldRequest.setRequired(false);
|
||||
|
@ -686,7 +686,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
//第一个数据的createTime是最大的
|
||||
assert returnPager != null;
|
||||
List<ProjectDTO> projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
long firstCreateTime = projectDTOS.get(0).getCreateTime();
|
||||
long firstCreateTime = projectDTOS.getFirst().getCreateTime();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getCreateTime() > firstCreateTime);
|
||||
}
|
||||
|
@ -713,7 +713,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
//第一个数据的organizationName是最小的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
String firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
String firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) < 0);
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
//第一个数据的organizationName是最大的
|
||||
assert returnPager != null;
|
||||
projectDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), ProjectDTO.class);
|
||||
firstOrganizationName = projectDTOS.get(0).getOrganizationName();
|
||||
firstOrganizationName = projectDTOS.getFirst().getOrganizationName();
|
||||
for (ProjectDTO projectDTO : projectDTOS) {
|
||||
Assertions.assertFalse(projectDTO.getOrganizationName().compareTo(firstOrganizationName) > 0);
|
||||
}
|
||||
|
@ -952,7 +952,7 @@ public class SystemProjectControllerTests extends BaseTest {
|
|||
returnPager = parseObjectFromMvcResult(mvcResult, Pager.class);
|
||||
//第一个数据的createTime是最大的
|
||||
List<UserExtendDTO> userExtendDTOS = JSON.parseArray(JSON.toJSONString(returnPager.getList()), UserExtendDTO.class);
|
||||
long firstCreateTime = userExtendDTOS.get(0).getCreateTime();
|
||||
long firstCreateTime = userExtendDTOS.getFirst().getCreateTime();
|
||||
for (UserExtendDTO userExtendDTO : userExtendDTOS) {
|
||||
Assertions.assertFalse(userExtendDTO.getCreateTime() > firstCreateTime);
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ class TestResourcePoolControllerTests extends BaseTest {
|
|||
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
|
||||
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
|
||||
// 返回值中取出第一条ID最大的数据, 并判断是否是default-admin
|
||||
TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).get(0);
|
||||
TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).getFirst();
|
||||
Assertions.assertNull(testResourcePoolDTO.getInUsed());
|
||||
}
|
||||
|
||||
|
@ -557,7 +557,7 @@ class TestResourcePoolControllerTests extends BaseTest {
|
|||
ResultHolder sortHolder = JSON.parseObject(sortData, ResultHolder.class);
|
||||
Pager<?> sortPageData = JSON.parseObject(JSON.toJSONString(sortHolder.getData()), Pager.class);
|
||||
// 返回值中取出第一条ID最大的数据, 并判断是否是default-admin
|
||||
TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).get(0);
|
||||
TestResourcePoolDTO testResourcePoolDTO = JSON.parseArray(JSON.toJSONString(sortPageData.getList()), TestResourcePoolDTO.class).getFirst();
|
||||
Assertions.assertTrue(StringUtils.equals(testResourcePoolDTO.getName(), keyWord));
|
||||
return testResourcePoolDTO;
|
||||
}
|
||||
|
|
|
@ -77,10 +77,10 @@ public class UserApiKeysControllerTests extends BaseTest {
|
|||
UserKeyExample userKeyExample = new UserKeyExample();
|
||||
userKeyExample.createCriteria().andCreateUserEqualTo("admin");
|
||||
List<UserKey> userKeys = userKeyMapper.selectByExample(userKeyExample);
|
||||
userKeyId = userKeys.get(0).getId();
|
||||
userKeyId = userKeys.getFirst().getId();
|
||||
Assertions.assertEquals(1, userKeys.size());
|
||||
//校验日志
|
||||
checkLog(userKeys.get(0).getId(), OperationLogType.ADD);
|
||||
checkLog(userKeys.getFirst().getId(), OperationLogType.ADD);
|
||||
//校验只能加五条的限制
|
||||
requestGet(ADD);
|
||||
requestGet(ADD);
|
||||
|
@ -111,10 +111,10 @@ public class UserApiKeysControllerTests extends BaseTest {
|
|||
//选一个id不等于userKeyId的 只要id
|
||||
//取所有的id
|
||||
List<String> list = userKeys.stream().map(UserKey::getId).filter(id -> !id.equals(userKeyId)).toList();
|
||||
requestGet(String.format(DELETE, list.get(0)));
|
||||
requestGet(String.format(DELETE, list.getFirst()));
|
||||
Assertions.assertEquals(4, userKeyMapper.countByExample(userKeyExample));
|
||||
//校验日志
|
||||
checkLog(list.get(0), OperationLogType.DELETE);
|
||||
checkLog(list.getFirst(), OperationLogType.DELETE);
|
||||
//处理不存在的
|
||||
requestGet(String.format(DELETE, UUID.randomUUID().toString()), status().is5xxServerError());
|
||||
//校验权限
|
||||
|
@ -220,7 +220,7 @@ public class UserApiKeysControllerTests extends BaseTest {
|
|||
public void testValidate() throws Exception {
|
||||
List<UserKey> userKeys = userKeyMapper.selectByExample(new UserKeyExample());
|
||||
List<String> list = userKeys.stream().map(UserKey::getId).filter(id -> !id.equals(userKeyId)).toList();
|
||||
UserKey userKey1 = userKeyMapper.selectByPrimaryKey(list.get(0));
|
||||
UserKey userKey1 = userKeyMapper.selectByPrimaryKey(list.getFirst());
|
||||
MockHttpServletRequestBuilder requestBuilder = MockMvcRequestBuilders.get(VALIDATE);
|
||||
String signature = CodingUtils.aesEncrypt(userKey1.getAccessKey() + "|" + UUID.randomUUID().toString() + "|" + System.currentTimeMillis(), userKey1.getSecretKey(), userKey1.getAccessKey());
|
||||
requestBuilder
|
||||
|
|
|
@ -84,7 +84,7 @@ public class UserLocalConfigControllerTests extends BaseTest {
|
|||
public void testUpdate() throws Exception {
|
||||
UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample();
|
||||
userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API");
|
||||
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).get(0);
|
||||
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).getFirst();
|
||||
UserLocalConfigUpdateRequest request = new UserLocalConfigUpdateRequest();
|
||||
request.setId(userLocalConfig.getId());
|
||||
request.setUserUrl("https://www.zhihu.com");
|
||||
|
@ -107,7 +107,7 @@ public class UserLocalConfigControllerTests extends BaseTest {
|
|||
public void testEnable() throws Exception {
|
||||
UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample();
|
||||
userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API");
|
||||
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).get(0);
|
||||
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).getFirst();
|
||||
requestGet(String.format(ENABLE, userLocalConfig.getId()));
|
||||
userLocalConfig = userLocalConfigMapper.selectByPrimaryKey(userLocalConfig.getId());
|
||||
Assertions.assertEquals(true, userLocalConfig.getEnable());
|
||||
|
@ -122,7 +122,7 @@ public class UserLocalConfigControllerTests extends BaseTest {
|
|||
public void testDisable() throws Exception {
|
||||
UserLocalConfigExample userLocalConfigExample = new UserLocalConfigExample();
|
||||
userLocalConfigExample.createCriteria().andCreateUserEqualTo("admin").andTypeEqualTo("API");
|
||||
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).get(0);
|
||||
UserLocalConfig userLocalConfig = userLocalConfigMapper.selectByExample(userLocalConfigExample).getFirst();
|
||||
requestGet(String.format(DISABLE, userLocalConfig.getId()));
|
||||
userLocalConfig = userLocalConfigMapper.selectByPrimaryKey(userLocalConfig.getId());
|
||||
Assertions.assertEquals(false, userLocalConfig.getEnable());
|
||||
|
|
|
@ -87,7 +87,7 @@ public class PersonalControllerTests extends BaseTest {
|
|||
example.createCriteria().andIdEqualTo(loginUser);
|
||||
List<UserExtend> userExtends = userExtendMapper.selectByExample(example);
|
||||
if (!userExtends.isEmpty()) {
|
||||
Assertions.assertNull(userExtends.get(0).getAvatar());
|
||||
Assertions.assertNull(userExtends.getFirst().getAvatar());
|
||||
}
|
||||
|
||||
request = new PersonalUpdateRequest();
|
||||
|
|
|
@ -29,12 +29,12 @@ public class TestResourcePoolServiceTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void getTestResourceDTO() {
|
||||
testResourcePoolService.getTestResourceDTO(testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).get(0).getId());
|
||||
testResourcePoolService.getTestResourceDTO(testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).getFirst().getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void validateOrgResourcePool() {
|
||||
TestResourcePool resourcePool = testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).get(0);
|
||||
TestResourcePool resourcePool = testResourcePoolMapper.selectByExample(new TestResourcePoolExample()).getFirst();
|
||||
testResourcePoolService.getTestResourcePool(resourcePool.getId());
|
||||
commonProjectService.validateProjectResourcePool(resourcePool, DEFAULT_PROJECT_ID);
|
||||
testResourcePoolService.validateOrgResourcePool(resourcePool, DEFAULT_ORGANIZATION_ID);
|
||||
|
|
|
@ -653,7 +653,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
@Override
|
||||
public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) {
|
||||
TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.API_CASE.getKey())
|
||||
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().get(0);
|
||||
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().getFirst();
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
TestPlanApiCaseMapper apiBatchMapper = sqlSession.getMapper(TestPlanApiCaseMapper.class);
|
||||
TestPlanApiCase record = new TestPlanApiCase();
|
||||
|
|
|
@ -243,7 +243,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
|||
@Override
|
||||
public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) {
|
||||
TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.SCENARIO_CASE.getKey())
|
||||
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().get(0);
|
||||
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().getFirst();
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
TestPlanApiScenarioMapper scenarioBatchMapper = sqlSession.getMapper(TestPlanApiScenarioMapper.class);
|
||||
TestPlanApiScenario record = new TestPlanApiScenario();
|
||||
|
|
|
@ -351,7 +351,7 @@ public class TestPlanCollectionMinderService {
|
|||
@NotNull
|
||||
private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
|
||||
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
||||
TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).get(0);
|
||||
TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).getFirst();
|
||||
if (testPlanCollectionMinderEditDTO.getExtended()) {
|
||||
BeanUtils.copyBean(testPlanCollection, parent);
|
||||
} else {
|
||||
|
@ -379,7 +379,7 @@ public class TestPlanCollectionMinderService {
|
|||
@NotNull
|
||||
private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
|
||||
List<TestPlanCollection> testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType());
|
||||
TestPlanCollection parent = testPlanCollections.get(0);
|
||||
TestPlanCollection parent = testPlanCollections.getFirst();
|
||||
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
||||
if (testPlanCollectionMinderEditDTO.getExtended()) {
|
||||
BeanUtils.copyBean(testPlanCollection, parent);
|
||||
|
|
|
@ -259,7 +259,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
Map<String, List<FunctionalCaseCustomFieldDTO>> collect = functionalCaseService.getCaseCustomFiledMap(ids, projectId);
|
||||
Set<String> userIds = extractUserIds(functionalCaseLists);
|
||||
List<String> relateIds = functionalCaseLists.stream().map(TestPlanCasePageResponse::getId).collect(Collectors.toList());
|
||||
Map<String, List<CaseRelateBugDTO>> bugListMap = getBugData(relateIds, functionalCaseLists.get(0).getTestPlanId());
|
||||
Map<String, List<CaseRelateBugDTO>> bugListMap = getBugData(relateIds, functionalCaseLists.getFirst().getTestPlanId());
|
||||
List<SelectOption> statusOption = bugStatusService.getHeaderStatusOption(projectId);
|
||||
Map<String, String> statusMap = statusOption.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
|
||||
Map<String, String> userMap = userLoginService.getUserNameMap(new ArrayList<>(userIds));
|
||||
|
@ -708,7 +708,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
List<TestPlanCaseExecuteHistory> testPlanCaseExecuteHistories = extTestPlanCaseExecuteHistoryMapper.selectSteps(id, caseId);
|
||||
List<FunctionalCaseStepDTO> functionalCaseStepDTOS = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(testPlanCaseExecuteHistories)) {
|
||||
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = testPlanCaseExecuteHistories.get(0);
|
||||
TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = testPlanCaseExecuteHistories.getFirst();
|
||||
if (StringUtils.isNotBlank(caseDetailSteps)) {
|
||||
List<FunctionalCaseStepDTO> newCaseSteps = JSON.parseArray(caseDetailSteps, FunctionalCaseStepDTO.class);
|
||||
compareStep(testPlanCaseExecuteHistory, newCaseSteps);
|
||||
|
@ -900,7 +900,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
@Override
|
||||
public void initResourceDefaultCollection(String planId, List<TestPlanCollectionDTO> defaultCollections) {
|
||||
TestPlanCollectionDTO defaultCollection = defaultCollections.stream().filter(collection -> StringUtils.equals(collection.getType(), CaseType.FUNCTIONAL_CASE.getKey())
|
||||
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().get(0);
|
||||
&& !StringUtils.equals(collection.getParentId(), "NONE")).toList().getFirst();
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
TestPlanFunctionalCaseMapper functionalBatchMapper = sqlSession.getMapper(TestPlanFunctionalCaseMapper.class);
|
||||
TestPlanFunctionalCase record = new TestPlanFunctionalCase();
|
||||
|
|
|
@ -188,7 +188,7 @@ public class TestPlanLogService {
|
|||
if (CollectionUtils.isEmpty(plans)) {
|
||||
return;
|
||||
}
|
||||
Project project = projectMapper.selectByPrimaryKey(plans.get(0).getProjectId());
|
||||
Project project = projectMapper.selectByPrimaryKey(plans.getFirst().getProjectId());
|
||||
List<LogDTO> list = new ArrayList<>();
|
||||
for (TestPlan plan : plans) {
|
||||
LogDTO dto = LogDTOBuilder.builder()
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CountUtils {
|
|||
return new CaseCount();
|
||||
}
|
||||
|
||||
Class<CaseCount> clazz = (Class<CaseCount>) list.get(0).getClass();
|
||||
Class<CaseCount> clazz = (Class<CaseCount>) list.getFirst().getClass();
|
||||
CaseCount summary;
|
||||
try {
|
||||
summary = clazz.newInstance();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue