Search in sources :

Example 1 with FinishExecutionRQ

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());
}
Also used : ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) FinishExecutionRQ(com.epam.ta.reportportal.ws.model.FinishExecutionRQ) OperationCompletionRS(com.epam.ta.reportportal.ws.model.OperationCompletionRS) Test(org.junit.jupiter.api.Test)

Example 2 with FinishExecutionRQ

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());
}
Also used : ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) FinishExecutionRQ(com.epam.ta.reportportal.ws.model.FinishExecutionRQ) Test(org.junit.jupiter.api.Test)

Example 3 with FinishExecutionRQ

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));
}
Also used : ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) FinishExecutionRQ(com.epam.ta.reportportal.ws.model.FinishExecutionRQ) Test(org.junit.jupiter.api.Test)

Example 4 with FinishExecutionRQ

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);
    }
}
Also used : FinishExecutionRQ(com.epam.ta.reportportal.ws.model.FinishExecutionRQ)

Example 5 with FinishExecutionRQ

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());
}
Also used : ReportPortalUser(com.epam.ta.reportportal.commons.ReportPortalUser) FinishExecutionRQ(com.epam.ta.reportportal.ws.model.FinishExecutionRQ) Test(org.junit.jupiter.api.Test)

Aggregations

FinishExecutionRQ (com.epam.ta.reportportal.ws.model.FinishExecutionRQ)15 Test (org.junit.jupiter.api.Test)13 ReportPortalUser (com.epam.ta.reportportal.commons.ReportPortalUser)9 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)3 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)3 Launch (com.epam.ta.reportportal.entity.launch.Launch)2 BulkRQ (com.epam.ta.reportportal.ws.model.BulkRQ)2 OperationCompletionRS (com.epam.ta.reportportal.ws.model.OperationCompletionRS)2 FinishLaunchRS (com.epam.ta.reportportal.ws.model.launch.FinishLaunchRS)2 DeleteBulkRQ (com.epam.ta.reportportal.ws.model.DeleteBulkRQ)1 HashMap (java.util.HashMap)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1