use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_ParallelExecutionRelatedPropertiesWithoutParallelValidationAndParallelRollbackPropertyGiven_ShouldUseParallelCommitValueForParallelValidationAndParallelRollback.
@Test
public void constructor_ParallelExecutionRelatedPropertiesWithoutParallelValidationAndParallelRollbackPropertyGiven_ShouldUseParallelCommitValueForParallelValidationAndParallelRollback() {
// Arrange
Properties props = new Properties();
props.setProperty(ConsensusCommitConfig.PARALLEL_EXECUTOR_COUNT, "100");
props.setProperty(ConsensusCommitConfig.PARALLEL_PREPARATION_ENABLED, "false");
props.setProperty(ConsensusCommitConfig.PARALLEL_COMMIT_ENABLED, "true");
// Act
ConsensusCommitConfig config = new ConsensusCommitConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getParallelExecutorCount()).isEqualTo(100);
assertThat(config.isParallelPreparationEnabled()).isEqualTo(false);
assertThat(config.isParallelValidationEnabled()).isEqualTo(// use the parallel commit value
true);
assertThat(config.isParallelCommitEnabled()).isEqualTo(true);
// use the parallel commit value
assertThat(config.isParallelRollbackEnabled()).isEqualTo(true);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class MultiStorageIntegrationTest method initMultiStorage.
private void initMultiStorage() {
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 to storage1, and from table2 to storage2
props.setProperty(MultiStorageConfig.TABLE_MAPPING, NAMESPACE1 + "." + TABLE1 + ":storage1," + NAMESPACE1 + "." + TABLE2 + ":storage2");
// Define namespace mapping from namespace2 to storage2
props.setProperty(MultiStorageConfig.NAMESPACE_MAPPING, NAMESPACE2 + ":storage2");
// The default storage is storage1
props.setProperty(MultiStorageConfig.DEFAULT_STORAGE, "storage1");
multiStorage = new MultiStorage(new DatabaseConfig(props));
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class JdbcDatabaseSecondaryIndexIntegrationTest 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 JdbcDatabaseSingleClusteringKeyScanIntegrationTest 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 JdbcDatabaseConditionalMutationIntegrationTest method getProperties.
@Override
protected Properties getProperties() {
Properties properties = JdbcEnv.getProperties();
rdbEngine = JdbcUtils.getRdbEngine(new JdbcConfig(new DatabaseConfig(properties)).getJdbcUrl());
return properties;
}
Aggregations