use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_PropertiesWithDeprecatedIsolationLevelGiven_ShouldLoadProperly.
@Test
public void constructor_PropertiesWithDeprecatedIsolationLevelGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty("scalar.db.isolation_level", Isolation.SERIALIZABLE.toString());
// Act
ConsensusCommitConfig config = new ConsensusCommitConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getIsolation()).isEqualTo(Isolation.SERIALIZABLE);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_UnsupportedSerializableStrategyGiven_ShouldThrowIllegalArgumentException.
@Test
public void constructor_UnsupportedSerializableStrategyGiven_ShouldThrowIllegalArgumentException() {
// Arrange
Properties props = new Properties();
props.setProperty(ConsensusCommitConfig.SERIALIZABLE_STRATEGY, "NO_STRATEGY");
// Act Assert
assertThatThrownBy(() -> new ConsensusCommitConfig(new DatabaseConfig(props))).isInstanceOf(IllegalArgumentException.class);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_UnsupportedIsolationGiven_ShouldThrowIllegalArgumentException.
@Test
public void constructor_UnsupportedIsolationGiven_ShouldThrowIllegalArgumentException() {
// Arrange
Properties props = new Properties();
props.setProperty(ConsensusCommitConfig.ISOLATION_LEVEL, "READ_COMMITTED");
// Act Assert
assertThatThrownBy(() -> new ConsensusCommitConfig(new DatabaseConfig(props))).isInstanceOf(IllegalArgumentException.class);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_ParallelExecutionRelatedPropertiesGiven_ShouldLoadProperly.
@Test
public void constructor_ParallelExecutionRelatedPropertiesGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(ConsensusCommitConfig.PARALLEL_EXECUTOR_COUNT, "100");
props.setProperty(ConsensusCommitConfig.PARALLEL_PREPARATION_ENABLED, "true");
props.setProperty(ConsensusCommitConfig.PARALLEL_VALIDATION_ENABLED, "true");
props.setProperty(ConsensusCommitConfig.PARALLEL_COMMIT_ENABLED, "true");
props.setProperty(ConsensusCommitConfig.PARALLEL_ROLLBACK_ENABLED, "true");
// Act
ConsensusCommitConfig config = new ConsensusCommitConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getParallelExecutorCount()).isEqualTo(100);
assertThat(config.isParallelPreparationEnabled()).isEqualTo(true);
assertThat(config.isParallelValidationEnabled()).isEqualTo(true);
assertThat(config.isParallelCommitEnabled()).isEqualTo(true);
assertThat(config.isParallelRollbackEnabled()).isEqualTo(true);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_NoPropertiesGiven_ShouldLoadAsDefaultValues.
@Test
public void constructor_NoPropertiesGiven_ShouldLoadAsDefaultValues() {
// Arrange
Properties props = new Properties();
// Act
ConsensusCommitConfig config = new ConsensusCommitConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getIsolation()).isEqualTo(Isolation.SNAPSHOT);
assertThat(config.getSerializableStrategy()).isEqualTo(SerializableStrategy.EXTRA_READ);
assertThat(config.getCoordinatorNamespace()).isNotPresent();
assertThat(config.getParallelExecutorCount()).isEqualTo(ConsensusCommitConfig.DEFAULT_PARALLEL_EXECUTOR_COUNT);
assertThat(config.isParallelPreparationEnabled()).isEqualTo(false);
assertThat(config.isParallelValidationEnabled()).isEqualTo(false);
assertThat(config.isParallelCommitEnabled()).isEqualTo(false);
assertThat(config.isParallelRollbackEnabled()).isEqualTo(false);
assertThat(config.isAsyncCommitEnabled()).isEqualTo(false);
assertThat(config.isAsyncRollbackEnabled()).isEqualTo(false);
}
Aggregations