ShardingExecuteEngine implements AutoCloseable { public <I, O> List<O> groupExecute(final Collection<ShardingExecuteGroup<I>> inputGroups, final ShardingGroupExecuteCallback<I, O> callback) throws SQLException { return groupExecute(inputGroups, null, callback, false); } ShardingExecuteEngine(final int executorSize); List<O> groupExecute(final Collection<ShardingExecuteGroup<I>> inputGroups, final ShardingGroupExecuteCallback<I, O> callback); List<O> groupExecute(
        final Collection<ShardingExecuteGroup<I>> inputGroups, final ShardingGroupExecuteCallback<I, O> firstCallback, final ShardingGroupExecuteCallback<I, O> callback, final boolean serial); @Override void close();  }
@Test public void assertParallelExecuteWithoutFirstCallback() throws SQLException, InterruptedException { List<String> actual = shardingExecuteEngine.groupExecute(inputGroups, callback); latch.await(); assertThat(actual.size(), is(4)); }
@Test public void assertParallelExecuteWithFirstCallback() throws SQLException, InterruptedException { List<String> actual = shardingExecuteEngine.groupExecute(inputGroups, firstCallback, callback, false); latch.await(); assertThat(actual.size(), is(4)); }
@Test public void assertSerialExecute() throws SQLException, InterruptedException { List<String> actual = shardingExecuteEngine.groupExecute(inputGroups, firstCallback, callback, true); latch.await(); assertThat(actual.size(), is(4)); }
@Test public void assertInputGroupIsEmpty() throws SQLException { CountDownLatch latch = new CountDownLatch(1); List<String> actual = shardingExecuteEngine.groupExecute(new LinkedList<ShardingExecuteGroup<StatementExecuteUnit>>(), new MockGroupExecuteCallback(latch)); latch.countDown(); assertThat(actual.size(), is(0)); }