Skip to content

Commit

Permalink
Add ShadowDataSourceMappingsFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Nov 3, 2024
1 parent 3e35e20 commit 447af4c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private Map<String, String> findBySQLHints(final ShadowRule rule, final Collecti
Map<String, String> result = new LinkedHashMap<>();
for (String each : relatedShadowTables) {
if (isContainsShadowInSQLHints(rule, each, new ShadowDetermineCondition(each, operationType))) {
result.putAll(rule.getShadowDataSourceRules(each));
result.putAll(rule.getShadowDataSourceMappings(each));
return result;
}
}
Expand All @@ -113,7 +113,7 @@ private Map<String, String> findByShadowColumn(final ShadowRule rule, final Coll
for (String each : relatedShadowTables) {
Collection<String> shadowColumnNames = rule.getShadowColumnNames(operationType, each);
if (!shadowColumnNames.isEmpty() && isMatchAnyColumnShadowAlgorithms(rule, each, shadowColumnNames)) {
return rule.getShadowDataSourceRules(each);
return rule.getShadowDataSourceMappings(each);
}
}
return Collections.emptyMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public Collection<String> getShadowColumnNames(final ShadowOperationType shadowO
* @return shadow data source mappings
*/
@HighFrequencyInvocation
public Map<String, String> getShadowDataSourceRules(final String tableName) {
public Map<String, String> getShadowDataSourceMappings(final String tableName) {
Map<String, String> result = new LinkedHashMap<>(shadowDataSourceRules.size(), 1F);
for (String each : shadowTableRules.get(tableName).getShadowDataSources()) {
ShadowDataSourceRule dataSourceRule = shadowDataSourceRules.get(each);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void assertGetShadowColumnNames() {

@Test
void assertGetShadowDataSourceMappings() {
assertThat(rule.getShadowDataSourceRules("foo_tbl"), is(Collections.singletonMap("prod_ds_0", "shadow_ds_0")));
assertThat(rule.getShadowDataSourceMappings("foo_tbl"), is(Collections.singletonMap("prod_ds_0", "shadow_ds_0")));
}

@Test
Expand Down

0 comments on commit 447af4c

Please sign in to comment.