Search in sources :

Example 1 with RocksDBConnectionFactory

use of com.jd.blockchain.storage.service.impl.rocksdb.RocksDBConnectionFactory in project jdchain-core by blockchain-jd-com.

the class RocksDBStorageTest method test.

@Test
public void test() {
    String dbUri = initEmptyDB("rocksdb_storage_test");
    long expectedVersion;
    try (DbConnectionFactory dbConnFactory = new RocksDBConnectionFactory()) {
        DbConnection conn = dbConnFactory.connect(dbUri);
        VersioningKVStorage verStorage = conn.getStorageService().getVersioningKVStorage();
        ExPolicyKVStorage exStorage = conn.getStorageService().getExPolicyKVStorage();
        expectedVersion = test(verStorage);
        test(exStorage);
    }
    try (DbConnectionFactory dbConnFactory = new RocksDBConnectionFactory()) {
        DbConnection conn = dbConnFactory.connect(dbUri);
        VersioningKVStorage verStorage = conn.getStorageService().getVersioningKVStorage();
        ExPolicyKVStorage exStorage = conn.getStorageService().getExPolicyKVStorage();
        testAfterReload(verStorage, expectedVersion);
        testAfterReload(exStorage);
    }
}
Also used : ExPolicyKVStorage(com.jd.blockchain.storage.service.ExPolicyKVStorage) VersioningKVStorage(com.jd.blockchain.storage.service.VersioningKVStorage) DbConnectionFactory(com.jd.blockchain.storage.service.DbConnectionFactory) RocksDBConnectionFactory(com.jd.blockchain.storage.service.impl.rocksdb.RocksDBConnectionFactory) DbConnection(com.jd.blockchain.storage.service.DbConnection) Test(org.junit.Test)

Aggregations

DbConnection (com.jd.blockchain.storage.service.DbConnection)1 DbConnectionFactory (com.jd.blockchain.storage.service.DbConnectionFactory)1 ExPolicyKVStorage (com.jd.blockchain.storage.service.ExPolicyKVStorage)1 VersioningKVStorage (com.jd.blockchain.storage.service.VersioningKVStorage)1 RocksDBConnectionFactory (com.jd.blockchain.storage.service.impl.rocksdb.RocksDBConnectionFactory)1 Test (org.junit.Test)1