return Arrays.asList(channel);
}
}
});
List<NodeTask> tasks = null;
NodeTaskServiceImpl nodeTaskSerivce = (NodeTaskServiceImpl) spring.getBean("nodeTaskService");
reflector.invoke(nodeTaskSerivce, "initNodeTask");
tasks = reflector.invoke(nodeTaskSerivce, "mergeIncNodeTasks");
want.number(tasks.size()).isEqualTo(2);
reflector.invoke(nodeTaskSerivce, "initNodeTask");
tasks = reflector.invoke(nodeTaskSerivce, "mergeIncNodeTasks");
want.bool(tasks.size() == 0).is(true);
channel.setStatus(ChannelStatus.STOP);
reflector.invoke(nodeTaskSerivce, "initNodeTask");
tasks = reflector.invoke(nodeTaskSerivce, "mergeIncNodeTasks");
want.bool(tasks.size() == 2).is(true);
tasks = nodeTaskSerivce.listAllNodeTasks();
want.bool(tasks.size() == 2).is(true);
// 清理内存
TestUtils.setField(nodeTaskSerivce, "allTasks", Lists.newArrayList());
TestUtils.setField(nodeTaskSerivce, "incTasks", Lists.newArrayList());