GenericTreeStructure implements TreeStructure { @Override public void getNodeByPath(@NotNull final String path, @NotNull final AsyncCallback<TreeNode<?>> callback) { getRootNodes(new AsyncCallback<List<TreeNode<?>>>() { @Override public void onSuccess(List<TreeNode<?>> result) { ProjectNode project = null; for (TreeNode<?> node : result) { if (node instanceof ProjectNode) { project = (ProjectNode)node; break; } } if (project == null) { callback.onFailure(new IllegalStateException("ProjectNode not found")); return; } String p = path; if (path.startsWith("/")) { p = path.substring(1); } getNodeByPathRecursively(project, p, project.getId().length() + 1, callback); } @Override public void onFailure(Throwable caught) { callback.onFailure(caught); } }); } protected  GenericTreeStructure(NodeFactory nodeFactory, EventBus eventBus, AppContext appContext,
                                   ProjectServiceClient projectServiceClient, DtoUnmarshallerFactory dtoUnmarshallerFactory); @Override void getRootNodes(@NotNull AsyncCallback<List<TreeNode<?>>> callback); @NotNull @Override TreeSettings getSettings(); NodeFactory getNodeFactory(); @Override void getNodeByPath(@NotNull final String path, @NotNull final AsyncCallback<TreeNode<?>> callback); ProjectNode newProjectNode(@NotNull ProjectDescriptor data); FileNode newFileNode(@NotNull TreeNode parent, @NotNull ItemReference data); FolderNode newFolderNode(@NotNull TreeNode parent, @NotNull ItemReference data);  }
@Test public void nodeSrcShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(asyncCallback).onSuccess(srcNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodePomXmlShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + POM_XML; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(asyncCallback).onSuccess(pomXmlNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeMainShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(asyncCallback).onSuccess(mainNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeJavaShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(asyncCallback).onSuccess(javaNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeComCodenvyExamplePackageShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(asyncCallback).onSuccess(comCodenvyExampleNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeControllerShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + CONTROLLER; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(asyncCallback).onSuccess(controllerNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeMessageControllerShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + CONTROLLER + "/" + MESSAGE_CONTROLLER; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(controllerNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(controllerNode); verify(asyncCallback).onSuccess(messageControllerNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeRegistrationControllerShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + CONTROLLER + "/" + REGISTRATION_CONTROLLER; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(controllerNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(controllerNode); verify(asyncCallback).onSuccess(registrationControllerNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeServiceShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + SERVICE; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(asyncCallback).onSuccess(serviceNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeReadmeShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + SERVICE + "/" + README; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(serviceNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(serviceNode); verify(asyncCallback).onSuccess(readmeNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeMessageServiceShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + SERVICE + "/" + MESSAGE_SERVICE; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(serviceNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(serviceNode); verify(asyncCallback).onSuccess(messageServiceNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeMessageServiceImplShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + SERVICE + "/" + MESSAGE_SERVICE_IMPL; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(serviceNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(serviceNode); verify(asyncCallback).onSuccess(messageServiceImplNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeRegistrationServiceShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + COM_CODENVY_EXAMPLE + "/" + SERVICE + "/" + REGISTRATION_SERVICE; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(comCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(comCodenvyExampleNode); verify(serviceNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(serviceNode); verify(asyncCallback).onSuccess(registrationServiceNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeOrgCodenvyExamplePackageShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + ORG_CODENVY_EXAMPLE; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(asyncCallback).onSuccess(orgCodenvyExampleNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeCreateBdSqlShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + JAVA + "/" + ORG_CODENVY_EXAMPLE + "/" + CREATE_BD_SQL; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(javaNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(javaNode); verify(orgCodenvyExampleNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(orgCodenvyExampleNode); verify(asyncCallback).onSuccess(createBdSqlNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeWebAppShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(asyncCallback).onSuccess(webAppNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeWebInfShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP + "/" + WEB_INF; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(webAppNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webAppNode); verify(asyncCallback).onSuccess(webInfNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeJspShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP + "/" + WEB_INF + "/" + JSP; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(webAppNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webAppNode); verify(webInfNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webInfNode); verify(asyncCallback).onSuccess(jspNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeMessageShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP + "/" + WEB_INF + "/" + JSP + "/" + MESSAGE_JSP; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(webAppNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webAppNode); verify(webInfNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webInfNode); verify(jspNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(jspNode); verify(asyncCallback).onSuccess(messageJspNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeRegistrationJspShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP + "/" + WEB_INF + "/" + JSP + "/" + REGISTRATION_JSP; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(webAppNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webAppNode); verify(webInfNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webInfNode); verify(jspNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(jspNode); verify(asyncCallback).onSuccess(registrationJspNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeSomeHtmlShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP + "/" + WEB_INF + "/" + JSP + "/" + SOME_HTML; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(webAppNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webAppNode); verify(webInfNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webInfNode); verify(jspNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(jspNode); verify(asyncCallback).onSuccess(someHtmlNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeWebSpringServletXmlShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP + "/" + SPRING_SERVLET_XML; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(webAppNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webAppNode); verify(asyncCallback).onSuccess(springServletXmlNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeWebXmlShouldBeReturnedByPath() { String path = "/" + SPRING + "/" + SRC + "/" + MAIN + "/" + WEB_APP + "/" + WEB_XML; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(srcNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(srcNode); verify(mainNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(mainNode); verify(webAppNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(webAppNode); verify(asyncCallback).onSuccess(webXmlNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeShouldNotBeReturnedEvenPathNotBeginningFromSlash() { String path = SPRING + "/" + SRC; treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(asyncCallback).onSuccess(srcNode); verify(asyncCallback, never()).onSuccess(null); }
@Test public void nodeShouldNotBeReturnedBecauseThereIsNotExist() { String path = "/" + SPRING + "/" + SRC; when(projectNode.getChildren()).thenReturn(getListTreeNode()); treeStructure.getNodeByPath(path, asyncCallback); rootNodeShouldBeReturned(); verify(projectNode).refreshChildren(treeNodeAsyncCallback.capture()); treeNodeAsyncCallback.getValue().onSuccess(projectNode); verify(asyncCallback).onFailure(any(IllegalStateException.class)); }