Search in sources :

Example 1 with SenderCaseDTO

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;
}
Also used : ItemAttributeResource(com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource) SenderCaseDTO(com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO)

Example 2 with 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());
}
Also used : SenderCase(com.epam.ta.reportportal.entity.project.email.SenderCase) SenderCaseDTO(com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO) Test(org.junit.jupiter.api.Test)

Example 3 with SenderCaseDTO

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());
}
Also used : ItemAttributeResource(com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource) ProjectNotificationConfigDTO(com.epam.ta.reportportal.ws.model.project.email.ProjectNotificationConfigDTO) SenderCaseDTO(com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO) BaseMvcTest(com.epam.ta.reportportal.ws.BaseMvcTest) Test(org.junit.jupiter.api.Test)

Example 4 with SenderCaseDTO

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());
}
Also used : SenderCase(com.epam.ta.reportportal.entity.project.email.SenderCase) SenderCaseDTO(com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO) Test(org.junit.jupiter.api.Test)

Aggregations

SenderCaseDTO (com.epam.ta.reportportal.ws.model.project.email.SenderCaseDTO)4 Test (org.junit.jupiter.api.Test)3 SenderCase (com.epam.ta.reportportal.entity.project.email.SenderCase)2 ItemAttributeResource (com.epam.ta.reportportal.ws.model.attribute.ItemAttributeResource)2 BaseMvcTest (com.epam.ta.reportportal.ws.BaseMvcTest)1 ProjectNotificationConfigDTO (com.epam.ta.reportportal.ws.model.project.email.ProjectNotificationConfigDTO)1