DataSourcesMetaData { public DataSourceMetaData getDataSourceMetaData(final String dataSourceName) { return dataSourceMetaDataMap.get(dataSourceName); } DataSourcesMetaData(final DatabaseType databaseType, final Map<String, DatabaseAccessConfiguration> databaseAccessConfigMap); Collection<String> getAllInstanceDataSourceNames(); DataSourceMetaData getDataSourceMetaData(final String dataSourceName);  }
@Test public void assertGetActualCatalogForShardingRule() { Map<String, DatabaseAccessConfiguration> databaseAccessConfigurationMap = new HashMap<>(2, 1); databaseAccessConfigurationMap.put("ds_0", new DatabaseAccessConfiguration("jdbc:mysql: databaseAccessConfigurationMap.put("ds_1", new DatabaseAccessConfiguration("jdbc:mysql: DataSourcesMetaData dataSourcesMetaData = new DataSourcesMetaData(DatabaseTypes.getActualDatabaseType("MySQL"), databaseAccessConfigurationMap); assertThat(dataSourcesMetaData.getDataSourceMetaData("ds_0").getCatalog(), is("db_0")); }
@Test public void assertGetActualSchemaNameForShardingRuleForMysql() { Map<String, DatabaseAccessConfiguration> databaseAccessConfigurationMap = new HashMap<>(2, 1); databaseAccessConfigurationMap.put("ds_0", new DatabaseAccessConfiguration("jdbc:mysql: databaseAccessConfigurationMap.put("ds_1", new DatabaseAccessConfiguration("jdbc:mysql: DataSourcesMetaData dataSourcesMetaData = new DataSourcesMetaData(DatabaseTypes.getActualDatabaseType("MySQL"), databaseAccessConfigurationMap); assertNull(dataSourcesMetaData.getDataSourceMetaData("ds_0").getSchema()); }