use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerImplTest method stopLaunch.
@Test
void stopLaunch() {
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.findById(1L)).thenReturn(getLaunch(StatusEnum.IN_PROGRESS, LaunchModeEnum.DEFAULT));
final OperationCompletionRS response = stopLaunchHandler.stopLaunch(1L, finishExecutionRQ, extractProjectDetails(rpUser, "test_project"), rpUser);
assertNotNull(response);
assertEquals("Launch with ID = '1' successfully stopped.", response.getResultMessage());
}
use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerImplTest method finishNotOwnLaunch.
@Test
void finishNotOwnLaunch() {
FinishExecutionRQ finishExecutionRQ = new FinishExecutionRQ();
finishExecutionRQ.setEndTime(Date.from(LocalDateTime.now().atZone(ZoneId.of("UTC")).toInstant()));
final ReportPortalUser rpUser = getRpUser("not owner", UserRole.USER, ProjectRole.MEMBER, 1L);
rpUser.setUserId(2L);
when(launchRepository.findByUuid("1")).thenReturn(getLaunch(StatusEnum.IN_PROGRESS, LaunchModeEnum.DEFAULT));
final ReportPortalException exception = assertThrows(ReportPortalException.class, () -> handler.finishLaunch("1", finishExecutionRQ, extractProjectDetails(rpUser, "test_project"), rpUser, null));
assertEquals("You do not have enough permissions. You are not launch owner.", exception.getMessage());
}
use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerImplTest method finishWithIncorrectEndTime.
@Test
void finishWithIncorrectEndTime() {
FinishExecutionRQ finishExecutionRQ = new FinishExecutionRQ();
finishExecutionRQ.setEndTime(Date.from(LocalDateTime.now().minusHours(5).atZone(ZoneId.of("UTC")).toInstant()));
final ReportPortalUser rpUser = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
when(launchRepository.findByUuid("1")).thenReturn(getLaunch(StatusEnum.IN_PROGRESS, 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 agent-java-soapui by reportportal.
the class StepBasedSoapUIServiceImpl method finishLaunch.
public void finishLaunch() {
if (null != launch) {
FinishExecutionRQ rq = new FinishExecutionRQ();
rq.setEndTime(Calendar.getInstance().getTime());
if (context.isTestCanceled()) {
rq.setStatus(TestStatus.FAILED.getResult());
} else {
rq.setStatus(context.isLaunchFailed() ? TestStatus.FAILED.getResult() : TestStatus.FINISHED.getResult());
}
this.launch.finish(rq);
}
}
use of com.epam.ta.reportportal.ws.model.FinishExecutionRQ in project service-api by reportportal.
the class FinishLaunchHandlerAsyncImplTest method finishLaunch.
@Test
void finishLaunch() {
FinishExecutionRQ request = new FinishExecutionRQ();
ReportPortalUser user = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
finishLaunchHandlerAsync.finishLaunch("0", request, user.getProjectDetails().get("test_project"), user, "http://base");
verify(amqpTemplate).convertAndSend(any(), any(), any(), any());
verify(reportingQueueService).getReportingQueueKey(any());
}
Aggregations