Search in sources :

Example 6 with PersistenceRecord

use of com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord in project narayana by jbosstm.

the class DisposeRecordUnitTest method test.

@Test
public void test() {
    ParticipantStore store = StoreManager.setupStore(null, StateType.OS_UNSHARED);
    DisposeRecord cr = new DisposeRecord(store, new ExtendedObject());
    assertFalse(cr.propagateOnAbort());
    assertTrue(cr.propagateOnCommit());
    assertEquals(cr.typeIs(), RecordType.DISPOSE);
    assertTrue(cr.type() != null);
    assertEquals(cr.doSave(), true);
    assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_OK);
    assertEquals(cr.nestedAbort(), TwoPhaseOutcome.FINISH_OK);
    cr = new DisposeRecord(store, new ExtendedObject());
    assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_OK);
    assertEquals(cr.nestedCommit(), TwoPhaseOutcome.FINISH_OK);
    cr = new DisposeRecord(store, new ExtendedObject());
    assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
    assertEquals(cr.topLevelAbort(), TwoPhaseOutcome.FINISH_OK);
    cr = new DisposeRecord(store, new ExtendedObject());
    assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
    assertEquals(cr.topLevelCommit(), TwoPhaseOutcome.FINISH_OK);
    cr = new DisposeRecord();
    assertFalse(cr.shouldAdd(new PersistenceRecord()));
    assertFalse(cr.shouldAlter(new PersistenceRecord()));
    assertFalse(cr.shouldMerge(new PersistenceRecord()));
    assertFalse(cr.shouldReplace(new PersistenceRecord()));
    assertFalse(cr.save_state(new OutputObjectState(), ObjectType.ANDPERSISTENT));
    assertFalse(cr.restore_state(new InputObjectState(), ObjectType.ANDPERSISTENT));
}
Also used : InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) ExtendedObject(com.hp.mwtests.ts.arjuna.resources.ExtendedObject) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) PersistenceRecord(com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord) ParticipantStore(com.arjuna.ats.arjuna.objectstore.ParticipantStore) DisposeRecord(com.arjuna.ats.internal.arjuna.abstractrecords.DisposeRecord) Test(org.junit.Test)

Aggregations

PersistenceRecord (com.arjuna.ats.internal.arjuna.abstractrecords.PersistenceRecord)6 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)5 Test (org.junit.Test)5 ParticipantStore (com.arjuna.ats.arjuna.objectstore.ParticipantStore)4 ExtendedObject (com.hp.mwtests.ts.arjuna.resources.ExtendedObject)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 PrintWriter (java.io.PrintWriter)3 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)2 DisposeRecord (com.arjuna.ats.internal.arjuna.abstractrecords.DisposeRecord)2 Uid (com.arjuna.ats.arjuna.common.Uid)1 BasicAction (com.arjuna.ats.arjuna.coordinator.BasicAction)1 CadaverActivationRecord (com.arjuna.ats.internal.arjuna.abstractrecords.CadaverActivationRecord)1 CadaverRecord (com.arjuna.ats.internal.arjuna.abstractrecords.CadaverRecord)1 LastResourceRecord (com.arjuna.ats.internal.arjuna.abstractrecords.LastResourceRecord)1 RecoveryRecord (com.arjuna.ats.internal.arjuna.abstractrecords.RecoveryRecord)1