use of com.epam.ta.reportportal.ws.model.launch.cluster.CreateClustersRQ in project service-api by reportportal.
the class UpdateLaunchHandlerImplTest method createClustersLaunchInProgress.
@Test
void createClustersLaunchInProgress() {
final ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.CUSTOMER, 1L);
when(getLaunchHandler.getLaunch(1L)).thenReturn(getLaunch(StatusEnum.IN_PROGRESS, LaunchModeEnum.DEFAULT).get());
final CreateClustersRQ createClustersRQ = new CreateClustersRQ();
createClustersRQ.setLaunchId(1L);
createClustersRQ.setRemoveNumbers(false);
final ReportPortalException exception = assertThrows(ReportPortalException.class, () -> handler.createClusters(createClustersRQ, extractProjectDetails(rpUser, "test_project"), rpUser));
assertEquals("Incorrect Request. Cannot analyze launch in progress.", exception.getMessage());
verify(launchAccessValidator, times(1)).validate(any(Launch.class), any(ReportPortalUser.ProjectDetails.class), eq(rpUser));
}
use of com.epam.ta.reportportal.ws.model.launch.cluster.CreateClustersRQ 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()));
}
Aggregations