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 assertCreateRouteContextToActualDataSource() {
          ShardingSphereSchema schema = new ShardingSphereSchema("logic_schema", Collections.emptyList(), Collections.singleton(rule), Collections.emptyMap(), mock(ShardingSphereMetaData.class));
          LogicSQL logicSQL = new LogicSQL(schema, mockSQLStatementContext(), "", Collections.emptyList());
          RouteContext actual = sqlRouter.createRouteContext(logicSQL, rule, new ConfigurationProperties(new Properties()));
          Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
          assertThat(routedDataSourceNames.next(), is(ACTUAL_DATASOURCE));
      }
test_case.class_method_signature: ShadowSQLRouterTest.assertCreateRouteContextToActualDataSource()
test_case.full_signature: @Test public void assertCreateRouteContextToActualDataSource()
test_case.identifier: assertCreateRouteContextToActualDataSource
test_case.invocations: emptyList singleton emptyMap mock mockSQLStatementContext emptyList createRouteContext iterator getActualDataSourceNames assertThat next is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertCreateRouteContextToActualDataSource()
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 RouteContext createRouteContext(final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props) {
          RouteContext result = new RouteContext();
          if (!(logicSQL.getSqlStatementContext().getSqlStatement() instanceof DMLStatement)) {
              rule.getShadowMappings().forEach((key, value) -> {
                  result.getRouteUnits().add(new RouteUnit(new RouteMapper(key, key), Collections.emptyList()));
                  result.getRouteUnits().add(new RouteUnit(new RouteMapper(value, value), Collections.emptyList()));
              });
              return result;
          }
          if (isShadow(logicSQL.getSqlStatementContext(), logicSQL.getParameters(), rule)) {
              rule.getShadowMappings().values().forEach(each -> result.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())));
          } else {
              rule.getShadowMappings().keySet().forEach(each -> result.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())));
          }
          return result;
      }
focal_method.class_method_signature: ShadowSQLRouter.createRouteContext(final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_method.full_signature: @Override public RouteContext createRouteContext(final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_method.identifier: createRouteContext
focal_method.invocations: getSqlStatement getSqlStatementContext forEach getShadowMappings add getRouteUnits emptyList add getRouteUnits emptyList isShadow getSqlStatementContext getParameters forEach values getShadowMappings add getRouteUnits emptyList forEach keySet getShadowMappings add getRouteUnits emptyList
focal_method.modifiers: @Override public
focal_method.parameters: (final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)
focal_method.return: RouteContext
focal_method.signature: RouteContext createRouteContext(final LogicSQL logicSQL, final ShadowRule rule, final ConfigurationProperties props)