Search in sources :

Example 16 with TreeNode

use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.

the class TreeNodeTest method setUp.

@Before
public void setUp() {
    data = new StringBuilder("Object");
    data2 = "Data";
    s = "String";
    t = new TreeNode(data, s, false);
    child = new TreeNode(data2, true);
    child2 = new TreeNode(data, s, false);
    t.add(child);
    t.add(child2);
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode) Before(org.junit.Before)

Example 17 with TreeNode

use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.

the class TreeNodeTest method testSortTree.

@Test
public void testSortTree() {
    TreeNode child1 = new TreeNode("2", false);
    t.add(child1);
    TreeNode child2 = new TreeNode("1", false);
    t.add(child2);
    TreeNode child3 = new TreeNode("3", false);
    t.add(child3);
    t.sortTree();
    assertEquals("Same number of children", 5, t.getChildCount());
    assertEquals("Sorted first node correct", child2, t.getChildAt(0));
    assertEquals("Sorted last node correct", child, t.getChildAt(3));
    assertEquals("Sorted middle correct", child1, t.getChildAt(1));
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode) Test(org.junit.Test)

Example 18 with TreeNode

use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.

the class TreeNodeTest method testRemoveAll.

@Test
public void testRemoveAll() {
    t.add(new TreeNode("Child", false));
    assertTrue(t.removeAll());
    assertEquals("No children", 0, t.getChildCount());
    assertTrue(t.removeAll());
    assertEquals("Still no children", 0, t.getChildCount());
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode) Test(org.junit.Test)

Example 19 with TreeNode

use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.

the class TreeNodeTest method testSortLevel.

@Test
public void testSortLevel() {
    TreeNode child1 = new TreeNode("2", false);
    t.add(child1);
    TreeNode child2 = new TreeNode("1", false);
    t.add(child2);
    TreeNode child3 = new TreeNode("3", false);
    t.add(child3);
    t.sortLevel();
    assertEquals("Same number of children", 5, t.getChildCount());
    assertEquals("Sorted first node correct", child2, t.getChildAt(0));
    assertEquals("Sorted last node correct", child, t.getChildAt(3));
    assertEquals("Sorted middle correct", child1, t.getChildAt(1));
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode) Test(org.junit.Test)

Example 20 with TreeNode

use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.

the class TreeSettingsTest method testGetTreeFileDate.

@Test
public void testGetTreeFileDate() {
    long d1 = TreeSettings.getTreeFileDate();
    long d2 = TreeSettings.getTreeFileDate();
    assertEquals("TreeDate same", d1, d2);
    TreeSettings.setTrees(new TreeNode("f", false), new TreeNode("p", false));
    d2 = TreeSettings.getTreeFileDate();
    assertTrue("TreeDate changed", d1 < d2);
}
Also used : TreeNode(org.eclipse.linuxtools.systemtap.structures.TreeNode) Test(org.junit.Test)

Aggregations

TreeNode (org.eclipse.linuxtools.systemtap.structures.TreeNode)34 Test (org.junit.Test)15 TreeDefinitionNode (org.eclipse.linuxtools.systemtap.structures.TreeDefinitionNode)4 Scanner (java.util.Scanner)3 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)3 ProbevarNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ProbevarNodeData)3 ArrayList (java.util.ArrayList)2 IFileStore (org.eclipse.core.filesystem.IFileStore)2 FuncparamNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.FuncparamNodeData)2 FunctionNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.FunctionNodeData)2 ProbeNodeData (org.eclipse.linuxtools.internal.systemtap.ui.ide.structures.nodedata.ProbeNodeData)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 StringTokenizer (java.util.StringTokenizer)1 Matcher (java.util.regex.Matcher)1 IStatus (org.eclipse.core.runtime.IStatus)1