use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class JdbcDatabaseSinglePartitionKeyIntegrationTest method getProperties.
@Override
protected Properties getProperties() {
Properties properties = JdbcEnv.getProperties();
rdbEngine = JdbcUtils.getRdbEngine(new JdbcConfig(new DatabaseConfig(properties)).getJdbcUrl());
return properties;
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class MultiStorageAdminIntegrationTest method initMultiStorageAdmin.
private void initMultiStorageAdmin() {
Properties props = new Properties();
props.setProperty(DatabaseConfig.STORAGE, "multi-storage");
// Define storages, storage1 and storage2
props.setProperty(MultiStorageConfig.STORAGES, "storage1,storage2");
Properties propertiesForStorage1 = MultiStorageEnv.getPropertiesForStorage1();
props.setProperty(MultiStorageConfig.STORAGES + ".storage1.storage", propertiesForStorage1.getProperty(DatabaseConfig.STORAGE));
props.setProperty(MultiStorageConfig.STORAGES + ".storage1.contact_points", propertiesForStorage1.getProperty(DatabaseConfig.CONTACT_POINTS));
if (propertiesForStorage1.containsValue(DatabaseConfig.CONTACT_PORT)) {
props.setProperty(MultiStorageConfig.STORAGES + ".storage1.contact_port", propertiesForStorage1.getProperty(DatabaseConfig.CONTACT_PORT));
}
props.setProperty(MultiStorageConfig.STORAGES + ".storage1.username", propertiesForStorage1.getProperty(DatabaseConfig.USERNAME));
props.setProperty(MultiStorageConfig.STORAGES + ".storage1.password", propertiesForStorage1.getProperty(DatabaseConfig.PASSWORD));
Properties propertiesForStorage2 = MultiStorageEnv.getPropertiesForStorage2();
props.setProperty(MultiStorageConfig.STORAGES + ".storage2.storage", propertiesForStorage2.getProperty(DatabaseConfig.STORAGE));
props.setProperty(MultiStorageConfig.STORAGES + ".storage2.contact_points", propertiesForStorage2.getProperty(DatabaseConfig.CONTACT_POINTS));
if (propertiesForStorage2.containsValue(DatabaseConfig.CONTACT_PORT)) {
props.setProperty(MultiStorageConfig.STORAGES + ".storage2.contact_port", propertiesForStorage2.getProperty(DatabaseConfig.CONTACT_PORT));
}
props.setProperty(MultiStorageConfig.STORAGES + ".storage2.username", propertiesForStorage2.getProperty(DatabaseConfig.USERNAME));
props.setProperty(MultiStorageConfig.STORAGES + ".storage2.password", propertiesForStorage2.getProperty(DatabaseConfig.PASSWORD));
// Define table mapping from table1 in namespace1 to storage1, and from table2 in namespace1 to
// storage2
props.setProperty(MultiStorageConfig.TABLE_MAPPING, NAMESPACE1 + "." + TABLE1 + ":storage1," + NAMESPACE1 + "." + TABLE2 + ":storage2");
// Define namespace mapping from namespace2 and namespace3 to storage2
props.setProperty(MultiStorageConfig.NAMESPACE_MAPPING, NAMESPACE2 + ":storage2," + NAMESPACE3 + ":storage2");
// The default storage is storage1
props.setProperty(MultiStorageConfig.DEFAULT_STORAGE, "storage1");
multiStorageAdmin = new MultiStorageAdmin(new DatabaseConfig(props));
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitIntegrationTestBase method setUp.
@Before
public void setUp() throws Exception {
if (!initialized) {
initialize();
DatabaseConfig config = TestUtils.addSuffix(getDatabaseConfig(), TEST_NAME);
StorageFactory factory = new StorageFactory(config);
admin = factory.getAdmin();
consensusCommitConfig = new ConsensusCommitConfig(config.getProperties());
consensusCommitAdmin = new ConsensusCommitAdmin(admin, consensusCommitConfig);
namespace1 = getNamespace1();
namespace2 = getNamespace2();
createTables();
originalStorage = factory.getStorage();
parallelExecutor = new ParallelExecutor(consensusCommitConfig);
initialized = true;
}
truncateTables();
storage = spy(originalStorage);
coordinator = spy(new Coordinator(storage, consensusCommitConfig));
TransactionalTableMetadataManager tableMetadataManager = new TransactionalTableMetadataManager(admin, -1);
recovery = spy(new RecoveryHandler(storage, coordinator, tableMetadataManager));
commit = spy(new CommitHandler(storage, coordinator, tableMetadataManager, parallelExecutor));
manager = new ConsensusCommitManager(storage, admin, consensusCommitConfig, coordinator, parallelExecutor, recovery, commit);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class MultiStorageEnv method getDatabaseConfigForStorage2.
public static DatabaseConfig getDatabaseConfigForStorage2() {
String contactPoints = System.getProperty(PROP_STORAGE2_CONTACT_POINTS, DEFAULT_STORAGE2_CONTACT_POINT);
String contactPort = System.getProperty(PROP_STORAGE2_CONTACT_PORT);
String username = System.getProperty(PROP_STORAGE2_USERNAME, DEFAULT_STORAGE2_USERNAME);
String password = System.getProperty(PROP_STORAGE2_PASSWORD, DEFAULT_STORAGE2_PASSWORD);
String storage = System.getProperty(PROP_STORAGE2_STORAGE, DEFAULT_STORAGE2_STORAGE);
Properties properties = new Properties();
properties.setProperty(DatabaseConfig.CONTACT_POINTS, contactPoints);
if (contactPort != null) {
properties.setProperty(DatabaseConfig.CONTACT_PORT, contactPort);
}
properties.setProperty(DatabaseConfig.USERNAME, username);
properties.setProperty(DatabaseConfig.PASSWORD, password);
properties.setProperty(DatabaseConfig.STORAGE, storage);
return new DatabaseConfig(properties);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class MultiStorageEnv method getDatabaseConfigForStorage1.
public static DatabaseConfig getDatabaseConfigForStorage1() {
String contactPoints = System.getProperty(PROP_STORAGE1_CONTACT_POINTS, DEFAULT_STORAGE1_CONTACT_POINT);
String contactPort = System.getProperty(PROP_STORAGE1_CONTACT_PORT);
String username = System.getProperty(PROP_STORAGE1_USERNAME, DEFAULT_STORAGE1_USERNAME);
String password = System.getProperty(PROP_STORAGE1_PASSWORD, DEFAULT_STORAGE1_PASSWORD);
String storage = System.getProperty(PROP_STORAGE1_STORAGE, DEFAULT_STORAGE1_STORAGE);
Properties properties = new Properties();
properties.setProperty(DatabaseConfig.CONTACT_POINTS, contactPoints);
if (contactPort != null) {
properties.setProperty(DatabaseConfig.CONTACT_PORT, contactPort);
}
properties.setProperty(DatabaseConfig.USERNAME, username);
properties.setProperty(DatabaseConfig.PASSWORD, password);
properties.setProperty(DatabaseConfig.STORAGE, storage);
return new DatabaseConfig(properties);
}
Aggregations