use of org.motechproject.config.core.domain.SQLDBConfig in project motech by motech.
the class BootstrapConfigPropertyMapperTest method shouldMapToPropertiesFromBootstrapConfig_WhenUsernameAndPasswordAreBlank.
@Test
public void shouldMapToPropertiesFromBootstrapConfig_WhenUsernameAndPasswordAreBlank() {
Properties bootstrapProperties = BootstrapConfigPropertyMapper.toProperties(new BootstrapConfig(new SQLDBConfig(sqlUrl, sqlDriver, sqlUsername, sqlPassword), configSource, felixPath, motechDir, queueUrl));
Assert.assertThat(bootstrapProperties.getProperty(sqlUsername), nullValue());
Assert.assertThat(bootstrapProperties.getProperty(sqlPassword), nullValue());
Assert.assertThat(bootstrapProperties.getProperty(CONFIG_SOURCE), is(configSource.getName()));
}
use of org.motechproject.config.core.domain.SQLDBConfig in project motech by motech.
the class BootstrapConfigPropertyMapperTest method shouldMapToPropertiesFromBootstrapConfig.
@Test
public void shouldMapToPropertiesFromBootstrapConfig() {
Properties bootstrapProperties = BootstrapConfigPropertyMapper.toProperties(new BootstrapConfig(new SQLDBConfig(sqlUrl, sqlDriver, sqlUsername, sqlPassword), configSource, felixPath, motechDir, queueUrl));
Assert.assertThat(bootstrapProperties.getProperty(CONFIG_SOURCE), is(configSource.getName()));
}
use of org.motechproject.config.core.domain.SQLDBConfig in project motech by motech.
the class SqlDBManagerTest method shouldProperlySetSqlProperties.
@Test
public void shouldProperlySetSqlProperties() throws IOException {
BootstrapConfig bootstrapConfig = new BootstrapConfig(new SQLDBConfig("jdbc:mysql://localhost:3306/", "com.mysql.jdbc.Driver", "root", "pass"), ConfigSource.FILE, "./felix", motechDir, "tcp://localhost:61616");
when(coreConfigurationService.loadBootstrapConfig()).thenReturn(bootstrapConfig);
Properties propertiesToUpdate = new Properties();
propertiesToUpdate.put("javax.jdo.option.ConnectionURL", "${sql.url}");
propertiesToUpdate.put("some.username", "${sql.user}");
propertiesToUpdate.put("some.password", "${sql.password}");
propertiesToUpdate.put("quartz.delegate", "${sql.quartz.delegateClass}");
SqlDBManager sqlDBManager = new SqlDBManagerImpl(coreConfigurationService);
Properties propertiesAfterUpdate = sqlDBManager.getSqlProperties(propertiesToUpdate);
assertEquals(4, propertiesAfterUpdate.size());
assertEquals("jdbc:mysql://localhost:3306/", propertiesAfterUpdate.getProperty("javax.jdo.option.ConnectionURL"));
assertEquals("root", propertiesAfterUpdate.getProperty("some.username"));
assertEquals("pass", propertiesAfterUpdate.getProperty("some.password"));
assertEquals(Drivers.QUARTZ_STD_JDBC_DELEGATE, propertiesAfterUpdate.getProperty("quartz.delegate"));
}
Aggregations