org.apache.cactus.ant
Class RunServerTestsTask
java.lang.Object
|
+--org.apache.tools.ant.ProjectComponent
|
+--org.apache.tools.ant.Task
|
+--org.apache.cactus.ant.RunServerTestsTask
- public class RunServerTestsTask
- extends org.apache.tools.ant.Task
Task to automate running in-container unit test. It has the following
syntax when used in Ant :
<runservertests testURL="&t;url>"
startTarget="<start target name>"
stopTarget="<stop target name>"
testTarget="<test target name>"/>
where <url>
is the URL that is used by this task to
ensure that the server is running. Indeed, the algorithm is as follow :
- Checks if server is running by trying to open an HTTP connection to
the URL,
- If it fails, call the start target and loop until the HTTP connection
the URL can be established,
- Call the test target. This target is supposed to start the test,
usually by running the junit Ant task,
- When the tests are finished, call the stop target to stop the server.
Note: The stop target is called only if the server was not already running
when this task was executed.
- Version:
- $Id: RunServerTestsTask.java,v 1.2 2002/03/10 13:28:19 vmassol Exp $
- Author:
- Vincent Massol
Method Summary |
void |
execute()
|
void |
init()
Initialize the task. |
void |
setStartTarget(java.lang.String theStartTarget)
Sets the target to call to start the server. |
void |
setStopTarget(java.lang.String theStopTarget)
Sets the target to call to stop the server. |
void |
setTestTarget(java.lang.String theTestTarget)
Sets the target to call to run the tests. |
void |
setTestURL(java.lang.String theTestURL)
Sets the URL to call for testing if the server is running. |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, 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 |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RunServerTestsTask
public RunServerTestsTask()
init
public void init()
- Initialize the task.
- Overrides:
init
in class org.apache.tools.ant.Task
execute
public void execute()
throws org.apache.tools.ant.BuildException
- Overrides:
execute
in class org.apache.tools.ant.Task
- See Also:
Task.execute()
setStartTarget
public void setStartTarget(java.lang.String theStartTarget)
- Sets the target to call to start the server.
- Parameters:
theStartTarget
- the Ant target to call
setStopTarget
public void setStopTarget(java.lang.String theStopTarget)
- Sets the target to call to stop the server.
- Parameters:
theStopTarget
- the Ant target to call
setTestURL
public void setTestURL(java.lang.String theTestURL)
- Sets the URL to call for testing if the server is running.
- Parameters:
theTestURL
- the test URL to ping
setTestTarget
public void setTestTarget(java.lang.String theTestTarget)
- Sets the target to call to run the tests.
- Parameters:
theTestTarget
- the Ant target to call
Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.