public void notifyTestStart(ObjectReader reader) {
   final TestProxy testProxy = reader.readObject();
   final JUnitRunningModel model = getModel();
   if (model != null && testProxy.getParent() == null && model.getRoot() != testProxy) {
     getDynamicParent(model, testProxy).addChild(testProxy);
   }
 }
 public void notifyFinish(ObjectReader reader) {
   myIsTerminated = true;
   synchronized (myCurrentTests) {
     myCurrentTests.clear();
   }
   final JUnitRunningModel model = getModel();
   if (model != null) {
     model.getNotifier().fireRunnerStateChanged(new CompletionEvent(true, reader.readInt()));
     TestStatusListener.notifySuiteFinished(model.getRoot(), model.getProject());
     terminateStillRunning(model);
   }
 }
 public void checkTerminated() {
   if (isRunning()) {
     final JUnitRunningModel model = getModel();
     if (model != null) {
       final JUnitListenersNotifier notifier = model.getNotifier();
       if (notifier != null) {
         notifier.fireRunnerStateChanged(new CompletionEvent(false, -1));
         terminateStillRunning(model);
       }
     }
     setTerminated(true);
   }
 }
 private void terminateStillRunning(@NotNull JUnitRunningModel model) {
   if (model.getRoot() != null) {
     final List<AbstractTestProxy> runningTests =
         TestStateUpdater.RUNNING_LEAF.select(myModel.getRoot().getAllTests());
     for (final AbstractTestProxy runningTest : runningTests) {
       final TestProxy testProxy = (TestProxy) runningTest;
       final TestState terminated = NotFailedState.createTerminated();
       testProxy.setState(terminated);
       TestProxy parent = testProxy.getParent();
       while (parent != null) {
         parent.setState(terminated);
         parent = parent.getParent();
       }
     }
   }
 }
  private TestProxy getDynamicParent(JUnitRunningModel model, final TestProxy currentTest) {
    if (myKnownDynamicParents == null) {
      myKnownDynamicParents = new HashMap<String, TestProxy>();
    }
    final String parentClass = currentTest.getInfo().getComment();
    TestProxy dynamicParent = myKnownDynamicParents.get(parentClass);
    if (dynamicParent == null) {
      final TestProxy root = model.getRoot();
      if (Comparing.strEqual(
          parentClass, StringUtil.getQualifiedName(root.getInfo().getComment(), root.getName()))) {
        dynamicParent = root;
      } else {
        dynamicParent =
            new TestProxy(
                new ClassBasedInfo(DisplayTestInfoExtractor.FOR_CLASS) {
                  {
                    setClassName(parentClass);
                  }

                  @Override
                  public void readFrom(ObjectReader reader) {}
                });
        root.addChild(dynamicParent);
      }
      myKnownDynamicParents.put(parentClass, dynamicParent);
    }
    return dynamicParent;
  }
Exemplo n.º 6
0
 protected void notifyByBalloon(
     JUnitRunningModel model, boolean started, JUnitConsoleProperties consoleProperties) {
   TestsUIUtil.notifyByBalloon(
       myProject, started, model != null ? model.getRoot() : null, consoleProperties);
 }