static class GUIRunner.HierarchyWrapper extends Object implements GUIRunner.Selector, TreeSelectionListener
hierarchyTree possibly with a single selected node
given by singleSelectedNode.| Modifier and Type | Field and Description |
|---|---|
private Actions |
actions
This is used only by
valueChanged(TreeSelectionEvent)
to set the filter via
Actions.setFilter(Description). |
private GUIRunner.TreePathIterator |
currPathIter
Represents the path to the testcase currently run.
|
private JTree |
hierarchyTree
The hierarchy of testsuites and testcases as a tree.
|
private GUIRunner.Selector |
selector
Selector to be influenced:
If this is in the selected tab,
selector
is the tab with the TestCaseLister;
otherwise it is GUIRunner.TabChangeListener.EMPTY_SELECTOR. |
private DefaultMutableTreeNode |
singleSelectedNode
Represents the selected node in
hierarchyTree. |
private GUIRunner.TestCaseLister |
testCaseLister
The the
GUIRunner.TestCaseLister
listing the failed test cases. |
private TreeSelectionModel |
treeSelection
The selection model for
hierarchyTree. |
| Constructor and Description |
|---|
HierarchyWrapper(Actions actions,
GUIRunner.TestCaseLister testCaseLister)
Creates a new HierarchyWrapper
with the given
actions and testCaseLister
which are used
to initialize actions and testCaseLister. |
| Modifier and Type | Method and Description |
|---|---|
void |
clearSelection()
Clears the selection.
|
(package private) void |
collapseAlongPath()
Collapses the path to the leaf
currPathIter points to
as much as possible in order not to hide singleSelectedNode
and the leafs corresponding with singular tests
which failed already (assumption failure, failure and error). |
(package private) void |
expandAlongPath()
Expands the path to the leaf
currPathIter points to. |
(package private) Actions |
getActions()
Returns the action.
|
(package private) TreePath |
getPath() |
(package private) TestCase |
getRoot() |
(package private) JTree |
getTree() |
(package private) void |
initClassStructure(TestCase testCase)
Notifies that the structure of the test class may have been updated.
|
private boolean |
isSelected(TestCase testCase)
Returns whether the given testcase
testCase
is selected in this HierarchyTree. |
(package private) void |
noteReportResult(TestCase testCase)
Notifies that the singular test
testCase is finished. |
(package private) TestCase |
noteTestStartedI(Quality qual)
Notifies that an atomic test is started or ignored.
|
void |
registerSelector(GUIRunner.Selector selector)
Acquaints this selector with another one
which is notified of the selection events
of this
Selector. |
private void |
setFilter()
Sets the filter (given by a description)
invoking
Actions.setFilter(Description):
The description is taken from singleSelectedNode. |
void |
setSelection(int index)
Sets selection of
indexth item
and clears other selections. |
(package private) void |
startTestRun(Description desc)
Notifies that a test run with structure given by
desc
is going to be run next. |
private static DefaultMutableTreeNode |
testCase2treeNode(TestCase testCase)
Converts the (tree of) testcases given by
testCase |
void |
valueChanged(TreeSelectionEvent selEvent)
Called whenever the value of the selection changes.
|
private final JTree hierarchyTree
initClassStructure(TestCase)
the hierarchy reflects the given testcase.
The selection model is given by treeSelection
and this is the TreeSelectionListener.private final TreeSelectionModel treeSelection
hierarchyTree.
At most one entry is selected.
If the entry represents a failure, the according element in
GUIRunner.TestCaseLister.failureSelection is selected also.valueChanged(TreeSelectionEvent)private final Actions actions
valueChanged(TreeSelectionEvent)
to set the filter via
Actions.setFilter(Description).private final GUIRunner.TestCaseLister testCaseLister
GUIRunner.TestCaseLister
listing the failed test cases.
This is used in noteReportResult(TestCase) only
and is to notify that a certain tescase failed
and is selected.private DefaultMutableTreeNode singleSelectedNode
hierarchyTree.
This is null if nothing selected
which is also the initial value.
This is set by valueChanged(TreeSelectionEvent)
and updated also by initClassStructure(TestCase).private GUIRunner.TreePathIterator currPathIter
null after this is created
and is initialized by startTestRun(Description).private GUIRunner.Selector selector
selector
is the tab with the TestCaseLister;
otherwise it is GUIRunner.TabChangeListener.EMPTY_SELECTOR.
Set by registerSelector(GUIRunner.Selector).HierarchyWrapper(Actions actions, GUIRunner.TestCaseLister testCaseLister)
actions and testCaseLister
which are used
to initialize actions and testCaseLister.actions - the Actions to be written into actions.testCaseLister - TestCaseLister to be written into testCaseLister.private static DefaultMutableTreeNode testCase2treeNode(TestCase testCase)
testCase.
****TestCase getRoot()
Actions getActions()
void initClassStructure(TestCase testCase)
Converts the overall test case hierarchy testCase
into a a tree node hierarchy
invoking testCase2treeNode(TestCase).
This defines the tree model of the hierarchy hierarchyTree.
The selected node singleSelectedNode is set to the root.
Since currPathIter points to the first testcase run,
it is set to null.
Finally, actions is notified about the test to be run next
which is specified by the testcase given by the selected node.
by invoking setFilter().
testCase - a description of the test structure defined in the test class
which is a hierarchy of suites and singular tests.private void setFilter()
Actions.setFilter(Description):
The description is taken from singleSelectedNode.void startTestRun(Description desc)
desc
is going to be run next.
Sets the quality of the testcases
given by singleSelectedNode
recursively to Quality.Scheduled
and sets currPathIter.
desc - describes the (hierarchy of) tests to be run.
This is a sub-hierarchy of the one given by the test class.
This parameter is purely formally
because it is given by singleSelectedNode.void expandAlongPath()
currPathIter points to.
This is invoked by noteTestStartedI(Quality)
when a testcase is started or ignored.collapseAlongPath()void collapseAlongPath()
currPathIter points to
as much as possible in order not to hide singleSelectedNode
and the leafs corresponding with singular tests
which failed already (assumption failure, failure and error).
This is invoked by noteReportResult(TestCase)
when a testcase is finished or after being ignored.expandAlongPath()JTree getTree()
TreePath getPath()
TestCase noteTestStartedI(Quality qual)
To Updates currPathIter pointing to the current testcase
and expands along the path given by the current testcase.
Then sets the quality of the according testcase
to qual and updates the according tree node.
qual - the quality of the testcase:
This is Quality.Started or Quality.Ignored.void noteReportResult(TestCase testCase)
testCase is finished.
Collapses the current path invoking collapseAlongPath(),
updates the tree node currPathIter points to
and notifies testCaseLister
if testCase failed and is selected invoking
GUIRunner.TestCaseLister.addSelectedTestCaseByNeed(TestCase).
testCase - The testcase comprising the result of the singular test finished.private boolean isSelected(TestCase testCase)
testCase
is selected in this HierarchyTree.testCase
is selected in this HierarchyTree.public void setSelection(int index)
GUIRunner.Selectorindexth item
and clears other selections.setSelection in interface GUIRunner.Selectorindex - a non-negative int value
representing the index of a testcase.
**** CAUTION: This presupposes that in a tree
only the leaves can be selected.public void clearSelection()
GUIRunner.SelectorclearSelection in interface GUIRunner.Selectorpublic void registerSelector(GUIRunner.Selector selector)
GUIRunner.SelectorSelector.
The one in the foreground is notified directly by a mouse event,
whereas the one in the background is selected via registration.
The one in the background in turn
notifies the empty selector
GUIRunner.TabChangeListener.EMPTY_SELECTOR
which takes no actions.registerSelector in interface GUIRunner.Selectorselector - another Selector.GUIRunner.TabChangeListener.setSelUnSel(int)public void valueChanged(TreeSelectionEvent selEvent)
If an entry is selected,
singleSelectedNode holds the selected node.
Next selector is notified of the selection:
GUIRunner.TestCaseLister.valueChanged(ListSelectionEvent).
Finally, invokes setFilter()
setting the filter for the next test run.
valueChanged in interface TreeSelectionListenerCopyright © 2012–2018 Simuline Organization (l2r). All rights reserved.