Search in sources :

Example 11 with IssueEntity

use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project service-api by reportportal.

the class IssueConverterTest method toModel.

@Test
void toModel() {
    final IssueEntity issueEntity = getIssueEntity();
    final Issue resource = IssueConverter.TO_MODEL.apply(issueEntity);
    assertEquals(resource.getAutoAnalyzed(), issueEntity.getAutoAnalyzed());
    assertEquals(resource.getComment(), issueEntity.getIssueDescription());
    assertEquals(resource.getIgnoreAnalyzer(), issueEntity.getIgnoreAnalyzer());
    assertEquals(resource.getIssueType(), issueEntity.getIssueType().getLocator());
}
Also used : Issue(com.epam.ta.reportportal.ws.model.issue.Issue) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) Test(org.junit.jupiter.api.Test)

Example 12 with IssueEntity

use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project commons-dao by reportportal.

the class TestItemRepositoryTest method assertIssueExistsAndTicketsEmpty.

private void assertIssueExistsAndTicketsEmpty(TestItem testItem, Long expectedId) {
    assertEquals(expectedId, testItem.getItemId());
    IssueEntity issue = testItem.getItemResults().getIssue();
    assertNotEquals(null, issue);
    assertEquals(0, issue.getTickets().size());
}
Also used : IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity)

Example 13 with IssueEntity

use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project service-api by reportportal.

the class FinishTestItemHandlerImpl method resolveIssue.

private Optional<IssueEntity> resolveIssue(ReportPortalUser user, StatusEnum status, TestItem testItem, @Nullable Issue issue, Long projectId) {
    if (isIssueRequired(testItem, status)) {
        return ofNullable(issue).map(is -> {
            // in provided issue should be locator id or NOT_ISSUE value
            String locator = is.getIssueType();
            if (!NOT_ISSUE_FLAG.getValue().equalsIgnoreCase(locator)) {
                IssueType issueType = issueTypeHandler.defineIssueType(projectId, locator);
                IssueEntity issueEntity = IssueConverter.TO_ISSUE.apply(is);
                issueEntity.setIssueType(issueType);
                if (!CollectionUtils.isEmpty(issue.getExternalSystemIssues())) {
                    externalTicketHandler.linkExternalTickets(user.getUsername(), Lists.newArrayList(issueEntity), new ArrayList<>(issue.getExternalSystemIssues()));
                }
                return Optional.of(issueEntity);
            }
            return Optional.<IssueEntity>empty();
        }).orElseGet(() -> {
            IssueEntity issueEntity = new IssueEntity();
            IssueType toInvestigate = issueTypeHandler.defineIssueType(projectId, TO_INVESTIGATE.getLocator());
            issueEntity.setIssueType(toInvestigate);
            return Optional.of(issueEntity);
        });
    }
    return Optional.empty();
}
Also used : StatusEnum(com.epam.ta.reportportal.entity.enums.StatusEnum) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) Primary(org.springframework.context.annotation.Primary) OperationCompletionRS(com.epam.ta.reportportal.ws.model.OperationCompletionRS) ATTRIBUTE_VALUE_INTERRUPTED(com.epam.ta.reportportal.core.hierarchy.AbstractFinishHierarchyHandler.ATTRIBUTE_VALUE_INTERRUPTED) Autowired(org.springframework.beans.factory.annotation.Autowired) MessageBus(com.epam.ta.reportportal.core.events.MessageBus) StringUtils(org.apache.commons.lang3.StringUtils) FinishTestItemRQ(com.epam.ta.reportportal.ws.model.FinishTestItemRQ) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) TO_INVESTIGATE(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup.TO_INVESTIGATE) Preconditions(com.epam.ta.reportportal.commons.Preconditions) TestItemRepository(com.epam.ta.reportportal.dao.TestItemRepository) Suppliers.formattedSupplier(com.epam.ta.reportportal.commons.validation.Suppliers.formattedSupplier) TestItemActivityResource(com.epam.ta.reportportal.ws.model.activity.TestItemActivityResource) ChangeStatusHandler(com.epam.ta.reportportal.core.item.impl.status.ChangeStatusHandler) Launch(com.epam.ta.reportportal.entity.launch.Launch) LogIndexer(com.epam.ta.reportportal.core.analyzer.auto.LogIndexer) TestItemStatusChangedEvent(com.epam.ta.reportportal.core.events.activity.TestItemStatusChangedEvent) Predicate(java.util.function.Predicate) BusinessRule.expect(com.epam.ta.reportportal.commons.validation.BusinessRule.expect) IssueConverter(com.epam.ta.reportportal.ws.converter.converters.IssueConverter) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) TestItemBuilder(com.epam.ta.reportportal.ws.converter.builders.TestItemBuilder) RetryHandler(com.epam.ta.reportportal.core.item.impl.retry.RetryHandler) ITEM_CAN_BE_INDEXED(com.epam.ta.reportportal.util.Predicates.ITEM_CAN_BE_INDEXED) IssueEntityRepository(com.epam.ta.reportportal.dao.IssueEntityRepository) NOT_ISSUE_FLAG(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup.NOT_ISSUE_FLAG) LaunchRepository(com.epam.ta.reportportal.dao.LaunchRepository) TestItemResults(com.epam.ta.reportportal.entity.item.TestItemResults) JStatusEnum(com.epam.ta.reportportal.jooq.enums.JStatusEnum) java.util(java.util) Issue(com.epam.ta.reportportal.ws.model.issue.Issue) TestItem(com.epam.ta.reportportal.entity.item.TestItem) TO_LOCAL_DATE_TIME(com.epam.ta.reportportal.commons.EntityUtils.TO_LOCAL_DATE_TIME) BooleanUtils(org.apache.commons.lang3.BooleanUtils) ErrorType(com.epam.ta.reportportal.ws.model.ErrorType) FinishTestItemHandler(com.epam.ta.reportportal.core.item.FinishTestItemHandler) StatusChangingStrategy(com.epam.ta.reportportal.core.item.impl.status.StatusChangingStrategy) ExternalTicketHandler(com.epam.ta.reportportal.core.item.ExternalTicketHandler) Lists(com.google.common.collect.Lists) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) Predicates.equalTo(com.epam.ta.reportportal.commons.Predicates.equalTo) CollectionUtils(org.apache.commons.collections.CollectionUtils) Service(org.springframework.stereotype.Service) UserRole(com.epam.ta.reportportal.entity.user.UserRole) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) Qualifier(org.springframework.beans.factory.annotation.Qualifier) LogRepository(com.epam.ta.reportportal.dao.LogRepository) Nullable(javax.annotation.Nullable) ATTRIBUTE_KEY_STATUS(com.epam.ta.reportportal.core.hierarchy.AbstractFinishHierarchyHandler.ATTRIBUTE_KEY_STATUS) RetrySearcher(com.epam.ta.reportportal.core.item.impl.retry.RetrySearcher) FinishHierarchyHandler(com.epam.ta.reportportal.core.hierarchy.FinishHierarchyHandler) Optional.ofNullable(java.util.Optional.ofNullable) TO_ACTIVITY_RESOURCE(com.epam.ta.reportportal.ws.converter.converters.TestItemConverter.TO_ACTIVITY_RESOURCE) ItemFinishedEvent(com.epam.ta.reportportal.core.events.item.ItemFinishedEvent) PROJECT_MANAGER(com.epam.ta.reportportal.entity.project.ProjectRole.PROJECT_MANAGER) Transactional(org.springframework.transaction.annotation.Transactional) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity)

Example 14 with IssueEntity

use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project service-api by reportportal.

the class AbstractStatusChangingStrategy method addToInvestigateIssue.

protected void addToInvestigateIssue(TestItem testItem, Long projectId) {
    IssueEntity issueEntity = new IssueEntity();
    IssueType toInvestigate = issueTypeHandler.defineIssueType(projectId, TO_INVESTIGATE.getLocator());
    issueEntity.setIssueType(toInvestigate);
    issueEntity.setTestItemResults(testItem.getItemResults());
    issueEntityRepository.save(issueEntity);
    testItem.getItemResults().setIssue(issueEntity);
}
Also used : IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity)

Example 15 with IssueEntity

use of com.epam.ta.reportportal.entity.item.issue.IssueEntity in project service-api by reportportal.

the class IssueConverterTest method getIssueEntity.

private static IssueEntity getIssueEntity() {
    final IssueEntity issue = new IssueEntity();
    issue.setIssueType(new IssueType(new IssueGroup(TestItemIssueGroup.PRODUCT_BUG), "locator", "long name", "SNA", "color"));
    issue.setIgnoreAnalyzer(false);
    issue.setAutoAnalyzed(false);
    issue.setIssueDescription("issue description");
    return issue;
}
Also used : IssueGroup(com.epam.ta.reportportal.entity.item.issue.IssueGroup) TestItemIssueGroup(com.epam.ta.reportportal.entity.enums.TestItemIssueGroup) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) 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