use of com.epam.ta.reportportal.ws.model.analyzer.RelevantItemInfo in project service-api by reportportal.
the class AnalyzerServiceImpl method updateTestItemIssue.
/**
* Updates issue for a specified test item
*
* @param projectId - Project id
* @param rs - Response from an analyzer
* @param testItem - Test item to be updated
* @return Updated issue entity
*/
private RelevantItemInfo updateTestItemIssue(Long projectId, AnalyzedItemRs rs, TestItem testItem) {
IssueType issueType = issueTypeHandler.defineIssueType(projectId, rs.getLocator());
IssueEntity issueEntity = new IssueEntityBuilder(testItem.getItemResults().getIssue()).addIssueType(issueType).addIgnoreFlag(testItem.getItemResults().getIssue().getIgnoreAnalyzer()).addAutoAnalyzedFlag(true).get();
issueEntity.setIssueId(testItem.getItemId());
issueEntity.setTestItemResults(testItem.getItemResults());
testItem.getItemResults().setIssue(issueEntity);
RelevantItemInfo relevantItemInfo = null;
if (rs.getRelevantItemId() != null) {
Optional<TestItem> relevantItemOptional = testItemRepository.findById(rs.getRelevantItemId());
if (relevantItemOptional.isPresent()) {
relevantItemInfo = updateIssueFromRelevantItem(issueEntity, relevantItemOptional.get());
} else {
LOGGER.error(ErrorType.TEST_ITEM_NOT_FOUND.getDescription(), rs.getRelevantItemId());
}
}
return relevantItemInfo;
}
use of com.epam.ta.reportportal.ws.model.analyzer.RelevantItemInfo in project service-api by reportportal.
the class AnalyzerUtilsTest method testToRelevantItemInfo.
@Test
void testToRelevantItemInfo() {
final TestItem testItem = new TestItem();
testItem.setItemId(1L);
testItem.setLaunchId(2L);
testItem.setPath("1");
final RelevantItemInfo itemInfo = AnalyzerUtils.TO_RELEVANT_ITEM_INFO.apply(testItem);
assertEquals(String.valueOf(testItem.getItemId()), itemInfo.getItemId());
assertEquals(String.valueOf(testItem.getLaunchId()), itemInfo.getLaunchId());
assertEquals(testItem.getPath(), itemInfo.getPath());
}
Aggregations