XAResourceRecord xares = new XAResourceRecord(tx, res, tx.getTxId(), null); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.FINISH_OK); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.FINISH_OK); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.HEURISTIC_HAZARD); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.HEURISTIC_HAZARD); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.HEURISTIC_HAZARD);
@Test public void testInvalid () throws Exception { XAResourceRecord xares = new XAResourceRecord(); assertEquals(xares.getXid(), null); assertEquals(xares.value(), null); assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR); assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_NOTOK); assertEquals(xares.topLevelAbort(), TwoPhaseOutcome.FINISH_ERROR); assertEquals(xares.topLevelCommit(), TwoPhaseOutcome.FINISH_ERROR); }