use of com.epam.ta.reportportal.core.events.item.ItemFinishedEvent in project service-api by reportportal.
the class FinishTestItemHandlerImpl method updateFinishedItem.
private void updateFinishedItem(TestItemResults testItemResults, StatusEnum actualStatus, Optional<IssueEntity> resolvedIssue, TestItem testItem, ReportPortalUser user, Long projectId) {
resolvedIssue.ifPresent(issue -> deleteOldIssueIndex(actualStatus, testItem, testItemResults, projectId));
if (testItemResults.getStatus() != actualStatus) {
TestItemActivityResource before = TO_ACTIVITY_RESOURCE.apply(testItem, projectId);
Optional<StatusChangingStrategy> statusChangingStrategy = ofNullable(statusChangingStrategyMapping.get(actualStatus));
if (statusChangingStrategy.isPresent()) {
statusChangingStrategy.get().changeStatus(testItem, actualStatus, user);
} else {
testItemResults.setStatus(actualStatus);
}
publishUpdateActivity(before, TO_ACTIVITY_RESOURCE.apply(testItem, projectId), user);
}
resolvedIssue.ifPresent(issue -> {
updateItemIssue(testItemResults, issue);
if (ITEM_CAN_BE_INDEXED.test(testItem)) {
eventPublisher.publishEvent(new ItemFinishedEvent(testItem.getItemId(), testItem.getLaunchId(), projectId));
}
});
}
Aggregations