RuleSchemaMetaDataLoader { @SuppressWarnings({"unchecked", "rawtypes"}) public RuleSchemaMetaData load(final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap, final ConfigurationProperties props) throws SQLException { Collection<String> excludedTableNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); SchemaMetaData configuredSchemaMetaData = new SchemaMetaData(); for (Entry<ShardingSphereRule, RuleMetaDataLoader> entry : OrderedSPIRegistry.getRegisteredServices(rules, RuleMetaDataLoader.class).entrySet()) { SchemaMetaData schemaMetaData = entry.getValue().load(databaseType, dataSourceMap, new DataNodes(rules), entry.getKey(), props, excludedTableNames); excludedTableNames.addAll(schemaMetaData.getAllTableNames()); if (entry.getKey() instanceof DataNodeRoutedRule) { excludedTableNames.addAll(((DataNodeRoutedRule) entry.getKey()).getAllActualTables()); } configuredSchemaMetaData.merge(schemaMetaData); } decorate(configuredSchemaMetaData); Map<String, Collection<String>> unConfiguredSchemaMetaDataMap = loadUnConfiguredSchemaMetaData(databaseType, dataSourceMap, excludedTableNames); return new RuleSchemaMetaData(configuredSchemaMetaData, unConfiguredSchemaMetaDataMap); }  @SuppressWarnings({"unchecked", "rawtypes"}) RuleSchemaMetaData load(final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap, 
                                   final ConfigurationProperties props); RuleSchemaMetaData load(final DatabaseType databaseType, final DataSource dataSource, 
                                   final ConfigurationProperties props); @SuppressWarnings({"unchecked", "rawtypes"}) Optional<TableMetaData> load(final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap, 
                                        final String tableName, final ConfigurationProperties props); Optional<TableMetaData> load(final DatabaseType databaseType, final DataSource dataSource, 
                                        final String tableName, final ConfigurationProperties props);  }
@Test public void assertSyncLoadFullDatabase() throws SQLException { assertRuleSchemaMetaData(loader.load(databaseType, dataSource, props)); }
@Test public void assertAsyncLoadFullDatabase() throws SQLException { assertRuleSchemaMetaData(loader.load(databaseType, dataSource, props)); }
@Test public void assertLoadWithExistedTableName() throws SQLException { assertTrue(loader.load(databaseType, dataSource, "data_node_routed_table_0", props).isPresent()); }
@Test public void assertLoadWithNotExistedTableName() throws SQLException { assertFalse(loader.load(databaseType, dataSource, "invalid_table", props).isPresent()); }