FacadeService { public void removeLaunchTasksFromQueue(final List<TaskContext> taskContexts) { List<TaskContext> failoverTaskContexts = new ArrayList<>(taskContexts.size()); Collection<String> readyJobNames = new HashSet<>(taskContexts.size(), 1); for (TaskContext each : taskContexts) { switch (each.getType()) { case FAILOVER: failoverTaskContexts.add(each); break; case READY: readyJobNames.add(each.getMetaInfo().getJobName()); break; default: break; } } failoverService.remove(failoverTaskContexts.stream().map(TaskContext::getMetaInfo).collect(Collectors.toList())); readyService.remove(readyJobNames); } FacadeService(final CoordinatorRegistryCenter regCenter); void start(); Collection<JobContext> getEligibleJobContext(); void removeLaunchTasksFromQueue(final List<TaskContext> taskContexts); void addRunning(final TaskContext taskContext); void updateDaemonStatus(final TaskContext taskContext, final boolean isIdle); void removeRunning(final TaskContext taskContext); void recordFailoverTask(final TaskContext taskContext); void addTransient(final String jobName); Optional<CloudJobConfigurationPOJO> load(final String jobName); Optional<CloudAppConfigurationPOJO> loadAppConfig(final String appName); Optional<String> getFailoverTaskId(final MetaInfo metaInfo); void addDaemonJobToReadyQueue(final String jobName); boolean isRunning(final TaskContext taskContext); void addMapping(final String taskId, final String hostname); String popMapping(final String taskId); Map<String, Integer> getAllReadyTasks(); Map<String, Set<TaskContext>> getAllRunningTasks(); Map<String, Collection<FailoverTaskInfo>> getAllFailoverTasks(); boolean isJobDisabled(final String jobName); void enableJob(final String jobName); void disableJob(final String jobName); Collection<ExecutorStateInfo> loadExecutorInfo(); void stop();  }
@Test public void assertRemoveLaunchTasksFromQueue() { facadeService.removeLaunchTasksFromQueue(Arrays.asList( TaskContext.from(TaskNode.builder().type(ExecutionType.FAILOVER).build().getTaskNodeValue()), TaskContext.from(TaskNode.builder().build().getTaskNodeValue()))); verify(failoverService).remove(Collections.singletonList(MetaInfo.from(TaskNode.builder().build().getTaskNodePath()))); verify(readyService).remove(Sets.newHashSet("test_job")); }