use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project seleniumRobot by bhecquet.
the class ReportPortalService method getLaunchOverriddenProperties.
private static Supplier<Launch> getLaunchOverriddenProperties() {
ListenerParameters parameters = new ListenerParameters(PropertiesLoader.load());
parameters.setCallbackReportingEnabled(true);
ReportPortal reportPortal = ReportPortal.builder().withParameters(parameters).build();
StartLaunchRQ rq = buildStartLaunch(reportPortal.getParameters());
rpLaunch = reportPortal.newLaunch(rq);
return () -> rpLaunch;
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class StartLaunchHandlerImplTest method startLaunch.
@Test
void startLaunch() {
final ReportPortalUser rpUser = getRpUser("test", UserRole.ADMINISTRATOR, ProjectRole.PROJECT_MANAGER, 1L);
StartLaunchRQ startLaunchRQ = new StartLaunchRQ();
startLaunchRQ.setStartTime(new Date());
startLaunchRQ.setName("test");
Launch launch = new Launch();
launch.setId(1L);
when(launchRepository.save(any(Launch.class))).then(a -> {
Launch l = a.getArgument(0);
l.setId(1L);
return l;
}).thenReturn(launch);
final StartLaunchRS startLaunchRS = startLaunchHandlerImpl.startLaunch(rpUser, extractProjectDetails(rpUser, "test_project"), startLaunchRQ);
verify(launchRepository, times(1)).refresh(any(Launch.class));
verify(eventPublisher, times(1)).publishEvent(any());
assertNotNull(startLaunchRS);
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class StartLaunchHandlerImplTest method accessDeniedForCustomerRoleAndDebugMode.
@Test
void accessDeniedForCustomerRoleAndDebugMode() {
final ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.CUSTOMER, 1L);
StartLaunchRQ startLaunchRQ = new StartLaunchRQ();
startLaunchRQ.setStartTime(new Date());
startLaunchRQ.setMode(Mode.DEBUG);
final ReportPortalException exception = assertThrows(ReportPortalException.class, () -> startLaunchHandlerImpl.startLaunch(rpUser, extractProjectDetails(rpUser, "test_project"), startLaunchRQ));
assertEquals("Forbidden operation.", exception.getMessage());
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class RerunHandlerImplTest method exceptionWhenLaunchIsNotStoredInDbByName.
@Test
void exceptionWhenLaunchIsNotStoredInDbByName() {
StartLaunchRQ request = new StartLaunchRQ();
String launchName = "launch";
long projectId = 1L;
request.setRerun(true);
request.setName(launchName);
ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.PROJECT_MANAGER, projectId);
when(launchRepository.findLatestByNameAndProjectId(launchName, projectId)).thenReturn(Optional.empty());
ReportPortalException exception = assertThrows(ReportPortalException.class, () -> rerunHandler.handleLaunch(request, projectId, rpUser));
assertEquals("Launch 'launch' not found. Did you use correct Launch ID?", exception.getMessage());
}
use of com.epam.ta.reportportal.ws.model.launch.StartLaunchRQ in project service-api by reportportal.
the class RerunHandlerImplTest method happyRerunLaunch.
@Test
void happyRerunLaunch() {
StartLaunchRQ request = new StartLaunchRQ();
String launchName = "launch";
long projectId = 1L;
request.setRerun(true);
request.setName(launchName);
request.setMode(Mode.DEFAULT);
request.setDescription("desc");
request.setAttributes(Sets.newHashSet(new ItemAttributesRQ("test", "test")));
ReportPortalUser rpUser = getRpUser("test", UserRole.USER, ProjectRole.PROJECT_MANAGER, projectId);
when(launchRepository.findLatestByNameAndProjectId("launch", projectId)).thenReturn(Optional.of(getLaunch("uuid")));
final Launch launch = rerunHandler.handleLaunch(request, projectId, rpUser);
assertNotNull(launch.getNumber());
assertNotNull(launch.getId());
}
Aggregations