*/
public void testNullLockMode()
throws DatabaseException {
SecondaryDatabase secDb = initDb();
Database priDb = secDb.getPrimaryDatabase();
Transaction txn = txnBegin();
DatabaseEntry key = entry(0);
DatabaseEntry data = entry(0);
DatabaseEntry secKey = entry(KEY_OFFSET);
DatabaseEntry found = new DatabaseEntry();
DatabaseEntry found2 = new DatabaseEntry();
DatabaseEntry found3 = new DatabaseEntry();
assertEquals(OperationStatus.SUCCESS,
priDb.put(txn, key, data));
assertEquals(OperationStatus.SUCCESS,
priDb.put(txn, entry(1), data));
assertEquals(OperationStatus.SUCCESS,
priDb.put(txn, entry(2), entry(2)));
/* Database operations. */
assertEquals(OperationStatus.SUCCESS,
priDb.get(txn, key, found, null));
assertEquals(OperationStatus.SUCCESS,
priDb.getSearchBoth(txn, key, data, null));
assertEquals(OperationStatus.SUCCESS,
secDb.get(txn, secKey, found, null));
assertEquals(OperationStatus.SUCCESS,
secDb.get(txn, secKey, found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secDb.getSearchBoth(txn, secKey, key, found, null));
/* Cursor operations. */
txnCommit(txn);
txn = txnBeginCursor();
Cursor cursor = priDb.openCursor(txn, null);
SecondaryCursor secCursor = secDb.openSecondaryCursor(txn, null);
assertEquals(OperationStatus.SUCCESS,
cursor.getSearchKey(key, found, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getSearchBoth(key, data, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getSearchKeyRange(key, found, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getSearchBothRange(key, data, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getFirst(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getNext(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getPrev(found, found2, null));
assertEquals(OperationStatus.NOTFOUND,
cursor.getNextDup(found, found2, null));
assertEquals(OperationStatus.NOTFOUND,
cursor.getPrevDup(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getNextNoDup(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getPrevNoDup(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
cursor.getLast(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getSearchKey(secKey, found, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getSearchKeyRange(secKey, found, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getFirst(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getNext(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getPrev(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getNextDup(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getPrevDup(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getNextNoDup(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getPrevNoDup(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getLast(found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getSearchKey(secKey, found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getSearchBoth(secKey, data, found, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getSearchKeyRange(secKey, found, found2, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getSearchBothRange(secKey, data, found, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getFirst(found, found2, found3, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getNext(found, found2, found3, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getPrev(found, found2, found3, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getNextDup(found, found2, found3, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getPrevDup(found, found2, found3, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getNextNoDup(found, found2, found3, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getPrevNoDup(found, found2, found3, null));
assertEquals(OperationStatus.SUCCESS,
secCursor.getLast(found, found2, found3, null));
secCursor.close();
cursor.close();
txnCommit(txn);
secDb.close();
priDb.close();
env.close();
env = null;
}