use of com.epam.ta.reportportal.entity.item.issue.IssueEntity 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.entity.item.issue.IssueEntity in project service-api by reportportal.
the class AnalyzerServiceServiceTest method issueProductBug.
private IssueEntity issueProductBug() {
IssueType issueType = new IssueType();
issueType.setLocator("pb001");
IssueEntity issueEntity = new IssueEntity();
issueEntity.setIssueType(issueType);
return issueEntity;
}
use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project service-api by reportportal.
the class PredicatesTest method checkTIIndexed.
@Test
void checkTIIndexed() {
TestItem testItem = new TestItem();
final TestItemResults itemResults = new TestItemResults();
testItem.setType(TestItemTypeEnum.STEP);
final IssueEntity issue = new IssueEntity();
final IssueType issueType = new IssueType();
issueType.setIssueGroup(new IssueGroup(TestItemIssueGroup.TO_INVESTIGATE));
issueType.setLocator(TestItemIssueGroup.TO_INVESTIGATE.getLocator());
issue.setIssueType(issueType);
itemResults.setIssue(issue);
testItem.setItemResults(itemResults);
assertTrue(ITEM_CAN_BE_INDEXED.test(testItem), "Item with TI issue is available for indexing");
}
use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project service-api by reportportal.
the class PredicatesTest method checkIgnoreIndexed.
@Test
void checkIgnoreIndexed() {
TestItem testItem = new TestItem();
testItem.setType(TestItemTypeEnum.STEP);
final TestItemResults itemResults = new TestItemResults();
final IssueEntity issueEntity = new IssueEntity();
issueEntity.setIgnoreAnalyzer(true);
final IssueType issueType = new IssueType();
issueType.setIssueGroup(new IssueGroup(TestItemIssueGroup.PRODUCT_BUG));
issueEntity.setIssueType(issueType);
itemResults.setIssue(issueEntity);
testItem.setItemResults(itemResults);
assertFalse(ITEM_CAN_BE_INDEXED.test(testItem), "Item with ignore flag shouldn't be available for indexing");
}
use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project service-api by reportportal.
the class AbstractFinishHierarchyHandler method attachIssue.
/**
* Attach default issue to the item only if it wasn't already created
*
* @param testItem {@link TestItem}
* @param issueType {@link IssueType}
*/
private void attachIssue(TestItem testItem, IssueType issueType) {
if (!SUITE.sameLevel(testItem.getType()) && testItem.isHasStats()) {
issueEntityRepository.findById(testItem.getItemId()).ifPresentOrElse(issue -> {
}, () -> {
IssueEntity issueEntity = new IssueEntity();
issueEntity.setIssueType(issueType);
issueEntity.setTestItemResults(testItem.getItemResults());
issueEntityRepository.save(issueEntity);
testItem.getItemResults().setIssue(issueEntity);
});
}
}
Aggregations