net.sf.jameleon.ant
Class ExecuteTestCaseSeparateVMTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by net.sf.jameleon.ant.ExecuteTestCaseSeparateVMTask

public class ExecuteTestCaseSeparateVMTask
extends org.apache.tools.ant.Task


Field Summary
protected static String DASH
           
protected  LinkedList fileSets
           
protected static String LB
           
protected static String US
           
 
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
ExecuteTestCaseSeparateVMTask()
           
 
Method Summary
 void addEnv(org.apache.tools.ant.types.Environment.Variable var)
          Adds an environment variable.
 void addFileset(org.apache.tools.ant.types.FileSet set)
          Ant's <fileset> definition.
 void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
          Adds a system property.
 void clearArgs()
          Clear out the arguments to this java task.
 org.apache.tools.ant.types.Commandline.Argument createArg()
          Adds a command-line argument.
 org.apache.tools.ant.types.Path createClasspath()
          Adds a path to the classpath.
 org.apache.tools.ant.types.Commandline.Argument createJvmarg()
          Adds a JVM argument.
protected  org.apache.tools.ant.taskdefs.ExecuteWatchdog createWatchdog()
          Create the Watchdog to kill a runaway process.
 void execute()
          Jameleon's implementation of Task.execute().
 int executeJava()
          Do the execution and return a return code.
protected  void handleErrorFlush(String line)
          Pass output sent to System.err to specified output file.
protected  void handleErrorOutput(String line)
          Pass output sent to System.err to specified output file.
protected  void handleFlush(String line)
          Pass output sent to System.out to specified output file.
protected  void handleOutput(String line)
          Pass output sent to System.out to specified output file.
protected  void run(String classname, Vector args)
          Executes the given classname with the given arguments as it was a command line application.
 void setAppend(boolean append)
          If true, append output to existing file.
 void setBaseDir(File dir)
           
 void setClassname(String s)
          Sets the Java class to execute.
 void setClasspath(org.apache.tools.ant.types.Path s)
          Set the classpath to be used when running the Java class
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
          Classpath to use, by reference.
 void setDebug(boolean debug)
           
 void setFailOnError(boolean fail)
          If true, then fail if the command exits with a returncode other than 0
 void setFork(boolean fork)
           
 void setJvm(String s)
          Set the command used to start the VM (only if not forking).
 void setJvmargs(String s)
          Set the command line arguments for the JVM.
 void setMaxmemory(String max)
          Corresponds to -mx or -Xmx depending on VM version.
 void setNewenvironment(boolean newenv)
          If true, use a completely new environment.
 void setOutput(File out)
          File the output of the process is redirected to.
 void setPrintFooter(boolean printFooter)
           
 void setSeparateVmPerScript(boolean separateVmPerScript)
           
 void setTimeout(Long value)
          Timeout in milliseconds after which the process will be killed.
protected  void validateOptions()
          Validate required options are set.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleInput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
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

fileSets

protected final LinkedList fileSets

LB

protected static final String LB

DASH

protected static final String DASH

US

protected static final String US
Constructor Detail

ExecuteTestCaseSeparateVMTask

public ExecuteTestCaseSeparateVMTask()
Method Detail

execute

public final void execute()
                   throws org.apache.tools.ant.BuildException
Jameleon's implementation of Task.execute().

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException - If anything goes wrong.

setPrintFooter

public void setPrintFooter(boolean printFooter)

setSeparateVmPerScript

public void setSeparateVmPerScript(boolean separateVmPerScript)

setDebug

public void setDebug(boolean debug)

setBaseDir

public void setBaseDir(File dir)

setFork

public void setFork(boolean fork)

addFileset

public void addFileset(org.apache.tools.ant.types.FileSet set)
Ant's <fileset> definition. To define the files to parse.

Parameters:
set - a fileset to add

validateOptions

protected void validateOptions()
                        throws org.apache.tools.ant.BuildException
Validate required options are set.

Throws:
org.apache.tools.ant.BuildException - if a fileset isn't set.

executeJava

public int executeJava()
                throws org.apache.tools.ant.BuildException
Do the execution and return a return code.

Returns:
the return code from the execute java class if it was executed in a separate VM (fork = "yes").
Throws:
org.apache.tools.ant.BuildException

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path s)
Set the classpath to be used when running the Java class

Parameters:
s - an Ant Path object containing the classpath.

createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Adds a path to the classpath.


setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference r)
Classpath to use, by reference.


setClassname

public void setClassname(String s)
                  throws org.apache.tools.ant.BuildException
Sets the Java class to execute.

Throws:
org.apache.tools.ant.BuildException

createArg

public org.apache.tools.ant.types.Commandline.Argument createArg()
Adds a command-line argument.


setJvmargs

public void setJvmargs(String s)
Set the command line arguments for the JVM.


createJvmarg

public org.apache.tools.ant.types.Commandline.Argument createJvmarg()
Adds a JVM argument.


setJvm

public void setJvm(String s)
Set the command used to start the VM (only if not forking).


addSysproperty

public void addSysproperty(org.apache.tools.ant.types.Environment.Variable sysp)
Adds a system property.


setFailOnError

public void setFailOnError(boolean fail)
If true, then fail if the command exits with a returncode other than 0


setOutput

public void setOutput(File out)
File the output of the process is redirected to.


setMaxmemory

public void setMaxmemory(String max)
Corresponds to -mx or -Xmx depending on VM version.


addEnv

public void addEnv(org.apache.tools.ant.types.Environment.Variable var)
Adds an environment variable.

Will be ignored if we are not forking a new VM.

Since:
Ant 1.5

setNewenvironment

public void setNewenvironment(boolean newenv)
If true, use a completely new environment.

Will be ignored if we are not forking a new VM.

Since:
Ant 1.5

setAppend

public void setAppend(boolean append)
If true, append output to existing file.

Since:
Ant 1.5

setTimeout

public void setTimeout(Long value)
Timeout in milliseconds after which the process will be killed.

Since:
Ant 1.5

handleOutput

protected void handleOutput(String line)
Pass output sent to System.out to specified output file.

Overrides:
handleOutput in class org.apache.tools.ant.Task
Since:
Ant 1.5

handleFlush

protected void handleFlush(String line)
Pass output sent to System.out to specified output file.

Overrides:
handleFlush in class org.apache.tools.ant.Task
Since:
Ant 1.5.2

handleErrorOutput

protected void handleErrorOutput(String line)
Pass output sent to System.err to specified output file.

Overrides:
handleErrorOutput in class org.apache.tools.ant.Task
Since:
Ant 1.5

handleErrorFlush

protected void handleErrorFlush(String line)
Pass output sent to System.err to specified output file.

Overrides:
handleErrorFlush in class org.apache.tools.ant.Task
Since:
Ant 1.5.2

run

protected void run(String classname,
                   Vector args)
            throws org.apache.tools.ant.BuildException
Executes the given classname with the given arguments as it was a command line application.

Throws:
org.apache.tools.ant.BuildException

clearArgs

public void clearArgs()
Clear out the arguments to this java task.


createWatchdog

protected org.apache.tools.ant.taskdefs.ExecuteWatchdog createWatchdog()
                                                                throws org.apache.tools.ant.BuildException
Create the Watchdog to kill a runaway process.

Throws:
org.apache.tools.ant.BuildException
Since:
Ant 1.5


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.