예제 #1
0
  @Override
  public void run() {
    WebResourceStatistics wrStats = webResourceStatisticsDataService.create();

    // Regardind the webResource type the computation of the statitics is
    // done in memory or through the db
    if (webResource instanceof Page) {
      extractTestSet(false);
      netResultList =
          getProcessResultWithNotTested(
              testSet,
              processResultDataService.getNetResultFromAuditAndWebResource(audit, webResource));
      wrStats = computeAuditStatisticsFromPrList(wrStats);
      wrStats = computeHttpStatusCode(wrStats);
    } else if (webResource instanceof Site) {
      extractTestSet(true);
      wrStats = computeAuditStatisticsFromDb(wrStats);
      wrStats = computeCriterionStatisticsFromDb(wrStats);
      wrStats = computeTestStatisticsFromDb(wrStats);
      wrStats = computeThemeStatisticsFromDb(wrStats);
    }
    wrStats = computeMark(wrStats);
    wrStats = computeRawMark(wrStats);
    wrStats = computeNumberOfFailedOccurrences(wrStats);

    wrStats.setAudit(audit);
    wrStats.setWebResource(webResource);

    webResourceStatisticsDataService.saveOrUpdate(wrStats);
  }
예제 #2
0
  /**
   * Gather the audit statistics informations : - Number of passed results - Number of failed
   * results - Number of need_more_information results - Number of not applicable results - Number
   * of failed tests
   *
   * @param wrStatistics
   * @return
   */
  private WebResourceStatistics computeAuditStatisticsFromDb(WebResourceStatistics wrStatistics) {
    int nbOfPassed =
        webResourceStatisticsDataService
            .getResultCountByResultType(webResource.getId(), TestSolution.PASSED)
            .intValue();

    int nbOfFailed =
        webResourceStatisticsDataService
            .getResultCountByResultType(webResource.getId(), TestSolution.FAILED)
            .intValue();

    int nbOfNmi =
        webResourceStatisticsDataService
            .getResultCountByResultType(webResource.getId(), TestSolution.NEED_MORE_INFO)
            .intValue();

    int nbOfNa =
        webResourceStatisticsDataService
            .getResultCountByResultType(webResource.getId(), TestSolution.NOT_APPLICABLE)
            .intValue();

    int nbOfDetected =
        webResourceStatisticsDataService
            .getResultCountByResultType(webResource.getId(), TestSolution.DETECTED)
            .intValue();

    int nbOfSuspected =
        webResourceStatisticsDataService
                .getResultCountByResultType(webResource.getId(), TestSolution.SUSPECTED_FAILED)
                .intValue()
            + webResourceStatisticsDataService
                .getResultCountByResultType(webResource.getId(), TestSolution.SUSPECTED_PASSED)
                .intValue();

    // if no test have been processed for any reason, mostly cause the source
    // code couldn't have been adapted, all theses values are set to -1
    if (nbOfFailed + nbOfNa + nbOfNmi + nbOfPassed + nbOfDetected + nbOfSuspected == 0) {
      nbOfFailed = nbOfNa = nbOfNmi = nbOfPassed = nbOfSuspected = nbOfDetected = -1;
    }

    wrStatistics.setNbOfFailed(nbOfFailed);
    wrStatistics.setNbOfInvalidTest(nbOfFailed);
    wrStatistics.setNbOfPassed(nbOfPassed);
    wrStatistics.setNbOfNmi(nbOfNmi);
    wrStatistics.setNbOfNa(nbOfNa);
    wrStatistics.setNbOfDetected(nbOfDetected);
    wrStatistics.setNbOfSuspected(nbOfSuspected);
    wrStatistics.setNbOfNotTested(
        testSet.size() * nbOfWr
            - nbOfDetected
            - nbOfSuspected
            - nbOfFailed
            - nbOfNa
            - nbOfNmi
            - nbOfPassed);

    setWeightedResult(wrStatistics);
    wrStatistics.setAudit(audit);
    return wrStatistics;
  }
예제 #3
0
 /**
  * Gather the number of failed occurrence for a given web resource.
  *
  * @param wrStatistics
  * @return
  */
 private WebResourceStatistics computeNumberOfFailedOccurrences(
     WebResourceStatistics wrStatistics) {
   int nbOfFailedOccurences =
       webResourceStatisticsDataService
           .getNumberOfOccurrencesByWebResourceAndResultType(
               webResource.getId(), TestSolution.FAILED)
           .intValue();
   wrStatistics.setNbOfFailedOccurences(nbOfFailedOccurences);
   return wrStatistics;
 }
예제 #4
0
  /** @param wrStatistics */
  private void setWeightedResult(WebResourceStatistics wrStatistics) {
    BigDecimal weightedPassed =
        webResourceStatisticsDataService.getWeightedResultByResultType(
            webResource.getId(), paramSet, TestSolution.PASSED);

    BigDecimal weightedFailed =
        webResourceStatisticsDataService.getWeightedResultByResultType(
            webResource.getId(), paramSet, TestSolution.FAILED);

    BigDecimal weightedNa =
        webResourceStatisticsDataService.getWeightedResultByResultType(
            webResource.getId(), paramSet, TestSolution.NOT_APPLICABLE);

    BigDecimal weightedNmi =
        webResourceStatisticsDataService.getWeightedResultByResultType(
            webResource.getId(), paramSet, TestSolution.NEED_MORE_INFO);
    wrStatistics.setWeightedFailed(weightedFailed);
    wrStatistics.setWeightedPassed(weightedPassed);
    wrStatistics.setWeightedNmi(weightedNmi);
    wrStatistics.setWeightedNa(weightedNa);
  }
예제 #5
0
 /**
  * Gather the Http status code for a given web resource.
  *
  * @param wrStatistics
  * @return
  */
 private WebResourceStatistics computeHttpStatusCode(WebResourceStatistics wrStatistics) {
   wrStatistics.setHttpStatusCode(
       webResourceStatisticsDataService.getHttpStatusCodeByWebResource(webResource.getId()));
   return wrStatistics;
 }