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()));
}
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());
}
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());
}
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));
}
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));
}
Aggregations