Beispiel #1
0
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;
}
Beispiel #2
0
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);
}