use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class JdbcDatabaseMultipleClusteringKeyScanIntegrationTest 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 JdbcDatabaseColumnValueIntegrationTest 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 JdbcDatabaseMultiplePartitionKeyIntegrationTest 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 JdbcConfigTest method constructor_PropertiesWithInvalidTableMetadataConnectionPoolPropertiesGiven_ShouldThrowIllegalArgumentException.
@Test
public void constructor_PropertiesWithInvalidTableMetadataConnectionPoolPropertiesGiven_ShouldThrowIllegalArgumentException() {
// Arrange
Properties props = new Properties();
props.setProperty(DatabaseConfig.CONTACT_POINTS, ANY_JDBC_URL);
props.setProperty(DatabaseConfig.USERNAME, ANY_USERNAME);
props.setProperty(DatabaseConfig.PASSWORD, ANY_PASSWORD);
props.setProperty(DatabaseConfig.STORAGE, JDBC_STORAGE);
props.setProperty(JdbcConfig.TABLE_METADATA_CONNECTION_POOL_MIN_IDLE, "aaa");
props.setProperty(JdbcConfig.TABLE_METADATA_CONNECTION_POOL_MAX_IDLE, "bbb");
props.setProperty(JdbcConfig.TABLE_METADATA_CONNECTION_POOL_MAX_TOTAL, "ccc");
// Act Assert
assertThatThrownBy(() -> new JdbcConfig(new DatabaseConfig(props))).isInstanceOf(IllegalArgumentException.class);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class JdbcConfigTest method constructor_AllPropertiesGiven_ShouldLoadProperly.
@Test
public void constructor_AllPropertiesGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(DatabaseConfig.CONTACT_POINTS, ANY_JDBC_URL);
props.setProperty(DatabaseConfig.USERNAME, ANY_USERNAME);
props.setProperty(DatabaseConfig.PASSWORD, ANY_PASSWORD);
props.setProperty(DatabaseConfig.STORAGE, JDBC_STORAGE);
props.setProperty(JdbcConfig.CONNECTION_POOL_MIN_IDLE, "1");
props.setProperty(JdbcConfig.CONNECTION_POOL_MAX_IDLE, "100");
props.setProperty(JdbcConfig.CONNECTION_POOL_MAX_TOTAL, "500");
props.setProperty(JdbcConfig.PREPARED_STATEMENTS_POOL_ENABLED, "true");
props.setProperty(JdbcConfig.PREPARED_STATEMENTS_POOL_MAX_OPEN, "300");
props.setProperty(JdbcConfig.ISOLATION_LEVEL, Isolation.SERIALIZABLE.name());
props.setProperty(JdbcConfig.TABLE_METADATA_SCHEMA, ANY_TABLE_METADATA_SCHEMA);
props.setProperty(JdbcConfig.TABLE_METADATA_CONNECTION_POOL_MIN_IDLE, "100");
props.setProperty(JdbcConfig.TABLE_METADATA_CONNECTION_POOL_MAX_IDLE, "200");
props.setProperty(JdbcConfig.TABLE_METADATA_CONNECTION_POOL_MAX_TOTAL, "300");
props.setProperty(JdbcConfig.ADMIN_CONNECTION_POOL_MIN_IDLE, "50");
props.setProperty(JdbcConfig.ADMIN_CONNECTION_POOL_MAX_IDLE, "150");
props.setProperty(JdbcConfig.ADMIN_CONNECTION_POOL_MAX_TOTAL, "200");
// Act
JdbcConfig config = new JdbcConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getJdbcUrl()).isEqualTo(ANY_JDBC_URL);
assertThat(config.getUsername().isPresent()).isTrue();
assertThat(config.getUsername().get()).isEqualTo(ANY_USERNAME);
assertThat(config.getPassword().isPresent()).isTrue();
assertThat(config.getPassword().get()).isEqualTo(ANY_PASSWORD);
assertThat(config.getConnectionPoolMinIdle()).isEqualTo(1);
assertThat(config.getConnectionPoolMaxIdle()).isEqualTo(100);
assertThat(config.getConnectionPoolMaxTotal()).isEqualTo(500);
assertThat(config.isPreparedStatementsPoolEnabled()).isEqualTo(true);
assertThat(config.getPreparedStatementsPoolMaxOpen()).isEqualTo(300);
assertThat(config.getIsolation()).isPresent();
assertThat(config.getIsolation().get()).isEqualTo(Isolation.SERIALIZABLE);
assertThat(config.getTableMetadataSchema()).isPresent();
assertThat(config.getTableMetadataSchema().get()).isEqualTo(ANY_TABLE_METADATA_SCHEMA);
assertThat(config.getTableMetadataConnectionPoolMinIdle()).isEqualTo(100);
assertThat(config.getTableMetadataConnectionPoolMaxIdle()).isEqualTo(200);
assertThat(config.getTableMetadataConnectionPoolMaxTotal()).isEqualTo(300);
assertThat(config.getAdminConnectionPoolMinIdle()).isEqualTo(50);
assertThat(config.getAdminConnectionPoolMaxIdle()).isEqualTo(150);
assertThat(config.getAdminConnectionPoolMaxTotal()).isEqualTo(200);
}
Aggregations