Package org.axonframework.testutils

Examples of org.axonframework.testutils.MockException


        testSubject = new EventProcessor(mockExecutorService, new NullShutdownCallback(),
                                         new DefaultErrorHandler(RetryPolicy.retryAfter(500, TimeUnit.MILLISECONDS)),
                                         new DefaultUnitOfWorkFactory(mockTransactionManager),
                                         Collections.singleton(listener), multiplexingEventProcessingMonitor);

        doThrow(new MockException()).doNothing().when(listener).handle(event1);

        testSubject.scheduleEvent(event1);
        testSubject.scheduleEvent(event2);
        testSubject.run();
        verify(mockExecutorService).schedule(eq(testSubject), gt(400L), eq(TimeUnit.MILLISECONDS));
View Full Code Here


        ExecutorService mockExecutorService = mock(ExecutorService.class);
        testSubject = new EventProcessor(mockExecutorService, new NullShutdownCallback(),
                                         new DefaultErrorHandler(RetryPolicy.retryAfter(500, TimeUnit.MILLISECONDS)),
                                         new DefaultUnitOfWorkFactory(mockTransactionManager),
                                         Collections.singleton(listener), multiplexingEventProcessingMonitor);
        doThrow(new MockException()).doNothing().when(listener).handle(event1);
        testSubject.scheduleEvent(event1);
        testSubject.scheduleEvent(event2);
        long t1 = System.currentTimeMillis();
        testSubject.run();
        // we simulate the immediate scheduling of the yielded task by executing run again
View Full Code Here

        testSubject = new EventProcessor(mockExecutorService, new NullShutdownCallback(),
                                         new DefaultErrorHandler(RetryPolicy.retryAfter(500, TimeUnit.MILLISECONDS)),
                                         new DefaultUnitOfWorkFactory(mockTransactionManager),
                                         Collections.singleton(listener), multiplexingEventProcessingMonitor);

        doThrow(new MockException()).doReturn(new Object()).when(mockTransactionManager).startTransaction();
        testSubject.scheduleEvent(event1);
        testSubject.scheduleEvent(event2);
        testSubject.run();
        verify(mockExecutorService, times(2)).execute(eq(testSubject));
        verify(listener, never()).handle(event1);
View Full Code Here

        @Override
        public void handle(EventMessage event) {
            handledEvents.add(event);
            if (--failOnEvent == 0) {
                throw new MockException();
            }
        }
View Full Code Here

        testSubject.subscribe(mockEventListener);

        final EventMessage<Object> message1 = asEventMessage(new Object());
        final EventMessage<Object> message2 = asEventMessage(new Object());

        doThrow(new MockException()).when(mockEventListener).handle(message1);

        testSubject.publish(message1);
        testSubject.publish(message2);

        verify(mockEventListener, times(2)).handle(isA(EventMessage.class));
View Full Code Here

        testSubject.subscribe(mockEventListener1);
        testSubject.subscribe(mockEventListener2);
        testSubject.subscribe(mockEventListener3);

        doThrow(new MockException()).when(mockEventListener1).handle(isA(EventMessage.class));
        doThrow(new MockException()).when(mockEventListener2).handle(isA(EventMessage.class));
        doNothing().when(mockEventListener3).handle(isA(EventMessage.class));

        final GenericEventMessage message = new GenericEventMessage("test");
        testSubject.publish(message);
View Full Code Here

TOP

Related Classes of org.axonframework.testutils.MockException

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.