Coverage (Apache Ant API)

org.apache.tools.ant.taskdefs.optional.sitraka
Class Coverage


java.lang.Object

  |

  +--org.apache.tools.ant.ProjectComponent

        |

        +--org.apache.tools.ant.Task

              |

              +--org.apache.tools.ant.taskdefs.optional.sitraka.Coverage


public class Coverage
extends Task

Runs Sitraka JProbe Coverage. Options are pretty numerous, you'd better check the manual for a full descriptions of options. (not that simple since they differ from the online help, from the usage command line and from the examples...)

For additional information, visit www.sitraka.com

Author:
Stephane Bailliez

Nested Class Summary
static class Coverage.Finalsnapshot
           
static class Coverage.Javavm
           
static class Coverage.Recordfromstart
           
 
Field Summary
protected  boolean applet
           
protected  Commandline cmdl
           
protected  CommandlineJava cmdlJava
           
protected  java.lang.String exitPrompt
          this is a somewhat annoying thing, set it to never
protected  java.util.Vector filesets
           
protected  Filters filters
           
protected  java.lang.String finalSnapshot
           
protected  java.lang.String function
           
protected  java.io.File home
           
protected  java.io.File inputFile
           
protected  java.io.File javaExe
           
protected  java.lang.String recordFromStart
           
protected  java.lang.String seedName
           
protected  java.io.File snapshotDir
           
protected  Socket socket
           
protected  boolean trackNatives
           
protected  Triggers triggers
           
protected  java.lang.String vm
           
protected  int warnLevel
           
protected  java.io.File workingDir
           
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
Coverage()
           
 
Method Summary
 void addFileset(FileSet fs)
          the classnames to execute.
protected  void checkOptions()
          wheck what is necessary to check, Coverage will do the job for us
 Commandline.Argument createArg()
          Adds a command argument.
 Path createClasspath()
          classpath to run the files.
 Filters createFilters()
          Defines class/method filters based on pattern matching.
 Commandline.Argument createJvmarg()
          Adds a JVM argument.
protected  java.io.File createParamFile()
          create the parameter file from the given options.
 Socket createSocket()
          Define a host and port to connect to if you want to do remote viewing.
protected  java.io.File createTmpFile()
          create a temporary file in the current dir (For JDK1.1 support)
 Triggers createTriggers()
          Defines events to use for interacting with the collection of data performed during coverage.
 void execute()
          execute the jplauncher by providing a parameter file
protected  java.lang.String[] getParameters()
          return the command line parameters.
 void setApplet(boolean value)
          If true, run an applet.
 void setClassname(java.lang.String value)
          classname to run as standalone or runner for filesets.
 void setExitprompt(java.lang.String value)
          Toggles display of the console prompt: always, error, never
 void setFinalsnapshot(java.lang.String value)
          Type of snapshot to send at program termination: none, coverage, all.
 void setHome(java.io.File value)
          The directory where JProbe is installed.
 void setInputfile(java.io.File value)
           
 void setJavaexe(java.io.File value)
          Path to the java executable.
 void setRecordfromstart(Coverage.Recordfromstart value)
          "all", "coverage", or "none".
 void setSeedname(java.lang.String value)
          seed name for snapshot file.
 void setSnapshotdir(java.io.File value)
          The path to the directory where snapshot files are stored.
 void setTracknatives(boolean value)
          If true, track native methods.
 void setVm(Coverage.Javavm value)
          Indicates which virtual machine to run: "jdk117", "jdk118" or "java2".
 void setWarnlevel(java.lang.Integer value)
          Set warning level (0-3, where 0 is the least amount of warnings).
 void setWorkingdir(java.io.File value)
          The physical path to the working directory for the VM.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

home


protected java.io.File home

cmdl


protected Commandline cmdl

cmdlJava


protected CommandlineJava cmdlJava

function


protected java.lang.String function

seedName


protected java.lang.String seedName

inputFile


protected java.io.File inputFile

javaExe


protected java.io.File javaExe

vm


protected java.lang.String vm

applet


protected boolean applet

exitPrompt


protected java.lang.String exitPrompt
this is a somewhat annoying thing, set it to never


filters


protected Filters filters

triggers


protected Triggers triggers

finalSnapshot


protected java.lang.String finalSnapshot

recordFromStart


protected java.lang.String recordFromStart

snapshotDir


protected java.io.File snapshotDir

workingDir


protected java.io.File workingDir

trackNatives


protected boolean trackNatives

socket


protected Socket socket

warnLevel


protected int warnLevel

filesets


protected java.util.Vector filesets
Constructor Detail

Coverage


public Coverage()
Method Detail

setHome


public void setHome(java.io.File value)
The directory where JProbe is installed.


setSeedname


public void setSeedname(java.lang.String value)
seed name for snapshot file. Can be null, default to snap


setInputfile


public void setInputfile(java.io.File value)

setJavaexe


public void setJavaexe(java.io.File value)
Path to the java executable.


setVm


public void setVm(Coverage.Javavm value)
Indicates which virtual machine to run: "jdk117", "jdk118" or "java2". Can be null, default to "java2".


setApplet


public void setApplet(boolean value)
If true, run an applet.


setExitprompt


public void setExitprompt(java.lang.String value)
Toggles display of the console prompt: always, error, never


createFilters


public Filters createFilters()
Defines class/method filters based on pattern matching. The syntax is filters is similar to a fileset.


createTriggers


public Triggers createTriggers()
Defines events to use for interacting with the collection of data performed during coverage. For example you may run a whole application but only decide to collect data once it reaches a certain method and once it exits another one.


createSocket


public Socket createSocket()
Define a host and port to connect to if you want to do remote viewing.


setFinalsnapshot


public void setFinalsnapshot(java.lang.String value)
Type of snapshot to send at program termination: none, coverage, all. Can be null, default to none


setRecordfromstart


public void setRecordfromstart(Coverage.Recordfromstart value)
"all", "coverage", or "none".


setWarnlevel


public void setWarnlevel(java.lang.Integer value)
Set warning level (0-3, where 0 is the least amount of warnings).


setSnapshotdir


public void setSnapshotdir(java.io.File value)
The path to the directory where snapshot files are stored. Choose a directory that is reachable by both the remote and local computers, and enter the same path on the command-line and in the viewer.


setWorkingdir


public void setWorkingdir(java.io.File value)
The physical path to the working directory for the VM.


setTracknatives


public void setTracknatives(boolean value)
If true, track native methods.


createJvmarg


public Commandline.Argument createJvmarg()
Adds a JVM argument.


createArg


public Commandline.Argument createArg()
Adds a command argument.


createClasspath


public Path createClasspath()
classpath to run the files.


setClassname


public void setClassname(java.lang.String value)
classname to run as standalone or runner for filesets.


addFileset


public void addFileset(FileSet fs)
the classnames to execute.


execute


public void execute()
             throws BuildException
execute the jplauncher by providing a parameter file

Overrides:
execute in class Task
Throws:
BuildException - if something goes wrong with the build

checkOptions


protected void checkOptions()
                     throws BuildException
wheck what is necessary to check, Coverage will do the job for us

BuildException

getParameters


protected java.lang.String[] getParameters()
return the command line parameters. Parameters can either be passed to the command line and stored to a file (then use the -jp_input=<filename>) if they are too numerous.


createParamFile


protected java.io.File createParamFile()
                                throws BuildException
create the parameter file from the given options. The file is created with a random name in the current directory.

Returns:
the file object where are written the configuration to run JProbe Coverage
Throws:
BuildException - thrown if something bad happens while writing the arguments to the file.

createTmpFile


protected java.io.File createTmpFile()
create a temporary file in the current dir (For JDK1.1 support)



Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.