Package io.permazen.kv.test
Class KVDatabaseTest
java.lang.Object
io.permazen.test.TestSupport
io.permazen.kv.test.KVTestSupport
io.permazen.kv.test.KVDatabaseTest
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
class
class
-
Field Summary
Fields inherited from class io.permazen.kv.test.KVTestSupport
numTransactionAttempts, numTransactionRetries
Fields inherited from class io.permazen.test.TestSupport
log, random, validator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
protected boolean
protected KVDatabase[][]
getDBs()
protected abstract KVDatabase
protected int
protected int
protected int
protected int
protected int
void
protected boolean
protected boolean
void
void
testApplyMutations
(KVDatabase store) Test KVStore.apply().protected void
testConflictingTransactions
(KVDatabase store, String name, io.permazen.kv.test.KVDatabaseTest.Conflictor conflictor, KVPair expected1, KVPair expected2) void
testKeyWatch
(KVDatabase store) void
This test has multiple threads banging away on a single transaction to verify that the transaction is thread safe.void
void
This test runs transactions in parallel and verifies there is no "leakage" between them.void
testParallelTransactions
(KVDatabase[] stores) void
testReadOnly
(KVDatabase store) void
testReadWriteConflict
(KVDatabase store) void
This test runs transactions sequentially and verifies that each transaction sees the changes that were committed in the previous transaction.void
testSimpleStuff
(KVDatabase store) void
testSortOrder
(KVDatabase store) void
testWriteSkewAnomaly
(KVDatabase store) protected boolean
Methods inherited from class io.permazen.kv.test.KVTestSupport
createKVTransaction, doCreateTransaction, getNumTries, kv, mapRetryExceptionMessage, s, setupTransactionAttemptCounters, showKV, showKV, stringView, stringView, teardownTransactionAttemptCounters, toXmlString, toXmlString, tryNtimes, tryNtimesWithResult, updateRetryStats
Methods inherited from class io.permazen.test.TestSupport
assertEquals, assertEquals, assertSameOrDiff, b, ba, buildList, buildMap, buildSet, buildSortedMap, buildSortedSet, checkMap, checkSet, checkValid, createTempDirectory, deleteDirectoryHierarchy, diff, getRandom, randomBytes, randomBytes, readResource, readResource, readResource, s, seedRandom, setUpValidator, show
-
Field Details
-
executor
-
threads
-
-
Constructor Details
-
KVDatabaseTest
public KVDatabaseTest()
-
-
Method Details
-
setupExecutorAndDatabases
- Throws:
Exception
-
teardownExecutorAndDatabases
- Throws:
Exception
-
getDBs
-
getKVDatabase
-
getNonconflictingTransactionCount
protected int getNonconflictingTransactionCount() -
getParallelTransactionLoopCount
protected int getParallelTransactionLoopCount() -
getParallelTransactionTaskCount
protected int getParallelTransactionTaskCount() -
getSequentialTransactionLoopCount
protected int getSequentialTransactionLoopCount() -
getRandomTaskMaxIterations
protected int getRandomTaskMaxIterations() -
allowsWriteSkewAnomaly
protected boolean allowsWriteSkewAnomaly() -
supportsReadOnlyAfterDataAccess
protected boolean supportsReadOnlyAfterDataAccess() -
allowBothTransactionsToFail
protected boolean allowBothTransactionsToFail() -
transactionsAreThreadSafe
protected boolean transactionsAreThreadSafe() -
supportsMultipleWriteTransactions
protected boolean supportsMultipleWriteTransactions() -
testSimpleStuff
- Throws:
Exception
-
testReadOnly
- Throws:
Exception
-
testSortOrder
- Throws:
Exception
-
testKeyWatch
- Throws:
Exception
-
testReadWriteConflict
- Throws:
Exception
-
testWriteSkewAnomaly
- Throws:
Exception
-
testConflictingTransactions
protected void testConflictingTransactions(KVDatabase store, String name, io.permazen.kv.test.KVDatabaseTest.Conflictor conflictor, KVPair expected1, KVPair expected2) throws Exception - Throws:
Exception
-
testNonconflictingTransactions
- Throws:
Exception
-
testParallelTransactions
This test runs transactions in parallel and verifies there is no "leakage" between them. Database must be configured for linearizable isolation.- Parameters:
store
- underlying store- Throws:
Exception
- if an error occurs
-
testParallelTransactions
- Throws:
Exception
-
testSequentialTransactions
This test runs transactions sequentially and verifies that each transaction sees the changes that were committed in the previous transaction.- Parameters:
store
- underlying store- Throws:
Exception
- if an error occurs
-
testMultipleThreadsTransaction
This test has multiple threads banging away on a single transaction to verify that the transaction is thread safe.- Parameters:
store
- underlying store- Throws:
Exception
- if an error occurs
-
testApplyMutations
Test KVStore.apply().- Parameters:
store
- database- Throws:
Exception
- if an error occurs
-