RouteService implements IRouteService { public ExecutePlan doRoute(String sql, Map<Integer, ParameterCommand> parameterCommand) { SqlType sqlType = SqlTypeUtil.getSqlType(sql); SqlParser parser = SqlParserFactory.getParser(sqlType); if (parser == null){ return buildExecutePlanTypeNo(sql, null, sqlType); } ParseResult result = new ParseResult(); parser.init(sql, buildParameters(parameterCommand)); parser.parse(result); ExecutePlan plan = route(result.getTables(), result.getCalculateUnits(), sql, sqlType); parser.changeSql(result, plan); return plan; }  ExecutePlan doRoute(String sql, Map<Integer, ParameterCommand> parameterCommand); ExecutePlan route(List<String> tables, List<CalculateUnit> units, String sql, SqlType sqlType); List<Object> buildParameters(Map<Integer, ParameterCommand> commonds);  }
@Test public void testDoRoute() throws Exception { ExecutePlan plan = routeService.doRoute(single14, null); System.out.println(plan); Assert.assertEquals(ExecuteType.ALL, plan.getExecuteType()); TrargetSqlEntity sql = plan.getSqlList().get(0); Assert.assertEquals("p1", sql.getPartition()); Assert.assertEquals("table1", sql.getLogicTableName()); Assert.assertEquals("table1_1", sql.getTargetTableName()); Assert.assertEquals(4, plan.getSqlList().size()); }