ShardingInstanceBroadcastRoutingEngine implements ShardingRouteEngine { @Override public void route(final RouteContext routeContext, final ShardingRule shardingRule) { for (String each : shardingRule.getDataSourceNames()) { if (dataSourcesMetaData.getAllInstanceDataSourceNames().contains(each)) { routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())); } } }  @Override void route(final RouteContext routeContext, final ShardingRule shardingRule);  }
@Test public void assertRoute() { RouteContext routeContext = new RouteContext(); shardingInstanceBroadcastRoutingEngine.route(routeContext, shardingRule); assertThat(routeContext.getRouteUnits().size(), is(1)); assertThat(routeContext.getRouteUnits().iterator().next().getDataSourceMapper().getActualName(), is(DATASOURCE_NAME)); }