Package org.apache.syncope.core.persistence.beans

Examples of org.apache.syncope.core.persistence.beans.Notification


    }

    @Test
    public void notifyByMail() {
        // 1. create suitable notification for subsequent tests
        Notification notification = new Notification();
        notification.addEvent("create");

        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);

        Random random = new Random(System.currentTimeMillis());
        String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org";
        notification.setSender(sender);
        String subject = "Test notification " + random.nextLong();
        notification.setSubject(subject);
        notification.setTemplate("optin");

        Notification actual = notificationDAO.save(notification);
        assertNotNull(actual);

        notificationDAO.flush();

        // 2. use test SMTP server
View Full Code Here


        return result;
    }

    public Notification createNotification(final NotificationTO notificationTO) {
        Notification result = new Notification();

        updateNotification(result, notificationTO);

        return result;
    }
View Full Code Here

    private NotificationDataBinder binder;

    @PreAuthorize("hasRole('NOTIFICATION_READ')")
    @RequestMapping(method = RequestMethod.GET, value = "/read/{notificationId}")
    public NotificationTO read(@PathVariable("notificationId") final Long notificationId) {
        Notification notification = notificationDAO.find(notificationId);
        if (notification == null) {
            LOG.error("Could not find notification '" + notificationId + "'");

            throw new NotFoundException(String.valueOf(notificationId));
        }
View Full Code Here

    }

    @PreAuthorize("hasRole('NOTIFICATION_CREATE')")
    public NotificationTO createInternal(final NotificationTO notificationTO) {
        LOG.debug("Notification create called with parameter {}", notificationTO);
        Notification notification = notificationDAO.save(binder.createNotification(notificationTO));
        auditManager.audit(Category.notification, NotificationSubCategory.create, Result.success,
                "Successfully created notification: " + notification.getId());
        return binder.getNotificationTO(notification);
    }
View Full Code Here

    @PreAuthorize("hasRole('NOTIFICATION_UPDATE')")
    @RequestMapping(method = RequestMethod.POST, value = "/update")
    public NotificationTO update(@RequestBody final NotificationTO notificationTO) {
        LOG.debug("ConnNotificationtor update called with parameter {}", notificationTO);

        Notification notification = notificationDAO.find(notificationTO.getId());
        if (notification == null) {
            LOG.error("Could not find notification '" + notificationTO.getId() + "'");

            throw new NotFoundException(String.valueOf(notificationTO.getId()));
        }

        binder.updateNotification(notification, notificationTO);
        notification = notificationDAO.save(notification);

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

        return binder.getNotificationTO(notification);
    }
View Full Code Here

    }

    @PreAuthorize("hasRole('CONNECTOR_DELETE')")
    @RequestMapping(method = RequestMethod.GET, value = "/delete/{notificationId}")
    public NotificationTO delete(@PathVariable("notificationId") final Long notificationId) {
        Notification notification = notificationDAO.find(notificationId);
        if (notification == null) {
            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);

        return notificationToDelete;
    }
View Full Code Here

    }

    @Test
    public void notifyByMail() throws Exception {
        // 1. create suitable notification for subsequent tests
        Notification notification = new Notification();
        notification.addEvent("[REST]:[UserController]:[]:[create]:[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);

        Random random = new Random(System.currentTimeMillis());
        String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org";
        notification.setSender(sender);
        String subject = "Test notification " + random.nextLong();
        notification.setSubject(subject);
        notification.setTemplate("optin");

        Notification actual = notificationDAO.save(notification);
        assertNotNull(actual);

        notificationDAO.flush();

        // 2. create user
View Full Code Here

    }

    @Test
    public void issueSYNCOPE192() throws Exception {
        // 1. create suitable notification for subsequent tests
        Notification notification = new Notification();
        notification.addEvent("[REST]:[UserController]:[]:[create]:[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);

        Random random = new Random(System.currentTimeMillis());
        String sender = "syncope192-" + random.nextLong() + "@syncope.apache.org";
        notification.setSender(sender);
        String subject = "Test notification " + random.nextLong();
        notification.setSubject(subject);
        notification.setTemplate("optin");
        notification.setTraceLevel(TraceLevel.NONE);

        Notification actual = notificationDAO.save(notification);
        assertNotNull(actual);

        // 2. create user
        UserTO userTO = UserTestITCase.getSampleTO(mailAddress);
        MembershipTO membershipTO = new MembershipTO();
View Full Code Here

    }

    @Test
    public void notifyByMailEmptyAbout() throws Exception {
        // 1. create suitable notification for subsequent tests
        Notification notification = new Notification();
        notification.addEvent("[REST]:[UserController]:[]:[create]:[SUCCESS]");

        notification.setAbout(null);

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

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

        Random random = new Random(System.currentTimeMillis());
        String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org";
        notification.setSender(sender);
        String subject = "Test notification " + random.nextLong();
        notification.setSubject(subject);
        notification.setTemplate("optin");

        Notification actual = notificationDAO.save(notification);
        assertNotNull(actual);

        notificationDAO.flush();

        // 2. create user
View Full Code Here

    }

    @Test
    public void notifyByMailWithRetry() throws Exception {
        // 1. create suitable notification for subsequent tests
        Notification notification = new Notification();
        notification.addEvent("[REST]:[UserController]:[]:[create]:[SUCCESS]");

        notification.setAbout(null);

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

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

        Random random = new Random(System.currentTimeMillis());
        String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org";
        notification.setSender(sender);
        String subject = "Test notification " + random.nextLong();
        notification.setSubject(subject);
        notification.setTemplate("optin");

        Notification actual = notificationDAO.save(notification);
        assertNotNull(actual);

        notificationDAO.flush();

        // 2. create user
View Full Code Here

TOP

Related Classes of org.apache.syncope.core.persistence.beans.Notification

Copyright © 2018 www.massapicom. 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.