Package ch.hortis.sonar.model

Examples of ch.hortis.sonar.model.FileMeasure


  }

  private void purgeFileMeasures( Snapshot snapshot ) {
    List<FileMeasure> fileMeasures = snapshot.getFileMeasures();
    for ( Iterator<FileMeasure> iter = fileMeasures.iterator(); iter.hasNext(); ) {
      FileMeasure fileMeasure = iter.next();
      deleteParameters(fileMeasure.getParameters());
      if ( LOG.isDebugEnabled() ) LOG.debug( "Removing FileMeasure " + fileMeasure.getId() );
      getEntityManager().remove( fileMeasure );
      iter.remove();
    }
  }
View Full Code Here


    MetricMeasure measure;
    Double roundedValue = roundUp(value);
    if (key.getFile()==null) {
      measure = new ProjectMeasure(snapshot, key.getMetric(), roundedValue);
    } else {
      measure = new FileMeasure(snapshot, key.getMetric(), roundedValue, key.getFile());
    }
    createMeasure( measure, key );
  }
View Full Code Here

  }

  private void purgeFileMeasures(Snapshot snapshot) {
    List<FileMeasure> fileMeasures = snapshot.getFileMeasures();
    for (Iterator<FileMeasure> iter = fileMeasures.iterator(); iter.hasNext();) {
      FileMeasure fileMeasure = iter.next();
      deleteParameters(fileMeasure.getParameters());
      getEntityManager().remove(fileMeasure);
      iter.remove();
    }
  }
View Full Code Here

    MetricMeasure measure;
    Double roundedValue = roundUp(value);
    if (key.getFile() == null) {
      measure = new ProjectMeasure(snapshot, key.getMetric(), roundedValue);
    } else {
      measure = new FileMeasure(snapshot, key.getMetric(), roundedValue, key.getFile());
    }
    createMeasure(measure, key);
  }
View Full Code Here

  }

  private void purgeFileMeasures(Snapshot snapshot) {
    List<FileMeasure> fileMeasures = snapshot.getFileMeasures();
    for (Iterator<FileMeasure> iter = fileMeasures.iterator(); iter.hasNext();) {
      FileMeasure fileMeasure = iter.next();
      deleteParameters(fileMeasure.getParameters());
      getEntityManager().remove(fileMeasure);
      iter.remove();
    }
  }
View Full Code Here

    MetricMeasure measure;
    Double roundedValue = roundUp(value);
    if (key.getFile() == null) {
      measure = new ProjectMeasure(snapshot, key.getMetric(), roundedValue, null, null, key.getSubkey());
    } else {
      measure = new FileMeasure(snapshot, key.getMetric(), roundedValue, key.getFile());
    }
    createMeasure(measure, key);
  }
View Full Code Here

    private double time;
    private double failures;
   
    private List<FileMeasure> asFileMeasures() {
      List<FileMeasure> measures = new ArrayList<FileMeasure>();
      FileMeasure measure = new FileMeasure();
      measure.setFile(file);
      measure.setMetric( loadMetric( Metrics.SUREFIRE_ERRORS ) );
      measure.setValue( errors );
      measures.add( measure );

      measure = new FileMeasure();
      measure.setFile(file);
      measure.setMetric( loadMetric( Metrics.SUREFIRE_SKIPPED ) );
      measure.setValue( skipped );
      measures.add( measure );

      measure = new FileMeasure();
      measure.setFile(file);
      measure.setMetric( loadMetric( Metrics.SUREFIRE_FAILURES ) );
      measure.setValue( failures );
      measures.add( measure );

      measure = new FileMeasure();
      measure.setFile(file);
      measure.setMetric( loadMetric( Metrics.SUREFIRE_TESTS ) );
      measure.setValue( tests );
      measures.add( measure );

      measure = new FileMeasure();
      measure.setFile(file);
      measure.setMetric( loadMetric( Metrics.SUREFIRE_TIME ) );
      measure.setValue( scaleValue( time * 1000, 3 ) );
      measures.add( measure );
      if ( tests > 0 ) {
        measure = new FileMeasure();
        measure.setFile(file);
        measure.setMetric( loadMetric( Metrics.SUREFIRE_SUCCESS_PERCENTAGE ) );
        measure.setValue( scaleValue( 100d - ( ( errors + failures ) * 100d / tests ) ) );
        measures.add( measure );
 
        measure = new FileMeasure();
        measure.setFile(file);
        measure.setMetric( loadMetric( Metrics.SUREFIRE_ERRORS_PERCENTAGE ) );
        measure.setValue( scaleValue( errors * 100d / tests ) );
        measures.add( measure );
 
        measure = new FileMeasure();
        measure.setFile(file);
        measure.setMetric( loadMetric( Metrics.SUREFIRE_FAILURE_PERCENTAGE ) );
        measure.setValue( scaleValue( failures * 100d / tests ) );
        measures.add( measure );
      }
      return measures;
    }
View Full Code Here

      this.file = file;
    }

    private Collection<FileMeasure> asMeasures() {
      Collection<FileMeasure> measures = new ArrayList<FileMeasure>();
      FileMeasure measure = new FileMeasure();
      measure.setMetric(duplicationMetric);
      measure.setFile(file);
      measure.setValue(duplication);
      measures.add(measure);

      measure = new FileMeasure();
      measure.setMetric(duplicatedLinesMetric);
      measure.setFile(file);
      measure.setValue(duplicatedLines);
      measures.add(measure);

      measure = new FileMeasure();
      measure.setMetric(duplicatedTokensMetric);
      measure.setFile(file);
      measure.setValue(duplicatedTokens);
      measures.add(measure);

      return measures;
    }
View Full Code Here

  public List<FileMeasure> collectFileMeasures() throws MojoExecutionException {
    List<FileMeasure> measures = new ArrayList<FileMeasure>();
    NodeList classes = parser.executeXPathNodeList("//classes/class");
    for (int i = 0; i < classes.getLength(); i++) {
      Element elt = (Element) classes.item(i);
      FileMeasure lineMeasure = toFileMeasure(elt, lineCoverageMetric, "line-rate");
      if (lineMeasure != null) {
        measures.add(lineMeasure);
      }
      FileMeasure branchMeasure = toFileMeasure(elt, branchCoverageMetric, "branch-rate");
      if (branchMeasure != null) {
        measures.add(branchMeasure);
      }
    }
    return measures;
View Full Code Here

      // cobertura 2.0 is quite bugged and generates some time coverage measures for unknown files (in Tuscany project for example)
      // so we simply return and do not create the file measure
      return null;
    }

    FileMeasure measure = new FileMeasure();
    measure.setMetric(null);
    measure.setFile(file);
    measure.setMetric(metric);
    measure.setValue(convertPercentage(Double.parseDouble(elt.getAttribute(valueAttributeName))));

    NodeList lines = parser.executeXPathNodeList(elt, "methods/method/lines/line");
    for (int i = 0; i < lines.getLength(); i++) {
      Element line = (Element) lines.item(i);
      double hits = Double.parseDouble(line.getAttribute("hits"));
      if (hits > 0) {
        measure.addParameter("line-hit", Double.parseDouble(line.getAttribute("number")), hits);
      }
    }
    return measure;
  }
View Full Code Here

TOP

Related Classes of ch.hortis.sonar.model.FileMeasure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.