Search in sources :

Example 11 with GenerateClustersConfig

use of com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig in project service-api by reportportal.

the class SaveLastRunAttributePartProviderTest method shouldUpdateWhenExists.

@Test
void shouldUpdateWhenExists() {
    final GenerateClustersConfig config = getConfig(false);
    final ItemAttribute itemAttribute = new ItemAttribute();
    when(itemAttributeRepository.findByLaunchIdAndKeyAndSystem(config.getLaunchId(), RP_CLUSTER_LAST_RUN_KEY, true)).thenReturn(Optional.of(itemAttribute));
    final PipelinePart pipelinePart = provider.provide(config);
    pipelinePart.handle();
    verify(itemAttributeRepository, times(1)).save(itemAttribute);
}
Also used : ItemAttribute(com.epam.ta.reportportal.entity.ItemAttribute) PipelinePart(com.epam.ta.reportportal.pipeline.PipelinePart) GenerateClustersConfig(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig) Test(org.junit.jupiter.api.Test)

Example 12 with GenerateClustersConfig

use of com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig in project service-api by reportportal.

the class ConfigProvider method getConfig.

public static final GenerateClustersConfig getConfig(boolean forUpdate) {
    final GenerateClustersConfig config = new GenerateClustersConfig();
    final AnalyzerConfig analyzerConfig = new AnalyzerConfig();
    analyzerConfig.setNumberOfLogLines(1);
    config.setAnalyzerConfig(analyzerConfig);
    config.setProject(1L);
    config.setLaunchId(1L);
    config.setForUpdate(forUpdate);
    config.setCleanNumbers(false);
    return config;
}
Also used : AnalyzerConfig(com.epam.ta.reportportal.ws.model.project.AnalyzerConfig) GenerateClustersConfig(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig)

Example 13 with GenerateClustersConfig

use of com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig in project service-api by reportportal.

the class UpdateLaunchHandlerImpl method createClusters.

@Override
@Transactional
public OperationCompletionRS createClusters(CreateClustersRQ createClustersRQ, ReportPortalUser.ProjectDetails projectDetails, ReportPortalUser user) {
    final Launch launch = getLaunchHandler.getLaunch(createClustersRQ.getLaunchId());
    launchAccessValidator.validate(launch, projectDetails, user);
    // TODO should be put inside *Validator after validators refactoring
    expect(launch.getStatus(), not(statusIn(StatusEnum.IN_PROGRESS))).verify(INCORRECT_REQUEST, "Cannot analyze launch in progress.");
    final Project project = getProjectHandler.getProject(projectDetails);
    AnalyzerConfig analyzerConfig = getAnalyzerConfig(project);
    final GenerateClustersConfig config = new GenerateClustersConfig();
    config.setAnalyzerConfig(analyzerConfig);
    config.setLaunchId(launch.getId());
    config.setProject(project.getId());
    config.setForUpdate(false);
    config.setCleanNumbers(createClustersRQ.isRemoveNumbers());
    clusterGenerator.generate(config);
    return new OperationCompletionRS(Suppliers.formattedSupplier("Clusters generation for launch with ID='{}' started.", launch.getId()).get());
}
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) Launch(com.epam.ta.reportportal.entity.launch.Launch) GenerateClustersConfig(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig) OperationCompletionRS(com.epam.ta.reportportal.ws.model.OperationCompletionRS) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

GenerateClustersConfig (com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig)13 Test (org.junit.jupiter.api.Test)11 PipelinePart (com.epam.ta.reportportal.pipeline.PipelinePart)6 ClusterData (com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.ClusterData)4 Launch (com.epam.ta.reportportal.entity.launch.Launch)2 Project (com.epam.ta.reportportal.entity.project.Project)2 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)2 AnalyzerConfig (com.epam.ta.reportportal.ws.model.project.AnalyzerConfig)2 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)1 GenerateClustersRq (com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersRq)1 AnalyzerUtils.getAnalyzerConfig (com.epam.ta.reportportal.core.analyzer.auto.impl.AnalyzerUtils.getAnalyzerConfig)1 LaunchTestUtil.getLaunch (com.epam.ta.reportportal.core.launch.impl.LaunchTestUtil.getLaunch)1 ItemAttribute (com.epam.ta.reportportal.entity.ItemAttribute)1 TestProjectExtractor.extractProjectDetails (com.epam.ta.reportportal.util.TestProjectExtractor.extractProjectDetails)1 OperationCompletionRS (com.epam.ta.reportportal.ws.model.OperationCompletionRS)1 IndexLaunch (com.epam.ta.reportportal.ws.model.analyzer.IndexLaunch)1 CreateClustersRQ (com.epam.ta.reportportal.ws.model.launch.cluster.CreateClustersRQ)1 Transactional (org.springframework.transaction.annotation.Transactional)1