Package org.axonframework.unitofwork

Examples of org.axonframework.unitofwork.UnitOfWorkFactory


                             });
    }

    @Test
    public void testDispatchCommand_ImplicitUnitOfWorkIsCommittedOnReturnValue() {
        UnitOfWorkFactory spyUnitOfWorkFactory = spy(new DefaultUnitOfWorkFactory());
        testSubject.setUnitOfWorkFactory(spyUnitOfWorkFactory);
        testSubject.subscribe(String.class.getName(), new CommandHandler<String>() {
            @Override
            public Object handle(CommandMessage<String> command, UnitOfWork unitOfWork) throws Throwable {
                assertTrue(CurrentUnitOfWork.isStarted());
View Full Code Here


    }


    @Test
    public void testDispatchCommand_UnitOfWorkIsCommittedOnCheckedException() {
        UnitOfWorkFactory mockUnitOfWorkFactory = mock(DefaultUnitOfWorkFactory.class);
        UnitOfWork mockUnitOfWork = mock(UnitOfWork.class);
        when(mockUnitOfWorkFactory.createUnitOfWork()).thenReturn(mockUnitOfWork);

        testSubject.setUnitOfWorkFactory(mockUnitOfWorkFactory);
        testSubject.subscribe(String.class.getName(), new CommandHandler<String>() {
            @Override
            public Object handle(CommandMessage<String> command, UnitOfWork unitOfWork) throws Throwable {
View Full Code Here

        logger.debug("Starting job to publish a scheduled event");
        Object event = context.getJobDetail().getJobDataMap().get(EVENT_KEY);
        EventMessage<?> eventMessage = createMessage(event);
        try {
            EventBus eventBus = (EventBus) context.getScheduler().getContext().get(EVENT_BUS_KEY);
            UnitOfWorkFactory unitOfWorkFactory =
                    (UnitOfWorkFactory) context.getScheduler().getContext().get(UNIT_OF_WORK_FACTORY_KEY);
            UnitOfWork uow = unitOfWorkFactory.createUnitOfWork();
            try {
                uow.publishEvent(eventMessage, eventBus);
            } finally {
                uow.commit();
            }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    @Test
    public void testScheduleJob_CustomUnitOfWork() throws InterruptedException, SchedulerException {
        final UnitOfWorkFactory unitOfWorkFactory = mock(UnitOfWorkFactory.class);
        UnitOfWork unitOfWork = mock(UnitOfWork.class);
        when(unitOfWorkFactory.createUnitOfWork()).thenReturn(unitOfWork);
        testSubject.setUnitOfWorkFactory(unitOfWorkFactory);
        testSubject.initialize();
        final CountDownLatch latch = new CountDownLatch(1);
        doAnswer(new Answer() {
            @Override
View Full Code Here

TOP

Related Classes of org.axonframework.unitofwork.UnitOfWorkFactory

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.