CommandExecutorSelector { public static ExecutorService getExecutorService(final boolean isOccupyThreadForPerConnection, final boolean supportHint, final TransactionType transactionType, final ChannelId channelId) { return isOccupyThreadForPerConnection(isOccupyThreadForPerConnection, supportHint, transactionType) ? ChannelThreadExecutorGroup.getInstance().get(channelId) : UserExecutorGroup.getInstance().getExecutorService(); }  static ExecutorService getExecutorService(final boolean isOccupyThreadForPerConnection, final boolean supportHint, final TransactionType transactionType, final ChannelId channelId);  }
@Test public void assertGetExecutorServiceWithLocal() { ChannelId channelId = mock(ChannelId.class); assertThat(CommandExecutorSelector.getExecutorService(false, false, TransactionType.LOCAL, channelId), instanceOf(ExecutorService.class)); }
@Test public void assertGetExecutorServiceWithOccupyThreadForPerConnection() { ChannelId channelId = mock(ChannelId.class); ChannelThreadExecutorGroup.getInstance().register(channelId); assertThat(CommandExecutorSelector.getExecutorService(true, false, TransactionType.LOCAL, channelId), instanceOf(ExecutorService.class)); }
@Test public void assertGetExecutorServiceWithXA() { ChannelId channelId = mock(ChannelId.class); ChannelThreadExecutorGroup.getInstance().register(channelId); assertThat(CommandExecutorSelector.getExecutorService(false, false, TransactionType.XA, channelId), instanceOf(ExecutorService.class)); }
@Test public void assertGetExecutorServiceWithBASE() { ChannelId channelId = mock(ChannelId.class); ChannelThreadExecutorGroup.getInstance().register(channelId); assertThat(CommandExecutorSelector.getExecutorService(false, false, TransactionType.BASE, channelId), instanceOf(ExecutorService.class)); }