use of com.hp.mwtests.ts.arjuna.resources.ExtendedObject in project narayana by jbosstm.
the class PersistenceRecordUnitTest method test.
@Test
public void test() {
ParticipantStore store = StoreManager.setupStore(null, StateType.OS_UNSHARED);
PersistenceRecord cr = new PersistenceRecord(new OutputObjectState(), store, new ExtendedObject());
arjPropertyManager.getCoordinatorEnvironmentBean().setClassicPrepare(true);
assertFalse(cr.propagateOnAbort());
assertTrue(cr.propagateOnCommit());
assertEquals(cr.typeIs(), RecordType.PERSISTENCE);
assertTrue(cr.type() != null);
assertEquals(cr.doSave(), true);
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(cr.topLevelAbort(), TwoPhaseOutcome.FINISH_ERROR);
cr = new PersistenceRecord(new OutputObjectState(), store, new ExtendedObject());
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(cr.topLevelCommit(), TwoPhaseOutcome.FINISH_OK);
cr.print(new PrintWriter(new ByteArrayOutputStream()));
OutputObjectState os = new OutputObjectState();
assertTrue(cr.save_state(os, ObjectType.ANDPERSISTENT));
assertTrue(cr.restore_state(new InputObjectState(os), ObjectType.ANDPERSISTENT));
assertEquals(cr.topLevelCleanup(), TwoPhaseOutcome.FINISH_OK);
}
use of com.hp.mwtests.ts.arjuna.resources.ExtendedObject in project narayana by jbosstm.
the class RecoveryRecordUnitTest method test.
@Test
public void test() {
RecoveryRecord cr = new RecoveryRecord(new OutputObjectState(), new ExtendedObject());
assertFalse(cr.propagateOnAbort());
assertTrue(cr.propagateOnCommit());
assertEquals(cr.typeIs(), RecordType.RECOVERY);
assertTrue(cr.type() != null);
assertEquals(cr.doSave(), false);
assertTrue(cr.value() != null);
cr.setValue(new OutputObjectState());
assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.nestedAbort(), TwoPhaseOutcome.FINISH_ERROR);
cr = new RecoveryRecord(new OutputObjectState(), new ExtendedObject());
assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.nestedCommit(), TwoPhaseOutcome.FINISH_OK);
cr = new RecoveryRecord(new OutputObjectState(), new ExtendedObject());
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.topLevelAbort(), TwoPhaseOutcome.FINISH_ERROR);
cr = new RecoveryRecord(new OutputObjectState(), new ExtendedObject());
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.topLevelCommit(), TwoPhaseOutcome.FINISH_OK);
cr = new RecoveryRecord();
cr.merge(new RecoveryRecord());
cr.alter(new RecoveryRecord());
assertTrue(cr.save_state(new OutputObjectState(), ObjectType.ANDPERSISTENT));
assertFalse(cr.restore_state(new InputObjectState(), ObjectType.ANDPERSISTENT));
}
use of com.hp.mwtests.ts.arjuna.resources.ExtendedObject in project narayana by jbosstm.
the class ExtendedUnitTest method testTryLock.
@Test
public void testTryLock() throws Exception {
ExtendedObject bo = new ExtendedObject();
assertTrue(bo.lock());
assertTrue(bo.unlock());
}
use of com.hp.mwtests.ts.arjuna.resources.ExtendedObject in project narayana by jbosstm.
the class CadaverActivationUnitTest method test.
@Test
public void test() {
ParticipantStore store = StoreManager.setupStore(null, StateType.OS_UNSHARED);
CadaverActivationRecord cr = new CadaverActivationRecord(new ExtendedObject());
assertTrue(cr.propagateOnAbort());
assertTrue(cr.propagateOnCommit());
assertEquals(cr.typeIs(), RecordType.ACTIVATION);
assertTrue(cr.type() != null);
assertEquals(cr.doSave(), false);
assertFalse(cr.shouldReplace(new PersistenceRecord(new OutputObjectState(), store, new ExtendedObject())));
assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.nestedAbort(), TwoPhaseOutcome.FINISH_OK);
cr = new CadaverActivationRecord(new ExtendedObject());
assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.nestedCommit(), TwoPhaseOutcome.FINISH_OK);
cr = new CadaverActivationRecord(new ExtendedObject());
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.topLevelAbort(), TwoPhaseOutcome.FINISH_OK);
cr = new CadaverActivationRecord(new ExtendedObject());
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.topLevelCommit(), TwoPhaseOutcome.FINISH_OK);
}
use of com.hp.mwtests.ts.arjuna.resources.ExtendedObject in project narayana by jbosstm.
the class ActivationRecordUnitTest method test.
@Test
public void test() {
AtomicAction A = new AtomicAction();
AtomicAction B = new AtomicAction();
A.begin();
B.begin();
ActivationRecord cr = new ActivationRecord(ObjectType.ANDPERSISTENT, new ExtendedObject(), B);
assertFalse(cr.propagateOnAbort());
assertTrue(cr.propagateOnCommit());
assertEquals(cr.typeIs(), RecordType.ACTIVATION);
assertTrue(cr.type() != null);
assertEquals(cr.doSave(), false);
assertEquals((Integer) cr.value(), new Integer(ObjectType.ANDPERSISTENT));
assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.nestedAbort(), TwoPhaseOutcome.FINISH_OK);
cr = new ActivationRecord(ObjectType.ANDPERSISTENT, new ExtendedObject(), B);
assertEquals(cr.nestedPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
assertEquals(cr.nestedCommit(), TwoPhaseOutcome.FINISH_OK);
B.abort();
cr = new ActivationRecord(ObjectType.ANDPERSISTENT, new ExtendedObject(), A);
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(cr.topLevelAbort(), TwoPhaseOutcome.FINISH_OK);
cr = new ActivationRecord(ObjectType.ANDPERSISTENT, new ExtendedObject(), A);
assertEquals(cr.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(cr.topLevelCommit(), TwoPhaseOutcome.FINISH_OK);
cr = new ActivationRecord();
cr.merge(new ActivationRecord());
cr.alter(new ActivationRecord());
assertTrue(cr.save_state(new OutputObjectState(), ObjectType.ANDPERSISTENT));
assertFalse(cr.restore_state(new InputObjectState(), ObjectType.ANDPERSISTENT));
A.abort();
}
Aggregations