use of com.epam.ta.reportportal.ws.model.launch.Mode.DEBUG in project service-api by reportportal.
the class LaunchControllerTest method bulkMoveToDebug.
@Test
void bulkMoveToDebug() throws Exception {
final List<Long> ids = launchRepository.findByFilter(Filter.builder().withTarget(Launch.class).withCondition(FilterCondition.builder().eq(CRITERIA_PROJECT_ID, String.valueOf(2L)).build()).build()).stream().filter(it -> it.getMode() == LaunchModeEnum.DEFAULT).map(Launch::getId).collect(Collectors.toList());
final Map<Long, UpdateLaunchRQ> entities = ids.stream().collect(toMap(it -> it, it -> {
final UpdateLaunchRQ updateLaunchRQ = new UpdateLaunchRQ();
updateLaunchRQ.setMode(DEBUG);
return updateLaunchRQ;
}));
final BulkRQ<Long, UpdateLaunchRQ> bulkRQ = new BulkRQ<>();
bulkRQ.setEntities(entities);
mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/launch/update").with(token(oAuthHelper.getDefaultToken())).content(objectMapper.writeValueAsBytes(bulkRQ)).contentType(APPLICATION_JSON)).andExpect(status().is(200));
launchRepository.findAllById(ids).forEach(it -> assertSame(it.getMode(), LaunchModeEnum.DEBUG));
}
Aggregations