use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class ResourceManagerFailureUnitTest method getUidsCount.
private int getUidsCount() throws Exception {
final RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
InputObjectState states = new InputObjectState();
int counter = 0;
if (recoveryStore.allObjUids(XAResourceRecord.typeName(), states) && states.notempty()) {
while (UidHelper.unpackFrom(states).notEquals(Uid.nullUid())) {
counter++;
}
}
return counter;
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class ServerTransactionUnitTest method test.
@Test
public void test() throws Exception {
ServerTransaction sc = new ServerTransaction(new Uid(), null);
assertTrue(sc.type() != null);
assertTrue(ServerTransaction.typeName() != null);
assertTrue(sc.getSavingUid().notEquals(Uid.nullUid()));
OutputObjectState os = new OutputObjectState();
assertTrue(sc.save_state(os, ObjectType.ANDPERSISTENT));
InputObjectState is = new InputObjectState(os);
assertTrue(sc.restore_state(is, ObjectType.ANDPERSISTENT));
sc.setRecoveryCoordinator(null);
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class ResourceRecordUnitTest method test.
@Test
public void test() throws Exception {
DemoResource res = new DemoResource();
ResourceRecord rec = new ResourceRecord(false, res.getResource(), new Uid());
PrintWriter writer = new PrintWriter(new ByteArrayOutputStream());
rec.print(writer);
assertTrue(rec.resourceHandle() != null);
OutputObjectState os = new OutputObjectState();
assertTrue(rec.save_state(os, ObjectType.ANDPERSISTENT));
InputObjectState is = new InputObjectState(os);
assertTrue(rec.restore_state(is, ObjectType.ANDPERSISTENT));
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class AssumedCompleteHeuristicServerTransactionUnitTest method testSaveAndRestoreState.
@Test
public void testSaveAndRestoreState() throws IOException {
final OutputObjectState outputObjectState = new OutputObjectState();
Assert.assertTrue(transaction.save_state(outputObjectState, ObjectType.ANDPERSISTENT));
final Date lastActiveTime = transaction.getLastActiveTime();
final InputObjectState inputObjectState = new InputObjectState(outputObjectState);
Assert.assertTrue(transaction.restore_state(inputObjectState, ObjectType.ANDPERSISTENT));
Assert.assertEquals(lastActiveTime.getTime(), inputObjectState.unpackLong());
}
use of com.arjuna.ats.arjuna.state.InputObjectState in project narayana by jbosstm.
the class AssumedCompleteUnitTest method testTransaction.
@Test
public void testTransaction() throws Exception {
AssumedCompleteTransaction tx = new AssumedCompleteTransaction(new Uid());
assertEquals(tx.getOriginalStatus(), Status.StatusNoTransaction);
assertTrue(tx.type() != null);
assertEquals(AssumedCompleteTransaction.typeName(), tx.type());
assertTrue(tx.toString() != null);
assertFalse(tx.assumeComplete());
assertEquals(tx.getLastActiveTime(), null);
OutputObjectState os = new OutputObjectState();
assertTrue(tx.save_state(os, ObjectType.ANDPERSISTENT));
InputObjectState is = new InputObjectState(os);
assertTrue(tx.restore_state(is, ObjectType.ANDPERSISTENT));
}
Aggregations