/** * @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; }
/** * @param ts * @param testSolution */ private void incrementThemeCounterFromTestSolution( ThemeStatistics ts, TestSolution testSolution) { switch (testSolution) { case PASSED: ts.setNbOfPassed(ts.getNbOfPassed() + 1); break; case FAILED: ts.setNbOfFailed(ts.getNbOfFailed() + 1); break; case NOT_APPLICABLE: ts.setNbOfNa(ts.getNbOfNa() + 1); break; case NEED_MORE_INFO: case DETECTED: case SUSPECTED_FAILED: case SUSPECTED_PASSED: ts.setNbOfNmi(ts.getNbOfNmi() + 1); break; case NOT_TESTED: ts.setNbOfNotTested(ts.getNbOfNotTested() + 1); break; } }