Search in sources :

Example 1 with IssueEntity

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;
}
Also used : RelevantItemInfo(com.epam.ta.reportportal.ws.model.analyzer.RelevantItemInfo) IssueEntityBuilder(com.epam.ta.reportportal.ws.converter.builders.IssueEntityBuilder) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) TestItem(com.epam.ta.reportportal.entity.item.TestItem)

Example 2 with IssueEntity

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;
}
Also used : IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity)

Example 3 with 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");
}
Also used : TestItemIssueGroup(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup) IssueGroup(com.epam.ta.reportportal.entity.item.issue.IssueGroup) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 4 with IssueEntity

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");
}
Also used : TestItemIssueGroup(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup) IssueGroup(com.epam.ta.reportportal.entity.item.issue.IssueGroup) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) TestItem(com.epam.ta.reportportal.entity.item.TestItem) Test(org.junit.jupiter.api.Test)

Example 5 with IssueEntity

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);
        });
    }
}
Also used : IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity)

Aggregations

IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)24 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)18 TestItem (com.epam.ta.reportportal.entity.item.TestItem)9 TestItemResults (com.epam.ta.reportportal.entity.item.TestItemResults)8 Test (org.junit.jupiter.api.Test)7 TestItemIssueGroup (com.epam.ta.reportportal.entity.enums.TestItemIssueGroup)6 IssueGroup (com.epam.ta.reportportal.entity.item.issue.IssueGroup)6 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)4 Issue (com.epam.ta.reportportal.ws.model.issue.Issue)4 IssueEntityBuilder (com.epam.ta.reportportal.ws.converter.builders.IssueEntityBuilder)3 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)2 ItemIssueTypeDefinedEvent (com.epam.ta.reportportal.core.events.activity.ItemIssueTypeDefinedEvent)2 StatusEnum (com.epam.ta.reportportal.entity.enums.StatusEnum)2 Launch (com.epam.ta.reportportal.entity.launch.Launch)2 OperationCompletionRS (com.epam.ta.reportportal.ws.model.OperationCompletionRS)2 TestItemActivityResource (com.epam.ta.reportportal.ws.model.activity.TestItemActivityResource)2 TO_LOCAL_DATE_TIME (com.epam.ta.reportportal.commons.EntityUtils.TO_LOCAL_DATE_TIME)1 Preconditions (com.epam.ta.reportportal.commons.Preconditions)1 Predicates.equalTo (com.epam.ta.reportportal.commons.Predicates.equalTo)1 BusinessRule.expect (com.epam.ta.reportportal.commons.validation.BusinessRule.expect)1