Esempio n. 1
0
 public MPSTreeNode rebuild() {
   MPSTreeNode root = new TextTreeNode("Tests");
   this.setRootVisible(false);
   TestNameMap<TestCaseTreeNode, TestMethodTreeNode> temp =
       new TestNameMap<TestCaseTreeNode, TestMethodTreeNode>();
   for (ITestNodeWrapper testCase :
       SetSequence.fromSet(MapSequence.fromMap(this.myState.getTestsMap()).keySet())) {
     if (testCase == null) {
       continue;
     }
     TestCaseTreeNode testCaseTreeNode = this.myMap.get(testCase.getFqName());
     if (testCaseTreeNode == null) {
       testCaseTreeNode = new TestCaseTreeNode(this.myOperationContext, testCase);
     }
     testCaseTreeNode.removeAllChildren();
     boolean hasFailedTest = false;
     for (ITestNodeWrapper method :
         ListSequence.fromList(MapSequence.fromMap(this.myState.getTestsMap()).get(testCase))) {
       TestMethodTreeNode oldMethodTreeNode =
           this.myMap.get(testCase.getFqName(), method.getName());
       TestMethodTreeNode newMethodTreeNode =
           new TestMethodTreeNode(this.myOperationContext, method);
       TestMethodTreeNode methodTreeNode =
           (oldMethodTreeNode == null ? newMethodTreeNode : oldMethodTreeNode);
       boolean isFailedMethod = isFailed(methodTreeNode);
       hasFailedTest = hasFailedTest || isFailedMethod;
       if (this.isAllTree || isFailedMethod) {
         if (methodTreeNode == null) {
           continue;
         }
         testCaseTreeNode.add(methodTreeNode);
         temp.put(testCase, method, methodTreeNode);
       } else {
         temp.put(testCase, method, methodTreeNode);
       }
     }
     if (this.isAllTree || hasFailedTest) {
       root.add(testCaseTreeNode);
       temp.put(testCase, testCaseTreeNode);
     } else {
       temp.put(testCase, testCaseTreeNode);
     }
   }
   this.myMap = temp;
   return root;
 }
Esempio n. 2
0
 private void updateState(
     TestMethodTreeNode methodNode, TestCaseTreeNode testCaseNode, TestState testState) {
   methodNode.setState(testState);
   List<TestState> priorityList =
       Arrays.asList(
           TestState.IN_PROGRESS,
           TestState.PASSED,
           TestState.FAILED,
           TestState.ERROR,
           TestState.TERMINATED);
   TestState oldState = testCaseNode.getState();
   if (ListSequence.fromList(priorityList).indexOf(oldState)
       < ListSequence.fromList(priorityList).indexOf(testState)) {
     if (TestState.PASSED.equals(testState)) {
       for (MPSTreeNode method : testCaseNode) {
         if (!(TestState.PASSED.equals(((TestMethodTreeNode) method).getState()))) {
           return;
         }
       }
     }
     testCaseNode.setState(testState);
   }
 }