Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cactus.integration.ant
Class RunServerTestsTask

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              org.apache.cactus.integration.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.

Since:
  Cactus 1.5
Version:
  $Id: RunServerTestsTask.java 239003 2004-05-31 20:05:27Z vmassol $

Constructor Summary
`RunServerTestsTask()`

Method Summary
`GenericContainer.Hook` | `createStart()` Creates a nested start element.
`GenericContainer.Hook` | `createStop()` Creates a nested stop element.
`GenericContainer.Hook` | `createTest()` Creates a nested test element.
`void` | `execute()`
`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.net.URL theTestURL)` Sets the URL to call for testing if the server is running.
`void` | `setTimeout(long theTimeout)`

Methods inherited from class org.apache.tools.ant.Task
`getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, init, 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
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RunServerTestsTask

    public RunServerTestsTask()

Method Detail

### execute

    public void execute()
                 throws org.apache.tools.ant.BuildException

  Throws:
    `org.apache.tools.ant.BuildException`
  See Also:
    `Task.execute()`

### createStart

    public final GenericContainer.Hook createStart()

  Creates a nested start element.

  Returns:
    The start element

### setStartTarget

    public void setStartTarget(java.lang.String theStartTarget)

  Sets the target to call to start the server.

  Parameters:
    `theStartTarget` - the Ant target to call

### createStop

    public final GenericContainer.Hook createStop()

  Creates a nested stop element.

  Returns:
    The stop element

### setStopTarget

    public void setStopTarget(java.lang.String theStopTarget)

  Sets the target to call to stop the server.

  Parameters:
    `theStopTarget` - the Ant target to call

### createTest

    public final GenericContainer.Hook createTest()

  Creates a nested test element.

  Returns:
    The test element

### setTestTarget

    public void setTestTarget(java.lang.String theTestTarget)

  Sets the target to call to run the tests.

  Parameters:
    `theTestTarget` - the Ant target to call

### setTestURL

    public void setTestURL(java.net.URL theTestURL)

  Sets the URL to call for testing if the server is running.

  Parameters:
    `theTestURL` - the test URL to ping

### setTimeout

    public void setTimeout(long theTimeout)

  Parameters:
    `theTimeout` - the timeout after which we stop trying to call the test URL.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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