Ejemplo n.º 1
0
 @Override
 public final void setWebResource(final WebResource webResource) {
   this.webResource = webResource;
   if (webResource instanceof Site) {
     this.audit = webResource.getAudit();
   } else if (webResource instanceof Page) {
     if (webResource.getAudit() != null) {
       this.audit = webResource.getAudit();
     } else if (webResource.getParent() != null) {
       this.audit = webResource.getParent().getAudit();
     }
   }
 }
Ejemplo n.º 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;
  }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
  }
Ejemplo n.º 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;
 }