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 abc97fb777b Refactor ShadowDataSourceMappingsFinderFactory (#33522)
abc97fb777b is described below

commit abc97fb777b0fb0ad3e8c268aa2290735cd7ab7f
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Mon Nov 4 00:54:01 2024 +0800

    Refactor ShadowDataSourceMappingsFinderFactory (#33522)
    
    * Add ShadowDataSourceMappingsFinder
    
    * Add ShadowDataSourceMappingsFinder
    
    * Add ShadowDataSourceMappingsFinder
    
    * Add ShadowDataSourceMappingsFinder
    
    * Add test cases on ShadowRuleConfigurationChecker
    
    * Refactor ShadowDataSourceMappingsFinderFactory
    
    * Refactor ShadowDataSourceMappingsFinderFactory
    
    * Refactor ShadowDataSourceMappingsFinderFactory
    
    * Refactor ShadowDataSourceMappingsFinderFactory
    
    * Refactor ShadowDataSourceMappingsFinderFactory
    
    * Refactor ShadowDataSourceMappingsFinderFactory
    
    * Refactor ShadowDataSourceMappingsFinderFactory
    
    * Refactor ShadowDataSourceMappingsFinderFactory
---
 .../shadow/route/ShadowSQLRouter.java              | 27 ++++++++--
 .../ColumnShadowAlgorithmDeterminer.java           |  2 +-
 .../determiner/HintShadowAlgorithmDeterminer.java  |  6 +--
 .../shadow/route/engine/ShadowRouteEngine.java     | 63 ----------------------
 .../finder/ShadowDataSourceMappingsFinder.java     |  2 +-
 .../ShadowDataSourceMappingsFinderFactory.java     | 43 ++++++++-------
 ...ShadowDMLStatementDataSourceMappingsFinder.java |  8 +--
 ...dowDeleteStatementDataSourceMappingsFinder.java |  4 +-
 ...dowInsertStatementDataSourceMappingsFinder.java |  2 +-
 ...dowSelectStatementDataSourceMappingsFinder.java |  4 +-
 ...dowUpdateStatementDataSourceMappingsFinder.java |  4 +-
 ...dowNonDMLStatementDataSourceMappingsFinder.java | 10 ++--
 .../route/{engine => }/util/ShadowExtractor.java   |  2 +-
 .../ColumnShadowAlgorithmDeterminerTest.java       |  6 +--
 .../HintShadowAlgorithmDeterminerTest.java         |  2 +-
 ...ShadowDataSourceMappingsFinderFactoryTest.java} | 13 +++--
 .../ShadowNonDMLStatementRouteEngineTest.java      |  2 +-
 .../{engine => }/util/ShadowExtractorTest.java     |  2 +-
 18 files changed, 79 insertions(+), 123 deletions(-)

diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
index 2143efaecf7..1b8ff3be53e 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
@@ -22,12 +22,18 @@ import 
org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.route.DecorateSQLRouter;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
+import org.apache.shardingsphere.infra.route.context.RouteMapper;
+import org.apache.shardingsphere.infra.route.context.RouteUnit;
 import org.apache.shardingsphere.infra.session.query.QueryContext;
 import org.apache.shardingsphere.shadow.constant.ShadowOrder;
-import 
org.apache.shardingsphere.shadow.route.engine.ShadowDataSourceMappingsFinderFactory;
-import org.apache.shardingsphere.shadow.route.engine.ShadowRouteEngine;
+import 
org.apache.shardingsphere.shadow.route.finder.ShadowDataSourceMappingsFinderFactory;
 import org.apache.shardingsphere.shadow.rule.ShadowRule;
 
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Optional;
+
 /**
  * Shadow SQL router.
  */
@@ -37,7 +43,22 @@ public final class ShadowSQLRouter implements 
DecorateSQLRouter<ShadowRule> {
     @Override
     public void decorateRouteContext(final RouteContext routeContext, final 
QueryContext queryContext, final ShardingSphereDatabase database,
                                      final ShadowRule rule, final 
ConfigurationProperties props) {
-        new ShadowRouteEngine().route(routeContext, rule, 
ShadowDataSourceMappingsFinderFactory.newInstance(queryContext));
+        Collection<RouteUnit> toBeRemovedRouteUnit = new LinkedList<>();
+        Collection<RouteUnit> toBeAddedRouteUnit = new LinkedList<>();
+        Map<String, String> shadowDataSourceMappings = 
ShadowDataSourceMappingsFinderFactory.newInstance(queryContext).find(rule);
+        for (RouteUnit each : routeContext.getRouteUnits()) {
+            String logicName = each.getDataSourceMapper().getLogicName();
+            String actualName = each.getDataSourceMapper().getActualName();
+            Optional<String> productionDataSourceName = 
rule.findProductionDataSourceName(actualName);
+            if (productionDataSourceName.isPresent()) {
+                String shadowDataSourceName = 
shadowDataSourceMappings.get(productionDataSourceName.get());
+                toBeRemovedRouteUnit.add(each);
+                String dataSourceName = null == shadowDataSourceName ? 
productionDataSourceName.get() : shadowDataSourceName;
+                toBeAddedRouteUnit.add(new RouteUnit(new 
RouteMapper(logicName, dataSourceName), each.getTableMappers()));
+            }
+        }
+        routeContext.getRouteUnits().removeAll(toBeRemovedRouteUnit);
+        routeContext.getRouteUnits().addAll(toBeAddedRouteUnit);
     }
     
     @Override
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/determiner/ColumnShadowAlgorithmDeterminer.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/determiner/ColumnShadowAlgorithmDeterminer.java
similarity index 97%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/determiner/ColumnShadowAlgorithmDeterminer.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/determiner/ColumnShadowAlgorithmDeterminer.java
index ce48e9d13ee..f1ffac30c7c 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/determiner/ColumnShadowAlgorithmDeterminer.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/determiner/ColumnShadowAlgorithmDeterminer.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.determiner;
+package org.apache.shardingsphere.shadow.route.determiner;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/determiner/HintShadowAlgorithmDeterminer.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/determiner/HintShadowAlgorithmDeterminer.java
similarity index 90%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/determiner/HintShadowAlgorithmDeterminer.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/determiner/HintShadowAlgorithmDeterminer.java
index 107020c2caf..037bea3c3d2 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/determiner/HintShadowAlgorithmDeterminer.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/determiner/HintShadowAlgorithmDeterminer.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.determiner;
+package org.apache.shardingsphere.shadow.route.determiner;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
@@ -41,11 +41,11 @@ public final class HintShadowAlgorithmDeterminer {
      * @return is shadow or not
      */
     public static boolean isShadow(final HintShadowAlgorithm<Comparable<?>> 
shadowAlgorithm, final ShadowDetermineCondition shadowCondition, final 
ShadowRule shadowRule, final boolean useShadow) {
-        PreciseHintShadowValue<Comparable<?>> shadowValue = 
createNoteShadowValues(shadowCondition, useShadow);
+        PreciseHintShadowValue<Comparable<?>> shadowValue = 
createHintShadowValues(shadowCondition, useShadow);
         return shadowAlgorithm.isShadow(shadowRule.getAllShadowTableNames(), 
shadowValue);
     }
     
-    private static PreciseHintShadowValue<Comparable<?>> 
createNoteShadowValues(final ShadowDetermineCondition shadowDetermineCondition, 
final boolean useShadow) {
+    private static PreciseHintShadowValue<Comparable<?>> 
createHintShadowValues(final ShadowDetermineCondition shadowDetermineCondition, 
final boolean useShadow) {
         ShadowOperationType shadowOperationType = 
shadowDetermineCondition.getShadowOperationType();
         String tableName = shadowDetermineCondition.getTableName();
         return new PreciseHintShadowValue<>(tableName, shadowOperationType, 
useShadow);
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteEngine.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteEngine.java
deleted file mode 100644
index 1dae3f8a867..00000000000
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteEngine.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.shadow.route.engine;
-
-import org.apache.shardingsphere.infra.annotation.HighFrequencyInvocation;
-import org.apache.shardingsphere.infra.route.context.RouteContext;
-import org.apache.shardingsphere.infra.route.context.RouteMapper;
-import org.apache.shardingsphere.infra.route.context.RouteUnit;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.ShadowDataSourceMappingsFinder;
-import org.apache.shardingsphere.shadow.rule.ShadowRule;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Optional;
-
-/**
- * Shadow route engine.
- */
-@HighFrequencyInvocation
-public final class ShadowRouteEngine {
-    
-    /**
-     * Route.
-     *
-     * @param routeContext route context
-     * @param rule shadow rule
-     * @param finder finder
-     */
-    public void route(final RouteContext routeContext, final ShadowRule rule, 
final ShadowDataSourceMappingsFinder finder) {
-        Collection<RouteUnit> toBeRemovedRouteUnit = new LinkedList<>();
-        Collection<RouteUnit> toBeAddedRouteUnit = new LinkedList<>();
-        Map<String, String> shadowDataSourceMappings = finder.find(rule);
-        for (RouteUnit each : routeContext.getRouteUnits()) {
-            String logicName = each.getDataSourceMapper().getLogicName();
-            String actualName = each.getDataSourceMapper().getActualName();
-            Optional<String> productionDataSourceName = 
rule.findProductionDataSourceName(actualName);
-            if (productionDataSourceName.isPresent()) {
-                String shadowDataSourceName = 
shadowDataSourceMappings.get(productionDataSourceName.get());
-                toBeRemovedRouteUnit.add(each);
-                String dataSourceName = null == shadowDataSourceName ? 
productionDataSourceName.get() : shadowDataSourceName;
-                toBeAddedRouteUnit.add(new RouteUnit(new 
RouteMapper(logicName, dataSourceName), each.getTableMappers()));
-            }
-        }
-        routeContext.getRouteUnits().removeAll(toBeRemovedRouteUnit);
-        routeContext.getRouteUnits().addAll(toBeAddedRouteUnit);
-    }
-}
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/ShadowDataSourceMappingsFinder.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinder.java
similarity index 95%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/ShadowDataSourceMappingsFinder.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinder.java
index 3bd42e20e3f..4fe987b35ff 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/ShadowDataSourceMappingsFinder.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinder.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder;
+package org.apache.shardingsphere.shadow.route.finder;
 
 import org.apache.shardingsphere.shadow.rule.ShadowRule;
 
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowDataSourceMappingsFinderFactory.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinderFactory.java
similarity index 72%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowDataSourceMappingsFinderFactory.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinderFactory.java
index 52eb12f96b0..7d18d579388 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowDataSourceMappingsFinderFactory.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinderFactory.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine;
+package org.apache.shardingsphere.shadow.route.finder;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
@@ -24,12 +24,11 @@ import 
org.apache.shardingsphere.infra.binder.context.statement.dml.InsertStatem
 import 
org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
 import 
org.apache.shardingsphere.infra.binder.context.statement.dml.UpdateStatementContext;
 import org.apache.shardingsphere.infra.session.query.QueryContext;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.ShadowDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowDeleteStatementDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowInsertStatementDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowSelectStatementDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowUpdateStatementDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.other.ShadowNonDMLStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowDeleteStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowInsertStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowSelectStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowUpdateStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.other.ShadowNonDMLStatementDataSourceMappingsFinder;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
@@ -37,7 +36,7 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectS
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
 
 /**
- * Shadow data source mappings finder.
+ * Shadow data source mappings finder factory.
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class ShadowDataSourceMappingsFinderFactory {
@@ -51,37 +50,37 @@ public final class ShadowDataSourceMappingsFinderFactory {
     public static ShadowDataSourceMappingsFinder newInstance(final 
QueryContext queryContext) {
         SQLStatement sqlStatement = 
queryContext.getSqlStatementContext().getSqlStatement();
         if (sqlStatement instanceof InsertStatement) {
-            return createShadowInsertStatementRouteEngine(queryContext);
+            return 
createShadowInsertStatementDataSourceMappingsFinder(queryContext);
         }
         if (sqlStatement instanceof DeleteStatement) {
-            return createShadowDeleteStatementRouteEngine(queryContext);
+            return 
createShadowDeleteStatementDataSourceMappingsFinder(queryContext);
         }
         if (sqlStatement instanceof UpdateStatement) {
-            return createShadowUpdateStatementRouteEngine(queryContext);
+            return 
createShadowUpdateStatementDataSourceMappingsFinder(queryContext);
         }
         if (sqlStatement instanceof SelectStatement) {
-            return createShadowSelectStatementRouteEngine(queryContext);
+            return 
createShadowSelectStatementDataSourceMappingsFinder(queryContext);
         }
-        return createShadowNonMDLStatementRouteEngine(queryContext);
+        return 
createShadowNonMDLStatementDataSourceMappingsFinder(queryContext);
     }
     
-    private static ShadowDataSourceMappingsFinder 
createShadowNonMDLStatementRouteEngine(final QueryContext queryContext) {
-        return new 
ShadowNonDMLStatementDataSourceMappingsFinder(queryContext.getHintValueContext());
+    private static ShadowDataSourceMappingsFinder 
createShadowInsertStatementDataSourceMappingsFinder(final QueryContext 
queryContext) {
+        return new 
ShadowInsertStatementDataSourceMappingsFinder((InsertStatementContext) 
queryContext.getSqlStatementContext(), queryContext.getHintValueContext());
     }
     
-    private static ShadowDataSourceMappingsFinder 
createShadowSelectStatementRouteEngine(final QueryContext queryContext) {
-        return new 
ShadowSelectStatementDataSourceMappingsFinder((SelectStatementContext) 
queryContext.getSqlStatementContext(), queryContext.getParameters(), 
queryContext.getHintValueContext());
+    private static ShadowDataSourceMappingsFinder 
createShadowDeleteStatementDataSourceMappingsFinder(final QueryContext 
queryContext) {
+        return new 
ShadowDeleteStatementDataSourceMappingsFinder((DeleteStatementContext) 
queryContext.getSqlStatementContext(), queryContext.getParameters(), 
queryContext.getHintValueContext());
     }
     
-    private static ShadowDataSourceMappingsFinder 
createShadowUpdateStatementRouteEngine(final QueryContext queryContext) {
+    private static ShadowDataSourceMappingsFinder 
createShadowUpdateStatementDataSourceMappingsFinder(final QueryContext 
queryContext) {
         return new 
ShadowUpdateStatementDataSourceMappingsFinder((UpdateStatementContext) 
queryContext.getSqlStatementContext(), queryContext.getParameters(), 
queryContext.getHintValueContext());
     }
     
-    private static ShadowDataSourceMappingsFinder 
createShadowDeleteStatementRouteEngine(final QueryContext queryContext) {
-        return new 
ShadowDeleteStatementDataSourceMappingsFinder((DeleteStatementContext) 
queryContext.getSqlStatementContext(), queryContext.getParameters(), 
queryContext.getHintValueContext());
+    private static ShadowDataSourceMappingsFinder 
createShadowSelectStatementDataSourceMappingsFinder(final QueryContext 
queryContext) {
+        return new 
ShadowSelectStatementDataSourceMappingsFinder((SelectStatementContext) 
queryContext.getSqlStatementContext(), queryContext.getParameters(), 
queryContext.getHintValueContext());
     }
     
-    private static ShadowDataSourceMappingsFinder 
createShadowInsertStatementRouteEngine(final QueryContext queryContext) {
-        return new 
ShadowInsertStatementDataSourceMappingsFinder((InsertStatementContext) 
queryContext.getSqlStatementContext(), queryContext.getHintValueContext());
+    private static ShadowDataSourceMappingsFinder 
createShadowNonMDLStatementDataSourceMappingsFinder(final QueryContext 
queryContext) {
+        return new 
ShadowNonDMLStatementDataSourceMappingsFinder(queryContext.getHintValueContext());
     }
 }
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/AbstractShadowDMLStatementDataSourceMappingsFinder.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/AbstractShadowDMLStatementDataSourceMappingsFinder.java
similarity index 95%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/AbstractShadowDMLStatementDataSourceMappingsFinder.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/AbstractShadowDMLStatementDataSourceMappingsFinder.java
index 0af9b1c0a80..35df01ab9b8 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/AbstractShadowDMLStatementDataSourceMappingsFinder.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/AbstractShadowDMLStatementDataSourceMappingsFinder.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder.dml;
+package org.apache.shardingsphere.shadow.route.finder.dml;
 
 import lombok.Getter;
 import org.apache.shardingsphere.infra.annotation.HighFrequencyInvocation;
@@ -24,9 +24,9 @@ import 
org.apache.shardingsphere.infra.binder.context.type.TableAvailable;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.shadow.condition.ShadowColumnCondition;
 import org.apache.shardingsphere.shadow.condition.ShadowDetermineCondition;
-import 
org.apache.shardingsphere.shadow.route.engine.determiner.ColumnShadowAlgorithmDeterminer;
-import 
org.apache.shardingsphere.shadow.route.engine.determiner.HintShadowAlgorithmDeterminer;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.ShadowDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.determiner.ColumnShadowAlgorithmDeterminer;
+import 
org.apache.shardingsphere.shadow.route.determiner.HintShadowAlgorithmDeterminer;
+import 
org.apache.shardingsphere.shadow.route.finder.ShadowDataSourceMappingsFinder;
 import org.apache.shardingsphere.shadow.rule.ShadowRule;
 import org.apache.shardingsphere.shadow.spi.ShadowAlgorithm;
 import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowDeleteStatementDataSourceMappingsFinder.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowDeleteStatementDataSourceMappingsFinder.java
similarity index 95%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowDeleteStatementDataSourceMappingsFinder.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowDeleteStatementDataSourceMappingsFinder.java
index 9c956cb7837..6c86f6d8cb8 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowDeleteStatementDataSourceMappingsFinder.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowDeleteStatementDataSourceMappingsFinder.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder.dml;
+package org.apache.shardingsphere.shadow.route.finder.dml;
 
 import 
org.apache.shardingsphere.infra.binder.context.statement.dml.DeleteStatementContext;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
 import org.apache.shardingsphere.shadow.condition.ShadowColumnCondition;
-import org.apache.shardingsphere.shadow.route.engine.util.ShadowExtractor;
+import org.apache.shardingsphere.shadow.route.util.ShadowExtractor;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.AndPredicate;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.WhereSegment;
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowInsertStatementDataSourceMappingsFinder.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowInsertStatementDataSourceMappingsFinder.java
similarity index 98%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowInsertStatementDataSourceMappingsFinder.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowInsertStatementDataSourceMappingsFinder.java
index 1abc47c5a8d..3cb306f42b5 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowInsertStatementDataSourceMappingsFinder.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowInsertStatementDataSourceMappingsFinder.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder.dml;
+package org.apache.shardingsphere.shadow.route.finder.dml;
 
 import 
org.apache.shardingsphere.infra.binder.context.segment.insert.values.InsertValueContext;
 import 
org.apache.shardingsphere.infra.binder.context.statement.dml.InsertStatementContext;
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowSelectStatementDataSourceMappingsFinder.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowSelectStatementDataSourceMappingsFinder.java
similarity index 96%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowSelectStatementDataSourceMappingsFinder.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowSelectStatementDataSourceMappingsFinder.java
index 6dd87aae743..5c1aa683cbf 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowSelectStatementDataSourceMappingsFinder.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowSelectStatementDataSourceMappingsFinder.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder.dml;
+package org.apache.shardingsphere.shadow.route.finder.dml;
 
 import 
org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
+import org.apache.shardingsphere.shadow.route.util.ShadowExtractor;
 import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
 import org.apache.shardingsphere.shadow.condition.ShadowColumnCondition;
-import org.apache.shardingsphere.shadow.route.engine.util.ShadowExtractor;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.AndPredicate;
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowUpdateStatementDataSourceMappingsFinder.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowUpdateStatementDataSourceMappingsFinder.java
similarity index 96%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowUpdateStatementDataSourceMappingsFinder.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowUpdateStatementDataSourceMappingsFinder.java
index 8bcf3358e94..052c6fcde7e 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/dml/ShadowUpdateStatementDataSourceMappingsFinder.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/dml/ShadowUpdateStatementDataSourceMappingsFinder.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder.dml;
+package org.apache.shardingsphere.shadow.route.finder.dml;
 
 import 
org.apache.shardingsphere.infra.binder.context.statement.dml.UpdateStatementContext;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
+import org.apache.shardingsphere.shadow.route.util.ShadowExtractor;
 import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
 import org.apache.shardingsphere.shadow.condition.ShadowColumnCondition;
-import org.apache.shardingsphere.shadow.route.engine.util.ShadowExtractor;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.AndPredicate;
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/other/ShadowNonDMLStatementDataSourceMappingsFinder.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/other/ShadowNonDMLStatementDataSourceMappingsFinder.java
similarity index 83%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/other/ShadowNonDMLStatementDataSourceMappingsFinder.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/other/ShadowNonDMLStatementDataSourceMappingsFinder.java
index 68ce6113566..f055cc1dbf1 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/finder/other/ShadowNonDMLStatementDataSourceMappingsFinder.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/finder/other/ShadowNonDMLStatementDataSourceMappingsFinder.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder.other;
+package org.apache.shardingsphere.shadow.route.finder.other;
 
 import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.shadow.condition.ShadowDetermineCondition;
-import 
org.apache.shardingsphere.shadow.route.engine.determiner.HintShadowAlgorithmDeterminer;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.ShadowDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.determiner.HintShadowAlgorithmDeterminer;
+import 
org.apache.shardingsphere.shadow.route.finder.ShadowDataSourceMappingsFinder;
 import org.apache.shardingsphere.shadow.rule.ShadowRule;
 import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
 
@@ -41,13 +41,13 @@ public final class 
ShadowNonDMLStatementDataSourceMappingsFinder implements Shad
         if (!hintValueContext.isShadow()) {
             return Collections.emptyMap();
         }
-        if (isMatchAnyNoteShadowAlgorithms(rule, new 
ShadowDetermineCondition("", ShadowOperationType.HINT_MATCH))) {
+        if (isMatchAnyHintShadowAlgorithms(rule, new 
ShadowDetermineCondition("", ShadowOperationType.HINT_MATCH))) {
             return rule.getAllShadowDataSourceMappings();
         }
         return Collections.emptyMap();
     }
     
-    private boolean isMatchAnyNoteShadowAlgorithms(final ShadowRule rule, 
final ShadowDetermineCondition shadowCondition) {
+    private boolean isMatchAnyHintShadowAlgorithms(final ShadowRule rule, 
final ShadowDetermineCondition shadowCondition) {
         return rule.getAllHintShadowAlgorithms().stream().anyMatch(each -> 
HintShadowAlgorithmDeterminer.isShadow(each, shadowCondition, rule, 
hintValueContext.isShadow()));
     }
 }
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/util/ShadowExtractor.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/util/ShadowExtractor.java
similarity index 98%
rename from 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/util/ShadowExtractor.java
rename to 
features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/util/ShadowExtractor.java
index 34a464268df..acabd477e2a 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/engine/util/ShadowExtractor.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/route/util/ShadowExtractor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.util;
+package org.apache.shardingsphere.shadow.route.util;
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
diff --git 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/determiner/ColumnShadowAlgorithmDeterminerTest.java
 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/determiner/ColumnShadowAlgorithmDeterminerTest.java
similarity index 97%
rename from 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/determiner/ColumnShadowAlgorithmDeterminerTest.java
rename to 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/determiner/ColumnShadowAlgorithmDeterminerTest.java
index b9caa6ad88d..ae733e38c7f 100644
--- 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/determiner/ColumnShadowAlgorithmDeterminerTest.java
+++ 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/determiner/ColumnShadowAlgorithmDeterminerTest.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.determiner;
+package org.apache.shardingsphere.shadow.route.determiner;
 
 import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
-import org.apache.shardingsphere.shadow.spi.column.ColumnShadowAlgorithm;
 import org.apache.shardingsphere.shadow.condition.ShadowColumnCondition;
 import org.apache.shardingsphere.shadow.condition.ShadowDetermineCondition;
 import org.apache.shardingsphere.shadow.spi.ShadowAlgorithm;
+import org.apache.shardingsphere.shadow.spi.ShadowOperationType;
+import org.apache.shardingsphere.shadow.spi.column.ColumnShadowAlgorithm;
 import org.apache.shardingsphere.test.util.PropertiesBuilder;
 import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
 import org.junit.jupiter.api.Test;
diff --git 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/determiner/HintShadowAlgorithmDeterminerTest.java
 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/determiner/HintShadowAlgorithmDeterminerTest.java
similarity index 98%
rename from 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/determiner/HintShadowAlgorithmDeterminerTest.java
rename to 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/determiner/HintShadowAlgorithmDeterminerTest.java
index 3a0a77061c6..b51d023c455 100644
--- 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/determiner/HintShadowAlgorithmDeterminerTest.java
+++ 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/determiner/HintShadowAlgorithmDeterminerTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.determiner;
+package org.apache.shardingsphere.shadow.route.determiner;
 
 import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
diff --git 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteEngineFactoryTest.java
 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinderFactoryTest.java
similarity index 90%
rename from 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteEngineFactoryTest.java
rename to 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinderFactoryTest.java
index a6ed9cce161..4c5d960a6ed 100644
--- 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteEngineFactoryTest.java
+++ 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/finder/ShadowDataSourceMappingsFinderFactoryTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine;
+package org.apache.shardingsphere.shadow.route.finder;
 
 import 
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
 import 
org.apache.shardingsphere.infra.binder.context.statement.dml.DeleteStatementContext;
@@ -27,11 +27,10 @@ import 
org.apache.shardingsphere.infra.hint.HintValueContext;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.session.connection.ConnectionContext;
 import org.apache.shardingsphere.infra.session.query.QueryContext;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.ShadowDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowDeleteStatementDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowInsertStatementDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowSelectStatementDataSourceMappingsFinder;
-import 
org.apache.shardingsphere.shadow.route.engine.finder.dml.ShadowUpdateStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowDeleteStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowInsertStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowSelectStatementDataSourceMappingsFinder;
+import 
org.apache.shardingsphere.shadow.route.finder.dml.ShadowUpdateStatementDataSourceMappingsFinder;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
 import 
org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
@@ -47,7 +46,7 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-class ShadowRouteEngineFactoryTest {
+class ShadowDataSourceMappingsFinderFactoryTest {
     
     @Test
     void assertNewInstance() {
diff --git 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/finder/other/ShadowNonDMLStatementRouteEngineTest.java
 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/finder/other/ShadowNonDMLStatementRouteEngineTest.java
similarity index 97%
rename from 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/finder/other/ShadowNonDMLStatementRouteEngineTest.java
rename to 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/finder/other/ShadowNonDMLStatementRouteEngineTest.java
index 5a70f58bad2..82760b410bc 100644
--- 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/finder/other/ShadowNonDMLStatementRouteEngineTest.java
+++ 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/finder/other/ShadowNonDMLStatementRouteEngineTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.finder.other;
+package org.apache.shardingsphere.shadow.route.finder.other;
 
 import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
 import org.apache.shardingsphere.infra.hint.HintValueContext;
diff --git 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/util/ShadowExtractorTest.java
 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/util/ShadowExtractorTest.java
similarity index 98%
rename from 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/util/ShadowExtractorTest.java
rename to 
features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/util/ShadowExtractorTest.java
index da0b789234e..8abb63126f9 100644
--- 
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/engine/util/ShadowExtractorTest.java
+++ 
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/route/util/ShadowExtractorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.shadow.route.engine.util;
+package org.apache.shardingsphere.shadow.route.util;
 
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.BinaryOperationExpression;
 import 
org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.ExpressionSegment;


Reply via email to