Search in sources :

Example 1 with SubordinateJTAXAResourceOrphanFilter

use of com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateJTAXAResourceOrphanFilter in project narayana by jbosstm.

the class XAResourceOrphanFilterTest method testSubordinateJTAXAResourceOrphanFilter.

@Test
public void testSubordinateJTAXAResourceOrphanFilter() throws HeuristicRollbackException, HeuristicMixedException, HeuristicCommitException, SystemException, RollbackException, XAException {
    XAResourceOrphanFilter orphanFilter = new SubordinateJTAXAResourceOrphanFilter();
    XidImple xid = (XidImple) XATxConverter.getXid(Uid.nullUid(), false, XATxConverter.FORMAT_ID);
    XATxConverter.setSubordinateNodeName(xid.getXID(), TxControl.getXANodeName());
    List<String> xaRecoveryNodes = jtaPropertyManager.getJTAEnvironmentBean().getXaRecoveryNodes();
    try {
        jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(Arrays.asList("2"));
        assertEquals(XAResourceOrphanFilter.Vote.ABSTAIN, orphanFilter.checkXid(xid));
        jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(Arrays.asList("1"));
        assertEquals(XAResourceOrphanFilter.Vote.ROLLBACK, orphanFilter.checkXid(xid));
    } finally {
        jtaPropertyManager.getJTAEnvironmentBean().setXaRecoveryNodes(xaRecoveryNodes);
    }
}
Also used : XidImple(com.arjuna.ats.jta.xa.XidImple) SubordinateJTAXAResourceOrphanFilter(com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateJTAXAResourceOrphanFilter) JTANodeNameXAResourceOrphanFilter(com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter) SubordinateJTAXAResourceOrphanFilter(com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateJTAXAResourceOrphanFilter) SubordinationManagerXAResourceOrphanFilter(com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinationManagerXAResourceOrphanFilter) JTAActionStatusServiceXAResourceOrphanFilter(com.arjuna.ats.internal.jta.recovery.arjunacore.JTAActionStatusServiceXAResourceOrphanFilter) XAResourceOrphanFilter(com.arjuna.ats.jta.recovery.XAResourceOrphanFilter) NodeNameXAResourceOrphanFilter(com.arjuna.ats.internal.jta.recovery.arjunacore.NodeNameXAResourceOrphanFilter) JTATransactionLogXAResourceOrphanFilter(com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter) Test(org.junit.Test)

Aggregations

JTAActionStatusServiceXAResourceOrphanFilter (com.arjuna.ats.internal.jta.recovery.arjunacore.JTAActionStatusServiceXAResourceOrphanFilter)1 JTANodeNameXAResourceOrphanFilter (com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter)1 JTATransactionLogXAResourceOrphanFilter (com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter)1 NodeNameXAResourceOrphanFilter (com.arjuna.ats.internal.jta.recovery.arjunacore.NodeNameXAResourceOrphanFilter)1 SubordinateJTAXAResourceOrphanFilter (com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinateJTAXAResourceOrphanFilter)1 SubordinationManagerXAResourceOrphanFilter (com.arjuna.ats.internal.jta.recovery.arjunacore.SubordinationManagerXAResourceOrphanFilter)1 XAResourceOrphanFilter (com.arjuna.ats.jta.recovery.XAResourceOrphanFilter)1 XidImple (com.arjuna.ats.jta.xa.XidImple)1 Test (org.junit.Test)1