use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_AsyncExecutionRelatedPropertiesWithoutAsyncRollbackPropertyGiven_ShouldUseAsyncCommitValueForAsyncRollback.
@Test
public void constructor_AsyncExecutionRelatedPropertiesWithoutAsyncRollbackPropertyGiven_ShouldUseAsyncCommitValueForAsyncRollback() {
// Arrange
Properties props = new Properties();
props.setProperty(ConsensusCommitConfig.ASYNC_COMMIT_ENABLED, "true");
// Act
ConsensusCommitConfig config = new ConsensusCommitConfig(new DatabaseConfig(props));
// Assert
assertThat(config.isAsyncCommitEnabled()).isEqualTo(true);
// use the async commit value
assertThat(config.isAsyncRollbackEnabled()).isEqualTo(true);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_PropertiesWithSerializableStrategyGiven_ShouldLoadProperly.
@Test
public void constructor_PropertiesWithSerializableStrategyGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(ConsensusCommitConfig.SERIALIZABLE_STRATEGY, SerializableStrategy.EXTRA_WRITE.toString());
// Act
ConsensusCommitConfig config = new ConsensusCommitConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getSerializableStrategy()).isEqualTo(SerializableStrategy.EXTRA_WRITE);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitConfigTest method constructor_AsyncExecutionRelatedPropertiesGiven_ShouldLoadProperly.
@Test
public void constructor_AsyncExecutionRelatedPropertiesGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(ConsensusCommitConfig.ASYNC_COMMIT_ENABLED, "true");
props.setProperty(ConsensusCommitConfig.ASYNC_ROLLBACK_ENABLED, "true");
// Act
ConsensusCommitConfig config = new ConsensusCommitConfig(new DatabaseConfig(props));
// Assert
assertThat(config.isAsyncCommitEnabled()).isEqualTo(true);
assertThat(config.isAsyncRollbackEnabled()).isEqualTo(true);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class SchemaLoaderIntegrationTestBase method beforeAll.
@BeforeAll
public void beforeAll() throws Exception {
initialize();
Properties properties = getProperties();
namespace1 = getNamespace1();
namespace2 = getNamespace2();
writeConfigFile(properties);
Map<String, Object> schemaJsonMap = getSchemaJsonMap();
writeSchemaFile(schemaJsonMap);
StorageFactory factory = StorageFactory.create(properties);
admin = factory.getAdmin();
consensusCommitAdmin = new ConsensusCommitAdmin(admin, new DatabaseConfig(properties));
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class CosmosSchemaLoaderWithStorageSpecificArgsIntegrationTest method getCommandArgsForCreationWithCoordinator.
@Override
protected List<String> getCommandArgsForCreationWithCoordinator(String configFile, String schemaFile) throws IOException {
CosmosConfig config = new CosmosConfig(new DatabaseConfig(new File(configFile)));
ImmutableList.Builder<String> builder = ImmutableList.<String>builder().add("--cosmos").add("-h").add(config.getEndpoint()).add("--schema-file").add(schemaFile).add("-p").add(config.getKey());
CosmosEnv.getDatabasePrefix().ifPresent((prefix) -> builder.add("--table-metadata-database-prefix").add(prefix).add("--coordinator-namespace-prefix").add(prefix));
return builder.build();
}
Aggregations