JdbcDataSourceDescriptorManager extends ContainerHolder implements Initializable { public JdbcDataSourceDescriptor getDescriptor(String id) { JdbcDataSourceDescriptor configuration = m_descriptors.get(id); if (configuration == null) { DataSourceDef ds = findDataSource(id); if (ds != null) { configuration = buildDescriptor(ds); m_descriptors.put(id, configuration); } } return configuration; }  List<String> getDataSourceNames(); JdbcDataSourceDescriptor getDescriptor(String id); void initialize(); void setDatasourceFile(String datasourceFile);  }
@Test public void testDynamic() throws Exception { define(OverwriteMockDataSourceProvider.class); define(MockDataSourceProvider.class); JdbcDataSourceDescriptorManager manager = lookup(JdbcDataSourceDescriptorManager.class); JdbcDataSourceDescriptor mock1 = manager.getDescriptor("mock1"); JdbcDataSourceDescriptor mock2 = manager.getDescriptor("mock2"); checkProperty(mock1, "user", "overwrite user user"); checkProperty(mock1, "url", "overwrite user url"); checkProperty(mock2, "user", "history user"); checkProperty(mock2, "url", "history url"); checkNames(manager, "mock1", "mock2", "jdbc-dal", "user", "history"); }
@Test public void testStatic() throws Exception { JdbcDataSourceDescriptorManager manager = lookup(JdbcDataSourceDescriptorManager.class); JdbcDataSourceDescriptor user = manager.getDescriptor("user"); JdbcDataSourceDescriptor history = manager.getDescriptor("history"); checkProperty(user, "user", "user"); checkProperty(user, "url", "jdbc:mysql: checkProperty(history, "user", "history"); checkProperty(history, "url", "jdbc:mysql: checkNames(manager, "jdbc-dal", "user", "history"); }