Search in sources :

Example 1 with XATerminator

use of com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator in project wildfly by wildfly.

the class EJBClientXidTransactionTestCase method beforeTestClass.

/**
     * Create and setup the remoting connection
     *
     * @throws Exception
     */
@BeforeClass
public static void beforeTestClass() throws Exception {
    // These system properties are required or else we end up picking up JTS transaction manager,
    // which is not what we want
    final JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
    jtaEnvironmentBean.setTransactionManagerClassName(TransactionManagerImple.class.getName());
    jtaEnvironmentBean.setTransactionSynchronizationRegistryClassName(TransactionSynchronizationRegistryImple.class.getName());
    final TransactionManager narayanaTm = jtaEnvironmentBean.getTransactionManager();
    final TransactionSynchronizationRegistry narayanaTsr = jtaEnvironmentBean.getTransactionSynchronizationRegistry();
    final XATerminator xat = new XATerminator();
    final JBossLocalTransactionProvider.Builder builder = JBossLocalTransactionProvider.builder();
    builder.setXATerminator(xat).setExtendedJBossXATerminator(xat);
    builder.setTransactionManager(narayanaTm);
    builder.setTransactionSynchronizationRegistry(narayanaTsr);
    LocalTransactionContext.getContextManager().setGlobalDefault(new LocalTransactionContext(builder.build()));
    txManager = ContextTransactionManager.getInstance();
    txSyncRegistry = ContextTransactionSynchronizationRegistry.getInstance();
// setup the tx manager and tx sync registry
}
Also used : XATerminator(com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator) TransactionManagerImple(com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple) TransactionSynchronizationRegistryImple(com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple) JBossLocalTransactionProvider(org.wildfly.transaction.client.provider.jboss.JBossLocalTransactionProvider) ContextTransactionManager(org.wildfly.transaction.client.ContextTransactionManager) TransactionManager(javax.transaction.TransactionManager) TransactionSynchronizationRegistry(javax.transaction.TransactionSynchronizationRegistry) ContextTransactionSynchronizationRegistry(org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry) JTAEnvironmentBean(com.arjuna.ats.jta.common.JTAEnvironmentBean) LocalTransactionContext(org.wildfly.transaction.client.LocalTransactionContext) BeforeClass(org.junit.BeforeClass)

Example 2 with XATerminator

use of com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator in project wildfly by wildfly.

the class HTTPEJBClientXidTransactionTestCase method beforeTestClass.

/**
     * Create and setup the remoting connection
     *
     * @throws Exception
     */
@BeforeClass
public static void beforeTestClass() throws Exception {
    // These system properties are required or else we end up picking up JTS transaction manager,
    // which is not what we want
    final JTAEnvironmentBean jtaEnvironmentBean = jtaPropertyManager.getJTAEnvironmentBean();
    jtaEnvironmentBean.setTransactionManagerClassName(TransactionManagerImple.class.getName());
    jtaEnvironmentBean.setTransactionSynchronizationRegistryClassName(TransactionSynchronizationRegistryImple.class.getName());
    final TransactionManager narayanaTm = jtaEnvironmentBean.getTransactionManager();
    final TransactionSynchronizationRegistry narayanaTsr = jtaEnvironmentBean.getTransactionSynchronizationRegistry();
    final XATerminator xat = new XATerminator();
    final JBossLocalTransactionProvider.Builder builder = JBossLocalTransactionProvider.builder();
    builder.setXATerminator(xat).setExtendedJBossXATerminator(xat);
    builder.setTransactionManager(narayanaTm);
    builder.setTransactionSynchronizationRegistry(narayanaTsr);
    LocalTransactionContext.getContextManager().setGlobalDefault(new LocalTransactionContext(builder.build()));
    txManager = ContextTransactionManager.getInstance();
    txSyncRegistry = ContextTransactionSynchronizationRegistry.getInstance();
    // setup the tx manager and tx sync registry
    AuthenticationConfiguration config = AuthenticationConfiguration.EMPTY.useName("user1").usePassword("password1");
    AuthenticationContext context = AuthenticationContext.empty().with(MatchRule.ALL, config);
    old = AuthenticationContext.captureCurrent();
    AuthenticationContext.getContextManager().setGlobalDefault(context);
}
Also used : AuthenticationConfiguration(org.wildfly.security.auth.client.AuthenticationConfiguration) XATerminator(com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator) TransactionManagerImple(com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple) TransactionSynchronizationRegistryImple(com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple) JBossLocalTransactionProvider(org.wildfly.transaction.client.provider.jboss.JBossLocalTransactionProvider) AuthenticationContext(org.wildfly.security.auth.client.AuthenticationContext) ContextTransactionManager(org.wildfly.transaction.client.ContextTransactionManager) TransactionManager(javax.transaction.TransactionManager) TransactionSynchronizationRegistry(javax.transaction.TransactionSynchronizationRegistry) ContextTransactionSynchronizationRegistry(org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry) JTAEnvironmentBean(com.arjuna.ats.jta.common.JTAEnvironmentBean) LocalTransactionContext(org.wildfly.transaction.client.LocalTransactionContext) BeforeClass(org.junit.BeforeClass)

Aggregations

XATerminator (com.arjuna.ats.internal.jbossatx.jta.jca.XATerminator)2 TransactionManagerImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple)2 TransactionSynchronizationRegistryImple (com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)2 JTAEnvironmentBean (com.arjuna.ats.jta.common.JTAEnvironmentBean)2 TransactionManager (javax.transaction.TransactionManager)2 TransactionSynchronizationRegistry (javax.transaction.TransactionSynchronizationRegistry)2 BeforeClass (org.junit.BeforeClass)2 ContextTransactionManager (org.wildfly.transaction.client.ContextTransactionManager)2 ContextTransactionSynchronizationRegistry (org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry)2 LocalTransactionContext (org.wildfly.transaction.client.LocalTransactionContext)2 JBossLocalTransactionProvider (org.wildfly.transaction.client.provider.jboss.JBossLocalTransactionProvider)2 AuthenticationConfiguration (org.wildfly.security.auth.client.AuthenticationConfiguration)1 AuthenticationContext (org.wildfly.security.auth.client.AuthenticationContext)1