Package com.saasovation.common.event

Examples of com.saasovation.common.event.StoredEvent


        long numberOfEvents = eventStore.countStoredEvents();

        TestableDomainEvent domainEvent = new TestableDomainEvent(10001, "testDomainEvent");

        StoredEvent storedEvent = eventStore.append(domainEvent);

        assertTrue(eventStore.countStoredEvents() > numberOfEvents);
        assertEquals(numberOfEvents + 1, eventStore.countStoredEvents());

        assertNotNull(storedEvent);

        TestableDomainEvent reconstitutedDomainEvent = storedEvent.toDomainEvent();

        assertNotNull(reconstitutedDomainEvent);
        assertEquals(domainEvent.id(), reconstitutedDomainEvent.id());
        assertEquals(domainEvent.name(), reconstitutedDomainEvent.name());
        assertEquals(domainEvent.occurredOn(), reconstitutedDomainEvent.occurredOn());
View Full Code Here


        numberOfEvents = eventStore.countStoredEvents();

        assertEquals(1, eventStore.allStoredEventsBetween(numberOfEvents, numberOfEvents + 1000).size());

        StoredEvent storedEvent = eventStore.allStoredEventsBetween(numberOfEvents, numberOfEvents).get(0);

        assertNotNull(storedEvent);

        TestableDomainEvent reconstitutedDomainEvent = storedEvent.toDomainEvent();

        assertNotNull(reconstitutedDomainEvent);
        assertEquals(lastDomainEvent.id(), reconstitutedDomainEvent.id());
        assertEquals(lastDomainEvent.name(), reconstitutedDomainEvent.name());
        assertEquals(lastDomainEvent.occurredOn(), reconstitutedDomainEvent.occurredOn());
View Full Code Here

    public void testStoredEvent() throws Exception {
        EventStore eventStore = this.eventStore();

        TestableDomainEvent domainEvent = new TestableDomainEvent(10001, "testDomainEvent");

        StoredEvent storedEvent = eventStore.append(domainEvent);

        assertNotNull(storedEvent);

        TestableDomainEvent reconstitutedDomainEvent = storedEvent.toDomainEvent();

        assertNotNull(reconstitutedDomainEvent);
        assertEquals(domainEvent.id(), reconstitutedDomainEvent.id());
        assertEquals(domainEvent.name(), reconstitutedDomainEvent.name());
        assertEquals(domainEvent.occurredOn(), reconstitutedDomainEvent.occurredOn());
View Full Code Here

    @Override
    public StoredEvent append(DomainEvent aDomainEvent) {
        String eventSerialization =
                EventSerializer.instance().serialize(aDomainEvent);

        StoredEvent storedEvent =
                new StoredEvent(
                        aDomainEvent.getClass().getName(),
                        aDomainEvent.occurredOn(),
                        eventSerialization);

        this.session().save(storedEvent);
View Full Code Here

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.readOnly(this.database());

        boolean done = false;
        for (long idSequence = aLowStoredEventId; !done && idSequence <= aHighStoredEventId; ++idSequence) {
            StoredEvent storedEvent =
                    uow.readObject(
                            (PRIMARY + idSequence).getBytes(),
                            StoredEvent.class);

            if (storedEvent != null) {
View Full Code Here

        uow.lock(lockKey.key());

        String eventSerialization =
                EventSerializer.instance().serialize(aDomainEvent);

        StoredEvent storedEvent =
                new StoredEvent(
                        aDomainEvent.getClass().getName(),
                        aDomainEvent.occurredOn(),
                        eventSerialization,
                        this.nextStoredEventIdSequence());
View Full Code Here

    @Override
    public synchronized StoredEvent append(DomainEvent aDomainEvent) {
        String eventSerialization =
                EventSerializer.instance().serialize(aDomainEvent);

        StoredEvent storedEvent =
                new StoredEvent(
                        aDomainEvent.getClass().getName(),
                        aDomainEvent.occurredOn(),
                        eventSerialization,
                        this.storedEvents.size() + 1);
View Full Code Here

TOP

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

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.