@Test public void assertLoadAllWithoutRootNode() { when(regCenter.isExisted("/config/job")).thenReturn(false); assertTrue(configService.loadAll().isEmpty()); verify(regCenter).isExisted("/config/job"); }
public Collection<CloudJobConfigurationPOJO> loadAll() { if (!regCenter.isExisted(CloudJobConfigurationNode.ROOT)) { return Collections.emptyList(); } List<String> jobNames = regCenter.getChildrenKeys(CloudJobConfigurationNode.ROOT); Collection<CloudJobConfigurationPOJO> result = new ArrayList<>(jobNames.size()); for (String each : jobNames) { load(each).ifPresent(result::add); } return result; }
CloudJobConfigurationService { public Collection<CloudJobConfigurationPOJO> loadAll() { if (!regCenter.isExisted(CloudJobConfigurationNode.ROOT)) { return Collections.emptyList(); } List<String> jobNames = regCenter.getChildrenKeys(CloudJobConfigurationNode.ROOT); Collection<CloudJobConfigurationPOJO> result = new ArrayList<>(jobNames.size()); for (String each : jobNames) { load(each).ifPresent(result::add); } return result; } }
CloudJobConfigurationService { public Collection<CloudJobConfigurationPOJO> loadAll() { if (!regCenter.isExisted(CloudJobConfigurationNode.ROOT)) { return Collections.emptyList(); } List<String> jobNames = regCenter.getChildrenKeys(CloudJobConfigurationNode.ROOT); Collection<CloudJobConfigurationPOJO> result = new ArrayList<>(jobNames.size()); for (String each : jobNames) { load(each).ifPresent(result::add); } return result; }  }
CloudJobConfigurationService { public Collection<CloudJobConfigurationPOJO> loadAll() { if (!regCenter.isExisted(CloudJobConfigurationNode.ROOT)) { return Collections.emptyList(); } List<String> jobNames = regCenter.getChildrenKeys(CloudJobConfigurationNode.ROOT); Collection<CloudJobConfigurationPOJO> result = new ArrayList<>(jobNames.size()); for (String each : jobNames) { load(each).ifPresent(result::add); } return result; }  void add(final CloudJobConfigurationPOJO cloudJobConfig); void update(final CloudJobConfigurationPOJO cloudJobConfig); Collection<CloudJobConfigurationPOJO> loadAll(); Optional<CloudJobConfigurationPOJO> load(final String jobName); void remove(final String jobName); }
CloudJobConfigurationService { public Collection<CloudJobConfigurationPOJO> loadAll() { if (!regCenter.isExisted(CloudJobConfigurationNode.ROOT)) { return Collections.emptyList(); } List<String> jobNames = regCenter.getChildrenKeys(CloudJobConfigurationNode.ROOT); Collection<CloudJobConfigurationPOJO> result = new ArrayList<>(jobNames.size()); for (String each : jobNames) { load(each).ifPresent(result::add); } return result; }  void add(final CloudJobConfigurationPOJO cloudJobConfig); void update(final CloudJobConfigurationPOJO cloudJobConfig); Collection<CloudJobConfigurationPOJO> loadAll(); Optional<CloudJobConfigurationPOJO> load(final String jobName); void remove(final String jobName);  }