org.schmant.task.junit4
Class ExtJUnit4Task

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.task.stub.AbstractTask<T>
          extended by org.schmant.task.template.process.AbstractExtProcessTask<T>
              extended by org.schmant.task.template.jdk.java.AbstractExtJvmTask<T>
                  extended by org.schmant.task.template.jdk.java.AbstractExtJavaTask<ExtJUnit4Task>
                      extended by org.schmant.task.junit4.ExtJUnit4Task
All Implemented Interfaces:
TaskDependency, LoggingConfigurable<ExtJUnit4Task>, Task, TaskRunnable, TaskSpecification<ExtJUnit4Task>, ExtProcessConfigured, ExtProcessTask<ExtJUnit4Task>

public final class ExtJUnit4Task
extends AbstractExtJavaTask<ExtJUnit4Task>

Task for running JUnit 4 tests in an external process.

See JUnit4TF

Since:
0.5
Author:
Karl Gustafsson
See Also:
JUnit4TF
Task_package:
org.junit.junit4

Field Summary
static String REPORTER_FQNS_SYSTEM_PROPERTY_NAME
           
 
Method Summary
protected  void addTaskSpecificJvmArguments(ArgumentList al)
          Override this to add information on reporters.
 void copyProperties(ExtJUnit4Task spec)
          Copy the properties to the target object.
protected  String getDefaultLogHeader()
          Get the default log header to log (to level INFO) before the task is run if the task user has not set a custom header.
protected  Collection<? extends EntityView> getTaskSpecificClasspathEntries()
          Override this to add the JUnit4 launcher jar to the classpath.
protected  void runInternal(Report r)
          Subclasses implement this.
 String toString()
          Default implementation for tasks.
protected  Collection<String> validate(Report r)
          This method may be overridden by subclasses to validate their configuration (including their TaskFactory:s) before the task is run.
 
Methods inherited from class org.schmant.task.template.jdk.java.AbstractExtJavaTask
addArgumentsToCommandList, getClasspathEntriesFromPathDecorators, getDecorators, getFallbackJavaExecutable, getJavaVMType, isAssertions, prepareArgumentList
 
Methods inherited from class org.schmant.task.template.jdk.java.AbstractExtJvmTask
getClasspathDecorators, getClasspathEntries, getJavaExecutable, getJavaHome, getJvmOptions
 
Methods inherited from class org.schmant.task.template.process.AbstractExtProcessTask
execAndWait, getArguments, getEnvironmentVariables, getProcessResult, getStderrStrategy, getStdoutStrategy, getWorkingDirectory, isFailOnErrors, isInheritEnvironmentVariables
 
Methods inherited from class org.schmant.task.stub.AbstractTask
cancel, createTask, getDefaultLogFooter, getDependencyForTasksScheduledByThisTask, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 
Methods inherited from class org.schmant.support.AbstractArgumentChecker
check, check, check, check
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.schmant.task.Task
cancel, getDependencyForTasksScheduledByThisTask, getFailureCause, isCancelled, isDone, isInterrupted, isRunning, isSuccessful
 
Methods inherited from interface org.schmant.run.TaskDependency
getDependencyObservable, getSatisfiedStateLock, isSatisfied
 
Methods inherited from interface org.schmant.task.TaskRunnable
run
 

Field Detail

REPORTER_FQNS_SYSTEM_PROPERTY_NAME

public static final String REPORTER_FQNS_SYSTEM_PROPERTY_NAME
See Also:
Constant Field Values
Method Detail

getDefaultLogHeader

protected String getDefaultLogHeader()
Description copied from class: AbstractTask
Get the default log header to log (to level INFO) before the task is run if the task user has not set a custom header. Subclasses may override this to return better headers.

This is called after validating the task.

Return null to disable logging.

Overrides:
getDefaultLogHeader in class AbstractTask<ExtJUnit4Task>
Returns:
"Running " + toString()

validate

protected Collection<String> validate(Report r)
Description copied from class: AbstractTask
This method may be overridden by subclasses to validate their configuration (including their TaskFactory:s) before the task is run.

Validation errors are collected as strings. If this method is overridden, always call super.validate.

Overrides:
validate in class AbstractExtJavaTask<ExtJUnit4Task>
Parameters:
r - A report to log warning and debug messages to. Validation errors should not be logged, though. They are logged later.
Returns:
A collection of error messages.

getTaskSpecificClasspathEntries

protected Collection<? extends EntityView> getTaskSpecificClasspathEntries()
Override this to add the JUnit4 launcher jar to the classpath.

Overrides:
getTaskSpecificClasspathEntries in class AbstractExtJavaTask<ExtJUnit4Task>
Returns:
Task-specific classpath entries.

addTaskSpecificJvmArguments

protected void addTaskSpecificJvmArguments(ArgumentList al)
Override this to add information on reporters.

Overrides:
addTaskSpecificJvmArguments in class AbstractExtJavaTask<ExtJUnit4Task>
Parameters:
al - The command line to add options to.

runInternal

protected void runInternal(Report r)
                    throws InterruptedException
Description copied from class: AbstractTask
Subclasses implement this. The task is AbstractTask.validate(Report):d before this method is called, see AbstractTask.run().

Specified by:
runInternal in class AbstractTask<ExtJUnit4Task>
Parameters:
r - The current thread's Report.
Throws:
InterruptedException

copyProperties

public void copyProperties(ExtJUnit4Task spec)
Description copied from class: AbstractTask
Copy the properties to the target object.

Subclasses must override this to copy their properties. The overriding method must call super.copyProperties.

Specified by:
copyProperties in interface TaskSpecification<ExtJUnit4Task>
Overrides:
copyProperties in class AbstractExtJavaTask<ExtJUnit4Task>
Parameters:
spec - The specification to copy properties to.

toString

public String toString()
Description copied from class: AbstractTask
Default implementation for tasks. Task implementations may override this. It is used in the default log header that is written (level INFO) before a task is run.

This implementation just returns the class name.

Overrides:
toString in class AbstractTask<ExtJUnit4Task>