Package org.axonframework.domain

Examples of org.axonframework.domain.StubDomainEvent


            if ("hello".equalsIgnoreCase(stringCommand)) {
                apply(new FirstEvent());
            } else if ("second".equalsIgnoreCase(stringCommand)) {
                apply(new ThirdEvent());
            } else {
                apply(new StubDomainEvent());
            }
        }
View Full Code Here


    @Test
    public void testPackageAlias() throws UnsupportedEncodingException {
        testSubject.addPackageAlias("axondomain", "org.axonframework.domain");
        testSubject.addPackageAlias("axon", "org.axonframework");

        SerializedObject<byte[]> serialized = testSubject.serialize(new StubDomainEvent(), byte[].class);
        String asString = new String(serialized.getData(), "UTF-8");
        assertFalse("Package name found in:" +  asString, asString.contains("org.axonframework.domain"));
        StubDomainEvent deserialized = (StubDomainEvent) testSubject.deserialize(serialized);
        assertEquals(StubDomainEvent.class, deserialized.getClass());
        assertTrue(asString.contains("axondomain"));
    }
View Full Code Here

    @Test
    public void testAlias() throws UnsupportedEncodingException {
        testSubject.addAlias("stub", StubDomainEvent.class);

        SerializedObject<byte[]> serialized = testSubject.serialize(new StubDomainEvent(), byte[].class);
        String asString = new String(serialized.getData(), "UTF-8");
        assertFalse(asString.contains("org.axonframework.domain"));
        assertTrue(asString.contains("<stub"));
        StubDomainEvent deserialized = (StubDomainEvent) testSubject.deserialize(serialized);
        assertEquals(StubDomainEvent.class, deserialized.getClass());
    }
View Full Code Here

    }

    @Test
    public void testLifeCycle_ExistingInstanceIgnoresEvent() {
        manager.handle(new GenericEventMessage<StartingEvent>(new StartingEvent("12")));
        manager.handle(new GenericEventMessage<StubDomainEvent>(new StubDomainEvent()));
        assertEquals(1, repositoryContents("12", MyTestSaga.class).size());
        assertEquals(1, repositoryContents("12", MyTestSaga.class).iterator().next().getCapturedEvents().size());
    }
View Full Code Here

        assertEquals(1, repositoryContents("12", MyTestSaga.class).iterator().next().getCapturedEvents().size());
    }

    @Test
    public void testLifeCycle_IgnoredEventDoesNotCreateInstance() {
        manager.handle(new GenericEventMessage<StubDomainEvent>(new StubDomainEvent()));
        assertEquals(0, repositoryContents("12", MyTestSaga.class).size());
    }
View Full Code Here

        private UUID identifier;

        private SimpleAggregateRoot() {
            identifier = UUID.randomUUID();
            apply(new StubDomainEvent());
        }
View Full Code Here

        private SimpleAggregateRoot(UUID identifier) {
            this.identifier = identifier;
        }

        private void doOperation() {
            apply(new StubDomainEvent());
        }
View Full Code Here

        assertEquals(2, aggregate.getHandledEvents().size());
        assertSame(event1, aggregate.getHandledEvents().get(0));
        assertSame(event2, aggregate.getHandledEvents().get(1));

        // now the aggregate is loaded (and hopefully correctly locked)
        StubDomainEvent event3 = new StubDomainEvent();

        aggregate.apply(event3);

        CurrentUnitOfWork.commit();
View Full Code Here

                ), event2, event3));
        testSubject.setConflictResolver(conflictResolver);
        TestAggregate actual = testSubject.load(identifier, 1L);
        verify(conflictResolver, never()).resolveConflicts(anyListOf(DomainEventMessage.class), anyListOf(
                DomainEventMessage.class));
        final StubDomainEvent appliedEvent = new StubDomainEvent();
        actual.apply(appliedEvent);

        CurrentUnitOfWork.commit();

        verify(conflictResolver).resolveConflicts(payloadsEqual(appliedEvent), eq(Arrays.asList(event2, event3)));
View Full Code Here

                                            )));
        testSubject.setConflictResolver(conflictResolver);
        TestAggregate actual = testSubject.load(identifier, 3L);
        verify(conflictResolver, never()).resolveConflicts(anyListOf(DomainEventMessage.class), anyListOf(
                DomainEventMessage.class));
        actual.apply(new StubDomainEvent());

        CurrentUnitOfWork.commit();

        verify(conflictResolver, never()).resolveConflicts(anyListOf(DomainEventMessage.class), anyListOf(
                DomainEventMessage.class));
View Full Code Here

TOP

Related Classes of org.axonframework.domain.StubDomainEvent

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.