From e86ca4d0f6b0e7b375567a45ca8e9380a91bcfc1 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Fri, 1 Nov 2024 01:46:20 +0800 Subject: [PATCH] Refactor AlgorithmChangedProcessorTest (#33487) --- .../mode/processor/AlgorithmChangedProcessorTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mode/core/src/test/java/org/apache/shardingsphere/mode/processor/AlgorithmChangedProcessorTest.java b/mode/core/src/test/java/org/apache/shardingsphere/mode/processor/AlgorithmChangedProcessorTest.java index 93ba50b3e617b..b1ee13754799b 100644 --- a/mode/core/src/test/java/org/apache/shardingsphere/mode/processor/AlgorithmChangedProcessorTest.java +++ b/mode/core/src/test/java/org/apache/shardingsphere/mode/processor/AlgorithmChangedProcessorTest.java @@ -72,10 +72,11 @@ private ShardingSphereDatabase mockDatabase(final AlgorithmChangedProcessorFixtu @Test void assertChangeRuleItemConfiguration() { + AlterNamedRuleItemEvent event = new AlterNamedRuleItemEvent("", "bar_algo", "", "", ""); AlgorithmChangedProcessorFixtureRuleConfiguration currentRuleConfig = new AlgorithmChangedProcessorFixtureRuleConfiguration(); currentRuleConfig.getAlgorithmConfigurations().put("foo_algo", new AlgorithmConfiguration("FOO_FIXTURE", new Properties())); AlgorithmConfiguration toBeChangedItemConfig = new AlgorithmConfiguration("BAR_FIXTURE", new Properties()); - processor.changeRuleItemConfiguration(new AlterNamedRuleItemEvent("", "bar_algo", "", "", ""), currentRuleConfig, toBeChangedItemConfig); + processor.changeRuleItemConfiguration(event, currentRuleConfig, toBeChangedItemConfig); assertThat(currentRuleConfig.getAlgorithmConfigurations().size(), is(2)); assertThat(currentRuleConfig.getAlgorithmConfigurations().get("foo_algo").getType(), is("FOO_FIXTURE")); assertThat(currentRuleConfig.getAlgorithmConfigurations().get("bar_algo").getType(), is("BAR_FIXTURE")); @@ -83,9 +84,10 @@ void assertChangeRuleItemConfiguration() { @Test void assertDropRuleItemConfiguration() { + DropNamedRuleItemEvent event = new DropNamedRuleItemEvent("", "foo_algo", ""); AlgorithmChangedProcessorFixtureRuleConfiguration currentRuleConfig = new AlgorithmChangedProcessorFixtureRuleConfiguration(); currentRuleConfig.getAlgorithmConfigurations().put("foo_algo", new AlgorithmConfiguration("FOO_FIXTURE", new Properties())); - processor.dropRuleItemConfiguration(new DropNamedRuleItemEvent("", "foo_algo", ""), currentRuleConfig); + processor.dropRuleItemConfiguration(event, currentRuleConfig); assertTrue(currentRuleConfig.getAlgorithmConfigurations().isEmpty()); } }