@Test
public void testIndexPriorityWritesToIndexHandler() throws Exception {
RpcScheduler mock = Mockito.mock(RpcScheduler.class);
PriorityFunction qosFunction = Mockito.mock(PriorityFunction.class);
Abortable abortable = new AbortServer();
PhoenixRpcScheduler scheduler = new PhoenixRpcScheduler(conf, mock, 200, 250,qosFunction,abortable);
BalancedQueueRpcExecutor executor = new BalancedQueueRpcExecutor("test-queue", 1, 1,qosFunction,conf,abortable);
scheduler.setIndexExecutorForTesting(executor);
dispatchCallWithPriority(scheduler, 200);
List<BlockingQueue<CallRunner>> queues = executor.getQueues();
assertEquals(1, queues.size());
BlockingQueue<CallRunner> queue = queues.get(0);
queue.poll(20, TimeUnit.SECONDS);
scheduler = new PhoenixRpcScheduler(conf, mock, 101, 110,qosFunction,abortable);
scheduler.setIndexExecutorForTesting(executor);
dispatchCallWithPriority(scheduler, 101);
queue.poll(20, TimeUnit.SECONDS);
Mockito.verify(mock, Mockito.times(2)).init(Mockito.any(Context.class));
scheduler.stop();
executor.stop();
}