Examples of AsyncAnnotatedSagaManager


Examples of org.axonframework.saga.annotation.AsyncAnnotatedSagaManager

    @Test
    @DirtiesContext
    public void testAsyncTransactionalSagaManagerWiring() throws InterruptedException {
        // this part should prove correct autowiring of the saga manager
        AsyncAnnotatedSagaManager sagaManager = beanFactory.getBean("asyncTransactionalSagaManager",
                                                                    AsyncAnnotatedSagaManager.class);
        assertNotNull(sagaManager);

        when(sagaFactory.supports(StubSaga.class)).thenReturn(true);
        when(sagaFactory.createSaga(StubSaga.class)).thenReturn(new StubSaga());

        String identifier = UUID.randomUUID().toString();
        final GenericDomainEventMessage<SimpleEvent> event = new GenericDomainEventMessage<SimpleEvent>(identifier,
                                                                                                        (long) 0,
                                                                                                        new SimpleEvent(
                                                                                                                identifier),
                                                                                                        MetaData.emptyInstance());
        sagaManager.handle(event);
        sagaManager.unsubscribe();
        verify(sagaFactory).createSaga(eq(StubSaga.class));
        sagaManager.stop();

        verify(correlationDataProvider).correlationDataFor(event);

        assertEquals("Saga was never stored in the saga repository",
                     1L, entityManager.createQuery("SELECT count(se) FROM SagaEntry se").getSingleResult());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.