use of com.epam.ta.reportportal.ws.model.launch.AnalyzeLaunchRQ in project service-api by reportportal.
the class LaunchAutoAnalysisStrategyTest method analyzeTest.
@Test
void analyzeTest() {
when(analyzerServiceAsync.hasAnalyzers()).thenReturn(true);
when(launchRepository.findById(1L)).thenReturn(Optional.of(launch));
when(launch.getId()).thenReturn(1L);
when(launch.getProjectId()).thenReturn(1L);
when(launch.getMode()).thenReturn(LaunchModeEnum.DEFAULT);
when(projectRepository.findById(1L)).thenReturn(Optional.of(project));
when(project.getId()).thenReturn(1L);
when(project.getProjectAttributes()).thenReturn(Sets.newHashSet());
when(analyzeCollectorFactory.getCollector(any(AnalyzeItemsMode.class))).thenReturn(analyzeItemsCollector);
ReportPortalUser user = getRpUser("user", UserRole.USER, ProjectRole.PROJECT_MANAGER, 1L);
when(analyzeItemsCollector.collectItems(1L, 1L, user)).thenReturn(Lists.newArrayList());
ReportPortalUser.ProjectDetails projectDetails = new ReportPortalUser.ProjectDetails(1L, "name", ProjectRole.PROJECT_MANAGER);
AnalyzeLaunchRQ analyzeLaunchRQ = new AnalyzeLaunchRQ();
analyzeLaunchRQ.setLaunchId(1L);
analyzeLaunchRQ.setAnalyzerHistoryMode("ALL");
analyzeLaunchRQ.setAnalyzeItemsModes(Lists.newArrayList("TO_INVESTIGATE"));
analyzeLaunchRQ.setAnalyzerTypeName("patternAnalyzer");
launchAutoAnalysisStrategy.analyze(analyzeLaunchRQ, projectDetails, user);
verify(eventPublisher, times(1)).publishEvent(any(AnalysisEvent.class));
}
use of com.epam.ta.reportportal.ws.model.launch.AnalyzeLaunchRQ in project service-api by reportportal.
the class LaunchPatternAnalysisStrategyTest method analyzeTest.
@Test
void analyzeTest() {
when(launchRepository.findById(1L)).thenReturn(Optional.of(launch));
when(launch.getProjectId()).thenReturn(1L);
when(launch.getMode()).thenReturn(LaunchModeEnum.DEFAULT);
when(projectRepository.findById(1L)).thenReturn(Optional.of(project));
ProjectAttribute projectAttribute = new ProjectAttribute();
projectAttribute.setValue("true");
Attribute attribute = new Attribute();
projectAttribute.setAttribute(attribute);
when(project.getProjectAttributes()).thenReturn(Sets.newHashSet(projectAttribute));
ReportPortalUser user = getRpUser("user", UserRole.USER, ProjectRole.PROJECT_MANAGER, 1L);
ReportPortalUser.ProjectDetails projectDetails = new ReportPortalUser.ProjectDetails(1L, "name", ProjectRole.PROJECT_MANAGER);
AnalyzeLaunchRQ analyzeLaunchRQ = new AnalyzeLaunchRQ();
analyzeLaunchRQ.setLaunchId(1L);
analyzeLaunchRQ.setAnalyzeItemsModes(Lists.newArrayList("TO_INVESTIGATE"));
analyzeLaunchRQ.setAnalyzerTypeName("patternAnalyzer");
launchPatternAnalysisStrategy.analyze(analyzeLaunchRQ, projectDetails, user);
verify(patternAnalyzer, times(1)).analyzeTestItems(launch, Sets.newHashSet(AnalyzeItemsMode.TO_INVESTIGATE));
}
use of com.epam.ta.reportportal.ws.model.launch.AnalyzeLaunchRQ in project service-api by reportportal.
the class LaunchControllerTest method getSuggestedItemsAnalyzerNotDeployed.
@Test
void getSuggestedItemsAnalyzerNotDeployed() throws Exception {
AnalyzeLaunchRQ analyzeLaunchRQ = new AnalyzeLaunchRQ();
analyzeLaunchRQ.setLaunchId(1L);
analyzeLaunchRQ.setAnalyzeItemsModes(Collections.singletonList("TO_INVESTIGATE"));
analyzeLaunchRQ.setAnalyzerTypeName("autoAnalyzer");
analyzeLaunchRQ.setAnalyzerHistoryMode("ALL");
mockMvc.perform(post(DEFAULT_PROJECT_BASE_URL + "/launch/analyze").with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(analyzeLaunchRQ)).contentType(APPLICATION_JSON)).andExpect(result -> assertTrue(result.getResolvedException() instanceof ReportPortalException)).andExpect(result -> assertEquals("Impossible interact with integration. There are no analyzer services are deployed.", result.getResolvedException().getMessage()));
}
Aggregations