コード例 #1
0
ファイル: AnalyserImpl.java プロジェクト: neyo2010/Tanaguru
  /**
   * @param wrStatistics
   * @return
   */
  private WebResourceStatistics computeCriterionStatisticsFromDb(
      WebResourceStatistics wrStatistics) {
    for (Criterion cr : criterionMap.keySet()) {
      CriterionStatistics criterionStatistics = criterionStatisticsDataService.create();
      criterionStatistics.setCriterion(cr);
      int nbOfFailed =
          criterionStatisticsDataService
              .getResultCountByResultTypeAndCriterion(webResource, TestSolution.FAILED, cr)
              .intValue();
      criterionStatistics.setNbOfFailed(nbOfFailed);

      int nbOfNa =
          criterionStatisticsDataService
              .getResultCountByResultTypeAndCriterion(webResource, TestSolution.NOT_APPLICABLE, cr)
              .intValue();
      criterionStatistics.setNbOfNa(nbOfNa);

      int nbOfPassed =
          criterionStatisticsDataService
              .getResultCountByResultTypeAndCriterion(webResource, TestSolution.PASSED, cr)
              .intValue();
      criterionStatistics.setNbOfPassed(nbOfPassed);

      int nbOfNmi =
          criterionStatisticsDataService
              .getResultCountByResultTypeAndCriterion(webResource, TestSolution.NEED_MORE_INFO, cr)
              .intValue();
      nbOfNmi +=
          criterionStatisticsDataService
              .getResultCountByResultTypeAndCriterion(
                  webResource, TestSolution.SUSPECTED_FAILED, cr)
              .intValue();
      nbOfNmi +=
          criterionStatisticsDataService
              .getResultCountByResultTypeAndCriterion(
                  webResource, TestSolution.SUSPECTED_PASSED, cr)
              .intValue();
      nbOfNmi +=
          criterionStatisticsDataService
              .getResultCountByResultTypeAndCriterion(webResource, TestSolution.DETECTED, cr)
              .intValue();
      criterionStatistics.setNbOfNmi(nbOfNmi);

      int criterionTestListSize = criterionMap.get(cr);
      criterionStatistics.setNbOfNotTested(
          criterionTestListSize * nbOfWr - nbOfFailed - nbOfNa - nbOfNmi - nbOfPassed);
      computeCriterionResult(criterionStatistics);
      wrStatistics.addCriterionStatistics(criterionStatistics);
    }
    return wrStatistics;
  }
コード例 #2
0
ファイル: AnalyserImpl.java プロジェクト: neyo2010/Tanaguru
 /**
  * @param testSolution
  * @param criterion
  * @param wrs
  */
 private void addResultToCriterionCounterMap(
     TestSolution testSolution, Criterion criterion, WebResourceStatistics wrs) {
   if (csMap == null) {
     csMap = new HashMap<Criterion, CriterionStatistics>();
   }
   if (csMap.containsKey(criterion)) {
     CriterionStatistics cs = csMap.get(criterion);
     incrementCriterionCounterFromTestSolution(cs, testSolution);
   } else {
     CriterionStatistics cs = criterionStatisticsDataService.create();
     cs.setCriterion(criterion);
     incrementCriterionCounterFromTestSolution(cs, testSolution);
     csMap.put(criterion, cs);
   }
 }