test_class.declarator: SHADOW_COLUMN = "is_shadow"
test_class.modifier: private static final
test_class.original_string: private static final String SHADOW_COLUMN = "is_shadow";
test_class.type: String
test_class.var_name: SHADOW_COLUMN
test_class.declarator: ACTUAL_DATASOURCE = "ds"
test_class.modifier: private static final
test_class.original_string: private static final String ACTUAL_DATASOURCE = "ds";
test_class.type: String
test_class.var_name: ACTUAL_DATASOURCE
test_class.declarator: SHADOW_DATASOURCE = "shadow_ds"
test_class.modifier: private static final
test_class.original_string: private static final String SHADOW_DATASOURCE = "shadow_ds";
test_class.type: String
test_class.var_name: SHADOW_DATASOURCE
test_class.declarator: sqlRouter
test_class.modifier: private
test_class.original_string: private ShadowSQLRouter sqlRouter;
test_class.type: ShadowSQLRouter
test_class.var_name: sqlRouter
test_class.declarator: rule
test_class.modifier: private
test_class.original_string: private ShadowRule rule;
test_class.type: ShadowRule
test_class.var_name: rule
test_class.file: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouterTest.java
test_class.identifier: ShadowSQLRouterTest
test_case.body: @Test
      public void assertDecorateRouteContextNonDMLStatement() {
          RouteContext actual = new RouteContext();
          actual.getRouteUnits().add(mockRouteUnit());
          ShardingSphereSchema schema = new ShardingSphereSchema("logic_schema", Collections.emptyList(), Collections.singleton(rule), Collections.emptyMap(), mock(ShardingSphereMetaData.class));
          LogicSQL logicSQL = new LogicSQL(schema, mockNonDMLSQLStatementContext(), "", Collections.emptyList());
          sqlRouter.decorateRouteContext(actual, logicSQL, rule, new ConfigurationProperties(new Properties()));
          assertThat(actual.getRouteUnits().size(), is(2));
          assertTrue(actual.getActualDataSourceNames().contains(SHADOW_DATASOURCE));
          assertTrue(actual.getActualDataSourceNames().contains(ACTUAL_DATASOURCE));
      }
test_case.class_method_signature: ShadowSQLRouterTest.assertDecorateRouteContextNonDMLStatement()
test_case.full_signature: @Test public void assertDecorateRouteContextNonDMLStatement()
test_case.identifier: assertDecorateRouteContextNonDMLStatement
test_case.invocations: add getRouteUnits mockRouteUnit emptyList singleton emptyMap mock mockNonDMLSQLStatementContext emptyList decorateRouteContext assertThat size getRouteUnits is assertTrue contains getActualDataSourceNames assertTrue contains getActualDataSourceNames
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertDecorateRouteContextNonDMLStatement()
focal_class.file: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouter.java
focal_class.identifier: ShadowSQLRouter
focal_class.interfaces: implements SQLRouter<ShadowRule>
focal_class.class_method_signature: ShadowSQLRouter.createRouteContext(final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.full_signature: @Override public RouteContext createRouteContext(final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.identifier: createRouteContext
focal_class.modifiers: @Override public
focal_class.parameters: (final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.return: RouteContext
focal_class.signature: RouteContext createRouteContext(final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.class_method_signature: ShadowSQLRouter.decorateRouteContext(final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.full_signature: @Override public void decorateRouteContext(final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.identifier: decorateRouteContext
focal_class.modifiers: @Override public
focal_class.parameters: (final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.return: void
focal_class.signature: void decorateRouteContext(final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_class.class_method_signature: ShadowSQLRouter.isShadow(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule rule)
focal_class.full_signature: private boolean isShadow(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule rule)
focal_class.identifier: isShadow
focal_class.modifiers: private
focal_class.parameters: (final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule rule)
focal_class.return: boolean
focal_class.signature: boolean isShadow(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule rule)
focal_class.class_method_signature: ShadowSQLRouter.getOrder()
focal_class.full_signature: @Override public int getOrder()
focal_class.identifier: getOrder
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getOrder()
focal_class.class_method_signature: ShadowSQLRouter.getTypeClass()
focal_class.full_signature: @Override public Class<ShadowRule> getTypeClass()
focal_class.identifier: getTypeClass
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Class<ShadowRule>
focal_class.signature: Class<ShadowRule> getTypeClass()
focal_method.body: @Override
      public void decorateRouteContext(final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props) {
          Collection<RouteUnit> toBeAdded = new LinkedList<>();
          if (!(logicSQL.getSqlStatementContext().getSqlStatement() instanceof DMLStatement)) {
              for (RouteUnit each : routeContext.getRouteUnits()) {
                  String shadowDataSourceName = rule.getShadowMappings().get(each.getDataSourceMapper().getActualName());
                  toBeAdded.add(new RouteUnit(new RouteMapper(each.getDataSourceMapper().getLogicName(), shadowDataSourceName), each.getTableMappers()));
              }
              routeContext.getRouteUnits().addAll(toBeAdded);
              return;
          }
          Collection<RouteUnit> toBeRemoved = new LinkedList<>();
          if (isShadow(logicSQL.getSqlStatementContext(), logicSQL.getParameters(), rule)) {
              for (RouteUnit each : routeContext.getRouteUnits()) {
                  toBeRemoved.add(each);
                  String shadowDataSourceName = rule.getShadowMappings().get(each.getDataSourceMapper().getActualName());
                  toBeAdded.add(new RouteUnit(new RouteMapper(each.getDataSourceMapper().getLogicName(), shadowDataSourceName), each.getTableMappers()));
              }
          }
          routeContext.getRouteUnits().removeAll(toBeRemoved);
          routeContext.getRouteUnits().addAll(toBeAdded);
      }
focal_method.class_method_signature: ShadowSQLRouter.decorateRouteContext(final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_method.full_signature: @Override public void decorateRouteContext(final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_method.identifier: decorateRouteContext
focal_method.invocations: getSqlStatement getSqlStatementContext getRouteUnits get getShadowMappings getActualName getDataSourceMapper add getLogicName getDataSourceMapper getTableMappers addAll getRouteUnits isShadow getSqlStatementContext getParameters getRouteUnits add get getShadowMappings getActualName getDataSourceMapper add getLogicName getDataSourceMapper getTableMappers removeAll getRouteUnits addAll getRouteUnits
focal_method.modifiers: @Override public
focal_method.parameters: (final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_method.return: void
focal_method.signature: void decorateRouteContext(final RouteContext routeContext, final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)