public void testCreateFilterChainOk() throws Exception {
String testInputDirProperty = System.getProperty("testinput.dir");
assertTrue("The system property 'testinput.dir' must be set",
testInputDirProperty != null);
File testInputDir = new File(testInputDirProperty);
assertTrue("The system property 'testinput.dir' must point to an "
+ "existing directory", testInputDir.isDirectory());
String fileName =
"org/apache/cactus/integration/ant/cactified.ear";
File earFile = new File(testInputDir, fileName);
assertTrue("The test input " + fileName + " does not exist",
earFile.exists());
this.container.setDeployableFile(EarParser.parse(earFile));
// Note that we needed to add a last character to the string
// after the @cactus.context@ token as otherwise the Ant code
// fails! It looks like an Ant bug to me...
String buffer = "@cactus.port@:@cactus.context@:";
FilterChain chain = this.container.createFilterChain();
ChainReaderHelper helper = new ChainReaderHelper();
Vector chains = new Vector();
chains.addElement(chain);
helper.setFilterChains(chains);
helper.setPrimaryReader(new StringReader(buffer));
Reader reader = helper.getAssembledReader();
assertEquals("8080:empty:", helper.readFully(reader));
}
Verify that the Ant filter chain is correctly configured to
replace the "cactus.port" and "cactus.context" tokens. |