This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 251235055fc Remove GlobalPropertiesNodePathParser (#34763)
251235055fc is described below

commit 251235055fc5d9e7407badb4f401da43096dbe29
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Feb 23 19:59:46 2025 +0800

    Remove GlobalPropertiesNodePathParser (#34763)
---
 .../config/global/GlobalPropertiesNodePath.java    |  2 --
 .../global/GlobalPropertiesNodePathParser.java     | 41 ----------------------
 .../global/GlobalPropertiesNodePathTest.java       | 10 ++++++
 .../global/type/PropertiesChangedHandler.java      |  4 +--
 4 files changed, 12 insertions(+), 45 deletions(-)

diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePath.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePath.java
index 46dec6967c1..b6e62371ec9 100644
--- 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePath.java
+++ 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePath.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.mode.node.path.config.global;
 
-import lombok.Getter;
 import org.apache.shardingsphere.mode.node.path.NodePath;
 import org.apache.shardingsphere.mode.node.path.NodePathEntity;
 
@@ -25,6 +24,5 @@ import 
org.apache.shardingsphere.mode.node.path.NodePathEntity;
  * Global properties node path.
  */
 @NodePathEntity("/props")
-@Getter
 public final class GlobalPropertiesNodePath implements NodePath {
 }
diff --git 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePathParser.java
 
b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePathParser.java
deleted file mode 100644
index f8871ced145..00000000000
--- 
a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePathParser.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.mode.node.path.config.global;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
-import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser;
-
-/**
- * Global properties node path parser.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class GlobalPropertiesNodePathParser {
-    
-    private static final VersionNodePathParser VERSION_PARSER = new 
VersionNodePathParser(NodePathGenerator.toPath(new GlobalPropertiesNodePath(), 
false));
-    
-    /**
-     * Get properties version node path parser.
-     *
-     * @return properties version node path parser
-     */
-    public static VersionNodePathParser getVersion() {
-        return VERSION_PARSER;
-    }
-}
diff --git 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePathTest.java
 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePathTest.java
index 50144d28739..6a8fefa4eb3 100644
--- 
a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePathTest.java
+++ 
b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/config/global/GlobalPropertiesNodePathTest.java
@@ -18,10 +18,13 @@
 package org.apache.shardingsphere.mode.node.path.config.global;
 
 import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
+import org.apache.shardingsphere.mode.node.path.NodePathSearcher;
+import org.apache.shardingsphere.mode.node.path.version.VersionNodePathParser;
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class GlobalPropertiesNodePathTest {
     
@@ -29,4 +32,11 @@ class GlobalPropertiesNodePathTest {
     void assertToPath() {
         assertThat(NodePathGenerator.toPath(new GlobalPropertiesNodePath(), 
false), is("/props"));
     }
+    
+    @Test
+    void assertGetVersion() {
+        VersionNodePathParser versionNodePathParser = 
NodePathSearcher.getVersion(new GlobalPropertiesNodePath());
+        
assertTrue(versionNodePathParser.isActiveVersionPath("/props/active_version"));
+        assertTrue(versionNodePathParser.isVersionPath("/props/versions/0"));
+    }
 }
diff --git 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/PropertiesChangedHandler.java
 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/PropertiesChangedHandler.java
index ed05e5f01cd..c0d72c0f216 100644
--- 
a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/PropertiesChangedHandler.java
+++ 
b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/type/PropertiesChangedHandler.java
@@ -23,8 +23,8 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.checker.ActiveVersionChecker;
 import 
org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global.GlobalDataChangedEventHandler;
 import org.apache.shardingsphere.mode.node.path.NodePathGenerator;
+import org.apache.shardingsphere.mode.node.path.NodePathSearcher;
 import 
org.apache.shardingsphere.mode.node.path.config.global.GlobalPropertiesNodePath;
-import 
org.apache.shardingsphere.mode.node.path.config.global.GlobalPropertiesNodePathParser;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -46,7 +46,7 @@ public final class PropertiesChangedHandler implements 
GlobalDataChangedEventHan
     
     @Override
     public void handle(final ContextManager contextManager, final 
DataChangedEvent event) {
-        if 
(!GlobalPropertiesNodePathParser.getVersion().isActiveVersionPath(event.getKey()))
 {
+        if (!NodePathSearcher.getVersion(new 
GlobalPropertiesNodePath()).isActiveVersionPath(event.getKey())) {
             return;
         }
         ActiveVersionChecker.checkActiveVersion(contextManager, event);

Reply via email to