void sessionmanager_4() { DBRM dbrm; SessionManagerServer::TxnID txn, txn2; const SessionManagerServer::SIDTIDEntry *stmap; int len; txn = dbrm.newTxnID(1000, true); txn2 = dbrm.newTxnID(1001, true); stmap = dbrm.SIDTIDMap(len); CPPUNIT_ASSERT(len == 2); #ifdef BRM_VERBOSE int i; cerr << "len = " << len << endl; for (i = 0; i < len; i++) { cerr << " " << i << ": txnid=" << stmap[i].txnid.id << " valid=" << stmap[i].txnid.valid << " sessionid=" << stmap[i].sessionid << endl; } #endif dbrm.committed(txn); dbrm.committed(txn2); delete [] stmap; stmap = dbrm.SIDTIDMap(len); CPPUNIT_ASSERT(len == 0); delete [] stmap; }
void sessionmanager_3() { DBRM dbrm; SessionManagerServer::TxnID txn, txn2; txn = dbrm.newTxnID(1000, true); txn2 = dbrm.getTxnID(1000); CPPUNIT_ASSERT(txn.id == txn2.id); CPPUNIT_ASSERT(txn.valid == txn2.valid == true); dbrm.rolledback(txn); CPPUNIT_ASSERT(txn.valid == false); txn2 = dbrm.getTxnID(1000); CPPUNIT_ASSERT(txn2.valid == false); }
void sessionmanager_2() { DBRM dbrm; SessionManagerServer::TxnID tmp; int ver1, ver2; ver1 = dbrm.verID(); tmp = dbrm.newTxnID(1000, true); ver2 = dbrm.verID(); CPPUNIT_ASSERT(ver2 == ver1 + 1); CPPUNIT_ASSERT(ver2 == tmp.id); CPPUNIT_ASSERT(tmp.valid == true); dbrm.committed(tmp); CPPUNIT_ASSERT(tmp.valid == false); }