| org.apache.tools.ant.types.selectors.BaseSelectorTest
All known Subclasses: org.apache.tools.ant.types.selectors.DateSelectorTest, org.apache.tools.ant.types.selectors.ContainsSelectorTest, org.apache.tools.ant.types.selectors.ModifiedSelectorTest, org.apache.tools.ant.types.selectors.FilenameSelectorTest, org.apache.tools.ant.types.selectors.DependSelectorTest, org.apache.tools.ant.types.selectors.DepthSelectorTest, org.apache.tools.ant.types.selectors.SizeSelectorTest, org.apache.tools.ant.types.selectors.TypeSelectorTest, org.apache.tools.ant.types.selectors.PresentSelectorTest,
BaseSelectorTest | abstract public class BaseSelectorTest extends TestCase (Code) | | Base test case for Selectors. Provides a shared test as well as
a test bed for selecting on, and a helper method for determining
whether selections are correct.
|
Method Summary | |
protected void | cleanupBed() Cleans up the testbed by calling a target in the
src/etc/testcases/types/selectors.xml file. | protected void | cleanupMirror() Cleans up the mirror testbed by calling a target in the
src/etc/testcases/types/selectors.xml file. | public String | diff(String expected, String result) Checks which files are selected and shouldn't be or which
are not selected but should. | abstract public BaseSelector | getInstance() | public Project | getProject() | public BaseSelector | getSelector() Return a preconfigured selector (with a set reference to
project instance). | protected void | makeBed() Creates a testbed. | protected void | makeMirror() Creates a mirror of the testbed for use in dependency checks.
Note that the right way to call this is within a try block,
with a finally clause that calls cleanupMirror(). | public String | mirrorSelectionString(FileSelector selector) This is a helper method that takes a selector and calls its
isSelected() method on each file in the mirror testbed. | public void | performTests(FileSelector selector, String expected) Does the selection test for a given selector and prints the
filenames of the differing files (selected but shouldn't,
not selected but should). | public String | resolve(String filelist) Resolves a diff-String (@see diff()) against the (inherited) filenames-
and files arrays. | public String | selectionString(FileSelector selector) This is a helper method that takes a selector and calls its
isSelected() method on each file in the testbed. | public String | selectionString(File basedir, File[] files, FileSelector selector) Worker method for the two convenience methods above. | public void | setUp() | public void | testRespondsToError() This is a test that all Selectors derived from BaseSelector can
use. |
cleanupBed | protected void cleanupBed()(Code) | | Cleans up the testbed by calling a target in the
src/etc/testcases/types/selectors.xml file.
|
cleanupMirror | protected void cleanupMirror()(Code) | | Cleans up the mirror testbed by calling a target in the
src/etc/testcases/types/selectors.xml file.
|
diff | public String diff(String expected, String result)(Code) | | Checks which files are selected and shouldn't be or which
are not selected but should.
Parameters: expected - String containing 'F's and 'T's Parameters: result - String containing 'F's and 'T's Difference as String containing '-' (equal) and'X' (difference). |
getInstance | abstract public BaseSelector getInstance()(Code) | | Override this in child classes to return a specific Selector
|
getSelector | public BaseSelector getSelector()(Code) | | Return a preconfigured selector (with a set reference to
project instance).
the selector |
makeBed | protected void makeBed()(Code) | | Creates a testbed. We avoid the dreaded "test" word so that we
don't falsely identify this as a test to be run. The actual
setting up of the testbed is done in the
src/etc/testcases/types/selectors.xml build file.
Note that the right way to call this is within a try block,
with a finally clause that calls cleanupBed(). You place tests of
the isSelected() method within the try block.
|
makeMirror | protected void makeMirror()(Code) | | Creates a mirror of the testbed for use in dependency checks.
Note that the right way to call this is within a try block,
with a finally clause that calls cleanupMirror(). You place tests of
the isSelected() method within the try block.
|
mirrorSelectionString | public String mirrorSelectionString(FileSelector selector)(Code) | | This is a helper method that takes a selector and calls its
isSelected() method on each file in the mirror testbed. This
variation is used for dependency checks and to get around the
limitations in the touch task when running JDK 1.1. It returns
a string of "T"s amd "F"s.
|
performTests | public void performTests(FileSelector selector, String expected)(Code) | | Does the selection test for a given selector and prints the
filenames of the differing files (selected but shouldn't,
not selected but should).
Parameters: selector - The selector to test Parameters: expected - The expected result |
resolve | public String resolve(String filelist)(Code) | | Resolves a diff-String (@see diff()) against the (inherited) filenames-
and files arrays.
Parameters: filelist - Diff-String String containing the filenames for all differing files,separated with semicolons ';' |
selectionString | public String selectionString(FileSelector selector)(Code) | | This is a helper method that takes a selector and calls its
isSelected() method on each file in the testbed. It returns
a string of "T"s amd "F"s
|
selectionString | public String selectionString(File basedir, File[] files, FileSelector selector)(Code) | | Worker method for the two convenience methods above. Applies a
selector on a set of files passed in and returns a string of
"T"s amd "F"s from applying the selector to each file.
|
setUp | public void setUp()(Code) | | |
testRespondsToError | public void testRespondsToError()(Code) | | This is a test that all Selectors derived from BaseSelector can
use. It calls the setError() method and checks to ensure that a
BuildException is thrown as a result.
|
|
|