Package org.axonframework.domain

Examples of org.axonframework.domain.GenericDomainEventMessage


    }

    @Test
    public void filteredFetchPayloadRevision() throws SQLException {
        deleteCurrentPersistentEvents();
        DomainEventMessage dem1 = new GenericDomainEventMessage(aggregateIdentifier, 122, "apayload");
        testSubject.persistEvent(aggregateType, dem1, getPayload(), getMetaData());
        DomainEventMessage dem2 = new GenericDomainEventMessage(aggregateIdentifier, 123, "apayload2");
        testSubject.persistEvent(aggregateType, dem2, getPayloadv4(), getMetaData());

        JdbcCriteriaBuilder builder = new JdbcCriteriaBuilder();
        JdbcCriteria criteria = (JdbcCriteria) builder.property("payloadrevision").lessThan("4");
View Full Code Here


    }

    @Test
    public void filteredFetch() throws SQLException {
        deleteCurrentPersistentEvents();
        DomainEventMessage dem1 = new GenericDomainEventMessage(aggregateIdentifier, 122, "apayload");
        testSubject.persistEvent(aggregateType, dem1, getPayload(), getMetaData());
        DomainEventMessage dem2 = new GenericDomainEventMessage(aggregateIdentifier, 123, "apayload2");
        testSubject.persistEvent(aggregateType, dem2, getPayload(), getMetaData());

        final Iterator<? extends SerializedDomainEventData> iterator = testSubject.fetchFiltered(
                null, Collections.<Object>emptyList(), 1);
View Full Code Here

    }

    @Test
    public void filteredFetchLargerBatchSize() throws SQLException {
        deleteCurrentPersistentEvents();
        DomainEventMessage dem1 = new GenericDomainEventMessage(aggregateIdentifier, 122, "apayload");
        testSubject.persistEvent(aggregateType, dem1, getPayload(), getMetaData());
        DomainEventMessage dem2 = new GenericDomainEventMessage(aggregateIdentifier, 123, "apayload2");
        testSubject.persistEvent(aggregateType, dem2, getPayload(), getMetaData());

        final Iterator<? extends SerializedDomainEventData> iterator = testSubject.fetchFiltered(
                null, Collections.<Object>emptyList(), 100);
View Full Code Here

            @Override
            protected void doInTransactionWithoutResult(
                    TransactionStatus status) {
                DomainEventMessage firstEvent = aggregate2.getUncommittedEvents().next();
                entityManager.persist(new DomainEventEntry("type",
                                                           new GenericDomainEventMessage(
                                                                   "a",
                                                                   new DateTime(),
                                                                   "someValue",
                                                                   0,
                                                                   "",
                                                                   MetaData.emptyInstance()),
                                                           emptySerializedObject,
                                                           emptySerializedObject));
            }
        });
        template.execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(
                    TransactionStatus status) {
                entityManager.persist(new DomainEventEntry("type",
                                                           new GenericDomainEventMessage(
                                                                   "a",
                                                                   new DateTime(),
                                                                   "anotherValue",
                                                                   0,
                                                                   "",
View Full Code Here

    @Test
    @Transactional
    public void testVisitAllEvents_IncludesUnknownEventType() throws Exception {
        EventVisitor eventVisitor = mock(EventVisitor.class);
        testSubject.appendEvents("test", new SimpleDomainEventStream(createDomainEvents(10)));
        final GenericDomainEventMessage eventMessage = new GenericDomainEventMessage<String>("test", 0, "test");
        testSubject.appendEvents("test", new SimpleDomainEventStream(eventMessage));
        testSubject.appendEvents("test", new SimpleDomainEventStream(createDomainEvents(10)));
        // we upcast the event to two instances, one of which is an unknown class
        testSubject.setUpcasterChain(new LazyUpcasterChain(Arrays.<Upcaster>asList(new StubUpcaster())));
        testSubject.visitEvents(eventVisitor);
View Full Code Here

    @Test
    public void testVisitAllEvents_IncludesUnknownEventType() throws Exception {
        EventVisitor eventVisitor = mock(EventVisitor.class);
        testSubject.appendEvents("test", new SimpleDomainEventStream(createDomainEvents(10)));
        final GenericDomainEventMessage eventMessage = new GenericDomainEventMessage<String>("test", 0, "test");
        testSubject.appendEvents("test", new SimpleDomainEventStream(eventMessage));
        testSubject.appendEvents("test", new SimpleDomainEventStream(createDomainEvents(10)));
        // we upcast the event to two instances, one of which is an unknown class
        testSubject.setUpcasterChain(new LazyUpcasterChain(Arrays.<Upcaster>asList(new StubUpcaster())));
        testSubject.visitEvents(eventVisitor);
View Full Code Here

                return repository.load(aggregateIdentifier);
            }
        });
        when(mockEventStore.readEvents(anyString(), anyObject()))
                .thenReturn(new SimpleDomainEventStream(
                        new GenericDomainEventMessage(aggregateIdentifier, 0, aggregateIdentifier)));
        testSubject.onEvent(commandHandlingEntry, 0, true);

        verify(mockCache).get(aggregateIdentifier);
        verify(mockCache).put(eq(aggregateIdentifier), isA(StubAggregate.class));
        verify(mockEventStore).readEvents(anyString(), eq(aggregateIdentifier));
View Full Code Here

    @Test
    public void testInitializeRepository_ConstructorNotCallable() {
        GenericAggregateFactory<ExceptionThrowingAggregate> factory =
                new GenericAggregateFactory<ExceptionThrowingAggregate>(ExceptionThrowingAggregate.class);
        try {
            factory.createAggregate(UUID.randomUUID(), new GenericDomainEventMessage(new Object(), 0, new Object()));
            fail("Expected IncompatibleAggregateException");
        } catch (IncompatibleAggregateException e) {
            // we got it
        }
    }
View Full Code Here

        }

        @SuppressWarnings("rawtypes")
        @Override
        public void handle(EventMessage event) {
            GenericDomainEventMessage e = (GenericDomainEventMessage) event;
            String str = String.format("%d - %s(%s) ID %s %s", //
                                       e.getSequenceNumber(), //
                                       e.getPayloadType().getSimpleName(), //
                                       e.getAggregateIdentifier(), //
                                       e.getIdentifier(), //
                                       e.getPayload());
            events.add(str);
        }
View Full Code Here

TOP

Related Classes of org.axonframework.domain.GenericDomainEventMessage

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.