Examples of EventStore


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

Examples of com.saasovation.common.event.EventStore

        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

Examples of com.saasovation.common.event.EventStore

        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

Examples of com.saasovation.common.event.EventStore

        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

Examples of org.axonframework.eventstore.EventStore

*/
public class RunDisruptorCommandBus {

    public static void main(String[] args) throws InterruptedException {
        // we'll store Events on the FileSystem, in the "events" folder
        EventStore eventStore = new FileSystemEventStore(new SimpleEventFileResolver(new File("./events")));

        // a Simple Event Bus will do
        EventBus eventBus = new SimpleEventBus();

        // we register the event handlers
View Full Code Here

Examples of org.axonframework.eventstore.EventStore

        // the CommandGateway provides a friendlier API to send commands
        CommandGateway commandGateway = new DefaultCommandGateway(commandBus);

        // we'll store Events on the FileSystem, in the "events" folder
        EventStore eventStore = new FileSystemEventStore(new SimpleEventFileResolver(new File("./events")));

        // a Simple Event Bus will do
        EventBus eventBus = new SimpleEventBus();

        // we need to configure the repository
View Full Code Here

Examples of org.axonframework.eventstore.EventStore

        // the CommandGateway provides a friendlier API to send commands
        CommandGateway commandGateway = new DefaultCommandGateway(commandBus);

        // we'll store Events on the FileSystem, in the "events" folder
        EventStore eventStore = new FileSystemEventStore(new SimpleEventFileResolver(new File("./events")));

        // a Simple Event Bus will do
        EventBus eventBus = new SimpleEventBus();

        // we need to configure the repository
View Full Code Here

Examples of org.axonframework.eventstore.EventStore

        // we start the application context
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("upcaster-config.xml");

        // we fetch the EventStore from the application context
        EventStore eventStore = applicationContext.getBean(EventStore.class);

        // we append some events. Notice we append a "ToDoItemCreatedEvent".
        eventStore.appendEvents("UpcasterSample", new SimpleDomainEventStream(
                new GenericDomainEventMessage("todo1", 0, new ToDoItemCreatedEvent("todo1", "I need to do this today")),
                new GenericDomainEventMessage("todo1", 1, new ToDoItemCompletedEvent("todo1"))
        ));
        eventStore.appendEvents("UpcasterSample", new SimpleDomainEventStream(
                new GenericDomainEventMessage("todo2", 0, new ToDoItemCreatedEvent("todo2", "I also need to do this"))
        ));


        // now, we read the events from the "todo1" stream
        DomainEventStream upcastEvents = eventStore.readEvents("UpcasterSample", "todo1");
        while (upcastEvents.hasNext()) {
            // and print them, so that we can see what we ended up with
            System.out.println(upcastEvents.next().getPayload().toString());
        }
        IOUtils.closeQuietlyIfCloseable(upcastEvents);
View Full Code Here

Examples of org.axonframework.eventstore.EventStore

        aggregate.apply(new StubDomainEvent());
    }

    @Test
    public void testSaveEventsWithDecorators() {
        testSubject = new EventSourcingRepository<TestAggregate>(stubAggregateFactory, new EventStore() {
            @Override
            public void appendEvents(String type, DomainEventStream events) {
                while (events.hasNext()) {
                    events.next();
                }
View Full Code Here

Examples of org.axonframework.eventstore.EventStore

        eventBus = new SimpleEventBus();
        eventBus.subscribe(new LoggingEventListener(events));
        events.clear();

        EventStore eventStore = new FileSystemEventStore(new SimpleEventFileResolver(tempFolder.newFolder()));
        AggregateFactory<Aggregate> aggregateFactory = new GenericAggregateFactory<Aggregate>(Aggregate.class);
        repository = new CachingEventSourcingRepository<Aggregate>(aggregateFactory, eventStore);
        repository.setEventBus(eventBus);

        uowFactory = new DefaultUnitOfWorkFactory();
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.