Skip to content

Commit

Permalink
Rename ShadowCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Nov 4, 2024
1 parent 91fa905 commit 51542d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ public Map<String, String> find(final ShadowRule rule) {
private boolean isMatchDefaultAlgorithm(final ShadowRule rule) {
Optional<ShadowAlgorithm> defaultAlgorithm = rule.getDefaultShadowAlgorithm();
if (defaultAlgorithm.isPresent() && defaultAlgorithm.get() instanceof HintShadowAlgorithm<?>) {
ShadowCondition determineCondition = new ShadowCondition("", ShadowOperationType.HINT_MATCH);
return HintShadowAlgorithmDeterminer.isShadow((HintShadowAlgorithm<Comparable<?>>) defaultAlgorithm.get(), determineCondition, rule, isShadow);
ShadowCondition shadowCondition = new ShadowCondition("", ShadowOperationType.HINT_MATCH);
return HintShadowAlgorithmDeterminer.isShadow((HintShadowAlgorithm<Comparable<?>>) defaultAlgorithm.get(), shadowCondition, rule, isShadow);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class ColumnShadowAlgorithmDeterminerTest {
void assertIsShadow() {
Properties props = PropertiesBuilder.build(new Property("column", "user_id"), new Property("operation", "insert"), new Property("regex", "[1]"));
assertTrue(ColumnShadowAlgorithmDeterminer.isShadow(
(ColumnShadowAlgorithm) TypedSPILoader.getService(ShadowAlgorithm.class, "REGEX_MATCH", props), createShadowDetermineCondition()));
(ColumnShadowAlgorithm) TypedSPILoader.getService(ShadowAlgorithm.class, "REGEX_MATCH", props), createShadowCondition()));
}

private ShadowCondition createShadowDetermineCondition() {
private ShadowCondition createShadowCondition() {
return new ShadowCondition("t_order", ShadowOperationType.INSERT, new ShadowColumnCondition("t_order", "user_id", Collections.singleton(1)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class HintShadowAlgorithmDeterminerTest {
void assertIsShadow() {
HintShadowAlgorithm hintShadowAlgorithm = (HintShadowAlgorithm) TypedSPILoader.getService(ShadowAlgorithm.class, "SQL_HINT", new Properties());
HintValueContext hintValueContext = createHintValueContext();
assertTrue(HintShadowAlgorithmDeterminer.isShadow(hintShadowAlgorithm, createShadowDetermineCondition(), new ShadowRule(createShadowRuleConfiguration()), hintValueContext.isShadow()));
assertTrue(HintShadowAlgorithmDeterminer.isShadow(hintShadowAlgorithm, createShadowCondition(), new ShadowRule(createShadowRuleConfiguration()), hintValueContext.isShadow()));
}

private HintValueContext createHintValueContext() {
Expand All @@ -68,7 +68,7 @@ private Collection<ShadowDataSourceConfiguration> createDataSources() {
return result;
}

private ShadowCondition createShadowDetermineCondition() {
private ShadowCondition createShadowCondition() {
return new ShadowCondition("t_order", ShadowOperationType.INSERT);
}
}

0 comments on commit 51542d8

Please sign in to comment.