PerspectiveTreeProvider implements PermissionTreeProvider { @Override public void loadChildren(PermissionNode parent, LoadOptions options, LoadCallback callback) { if (parent.getNodeName().equals(rootNodeName)) { callback.afterLoad(buildPerspectiveNodes(options)); } } PerspectiveTreeProvider(); @Inject  PerspectiveTreeProvider(ActivityBeansCache activityBeansCache,
                                   PermissionManager permissionManager,
                                   PermissionTreeI18n i18n); boolean isActive(); void setActive(boolean active); String getResourceName(); void setResourceName(String resourceName); String getRootNodeName(); void setRootNodeName(String rootNodeName); int getRootNodePosition(); void setRootNodePosition(int rootNodePosition); void excludePerspectiveId(String perspectiveId); Set<String> getPerspectiveIdsExcluded(); @Override PermissionNode buildRootNode(); @Override void loadChildren(PermissionNode parent,
                             LoadOptions options,
                             LoadCallback callback); String getPerspectiveName(String perspectiveId); void setPerspectiveName(String perspectiveId,
                                   String name);  }
@Test public void testEmpty() { DefaultLoadOptions options = new DefaultLoadOptions(); provider.loadChildren(root, options, children -> { assertEquals(children.size(), 0); }); }
@Test public void testIncludedResourceIds() { DefaultLoadOptions options = new DefaultLoadOptions(); options.setResourceIds(Arrays.asList("Perspective1")); provider.loadChildren(root, options, children -> { assertEquals(children.size(), 1); }); }
@Test public void testExcludedResourceIds() { DefaultLoadOptions options = new DefaultLoadOptions(); options.setResourceIds(Arrays.asList("Perspective1")); provider.loadChildren(root, options, children -> { assertEquals(children.size(), 1); }); }
@Test public void testNameSearch1() { DefaultLoadOptions options = new DefaultLoadOptions(); options.setNodeNamePattern("nice"); provider.loadChildren(root, options, children -> { assertEquals(children.size(), 2); }); }
@Test public void testNameSearch2() { DefaultLoadOptions options = new DefaultLoadOptions(); options.setNodeNamePattern("another"); provider.loadChildren(root, options, children -> { assertEquals(children.size(), 1); }); }
@Test public void testNameSearch3() { DefaultLoadOptions options = new DefaultLoadOptions(); options.setNodeNamePattern("another"); provider.loadChildren(root, options, children -> { assertEquals(children.size(), 1); }); }