Package org.axonframework.unitofwork

Examples of org.axonframework.unitofwork.UnitOfWork.rollback()


        uow.registerAggregate(aggregate, mock(EventBus.class), mock(SaveAggregateCallback.class));
        aggregate.doSomething();
        aggregate.doSomething();

        RuntimeException mockFailure = new RuntimeException("mock");
        uow.rollback(mockFailure);

        verify(mockAuditDataProvider, times(2)).provideAuditDataFor(any(CommandMessage.class));
        verify(mockAuditLogger, never()).logSuccessful(eq(command), any(Object.class), any(List.class));
        verify(mockAuditLogger).logFailed(eq(command), eq(mockFailure), listWithTwoEventMessages());
    }
View Full Code Here


                                                  any(AMQP.BasicProperties.class), isA(byte[].class));
        verify(transactionalChannel, never()).txRollback();
        verify(transactionalChannel, never()).txCommit();
        verify(transactionalChannel, never()).close();

        uow.rollback();
        verify(transactionalChannel, never()).txCommit();
        verify(transactionalChannel).txRollback();
        verify(transactionalChannel).close();
    }
View Full Code Here

        Object returnValue;
        try {
            returnValue = chain.proceed();
        } catch (Throwable throwable) {
            if (rollbackConfiguration.rollBackOn(throwable)) {
                unitOfWork.rollback(throwable);
            } else {
                unitOfWork.commit();
            }
            throw throwable;
        }
View Full Code Here

            UnitOfWork uow = null;
            try {
                uow = unitOfWorkFactory.createUnitOfWork();
                processingResult = doHandle(event);
                if (processingResult.requiresRollback()) {
                    uow.rollback();
                } else {
                    uow.commit();
                }
                if (processingResult.requiresRescheduleEvent()) {
                    eventQueue.addFirst(event);
View Full Code Here

                    eventQueue.addFirst(event);
                    retryAfter = System.currentTimeMillis() + processingResult.waitTime();
                }
                // the batch failed.
                if (uow != null && uow.isStarted()) {
                    uow.rollback();
                }

                if (!processingResult.requiresRescheduleEvent()) {
                    // report successful messages to far...
                    notifyProcessingHandlers();
View Full Code Here

        CustomParameterAggregateRoot aggregateRoot = new CustomParameterAggregateRoot();
        aggregateRoot.doSomething();

        assertEquals("It works", aggregateRoot.secondParameter);

        uow.rollback();
    }

    @Test
    public void testEventNotAppliedInReplayMode() {
        final UUID id = UUID.randomUUID();
View Full Code Here

        try {
            result.set(gateway.waitForReturnValue("Command"));
        } catch (Exception e) {
            error.set(e);
        } finally {
            uow.rollback();
        }
        verify(mockRetryScheduler, never()).scheduleRetry(isA(CommandMessage.class),
                                                          any(RuntimeException.class),
                                                          anyList(),
                                                          any(Runnable.class));
View Full Code Here

                    Aggregate aggregate = repository.load(updated.id);
                    aggregate.update(token);
                    if (commit) {
                        nested.commit();
                    } else {
                        nested.rollback();
                    }
                }
            }
        }
    }
View Full Code Here

    }

    private Aggregate loadAggregate(String id) {
        UnitOfWork uow = uowFactory.createUnitOfWork();
        Aggregate verify = repository.load(id);
        uow.rollback();
        return verify;
    }

    /**
     * Capture information about events that are published
View Full Code Here

                logger.warn("An Exception occurred while detecting illegal state changes in {}.",
                            workingAggregate.getClass().getName(),
                            e);
            } finally {
                // rollback to prevent changes bing pushed to event store
                uow.rollback();
            }
        }
    }

    private void assertValidWorkingAggregateState(EventSourcedAggregateRoot eventSourcedAggregate) {
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.