Package com.saasovation.common.event

Examples of com.saasovation.common.event.EventStore


        assertTrue(log.hasPreviousNotificationLog());
        assertFalse(log.isArchived());
    }

    public void testFirstNotificationLogFromFactory() throws Exception {
        EventStore eventStore = this.eventStore();
        NotificationLogId id = NotificationLogId.first(NotificationLogFactory.notificationsPerLog());
        NotificationLogFactory factory = new NotificationLogFactory(eventStore);
        NotificationLog log = factory.createNotificationLog(id);

        assertEquals(NotificationLogFactory.notificationsPerLog(), log.totalNotifications());
        assertTrue(eventStore.countStoredEvents() >= log.totalNotifications());
        assertTrue(log.hasNextNotificationLog());
        assertFalse(log.hasPreviousNotificationLog());
        assertTrue(log.isArchived());
    }
View Full Code Here


        assertFalse(log.hasPreviousNotificationLog());
        assertTrue(log.isArchived());
    }

    public void testPreviousOfCurrentNotificationLogFromFactory() throws Exception {
        EventStore eventStore = this.eventStore();
        long totalEvents = eventStore.countStoredEvents();
        boolean shouldBePrevious = totalEvents > (NotificationLogFactory.notificationsPerLog() * 2);
        NotificationLogFactory factory = new NotificationLogFactory(eventStore);
        NotificationLog log = factory.createCurrentNotificationLog();

        NotificationLogId previousId = log.decodedPreviousNotificationLogId();
View Full Code Here

        assertEquals(shouldBePrevious, log.hasPreviousNotificationLog());
        assertTrue(log.isArchived());
    }

    public void testEncodedWithDecodedNavigationIds() throws Exception {
        EventStore eventStore = this.eventStore();
        NotificationLogFactory factory = new NotificationLogFactory(eventStore);
        NotificationLog log = factory.createCurrentNotificationLog();

        String currentId = log.notificationLogId();
        NotificationLogId decodedCurrentLogId = log.decodedNotificationLogId();
View Full Code Here

        assertEquals(decodedNextLogId, new NotificationLogId(nextId));
        assertEquals(decodedCurrentLogId, decodedNextLogId);
    }

    private EventStore eventStore() {
        EventStore eventStore = new MockEventStore(new PersistenceManagerProvider() {});

        assertNotNull(eventStore);

        return eventStore;
    }
View Full Code Here

TOP

Related Classes of com.saasovation.common.event.EventStore

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.