use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class JdbcConfigTest method constructor_PropertiesWithWrongStorage_ShouldThrowIllegalArgumentException.
@Test
public void constructor_PropertiesWithWrongStorage_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, "aaa");
// 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_PropertiesWithInvalidConnectionPoolPropertiesGiven_ShouldThrowIllegalArgumentException.
@Test
public void constructor_PropertiesWithInvalidConnectionPoolPropertiesGiven_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.CONNECTION_POOL_MIN_IDLE, "aaa");
props.setProperty(JdbcConfig.CONNECTION_POOL_MAX_IDLE, "bbb");
props.setProperty(JdbcConfig.CONNECTION_POOL_MAX_TOTAL, "ccc");
props.setProperty(JdbcConfig.PREPARED_STATEMENTS_POOL_ENABLED, "ddd");
props.setProperty(JdbcConfig.PREPARED_STATEMENTS_POOL_MAX_OPEN, "eee");
// 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_PropertiesWithInvalidIsolationLevelGiven_ShouldThrowIllegalArgumentException.
@Test
public void constructor_PropertiesWithInvalidIsolationLevelGiven_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.ISOLATION_LEVEL, "aaa");
// 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 CosmosConfigTest method constructor_WithoutTableMetadataDatabase_ShouldLoadProperly.
@Test
public void constructor_WithoutTableMetadataDatabase_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(DatabaseConfig.CONTACT_POINTS, ANY_ENDPOINT);
props.setProperty(DatabaseConfig.PASSWORD, ANY_KEY);
props.setProperty(DatabaseConfig.STORAGE, COSMOS_STORAGE);
// Act
CosmosConfig config = new CosmosConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getEndpoint()).isEqualTo(ANY_ENDPOINT);
assertThat(config.getKey()).isEqualTo(ANY_KEY);
assertThat(config.getTableMetadataDatabase()).isNotPresent();
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class CosmosConfigTest method constructor_AllPropertiesGiven_ShouldLoadProperly.
@Test
public void constructor_AllPropertiesGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(DatabaseConfig.CONTACT_POINTS, ANY_ENDPOINT);
props.setProperty(DatabaseConfig.PASSWORD, ANY_KEY);
props.setProperty(DatabaseConfig.STORAGE, COSMOS_STORAGE);
props.setProperty(CosmosConfig.TABLE_METADATA_DATABASE, ANY_TABLE_METADATA_DATABASE);
// Act
CosmosConfig config = new CosmosConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getEndpoint()).isEqualTo(ANY_ENDPOINT);
assertThat(config.getKey()).isEqualTo(ANY_KEY);
assertThat(config.getTableMetadataDatabase()).isPresent();
assertThat(config.getTableMetadataDatabase().get()).isEqualTo(ANY_TABLE_METADATA_DATABASE);
}
Aggregations