Package org.axonframework.eventhandling.annotation

Examples of org.axonframework.eventhandling.annotation.AnnotationEventListenerAdapter


        ));

        // create the event bus and subscribe two listeners
        // notice how the registration process itself is unaware of clustering
        EventBus eventBus = new ClusteringEventBus(clusterSelector);
        eventBus.subscribe(new AnnotationEventListenerAdapter(new ThreadPrintingEventListener()));
        eventBus.subscribe(new AnnotationEventListenerAdapter(new AnotherThreadPrintingEventListener()));

        // publish an event
        eventBus.publish(asEventMessage(new ToDoItemCompletedEvent("todo1")));

        // we need to shutdown the executor we have created to prevent the JVM from hanging on shutdown
View Full Code Here


        testSubject = new AnnotationClusterSelector(MyInheritedAnnotation.class, cluster);
    }

    @Test
    public void testSelectClusterForAnnotatedHandler() {
        Cluster actual = testSubject.selectCluster(new AnnotationEventListenerAdapter(new AnnotatedEventHandler()));
        assertSame(cluster, actual);
    }
View Full Code Here

        assertSame(cluster, actual);
    }

    @Test
    public void testSelectClusterForAnnotatedHandlerSubClass() {
        Cluster actual = testSubject.selectCluster(new AnnotationEventListenerAdapter(new AnnotatedSubEventHandler()));
        assertSame(cluster, actual);
    }
View Full Code Here

        assertSame(cluster, actual);
    }

    @Test
    public void testReturnNullWhenNoAnnotationFound() {
        Cluster actual = testSubject.selectCluster(new AnnotationEventListenerAdapter(new NonAnnotatedEventHandler()));
        assertNull("ClusterSelector should not have selected a cluster", actual);
    }
View Full Code Here

    }

    @Test
    public void testSelectClusterForNonInheritedHandlerSubClassWhenSuperClassInspectionIsEnabled() {
        testSubject = new AnnotationClusterSelector(MyAnnotation.class, cluster, true);
        Cluster actual = testSubject.selectCluster(new AnnotationEventListenerAdapter(new AnnotatedSubEventHandler()));
        assertSame(cluster, actual);
    }
View Full Code Here

    }

    @Test
    public void testReturnNullForNonInheritedHandlerSubClassWhenSuperClassInspectionIsDisabled() {
        testSubject = new AnnotationClusterSelector(MyAnnotation.class, cluster);
        Cluster actual = testSubject.selectCluster(new AnnotationEventListenerAdapter(new AnnotatedSubEventHandler()));
        assertNull("ClusterSelector should not have selected a cluster", actual);
    }
View Full Code Here

        });
        final List<EventMessage> ackedMessages = listenForAcknowledgedMessages();

        final FirstHandler handler1 = spy(new FirstHandler());
        final SecondHandler handler2 = spy(new SecondHandler());
        testSubject.subscribe(new AnnotationEventListenerAdapter(handler1));
        testSubject.subscribe(new AnnotationEventListenerAdapter(handler2));

        final EventMessage<Object> eventMessage = GenericEventMessage.asEventMessage("test");
        testSubject.publish(eventMessage);

        InOrder inOrder = Mockito.inOrder(handler1, handler2);
View Full Code Here

TOP

Related Classes of org.axonframework.eventhandling.annotation.AnnotationEventListenerAdapter

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.