private void addNodeToHelpSys(TreeNode<HelpSet> helpSetNode) { if (helpSetNode.getContent() != null) { HelpSys.add(helpSetNode.getContent()); } TreeNode<HelpSet>[] children = helpSetNode.getChildren(); for (TreeNode<HelpSet> child : children) { addNodeToHelpSys(child); } }
public void testProxy() { TreeNode<String> n = new TreeNode<String>("x"); Assert.assertEquals("x", n.getId()); Assert.assertEquals(null, n.getParent()); Assert.assertEquals(null, n.getContent()); assertNotNull(n.getChildren()); Assert.assertEquals(0, n.getChildren().length); }
public void testGetProductComponents_inputString() throws IOException { URL location = AbstractProductReaderTest.class.getProtectionDomain().getCodeSource().getLocation(); reader.readProductNodes(location.getFile(), null); File file = new File(location.getFile()); TreeNode<File> productComponents = reader.getProductComponents(); assertNotNull(productComponents); File parent = file.getParentFile(); assertEquals(parent.getName(), productComponents.getId()); assertEquals(parent, productComponents.getContent()); TreeNode<File>[] treeNodes = productComponents.getChildren(); assertEquals(1, treeNodes.length); assertEquals(file.getName(), treeNodes[0].getId()); assertEquals(file, treeNodes[0].getContent()); }
public void testGetProductComponents_inputFile() throws IOException { URL location = AbstractProductReaderTest.class.getProtectionDomain().getCodeSource().getLocation(); File file = new File(location.getFile()); reader.readProductNodes(file, null); TreeNode<File> productComponents = reader.getProductComponents(); assertNotNull(productComponents); File parent = file.getParentFile(); assertEquals(parent.getName(), productComponents.getId()); assertEquals(parent, productComponents.getContent()); TreeNode<File>[] treeNodes = productComponents.getChildren(); assertEquals(1, treeNodes.length); assertEquals(file.getName(), treeNodes[0].getId()); assertEquals(file, treeNodes[0].getContent()); }
public void testGetChildren() { TreeNode<String> root = new TreeNode<String>(""); TreeNode<String>[] children = root.getChildren(); assertNotNull(children); assertEquals(0, children.length); root.createChild("foo/bar"); root.createChild("foo/baz"); root.createChild("foo/boo"); children = root.getChildren(); assertNotNull(children); assertEquals(1, children.length); children = root.getChild("foo").getChildren(); assertNotNull(children); assertEquals(3, children.length); }