-
Notifications
You must be signed in to change notification settings - Fork 1
Testing against different Storage Backends
We have set up a test infrastructure that allows to run tests automatically against different storage backends. The implementation is also designed to allow tests that require multiple HierarchicalNodeStores
with different backends. This allows to create tests that push/pull between storage backends.
To easiest way to write a test that is capable of running against different storage backends is to extend AbstractHierarchicalNodeStoreTest
. This base class provides a method getNodeStore()
that will return a fresh initialized NodeStore for every test. The store is also cleaned properly after every test.
If you have more complicated use cases (eg. need multiple storages) you can utilize the TestStorageBackends.getConfiguredProviders()
to get all configured TestStorageProvider
s. Don't forget to destroy created backends with TestStorageProvider.destroyStorageBackend
afterwards.
The system property com.dc2f.dstore.test.storageProviders
takes a comma separated list of fully qualified class names of TestStorageProvider
s. If the property is not set tests will only run against HashMapStorageBackend
.
A TestStorageProvider
is capable of creating and destroying backend storages for test purposes. To implement a new StorageBackend
and run all tests against it you only need to implement a TestStorageProvider
that initializes a HierarchicalNodeStore with your backend.