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 ae8111cc167 Remove useless VersionNodePathParser.findIdentifierByActiveVersionPath() (#34913) ae8111cc167 is described below commit ae8111cc16771c8580b2f7c65a06317a73d563aa Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Fri Mar 7 14:05:03 2025 +0800 Remove useless VersionNodePathParser.findIdentifierByActiveVersionPath() (#34913) --- .../mode/node/path/version/VersionNodePathParser.java | 14 -------------- .../node/path/version/VersionNodePathParserTest.java | 17 ----------------- 2 files changed, 31 deletions(-) diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParser.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParser.java index 52f1dafe350..dc9904f8771 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParser.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParser.java @@ -19,8 +19,6 @@ package org.apache.shardingsphere.mode.node.path.version; import org.apache.shardingsphere.mode.node.path.NodePath; -import java.util.Optional; -import java.util.regex.Matcher; import java.util.regex.Pattern; /** @@ -44,16 +42,4 @@ public final class VersionNodePathParser { public boolean isActiveVersionPath(final String path) { return activeVersionPattern.matcher(path).find(); } - - /** - * Find identifier name by active version path. - * - * @param activeVersionPath active version path - * @param identifierGroupIndex identifier group index - * @return found identifier - */ - public Optional<String> findIdentifierByActiveVersionPath(final String activeVersionPath, final int identifierGroupIndex) { - Matcher matcher = activeVersionPattern.matcher(activeVersionPath); - return matcher.find() ? Optional.of(matcher.group(identifierGroupIndex)) : Optional.empty(); - } } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParserTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParserTest.java index 15c744cedf7..b39a256b71d 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParserTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePathParserTest.java @@ -21,11 +21,6 @@ import org.apache.shardingsphere.mode.node.path.engine.searcher.NodePathPattern; import org.apache.shardingsphere.mode.node.path.type.database.metadata.schema.TableMetadataNodePath; import org.junit.jupiter.api.Test; -import java.util.Optional; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; class VersionNodePathParserTest { @@ -36,16 +31,4 @@ class VersionNodePathParserTest { void assertIsActiveVersionPath() { assertTrue(parser.isActiveVersionPath("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/active_version")); } - - @Test - void assertFindIdentifierByActiveVersionPath() { - String path = "/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/active_version"; - assertThat(parser.findIdentifierByActiveVersionPath(path, 1), is(Optional.of("foo_tbl"))); - } - - @Test - void assertNotFindIdentifierByActiveVersionPath() { - String path = "/metadata/foo_db/schemas/foo_schema/tables/foo_tbl/versions"; - assertFalse(parser.findIdentifierByActiveVersionPath(path, 1).isPresent()); - } }