use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerImplTest method finishWithIncorrectStatus.
@Test
void finishWithIncorrectStatus() {
FinishExecutionRQ finishExecutionRQ = new FinishExecutionRQ();
finishExecutionRQ.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
final ReportPortalUser rpUser = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
when(launchRepository.findByUuid("1")).thenReturn(getLaunch(StatusEnum.PASSED, LaunchModeEnum.DEFAULT));
assertThrows(ReportPortalException.class, () -> handler.finishLaunch("1", finishExecutionRQ, extractProjectDetails(rpUser, "test_project"), rpUser, null));
}
use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerImplTest method bulkStopLaunch.
@Test
void bulkStopLaunch() {
FinishExecutionRQ finishExecutionRQ = new FinishExecutionRQ();
finishExecutionRQ.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
Map<Long, FinishExecutionRQ> entities = new HashMap<>();
entities.put(1L, finishExecutionRQ);
BulkRQ<Long, FinishExecutionRQ> bulkRq = new BulkRQ<>();
bulkRq.setEntities(entities);
ReportPortalUser rpUser = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
when(launchRepository.findById(1L)).thenReturn(getLaunch(StatusEnum.IN_PROGRESS, LaunchModeEnum.DEFAULT));
final List<OperationCompletionRS> response = stopLaunchHandler.stopLaunch(bulkRq, extractProjectDetails(rpUser, "test_project"), rpUser);
assertNotNull(response);
assertEquals(1, response.size());
}
use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerImplTest method finishLaunchWithLink.
@Test
void finishLaunchWithLink() {
FinishExecutionRQ finishExecutionRQ = new FinishExecutionRQ();
finishExecutionRQ.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
ReportPortalUser rpUser = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
when(launchRepository.findByUuid("1")).thenReturn(getLaunch(StatusEnum.IN_PROGRESS, LaunchModeEnum.DEFAULT));
final FinishLaunchRS finishLaunchRS = handler.finishLaunch("1", finishExecutionRQ, extractProjectDetails(rpUser, "test_project"), rpUser, "http://example.com");
verify(finishHierarchyHandler, times(1)).finishDescendants(any(), any(), any(), any(), any());
assertNotNull(finishLaunchRS);
assertEquals("http://example.com/ui/#test_project/launches/all/1", finishLaunchRS.getLink());
}
use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerImplTest method finishLaunch.
@Test
void finishLaunch() {
FinishExecutionRQ finishExecutionRQ = new FinishExecutionRQ();
finishExecutionRQ.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
ReportPortalUser rpUser = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
when(launchRepository.findByUuid("1")).thenReturn(getLaunch(StatusEnum.IN_PROGRESS, LaunchModeEnum.DEFAULT));
FinishLaunchRS response = handler.finishLaunch("1", finishExecutionRQ, extractProjectDetails(rpUser, "test_project"), rpUser, null);
verify(finishHierarchyHandler, times(1)).finishDescendants(any(), any(), any(), any(), any());
assertNotNull(response);
}
use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class LaunchValidatorTest method validate.
@Test
void validate() {
Launch launch = new Launch();
launch.setStatus(StatusEnum.IN_PROGRESS);
launch.setStartTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(1575551458336L), ZoneOffset.UTC));
FinishExecutionRQ finishExecutionRQ = new FinishExecutionRQ();
finishExecutionRQ.setEndTime(TO_DATE.apply(LocalDateTime.ofInstant(Instant.ofEpochMilli(1575551458334L), ZoneOffset.UTC)));
ReportPortalException reportPortalException = assertThrows(ReportPortalException.class, () -> LaunchValidator.validate(launch, finishExecutionRQ));
assertEquals(Suppliers.formattedSupplier(FINISH_TIME_EARLIER_THAN_START_TIME.getDescription(), TO_LOCAL_DATE_TIME.apply(finishExecutionRQ.getEndTime()), launch.getStartTime(), launch.getId()).get(), reportPortalException.getMessage());
}
Aggregations