JtaConfigurer implements InitializingBean, DisposableBean { @Override public void afterPropertiesSet() throws Exception { configureTransactionManager(); configureUserTransaction(); Jta.configure(transactionManager, userTransaction); }  @Override void afterPropertiesSet(); void setTransactionManager(TransactionManager transactionManager); void setUserTransaction(UserTransaction userTransaction); void setJndiTemplate(JndiTemplate jndiTemplate); @Override void destroy();  }
@Test(expected = IllegalStateException.class) public void testAfterPropertiesSet_ConfigNotInitialized() throws Exception { new JtaConfigurer().afterPropertiesSet(); }
@Test public void testAfterPropertiesSet_NoJta() throws Exception { ConfigContext.init(new SimpleConfig()); new JtaConfigurer().afterPropertiesSet(); assertTrue(Jta.isFrozen()); assertFalse(Jta.isEnabled()); assertNull(Jta.getTransactionManager()); assertNull(Jta.getUserTransaction()); }
@Test public void testAfterPropertiesSet_JtaObjectConfig() throws Exception { initializeJtaObjectConfig(); new JtaConfigurer().afterPropertiesSet(); assertEquals(transactionManager, Jta.getTransactionManager()); assertEquals(userTransaction, Jta.getUserTransaction()); }
@Test public void testAfterPropertiesSet_JtaJndiConfig() throws Exception { initializeJtaJndiConfig(); new JtaConfigurer().afterPropertiesSet(); assertEquals(transactionManager, Jta.getTransactionManager()); assertEquals(userTransaction, Jta.getUserTransaction()); }