diff --git a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutorTest.java similarity index 98% rename from features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java rename to features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutorTest.java index ba01dffe80bdf..b9262cdc6829e 100644 --- a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleStatementUpdaterTest.java +++ b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/CreateBroadcastTableRuleExecutorTest.java @@ -35,7 +35,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class CreateBroadcastTableRuleStatementUpdaterTest { +class CreateBroadcastTableRuleExecutorTest { private final CreateBroadcastTableRuleExecutor executor = new CreateBroadcastTableRuleExecutor(); diff --git a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleStatementUpdaterTest.java b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleExecutorTest.java similarity index 98% rename from features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleStatementUpdaterTest.java rename to features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleExecutorTest.java index 8b9480c021a8a..bd5257ff80f9f 100644 --- a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleStatementUpdaterTest.java +++ b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/update/DropBroadcastTableRuleExecutorTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class DropBroadcastTableRuleStatementUpdaterTest { +class DropBroadcastTableRuleExecutorTest { private final DropBroadcastTableRuleExecutor executor = new DropBroadcastTableRuleExecutor(); diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleExecutorTest.java similarity index 99% rename from features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java rename to features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleExecutorTest.java index d73d9299ca17b..25a9a100b3220 100644 --- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleStatementUpdaterTest.java +++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/AlterEncryptRuleExecutorTest.java @@ -46,7 +46,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class AlterEncryptRuleStatementUpdaterTest { +class AlterEncryptRuleExecutorTest { private final AlterEncryptRuleExecutor executor = new AlterEncryptRuleExecutor(); diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java similarity index 99% rename from features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java rename to features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java index 3c5187ca64206..74018f7bc8437 100644 --- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleStatementUpdaterTest.java +++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java @@ -47,7 +47,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class CreateEncryptRuleStatementUpdaterTest { +class CreateEncryptRuleExecutorTest { private final CreateEncryptRuleExecutor executor = new CreateEncryptRuleExecutor(); diff --git a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleExecutorTest.java similarity index 99% rename from features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java rename to features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleExecutorTest.java index 94255028fd616..055f460ebeaf0 100644 --- a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java +++ b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleExecutorTest.java @@ -43,7 +43,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class DropEncryptRuleStatementUpdaterTest { +class DropEncryptRuleExecutorTest { private final DropEncryptRuleExecutor executor = new DropEncryptRuleExecutor(); diff --git a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/AlterMaskRuleStatementUpdaterTest.java b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/AlterMaskRuleExecutorTest.java similarity index 99% rename from features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/AlterMaskRuleStatementUpdaterTest.java rename to features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/AlterMaskRuleExecutorTest.java index ee8ed9b5737e5..bf2b93b7c3178 100644 --- a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/AlterMaskRuleStatementUpdaterTest.java +++ b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/AlterMaskRuleExecutorTest.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class AlterMaskRuleStatementUpdaterTest { +class AlterMaskRuleExecutorTest { private final AlterMaskRuleExecutor executor = new AlterMaskRuleExecutor(); diff --git a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/CreateMaskRuleStatementUpdaterTest.java b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/CreateMaskRuleExecutorTest.java similarity index 99% rename from features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/CreateMaskRuleStatementUpdaterTest.java rename to features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/CreateMaskRuleExecutorTest.java index 752bc01405118..4c7de8d418048 100644 --- a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/CreateMaskRuleStatementUpdaterTest.java +++ b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/CreateMaskRuleExecutorTest.java @@ -42,7 +42,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class CreateMaskRuleStatementUpdaterTest { +class CreateMaskRuleExecutorTest { private final CreateMaskRuleExecutor executor = new CreateMaskRuleExecutor(); diff --git a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/DropMaskRuleStatementUpdaterTest.java b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/DropMaskRuleExecutorTest.java similarity index 99% rename from features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/DropMaskRuleStatementUpdaterTest.java rename to features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/DropMaskRuleExecutorTest.java index 49ba7e2adf15b..9b885f0126010 100644 --- a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/DropMaskRuleStatementUpdaterTest.java +++ b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/update/DropMaskRuleExecutorTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class DropMaskRuleStatementUpdaterTest { +class DropMaskRuleExecutorTest { private final DropMaskRuleExecutor executor = new DropMaskRuleExecutor(); diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleExecutorTest.java similarity index 99% rename from features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java rename to features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleExecutorTest.java index fced83bf6636f..0e9655a5d6997 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleStatementUpdaterTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/AlterReadwriteSplittingRuleExecutorTest.java @@ -48,7 +48,7 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class AlterReadwriteSplittingRuleStatementUpdaterTest { +class AlterReadwriteSplittingRuleExecutorTest { @Mock(answer = Answers.RETURNS_DEEP_STUBS) private ShardingSphereDatabase database; diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleExecutorTest.java similarity index 99% rename from features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java rename to features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleExecutorTest.java index e14597d897e52..3ad886401a038 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleStatementUpdaterTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/CreateReadwriteSplittingRuleExecutorTest.java @@ -54,7 +54,7 @@ @ExtendWith(AutoMockExtension.class) @StaticMockSettings(TypedSPILoader.class) -class CreateReadwriteSplittingRuleStatementUpdaterTest { +class CreateReadwriteSplittingRuleExecutorTest { @Mock(answer = Answers.RETURNS_DEEP_STUBS) private ShardingSphereDatabase database; diff --git a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdaterTest.java b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleExecutorTest.java similarity index 99% rename from features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdaterTest.java rename to features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleExecutorTest.java index 09b229f183b0b..49d0e31c2af89 100644 --- a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdaterTest.java +++ b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleExecutorTest.java @@ -51,7 +51,7 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class DropReadwriteSplittingRuleStatementUpdaterTest { +class DropReadwriteSplittingRuleExecutorTest { private final DropReadwriteSplittingRuleExecutor executor = new DropReadwriteSplittingRuleExecutor(); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmExecutorTest.java similarity index 98% rename from features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmStatementUpdaterTest.java rename to features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmExecutorTest.java index 8c05c195a0754..966f2728a9ae8 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmExecutorTest.java @@ -45,7 +45,7 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class AlterDefaultShadowAlgorithmStatementUpdaterTest { +class AlterDefaultShadowAlgorithmExecutorTest { private final AlterDefaultShadowAlgorithmExecutor executor = new AlterDefaultShadowAlgorithmExecutor(); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java similarity index 99% rename from features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java rename to features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java index 48c6eddc119f3..23a0e697ebf1b 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java @@ -55,7 +55,9 @@ @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) -class AlterShadowRuleStatementUpdaterTest { +class AlterShadowRuleExecutorTest { + + private final AlterShadowRuleExecutor executor = new AlterShadowRuleExecutor(); @Mock private ResourceMetaData resourceMetaData; @@ -63,8 +65,6 @@ class AlterShadowRuleStatementUpdaterTest { @Mock private ShadowRuleConfiguration currentConfig; - private final AlterShadowRuleExecutor executor = new AlterShadowRuleExecutor(); - @BeforeEach void setUp() { Collection shadowDataSource = new LinkedList<>(); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmExecutorTest.java similarity index 98% rename from features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmStatementUpdaterTest.java rename to features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmExecutorTest.java index 65c62d734dbbb..8471abc1d8049 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateDefaultShadowAlgorithmExecutorTest.java @@ -38,7 +38,7 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class CreateDefaultShadowAlgorithmStatementUpdaterTest { +class CreateDefaultShadowAlgorithmExecutorTest { private final CreateDefaultShadowAlgorithmExecutor executor = new CreateDefaultShadowAlgorithmExecutor(); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleExecutorTest.java similarity index 99% rename from features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java rename to features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleExecutorTest.java index ed731986b7424..733f11d7f3959 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/CreateShadowRuleExecutorTest.java @@ -52,7 +52,9 @@ @ExtendWith(MockitoExtension.class) @MockitoSettings(strictness = Strictness.LENIENT) -class CreateShadowRuleStatementUpdaterTest { +class CreateShadowRuleExecutorTest { + + private final CreateShadowRuleExecutor executor = new CreateShadowRuleExecutor(); @Mock(answer = Answers.RETURNS_DEEP_STUBS) private ShardingSphereDatabase database; @@ -63,8 +65,6 @@ class CreateShadowRuleStatementUpdaterTest { @Mock private ShadowRuleConfiguration currentConfig; - private final CreateShadowRuleExecutor executor = new CreateShadowRuleExecutor(); - @BeforeEach void setUp() { when(database.getResourceMetaData()).thenReturn(resourceMetaData); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmExecutorTest.java similarity index 98% rename from features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java rename to features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmExecutorTest.java index 4260c2bda4da7..46791c81c6d4f 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmExecutorTest.java @@ -36,7 +36,7 @@ import static org.mockito.Mockito.mock; @ExtendWith(MockitoExtension.class) -class DropDefaultShadowAlgorithmStatementUpdaterTest { +class DropDefaultShadowAlgorithmExecutorTest { private final DropDefaultShadowAlgorithmExecutor executor = new DropDefaultShadowAlgorithmExecutor(); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmExecutorTest.java similarity index 98% rename from features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java rename to features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmExecutorTest.java index 727f58142aeeb..47d568358dabc 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmExecutorTest.java @@ -33,7 +33,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class DropShadowAlgorithmStatementUpdaterTest { +class DropShadowAlgorithmExecutorTest { private final DropShadowAlgorithmExecutor executor = new DropShadowAlgorithmExecutor(); diff --git a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleExecutorTest.java similarity index 99% rename from features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java rename to features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleExecutorTest.java index 85a47dcc266c6..c52c941574efe 100644 --- a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java +++ b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleExecutorTest.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class DropShadowRuleStatementUpdaterTest { +class DropShadowRuleExecutorTest { private final DropShadowRuleExecutor executor = new DropShadowRuleExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyExecutorTest.java similarity index 99% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyExecutorTest.java index 9d280463001d0..149776001fb5f 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyExecutorTest.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class AlterDefaultShardingStrategyStatementUpdaterTest { +class AlterDefaultShardingStrategyExecutorTest { private final AlterDefaultShardingStrategyExecutor executor = new AlterDefaultShardingStrategyExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableReferenceRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableReferenceRuleExecutorTest.java similarity index 98% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableReferenceRuleStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableReferenceRuleExecutorTest.java index 5d92f9614beaa..98c90395872ea 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableReferenceRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableReferenceRuleExecutorTest.java @@ -36,7 +36,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class AlterShardingTableReferenceRuleStatementUpdaterTest { +class AlterShardingTableReferenceRuleExecutorTest { private final AlterShardingTableReferenceRuleExecutor executor = new AlterShardingTableReferenceRuleExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleExecutorTest.java similarity index 99% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleExecutorTest.java index 56263beeb469b..845acc2cfb65e 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingTableRuleExecutorTest.java @@ -53,14 +53,14 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class AlterShardingTableRuleStatementUpdaterTest { +class AlterShardingTableRuleExecutorTest { + + private final AlterShardingTableRuleExecutor executor = new AlterShardingTableRuleExecutor(); private final ShardingRuleConfiguration currentRuleConfig = createCurrentShardingRuleConfiguration(); private final ResourceMetaData resourceMetaData = new ResourceMetaData(createDataSource()); - private final AlterShardingTableRuleExecutor executor = new AlterShardingTableRuleExecutor(); - @BeforeEach void setUp() { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyExecutorTest.java similarity index 99% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyExecutorTest.java index 8ec77dc060152..96f1d72666068 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyExecutorTest.java @@ -41,7 +41,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class CreateDefaultShardingStrategyStatementUpdaterTest { +class CreateDefaultShardingStrategyExecutorTest { private final CreateDefaultShardingStrategyExecutor executor = new CreateDefaultShardingStrategyExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableReferenceRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableReferenceRuleExecutorTest.java similarity index 98% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableReferenceRuleStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableReferenceRuleExecutorTest.java index 2f6478d59dc88..db141a74345d2 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableReferenceRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableReferenceRuleExecutorTest.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class CreateShardingTableReferenceRuleStatementUpdaterTest { +class CreateShardingTableReferenceRuleExecutorTest { private final CreateShardingTableReferenceRuleExecutor executor = new CreateShardingTableReferenceRuleExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleExecutorTest.java similarity index 99% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleExecutorTest.java index a717812ff7d9b..20104602dd90e 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleExecutorTest.java @@ -68,12 +68,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class CreateShardingTableRuleStatementUpdaterTest { - - private final ShardingRuleConfiguration currentRuleConfig = createCurrentShardingRuleConfiguration(); +class CreateShardingTableRuleExecutorTest { private final CreateShardingTableRuleExecutor executor = new CreateShardingTableRuleExecutor(); + private final ShardingRuleConfiguration currentRuleConfig = createCurrentShardingRuleConfiguration(); + @BeforeEach void before() { ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyExecutorTest.java similarity index 99% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyExecutorTest.java index f4caec49ec969..188821aba6b16 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropDefaultShardingStrategyExecutorTest.java @@ -40,7 +40,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class DropDefaultShardingStrategyStatementUpdaterTest { +class DropDefaultShardingStrategyExecutorTest { private final DropDefaultShardingStrategyExecutor executor = new DropDefaultShardingStrategyExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java similarity index 94% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java index 5d7f6477d1c2c..a35a25e6595ab 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java @@ -27,10 +27,9 @@ import org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration; import org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingAlgorithmExecutor; import org.apache.shardingsphere.sharding.distsql.statement.DropShardingAlgorithmStatement; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Answers; -import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Collections; @@ -41,49 +40,47 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; @ExtendWith(MockitoExtension.class) -class DropShardingAlgorithmStatementUpdaterTest { - - @Mock(answer = Answers.RETURNS_DEEP_STUBS) - private ShardingSphereDatabase database; +class DropShardingAlgorithmExecutorTest { private final DropShardingAlgorithmExecutor executor = new DropShardingAlgorithmExecutor(); + @BeforeEach + void setUp() { + executor.setDatabase(mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS)); + } + @Test void assertCheckSQLStatementWithoutCurrentRule() throws RuleDefinitionViolationException { - executor.setDatabase(database); assertThrows(MissingRequiredAlgorithmException.class, () -> executor.checkBeforeUpdate(new DropShardingAlgorithmStatement(false, Collections.emptyList()), null)); } @Test void assertCheckSQLStatementWithoutCurrentRuleWithIfExists() throws RuleDefinitionViolationException { DropShardingAlgorithmStatement dropShardingAlgorithmStatement = new DropShardingAlgorithmStatement(true, Collections.emptyList()); - executor.setDatabase(database); executor.checkBeforeUpdate(dropShardingAlgorithmStatement, null); } @Test void assertCheckSQLStatementWithoutExistedAlgorithm() throws RuleDefinitionViolationException { - executor.setDatabase(database); assertThrows(MissingRequiredAlgorithmException.class, () -> executor.checkBeforeUpdate(createSQLStatement("t_order"), new ShardingRuleConfiguration())); } @Test void assertCheckSQLStatementWithoutExistedAlgorithmWithIfExists() throws RuleDefinitionViolationException { - executor.setDatabase(database); executor.checkBeforeUpdate(createSQLStatementWithIfExists("t_order"), new ShardingRuleConfiguration()); } @Test void assertCheckSQLStatementWithBindingTableRule() throws RuleDefinitionViolationException { - executor.setDatabase(database); assertThrows(AlgorithmInUsedException.class, () -> executor.checkBeforeUpdate(createSQLStatement("t_order_tb_inline"), createCurrentRuleConfiguration())); } @Test void assertCheckSQLStatementWithBindingTableRuleWithIfExists() throws RuleDefinitionViolationException { - executor.setDatabase(database); assertThrows(AlgorithmInUsedException.class, () -> executor.checkBeforeUpdate(createSQLStatementWithIfExists("t_order_tb_inline"), createCurrentRuleConfiguration())); } diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorExecutorTest.java similarity index 98% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorExecutorTest.java index 83abcaf94ef29..cfd294bb917dc 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorExecutorTest.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class DropShardingAuditorStatementUpdaterTest { +class DropShardingAuditorExecutorTest { private final DropShardingAuditorExecutor executor = new DropShardingAuditorExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorExecutorTest.java similarity index 98% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorExecutorTest.java index a5619996d5deb..22bc574b87efc 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorExecutorTest.java @@ -37,7 +37,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class DropShardingKeyGeneratorStatementUpdaterTest { +class DropShardingKeyGeneratorExecutorTest { private final DropShardingKeyGeneratorExecutor executor = new DropShardingKeyGeneratorExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableReferenceRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableReferenceExecutorTest.java similarity index 99% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableReferenceRuleStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableReferenceExecutorTest.java index 5e1420edb1fba..61576549a2e78 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableReferenceRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableReferenceExecutorTest.java @@ -39,7 +39,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; -class DropShardingTableReferenceRuleStatementUpdaterTest { +class DropShardingTableReferenceExecutorTest { private final DropShardingTableReferenceExecutor executor = new DropShardingTableReferenceExecutor(); diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleExecutorTest.java similarity index 99% rename from features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java rename to features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleExecutorTest.java index 509d513e4252f..c5b7970f51175 100644 --- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleStatementUpdaterTest.java +++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingTableRuleExecutorTest.java @@ -50,7 +50,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; -class DropShardingTableRuleStatementUpdaterTest { +class DropShardingTableRuleExecutorTest { private final DropShardingTableRuleExecutor executor = new DropShardingTableRuleExecutor(); diff --git a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableStatementUpdaterTest.java b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutorTest.java similarity index 95% rename from kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableStatementUpdaterTest.java rename to kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutorTest.java index ffb9502bb580e..3ddd77d97ea3c 100644 --- a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableStatementUpdaterTest.java +++ b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/LoadSingleTableExecutorTest.java @@ -17,9 +17,9 @@ package org.apache.shardingsphere.single.distsql.handler.update; -import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.table.TableExistsException; import org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException; import org.apache.shardingsphere.infra.database.core.type.DatabaseType; +import org.apache.shardingsphere.infra.exception.dialect.exception.syntax.table.TableExistsException; import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase; import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema; import org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule; @@ -30,6 +30,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Answers; +import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Collection; @@ -40,25 +42,24 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.RETURNS_DEEP_STUBS; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -class LoadSingleTableStatementUpdaterTest { +class LoadSingleTableExecutorTest { + + private final LoadSingleTableExecutor executor = new LoadSingleTableExecutor(); + @Mock(answer = Answers.RETURNS_DEEP_STUBS) private ShardingSphereDatabase database; + @Mock private ShardingSphereSchema schema; - private final LoadSingleTableExecutor executor = new LoadSingleTableExecutor(); - @BeforeEach void setUp() { - database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS); when(database.getRuleMetaData().findRules(DataSourceContainedRule.class)).thenReturn(Collections.emptyList()); when(database.getProtocolType()).thenReturn(TypedSPILoader.getService(DatabaseType.class, "FIXTURE")); - schema = mock(ShardingSphereSchema.class); when(database.getSchema("foo_db")).thenReturn(schema); } diff --git a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitStatementUpdaterTest.java b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutorTest.java similarity index 98% rename from kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitStatementUpdaterTest.java rename to kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutorTest.java index 719cbe6e21350..dbdfba85a6e52 100644 --- a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitStatementUpdaterTest.java +++ b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/update/SetDefaultSingleTableStorageUnitExecutorTest.java @@ -34,7 +34,7 @@ import static org.mockito.Mockito.mock; @ExtendWith(MockitoExtension.class) -class SetDefaultSingleTableStorageUnitStatementUpdaterTest { +class SetDefaultSingleTableStorageUnitExecutorTest { private final SetDefaultSingleTableStorageUnitExecutor executor = new SetDefaultSingleTableStorageUnitExecutor(); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationExecutorTest.java similarity index 92% rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationExecutorTest.java index e944265d40429..6bdd77e1d9753 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportDatabaseConfigurationExecutorTest.java @@ -58,9 +58,9 @@ @ExtendWith(AutoMockExtension.class) @StaticMockSettings(ProxyContext.class) @MockitoSettings(strictness = Strictness.LENIENT) -class ImportDatabaseConfigurationUpdaterTest { +class ImportDatabaseConfigurationExecutorTest { - private ImportDatabaseConfigurationExecutor importDatabaseConfigUpdater; + private ImportDatabaseConfigurationExecutor executor; @BeforeAll static void setUp() throws ClassNotFoundException { @@ -121,16 +121,16 @@ void assertImportInvalidAlgorithm() { private void assertExecute(final String databaseName, final String filePath) throws SQLException { init(databaseName); - importDatabaseConfigUpdater.executeUpdate(new ImportDatabaseConfigurationStatement(ImportDatabaseConfigurationUpdaterTest.class.getResource(filePath).getPath()), mock(ContextManager.class)); + executor.executeUpdate(new ImportDatabaseConfigurationStatement(ImportDatabaseConfigurationExecutorTest.class.getResource(filePath).getPath()), mock(ContextManager.class)); } @SneakyThrows({IllegalAccessException.class, NoSuchFieldException.class}) private void init(final String databaseName) { ContextManager contextManager = mockContextManager(databaseName); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); - importDatabaseConfigUpdater = new ImportDatabaseConfigurationExecutor(); + executor = new ImportDatabaseConfigurationExecutor(); YamlDatabaseConfigurationImportExecutor databaseConfigImportExecutor = new YamlDatabaseConfigurationImportExecutor(); - Plugins.getMemberAccessor().set(importDatabaseConfigUpdater.getClass().getDeclaredField("databaseConfigImportExecutor"), importDatabaseConfigUpdater, databaseConfigImportExecutor); + Plugins.getMemberAccessor().set(executor.getClass().getDeclaredField("databaseConfigImportExecutor"), executor, databaseConfigImportExecutor); Plugins.getMemberAccessor().set(databaseConfigImportExecutor.getClass().getDeclaredField("validateHandler"), databaseConfigImportExecutor, mock(DataSourcePoolPropertiesValidator.class)); } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataExecutorTest.java similarity index 91% rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataExecutorTest.java index 0befe8d96bae2..c48786f307c8d 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/ImportMetaDataExecutorTest.java @@ -59,7 +59,7 @@ @ExtendWith(AutoMockExtension.class) @StaticMockSettings(ProxyContext.class) @MockitoSettings(strictness = Strictness.LENIENT) -class ImportMetaDataUpdaterTest { +class ImportMetaDataExecutorTest { private static final String METADATA_VALUE = "eyJtZXRhX2RhdGEiOnsiZGF0YWJhc2VzIjp7InNoYXJkaW5nX2RiIjoiZGF0YWJhc2VOYW1lOiBzaGFyZGluZ19kYlxuZGF0YVNvdXJjZXM6XG5ydWxlczpcbiJ9LCJwcm9w" + "cyI6InByb3BzOlxuICBzeXN0ZW0tbG9nLWxldmVsOiBJTkZPXG4gIHNxbC1zaG93OiBmYWxzZVxuIiwicnVsZXMiOiJydWxlczpcbi0gIUFVVEhPUklUWVxuICBwcml2aWxlZ2U6XG4gICAgdHlwZTogQUxMX1BFUk1JVFRFR" @@ -67,7 +67,7 @@ class ImportMetaDataUpdaterTest { private static final String EMPTY = "empty_metadata"; - private ImportMetaDataExecutor importMetaDataUpdater; + private ImportMetaDataExecutor executor; private final Map featureMap = new HashMap<>(1, 1F); @@ -79,25 +79,25 @@ void setup() { @Test void assertCheckImportEmptyMetaData() { init(null); - assertThrows(MissingRequiredDataSourcesException.class, () -> importMetaDataUpdater.executeUpdate( - new ImportMetaDataStatement(null, Objects.requireNonNull(ImportMetaDataUpdaterTest.class.getResource(featureMap.get(EMPTY))).getPath()), mock(ContextManager.class))); + assertThrows(MissingRequiredDataSourcesException.class, () -> executor.executeUpdate( + new ImportMetaDataStatement(null, Objects.requireNonNull(ImportMetaDataExecutorTest.class.getResource(featureMap.get(EMPTY))).getPath()), mock(ContextManager.class))); } @Test void assertImportMetaDataFromJsonValue() { init(EMPTY); - assertThrows(NullPointerException.class, () -> importMetaDataUpdater.executeUpdate(new ImportMetaDataStatement(METADATA_VALUE, null), mock(ContextManager.class))); + assertThrows(NullPointerException.class, () -> executor.executeUpdate(new ImportMetaDataStatement(METADATA_VALUE, null), mock(ContextManager.class))); } @Test void assertImportExistedMetaDataFromFile() { init(EMPTY); - assertThrows(UnsupportedSQLOperationException.class, () -> importMetaDataUpdater.executeUpdate( - new ImportMetaDataStatement(null, Objects.requireNonNull(ImportMetaDataUpdaterTest.class.getResource(featureMap.get(EMPTY))).getPath()), mock(ContextManager.class))); + assertThrows(UnsupportedSQLOperationException.class, () -> executor.executeUpdate( + new ImportMetaDataStatement(null, Objects.requireNonNull(ImportMetaDataExecutorTest.class.getResource(featureMap.get(EMPTY))).getPath()), mock(ContextManager.class))); } private void init(final String feature) { - importMetaDataUpdater = new ImportMetaDataExecutor(); + executor = new ImportMetaDataExecutor(); ContextManager contextManager = mockContextManager(feature); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); when(ProxyContext.getInstance().databaseExists(feature)).thenReturn(true); diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterExecutorTest.java similarity index 94% rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterUpdaterTest.java rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterExecutorTest.java index 03af35d1afe95..b14babcb81ef5 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterExecutorTest.java @@ -37,13 +37,14 @@ @ExtendWith(AutoMockExtension.class) @StaticMockSettings(ProxyContext.class) -class LockClusterUpdaterTest { +class LockClusterExecutorTest { + + private final LockClusterExecutor executor = new LockClusterExecutor(); @Test void assertExecuteUpdateWithLockedCluster() { ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(contextManager.getClusterStateContext().getCurrentState()).thenReturn(ClusterState.UNAVAILABLE); - LockClusterExecutor executor = new LockClusterExecutor(); assertThrows(IllegalStateException.class, () -> executor.executeUpdate(new LockClusterStatement(new AlgorithmSegment("FOO", new Properties())), contextManager)); } @@ -51,7 +52,6 @@ void assertExecuteUpdateWithLockedCluster() { void assertExecuteUpdateWithWrongAlgorithm() { ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(contextManager.getClusterStateContext().getCurrentState()).thenReturn(ClusterState.OK); - LockClusterExecutor executor = new LockClusterExecutor(); assertThrows(ServiceProviderNotFoundException.class, () -> executor.executeUpdate(new LockClusterStatement(new AlgorithmSegment("FOO", new Properties())), contextManager)); } } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutorTest.java similarity index 94% rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutorTest.java index 211500ea557dd..7320c3db88d7b 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutorTest.java @@ -51,12 +51,13 @@ @ExtendWith(AutoMockExtension.class) @StaticMockSettings(ProxyContext.class) -class SetDistVariableUpdaterTest { +class SetDistVariableExecutorTest { + + private final SetDistVariableExecutor executor = new SetDistVariableExecutor(); @Test void assertExecuteWithConfigurationKey() throws SQLException { SetDistVariableStatement statement = new SetDistVariableStatement("proxy_frontend_flush_threshold", "1024"); - SetDistVariableExecutor executor = new SetDistVariableExecutor(); ContextManager contextManager = mockContextManager(); executor.executeUpdate(statement, contextManager); Object actualValue = contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("proxy-frontend-flush-threshold"); @@ -67,7 +68,6 @@ void assertExecuteWithConfigurationKey() throws SQLException { @Test void assertExecuteWithTemporaryConfigurationKey() throws SQLException { SetDistVariableStatement statement = new SetDistVariableStatement("proxy_meta_data_collector_enabled", "false"); - SetDistVariableExecutor executor = new SetDistVariableExecutor(); ContextManager contextManager = mockContextManager(); executor.executeUpdate(statement, contextManager); Object actualValue = contextManager.getMetaDataContexts().getMetaData().getTemporaryProps().getProps().get("proxy-meta-data-collector-enabled"); @@ -78,7 +78,6 @@ void assertExecuteWithTemporaryConfigurationKey() throws SQLException { @Test void assertExecuteWithTypedSPI() throws SQLException { SetDistVariableStatement statement = new SetDistVariableStatement("proxy_frontend_database_protocol_type", "MySQL"); - SetDistVariableExecutor executor = new SetDistVariableExecutor(); ContextManager contextManager = mockContextManager(); executor.executeUpdate(statement, contextManager); Object actualValue = contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("proxy-frontend-database-protocol-type"); @@ -89,7 +88,6 @@ void assertExecuteWithTypedSPI() throws SQLException { @Test void assertExecuteWithSystemLogLevel() throws SQLException { SetDistVariableStatement statement = new SetDistVariableStatement("system_log_level", "debug"); - SetDistVariableExecutor executor = new SetDistVariableExecutor(); ContextManager contextManager = mockContextManager(); executor.executeUpdate(statement, contextManager); Object actualValue = contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("system-log-level"); @@ -101,7 +99,6 @@ void assertExecuteWithSystemLogLevel() throws SQLException { void assertExecuteWithWrongSystemLogLevel() { ContextManager contextManager = mockContextManager(); SetDistVariableStatement statement = new SetDistVariableStatement("system_log_level", "invalid"); - SetDistVariableExecutor executor = new SetDistVariableExecutor(); assertThrows(InvalidValueException.class, () -> executor.executeUpdate(statement, contextManager)); } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetInstanceStatusUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetInstanceStatusExecutorTest.java similarity index 91% rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetInstanceStatusUpdaterTest.java rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetInstanceStatusExecutorTest.java index b1ad292722a49..088d2e410f1bd 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetInstanceStatusUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetInstanceStatusExecutorTest.java @@ -28,11 +28,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -class SetInstanceStatusUpdaterTest { +class SetInstanceStatusExecutorTest { + + private final SetInstanceStatusExecutor executor = new SetInstanceStatusExecutor(); @Test void assertExecuteUpdateWithNotExistsInstanceID() { - SetInstanceStatusExecutor executor = new SetInstanceStatusExecutor(); assertThrows(UnsupportedSQLOperationException.class, () -> executor.executeUpdate(new SetInstanceStatusStatement("ENABLE", "instanceID"), mock(ContextManager.class, RETURNS_DEEP_STUBS))); } @@ -40,7 +41,6 @@ void assertExecuteUpdateWithNotExistsInstanceID() { void assertExecuteUpdateWithCurrentUsingInstance() { ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(contextManager.getInstanceContext().getInstance().getCurrentInstanceId()).thenReturn("instanceID"); - SetInstanceStatusExecutor executor = new SetInstanceStatusExecutor(); assertThrows(UnsupportedSQLOperationException.class, () -> executor.executeUpdate(new SetInstanceStatusStatement("DISABLE", "instanceID"), contextManager)); } @@ -50,7 +50,6 @@ void assertExecuteUpdateWithAlreadyDisableInstance() { when(contextManager.getInstanceContext().getInstance().getCurrentInstanceId()).thenReturn("currentInstance"); when(contextManager.getInstanceContext().getComputeNodeInstanceById("instanceID").isPresent()).thenReturn(true); when(contextManager.getInstanceContext().getComputeNodeInstanceById("instanceID").get().getState().getCurrentState()).thenReturn(InstanceState.CIRCUIT_BREAK); - SetInstanceStatusExecutor executor = new SetInstanceStatusExecutor(); assertThrows(UnsupportedSQLOperationException.class, () -> executor.executeUpdate(new SetInstanceStatusStatement("DISABLE", "instanceID"), contextManager)); } } diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterUpdaterTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterExecutorTest.java similarity index 94% rename from proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterUpdaterTest.java rename to proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterExecutorTest.java index 99cf52eb10f24..ff4e3365d57e3 100644 --- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterUpdaterTest.java +++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/UnlockClusterExecutorTest.java @@ -33,14 +33,15 @@ @ExtendWith(AutoMockExtension.class) @StaticMockSettings(ProxyContext.class) -class UnlockClusterUpdaterTest { +class UnlockClusterExecutorTest { + + private final UnlockClusterExecutor executor = new UnlockClusterExecutor(); @Test void assertExecuteUpdateWithNotLockedCluster() { ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS); when(contextManager.getClusterStateContext().getCurrentState()).thenReturn(ClusterState.OK); when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager); - UnlockClusterExecutor executor = new UnlockClusterExecutor(); assertThrows(IllegalStateException.class, () -> executor.executeUpdate(new UnlockClusterStatement(), contextManager)); } }