Search in sources :

Example 6 with GenerateClustersConfig

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

the class UpdateLaunchHandlerImplTest method createClusters.

@Test
void createClusters() {
    final ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.CUSTOMER, 1L);
    final Project project = new Project();
    project.setId(1L);
    when(getProjectHandler.getProject(any(ReportPortalUser.ProjectDetails.class))).thenReturn(project);
    when(getLaunchHandler.getLaunch(1L)).thenReturn(getLaunch(StatusEnum.PASSED, LaunchModeEnum.DEFAULT).get());
    final CreateClustersRQ createClustersRQ = new CreateClustersRQ();
    createClustersRQ.setLaunchId(1L);
    createClustersRQ.setRemoveNumbers(true);
    handler.createClusters(createClustersRQ, extractProjectDetails(rpUser, "test_project"), rpUser);
    verify(launchAccessValidator, times(1)).validate(any(Launch.class), any(ReportPortalUser.ProjectDetails.class), eq(rpUser));
    final ArgumentCaptor<GenerateClustersConfig> argumentCaptor = ArgumentCaptor.forClass(GenerateClustersConfig.class);
    verify(clusterGenerator, times(1)).generate(argumentCaptor.capture());
    final GenerateClustersConfig config = argumentCaptor.getValue();
    assertEquals(1L, config.getProject());
    assertEquals(1L, config.getLaunchId());
    assertEquals(createClustersRQ.isRemoveNumbers(), config.isCleanNumbers());
    assertFalse(config.isForUpdate());
    assertEquals(ProjectAttributeEnum.NUMBER_OF_LOG_LINES.getDefaultValue(), String.valueOf(config.getAnalyzerConfig().getNumberOfLogLines()));
}
Also used : Project(com.epam.ta.reportportal.entity.project.Project) TestProjectExtractor.extractProjectDetails(com.epam.ta.reportportal.util.TestProjectExtractor.extractProjectDetails) CreateClustersRQ(com.epam.ta.reportportal.ws.model.launch.cluster.CreateClustersRQ) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) LaunchTestUtil.getLaunch(com.epam.ta.reportportal.core.launch.impl.LaunchTestUtil.getLaunch) Launch(com.epam.ta.reportportal.entity.launch.Launch) GenerateClustersConfig(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig) Test(org.junit.jupiter.api.Test)

Example 7 with GenerateClustersConfig

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

the class ClusterGeneratorImplTest method shouldFailWhenCacheContainsLaunchId.

@Test
void shouldFailWhenCacheContainsLaunchId() {
    when(analyzerStatusCache.containsLaunchId(anyString(), anyLong())).thenReturn(true);
    final GenerateClustersConfig config = getConfig(false);
    final ReportPortalException exception = assertThrows(ReportPortalException.class, () -> clusterGenerator.generate(config));
    assertEquals("Impossible interact with integration. Clusters creation is in progress.", exception.getMessage());
}
Also used : ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) GenerateClustersConfig(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig) Test(org.junit.jupiter.api.Test)

Example 8 with GenerateClustersConfig

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

the class AnalyzerClusterDataProviderTest method shouldNotReturnDataWhenNoIndexLaunch.

@Test
void shouldNotReturnDataWhenNoIndexLaunch() {
    when(analyzerServiceClient.hasClients()).thenReturn(true);
    final GenerateClustersConfig config = getConfig(false);
    when(launchPreparerService.prepare(config.getLaunchId(), config.getAnalyzerConfig())).thenReturn(Optional.empty());
    final Optional<ClusterData> data = provider.provide(config);
    assertTrue(data.isEmpty());
}
Also used : ClusterData(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.ClusterData) GenerateClustersConfig(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.GenerateClustersConfig) Test(org.junit.jupiter.api.Test)

Example 9 with GenerateClustersConfig

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

the class SaveClusterDataPartProviderTest method shouldNotSaveWhenNoDataExists.

@Test
void shouldNotSaveWhenNoDataExists() {
    final GenerateClustersConfig config = getConfig(false);
    when(dataProvider.provide(config)).thenReturn(Optional.empty());
    final PipelinePart pipelinePart = provider.provide(config);
    pipelinePart.handle();
    verify(createClusterHandler, times(0)).create(any(ClusterData.class));
}
Also used : ClusterData(com.epam.ta.reportportal.core.analyzer.auto.client.model.cluster.ClusterData) 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 10 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 shouldSaveWhenNotExists.

@Test
void shouldSaveWhenNotExists() {
    final GenerateClustersConfig config = getConfig(false);
    when(itemAttributeRepository.findByLaunchIdAndKeyAndSystem(config.getLaunchId(), RP_CLUSTER_LAST_RUN_KEY, true)).thenReturn(Optional.empty());
    final PipelinePart pipelinePart = provider.provide(config);
    pipelinePart.handle();
    verify(itemAttributeRepository, times(1)).saveByLaunchId(eq(config.getLaunchId()), eq(RP_CLUSTER_LAST_RUN_KEY), anyString(), eq(true));
}
Also used : 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)

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