ShardingDatabaseBroadcastRoutingEngine implements ShardingRouteEngine { @Override public void route(final RouteContext routeContext, final ShardingRule shardingRule) { for (String each : shardingRule.getDataSourceNames()) { routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())); } }  @Override void route(final RouteContext routeContext, final ShardingRule shardingRule);  }
@Test public void assertRoute() { ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration(); shardingRuleConfig.getTables().add(new ShardingTableRuleConfiguration("t_order", "ds${0..1}.t_order_${0..2}")); RouteContext routeContext = new RouteContext(); shardingDatabaseBroadcastRoutingEngine.route(routeContext, new ShardingRule(shardingRuleConfig, Arrays.asList("ds0", "ds1"))); List<RouteUnit> routeUnits = new ArrayList<>(routeContext.getRouteUnits()); assertThat(routeContext.getRouteUnits().size(), is(2)); assertThat(routeUnits.get(0).getDataSourceMapper().getActualName(), is("ds0")); assertThat(routeUnits.get(1).getDataSourceMapper().getActualName(), is("ds1")); }