use of com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO in project service-api by reportportal.
the class NotificationConfigConverterTest method getCaseDTO.
private static SenderCaseDTO getCaseDTO() {
SenderCaseDTO senderCaseDTO = new SenderCaseDTO();
senderCaseDTO.setRecipients(Arrays.asList("recipient1", "recipient2"));
senderCaseDTO.setLaunchNames(Arrays.asList("launch1", "launch2"));
final ItemAttributeResource launchAttribute = new ItemAttributeResource();
launchAttribute.setKey("key");
launchAttribute.setValue("val");
senderCaseDTO.setAttributes(Sets.newHashSet(launchAttribute));
senderCaseDTO.setSendCase("always");
senderCaseDTO.setEnabled(true);
return senderCaseDTO;
}
use of com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO in project service-api by reportportal.
the class NotificationConfigConverterTest method toCaseResource.
@Test
void toCaseResource() {
final SenderCase senderCase = getCase();
final SenderCaseDTO senderCaseDTO = NotificationConfigConverter.TO_CASE_RESOURCE.apply(senderCase);
assertThat(senderCaseDTO.getRecipients()).containsExactlyInAnyOrderElementsOf(senderCase.getRecipients());
// assertThat(senderCaseDTO.getAttributes()).containsExactlyInAnyOrderElementsOf(senderCase.getLaunchAttributeRules());
assertThat(senderCaseDTO.getLaunchNames()).containsExactlyInAnyOrderElementsOf(senderCase.getLaunchNames());
assertEquals(senderCaseDTO.getSendCase(), senderCase.getSendCase().getCaseString());
}
use of com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO in project service-api by reportportal.
the class ProjectControllerTest method updateProjectNotificationConfig.
@Test
void updateProjectNotificationConfig() throws Exception {
ProjectNotificationConfigDTO request = new ProjectNotificationConfigDTO();
SenderCaseDTO senderCaseDTO = new SenderCaseDTO();
senderCaseDTO.setSendCase("always");
senderCaseDTO.setRecipients(Collections.singletonList("default"));
senderCaseDTO.setLaunchNames(Collections.singletonList("test launch"));
senderCaseDTO.setEnabled(true);
ItemAttributeResource launchAttribute = new ItemAttributeResource();
launchAttribute.setKey("key");
launchAttribute.setValue("val");
senderCaseDTO.setAttributes(Sets.newHashSet(launchAttribute));
request.setSenderCases(singletonList(senderCaseDTO));
mockMvc.perform(put("/v1/project/default_personal/notification").with(token(oAuthHelper.getDefaultToken())).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(request))).andExpect(status().isOk());
}
use of com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO in project service-api by reportportal.
the class NotificationConfigConverterTest method toCaseModel.
@Test
void toCaseModel() {
final SenderCaseDTO caseDTO = getCaseDTO();
final SenderCase senderCase = NotificationConfigConverter.TO_CASE_MODEL.apply(caseDTO);
assertThat(senderCase.getRecipients()).containsExactlyInAnyOrderElementsOf(caseDTO.getRecipients());
assertThat(senderCase.getLaunchNames()).containsExactlyInAnyOrderElementsOf(caseDTO.getLaunchNames());
// assertThat(senderCase.getLaunchAttributes()).containsExactlyInAnyOrderElementsOf(caseDTO.getAttributes());
assertEquals(senderCase.getSendCase().getCaseString(), caseDTO.getSendCase());
assertEquals(senderCase.isEnabled(), caseDTO.isEnabled());
}
Aggregations