Upgrading to latest WebTest and Cactus
I attempted (and succeeded) in upgrading to the latest and greatest releases of Canoo's WebTest and Jakarta's Cactus this afternoon. It wasn't too bad. Both have revised their taskdef's to read from a properties file, and Cactus has simplified the process to include cactus-related JARs/mappings in your webapps. Now you can "cactify" your war with a little Ant-lovin:
<cactifywar srcfile="${webapp.dist}/${webapp.war}" destfile="${webapp.dist}/${webapp.name}-cactus.war"> <lib dir="${strutstestcase.dir}" includes="*.jar"/> <lib dir="${cactus.dir}"> <include name="*.jar"/> </lib> </cactifywar>
Pretty slick IMO. Now if I could only figure out how to do form-based authentication with Cactus (I couldn't find it in the docs).
The other issue I've been banging my head against the wall over is running canoo/httpunit tests with a compression filter enabled. Yep, the problems still exist, despite the fact that I patched httpunit. So I've come up with a new fix that satisfies me and eases the pain in my noggin'. In my compression filter, I simply disabled compression when it's an httpunit test:
String userAgent = req.getHeader("User-Agent"); if (!isGzipSupported(req) || userAgent.startsWith("httpunit")) { // Invoke resource normally. chain.doFilter(req, res); } else { // gzip it }
Posted by Vincent Massol on July 16, 2003 at 05:09 AM MDT #
Awesome - that worked! And it was <em>very</em> simple to get working. Now the question is - can I put this in in a base class for all my Actions (extends CactusStrutsTestCase)? I'd love to have a setup where each Test class can call super.authenticate() and it authenticates using the following lines:
Posted by Matt Raible on July 18, 2003 at 02:23 PM MDT #