Examples of SimpleDomainEventStream


Examples of org.axonframework.domain.SimpleDomainEventStream

        assertEquals((long) aggregate1.getUncommittedEventCount(),
                     mongoTemplate.domainEventCollection().count());

        // we store some more events to make sure only correct events are retrieved
        testSubject.appendEvents("test", new SimpleDomainEventStream(
                new GenericDomainEventMessage<Object>(aggregate2.getIdentifier(),
                                                      0,
                                                      new Object(),
                                                      Collections.singletonMap("key", (Object) "Value"))));
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

            public List<SerializedObject> upcast(SerializedObject serializedObject, UpcastingContext upcastingContext) {
                return Collections.emptyList();
            }
        });
        final UUID streamId = UUID.randomUUID();
        testSubject.appendEvents("test", new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(streamId, 0, "test")));
        testSubject.readEvents("test", streamId);
    }
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

    }

    @DirtiesContext
    @Test
    public void testStoreDuplicateAggregate() {
        testSubject.appendEvents("type1", new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>("aggregate1", 0, "payload")));
        try {
            testSubject.appendEvents("type1", new SimpleDomainEventStream(
                    new GenericDomainEventMessage<String>("aggregate1", 0, "payload")));
            fail("Expected exception to be thrown");
        } catch (ConcurrencyException e) {
            assertNotNull(e);
        }
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

    @DirtiesContext
    @Test
    public void testVisitAllEvents() {
        EventVisitor eventVisitor = mock(EventVisitor.class);
        testSubject.appendEvents("type1", new SimpleDomainEventStream(createDomainEvents(77)));
        testSubject.appendEvents("type2", new SimpleDomainEventStream(createDomainEvents(23)));

        testSubject.visitEvents(eventVisitor);
        verify(eventVisitor, times(100)).doWithEvent(isA(DomainEventMessage.class));
    }
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

                if (event.getAggregateIdentifier().equals(identifier)) {
                    relevant.add(event);
                }
            }

            return new SimpleDomainEventStream(relevant);
        }
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

        DomainEventMessage event1 = new GenericDomainEventMessage<String>(aggregateIdentifier, 0L,
                                                                          "Mock contents", MetaData.emptyInstance());
        DomainEventMessage event2 = new GenericDomainEventMessage<String>(aggregateIdentifier, 1L,
                                                                          "Mock contents", MetaData.emptyInstance());
        when(mockEventStore.readEvents("stub", aggregateIdentifier))
                .thenReturn(new SimpleDomainEventStream(event1, event2));
    }
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

        }
    }

    @Test
    public void testSnapshotterTriggered() {
        readAllFrom(testSubject.decorateForRead("some", aggregateIdentifier, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 0,
                                                      "Mock contents", MetaData.emptyInstance()),
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 1,
                                                      "Mock contents", MetaData.emptyInstance()),
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 2,
                                                      "Mock contents", MetaData.emptyInstance())
        )));
        readAllFrom(testSubject.decorateForAppend("some", aggregate, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 3,
                                                      "Mock contents", MetaData.emptyInstance())
        )));

        verify(mockSnapshotter, never()).scheduleSnapshot("some", aggregateIdentifier);
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

        verify(mockSnapshotter).scheduleSnapshot("some", aggregateIdentifier);
    }

    @Test
    public void testSnapshotterNotTriggeredOnRead() {
        readAllFrom(testSubject.decorateForRead("some", aggregateIdentifier, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 0,
                                                      "Mock contents", MetaData.emptyInstance()),
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 1,
                                                      "Mock contents", MetaData.emptyInstance()),
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 2,
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

        verify(mockSnapshotter, never()).scheduleSnapshot("some", aggregateIdentifier);
    }

    @Test
    public void testSnapshotterNotTriggeredOnSave() {
        readAllFrom(testSubject.decorateForRead("some", aggregateIdentifier, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 0,
                                                      "Mock contents", MetaData.emptyInstance()),
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 1,
                                                      "Mock contents", MetaData.emptyInstance())
        )));
        readAllFrom(testSubject.decorateForAppend("some", aggregate, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 2,
                                                      "Mock contents", MetaData.emptyInstance())
        )));

        verify(mockSnapshotter, never()).scheduleSnapshot("some", aggregateIdentifier);
View Full Code Here

Examples of org.axonframework.domain.SimpleDomainEventStream

    }

    @Test
    public void testCounterDoesNotResetWhenUsingCache() {
        testSubject.setAggregateCache(mockCache);
        readAllFrom(testSubject.decorateForRead("some", aggregateIdentifier, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 0,
                                                      "Mock contents", MetaData.emptyInstance()),
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 1,
                                                      "Mock contents", MetaData.emptyInstance())
        )));
        readAllFrom(testSubject.decorateForAppend("some", aggregate, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 2,
                                                      "Mock contents", MetaData.emptyInstance())
        )));
        readAllFrom(testSubject.decorateForAppend("some", aggregate, new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>(aggregateIdentifier, (long) 3,
                                                      "Mock contents", MetaData.emptyInstance())
        )));

        verify(mockSnapshotter, never()).scheduleSnapshot("some", aggregateIdentifier);
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.