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 8cdcd74114f Remove NodePathGenerator.toPath (#34970) 8cdcd74114f is described below commit 8cdcd74114fed942b0a3a51351ba333141e3f429 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Thu Mar 13 12:23:41 2025 +0800 Remove NodePathGenerator.toPath (#34970) --- ...ittingQualifiedDataSourceChangedSubscriber.java | 2 +- .../collect/StatisticsCollectJobWorker.java | 2 +- .../database/DataSourceUnitPersistService.java | 4 ++-- .../database/DatabaseRulePersistService.java | 6 +++--- .../config/global/GlobalRulePersistService.java | 2 +- .../service/DatabaseMetaDataPersistService.java | 6 +++--- .../service/SchemaMetaDataPersistService.java | 6 +++--- .../service/TableMetaDataPersistService.java | 4 ++-- .../service/TableRowDataPersistService.java | 10 ++++----- .../service/ViewMetaDataPersistService.java | 4 ++-- .../statistics/StatisticsPersistService.java | 10 ++++----- .../mode/node/ComputeNodePersistService.java | 24 +++++++++++----------- .../QualifiedDataSourceStatePersistService.java | 6 +++--- .../mode/state/StatePersistService.java | 4 ++-- .../path/engine/generator/NodePathGenerator.java | 21 +++++-------------- .../path/engine/generator/NodePathSegment.java | 4 +--- .../path/engine/searcher/NodePathSearcher.java | 2 +- .../mode/node/path/version/VersionNodePath.java | 2 +- .../mode/node/rule/tuple/RuleNodeTuple.java | 2 +- .../path/engine/generator/NodePathSegmentTest.java | 6 +++--- .../database/SchemaMetaDataNodePathTest.java | 2 +- .../database/TableMetaDataNodePathTest.java | 5 ++--- .../database/ViewMetaDataNodePathTest.java | 4 ++-- .../metadata/rule/DatabaseRuleNodePathTest.java | 8 ++++---- .../metadata/storage/StorageNodeNodePathTest.java | 4 ++-- .../metadata/storage/StorageUnitNodePathTest.java | 4 ++-- .../statistics/StatisticsDataNodePathTest.java | 2 +- .../statistics/StatisticsDatabaseNodePathTest.java | 4 ++-- .../statistics/StatisticsJobNodePathTest.java | 2 +- .../statistics/StatisticsSchemaNodePathTest.java | 4 ++-- .../statistics/StatisticsTableNodePathTest.java | 4 ++-- .../config/GlobalPropertiesNodePathTest.java | 2 +- .../type/global/config/GlobalRuleNodePathTest.java | 4 ++-- .../type/global/execution/ProcessNodePathTest.java | 4 ++-- .../node/compute/label/LabelNodePathTest.java | 2 +- .../process/KillProcessTriggerNodePathTest.java | 4 ++-- .../ShowProcessListTriggerNodePathTest.java | 4 ++-- .../node/compute/status/OnlineNodePathTest.java | 6 +++--- .../node/compute/status/StatusNodePathTest.java | 4 ++-- .../workerid/ComputeNodeWorkerIDNodePathTest.java | 2 +- .../storage/QualifiedDataSourceNodePathTest.java | 4 ++-- .../WorkerIDReservationNodePathTest.java | 4 ++-- .../DatabaseListenerCoordinatorNodePathTest.java | 4 ++-- .../path/type/global/state/StateNodePathTest.java | 2 +- .../state/DatabaseListenerChangedHandler.java | 2 +- .../listener/DataChangedEventListenerRegistry.java | 4 ++-- .../ClusterDatabaseListenerPersistCoordinator.java | 4 ++-- .../process/ClusterProcessPersistCoordinator.java | 6 +++--- .../service/ClusterProcessPersistService.java | 14 ++++++------- .../workerid/ReservationPersistService.java | 2 +- .../config/type/GlobalRuleChangedHandlerTest.java | 2 +- .../config/type/PropertiesChangedHandlerTest.java | 2 +- .../type/ComputeNodeLabelChangedHandlerTest.java | 2 +- .../compute/type/ComputeNodeOnlineHandlerTest.java | 2 +- .../type/ComputeNodeStateChangedHandlerTest.java | 2 +- .../ComputeNodeWorkerIdChangedHandlerTest.java | 2 +- .../node/process/KillProcessHandlerTest.java | 2 +- .../node/process/ShowProcessListHandlerTest.java | 2 +- .../statistics/StatisticsChangedHandlerTest.java | 2 +- .../QualifiedDataSourceChangedHandlerTest.java | 2 +- .../state/DatabaseListenerChangedHandlerTest.java | 2 +- .../global/state/StateChangedHandlerTest.java | 2 +- 62 files changed, 129 insertions(+), 143 deletions(-) diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/deliver/ReadwriteSplittingQualifiedDataSourceChangedSubscriber.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/deliver/ReadwriteSplittingQualifiedDataSourceChangedSubscriber.java index 0c0caa02e6f..dcc0f75c267 100644 --- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/deliver/ReadwriteSplittingQualifiedDataSourceChangedSubscriber.java +++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/deliver/ReadwriteSplittingQualifiedDataSourceChangedSubscriber.java @@ -39,6 +39,6 @@ public final class ReadwriteSplittingQualifiedDataSourceChangedSubscriber implem */ @Subscribe public void delete(final QualifiedDataSourceDeletedEvent event) { - repository.delete(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(event.getQualifiedDataSource()), false)); + repository.delete(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(event.getQualifiedDataSource()))); } } diff --git a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java index be9ab5df1e3..44046bcac82 100644 --- a/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java +++ b/kernel/schedule/core/src/main/java/org/apache/shardingsphere/schedule/core/job/statistics/collect/StatisticsCollectJobWorker.java @@ -69,7 +69,7 @@ public final class StatisticsCollectJobWorker { private CoordinatorRegistryCenter createRegistryCenter(final ModeConfiguration modeConfig) { ClusterPersistRepositoryConfiguration repositoryConfig = (ClusterPersistRepositoryConfiguration) modeConfig.getRepository(); - String namespace = repositoryConfig.getNamespace() + NodePathGenerator.toPath(new StatisticsJobNodePath(), false); + String namespace = repositoryConfig.getNamespace() + NodePathGenerator.toPath(new StatisticsJobNodePath()); CoordinatorRegistryCenter result = new ZookeeperRegistryCenter(getZookeeperConfiguration(repositoryConfig, namespace)); result.init(); return result; diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistService.java index 152bb2986b7..8ebeb0a7b42 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DataSourceUnitPersistService.java @@ -56,7 +56,7 @@ public final class DataSourceUnitPersistService { * @return data source pool properties map */ public Map<String, DataSourcePoolProperties> load(final String databaseName) { - Collection<String> childrenKeys = repository.getChildrenKeys(NodePathGenerator.toPath(new StorageUnitNodePath(databaseName, null), false)); + Collection<String> childrenKeys = repository.getChildrenKeys(NodePathGenerator.toPath(new StorageUnitNodePath(databaseName, null))); return childrenKeys.stream().collect(Collectors.toMap(each -> each, each -> load(databaseName, each), (a, b) -> b, () -> new LinkedHashMap<>(childrenKeys.size(), 1F))); } @@ -95,6 +95,6 @@ public final class DataSourceUnitPersistService { * @param dataSourceName data source name */ public void delete(final String databaseName, final String dataSourceName) { - repository.delete(NodePathGenerator.toPath(new StorageUnitNodePath(databaseName, dataSourceName), false)); + repository.delete(NodePathGenerator.toPath(new StorageUnitNodePath(databaseName, dataSourceName))); } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java index dea58865b1e..39641d8b6a8 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/database/DatabaseRulePersistService.java @@ -66,7 +66,7 @@ public final class DatabaseRulePersistService { * @return configurations */ public Collection<RuleConfiguration> load(final String databaseName) { - return repository.getChildrenKeys(NodePathGenerator.toPath(new DatabaseRuleNodePath(databaseName, null, null), false)).stream() + return repository.getChildrenKeys(NodePathGenerator.toPath(new DatabaseRuleNodePath(databaseName, null, null))).stream() .map(each -> load(databaseName, each)).collect(Collectors.toList()); } @@ -93,7 +93,7 @@ public final class DatabaseRulePersistService { } private Collection<DatabaseRuleNodePath> getNamedItemNodePaths(final String databaseName, final String ruleType, final String namedItem) { - return repository.getChildrenKeys(NodePathGenerator.toPath(new DatabaseRuleNodePath(databaseName, ruleType, new DatabaseRuleItem(namedItem)), false)).stream() + return repository.getChildrenKeys(NodePathGenerator.toPath(new DatabaseRuleNodePath(databaseName, ruleType, new DatabaseRuleItem(namedItem)))).stream() .map(each -> new DatabaseRuleNodePath(databaseName, ruleType, new DatabaseRuleItem(namedItem, each))).collect(Collectors.toList()); } @@ -124,7 +124,7 @@ public final class DatabaseRulePersistService { * @param ruleType rule type */ public void delete(final String databaseName, final String ruleType) { - repository.delete(NodePathGenerator.toPath(new DatabaseRuleNodePath(databaseName, ruleType, null), false)); + repository.delete(NodePathGenerator.toPath(new DatabaseRuleNodePath(databaseName, ruleType, null))); } /** diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/global/GlobalRulePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/global/GlobalRulePersistService.java index 0821aa388df..1713863d83b 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/global/GlobalRulePersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/config/global/GlobalRulePersistService.java @@ -58,7 +58,7 @@ public final class GlobalRulePersistService { * @return global rule configurations */ public Collection<RuleConfiguration> load() { - return repository.getChildrenKeys(NodePathGenerator.toPath(new GlobalRuleNodePath(null), false)).stream().map(this::load).collect(Collectors.toList()); + return repository.getChildrenKeys(NodePathGenerator.toPath(new GlobalRuleNodePath(null))).stream().map(this::load).collect(Collectors.toList()); } /** diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/DatabaseMetaDataPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/DatabaseMetaDataPersistService.java index b48b91ff9f7..c4f156cf013 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/DatabaseMetaDataPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/DatabaseMetaDataPersistService.java @@ -38,7 +38,7 @@ public final class DatabaseMetaDataPersistService { * @param databaseName to be added database name */ public void add(final String databaseName) { - repository.persist(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName), false), ""); + repository.persist(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName)), ""); } /** @@ -47,7 +47,7 @@ public final class DatabaseMetaDataPersistService { * @param databaseName to be dropped database name */ public void drop(final String databaseName) { - repository.delete(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName), false)); + repository.delete(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName))); } /** @@ -56,6 +56,6 @@ public final class DatabaseMetaDataPersistService { * @return loaded database names */ public Collection<String> loadAllDatabaseNames() { - return repository.getChildrenKeys(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(null), false)); + return repository.getChildrenKeys(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(null))); } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/SchemaMetaDataPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/SchemaMetaDataPersistService.java index 7742480610f..ab4a03e0d52 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/SchemaMetaDataPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/SchemaMetaDataPersistService.java @@ -53,7 +53,7 @@ public final class SchemaMetaDataPersistService { * @param schemaName to be added schema name */ public void add(final String databaseName, final String schemaName) { - repository.persist(NodePathGenerator.toPath(new TableMetaDataNodePath(databaseName, schemaName, null), false), ""); + repository.persist(NodePathGenerator.toPath(new TableMetaDataNodePath(databaseName, schemaName, null)), ""); } /** @@ -63,7 +63,7 @@ public final class SchemaMetaDataPersistService { * @param schemaName to be dropped schema name */ public void drop(final String databaseName, final String schemaName) { - repository.delete(NodePathGenerator.toPath(new SchemaMetaDataNodePath(databaseName, schemaName), false)); + repository.delete(NodePathGenerator.toPath(new SchemaMetaDataNodePath(databaseName, schemaName))); } /** @@ -113,7 +113,7 @@ public final class SchemaMetaDataPersistService { * @return schemas */ public Collection<ShardingSphereSchema> load(final String databaseName) { - return repository.getChildrenKeys(NodePathGenerator.toPath(new SchemaMetaDataNodePath(databaseName, null), false)).stream() + return repository.getChildrenKeys(NodePathGenerator.toPath(new SchemaMetaDataNodePath(databaseName, null))).stream() .map(each -> new ShardingSphereSchema(each, tableMetaDataPersistService.load(databaseName, each), viewMetaDataPersistService.load(databaseName, each))).collect(Collectors.toList()); } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistService.java index 6c1c5428a61..a31830e2dae 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableMetaDataPersistService.java @@ -51,7 +51,7 @@ public final class TableMetaDataPersistService { * @return loaded tables */ public Collection<ShardingSphereTable> load(final String databaseName, final String schemaName) { - return repository.getChildrenKeys(NodePathGenerator.toPath(new TableMetaDataNodePath(databaseName, schemaName, null), false)).stream() + return repository.getChildrenKeys(NodePathGenerator.toPath(new TableMetaDataNodePath(databaseName, schemaName, null))).stream() .map(each -> load(databaseName, schemaName, each)).collect(Collectors.toList()); } @@ -93,7 +93,7 @@ public final class TableMetaDataPersistService { * @param tableName to be dropped table name */ public void drop(final String databaseName, final String schemaName, final String tableName) { - repository.delete(NodePathGenerator.toPath(new TableMetaDataNodePath(databaseName, schemaName, tableName.toLowerCase()), false)); + repository.delete(NodePathGenerator.toPath(new TableMetaDataNodePath(databaseName, schemaName, tableName.toLowerCase()))); } /** diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableRowDataPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableRowDataPersistService.java index 75893511fd2..833b301b83e 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableRowDataPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/TableRowDataPersistService.java @@ -50,9 +50,9 @@ public final class TableRowDataPersistService { */ public void persist(final String databaseName, final String schemaName, final String tableName, final Collection<YamlRowStatistics> rows) { if (rows.isEmpty()) { - repository.persist(NodePathGenerator.toPath(new StatisticsTableNodePath(databaseName, schemaName, tableName.toLowerCase()), false), ""); + repository.persist(NodePathGenerator.toPath(new StatisticsTableNodePath(databaseName, schemaName, tableName.toLowerCase())), ""); } else { - rows.forEach(each -> repository.persist(NodePathGenerator.toPath(new StatisticsDataNodePath(databaseName, schemaName, tableName.toLowerCase(), each.getUniqueKey()), false), + rows.forEach(each -> repository.persist(NodePathGenerator.toPath(new StatisticsDataNodePath(databaseName, schemaName, tableName.toLowerCase(), each.getUniqueKey())), YamlEngine.marshal(each))); } } @@ -66,7 +66,7 @@ public final class TableRowDataPersistService { * @param rows rows */ public void delete(final String databaseName, final String schemaName, final String tableName, final Collection<YamlRowStatistics> rows) { - rows.forEach(each -> repository.delete(NodePathGenerator.toPath(new StatisticsDataNodePath(databaseName, schemaName, tableName.toLowerCase(), each.getUniqueKey()), false))); + rows.forEach(each -> repository.delete(NodePathGenerator.toPath(new StatisticsDataNodePath(databaseName, schemaName, tableName.toLowerCase(), each.getUniqueKey())))); } /** @@ -80,8 +80,8 @@ public final class TableRowDataPersistService { public TableStatistics load(final String databaseName, final String schemaName, final ShardingSphereTable table) { TableStatistics result = new TableStatistics(table.getName()); YamlRowStatisticsSwapper swapper = new YamlRowStatisticsSwapper(new ArrayList<>(table.getAllColumns())); - for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsTableNodePath(databaseName, schemaName, table.getName()), false))) { - String yamlRow = repository.query(NodePathGenerator.toPath(new StatisticsDataNodePath(databaseName, schemaName, table.getName(), each), false)); + for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsTableNodePath(databaseName, schemaName, table.getName())))) { + String yamlRow = repository.query(NodePathGenerator.toPath(new StatisticsDataNodePath(databaseName, schemaName, table.getName(), each))); if (!Strings.isNullOrEmpty(yamlRow)) { result.getRows().add(swapper.swapToObject(YamlEngine.unmarshal(yamlRow, YamlRowStatistics.class))); } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/ViewMetaDataPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/ViewMetaDataPersistService.java index 82e48ecc70b..69d1a94cde9 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/ViewMetaDataPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/metadata/service/ViewMetaDataPersistService.java @@ -51,7 +51,7 @@ public final class ViewMetaDataPersistService { * @return loaded views */ public Collection<ShardingSphereView> load(final String databaseName, final String schemaName) { - return repository.getChildrenKeys(NodePathGenerator.toPath(new ViewMetaDataNodePath(databaseName, schemaName, null), false)).stream() + return repository.getChildrenKeys(NodePathGenerator.toPath(new ViewMetaDataNodePath(databaseName, schemaName, null))).stream() .map(each -> load(databaseName, schemaName, each)).collect(Collectors.toList()); } @@ -93,6 +93,6 @@ public final class ViewMetaDataPersistService { * @param viewName to be dropped view name */ public void drop(final String databaseName, final String schemaName, final String viewName) { - repository.delete(NodePathGenerator.toPath(new ViewMetaDataNodePath(databaseName, schemaName, viewName.toLowerCase()), false)); + repository.delete(NodePathGenerator.toPath(new ViewMetaDataNodePath(databaseName, schemaName, viewName.toLowerCase()))); } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java index 9dbff867be6..26f4b49bf12 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/statistics/StatisticsPersistService.java @@ -59,7 +59,7 @@ public final class StatisticsPersistService { * @return statistics */ public ShardingSphereStatistics load(final ShardingSphereMetaData metaData) { - Collection<String> databaseNames = repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsDatabaseNodePath(null), false)); + Collection<String> databaseNames = repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsDatabaseNodePath(null))); if (databaseNames.isEmpty()) { return new ShardingSphereStatistics(); } @@ -72,7 +72,7 @@ public final class StatisticsPersistService { private DatabaseStatistics load(final ShardingSphereDatabase database) { DatabaseStatistics result = new DatabaseStatistics(); - for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsSchemaNodePath(database.getName(), null), false)).stream() + for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsSchemaNodePath(database.getName(), null))).stream() .filter(database::containsSchema).collect(Collectors.toList())) { result.putSchemaStatistics(each, load(database.getName(), database.getSchema(each))); } @@ -81,7 +81,7 @@ public final class StatisticsPersistService { private SchemaStatistics load(final String databaseName, final ShardingSphereSchema schema) { SchemaStatistics result = new SchemaStatistics(); - for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsTableNodePath(databaseName, schema.getName(), null), false)).stream() + for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new StatisticsTableNodePath(databaseName, schema.getName(), null))).stream() .filter(schema::containsTable).collect(Collectors.toList())) { result.putTableStatistics(each, tableRowDataPersistService.load(databaseName, schema.getName(), schema.getTable(each))); @@ -104,7 +104,7 @@ public final class StatisticsPersistService { } private void persistSchema(final String databaseName, final String schemaName) { - repository.persist(NodePathGenerator.toPath(new StatisticsSchemaNodePath(databaseName, schemaName), false), ""); + repository.persist(NodePathGenerator.toPath(new StatisticsSchemaNodePath(databaseName, schemaName)), ""); } private void persistTableData(final ShardingSphereDatabase database, final String schemaName, final SchemaStatistics schemaStatistics) { @@ -141,6 +141,6 @@ public final class StatisticsPersistService { * @param databaseName database name */ public void delete(final String databaseName) { - repository.delete(NodePathGenerator.toPath(new StatisticsDatabaseNodePath(databaseName), false)); + repository.delete(NodePathGenerator.toPath(new StatisticsDatabaseNodePath(databaseName))); } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/node/ComputeNodePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/node/ComputeNodePersistService.java index 9d388840a8b..30c629503d9 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/node/ComputeNodePersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/node/ComputeNodePersistService.java @@ -67,7 +67,7 @@ public final class ComputeNodePersistService { private void persistOnline(final ComputeNodeInstance computeNodeInstance) { ComputeNodeData computeNodeData = new ComputeNodeData( computeNodeInstance.getMetaData().getDatabaseName(), computeNodeInstance.getMetaData().getAttributes(), computeNodeInstance.getMetaData().getVersion()); - repository.persistEphemeral(NodePathGenerator.toPath(new OnlineNodePath(computeNodeInstance.getMetaData().getType(), computeNodeInstance.getMetaData().getId()), false), + repository.persistEphemeral(NodePathGenerator.toPath(new OnlineNodePath(computeNodeInstance.getMetaData().getType(), computeNodeInstance.getMetaData().getId())), YamlEngine.marshal(new YamlComputeNodeDataSwapper().swapToYamlConfiguration(computeNodeData))); } @@ -77,7 +77,7 @@ public final class ComputeNodePersistService { * @param computeNodeInstance compute node instance */ public void offline(final ComputeNodeInstance computeNodeInstance) { - repository.delete(NodePathGenerator.toPath(new OnlineNodePath(computeNodeInstance.getMetaData().getType(), computeNodeInstance.getMetaData().getId()), false)); + repository.delete(NodePathGenerator.toPath(new OnlineNodePath(computeNodeInstance.getMetaData().getType(), computeNodeInstance.getMetaData().getId()))); } /** @@ -91,8 +91,8 @@ public final class ComputeNodePersistService { private Collection<ComputeNodeInstance> loadInstances(final InstanceType instanceType) { Collection<ComputeNodeInstance> result = new LinkedList<>(); - for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new OnlineNodePath(instanceType, null), false))) { - String value = repository.query(NodePathGenerator.toPath(new OnlineNodePath(instanceType, each), false)); + for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new OnlineNodePath(instanceType, null)))) { + String value = repository.query(NodePathGenerator.toPath(new OnlineNodePath(instanceType, each))); if (!Strings.isNullOrEmpty(value)) { result.add(loadInstance(InstanceMetaDataFactory.create(each, instanceType, new YamlComputeNodeDataSwapper().swapToObject(YamlEngine.unmarshal(value, YamlComputeNodeData.class))))); } @@ -115,12 +115,12 @@ public final class ComputeNodePersistService { } private String loadState(final String instanceId) { - return repository.query(NodePathGenerator.toPath(new StatusNodePath(instanceId), false)); + return repository.query(NodePathGenerator.toPath(new StatusNodePath(instanceId))); } @SuppressWarnings("unchecked") private Collection<String> loadLabels(final String instanceId) { - String yamlContent = repository.query(NodePathGenerator.toPath(new LabelNodePath(instanceId), false)); + String yamlContent = repository.query(NodePathGenerator.toPath(new LabelNodePath(instanceId))); return Strings.isNullOrEmpty(yamlContent) ? Collections.emptyList() : YamlEngine.unmarshal(yamlContent, Collection.class); } @@ -131,7 +131,7 @@ public final class ComputeNodePersistService { * @param instanceState instance state */ public void updateState(final String instanceId, final InstanceState instanceState) { - repository.persistEphemeral(NodePathGenerator.toPath(new StatusNodePath(instanceId), false), instanceState.name()); + repository.persistEphemeral(NodePathGenerator.toPath(new StatusNodePath(instanceId)), instanceState.name()); } /** @@ -141,7 +141,7 @@ public final class ComputeNodePersistService { * @param labels instance labels */ public void persistLabels(final String instanceId, final Collection<String> labels) { - repository.persistEphemeral(NodePathGenerator.toPath(new LabelNodePath(instanceId), false), YamlEngine.marshal(labels)); + repository.persistEphemeral(NodePathGenerator.toPath(new LabelNodePath(instanceId)), YamlEngine.marshal(labels)); } /** @@ -151,7 +151,7 @@ public final class ComputeNodePersistService { * @param workerId worker ID */ public void persistWorkerId(final String instanceId, final int workerId) { - repository.persistEphemeral(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(instanceId), false), String.valueOf(workerId)); + repository.persistEphemeral(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(instanceId)), String.valueOf(workerId)); } /** @@ -162,7 +162,7 @@ public final class ComputeNodePersistService { */ public Optional<Integer> loadWorkerId(final String instanceId) { try { - String workerId = repository.query(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(instanceId), false)); + String workerId = repository.query(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(instanceId))); return Strings.isNullOrEmpty(workerId) ? Optional.empty() : Optional.of(Integer.valueOf(workerId)); } catch (final NumberFormatException ex) { log.error("Invalid worker id for instance: {}", instanceId); @@ -176,8 +176,8 @@ public final class ComputeNodePersistService { * @return assigned worker IDs */ public Collection<Integer> getAssignedWorkerIds() { - Collection<String> instanceIds = repository.getChildrenKeys(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(null), false)); - return instanceIds.stream().map(each -> repository.query(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(each), false))) + Collection<String> instanceIds = repository.getChildrenKeys(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(null))); + return instanceIds.stream().map(each -> repository.query(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath(each)))) .filter(Objects::nonNull).map(Integer::parseInt).collect(Collectors.toSet()); } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/node/QualifiedDataSourceStatePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/node/QualifiedDataSourceStatePersistService.java index 343dfeae420..054b894722d 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/node/QualifiedDataSourceStatePersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/node/QualifiedDataSourceStatePersistService.java @@ -47,10 +47,10 @@ public final class QualifiedDataSourceStatePersistService { * @return loaded qualified data source states */ public Map<String, QualifiedDataSourceState> load() { - Collection<String> qualifiedDataSourceNodes = repository.getChildrenKeys(NodePathGenerator.toPath(new QualifiedDataSourceNodePath((String) null), false)); + Collection<String> qualifiedDataSourceNodes = repository.getChildrenKeys(NodePathGenerator.toPath(new QualifiedDataSourceNodePath((String) null))); Map<String, QualifiedDataSourceState> result = new HashMap<>(qualifiedDataSourceNodes.size(), 1F); qualifiedDataSourceNodes.forEach(each -> { - String yamlContent = repository.query(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(new QualifiedDataSource(each)), false)); + String yamlContent = repository.query(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(new QualifiedDataSource(each)))); if (!Strings.isNullOrEmpty(yamlContent)) { result.put(each, new YamlQualifiedDataSourceStateSwapper().swapToObject(YamlEngine.unmarshal(yamlContent, YamlQualifiedDataSourceState.class))); } @@ -68,7 +68,7 @@ public final class QualifiedDataSourceStatePersistService { */ public void update(final String databaseName, final String groupName, final String storageUnitName, final DataSourceState dataSourceState) { QualifiedDataSourceState status = new QualifiedDataSourceState(dataSourceState); - repository.persist(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(new QualifiedDataSource(databaseName, groupName, storageUnitName)), false), + repository.persist(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(new QualifiedDataSource(databaseName, groupName, storageUnitName))), YamlEngine.marshal(new YamlQualifiedDataSourceStateSwapper().swapToYamlConfiguration(status))); } } diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StatePersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StatePersistService.java index abc13fc0448..1eeb103bc92 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StatePersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/state/StatePersistService.java @@ -36,7 +36,7 @@ public final class StatePersistService { * @param state to be updated state */ public void update(final ShardingSphereState state) { - repository.persist(NodePathGenerator.toPath(new StateNodePath(), false), state.name()); + repository.persist(NodePathGenerator.toPath(new StateNodePath()), state.name()); } /** @@ -45,6 +45,6 @@ public final class StatePersistService { * @return loaded state */ public ShardingSphereState load() { - return ShardingSphereState.valueFrom(repository.query(NodePathGenerator.toPath(new StateNodePath(), false))); + return ShardingSphereState.valueFrom(repository.query(NodePathGenerator.toPath(new StateNodePath()))); } } diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathGenerator.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathGenerator.java index 49f10eb221a..ff39aff524b 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathGenerator.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathGenerator.java @@ -38,29 +38,18 @@ public final class NodePathGenerator { * Generate to path. * * @param nodePath node path - * @param trimEmptyNode null variable should trim parent node if true * @return path */ - public static String toPath(final NodePath nodePath, final boolean trimEmptyNode) { + public static String toPath(final NodePath nodePath) { String templatePath = Objects.requireNonNull(nodePath.getClass().getAnnotation(NodePathEntity.class), "NodePathEntity annotation is missing").value(); LinkedList<String> nodeSegments = new LinkedList<>(); for (String each : templatePath.split(PATH_DELIMITER)) { - Optional<String> segmentLiteral = new NodePathSegment(each, trimEmptyNode).getLiteral(nodePath); - if (segmentLiteral.isPresent()) { - nodeSegments.add(segmentLiteral.get()); - continue; + Optional<String> segmentLiteral = new NodePathSegment(each).getLiteral(nodePath); + if (!segmentLiteral.isPresent()) { + break; } - if (trimEmptyNode) { - trimLastParentNode(nodeSegments); - } - break; + nodeSegments.add(segmentLiteral.get()); } return String.join(PATH_DELIMITER, nodeSegments); } - - private static void trimLastParentNode(final LinkedList<String> nodeSegments) { - if (!nodeSegments.isEmpty()) { - nodeSegments.removeLast(); - } - } } diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegment.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegment.java index b353bbe8ec0..7fcabd5be36 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegment.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegment.java @@ -31,8 +31,6 @@ public final class NodePathSegment { private final String input; - private final boolean trimEmptyNode; - /** * Get segment literal. * @@ -47,7 +45,7 @@ public final class NodePathSegment { return Optional.empty(); } if (variableValue instanceof NodePath) { - return Optional.of(NodePathGenerator.toPath((NodePath) variableValue, trimEmptyNode)); + return Optional.of(NodePathGenerator.toPath((NodePath) variableValue)); } return Optional.of(variableValue.toString()); } diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathSearcher.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathSearcher.java index 00c3847bd82..c3b54f9b341 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathSearcher.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/engine/searcher/NodePathSearcher.java @@ -70,6 +70,6 @@ public final class NodePathSearcher { private static Pattern createPattern(final NodePath searchExample, final boolean containsChildPath) { String endPattern = containsChildPath ? "?" : "$"; - return Pattern.compile(START_PATTERN + NodePathGenerator.toPath(searchExample, false) + endPattern, Pattern.CASE_INSENSITIVE); + return Pattern.compile(START_PATTERN + NodePathGenerator.toPath(searchExample) + endPattern, Pattern.CASE_INSENSITIVE); } } diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java index c36cc58556c..fc2bd15c6ea 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/version/VersionNodePath.java @@ -34,7 +34,7 @@ public final class VersionNodePath { private final String path; public VersionNodePath(final NodePath nodePath) { - path = NodePathGenerator.toPath(nodePath, false); + path = NodePathGenerator.toPath(nodePath); } /** diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/rule/tuple/RuleNodeTuple.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/rule/tuple/RuleNodeTuple.java index e4106076d57..9adb44f0ac0 100644 --- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/rule/tuple/RuleNodeTuple.java +++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/rule/tuple/RuleNodeTuple.java @@ -39,6 +39,6 @@ public final class RuleNodeTuple { * @return path */ public String getPath() { - return NodePathGenerator.toPath(nodePath, false); + return NodePathGenerator.toPath(nodePath); } } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegmentTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegmentTest.java index 2806e710fda..99d676832c3 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegmentTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/engine/generator/NodePathSegmentTest.java @@ -33,17 +33,17 @@ class NodePathSegmentTest { @Test void assertGetLiteralWithoutVariable() { - assertThat(new NodePathSegment("foo", false).getLiteral(new NodePathFixture("foo")), is(Optional.of("foo"))); + assertThat(new NodePathSegment("foo").getLiteral(new NodePathFixture("foo")), is(Optional.of("foo"))); } @Test void assertGetLiteralWithVariable() { - assertThat(new NodePathSegment("${fooVariable}", false).getLiteral(new NodePathFixture("foo_value")), is(Optional.of("foo_value"))); + assertThat(new NodePathSegment("${fooVariable}").getLiteral(new NodePathFixture("foo_value")), is(Optional.of("foo_value"))); } @Test void assertGetLiteralWithNullVariable() { - assertFalse(new NodePathSegment("${fooVariable}", false).getLiteral(new NodePathFixture(null)).isPresent()); + assertFalse(new NodePathSegment("${fooVariable}").getLiteral(new NodePathFixture(null)).isPresent()); } @NodePathEntity("/foo/${fooVariable}") diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/SchemaMetaDataNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/SchemaMetaDataNodePathTest.java index 03a4a91ebca..19268d712b9 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/SchemaMetaDataNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/SchemaMetaDataNodePathTest.java @@ -30,7 +30,7 @@ class SchemaMetaDataNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new SchemaMetaDataNodePath("foo_db", null), false), is("/metadata/foo_db/schemas")); + assertThat(NodePathGenerator.toPath(new SchemaMetaDataNodePath("foo_db", null)), is("/metadata/foo_db/schemas")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/TableMetaDataNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/TableMetaDataNodePathTest.java index 0a2397d12d0..377a9fd73ec 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/TableMetaDataNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/TableMetaDataNodePathTest.java @@ -32,9 +32,8 @@ class TableMetaDataNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new TableMetaDataNodePath("foo_db", "foo_schema", null), false), is("/metadata/foo_db/schemas/foo_schema/tables")); - assertThat(NodePathGenerator.toPath(new TableMetaDataNodePath("foo_db", "foo_schema", "foo_tbl"), false), - is("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl")); + assertThat(NodePathGenerator.toPath(new TableMetaDataNodePath("foo_db", "foo_schema", null)), is("/metadata/foo_db/schemas/foo_schema/tables")); + assertThat(NodePathGenerator.toPath(new TableMetaDataNodePath("foo_db", "foo_schema", "foo_tbl")), is("/metadata/foo_db/schemas/foo_schema/tables/foo_tbl")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/ViewMetaDataNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/ViewMetaDataNodePathTest.java index 4875bf6a2ac..f299df66b83 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/ViewMetaDataNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/database/ViewMetaDataNodePathTest.java @@ -32,8 +32,8 @@ class ViewMetaDataNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new ViewMetaDataNodePath("foo_db", "foo_schema", null), false), is("/metadata/foo_db/schemas/foo_schema/views")); - assertThat(NodePathGenerator.toPath(new ViewMetaDataNodePath("foo_db", "foo_schema", "foo_view"), false), is("/metadata/foo_db/schemas/foo_schema/views/foo_view")); + assertThat(NodePathGenerator.toPath(new ViewMetaDataNodePath("foo_db", "foo_schema", null)), is("/metadata/foo_db/schemas/foo_schema/views")); + assertThat(NodePathGenerator.toPath(new ViewMetaDataNodePath("foo_db", "foo_schema", "foo_view")), is("/metadata/foo_db/schemas/foo_schema/views/foo_view")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/rule/DatabaseRuleNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/rule/DatabaseRuleNodePathTest.java index 33fde9ff040..f7acb3bbd2e 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/rule/DatabaseRuleNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/rule/DatabaseRuleNodePathTest.java @@ -30,11 +30,11 @@ class DatabaseRuleNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", null, null), false), is("/metadata/foo_db/rules")); - assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", "foo_rule", null), false), is("/metadata/foo_db/rules/foo_rule")); - assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", "foo_rule", new DatabaseRuleItem("unique_rule_item")), false), + assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", null, null)), is("/metadata/foo_db/rules")); + assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", "foo_rule", null)), is("/metadata/foo_db/rules/foo_rule")); + assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", "foo_rule", new DatabaseRuleItem("unique_rule_item"))), is("/metadata/foo_db/rules/foo_rule/unique_rule_item")); - assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", "foo_rule", new DatabaseRuleItem("named_rule_item/item")), false), + assertThat(NodePathGenerator.toPath(new DatabaseRuleNodePath("foo_db", "foo_rule", new DatabaseRuleItem("named_rule_item/item"))), is("/metadata/foo_db/rules/foo_rule/named_rule_item/item")); } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageNodeNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageNodeNodePathTest.java index 7fb723270a0..09150686e01 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageNodeNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageNodeNodePathTest.java @@ -30,8 +30,8 @@ class StorageNodeNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StorageNodeNodePath("foo_db", null), false), is("/metadata/foo_db/data_sources/nodes")); - assertThat(NodePathGenerator.toPath(new StorageNodeNodePath("foo_db", "foo_storage_node"), false), is("/metadata/foo_db/data_sources/nodes/foo_storage_node")); + assertThat(NodePathGenerator.toPath(new StorageNodeNodePath("foo_db", null)), is("/metadata/foo_db/data_sources/nodes")); + assertThat(NodePathGenerator.toPath(new StorageNodeNodePath("foo_db", "foo_storage_node")), is("/metadata/foo_db/data_sources/nodes/foo_storage_node")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageUnitNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageUnitNodePathTest.java index ada4e077bd4..9758973262e 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageUnitNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/metadata/storage/StorageUnitNodePathTest.java @@ -30,8 +30,8 @@ class StorageUnitNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StorageUnitNodePath("foo_db", null), false), is("/metadata/foo_db/data_sources/units")); - assertThat(NodePathGenerator.toPath(new StorageUnitNodePath("foo_db", "foo_storage_unit"), false), is("/metadata/foo_db/data_sources/units/foo_storage_unit")); + assertThat(NodePathGenerator.toPath(new StorageUnitNodePath("foo_db", null)), is("/metadata/foo_db/data_sources/units")); + assertThat(NodePathGenerator.toPath(new StorageUnitNodePath("foo_db", "foo_storage_unit")), is("/metadata/foo_db/data_sources/units/foo_storage_unit")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDataNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDataNodePathTest.java index ffb4a058c9c..a391466796f 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDataNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDataNodePathTest.java @@ -29,7 +29,7 @@ class StatisticsDataNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StatisticsDataNodePath("foo_db", "foo_schema", "foo_tbl", "foo_key"), false), + assertThat(NodePathGenerator.toPath(new StatisticsDataNodePath("foo_db", "foo_schema", "foo_tbl", "foo_key")), is("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl/foo_key")); } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDatabaseNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDatabaseNodePathTest.java index 9cbafc2ce88..a9c0c28e63e 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDatabaseNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsDatabaseNodePathTest.java @@ -29,8 +29,8 @@ class StatisticsDatabaseNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StatisticsDatabaseNodePath(null), false), is("/statistics/databases")); - assertThat(NodePathGenerator.toPath(new StatisticsDatabaseNodePath("foo_db"), false), is("/statistics/databases/foo_db")); + assertThat(NodePathGenerator.toPath(new StatisticsDatabaseNodePath(null)), is("/statistics/databases")); + assertThat(NodePathGenerator.toPath(new StatisticsDatabaseNodePath("foo_db")), is("/statistics/databases/foo_db")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsJobNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsJobNodePathTest.java index 76359430649..f2e1c4b3a1d 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsJobNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsJobNodePathTest.java @@ -27,6 +27,6 @@ class StatisticsJobNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StatisticsJobNodePath(), false), is("/statistics/job")); + assertThat(NodePathGenerator.toPath(new StatisticsJobNodePath()), is("/statistics/job")); } } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsSchemaNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsSchemaNodePathTest.java index 1d753b0d136..e660b16e789 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsSchemaNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsSchemaNodePathTest.java @@ -29,8 +29,8 @@ class StatisticsSchemaNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StatisticsSchemaNodePath("foo_db", null), false), is("/statistics/databases/foo_db/schemas")); - assertThat(NodePathGenerator.toPath(new StatisticsSchemaNodePath("foo_db", "foo_schema"), false), is("/statistics/databases/foo_db/schemas/foo_schema")); + assertThat(NodePathGenerator.toPath(new StatisticsSchemaNodePath("foo_db", null)), is("/statistics/databases/foo_db/schemas")); + assertThat(NodePathGenerator.toPath(new StatisticsSchemaNodePath("foo_db", "foo_schema")), is("/statistics/databases/foo_db/schemas/foo_schema")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsTableNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsTableNodePathTest.java index 491985a2c5e..6c96293a776 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsTableNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/database/statistics/StatisticsTableNodePathTest.java @@ -29,8 +29,8 @@ class StatisticsTableNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StatisticsTableNodePath("foo_db", "foo_schema", null), false), is("/statistics/databases/foo_db/schemas/foo_schema/tables")); - assertThat(NodePathGenerator.toPath(new StatisticsTableNodePath("foo_db", "foo_schema", "foo_tbl"), false), is("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl")); + assertThat(NodePathGenerator.toPath(new StatisticsTableNodePath("foo_db", "foo_schema", null)), is("/statistics/databases/foo_db/schemas/foo_schema/tables")); + assertThat(NodePathGenerator.toPath(new StatisticsTableNodePath("foo_db", "foo_schema", "foo_tbl")), is("/statistics/databases/foo_db/schemas/foo_schema/tables/foo_tbl")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java index e35eabbfd97..737ef6155e3 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalPropertiesNodePathTest.java @@ -29,7 +29,7 @@ class GlobalPropertiesNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new GlobalPropertiesNodePath(), false), is("/props")); + assertThat(NodePathGenerator.toPath(new GlobalPropertiesNodePath()), is("/props")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java index 7009dff8dfe..4eb1326736d 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/config/GlobalRuleNodePathTest.java @@ -31,8 +31,8 @@ class GlobalRuleNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new GlobalRuleNodePath(null), false), is("/rules")); - assertThat(NodePathGenerator.toPath(new GlobalRuleNodePath("foo_rule"), false), is("/rules/foo_rule")); + assertThat(NodePathGenerator.toPath(new GlobalRuleNodePath(null)), is("/rules")); + assertThat(NodePathGenerator.toPath(new GlobalRuleNodePath("foo_rule")), is("/rules/foo_rule")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/execution/ProcessNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/execution/ProcessNodePathTest.java index 0a4766296c5..813cba55df9 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/execution/ProcessNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/execution/ProcessNodePathTest.java @@ -27,7 +27,7 @@ class ProcessNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new ProcessNodePath("foo_process_id", null), false), is("/execution_nodes/foo_process_id")); - assertThat(NodePathGenerator.toPath(new ProcessNodePath("foo_process_id", "foo_instance_id"), false), is("/execution_nodes/foo_process_id/foo_instance_id")); + assertThat(NodePathGenerator.toPath(new ProcessNodePath("foo_process_id", null)), is("/execution_nodes/foo_process_id")); + assertThat(NodePathGenerator.toPath(new ProcessNodePath("foo_process_id", "foo_instance_id")), is("/execution_nodes/foo_process_id/foo_instance_id")); } } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/label/LabelNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/label/LabelNodePathTest.java index 2cda6ea3826..38f1cf5eef8 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/label/LabelNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/label/LabelNodePathTest.java @@ -28,7 +28,7 @@ class LabelNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new LabelNodePath("foo_instance_id"), false), is("/nodes/compute_nodes/labels/foo_instance_id")); + assertThat(NodePathGenerator.toPath(new LabelNodePath("foo_instance_id")), is("/nodes/compute_nodes/labels/foo_instance_id")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/KillProcessTriggerNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/KillProcessTriggerNodePathTest.java index e22ad520147..0f66f10fcd9 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/KillProcessTriggerNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/KillProcessTriggerNodePathTest.java @@ -30,8 +30,8 @@ class KillProcessTriggerNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new KillProcessTriggerNodePath(null), false), is("/nodes/compute_nodes/kill_process_trigger")); - assertThat(NodePathGenerator.toPath(new KillProcessTriggerNodePath(new InstanceProcessNodeValue("foo_instance_id", "foo_process_id")), false), + assertThat(NodePathGenerator.toPath(new KillProcessTriggerNodePath(null)), is("/nodes/compute_nodes/kill_process_trigger")); + assertThat(NodePathGenerator.toPath(new KillProcessTriggerNodePath(new InstanceProcessNodeValue("foo_instance_id", "foo_process_id"))), is("/nodes/compute_nodes/kill_process_trigger/foo_instance_id:foo_process_id")); } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/ShowProcessListTriggerNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/ShowProcessListTriggerNodePathTest.java index a104625e648..d8906af939d 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/ShowProcessListTriggerNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/process/ShowProcessListTriggerNodePathTest.java @@ -30,8 +30,8 @@ class ShowProcessListTriggerNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(null), false), is("/nodes/compute_nodes/show_process_list_trigger")); - assertThat(NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(new InstanceProcessNodeValue("foo_instance_id", "foo_process_id")), false), + assertThat(NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(null)), is("/nodes/compute_nodes/show_process_list_trigger")); + assertThat(NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(new InstanceProcessNodeValue("foo_instance_id", "foo_process_id"))), is("/nodes/compute_nodes/show_process_list_trigger/foo_instance_id:foo_process_id")); } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/OnlineNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/OnlineNodePathTest.java index bcd63ed26d7..57ceffcb8c0 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/OnlineNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/OnlineNodePathTest.java @@ -31,9 +31,9 @@ class OnlineNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new OnlineNodePath(null, null), false), is("/nodes/compute_nodes/online")); - assertThat(NodePathGenerator.toPath(new OnlineNodePath(InstanceType.JDBC, null), false), is("/nodes/compute_nodes/online/jdbc")); - assertThat(NodePathGenerator.toPath(new OnlineNodePath(InstanceType.PROXY, "foo_instance_id"), false), is("/nodes/compute_nodes/online/proxy/foo_instance_id")); + assertThat(NodePathGenerator.toPath(new OnlineNodePath(null, null)), is("/nodes/compute_nodes/online")); + assertThat(NodePathGenerator.toPath(new OnlineNodePath(InstanceType.JDBC, null)), is("/nodes/compute_nodes/online/jdbc")); + assertThat(NodePathGenerator.toPath(new OnlineNodePath(InstanceType.PROXY, "foo_instance_id")), is("/nodes/compute_nodes/online/proxy/foo_instance_id")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/StatusNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/StatusNodePathTest.java index 3e495aba813..4292eaf637b 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/StatusNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/status/StatusNodePathTest.java @@ -28,8 +28,8 @@ class StatusNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StatusNodePath(null), false), is("/nodes/compute_nodes/status")); - assertThat(NodePathGenerator.toPath(new StatusNodePath("foo_instance_id"), false), is("/nodes/compute_nodes/status/foo_instance_id")); + assertThat(NodePathGenerator.toPath(new StatusNodePath(null)), is("/nodes/compute_nodes/status")); + assertThat(NodePathGenerator.toPath(new StatusNodePath("foo_instance_id")), is("/nodes/compute_nodes/status/foo_instance_id")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/workerid/ComputeNodeWorkerIDNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/workerid/ComputeNodeWorkerIDNodePathTest.java index 7a30f7dd559..3e85f50ea46 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/workerid/ComputeNodeWorkerIDNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/compute/workerid/ComputeNodeWorkerIDNodePathTest.java @@ -28,7 +28,7 @@ class ComputeNodeWorkerIDNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath("foo_instance_id"), false), is("/nodes/compute_nodes/worker_id/foo_instance_id")); + assertThat(NodePathGenerator.toPath(new ComputeNodeWorkerIDNodePath("foo_instance_id")), is("/nodes/compute_nodes/worker_id/foo_instance_id")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/storage/QualifiedDataSourceNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/storage/QualifiedDataSourceNodePathTest.java index 433423b7cd7..043f7936fbe 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/storage/QualifiedDataSourceNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/node/storage/QualifiedDataSourceNodePathTest.java @@ -30,8 +30,8 @@ class QualifiedDataSourceNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new QualifiedDataSourceNodePath((String) null), false), is("/nodes/qualified_data_sources")); - assertThat(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(new QualifiedDataSource("foo_db.foo_group.foo_ds")), false), + assertThat(NodePathGenerator.toPath(new QualifiedDataSourceNodePath((String) null)), is("/nodes/qualified_data_sources")); + assertThat(NodePathGenerator.toPath(new QualifiedDataSourceNodePath(new QualifiedDataSource("foo_db.foo_group.foo_ds"))), is("/nodes/qualified_data_sources/foo_db.foo_group.foo_ds")); } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/reservation/WorkerIDReservationNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/reservation/WorkerIDReservationNodePathTest.java index 5889dd2d1b1..ccb1cbc48d9 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/reservation/WorkerIDReservationNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/reservation/WorkerIDReservationNodePathTest.java @@ -27,7 +27,7 @@ class WorkerIDReservationNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new WorkerIDReservationNodePath(null), false), is("/reservation/worker_id")); - assertThat(NodePathGenerator.toPath(new WorkerIDReservationNodePath(1), false), is("/reservation/worker_id/1")); + assertThat(NodePathGenerator.toPath(new WorkerIDReservationNodePath(null)), is("/reservation/worker_id")); + assertThat(NodePathGenerator.toPath(new WorkerIDReservationNodePath(1)), is("/reservation/worker_id/1")); } } diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/DatabaseListenerCoordinatorNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/DatabaseListenerCoordinatorNodePathTest.java index 30f12c9fdcf..d9cc25d1698 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/DatabaseListenerCoordinatorNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/DatabaseListenerCoordinatorNodePathTest.java @@ -29,8 +29,8 @@ class DatabaseListenerCoordinatorNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath(null), false), is("/states/database_listener_coordinator")); - assertThat(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath("foo_db"), false), is("/states/database_listener_coordinator/foo_db")); + assertThat(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath(null)), is("/states/database_listener_coordinator")); + assertThat(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath("foo_db")), is("/states/database_listener_coordinator/foo_db")); } @Test diff --git a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/StateNodePathTest.java b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/StateNodePathTest.java index 6450d797ffa..7feb8f05501 100644 --- a/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/StateNodePathTest.java +++ b/mode/node/src/test/java/org/apache/shardingsphere/mode/node/path/type/global/state/StateNodePathTest.java @@ -27,6 +27,6 @@ class StateNodePathTest { @Test void assertToPath() { - assertThat(NodePathGenerator.toPath(new StateNodePath(), false), is("/states/cluster_state")); + assertThat(NodePathGenerator.toPath(new StateNodePath()), is("/states/cluster_state")); } } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandler.java index cd48c977301..a465a6818a7 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandler.java @@ -59,7 +59,7 @@ public final class DatabaseListenerChangedHandler implements GlobalDataChangedEv private void handle(final ContextManager contextManager, final String databaseName, final ClusterDatabaseListenerCoordinatorType type) { ClusterPersistRepository repository = (ClusterPersistRepository) contextManager.getPersistServiceFacade().getRepository(); - String databasePath = NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName), false); + String databasePath = NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName)); switch (type) { case CREATE: repository.watch(databasePath, new DatabaseMetaDataChangedListener(contextManager)); diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/DataChangedEventListenerRegistry.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/DataChangedEventListenerRegistry.java index fae8ce5e316..8b309f81134 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/DataChangedEventListenerRegistry.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/listener/DataChangedEventListenerRegistry.java @@ -54,10 +54,10 @@ public final class DataChangedEventListenerRegistry { } private void registerDatabaseListeners(final String databaseName) { - repository.watch(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName), false), new DatabaseMetaDataChangedListener(contextManager)); + repository.watch(NodePathGenerator.toPath(new DatabaseMetaDataNodePath(databaseName)), new DatabaseMetaDataChangedListener(contextManager)); } private void registerGlobalHandlers(final GlobalDataChangedEventHandler handler) { - repository.watch(NodePathGenerator.toPath(handler.getSubscribedNodePath(), false), new GlobalMetaDataChangedListener(contextManager, handler)); + repository.watch(NodePathGenerator.toPath(handler.getSubscribedNodePath()), new GlobalMetaDataChangedListener(contextManager, handler)); } } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/database/ClusterDatabaseListenerPersistCoordinator.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/database/ClusterDatabaseListenerPersistCoordinator.java index 9a5d07cdaf6..553ca793cd6 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/database/ClusterDatabaseListenerPersistCoordinator.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/database/ClusterDatabaseListenerPersistCoordinator.java @@ -37,7 +37,7 @@ public final class ClusterDatabaseListenerPersistCoordinator { * @param clusterDatabaseListenerCoordinatorType database changed listener assisted type */ public void persist(final String databaseName, final ClusterDatabaseListenerCoordinatorType clusterDatabaseListenerCoordinatorType) { - repository.persistEphemeral(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath(databaseName), false), clusterDatabaseListenerCoordinatorType.name()); + repository.persistEphemeral(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath(databaseName)), clusterDatabaseListenerCoordinatorType.name()); } /** @@ -46,6 +46,6 @@ public final class ClusterDatabaseListenerPersistCoordinator { * @param databaseName database name */ public void delete(final String databaseName) { - repository.delete(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath(databaseName), false)); + repository.delete(NodePathGenerator.toPath(new DatabaseListenerCoordinatorNodePath(databaseName))); } } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java index 36adb2cdc38..79989426b3c 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/coordinator/process/ClusterProcessPersistCoordinator.java @@ -50,9 +50,9 @@ public final class ClusterProcessPersistCoordinator { public void reportLocalProcesses(final String instanceId, final String taskId) { Collection<Process> processes = ProcessRegistry.getInstance().listAll(); if (!processes.isEmpty()) { - repository.persist(NodePathGenerator.toPath(new ProcessNodePath(taskId, instanceId), false), YamlEngine.marshal(swapper.swapToYamlConfiguration(processes))); + repository.persist(NodePathGenerator.toPath(new ProcessNodePath(taskId, instanceId)), YamlEngine.marshal(swapper.swapToYamlConfiguration(processes))); } - repository.delete(NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(new InstanceProcessNodeValue(instanceId, taskId)), false)); + repository.delete(NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(new InstanceProcessNodeValue(instanceId, taskId)))); } /** @@ -62,6 +62,6 @@ public final class ClusterProcessPersistCoordinator { * @param processId process ID */ public void cleanProcess(final String instanceId, final String processId) { - repository.delete(NodePathGenerator.toPath(new KillProcessTriggerNodePath(new InstanceProcessNodeValue(instanceId, processId)), false)); + repository.delete(NodePathGenerator.toPath(new KillProcessTriggerNodePath(new InstanceProcessNodeValue(instanceId, processId)))); } } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterProcessPersistService.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterProcessPersistService.java index b83c96eefc5..fcd794a00f5 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterProcessPersistService.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/persist/service/ClusterProcessPersistService.java @@ -57,7 +57,7 @@ public final class ClusterProcessPersistService implements ProcessPersistService isCompleted = ProcessOperationLockRegistry.getInstance().waitUntilReleaseReady(taskId, () -> isReady(triggerPaths)); return getShowProcessListData(taskId); } finally { - repository.delete(NodePathGenerator.toPath(new ProcessNodePath(taskId, null), false)); + repository.delete(NodePathGenerator.toPath(new ProcessNodePath(taskId, null))); if (!isCompleted) { triggerPaths.forEach(repository::delete); } @@ -66,15 +66,15 @@ public final class ClusterProcessPersistService implements ProcessPersistService private Collection<String> getShowProcessListTriggerPaths(final String taskId) { return Stream.of(InstanceType.values()) - .flatMap(each -> repository.getChildrenKeys(NodePathGenerator.toPath(new OnlineNodePath(each, null), false)).stream() - .map(instanceId -> NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(new InstanceProcessNodeValue(instanceId, taskId)), false))) + .flatMap(each -> repository.getChildrenKeys(NodePathGenerator.toPath(new OnlineNodePath(each, null))).stream() + .map(instanceId -> NodePathGenerator.toPath(new ShowProcessListTriggerNodePath(new InstanceProcessNodeValue(instanceId, taskId))))) .collect(Collectors.toList()); } private Collection<Process> getShowProcessListData(final String taskId) { YamlProcessList yamlProcessList = new YamlProcessList(); - for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new ProcessNodePath(taskId, null), false)).stream() - .map(each -> repository.query(NodePathGenerator.toPath(new ProcessNodePath(taskId, each), false))).collect(Collectors.toList())) { + for (String each : repository.getChildrenKeys(NodePathGenerator.toPath(new ProcessNodePath(taskId, null))).stream() + .map(each -> repository.query(NodePathGenerator.toPath(new ProcessNodePath(taskId, each)))).collect(Collectors.toList())) { yamlProcessList.getProcesses().addAll(YamlEngine.unmarshal(each, YamlProcessList.class).getProcesses()); } return new YamlProcessListSwapper().swapToObject(yamlProcessList); @@ -96,8 +96,8 @@ public final class ClusterProcessPersistService implements ProcessPersistService private Collection<String> getKillProcessTriggerPaths(final String processId) { return Stream.of(InstanceType.values()) - .flatMap(each -> repository.getChildrenKeys(NodePathGenerator.toPath(new OnlineNodePath(each, null), false)).stream() - .map(onlinePath -> NodePathGenerator.toPath(new KillProcessTriggerNodePath(new InstanceProcessNodeValue(onlinePath, processId)), false))) + .flatMap(each -> repository.getChildrenKeys(NodePathGenerator.toPath(new OnlineNodePath(each, null))).stream() + .map(onlinePath -> NodePathGenerator.toPath(new KillProcessTriggerNodePath(new InstanceProcessNodeValue(onlinePath, processId))))) .collect(Collectors.toList()); } diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/workerid/ReservationPersistService.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/workerid/ReservationPersistService.java index eb1e1361643..19755e9d3fd 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/workerid/ReservationPersistService.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/workerid/ReservationPersistService.java @@ -43,7 +43,7 @@ public final class ReservationPersistService { public Optional<Integer> reserveWorkerId(final Integer preselectedWorkerId, final String instanceId) { try { return repository.persistExclusiveEphemeral( - NodePathGenerator.toPath(new WorkerIDReservationNodePath(preselectedWorkerId), false), instanceId) ? Optional.of(preselectedWorkerId) : Optional.empty(); + NodePathGenerator.toPath(new WorkerIDReservationNodePath(preselectedWorkerId)), instanceId) ? Optional.of(preselectedWorkerId) : Optional.empty(); } catch (final ClusterRepositoryPersistException ignore) { return Optional.empty(); } diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/GlobalRuleChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/GlobalRuleChangedHandlerTest.java index 1842e5bfe62..fca834596b3 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/GlobalRuleChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/GlobalRuleChangedHandlerTest.java @@ -48,7 +48,7 @@ class GlobalRuleChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/rules")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/rules")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/PropertiesChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/PropertiesChangedHandlerTest.java index f577d9414a8..bf8829eaea4 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/PropertiesChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/config/type/PropertiesChangedHandlerTest.java @@ -48,7 +48,7 @@ class PropertiesChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/props")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/props")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeLabelChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeLabelChangedHandlerTest.java index aeaca42c843..fabe91a582c 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeLabelChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeLabelChangedHandlerTest.java @@ -46,7 +46,7 @@ class ComputeNodeLabelChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/nodes/compute_nodes/labels")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/compute_nodes/labels")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeOnlineHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeOnlineHandlerTest.java index ac69f211e7a..848b563dc9d 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeOnlineHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeOnlineHandlerTest.java @@ -48,7 +48,7 @@ class ComputeNodeOnlineHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/nodes/compute_nodes/online")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/compute_nodes/online")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeStateChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeStateChangedHandlerTest.java index 98b9a1902bd..eecb251c12f 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeStateChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeStateChangedHandlerTest.java @@ -44,7 +44,7 @@ class ComputeNodeStateChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/nodes/compute_nodes/status")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/compute_nodes/status")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeWorkerIdChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeWorkerIdChangedHandlerTest.java index 6acf6b97c1e..514c8f5dbf6 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeWorkerIdChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/compute/type/ComputeNodeWorkerIdChangedHandlerTest.java @@ -44,7 +44,7 @@ class ComputeNodeWorkerIdChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/nodes/compute_nodes/worker_id")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/compute_nodes/worker_id")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/KillProcessHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/KillProcessHandlerTest.java index f9579f48ac1..d0b96a640a1 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/KillProcessHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/KillProcessHandlerTest.java @@ -53,7 +53,7 @@ class KillProcessHandlerTest { void setUp() { when(contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId()).thenReturn("foo_instance_id"); handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/nodes/compute_nodes/kill_process_trigger")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/compute_nodes/kill_process_trigger")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/ShowProcessListHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/ShowProcessListHandlerTest.java index 2d78612f4d9..803e605d2f1 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/ShowProcessListHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/process/ShowProcessListHandlerTest.java @@ -56,7 +56,7 @@ class ShowProcessListHandlerTest { void setUp() { when(contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId()).thenReturn("foo_instance_id"); handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/nodes/compute_nodes/show_process_list_trigger")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/compute_nodes/show_process_list_trigger")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/statistics/StatisticsChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/statistics/StatisticsChangedHandlerTest.java index fc857ce959c..4817fa4202c 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/statistics/StatisticsChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/statistics/StatisticsChangedHandlerTest.java @@ -48,7 +48,7 @@ class StatisticsChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/statistics/databases")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/statistics/databases")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/storage/QualifiedDataSourceChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/storage/QualifiedDataSourceChangedHandlerTest.java index 15f1e788799..e5399ad165c 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/storage/QualifiedDataSourceChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/storage/QualifiedDataSourceChangedHandlerTest.java @@ -54,7 +54,7 @@ class QualifiedDataSourceChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/nodes/qualified_data_sources")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/nodes/qualified_data_sources")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandlerTest.java index 76de4088388..4996b51f7fe 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/DatabaseListenerChangedHandlerTest.java @@ -57,7 +57,7 @@ class DatabaseListenerChangedHandlerTest { when(contextManager.getPersistServiceFacade().getRepository()).thenReturn(repository); when(contextManager.getMetaDataContexts().getMetaData().getTemporaryProps()).thenReturn(new TemporaryConfigurationProperties(new Properties())); handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/states/database_listener_coordinator")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/states/database_listener_coordinator")).findFirst().orElse(null); } @Test diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/StateChangedHandlerTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/StateChangedHandlerTest.java index dca55aedf23..6cff02b28d3 100644 --- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/StateChangedHandlerTest.java +++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/state/StateChangedHandlerTest.java @@ -44,7 +44,7 @@ class StateChangedHandlerTest { @BeforeEach void setUp() { handler = ShardingSphereServiceLoader.getServiceInstances(GlobalDataChangedEventHandler.class).stream() - .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath(), false).equals("/states/cluster_state")).findFirst().orElse(null); + .filter(each -> NodePathGenerator.toPath(each.getSubscribedNodePath()).equals("/states/cluster_state")).findFirst().orElse(null); } @Test