public abstract class KVDatabaseTest extends KVTestSupport
Modifier and Type | Class and Description |
---|---|
class |
KVDatabaseTest.Committer |
class |
KVDatabaseTest.RandomTask |
class |
KVDatabaseTest.Reader |
class |
KVDatabaseTest.Writer |
Modifier and Type | Field and Description |
---|---|
protected ExecutorService |
executor |
protected ExecutorService[] |
threads |
numTransactionAttempts, numTransactionRetries
log, random, validator
Constructor and Description |
---|
KVDatabaseTest() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
allowBothTransactionsToFail() |
protected boolean |
allowsWriteSkewAnomaly() |
protected KVDatabase[][] |
getDBs() |
protected abstract KVDatabase |
getKVDatabase() |
protected int |
getNonconflictingTransactionCount() |
protected int |
getParallelTransactionLoopCount() |
protected int |
getParallelTransactionTaskCount() |
protected int |
getRandomTaskMaxIterations() |
protected int |
getSequentialTransactionLoopCount() |
void |
setupExecutorAndDatabases() |
protected boolean |
supportsMultipleWriteTransactions() |
protected boolean |
supportsReadOnlyAfterDataAccess() |
void |
teardownExecutorAndDatabases() |
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 |
testMultipleThreadsTransaction(KVDatabase store)
This test has multiple threads banging away on a single transaction to verify
that the transaction is thread safe.
|
void |
testNonconflictingTransactions(KVDatabase store) |
void |
testParallelTransactions(KVDatabase store)
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 |
testSequentialTransactions(KVDatabase store)
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 |
transactionsAreThreadSafe() |
createKVTransaction, doCreateTransaction, getNumTries, kv, mapRetryExceptionMessage, s, setupTransactionAttemptCounters, showKV, showKV, stringView, stringView, teardownTransactionAttemptCounters, toXmlString, toXmlString, tryNtimes, tryNtimesWithResult, updateRetryStats
assertEquals, assertEquals, b, ba, buildList, buildMap, buildSet, buildSortedMap, buildSortedSet, checkMap, checkSet, checkValid, createTempDirectory, deleteDirectoryHierarchy, diff, getRandom, randomBytes, randomBytes, readResource, readResource, readResource, s, seedRandom, setUpValidator, show
protected ExecutorService executor
protected ExecutorService[] threads
@BeforeClass(dependsOnGroups="configure") public void setupExecutorAndDatabases() throws Exception
Exception
@AfterClass public void teardownExecutorAndDatabases() throws Exception
Exception
@DataProvider(name="kvdbs") protected KVDatabase[][] getDBs()
protected abstract KVDatabase getKVDatabase()
protected int getNonconflictingTransactionCount()
protected int getParallelTransactionLoopCount()
protected int getParallelTransactionTaskCount()
protected int getSequentialTransactionLoopCount()
protected int getRandomTaskMaxIterations()
protected boolean allowsWriteSkewAnomaly()
protected boolean supportsReadOnlyAfterDataAccess()
protected boolean allowBothTransactionsToFail()
protected boolean transactionsAreThreadSafe()
protected boolean supportsMultipleWriteTransactions()
public void testSimpleStuff(KVDatabase store) throws Exception
Exception
public void testReadOnly(KVDatabase store) throws Exception
Exception
public void testSortOrder(KVDatabase store) throws Exception
Exception
public void testKeyWatch(KVDatabase store) throws Exception
Exception
public void testReadWriteConflict(KVDatabase store) throws Exception
Exception
public void testWriteSkewAnomaly(KVDatabase store) throws Exception
Exception
protected void testConflictingTransactions(KVDatabase store, String name, io.permazen.kv.test.KVDatabaseTest.Conflictor conflictor, KVPair expected1, KVPair expected2) throws Exception
Exception
public void testNonconflictingTransactions(KVDatabase store) throws Exception
Exception
public void testParallelTransactions(KVDatabase store) throws Exception
store
- underlying storeException
- if an error occurspublic void testParallelTransactions(KVDatabase[] stores) throws Exception
Exception
public void testSequentialTransactions(KVDatabase store) throws Exception
store
- underlying storeException
- if an error occurspublic void testMultipleThreadsTransaction(KVDatabase store) throws Exception
store
- underlying storeException
- if an error occurspublic void testApplyMutations(KVDatabase store) throws Exception
store
- databaseException
- if an error occursCopyright © 2022. All rights reserved.