use of org.eclipse.linuxtools.internal.perf.model.TreeParent in project linuxtools by eclipse.
the class ModelTest method testModelDefaultGenericStructure.
@Test
public void testModelDefaultGenericStructure() {
TreeParent invisibleRoot = buildModel("resources/defaultevent-data/perf.data", "resources/defaultevent-data/perf.data.txt", "resources/defaultevent-data/perf.data.err.log");
checkChildrenStructure(invisibleRoot, stack);
}
use of org.eclipse.linuxtools.internal.perf.model.TreeParent in project linuxtools by eclipse.
the class ModelTest method checkChildrenStructure.
/**
* @param root some element that will serve as the root
* @param stack a stack of classes
*/
private void checkChildrenStructure(TreeParent root, Stack<Class<?>> stack) {
if (!stack.isEmpty()) {
// children of root must be instances of the top class on the stack
Class<?> klass = stack.pop();
for (TreeParent tp : root.getChildren()) {
// tp.getClass() instanceof klass
assertTrue(klass.isAssignableFrom(tp.getClass()));
// each sibling needs its own stack
Stack<Class<?>> newStack = new Stack<>();
newStack.addAll(stack);
checkChildrenStructure(tp, newStack);
}
}
}
use of org.eclipse.linuxtools.internal.perf.model.TreeParent in project linuxtools by eclipse.
the class ModelTest method testModelMultiEventGenericStructure.
@Test
public void testModelMultiEventGenericStructure() {
TreeParent invisibleRoot = buildModel("resources/multievent-data/perf.data", "resources/multievent-data/perf.data.txt", "resources/multievent-data/perf.data.err.log");
checkChildrenStructure(invisibleRoot, stack);
}
use of org.eclipse.linuxtools.internal.perf.model.TreeParent in project linuxtools by eclipse.
the class ModelTest method checkCommadLabels.
/**
* Check whether the command labels in model rooted at cmd exist in
* list of labels cmdLabels.
* @param cmdLabels list of command labels
* @param cmd root of tree model
*/
private void checkCommadLabels(String[] cmdLabels, TreeParent cmd) {
List<String> cmdList = new ArrayList<>(Arrays.asList(cmdLabels));
for (TreeParent dso : cmd.getChildren()) {
assertTrue(cmdList.get(0).equals(dso.getName()));
cmdList.remove(0);
}
}
Aggregations