org.hackystat.sensor.ant.clover
Class CloverSensor

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.hackystat.sensor.ant.task.HackystatSensorTask
              extended by org.hackystat.sensor.ant.clover.CloverSensor
All Implemented Interfaces:
java.lang.Cloneable

public class CloverSensor
extends HackystatSensorTask

Implements an Ant task that parses the XML files generated by the Clover coverage tool and sends the data to a Hackystat server.

Author:
Aaron A. Kagawa, Philip Johnson

Field Summary
 
Fields inherited from class org.hackystat.sensor.ant.task.HackystatSensorTask
dataFilesList, errMsgPrefix, failOnError, msgPrefix, runtime, sensorProps, sensorShell, sourceFilesList, toolAccount, tstampSet, verbose
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
CloverSensor()
          Initialize a new instance of a CloverSensor.
CloverSensor(java.lang.String host, java.lang.String email, java.lang.String password)
          Initialize a new instance of a CloverSensor, passing the host and directory key in explicitly.
 
Method Summary
 void executeInternal()
          Parses the Coverage XML files and sends the resulting coverage results to the hackystat server.
 int processCoverageXmlFile(java.io.File xmlFile)
          Parses an Clover XML file and sends the data to the shell.
 
Methods inherited from class org.hackystat.sensor.ant.task.HackystatSensorTask
createDataFiles, createSourceFiles, execute, getDataFiles, getFiles, getSourceFiles, info, isUsingUserMap, sendAndQuit, setFailOnError, setRetryAttempts, setRetryWaitInterval, setupSensorShell, setUserMapTool, setUserMapToolAccount, setVerbose, signalError, summaryInfo, verboseInfo
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloverSensor

public CloverSensor()
Initialize a new instance of a CloverSensor.


CloverSensor

public CloverSensor(java.lang.String host,
                    java.lang.String email,
                    java.lang.String password)
Initialize a new instance of a CloverSensor, passing the host and directory key in explicitly. This supports testing. Note that when this constructor is called, offline data recovery by the sensor is disabled.

Parameters:
host - The hackystat host URL.
email - The Hackystat email to use.
password - The Hackystat password to use.
Method Detail

executeInternal

public void executeInternal()
                     throws org.apache.tools.ant.BuildException
Parses the Coverage XML files and sends the resulting coverage results to the hackystat server. This method is invoked automatically by Ant.

Specified by:
executeInternal in class HackystatSensorTask
Throws:
org.apache.tools.ant.BuildException - If there is an error.

processCoverageXmlFile

public int processCoverageXmlFile(java.io.File xmlFile)
                           throws org.apache.tools.ant.BuildException
Parses an Clover XML file and sends the data to the shell. The only coverage information that is used by the sensor is the Clover class level report. All other coverage information is ignored; for example the sensor does not use the method element coverage information. Instead, the sensor parses the class element. Here is an example:
 <file name="PmdSensor.java">
   <class name="PmdSensor">
     <metrics methods="18" conditionals="36" coveredstatements="77" coveredmethods="7" 
       coveredconditionals="11" statements="141" coveredelements="95" elements="195"/>
   </class>
   <metrics classes="1" methods="18" conditionals="36" ncloc="270" coveredstatements="77" 
     coveredmethods="7" coveredconditionals="11" statements="141" loc="456" 
     coveredelements="95" elements="195"/>
   ...
 </file>
 
The granularities of file metrics element. One could dig down into the line elements but we aren't doing that now.

Parameters:
xmlFile - The XML file name to be processed.
Returns:
The number of coverage entries in this XML file.
Throws:
org.apache.tools.ant.BuildException - if any error.