use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class DynamoConfigTest method constructor_PropertiesWithoutTableMetadataNamespaceGiven_ShouldLoadProperly.
@Test
public void constructor_PropertiesWithoutTableMetadataNamespaceGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(DatabaseConfig.CONTACT_POINTS, ANY_REGION);
props.setProperty(DatabaseConfig.USERNAME, ANY_ACCESS_KEY_ID);
props.setProperty(DatabaseConfig.PASSWORD, ANY_SECRET_ACCESS_ID);
props.setProperty(DatabaseConfig.STORAGE, DYNAMO_STORAGE);
props.setProperty(DynamoConfig.ENDPOINT_OVERRIDE, ANY_ENDPOINT_OVERRIDE);
// Act
DynamoConfig config = new DynamoConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getRegion()).isEqualTo(ANY_REGION);
assertThat(config.getAccessKeyId()).isEqualTo(ANY_ACCESS_KEY_ID);
assertThat(config.getSecretAccessKey()).isEqualTo(ANY_SECRET_ACCESS_ID);
assertThat(config.getEndpointOverride().isPresent()).isTrue();
assertThat(config.getEndpointOverride().get()).isEqualTo(ANY_ENDPOINT_OVERRIDE);
assertThat(config.getTableMetadataNamespace()).isNotPresent();
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class DynamoConfigTest method constructor_AllPropertiesGiven_ShouldLoadProperly.
@Test
public void constructor_AllPropertiesGiven_ShouldLoadProperly() {
// Arrange
Properties props = new Properties();
props.setProperty(DatabaseConfig.CONTACT_POINTS, ANY_REGION);
props.setProperty(DatabaseConfig.USERNAME, ANY_ACCESS_KEY_ID);
props.setProperty(DatabaseConfig.PASSWORD, ANY_SECRET_ACCESS_ID);
props.setProperty(DatabaseConfig.STORAGE, DYNAMO_STORAGE);
props.setProperty(DynamoConfig.ENDPOINT_OVERRIDE, ANY_ENDPOINT_OVERRIDE);
props.setProperty(DynamoConfig.TABLE_METADATA_NAMESPACE, ANY_TABLE_METADATA_NAMESPACE);
// Act
DynamoConfig config = new DynamoConfig(new DatabaseConfig(props));
// Assert
assertThat(config.getRegion()).isEqualTo(ANY_REGION);
assertThat(config.getAccessKeyId()).isEqualTo(ANY_ACCESS_KEY_ID);
assertThat(config.getSecretAccessKey()).isEqualTo(ANY_SECRET_ACCESS_ID);
assertThat(config.getEndpointOverride().isPresent()).isTrue();
assertThat(config.getEndpointOverride().get()).isEqualTo(ANY_ENDPOINT_OVERRIDE);
assertThat(config.getTableMetadataNamespace()).isPresent();
assertThat(config.getTableMetadataNamespace().get()).isEqualTo(ANY_TABLE_METADATA_NAMESPACE);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class CosmosConfigTest method constructor_WithoutStorage_ShouldThrowIllegalArgumentException.
@Test
public void constructor_WithoutStorage_ShouldThrowIllegalArgumentException() {
// Arrange
Properties props = new Properties();
props.setProperty(DatabaseConfig.CONTACT_POINTS, ANY_ENDPOINT);
props.setProperty(DatabaseConfig.PASSWORD, ANY_KEY);
props.setProperty(CosmosConfig.TABLE_METADATA_DATABASE, ANY_TABLE_METADATA_DATABASE);
// Act Assert
assertThatThrownBy(() -> new CosmosConfig(new DatabaseConfig(props))).isInstanceOf(IllegalArgumentException.class);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class ConsensusCommitSpecificIntegrationTestBase method beforeAll.
@BeforeAll
public void beforeAll() throws Exception {
initialize();
Properties properties = TestUtils.addSuffix(getProperties(), TEST_NAME);
StorageFactory factory = StorageFactory.create(properties);
admin = factory.getAdmin();
databaseConfig = new DatabaseConfig(properties);
consensusCommitConfig = new ConsensusCommitConfig(databaseConfig);
consensusCommitAdmin = new ConsensusCommitAdmin(admin, consensusCommitConfig);
namespace1 = getNamespace1();
namespace2 = getNamespace2();
createTables();
originalStorage = factory.getStorage();
parallelExecutor = new ParallelExecutor(consensusCommitConfig);
}
use of com.scalar.db.config.DatabaseConfig in project scalardb by scalar-labs.
the class TwoPhaseConsensusCommitSpecificIntegrationTestBase method beforeAll.
@BeforeAll
public void beforeAll() throws Exception {
initialize();
Properties properties = TestUtils.addSuffix(getProperties(), TEST_NAME);
namespace = getNamespace();
StorageFactory factory = StorageFactory.create(properties);
admin = factory.getAdmin();
DatabaseConfig databaseConfig = new DatabaseConfig(properties);
ConsensusCommitConfig consensusCommitConfig = new ConsensusCommitConfig(databaseConfig);
consensusCommitAdmin = new ConsensusCommitAdmin(admin, consensusCommitConfig);
createTables();
storage = factory.getStorage();
initManagerAndCoordinator(databaseConfig, consensusCommitConfig);
}
Aggregations