SQLExecutePrepareTemplate { public Collection<ShardingExecuteGroup<StatementExecuteUnit>> getExecuteUnitGroups(final Collection<RouteUnit> routeUnits, final SQLExecutePrepareCallback callback) throws SQLException { return getSynchronizedExecuteUnitGroups(routeUnits, callback); }  Collection<ShardingExecuteGroup<StatementExecuteUnit>> getExecuteUnitGroups(final Collection<RouteUnit> routeUnits, final SQLExecutePrepareCallback callback);  }
@Test public void assertGetExecuteUnitGroupForOneShardMemoryStrictly() throws SQLException { mockConnections(callback, ConnectionMode.MEMORY_STRICTLY, 1); sqlExecutePrepareTemplate = new SQLExecutePrepareTemplate(2); Collection<ShardingExecuteGroup<StatementExecuteUnit>> actual = sqlExecutePrepareTemplate.getExecuteUnitGroups(mockShardRouteUnit(1, 1), callback); assertThat(actual.size(), is(1)); for (ShardingExecuteGroup<StatementExecuteUnit> each : actual) { assertThat(each.getInputs().size(), is(1)); } }
@Test public void assertGetExecuteUnitGroupForMultiShardConnectionStrictly() throws SQLException { mockConnections(callback, ConnectionMode.CONNECTION_STRICTLY, 1); sqlExecutePrepareTemplate = new SQLExecutePrepareTemplate(1); Collection<ShardingExecuteGroup<StatementExecuteUnit>> actual = sqlExecutePrepareTemplate.getExecuteUnitGroups(mockShardRouteUnit(10, 2), callback); assertThat(actual.size(), is(10)); for (ShardingExecuteGroup<StatementExecuteUnit> each : actual) { assertThat(each.getInputs().size(), is(2)); } }