public TaskRunScheduler getTaskRunScheduler() {
        return taskRunScheduler;
    }
@Test
    public void testTaskRunMergeRedundant1() {
        TaskRunManager taskRunManager = new TaskRunManager();
        Task task = new Task("test");
        task.setDefinition("select 1");
        long taskId = 1;

        TaskRun taskRun1 = makeTaskRun(taskId, task, makeExecuteOption(true, false));
        TaskRun taskRun2 = makeTaskRun(taskId, task, makeExecuteOption(true, true));

        // If it's a sync refresh, no merge redundant anyway
        SubmitResult result = taskRunManager.submitTaskRun(taskRun1, taskRun1.getExecuteOption());
        Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.SUBMITTED);
        result = taskRunManager.submitTaskRun(taskRun2, taskRun2.getExecuteOption());
        Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.SUBMITTED);

        TaskRunScheduler taskRunScheduler = taskRunManager.getTaskRunScheduler();
        Collection<TaskRun> taskRuns = taskRunScheduler.getPendingTaskRunsByTaskId(taskId);
        Assert.assertTrue(taskRuns != null);
        Assert.assertEquals(2, taskRunScheduler.getPendingQueueCount());
        Assert.assertEquals(2, taskRunScheduler.getPendingTaskRunsByTaskId(taskId).size());

        // If it's a sync refresh, no merge redundant anyway
        TaskRun taskRun3 = makeTaskRun(taskId, task, makeExecuteOption(false, true));
        result = taskRunManager.submitTaskRun(taskRun3, taskRun3.getExecuteOption());
        Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.SUBMITTED);
        Assert.assertEquals(3, taskRunScheduler.getPendingQueueCount());
        Assert.assertEquals(3, taskRunScheduler.getPendingTaskRunsByTaskId(taskId).size());
        // merge it
        TaskRun taskRun4 = makeTaskRun(taskId, task, makeExecuteOption(true, false));
        result = taskRunManager.submitTaskRun(taskRun4, taskRun4.getExecuteOption());
        Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.SUBMITTED);

        Assert.assertEquals(3, taskRunScheduler.getPendingQueueCount());
        Assert.assertEquals(3, taskRunScheduler.getPendingTaskRunsByTaskId(taskId).size());

        // no merge it
        TaskRun taskRun5 = makeTaskRun(taskId, task, makeExecuteOption(false, false));
        result = taskRunManager.submitTaskRun(taskRun5, taskRun5.getExecuteOption());
        Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.SUBMITTED);
        Assert.assertEquals(4, taskRunScheduler.getPendingQueueCount());
        Assert.assertEquals(4, taskRunScheduler.getPendingTaskRunsByTaskId(taskId).size());

        for (int i = 4; i < Config.task_runs_queue_length; i++) {
            TaskRun taskRun = makeTaskRun(taskId, task, makeExecuteOption(false, false));
            result = taskRunManager.submitTaskRun(taskRun, taskRun.getExecuteOption());
            Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.SUBMITTED);
            Assert.assertEquals(i + 1, taskRunScheduler.getPendingQueueCount());
            Assert.assertEquals(i + 1, taskRunScheduler.getPendingTaskRunsByTaskId(taskId).size());
        }
        // no assign it: exceed queue's size
        TaskRun taskRun6 = makeTaskRun(taskId, task, makeExecuteOption(false, false));
        result = taskRunManager.submitTaskRun(taskRun6, taskRun6.getExecuteOption());
        Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.REJECTED);
        Assert.assertEquals(Config.task_runs_queue_length, taskRunScheduler.getPendingQueueCount());
        Assert.assertEquals(Config.task_runs_queue_length, taskRunScheduler.getPendingTaskRunsByTaskId(taskId).size());

        // no assign it: exceed queue's size
        TaskRun taskRun7 = makeTaskRun(taskId, task, makeExecuteOption(false, false));
        result = taskRunManager.submitTaskRun(taskRun7, taskRun7.getExecuteOption());
        Assert.assertTrue(result.getStatus() == SubmitResult.SubmitStatus.REJECTED);
        Assert.assertEquals(Config.task_runs_queue_length, taskRunScheduler.getPendingQueueCount());
        Assert.assertEquals(Config.task_runs_queue_length, taskRunScheduler.getPendingTaskRunsByTaskId(taskId).size());
    }