| org.apache.tools.ant.BuildFileTestA
All known Subclasses: net.sourceforge.groboutils.codecoverage.v2.ant.AntTestA,
BuildFileTestA | abstract public class BuildFileTestA extends TestCase (Code) | | (note: name changed from BuildFileTest to ensure the abstract test isn't
run).
A BuildFileTest is a TestCase which executes targets from an Ant buildfile
for testing.
This class provides a number of utility methods for particular build file
tests which extend this class.
author: Nico Seessle author: Conor MacNeill |
Field Summary | |
protected Project | project |
Method Summary | |
protected void | assertLogContaining(String substring) | protected void | assertPropertyEquals(String property, String value) assert that a property equals a value; comparison is case sensitive. | protected void | assertPropertySet(String property) | protected void | assertPropertyUnset(String property) | protected void | configureProject(String filename) | protected void | configureProject(String filename, int logLevel) | protected void | executeTarget(String targetName) | protected void | expectBuildException(String target, String cause) | protected void | expectBuildExceptionContaining(String target, String cause, String contains) | protected void | expectDebuglog(String target, String log) Assert that the given message has been logged with a priority
>= DEBUG when running the given target. | protected void | expectLog(String target, String log) Assert that only the given message has been logged with a
priority >= INFO when running the given target. | protected void | expectLogContaining(String target, String log) Assert that the given message has been logged with a priority
>= INFO when running the given target. | protected void | expectOutput(String target, String output) | protected void | expectOutputAndError(String target, String output, String error) | protected void | expectPropertySet(String target, String property, String value) | protected void | expectPropertySet(String target, String property) call a target, verify named property is "true". | protected void | expectPropertyUnset(String target, String property) | protected void | expectSpecificBuildException(String target, String cause, String msg) | protected BuildException | getBuildException() | protected String | getError() | protected String | getFullLog() Gets the log the BuildFileTest object. | protected String | getLog() Gets the log the BuildFileTest object. | protected String | getOutput() | protected Project | getProject() Get the project which has been configured for a test. | protected File | getProjectDir() | protected URL | getResource(String resource) Retrieve a resource from the caller classloader to avoid
assuming a vm working directory. |
project | protected Project project(Code) | | |
BuildFileTestA | public BuildFileTestA(String name)(Code) | | Constructor for the BuildFileTest object
Parameters: name - string to pass up to TestCase constructor |
assertLogContaining | protected void assertLogContaining(String substring)(Code) | | Assert that the given substring is in the log messages
|
assertPropertyEquals | protected void assertPropertyEquals(String property, String value)(Code) | | assert that a property equals a value; comparison is case sensitive.
Parameters: property - property name Parameters: value - expected value |
assertPropertySet | protected void assertPropertySet(String property)(Code) | | assert that a property equals "true"
Parameters: property - property name |
assertPropertyUnset | protected void assertPropertyUnset(String property)(Code) | | assert that a property is null
Parameters: property - property name |
configureProject | protected void configureProject(String filename) throws BuildException(Code) | | set up to run the named project
Parameters: filename - name of project file to run |
configureProject | protected void configureProject(String filename, int logLevel) throws BuildException(Code) | | set up to run the named project
Parameters: filename - name of project file to run |
executeTarget | protected void executeTarget(String targetName)(Code) | | execute a target we have set up
Parameters: targetName - target to run |
expectBuildException | protected void expectBuildException(String target, String cause)(Code) | | run a target, expect for any build exception
Parameters: target - target to run Parameters: cause - information string to reader of report |
expectBuildExceptionContaining | protected void expectBuildExceptionContaining(String target, String cause, String contains)(Code) | | run a target, expect an exception string
containing the substring we look for (case sensitive match)
Parameters: target - target to run Parameters: cause - information string to reader of report Parameters: contains - substring of the build exception to look for |
expectDebuglog | protected void expectDebuglog(String target, String log)(Code) | | Assert that the given message has been logged with a priority
>= DEBUG when running the given target.
|
expectLog | protected void expectLog(String target, String log)(Code) | | Assert that only the given message has been logged with a
priority >= INFO when running the given target.
|
expectLogContaining | protected void expectLogContaining(String target, String log)(Code) | | Assert that the given message has been logged with a priority
>= INFO when running the given target.
|
expectOutput | protected void expectOutput(String target, String output)(Code) | | execute the target, verify output matches expectations
Parameters: target - target to execute Parameters: output - output to look for |
expectOutputAndError | protected void expectOutputAndError(String target, String output, String error)(Code) | | execute the target, verify output matches expectations
and that we got the named error at the end
Parameters: target - target to execute Parameters: output - output to look for Parameters: error - Description of Parameter |
expectPropertySet | protected void expectPropertySet(String target, String property, String value)(Code) | | call a target, verify property is as expected
Parameters: target - build file target Parameters: property - property name Parameters: value - expected value |
expectPropertySet | protected void expectPropertySet(String target, String property)(Code) | | call a target, verify named property is "true".
Parameters: target - build file target Parameters: property - property name |
expectPropertyUnset | protected void expectPropertyUnset(String target, String property)(Code) | | call a target, verify property is null
Parameters: target - build file target Parameters: property - property name |
expectSpecificBuildException | protected void expectSpecificBuildException(String target, String cause, String msg)(Code) | | run a target, wait for a build exception
Parameters: target - target to run Parameters: cause - information string to reader of report Parameters: msg - the message value of the build exception we are waiting forset to null for any build exception to be valid |
getBuildException | protected BuildException getBuildException()(Code) | | |
getFullLog | protected String getFullLog()(Code) | | Gets the log the BuildFileTest object.
only valid if configureProject() has
been called.
The log value |
getLog | protected String getLog()(Code) | | Gets the log the BuildFileTest object.
only valid if configureProject() has
been called.
The log value |
getProject | protected Project getProject()(Code) | | Get the project which has been configured for a test.
the Project instance for this test. |
getProjectDir | protected File getProjectDir()(Code) | | get the directory of the project
the base dir of the project |
getResource | protected URL getResource(String resource)(Code) | | Retrieve a resource from the caller classloader to avoid
assuming a vm working directory. The resource path must be
relative to the package name or absolute from the root path.
Parameters: resource - the resource to retrieve its url. throws: AssertionFailureException - if resource is not found. |
|
|