コード例 #1
0
  /** Returns true if this VM has acquired the right to run this TestTask */
  private static DUnitRun getDUnitRun() {
    if (dunitRun != null) {
      System.out.println("BBB dunitRun not null returning");
      return dunitRun;
    }

    try {
      SwarmBB.getBB().getSharedLock().lock();
      Integer runId = (Integer) SwarmBB.getBB().getSharedMap().get(SwarmBB.RUN_ID);
      System.out.println("BBB runID=" + runId);
      if (runId != null) {
        dunitRun = Swarm.getDUnitRun(runId);
        System.out.println("BBB lookedUp RUN:" + dunitRun);
      } else {
        dunitRun = Swarm.generateNewDUnitRun();
        System.out.println(
            "BBB GENNED UP A RUN:" + dunitRun + " mapping to id:" + dunitRun.getId());
        SwarmBB.getBB().getSharedMap().put(SwarmBB.RUN_ID, dunitRun.getId());
      }
    } catch (SQLException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      SwarmBB.getBB().getSharedLock().unlock();
    }
    return dunitRun;
  }
コード例 #2
0
 public void recordFail(String className, String methodName, long tookMs) {
   try {
     DUnitRun du = getDUnitRun();
     DUnitClassInfo duci = Swarm.getOrCreateDUnitClassInfo(className);
     DUnitMethodInfo dumi = Swarm.getOrCreateDUnitMethodInfo(methodName, duci.getId());
     Swarm.recordFailure(du, dumi, lastThrowable, tookMs);
   } catch (SQLException se) {
     se.printStackTrace();
   }
 }