Package org.axonframework.domain

Examples of org.axonframework.domain.SimpleDomainEventStream


                                            public String getSnapshotEventEntryEntityName() {
                                                return "CustomSnapshotEventEntry";
                                            }
                                        }));

        testSubject.appendEvents("temp", new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>("id1", 1L, "Payload")));
        testSubject.appendEvents("temp", new SimpleDomainEventStream(
                new GenericDomainEventMessage<String>("id1", 2L, "Payload2")));
        testSubject.appendSnapshotEvent("temp",
                                        new GenericDomainEventMessage<String>("id1", 1L, "Snapshot1"));

        entityManager.flush();
View Full Code Here


        final ExecutorService executor = Executors.newFixedThreadPool(2);
        snapshotter.setAggregateFactories(Arrays.<AggregateFactory<?>>asList(new GenericAggregateFactory<StubAggregate>(StubAggregate.class)));
        new TransactionTemplate(transactionManager).execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus transactionStatus) {
                eventStore.appendEvents("StubAggregate", new SimpleDomainEventStream(new GenericDomainEventMessage("id1", 0, "Payload1"),
                                                                                     new GenericDomainEventMessage("id1", 1, "Payload2")));
            }
        });
        try {
            snapshotter.setExecutor(executor);
View Full Code Here

        testSubject  = new CompositeEventStreamDecorator(asList(decorator1, decorator2));
    }

    @Test
    public void testDecorateForRead() throws Exception {
        final SimpleDomainEventStream eventStream = new SimpleDomainEventStream();
        testSubject.decorateForRead("test", "id", eventStream);

        InOrder inOrder = inOrder(decorator1, decorator2);
        inOrder.verify(decorator1).decorateForRead("test", "id", eventStream);
        inOrder.verify(decorator2).decorateForRead("test", "id", eventStream);
View Full Code Here

        verifyNoMoreInteractions(decorator1, decorator2);
    }

    @Test
    public void testDecorateForAppend() throws Exception {
        final SimpleDomainEventStream eventStream = new SimpleDomainEventStream();
        final EventSourcedAggregateRoot aggregate = mock(EventSourcedAggregateRoot.class);
        testSubject.decorateForAppend("test", aggregate, eventStream);

        InOrder inOrder = inOrder(decorator1, decorator2);
        inOrder.verify(decorator2).decorateForAppend("test", aggregate, eventStream);
View Full Code Here

        UUID identifier = UUID.randomUUID();
        DomainEventMessage event1 = new GenericDomainEventMessage<String>(identifier, (long) 1,
                                                                          "Mock contents", MetaData.emptyInstance());
        DomainEventMessage event2 = new GenericDomainEventMessage<String>(identifier, (long) 2,
                                                                          "Mock contents", MetaData.emptyInstance());
        when(mockEventStore.readEvents("test", identifier)).thenReturn(new SimpleDomainEventStream(event1, event2));

        TestAggregate aggregate = testSubject.load(identifier, null);

        assertEquals(0, aggregate.getUncommittedEventCount());
        assertEquals(2, aggregate.getHandledEvents().size());
View Full Code Here

    @Test
    public void testLoad_FirstEventIsSnapshot() {
        UUID identifier = UUID.randomUUID();
        TestAggregate aggregate = new TestAggregate(identifier);
        when(mockEventStore.readEvents("test", identifier)).thenReturn(new SimpleDomainEventStream(
                new GenericDomainEventMessage<TestAggregate>(identifier, 10, aggregate)
        ));
        assertSame(aggregate, testSubject.load(identifier));
    }
View Full Code Here

        DomainEventMessage event2 = new GenericDomainEventMessage<String>(identifier, (long) 2,
                                                                          "Mock contents", MetaData.emptyInstance());
        DomainEventMessage event3 = new GenericDomainEventMessage<String>(identifier, (long) 3,
                                                                          "Mock contents", MetaData.emptyInstance());
        when(mockEventStore.readEvents("test", identifier)).thenReturn(
                new SimpleDomainEventStream(new GenericDomainEventMessage<String>(identifier, (long) 1,
                                                                                  "Mock contents",
                                                                                  MetaData.emptyInstance()
                ), event2, event3));
        testSubject.setConflictResolver(conflictResolver);
        TestAggregate actual = testSubject.load(identifier, 1L);
View Full Code Here

        DomainEventMessage event2 = new GenericDomainEventMessage<String>(identifier, (long) 2,
                                                                          "Mock contents", MetaData.emptyInstance());
        DomainEventMessage event3 = new GenericDomainEventMessage<String>(identifier, (long) 3,
                                                                          "Mock contents", MetaData.emptyInstance());
        when(mockEventStore.readEvents("test", identifier)).thenReturn(
                new SimpleDomainEventStream(new GenericDomainEventMessage<String>(identifier, (long) 1,
                                                                                  "Mock contents",
                                                                                  MetaData.emptyInstance()
                ), event2, event3)
        );
View Full Code Here

        DomainEventMessage event2 = new GenericDomainEventMessage<String>(identifier, (long) 2,
                                                                          "Mock contents", MetaData.emptyInstance());
        DomainEventMessage event3 = new GenericDomainEventMessage<String>(identifier, (long) 3,
                                                                          "Mock contents", MetaData.emptyInstance());
        when(mockEventStore.readEvents("test", identifier)).thenReturn(
                new SimpleDomainEventStream(new GenericDomainEventMessage<String>(identifier, (long) 1,
                                                                                  "Mock contents",
                                                                                  MetaData.emptyInstance()
                ), event2, event3));

        try {
View Full Code Here

    @Test
    public void testLoadAndSaveWithoutConflictingChanges() {
        ConflictResolver conflictResolver = mock(ConflictResolver.class);
        UUID identifier = UUID.randomUUID();
        when(mockEventStore.readEvents("test", identifier)).thenReturn(
                new SimpleDomainEventStream(new GenericDomainEventMessage<String>(identifier, (long) 1,
                                                                                  "Mock contents",
                                                                                  MetaData.emptyInstance()
                ),
                                            new GenericDomainEventMessage<String>(identifier, (long) 2,
                                                                                  "Mock contents",
View Full Code Here

TOP

Related Classes of org.axonframework.domain.SimpleDomainEventStream

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.