Search in sources :

Example 21 with IssueEntity

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

the class AnalyzerServiceServiceTest method issueToInvestigate.

private IssueEntity issueToInvestigate() {
    IssueType issueType = new IssueType();
    issueType.setLocator("ti001");
    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 22 with IssueEntity

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

the class AnalyzerUtilsTest method createIssue.

private IssueEntity createIssue(boolean isAutoAnalyzed) {
    IssueType issueType = new IssueType();
    issueType.setId(1L);
    issueType.setLocator("locator");
    IssueEntity issue = new IssueEntity();
    issue.setAutoAnalyzed(isAutoAnalyzed);
    issue.setIssueType(issueType);
    return issue;
}
Also used : IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity)

Example 23 with IssueEntity

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

the class LogIndexerServiceTest method createTestItem.

private TestItem createTestItem(Long id, TestItemIssueGroup issueGroup) {
    TestItem ti = new TestItem();
    ti.setItemId(id);
    ti.setLaunchId(id);
    ti.setItemResults(new TestItemResults());
    IssueType issueType = new IssueType();
    issueType.setLocator(issueGroup.getLocator());
    IssueEntity issueEntity = new IssueEntity();
    issueEntity.setIssueType(issueType);
    issueEntity.setIgnoreAnalyzer(false);
    ti.getItemResults().setIssue(issueEntity);
    return ti;
}
Also used : 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)

Example 24 with IssueEntity

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

the class SearchLogServiceImplTest method searchTest.

@Test
void searchTest() {
    ReportPortalUser.ProjectDetails projectDetails = new ReportPortalUser.ProjectDetails(1L, "project", ProjectRole.PROJECT_MANAGER);
    when(projectRepository.findById(projectDetails.getProjectId())).thenReturn(Optional.of(project));
    when(testItemRepository.findById(1L)).thenReturn(Optional.of(testItem));
    when(testItemRepository.findAllById(any())).thenReturn(Lists.newArrayList(testItemOfFoundLog));
    when(testItem.getLaunchId()).thenReturn(1L);
    when(testItemOfFoundLog.getItemId()).thenReturn(2L);
    when(testItemOfFoundLog.getLaunchId()).thenReturn(1L);
    when(launchRepository.findById(1L)).thenReturn(Optional.of(launch));
    when(launch.getId()).thenReturn(1L);
    when(testItem.getPath()).thenReturn("1");
    when(testItem.getItemResults()).thenReturn(testItemResults);
    when(testItem.isHasStats()).thenReturn(true);
    when(testItemOfFoundLog.getItemResults()).thenReturn(testItemResults);
    when(testItemOfFoundLog.isHasStats()).thenReturn(true);
    when(testItemResults.getStatus()).thenReturn(StatusEnum.FAILED);
    IssueType issueType = new IssueType();
    issueType.setLocator("locator");
    IssueEntity issueEntity = new IssueEntity();
    issueEntity.setIssueType(issueType);
    issueEntity.setIgnoreAnalyzer(false);
    when(testItemResults.getIssue()).thenReturn(issueEntity);
    when(userFilterRepository.findByIdAndProjectId(1L, 1L)).thenReturn(Optional.of(userFilter));
    when(userFilter.getTargetClass()).thenReturn(ObjectType.Launch);
    when(userFilter.getFilterCondition()).thenReturn(Collections.emptySet());
    when(logRepository.findMessagesByLaunchIdAndItemIdAndPathAndLevelGte(launch.getId(), testItem.getItemId(), testItem.getPath(), LogLevel.ERROR_INT)).thenReturn(Lists.newArrayList("message"));
    SearchRs searchRs = new SearchRs();
    searchRs.setLogId(1L);
    searchRs.setTestItemId(2L);
    when(analyzerServiceClient.searchLogs(any(SearchRq.class))).thenReturn(Lists.newArrayList(searchRs));
    Log log = new Log();
    log.setId(1L);
    log.setTestItem(testItem);
    log.setLogMessage("message");
    log.setLogLevel(40000);
    when(logRepository.findAllById(any())).thenReturn(Lists.newArrayList(log));
    SearchLogRq searchLogRq = new SearchLogRq();
    searchLogRq.setSearchMode(CURRENT_LAUNCH.getValue());
    searchLogRq.setFilterId(1L);
    when(searchCollectorFactory.getCollector(CURRENT_LAUNCH)).thenReturn(currentLaunchCollector);
    when(currentLaunchCollector.collect(any(), any())).thenReturn(Collections.singletonList(1L));
    Iterable<SearchLogRs> responses = searchLogService.search(1L, searchLogRq, projectDetails);
    Assertions.assertNotNull(responses);
    Assertions.assertEquals(1, Lists.newArrayList(responses).size());
}
Also used : SearchRq(com.epam.ta.reportportal.ws.model.analyzer.SearchRq) Log(com.epam.ta.reportportal.entity.log.Log) IssueType(com.epam.ta.reportportal.entity.item.issue.IssueType) IssueEntity(com.epam.ta.reportportal.entity.item.issue.IssueEntity) SearchLogRs(com.epam.ta.reportportal.ws.model.log.SearchLogRs) SearchRs(com.epam.ta.reportportal.ws.model.analyzer.SearchRs) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) SearchLogRq(com.epam.ta.reportportal.ws.model.log.SearchLogRq) Test(org.junit.jupiter.api.Test)

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