@Test public void transaction_inactive() { final VoidService delegate = newMock(VoidService.class); final EntityManagerManager manager = newMock(EntityManagerManager.class); final EntityTransactionManager transactionManager = newMock(EntityTransactionManager.class); final JpaTransactionAdvisor advisor = newJpaTransactionAdvisor(manager, transactionManager); final EntityManager entityManager = newMock(EntityManager.class); final EntityTransaction transaction = newMock(EntityTransaction.class); final AspectInterceptorBuilder<VoidService> builder = aspectDecorator.createBuilder( VoidService.class, delegate, "foo.Bar"); advisor.addTransactionCommitAdvice(builder); final VoidService interceptor = builder.build(); train_getAndBeginTransaction(manager, entityManager, transaction); delegate.voidMethod(); train_commitActiveTransaction(transaction); replay(); interceptor.voidMethod(); verify(); }
@Override public void addTransactionCommitAdvice(MethodAdviceReceiver receiver) { for (final Method m : receiver.getInterface().getMethods()) { if (m.getAnnotation(CommitAfter.class) != null) { PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class); receiver.adviseMethod(m, methodAdvices.get(annotation == null ? null : annotation.unitName())); } } }
JpaTransactionAdvisorImpl implements JpaTransactionAdvisor { @Override public void addTransactionCommitAdvice(MethodAdviceReceiver receiver) { for (final Method m : receiver.getInterface().getMethods()) { if (m.getAnnotation(CommitAfter.class) != null) { PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class); receiver.adviseMethod(m, methodAdvices.get(annotation == null ? null : annotation.unitName())); } } } }
JpaTransactionAdvisorImpl implements JpaTransactionAdvisor { @Override public void addTransactionCommitAdvice(MethodAdviceReceiver receiver) { for (final Method m : receiver.getInterface().getMethods()) { if (m.getAnnotation(CommitAfter.class) != null) { PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class); receiver.adviseMethod(m, methodAdvices.get(annotation == null ? null : annotation.unitName())); } } } JpaTransactionAdvisorImpl(EntityManagerManager manager,
            EntityTransactionManager transactionManager); }
JpaTransactionAdvisorImpl implements JpaTransactionAdvisor { @Override public void addTransactionCommitAdvice(MethodAdviceReceiver receiver) { for (final Method m : receiver.getInterface().getMethods()) { if (m.getAnnotation(CommitAfter.class) != null) { PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class); receiver.adviseMethod(m, methodAdvices.get(annotation == null ? null : annotation.unitName())); } } } JpaTransactionAdvisorImpl(EntityManagerManager manager,
            EntityTransactionManager transactionManager); @Override void addTransactionCommitAdvice(MethodAdviceReceiver receiver); }
JpaTransactionAdvisorImpl implements JpaTransactionAdvisor { @Override public void addTransactionCommitAdvice(MethodAdviceReceiver receiver) { for (final Method m : receiver.getInterface().getMethods()) { if (m.getAnnotation(CommitAfter.class) != null) { PersistenceContext annotation = receiver.getMethodAnnotation(m, PersistenceContext.class); receiver.adviseMethod(m, methodAdvices.get(annotation == null ? null : annotation.unitName())); } } } JpaTransactionAdvisorImpl(EntityManagerManager manager,
            EntityTransactionManager transactionManager); @Override void addTransactionCommitAdvice(MethodAdviceReceiver receiver);  }