use of org.aion.db.impl.mockdb.MockDBDriver in project aion by aionnetwork.
the class MockDBDriverTest method setUp.
@Before
public void setUp() {
vendor = DBVendor.MOCKDB;
driver = new MockDBDriver();
props = new Properties();
props.setProperty("db_type", vendor.toValue());
props.setProperty("db_name", "test");
db = null;
}
use of org.aion.db.impl.mockdb.MockDBDriver in project aion by aionnetwork.
the class DatabaseFactoryTest method testDriverReturnDatabase.
// It should return an instance of the DB given the correct properties
@Test
public void testDriverReturnDatabase() {
Properties props = new Properties();
props.setProperty("db_name", dbName + DatabaseTestUtils.getNext());
props.setProperty("db_path", dbPath);
// MOCKDB
props.setProperty("db_type", DBVendor.MOCKDB.toValue());
IByteArrayKeyValueDatabase db = DatabaseFactory.connect(props);
// System.out.println(db.getClass().getName());
assertNotNull(db);
// LEVELDB
props.setProperty("db_type", DBVendor.LEVELDB.toValue());
props.setProperty(DatabaseFactory.PROP_MAX_FD_ALLOC, String.valueOf(LevelDBConstants.MAX_OPEN_FILES));
props.setProperty(DatabaseFactory.PROP_BLOCK_SIZE, String.valueOf(LevelDBConstants.BLOCK_SIZE));
props.setProperty(DatabaseFactory.PROP_WRITE_BUFFER_SIZE, String.valueOf(LevelDBConstants.WRITE_BUFFER_SIZE));
props.setProperty(DatabaseFactory.PROP_CACHE_SIZE, String.valueOf(LevelDBConstants.CACHE_SIZE));
db = DatabaseFactory.connect(props);
// System.out.println(db.getClass().getName());
assertNotNull(db);
// H2
props.setProperty("db_type", DBVendor.H2.toValue());
db = DatabaseFactory.connect(props);
// System.out.println(db.getClass().getName());
assertNotNull(db);
// MockDBDriver class
props.setProperty("db_type", MockDBDriver.class.getName());
db = DatabaseFactory.connect(props);
// System.out.println(db.getClass().getName());
assertNotNull(db);
}
Aggregations