JDBCRepositoryConfiguration jdbcConfig =
marinerConfig.getLocalRepository()
.getJDBCRepositoryConfiguration();
ConnectionPoolConfiguration connectionPool = null;
AnonymousDataSourceConfiguration anonymousDataSource = null;
MCSDatabaseConfiguration mcsDatabase = null;
if (jdbcConfig.getDataSourceConfiguration()
instanceof ConnectionPoolConfiguration) {
// Pooled datasource
connectionPool =
(ConnectionPoolConfiguration)jdbcConfig
.getDataSourceConfiguration();
if (connectionPool.getDataSourceConfiguration()
instanceof AnonymousDataSourceConfiguration) {
// anonymous pooled
anonymousDataSource =
(AnonymousDataSourceConfiguration)connectionPool
.getDataSourceConfiguration();
if (anonymousDataSource.getDataSourceConfiguration()
instanceof MCSDatabaseConfiguration) {
// MCS Database anonymous pooled
mcsDatabase =
(MCSDatabaseConfiguration)anonymousDataSource
.getDataSourceConfiguration();
}
} else if (
connectionPool.getDataSourceConfiguration()
instanceof MCSDatabaseConfiguration) {
// MCS Database pooled
mcsDatabase =
(MCSDatabaseConfiguration)connectionPool
.getDataSourceConfiguration();
}
} else if (
jdbcConfig.getDataSourceConfiguration()
instanceof AnonymousDataSourceConfiguration) {
// anonymous
anonymousDataSource =
(AnonymousDataSourceConfiguration)jdbcConfig
.getDataSourceConfiguration();
if (anonymousDataSource.getDataSourceConfiguration()
instanceof MCSDatabaseConfiguration) {
// MCS Database anonymous
mcsDatabase =
(MCSDatabaseConfiguration)anonymousDataSource
.getDataSourceConfiguration();
}
}
if (config.repositoryUser != null) {
Assert.assertEquals(config.repositoryUser,
anonymousDataSource.getUser());
}
if (config.repositoryPassword != null) {
Assert.assertEquals(config.repositoryPassword,
anonymousDataSource.getPassword());
}
if (config.repositoryVendor != null) {
Assert.assertEquals(config.repositoryVendor,
mcsDatabase.getVendor());
}
if (config.repositorySource != null) {
Assert.assertEquals(config.repositorySource,
mcsDatabase.getSource());
}
if (config.repositoryHost != null) {
Assert.assertEquals(config.repositoryHost,
mcsDatabase.getHost());
}
if (config.repositoryPort != null) {
Assert.assertEquals(config.repositoryPort,
mcsDatabase.getPort());
}
if (config.repositoryDbPoolMax != null) {
Assert.assertEquals(config.repositoryDbPoolMax,
connectionPool.getMaximum());
}
if (config.repositoryKeepConnectionsAlive != null) {
Assert.assertEquals(config.repositoryKeepConnectionsAlive,
connectionPool.getKeepAlive());
}
if (config.repositoryConnectionPollInterval != null) {
Assert.assertEquals(config.repositoryConnectionPollInterval,
connectionPool.getPollInterval());
}
}
}