From 42247f8bfc10799162e281c35a4ab3e1096fa7d4 Mon Sep 17 00:00:00 2001 From: zhangliang Date: Sun, 12 Jan 2025 19:15:19 +0800 Subject: [PATCH] Refactor GlobalPropertiesNodePath --- .../shardingsphere/mode/path/GlobalPropertiesNodePath.java | 2 +- .../mode/path/GlobalPropertiesNodePathTest.java | 4 ++-- .../dispatch/handler/global/PropertiesChangedHandler.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePath.java b/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePath.java index 5ca76b8272184..e5228b8d21b58 100644 --- a/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePath.java +++ b/mode/api/src/main/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePath.java @@ -78,7 +78,7 @@ public static String getActiveVersionPath() { * @param path path * @return true or false */ - public static boolean issActiveVersionPath(final String path) { + public static boolean isActiveVersionPath(final String path) { Pattern pattern = Pattern.compile(getActiveVersionPath() + "$", Pattern.CASE_INSENSITIVE); Matcher matcher = pattern.matcher(path); return matcher.find(); diff --git a/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePathTest.java b/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePathTest.java index 8717bd5ed25d6..14c9023d2f85e 100644 --- a/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePathTest.java +++ b/mode/api/src/test/java/org/apache/shardingsphere/mode/path/GlobalPropertiesNodePathTest.java @@ -46,7 +46,7 @@ void assertGetActiveVersionPath() { } @Test - void assertIssActiveVersionPath() { - assertTrue(GlobalPropertiesNodePath.issActiveVersionPath("/props/active_version")); + void assertIsActiveVersionPath() { + assertTrue(GlobalPropertiesNodePath.isActiveVersionPath("/props/active_version")); } } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java index 3fa9687a1c7c7..4c1667cd572b1 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/PropertiesChangedHandler.java @@ -44,7 +44,7 @@ public Collection getSubscribedTypes() { @Override public void handle(final ContextManager contextManager, final DataChangedEvent event) { - if (!GlobalPropertiesNodePath.issActiveVersionPath(event.getKey())) { + if (!GlobalPropertiesNodePath.isActiveVersionPath(event.getKey())) { return; } ActiveVersionChecker.checkActiveVersion(contextManager, event);