use of com.epam.ta.reportportal.entity.AnalyzeMode in project service-api by reportportal.
the class LaunchAutoAnalysisStrategy method analyze.
public void analyze(AnalyzeLaunchRQ analyzeRQ, ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user) {
expect(analyzerServiceAsync.hasAnalyzers(), Predicate.isEqual(true)).verify(ErrorType.UNABLE_INTERACT_WITH_INTEGRATION, "There are no analyzer services are deployed.");
AnalyzeMode analyzeMode = AnalyzeMode.fromString(analyzeRQ.getAnalyzerHistoryMode()).orElseThrow(() -> new ReportPortalException(BAD_REQUEST_ERROR, analyzeRQ.getAnalyzerHistoryMode()));
Launch launch = launchRepository.findById(analyzeRQ.getLaunchId()).orElseThrow(() -> new ReportPortalException(LAUNCH_NOT_FOUND, analyzeRQ.getLaunchId()));
validateLaunch(launch, projectDetails);
Project project = projectRepository.findById(projectDetails.getProjectId()).orElseThrow(() -> new ReportPortalException(PROJECT_NOT_FOUND, projectDetails.getProjectId()));
AnalyzerConfig analyzerConfig = getAnalyzerConfig(project);
analyzerConfig.setAnalyzerMode(analyzeMode.getValue());
List<Long> itemIds = collectItemsByModes(launch.getId(), analyzeRQ.getAnalyzeItemsModes(), project, user);
eventPublisher.publishEvent(new AnalysisEvent(launch, itemIds, analyzerConfig));
}
Aggregations