Search in sources :

Example 1 with LaunchAutoAnalysisFinishEvent

use of com.epam.reportportal.extension.event.LaunchAutoAnalysisFinishEvent in project service-api by reportportal.

the class LaunchAutoAnalysisSubscriber method handleEvent.

@Override
public void handleEvent(LaunchFinishedEvent launchFinishedEvent, Project project, Launch launch) {
    AnalyzerConfig analyzerConfig = AnalyzerUtils.getAnalyzerConfig(project);
    if (BooleanUtils.isTrue(analyzerConfig.getIsAutoAnalyzerEnabled())) {
        List<Long> itemIds = analyzeCollectorFactory.getCollector(AnalyzeItemsMode.TO_INVESTIGATE).collectItems(project.getId(), launch.getId(), launchFinishedEvent.getUser());
        logIndexer.indexLaunchLogs(project.getId(), launch.getId(), analyzerConfig).join();
        analyzerServiceAsync.analyze(launch, itemIds, analyzerConfig).thenRunAsync(() -> eventPublisher.publishEvent(new LaunchAutoAnalysisFinishEvent(launch.getId()))).join();
        // TODO provide executor
        CompletableFuture.supplyAsync(() -> logIndexer.indexItemsLogs(project.getId(), launch.getId(), itemIds, analyzerConfig));
    } else {
        logIndexer.indexLaunchLogs(project.getId(), launch.getId(), analyzerConfig);
        eventPublisher.publishEvent(new LaunchAutoAnalysisFinishEvent(launch.getId()));
    }
}
Also used : LaunchAutoAnalysisFinishEvent(com.epam.reportportal.extension.event.LaunchAutoAnalysisFinishEvent) AnalyzerConfig(com.epam.ta.reportportal.ws.model.project.AnalyzerConfig)

Aggregations

LaunchAutoAnalysisFinishEvent (com.epam.reportportal.extension.event.LaunchAutoAnalysisFinishEvent)1 AnalyzerConfig (com.epam.ta.reportportal.ws.model.project.AnalyzerConfig)1