use of com.epam.ta.reportportal.ws.model.attribute.UpdateItemAttributeRQ in project service-api by reportportal.
the class LaunchControllerTest method bulkCreateAttributes.
@Test
void bulkCreateAttributes() throws Exception {
BulkInfoUpdateRQ request = new BulkInfoUpdateRQ();
List<Long> launchIds = Arrays.asList(1L, 2L, 3L, 4L);
request.setIds(launchIds);
BulkInfoUpdateRQ.Description description = new BulkInfoUpdateRQ.Description();
description.setAction(BulkInfoUpdateRQ.Action.UPDATE);
String comment = "updated";
description.setComment(comment);
request.setDescription(description);
UpdateItemAttributeRQ updateItemAttributeRQ = new UpdateItemAttributeRQ();
updateItemAttributeRQ.setAction(BulkInfoUpdateRQ.Action.CREATE);
updateItemAttributeRQ.setTo(new ItemAttributeResource("createdKey", "createdValue"));
request.setAttributes(Lists.newArrayList(updateItemAttributeRQ));
mockMvc.perform(put(DEFAULT_PROJECT_BASE_URL + "/launch/info").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
List<Launch> launches = launchRepository.findAllById(launchIds);
launches.forEach(it -> launchRepository.refresh(it));
launches.forEach(it -> {
assertTrue(it.getAttributes().stream().anyMatch(attr -> "createdKey".equals(attr.getKey()) && attr.getValue().equals("createdValue") && !attr.isSystem()));
assertTrue(it.getDescription().length() > comment.length() && it.getDescription().contains(comment));
});
}
Aggregations