@Test public void getSegmentSiblingsRootTest() { doAnswer(invocationOnMock -> { final Path p = Paths.convert((org.uberfire.java.nio.file.Path) invocationOnMock.getArguments()[0]); return new FolderItem(p, p.getFileName(), FolderItemType.FOLDER); }).when(explorerServiceHelper).toFolderItem(any(org.uberfire.java.nio.file.Path.class)); Path path = PathFactory.newPath("/", "default: final List<FolderItem> siblings = resolver.getSegmentSiblings(path); assertEquals(1, siblings.size()); assertEquals("/", siblings.get(0).getFileName()); }
List<FolderItem> getSegmentSiblings(final Path path) { final List<FolderItem> result = new ArrayList<>(); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (nioPath.equals(nioPath.getRoot())) { result.add(explorerServiceHelper.toFolderItem(nioPath)); } else { final org.uberfire.java.nio.file.Path nioParentPath = nioPath.getParent(); for (org.uberfire.java.nio.file.Path sibling : getDirectoryIterator(nioParentPath)) { result.add(explorerServiceHelper.toFolderItem(sibling)); } } return result; }
ProjectExplorerContentResolver { List<FolderItem> getSegmentSiblings(final Path path) { final List<FolderItem> result = new ArrayList<>(); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (nioPath.equals(nioPath.getRoot())) { result.add(explorerServiceHelper.toFolderItem(nioPath)); } else { final org.uberfire.java.nio.file.Path nioParentPath = nioPath.getParent(); for (org.uberfire.java.nio.file.Path sibling : getDirectoryIterator(nioParentPath)) { result.add(explorerServiceHelper.toFolderItem(sibling)); } } return result; } }
ProjectExplorerContentResolver { List<FolderItem> getSegmentSiblings(final Path path) { final List<FolderItem> result = new ArrayList<>(); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (nioPath.equals(nioPath.getRoot())) { result.add(explorerServiceHelper.toFolderItem(nioPath)); } else { final org.uberfire.java.nio.file.Path nioParentPath = nioPath.getParent(); for (org.uberfire.java.nio.file.Path sibling : getDirectoryIterator(nioParentPath)) { result.add(explorerServiceHelper.toFolderItem(sibling)); } } return result; } @Inject  ProjectExplorerContentResolver(final KieModuleService moduleService,
                                          final ExplorerServiceHelper helper,
                                          final ExplorerServiceHelper explorerServiceHelper,
                                          final WorkspaceProjectService projectService); }
ProjectExplorerContentResolver { List<FolderItem> getSegmentSiblings(final Path path) { final List<FolderItem> result = new ArrayList<>(); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (nioPath.equals(nioPath.getRoot())) { result.add(explorerServiceHelper.toFolderItem(nioPath)); } else { final org.uberfire.java.nio.file.Path nioParentPath = nioPath.getParent(); for (org.uberfire.java.nio.file.Path sibling : getDirectoryIterator(nioParentPath)) { result.add(explorerServiceHelper.toFolderItem(sibling)); } } return result; } @Inject  ProjectExplorerContentResolver(final KieModuleService moduleService,
                                          final ExplorerServiceHelper helper,
                                          final ExplorerServiceHelper explorerServiceHelper,
                                          final WorkspaceProjectService projectService); ProjectExplorerContent resolve(final ProjectExplorerContentQuery query); }
ProjectExplorerContentResolver { List<FolderItem> getSegmentSiblings(final Path path) { final List<FolderItem> result = new ArrayList<>(); final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); if (nioPath.equals(nioPath.getRoot())) { result.add(explorerServiceHelper.toFolderItem(nioPath)); } else { final org.uberfire.java.nio.file.Path nioParentPath = nioPath.getParent(); for (org.uberfire.java.nio.file.Path sibling : getDirectoryIterator(nioParentPath)) { result.add(explorerServiceHelper.toFolderItem(sibling)); } } return result; } @Inject  ProjectExplorerContentResolver(final KieModuleService moduleService,
                                          final ExplorerServiceHelper helper,
                                          final ExplorerServiceHelper explorerServiceHelper,
                                          final WorkspaceProjectService projectService); ProjectExplorerContent resolve(final ProjectExplorerContentQuery query);  }