Ejemplo n.º 1
0
 /**
  * @param testSolution
  * @param criterion
  * @param wrs
  */
 private void addResultToThemeCounterMap(
     TestSolution testSolution, Theme theme, WebResourceStatistics wrs) {
   if (tsMap == null) {
     tsMap = new HashMap<Theme, ThemeStatistics>();
   }
   if (tsMap.containsKey(theme)) {
     ThemeStatistics ts = tsMap.get(theme);
     incrementThemeCounterFromTestSolution(ts, testSolution);
   } else {
     ThemeStatistics ts = themeStatisticsDataService.create();
     ts.setTheme(theme);
     incrementThemeCounterFromTestSolution(ts, testSolution);
     tsMap.put(theme, ts);
   }
 }
Ejemplo n.º 2
0
  /**
   * @param wrStatistics
   * @return
   */
  private WebResourceStatistics computeThemeStatisticsFromDb(WebResourceStatistics wrStatistics) {
    for (Theme theme : themeMap.keySet()) {
      ThemeStatistics themeStatistics = themeStatisticsDataService.create();
      themeStatistics.setTheme(theme);

      int nbOfFailed =
          themeStatisticsDataService
              .getResultCountByResultTypeAndTheme(webResource, TestSolution.FAILED, theme)
              .intValue();
      themeStatistics.setNbOfFailed(nbOfFailed);

      int nbOfPassed =
          themeStatisticsDataService
              .getResultCountByResultTypeAndTheme(webResource, TestSolution.PASSED, theme)
              .intValue();
      themeStatistics.setNbOfPassed(nbOfPassed);

      int nbOfNa =
          themeStatisticsDataService
              .getResultCountByResultTypeAndTheme(webResource, TestSolution.NOT_APPLICABLE, theme)
              .intValue();
      themeStatistics.setNbOfNa(nbOfNa);

      int nbOfNmi =
          themeStatisticsDataService
              .getResultCountByResultTypeAndTheme(webResource, TestSolution.NEED_MORE_INFO, theme)
              .intValue();
      nbOfNmi +=
          themeStatisticsDataService
              .getResultCountByResultTypeAndTheme(webResource, TestSolution.SUSPECTED_FAILED, theme)
              .intValue();
      nbOfNmi +=
          themeStatisticsDataService
              .getResultCountByResultTypeAndTheme(webResource, TestSolution.SUSPECTED_PASSED, theme)
              .intValue();
      themeStatistics.setNbOfNmi(nbOfNmi);

      int themeTestListSize = themeMap.get(theme);

      themeStatistics.setNbOfNotTested(
          themeTestListSize * nbOfWr - nbOfFailed - nbOfNa - nbOfNmi - nbOfPassed);

      wrStatistics.addThemeStatistics(themeStatistics);
    }
    return wrStatistics;
  }