Examples of NotificationTO


Examples of org.apache.syncope.common.to.NotificationTO

        }
    }

    @Test
    public void issueSYNCOPE83() {
        NotificationTO notificationTO = buildNotificationTO();
        notificationTO.setSelfAsRecipient(true);

        NotificationTO actual = null;
        SyncopeClientException exception = null;
        try {
            Response response = notificationService.create(notificationTO);
            actual = getObject(response, NotificationTO.class, notificationService);
        } catch (SyncopeClientCompositeErrorException e) {
            exception = e.getException(SyncopeClientExceptionType.InvalidNotification);
        }
        assertNull(exception);
        assertNotNull(actual);
        assertNotNull(actual.getId());
        notificationTO.setId(actual.getId());
        assertEquals(actual, notificationTO);
    }
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

        notificationTO.setId(actual.getId());
        assertEquals(actual, notificationTO);
    }

    private NotificationTO buildNotificationTO() {
        NotificationTO notificationTO = new NotificationTO();
        notificationTO.setTraceLevel(TraceLevel.SUMMARY);
        notificationTO.addEvent("create");

        AttributeCond fullnameLeafCond1 = new AttributeCond(AttributeCond.Type.LIKE);
        fullnameLeafCond1.setSchema("fullname");
        fullnameLeafCond1.setExpression("%o%");
        AttributeCond fullnameLeafCond2 = new AttributeCond(AttributeCond.Type.LIKE);
        fullnameLeafCond2.setSchema("fullname");
        fullnameLeafCond2.setExpression("%i%");
        NodeCond about = NodeCond.getAndCond(NodeCond.getLeafCond(fullnameLeafCond1),
                NodeCond.getLeafCond(fullnameLeafCond2));

        notificationTO.setAbout(about);

        notificationTO.setRecipientAttrName("email");
        notificationTO.setRecipientAttrType(IntMappingType.UserSchema);

        notificationTO.setSender("syncope@syncope.apache.org");
        notificationTO.setSubject("Test notification");
        notificationTO.setTemplate("test");
        return notificationTO;
    }
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

public class NotificationDataBinder {

    private static final String[] IGNORE_PROPERTIES = {"id", "about", "recipients"};

    public NotificationTO getNotificationTO(final Notification notification) {
        NotificationTO result = new NotificationTO();

        BeanUtils.copyProperties(notification, result, IGNORE_PROPERTIES);

        result.setId(notification.getId());
        result.setAbout(notification.getAbout());
        result.setRecipients(notification.getRecipients());

        return result;
    }
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

        return notificationTOs;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/create")
    public NotificationTO create(final HttpServletResponse response, @RequestBody final NotificationTO notificationTO) {
        NotificationTO savedNotificationTO = createInternal(notificationTO);
        response.setStatus(HttpServletResponse.SC_CREATED);
        return savedNotificationTO;
    }
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

            LOG.error("Could not find notificatin '" + notificationId + "'");

            throw new NotFoundException(String.valueOf(notificationId));
        }

        NotificationTO notificationToDelete = binder.getNotificationTO(notification);

        auditManager.audit(Category.notification, NotificationSubCategory.delete, Result.success,
                "Successfully deleted notification: " + notification.getId());

        notificationDAO.delete(notificationId);
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

        super(baseUrl, restTemplate);
    }

    @Override
    public Response create(final NotificationTO notificationTO) {
        NotificationTO notification = getRestTemplate().postForObject(baseUrl + "notification/create.json",
                notificationTO, NotificationTO.class);
        URI location = URI.create(baseUrl + "notification/read/" + notification.getId() + ".json");
        return Response.created(location).header(SyncopeConstants.REST_HEADER_ID, notification.getId()).build();
    }
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

        return taskTO;
    }

    private String createNotificationTask() {
        // 1. Create notification
        NotificationTO notification = new NotificationTO();
        notification.setTraceLevel(TraceLevel.FAILURES);
        notification.addEvent("[REST]:[UserController]:[]:[create]:[SUCCESS]");
        notification.addEvent("[REST]:[UserController]:[]:[createInternal]:[SUCCESS]");

        MembershipCond membCond = new MembershipCond();
        membCond.setRoleId(7L);
        notification.setAbout(NodeCond.getLeafCond(membCond));

        membCond = new MembershipCond();
        membCond.setRoleId(8L);
        notification.setRecipients(NodeCond.getLeafCond(membCond));
        notification.setSelfAsRecipient(true);

        notification.setRecipientAttrName("email");
        notification.setRecipientAttrType(IntMappingType.UserSchema);

        String sender = "syncope86@syncope.apache.org";
        notification.setSender(sender);
        String subject = "Test notification SYNCOPE-86";
        notification.setSubject(subject);
        notification.setTemplate("optin");

        Response response = notificationService.create(notification);
        notification = getObject(response, NotificationTO.class, notificationService);
        assertNotNull(notification);
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

@FixMethodOrder(MethodSorters.JVM)
public class NotificationTestITCase extends AbstractTest {

    @Test
    public void read() {
        NotificationTO notificationTO = notificationService.read(1L);
        assertNotNull(notificationTO);
    }
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

        }
    }

    @Test
    public void create() {
        NotificationTO notificationTO = buildNotificationTO();

        MembershipCond membCond = new MembershipCond();
        membCond.setRoleId(7L);
        NodeCond recipients = NodeCond.getLeafCond(membCond);
        notificationTO.setRecipients(recipients);

        Response response = notificationService.create(notificationTO);
        NotificationTO actual = getObject(response, NotificationTO.class, notificationService);

        assertNotNull(actual);
        assertNotNull(actual.getId());
        notificationTO.setId(actual.getId());
        assertEquals(actual, notificationTO);
    }
View Full Code Here

Examples of org.apache.syncope.common.to.NotificationTO

        assertEquals(actual, notificationTO);
    }

    @Test
    public void update() {
        NotificationTO notificationTO = notificationService.read(1L);
        assertNotNull(notificationTO);

        notificationTO.setRecipients(NodeCond.getLeafCond(new MembershipCond()));

        SyncopeClientException exception = null;
        try {
            notificationService.update(notificationTO.getId(), notificationTO);
        } catch (SyncopeClientCompositeErrorException e) {
            exception = e.getException(SyncopeClientExceptionType.InvalidNotification);
        }
        assertNotNull(exception);

        MembershipCond membCond = new MembershipCond();
        membCond.setRoleId(7L);
        NodeCond recipients = NodeCond.getLeafCond(membCond);

        notificationTO.setRecipients(recipients);

        notificationService.update(notificationTO.getId(), notificationTO);
        NotificationTO actual = notificationService.read(notificationTO.getId());
        assertNotNull(actual);
        assertEquals(actual, notificationTO);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.