@Test public void assertGetAllTasksWhenRootNodeHasNoChild() { when(regCenter.isExisted(ReadyNode.ROOT)).thenReturn(true); when(regCenter.getChildrenKeys(ReadyNode.ROOT)).thenReturn(Collections.emptyList()); assertTrue(readyService.getAllReadyTasks().isEmpty()); verify(regCenter).isExisted(ReadyNode.ROOT); verify(regCenter).getChildrenKeys(ReadyNode.ROOT); verify(regCenter, times(0)).get(ArgumentMatchers.any()); }
public Map<String, Integer> getAllReadyTasks() { if (!regCenter.isExisted(ReadyNode.ROOT)) { return Collections.emptyMap(); } List<String> jobNames = regCenter.getChildrenKeys(ReadyNode.ROOT); Map<String, Integer> result = new HashMap<>(jobNames.size(), 1); for (String each : jobNames) { String times = regCenter.get(ReadyNode.getReadyJobNodePath(each)); if (!Strings.isNullOrEmpty(times)) { result.put(each, Integer.parseInt(times)); } } return result; }
ReadyService { public Map<String, Integer> getAllReadyTasks() { if (!regCenter.isExisted(ReadyNode.ROOT)) { return Collections.emptyMap(); } List<String> jobNames = regCenter.getChildrenKeys(ReadyNode.ROOT); Map<String, Integer> result = new HashMap<>(jobNames.size(), 1); for (String each : jobNames) { String times = regCenter.get(ReadyNode.getReadyJobNodePath(each)); if (!Strings.isNullOrEmpty(times)) { result.put(each, Integer.parseInt(times)); } } return result; } }
ReadyService { public Map<String, Integer> getAllReadyTasks() { if (!regCenter.isExisted(ReadyNode.ROOT)) { return Collections.emptyMap(); } List<String> jobNames = regCenter.getChildrenKeys(ReadyNode.ROOT); Map<String, Integer> result = new HashMap<>(jobNames.size(), 1); for (String each : jobNames) { String times = regCenter.get(ReadyNode.getReadyJobNodePath(each)); if (!Strings.isNullOrEmpty(times)) { result.put(each, Integer.parseInt(times)); } } return result; } ReadyService(final CoordinatorRegistryCenter regCenter); }
ReadyService { public Map<String, Integer> getAllReadyTasks() { if (!regCenter.isExisted(ReadyNode.ROOT)) { return Collections.emptyMap(); } List<String> jobNames = regCenter.getChildrenKeys(ReadyNode.ROOT); Map<String, Integer> result = new HashMap<>(jobNames.size(), 1); for (String each : jobNames) { String times = regCenter.get(ReadyNode.getReadyJobNodePath(each)); if (!Strings.isNullOrEmpty(times)) { result.put(each, Integer.parseInt(times)); } } return result; } ReadyService(final CoordinatorRegistryCenter regCenter); void addTransient(final String jobName); void addDaemon(final String jobName); void setMisfireDisabled(final String jobName); Collection<JobContext> getAllEligibleJobContexts(final Collection<JobContext> ineligibleJobContexts); void remove(final Collection<String> jobNames); Map<String, Integer> getAllReadyTasks(); }
ReadyService { public Map<String, Integer> getAllReadyTasks() { if (!regCenter.isExisted(ReadyNode.ROOT)) { return Collections.emptyMap(); } List<String> jobNames = regCenter.getChildrenKeys(ReadyNode.ROOT); Map<String, Integer> result = new HashMap<>(jobNames.size(), 1); for (String each : jobNames) { String times = regCenter.get(ReadyNode.getReadyJobNodePath(each)); if (!Strings.isNullOrEmpty(times)) { result.put(each, Integer.parseInt(times)); } } return result; } ReadyService(final CoordinatorRegistryCenter regCenter); void addTransient(final String jobName); void addDaemon(final String jobName); void setMisfireDisabled(final String jobName); Collection<JobContext> getAllEligibleJobContexts(final Collection<JobContext> ineligibleJobContexts); void remove(final Collection<String> jobNames); Map<String, Integer> getAllReadyTasks();  }