Search in sources :

Example 1 with AnalysisEvent

use of com.epam.ta.reportportal.core.events.AnalysisEvent 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));
}
Also used : Project(com.epam.ta.reportportal.entity.project.Project) AnalyzerUtils.getAnalyzerConfig(com.epam.ta.reportportal.core.analyzer.auto.impl.AnalyzerUtils.getAnalyzerConfig) AnalyzerConfig(com.epam.ta.reportportal.ws.model.project.AnalyzerConfig) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) AnalysisEvent(com.epam.ta.reportportal.core.events.AnalysisEvent) AnalyzeMode(com.epam.ta.reportportal.entity.AnalyzeMode) Launch(com.epam.ta.reportportal.entity.launch.Launch)

Aggregations

AnalyzerUtils.getAnalyzerConfig (com.epam.ta.reportportal.core.analyzer.auto.impl.AnalyzerUtils.getAnalyzerConfig)1 AnalysisEvent (com.epam.ta.reportportal.core.events.AnalysisEvent)1 AnalyzeMode (com.epam.ta.reportportal.entity.AnalyzeMode)1 Launch (com.epam.ta.reportportal.entity.launch.Launch)1 Project (com.epam.ta.reportportal.entity.project.Project)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 AnalyzerConfig (com.epam.ta.reportportal.ws.model.project.AnalyzerConfig)1