Search in sources :

Example 1 with NotificationTO

use of org.apache.syncope.common.lib.to.NotificationTO in project syncope by apache.

the class NotificationITCase method issueSYNCOPE974.

@Test
public void issueSYNCOPE974() {
    NotificationTO notificationTO = new NotificationTO();
    notificationTO.setRecipientAttrName("email");
    notificationTO.setSelfAsRecipient(false);
    notificationTO.setSender("sender@ukr.net");
    notificationTO.setSubject("subject 21");
    notificationTO.setTemplate("requestPasswordReset");
    notificationTO.setTraceLevel(TraceLevel.ALL);
    notificationTO.setActive(true);
    try {
        notificationService.create(notificationTO);
        fail("This should not happen");
    } catch (SyncopeClientException e) {
        assertEquals(ClientExceptionType.RequiredValuesMissing, e.getType());
        assertTrue(e.getMessage().contains("events"));
    }
}
Also used : NotificationTO(org.apache.syncope.common.lib.to.NotificationTO) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) Test(org.junit.jupiter.api.Test)

Example 2 with NotificationTO

use of org.apache.syncope.common.lib.to.NotificationTO in project syncope by apache.

the class NotificationITCase method issueSYNCOPE83.

@Test
public void issueSYNCOPE83() {
    NotificationTO notificationTO = buildNotificationTO();
    notificationTO.setSelfAsRecipient(true);
    NotificationTO actual = null;
    try {
        Response response = notificationService.create(notificationTO);
        actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
    } catch (SyncopeClientException e) {
        assertNotNull(e);
    }
    assertNotNull(actual);
    assertNotNull(actual.getKey());
    notificationTO.setKey(actual.getKey());
    assertEquals(actual, notificationTO);
}
Also used : Response(javax.ws.rs.core.Response) NotificationTO(org.apache.syncope.common.lib.to.NotificationTO) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) NotificationService(org.apache.syncope.common.rest.api.service.NotificationService) Test(org.junit.jupiter.api.Test)

Example 3 with NotificationTO

use of org.apache.syncope.common.lib.to.NotificationTO in project syncope by apache.

the class NotificationITCase method issueSYNCOPE445.

@Test
public void issueSYNCOPE445() {
    NotificationTO notificationTO = buildNotificationTO();
    notificationTO.getStaticRecipients().add("syncope445@syncope.apache.org");
    NotificationTO actual = null;
    try {
        Response response = notificationService.create(notificationTO);
        actual = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
    } catch (SyncopeClientException e) {
        assertNotNull(e);
    }
    assertNotNull(actual);
    assertNotNull(actual.getKey());
    notificationTO.setKey(actual.getKey());
    assertEquals(actual, notificationTO);
}
Also used : Response(javax.ws.rs.core.Response) NotificationTO(org.apache.syncope.common.lib.to.NotificationTO) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) NotificationService(org.apache.syncope.common.rest.api.service.NotificationService) Test(org.junit.jupiter.api.Test)

Example 4 with NotificationTO

use of org.apache.syncope.common.lib.to.NotificationTO in project syncope by apache.

the class NotificationITCase method delete.

@Test
public void delete() {
    NotificationTO notification = buildNotificationTO();
    notification.setSelfAsRecipient(true);
    Response response = notificationService.create(notification);
    notification = getObject(response.getLocation(), NotificationService.class, NotificationTO.class);
    notificationService.delete(notification.getKey());
    try {
        notificationService.read(notification.getKey());
        fail("This should not happen");
    } catch (SyncopeClientException e) {
        assertEquals(ClientExceptionType.NotFound, e.getType());
    }
}
Also used : Response(javax.ws.rs.core.Response) NotificationTO(org.apache.syncope.common.lib.to.NotificationTO) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) NotificationService(org.apache.syncope.common.rest.api.service.NotificationService) Test(org.junit.jupiter.api.Test)

Example 5 with NotificationTO

use of org.apache.syncope.common.lib.to.NotificationTO in project syncope by apache.

the class NotificationITCase method buildNotificationTO.

private NotificationTO buildNotificationTO() {
    NotificationTO notificationTO = new NotificationTO();
    notificationTO.setTraceLevel(TraceLevel.SUMMARY);
    notificationTO.getEvents().add("create");
    notificationTO.getAbouts().put(AnyTypeKind.USER.name(), SyncopeClient.getUserSearchConditionBuilder().is("fullname").equalTo("*o*").and("fullname").equalTo("*i*").query());
    notificationTO.setRecipientAttrName("email");
    notificationTO.setSender("syncope@syncope.apache.org");
    notificationTO.setSubject("Test notification");
    notificationTO.setTemplate("test");
    return notificationTO;
}
Also used : NotificationTO(org.apache.syncope.common.lib.to.NotificationTO)

Aggregations

NotificationTO (org.apache.syncope.common.lib.to.NotificationTO)17 Test (org.junit.jupiter.api.Test)11 Response (javax.ws.rs.core.Response)8 NotificationService (org.apache.syncope.common.rest.api.service.NotificationService)7 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)6 NotificationTaskTO (org.apache.syncope.common.lib.to.NotificationTaskTO)2 Notification (org.apache.syncope.core.persistence.api.entity.Notification)2 URI (java.net.URI)1 ParseException (java.text.ParseException)1 Matcher (java.util.regex.Matcher)1 StringUtils (org.apache.commons.lang3.StringUtils)1 SyncopeConstants (org.apache.syncope.common.lib.SyncopeConstants)1 GroupTO (org.apache.syncope.common.lib.to.GroupTO)1 ImplementationTO (org.apache.syncope.common.lib.to.ImplementationTO)1 MembershipTO (org.apache.syncope.common.lib.to.MembershipTO)1 PushTaskTO (org.apache.syncope.common.lib.to.PushTaskTO)1 UserTO (org.apache.syncope.common.lib.to.UserTO)1 AnyTypeKind (org.apache.syncope.common.lib.types.AnyTypeKind)1 ClientExceptionType (org.apache.syncope.common.lib.types.ClientExceptionType)1 TaskQuery (org.apache.syncope.common.rest.api.beans.TaskQuery)1