ExecutorPathResolver { public List<String> getNextExecutorsPaths(String path) { List<String> nextExecutorsPaths = new ArrayList<>(); String executorPath = getExecutorPath(path); for (String availablePath : _availableExecutorPaths) { if (isNextExecutorPath(availablePath, executorPath)) { nextExecutorsPaths.add(availablePath); } } Collections.sort(nextExecutorsPaths); return nextExecutorsPaths; } ExecutorPathResolver(Set<String> availableExecutorPaths); String getExecutorPath(String path); List<String> getNextExecutorsPaths(String path); static final String ROOT_EXECUTOR_PATH; }
@Test public void testGetNextExecutorsPaths() { Assert.assertEquals( Arrays.asList("/plugins", "/server"), _executorPathResolver.getNextExecutorsPaths(null)); Assert.assertEquals( Arrays.asList("/server/log"), _executorPathResolver.getNextExecutorsPaths("/server")); Assert.assertEquals( Arrays.asList("/server/log/error", "/server/log/output"), _executorPathResolver.getNextExecutorsPaths("/server/log/xyz")); }