Search in sources :

Example 1 with RelevantItemInfo

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;
}
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 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());
}
Also used : RelevantItemInfo(com.epam.ta.reportportal.ws.model.analyzer.RelevantItemInfo) TestItem(com.epam.ta.reportportal.entity.item.TestItem) IndexTestItem(com.epam.ta.reportportal.ws.model.analyzer.IndexTestItem) AnalyzerUtils.fromTestItem(com.epam.ta.reportportal.core.analyzer.auto.impl.AnalyzerUtils.fromTestItem) Test(org.junit.jupiter.api.Test)

Aggregations

TestItem (com.epam.ta.reportportal.entity.item.TestItem)2 RelevantItemInfo (com.epam.ta.reportportal.ws.model.analyzer.RelevantItemInfo)2 AnalyzerUtils.fromTestItem (com.epam.ta.reportportal.core.analyzer.auto.impl.AnalyzerUtils.fromTestItem)1 IssueEntity (com.epam.ta.reportportal.entity.item.issue.IssueEntity)1 IssueType (com.epam.ta.reportportal.entity.item.issue.IssueType)1 IssueEntityBuilder (com.epam.ta.reportportal.ws.converter.builders.IssueEntityBuilder)1 IndexTestItem (com.epam.ta.reportportal.ws.model.analyzer.IndexTestItem)1 Test (org.junit.jupiter.api.Test)1