Examples of SagaManager


Examples of org.axonframework.saga.SagaManager

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

        // This type is found using component scanning
        when(sagaFactory.supports(StubSaga.class)).thenReturn(true);
        when(sagaFactory.createSaga(any(Class.class))).thenAnswer(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                return ((Class) invocation.getArguments()[0]).newInstance();
            }
        });

        String identifier = UUID.randomUUID().toString();
        final GenericDomainEventMessage<SimpleEvent> event = new GenericDomainEventMessage<SimpleEvent>(identifier,
                                                                                                        (long) 0,
                                                                                                        new SimpleEvent(
                                                                                                                identifier),
                                                                                                        MetaData.emptyInstance());
        sagaManager.handle(event);

        verify(correlationDataProvider, times(2)).correlationDataFor(event);
        verify(sagaFactory).createSaga(StubSaga.class);
    }
View Full Code Here

Examples of org.axonframework.saga.SagaManager

    @Test
    @DirtiesContext
    public void testAsyncSagaManagerWiring() throws InterruptedException {

        // this part should prove correct autowiring of the saga manager
        SagaManager sagaManager = beanFactory.getBean("asyncSagaManager", SagaManager.class);
        assertNotNull(sagaManager);
        assertNotNull(tm);

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

        String identifier = UUID.randomUUID().toString();
        sagaManager.handle(new GenericDomainEventMessage<SimpleEvent>(identifier, (long) 0,
                                                                      new SimpleEvent(
                                                                              identifier), MetaData.emptyInstance()));
        Thread.sleep(250);
        te.shutdown();
        te.getThreadPoolExecutor().awaitTermination(2, TimeUnit.SECONDS);
View Full Code Here

Examples of pl.com.bottega.ecommerce.system.saga.SagaManager

    @Override
    public Collection<SagaManager> getLoadersForEvent(Object event) {
        Collection<SagaManager> results = new HashSet<SagaManager>();
        Collection<String> loadersBeansNames = loadersInterestedIn.get(event.getClass());
        for (String loaderBeanName : loadersBeansNames) {
            SagaManager loader = beanFactory.getBean(loaderBeanName, SagaManager.class);
            results.add(loader);
        }
        return results;
    }
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.