PrimaryReplicaReplicationRule implements DataSourceRoutedRule, StatusContainedRule { @Override public Map<String, Collection<String>> getDataSourceMapper() { Map<String, Collection<String>> result = new HashMap<>(); for (Entry<String, PrimaryReplicaReplicationDataSourceRule> entry : dataSourceRules.entrySet()) { result.putAll(entry.getValue().getDataSourceMapper()); } return result; } PrimaryReplicaReplicationRule(final PrimaryReplicaReplicationRuleConfiguration config);  PrimaryReplicaReplicationRule(final AlgorithmProvidedPrimaryReplicaReplicationRuleConfiguration config); PrimaryReplicaReplicationDataSourceRule getSingleDataSourceRule(); Optional<PrimaryReplicaReplicationDataSourceRule> findDataSourceRule(final String dataSourceName); @Override Map<String, Collection<String>> getDataSourceMapper(); @Override void updateRuleStatus(final RuleChangedEvent event);  }
@Test public void assertGetDataSourceMapper() { PrimaryReplicaReplicationRule primaryReplicaReplicationRule = createPrimaryReplicaReplicationRule(); Map<String, Collection<String>> actual = primaryReplicaReplicationRule.getDataSourceMapper(); Map<String, Collection<String>> expected = ImmutableMap.of("test_pr", Arrays.asList("primary_ds", "replica_ds_0", "replica_ds_1")); assertThat(actual, is(expected)); }