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
Nested ClassesModifier and TypeClassDescriptionclassclassclassclass -
Field Summary
FieldsFields inherited from class io.permazen.kv.test.KVTestSupport
numTransactionAttempts, numTransactionRetriesFields inherited from class io.permazen.test.TestSupport
log, random, validator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected booleanprotected KVDatabase[][]getDBs()protected abstract KVDatabaseprotected intprotected intprotected intprotected intprotected intvoidprotected booleanprotected booleanvoidvoidtestApplyMutations(KVDatabase store) Test KVStore.apply().protected voidtestConflictingTransactions(KVDatabase store, String name, io.permazen.kv.test.KVDatabaseTest.Conflictor conflictor, KVPair expected1, KVPair expected2) voidtestKeyWatch(KVDatabase store) voidThis test has multiple threads banging away on a single transaction to verify that the transaction is thread safe.voidvoidThis test runs transactions in parallel and verifies there is no "leakage" between them.voidtestParallelTransactions(KVDatabase[] stores) voidtestReadOnly(KVDatabase store) voidtestReadWriteConflict(KVDatabase store) voidThis test runs transactions sequentially and verifies that each transaction sees the changes that were committed in the previous transaction.voidtestSimpleStuff(KVDatabase store) voidtestSortOrder(KVDatabase store) voidtestWriteSkewAnomaly(KVDatabase store) protected booleanMethods inherited from class io.permazen.kv.test.KVTestSupport
b, createKVTransaction, doCreateTransaction, getNumTries, kv, mapRetryExceptionMessage, s, s, setupTransactionAttemptCounters, showKV, showKV, stringView, stringView, teardownTransactionAttemptCounters, toXmlString, toXmlString, tryNtimes, tryNtimesWithResult, updateRetryStatsMethods inherited from class io.permazen.test.TestSupport
assertEquals, assertEquals, assertSameOrDiff, buildList, buildMap, buildSet, buildSortedMap, buildSortedSet, checkMap, checkSet, checkValid, createTempDirectory, deleteDirectoryHierarchy, diff, getRandom, readResource, readResource, readResource, 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
-