@Test void testStartTransaction() throws Exception { UnitOfWork<Message<?>> unitOfWork = spy(this.unitOfWork); subject.handle(unitOfWork, interceptorChain); verify(transactionManager).startTransaction(); verify(interceptorChain).proceed(); verify(unitOfWork).onCommit(any()); verify(unitOfWork).onRollback(any()); }
@Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } TransactionManagingInterceptor(TransactionManager transactionManager); }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } TransactionManagingInterceptor(TransactionManager transactionManager); @Override Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain); }
TransactionManagingInterceptor implements MessageHandlerInterceptor<T> { @Override public Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain) throws Exception { Transaction transaction = transactionManager.startTransaction(); unitOfWork.onCommit(u -> transaction.commit()); unitOfWork.onRollback(u -> transaction.rollback()); return interceptorChain.proceed(); } TransactionManagingInterceptor(TransactionManager transactionManager); @Override Object handle(UnitOfWork<? extends T> unitOfWork, InterceptorChain interceptorChain);  }