Package in.partake.model.dto

Examples of in.partake.model.dto.UserNotification


public class UserNotificationTestDataProvider extends TestDataProvider<UserNotification> {
    @Override
    public UserNotification create(long pkNumber, String pkSalt, int objNumber) {
        UUID uuid = new UUID(pkNumber, pkSalt.hashCode());
        return new UserNotification(uuid.toString(), new UUID(1, 0), "userId", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.SUCCESS, new DateTime(objNumber), null);
    }
View Full Code Here


    }

    @Override
    public List<UserNotification> createSamples() {
        List<UserNotification> array = new ArrayList<UserNotification>();
        array.add(new UserNotification(new UUID(0, 0).toString(), new UUID(1, 0), "userId", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.SUCCESS, new DateTime(0), null));
        array.add(new UserNotification(new UUID(0, 1).toString(), new UUID(1, 0), "userId", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.SUCCESS, new DateTime(0), null));
        array.add(new UserNotification(new UUID(0, 0).toString(), new UUID(1, 1), "userId", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.SUCCESS, new DateTime(0), null));
        array.add(new UserNotification(new UUID(0, 0).toString(), new UUID(1, 0), "userId1", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.SUCCESS, new DateTime(0), null));
        array.add(new UserNotification(new UUID(0, 0).toString(), new UUID(1, 0), "userId", NotificationType.BECAME_TO_BE_ENROLLED, MessageDelivery.SUCCESS, new DateTime(0), null));
        array.add(new UserNotification(new UUID(0, 0).toString(), new UUID(1, 0), "userId", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.FAIL, new DateTime(0), null));
        array.add(new UserNotification(new UUID(0, 0).toString(), new UUID(1, 0), "userId", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.SUCCESS, new DateTime(1), null));
        array.add(new UserNotification(new UUID(0, 0).toString(), new UUID(1, 0), "userId", NotificationType.BECAME_TO_BE_CANCELLED, MessageDelivery.SUCCESS, new DateTime(0), new DateTime(1)));
        return array;
    }
View Full Code Here

    public void createFixtures(PartakeConnection con, IPartakeDAOs daos) throws DAOException {
        IUserNotificationAccess dao = daos.getUserNotificationAccess();
        dao.truncate(con);

        dao.put(con, new UserNotification(USER_NOTIFICATION_INQUEUE_ID, DEFAULT_EVENT_TICKET_ID, DEFAULT_USER_ID, NotificationType.EVENT_ONEDAY_BEFORE_REMINDER, MessageDelivery.INQUEUE, new DateTime(0), null));
    }
View Full Code Here

        new EventReminderTask().run();

        // Check EventNotification and UserNotification.
        List<UserNotification> userNotifications = loadUserNotificationsByUserId(DEFAULT_USER_ID);
        assertThat(userNotifications.size(), is(1));
        UserNotification userNotification = userNotifications.get(0);
        assertThat(userNotification.getTicketId(), is(ticket.getId()));
        assertThat(userNotification.getDelivery(), is(MessageDelivery.INQUEUE));
        assertThat(userNotification.getNotificationType(), is(NotificationType.EVENT_ONEDAY_BEFORE_REMINDER));

        List<EventTicketNotification> eventNotifications = loadEventTicketNotificationsByEventId(ticketId);
        assertThat(eventNotifications.size(), is(3));

        // Re-run.
View Full Code Here

    // ----------------------------------------------------------------------

    @Test
    public void testToBuildUserNotificationMessageBodyForOnedayBeforeReminder() throws Exception{
        UserNotification notification = loadUserNotification(USER_NOTIFICATION_INQUEUE_ID);
        Event event = loadEvent(DEFAULT_EVENT_ID);
        EventTicket ticket = loadEventTicket(DEFAULT_EVENT_TICKET_ID);

        UserNotification userNotification = new UserNotification(notification);
        userNotification.setNotificationType(NotificationType.EVENT_ONEDAY_BEFORE_REMINDER);

        String messageBody = SendMessageEnvelopeTask.buildUserNotificationMessageBody(userNotification, event, ticket);
        String expected = String.format("[PRTK] 「title」は%sに開始です。あなたの参加は確定しています。 http://127.0.0.1:9000/events/00000000-0000-0002-0000-000000000000", Helper.readableDate(event.getBeginDate()));
        assertThat(messageBody, is(expected));
    }
View Full Code Here

        assertThat(messageBody, is(expected));
    }

    @Test
    public void testToBuildUserNotificationMessageBodyForOnedayBeforeReservationReminder() throws Exception{
        UserNotification notification = loadUserNotification(USER_NOTIFICATION_INQUEUE_ID);
        Event event = loadEvent(DEFAULT_EVENT_ID);
        EventTicket ticket = loadEventTicket(DEFAULT_EVENT_TICKET_ID);

        UserNotification userNotification = new UserNotification(notification);
        userNotification.setNotificationType(NotificationType.ONE_DAY_BEFORE_REMINDER_FOR_RESERVATION);

        String messageBody = SendMessageEnvelopeTask.buildUserNotificationMessageBody(userNotification, event, ticket);
        String expected = String.format("[PRTK] 「title」の締め切りは%sです。参加・不参加を確定してください。 http://127.0.0.1:9000/events/00000000-0000-0002-0000-000000000000", Helper.readableDate(event.getBeginDate()));
        assertThat(messageBody, is(expected));
    }
View Full Code Here

        assertThat(messageBody, is(expected));
    }

    @Test
    public void testToBuildUserNotificationMessageBodyForHalfdayBeforeReservationReminder() throws Exception{
        UserNotification notification = loadUserNotification(USER_NOTIFICATION_INQUEUE_ID);
        Event event = loadEvent(DEFAULT_EVENT_ID);
        EventTicket ticket = loadEventTicket(DEFAULT_EVENT_TICKET_ID);

        UserNotification userNotification = new UserNotification(notification);
        userNotification.setNotificationType(NotificationType.HALF_DAY_BEFORE_REMINDER_FOR_RESERVATION);

        String messageBody = SendMessageEnvelopeTask.buildUserNotificationMessageBody(userNotification, event, ticket);
        String expected = String.format("[PRTK] 「title」の締め切りは%sです。参加・不参加を確定してください。 http://127.0.0.1:9000/events/00000000-0000-0002-0000-000000000000", Helper.readableDate(event.getBeginDate()));
        assertThat(messageBody, is(expected));
    }
View Full Code Here

        assertThat(messageBody, is(expected));
    }

    @Test
    public void testToBuildUserNotificationMessageBodyForEnrolledReminder() throws Exception{
        UserNotification notification = loadUserNotification(USER_NOTIFICATION_INQUEUE_ID);
        Event event = loadEvent(DEFAULT_EVENT_ID);
        EventTicket ticket = loadEventTicket(DEFAULT_EVENT_TICKET_ID);

        UserNotification userNotification = new UserNotification(notification);
        userNotification.setNotificationType(NotificationType.BECAME_TO_BE_ENROLLED);

        String messageBody = SendMessageEnvelopeTask.buildUserNotificationMessageBody(userNotification, event, ticket);
        String expected = "[PRTK] 「title」で補欠から参加者へ繰り上がりました。 http://127.0.0.1:9000/events/00000000-0000-0002-0000-000000000000";
        assertThat(messageBody, is(expected));
    }
View Full Code Here

        assertThat(messageBody, is(expected));
    }

    @Test
    public void testToBuildUserNotificationMessageBodyForCancelledReminder() throws Exception{
        UserNotification notification = loadUserNotification(USER_NOTIFICATION_INQUEUE_ID);
        Event event = loadEvent(DEFAULT_EVENT_ID);
        EventTicket ticket = loadEventTicket(DEFAULT_EVENT_TICKET_ID);

        UserNotification userNotification = new UserNotification(notification);
        userNotification.setNotificationType(NotificationType.BECAME_TO_BE_CANCELLED);

        String messageBody = SendMessageEnvelopeTask.buildUserNotificationMessageBody(userNotification, event, ticket);
        String expected = "[PRTK] 「title」で参加者から補欠へ繰り下がりました。 http://127.0.0.1:9000/events/00000000-0000-0002-0000-000000000000";
        assertThat(messageBody, is(expected));
    }
View Full Code Here

                            daos.getTwitterMessageAccess().put(con, message);
                        }
                    }

                    if (envelope.getUserNotificationId() != null) {
                        UserNotification notification = daos.getUserNotificationAccess().find(con, envelope.getUserNotificationId());
                        if (notification != null) {
                            UserNotification message = new UserNotification(notification);
                            message.setDelivery(MessageDelivery.FAIL);
                            message.setModifiedAt(TimeUtil.getCurrentDateTime());
                            daos.getUserNotificationAccess().put(con, message);
                        }
                    }

                    it.remove();
View Full Code Here

TOP

Related Classes of in.partake.model.dto.UserNotification

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.