Docs for: v1.7.2 | v1.7 Last update: March 26 2006

# Release changes archives ## Cactus 1.3 (released on April 21 2002) Improved classloader support on the server side: Cactus first tries to load the Class to test using the Context class loader (thus, if you container has set the context class loader to point to the webapp classloader you'll be able to use Cactus as an extension and share it between projects). If the class cannot be loaded through the context class loader, Cactus then tries to load it using the Webapp classloader (in that case you'll need to have `cactus.jar` in your `WEB-INF/lib` directory). (VMA) Modified the mechanism to get test result from the Server side. Previously Cactus was using a serialized object whereas now Cactus sends back XML data. (VMA) Thanks to Kjeld. Fixes issue CACTUS-16. Added a Tested On ... page that gives the list of Servers/Versions on which Cactus has been tested. Please contribute if you have a working configuration not listed there. (VMA) Added a "Cactus users" page so that Cactus users can describe what they are doing with Cactus and share that with others. (VMA) Added support for Resin 2.1.0. The `ResinRun` Cactus Ant task that is used to start/stop Resin has been modified to support both Resin 2.0 and Resin 2.1 (Resin 2.1 has changed its API to start it). (VMA) Added a Security Howto tutorial to explain how to unit test secure Servlet code. (VMA) Updated the whole web site for Cactus 1.3 and added some FAQ entries. (VMA) Improved Cactus logging. Cactus logging is now enabled by a `cactus.enableLogging=true` property that needs to be either defined in `cactus.properties` (which also needs to be part of the server WAR if you wish to turn on logging on the server side) or by using a java parameter (`-Dcactus.enableLogging=true`). If Log4J is not in the classpath, then logging is disabled. (VMA) Added a "News" page with all news and events regarding Cactus. It is also supposed to act as a history page. (VMA) `HttpServletContextWrapper.getRequestDispatcher()` now throws `null` when the wrapped servlet context returns `null` when asked for a request dispatcher. (VMA) Thanks to Steven L. Youtsey. Fixes issue CACTUS-13. Wrapped `HttpServletRequest.getRequestURL()` (Servlet API 2.3 only) to take into account the simulated URL (if any). (VMA) Thanks to Kim Madsen. Completely reworked the internal Cactus build scripts and directory structure to make it more flexible and to prepare for the upcoming J2EE Sample application (we only have a Servlet Sample so far). (VMA) Corrected bug that prevented using testURL in runservertests with a URL that returned nothing. Also added some verbose logs. (VMA) Thanks to Aslak Hellesoy. New Web site Statistics page, using Webalizer. (VMA) Corrected issue with `getNamedDispatcher()` not returning `null` when called with a servlet name that cannot be found, as is expected by the spec. Added test cases to verify the behaviour. (VMA) Thanks to Kim Madsen. Migration tutorial that explains how to move from Cactus 1.2 to Cactus 1.3 (VMA) Cactus now supports JDK 1.4. Actually the only change made to support it was to use the `assertXXX()` methods of JUnit instead of the `assert()` one, which is now a reserved keyword in JDK 1.4. (VMA) Updated coding conventions and added target to Ant build file for automatic checking of conventions using Checkstyle. (VMA) Reformatted all sources to be compliant with our coding conventions (checked using Checkstyle). (VMA) New JBuilder5 integration tutorial. (VMA) Thanks to Sean Zhang. Added support for BASIC authentication. Thanks to Jason Robertson and Peter Wong. See class `TestServletTestCase_Authentication` in the sample unit tests for an example on how to use it. (VMA) Added `WebRequest.setRedirectorName(String redirectorName)` to override default `cactus.servletRedirectorName` parameter that you define in `cactus.properties`. This lets you define a redirector per test case if you wish. It is useful when you want to test some servlet methods that are secured and others that are not, for example. (VMA) Modified `cactus.properties` configuration parameters. For example, where you previously were writing `cactus.servletRedirectorURL = http://localhost:8080/test/ServletRedirector` you would now have 2 parameters: `cactus.contextURL = http://localhost:8080/test` and `cactus.servletRedirectorName = ServletRedirector`. (VMA) Cactus is now working again with JDK 1.2. (VMA) Thanks to Balki Nakshatrala. Added LICENSE file to all Cactus jars, in `META-INF/` directory. (VMA) Improved Tomcat 3.3 configuration that is bundled with the Cactus sample application and added `delaySocketClose="true"`, which is a new attribute of Tomcat 3.3.1. The reason is that on fast CPU Tomcat 3.3.0 is releasing too quickly opened sockets and the Cactus client side gets a "socket closed by peer" exception. (VMA) Thanks to Larry Isaacs. Added automatic script support for WebLogic 6.1. (VMA) Corrected bug in `AbstractHttpServletRequestWrapper.getPathTranslated()` which was not returning `null` when `getRealPath("/")` was returning `null`. It is allowed by the spec. to return `null` upon certain conditions (see section SRV.4.5 of the Servlet 2.3 spec.). (VMA) Add a tutorial for setting up Cactus in VAJava with Tomcat environment. (VMA) Thanks to Jim Young. Compatibility with JDK 1.2 was broken by using the `URL.getPath()` in `HttpClientHelper`. It is now fixed and should work both for JDK 1.2 and 1.3. (VMA) Thanks to Piyush Asthana. Added a `AbstractTestCase.getLogger()` method that lets any test case class get access to a logger to perform its own logging. Logs will go into the Cactus log files. (VMA) By default, the Cactus log4j configuration file defines a root category that logs to the Cactus log file with a DEBUG Priority. There is another category for the Cactus classes with a Priority of WARN so that no debug logs will be printed by default. (VMA) Cactus is now using AspectJ under the hood to provide automatic logging of entries and exits of methods (for debugging purpose) and to automatically initialise the logging subsystem. The next step is to add automatic configuration checking using AspectJ. The consequence for end users if that they now need to include the `aspectjrt.jar` jar in their classpaths (both client side and server side). It is a small jar (25ko) that is packaged in the cactus distribution. (VMA) Added new java property "`cactus.config`" to specify location of cactus properties file (you pass it on the command line, ex: "`java -Dcactus.config=conf/mycactus.properties`"). If not specified, Cactus will look for a "`cactus.properties`" file in the classpath. (VMA) New howto that explains how to use JUnitEE as a Test Runner for executing Cactus tests from within the container (i.e. Cactus client and server sides live in the same JVM in the container). (VMA) Thanks to Kaarle Kaila. Fixed bug in `MockHttpURLConnection` that was triggered by some modification in HttpUnit. It means that some Cactus 1.2 unit tests will fail if run with HttpUnit 1.2.8 (still in CVS on the 12/11/01). (VMA) Moved the Jyve FAQ to an internal FAQ - because Jyve was not always up and also so that we can have our FAQ in CVS along with the rest of the documentation. (VMA) The `getHost()` method of the `ServletURL` class returns the ":" signifing the start of the port number of the host. This has side effects in Cactus in that passing in the host name and port into the WebRequest method as "127.0.0.1:7001" will cause Cactus to use this url "http://127.0.0.1::7001". (VMA) Thanks to Chris Hazen. Fixes issue CACTUS-13. Added support for JUnit 3.8 (which has replaced the `name()` method by a `getName()` one). Note that Cactus is still supporting earlier versions of JUnit. (VMA) Added a new method: `WebRequest.setContentType(String)` (if you don't specify anything it default to "application/x-www-form-urlencoded"). This will set the content type HTTP header for the request. You can get this value from your server code by calling `HttpServletRequest.getContentType()`. (VMA) Added new method: `WebRequest.setUserData(InputStream)` to allow sending arbitrary data in the request body. Note that calling this method will invalidate any parameters that were set to be sent in the request body. (VMA) Added support for testing code which uses `HttpServletRequest.getReader()`. Note: there seems to be a bug in Orion 1.4 for using `getReader()`. It runs fine on Orion 1.5 however. (VMA) The `WebRequest.setMethod()` has been removed as deprecating it would have led to potential error difficult to locate (as Cactus default behaviour is now to pass parameter using GET, whereas before it was passing them using POST). (VMA) The existing `WebRequest.addParameter(name, value)` is now passing the parameter in the URL query string by default (same as calling `WebRequest.addParameter(name, value, WebRequest.GET_METHOD)`. (VMA) Added a new `WebRequest.addParameter(name, value, method)` where method is either "GET" or "POST". This let you choose on a fine grain level, which method you'd like to use to pass a given parameter. (VMA) Changed the way Cactus passes internal parameters to the redirectors. They were previously passed as POST parameters (in the request body). They are now passed in the query string of the URL. This is to prepare the path for supporting unit testing binary data sent to servlets (like files, ...). Thanks to Kevin Jones for raising awareness of the issue and thanks to Alvin for providing a fix. (VMA) Removed `ServletTestRequest`. It was deprecated in version 1.2 and is now removed in 1.3. You should use `WebRequest` instead. (VMA) ## Cactus 1.2 (released on September 25 2001) Added code sample for unit testing tag libs. (NDL) Tutorial for unit testing EJBs. Thanks to Hudson Wong. (VMA) Tutorial for unit testing Taglibs. (NDL) Tutorial for unit testing Servlet Filters. (VMA) `HttpServletRequestWrapper.getPathTranslated()` now takes into account any path info set up in `WebRequest.setURL()`. (VMA) Transform the `WebResponse.getText()` and `WebResponse.getTestAsArray()` so that they can be called repeatably and produce the same results. Previously the data were read from the server output stream and thus the second read was not returning anything (as it has already been read). (VMA) Cactus is now a top level Jakarta project. The package names have been changed from `org.apache.commons.cactus` to `org.apache.cactus`. (VMA) Bug fix: `getRequest()`, `getServletContext()` and `getServletConfig()` methods on the `pageContext` implicit object (available in `JspTestCase`) now returns the Cactus wrapped versions of these objects, thus taking into account the simulated URL. (VMA) Thanks to Nicholas Lesiecki. Added support for unit testing Servlet Filters (Servlet API 2.3 only) by providing a new `FilterTestCase` test case class. Also added some filter unit testing samples in the distribution. (VMA) The Cactus HTTP client was following redirects. This is wrong for unit tests as we should be able to assert returned headers, cookies, ... even for a redirect response. (VMA) Thanks to Tony Payne. Fixes issue CACTUS-9. New `WebRequest.addCookie(String theDomain, String theName, String theValue)` and `WebRequest.addCookie(Cookie theCookie)` methods for adding cookies to the request. (VMA) New `org.apache.cactus.Cookie` class that replaces the old `org.apache.cactus.util.ClientCookie` one which has been deprecated. The new Cookie class can be used in `beginXXX()` and `endXXX()` methods to manipulate cookies. (VMA) Improved cookie handling and support for domains and paths. It means that the domain need to match either the redirector host name or the host specified in the call to `setURL()`, otherwise the cookie won't get sent. If no domain is used when adding a cookie to `WebRequest` then "locahost" domain is used. The cookie path is optional and can be null. If not null, the cookie is only sent for requests starting with the path URL. (VMA) New dependency on the Jakarta Commons HttpClient component. It is used to manage client cookies, i.e. all Cactus code for managing cookies has been removed in favor of HttpClient. The consequence is that cookie handling now complies much better to the specifciation. (VMA) Modified `cactus.properties` and `web.xml` mappings (by adding a trailing forward slash to redirector URL and mappings) to support test cases that returns an HTTP status code greater than 400. Otherwise `HttpURLConnection` returns a `FileNotFoundException`. (VMA) Thanks to Ron Smith. Added a `Vector getLogs()` method to `ServletContextWrapper` that returns a vector of the log messages generated by calls to `ServletContext.log()`. This is to easily assert the content of these calls when writing test cases. (VMA) Some major refactorings and clean up of code ... (VMA) Added automatic Ant script support for Orion 1.5.x (VMA) The test result object that was placed in the `ServletContext` scope was not serializable, causing errors on IPlanet 6.x (VMA) Thanks to Navjeet Chabbewal. Added new end method signature that integrates with HttpUnit. You now have the possibility to use the full assertion power of HttpUnit in your end method. You simply need to define your end methods with the following signature: `endXXX(com.meterware.httpunit.WebResponse)`. If you don't need that power and only want to do simple asserts you can use the `endXXX(org.apache.cactus.WebResponse)` signature which will let you do simple assertions (cookies, headers, content as a String, ...). (VMA) Deprecated the way to write end methods. The new correct way is `endXXX(org.apache.cactus.WebResponse theResponse)` (it was `endXXX(HttpURLConnection theConnection)` previously). All helper methods of `AssertUtils` have been included in `WebResponse` and `AssertUtils` is now deprecated. (VMA) Deprecated `ServletTestRequest`. New correct way of writing a begin method is `beginXXX(WebRequest theRequest)`. The class methods are the same. (VMA) The Cactus `runservertests` custom Ant task will now not stop the server if it was running before the task was executed. This is to allow to run and rerun Cactus tests without starting/stopping the server every time you run the tests. (VMA) Thanks to Paul Dillon. Updated all Cactus documentation and reorganised it to better understand what Cactus is, how it works and how to use it. (VMA) The port used to start the servlet engines when running the sample tests (using the provided Ant scripts) is now configurable. This allows for not interfering with other servers running on the same port. (VMA) New tutorial for integration within JBuilder. Thanks to Cedric Chabanois and Kunal Vaishnav for providing this tutorial. (VMA) Log4j was not initialized on the server side when using JSP Redirector (it was initialized only when using the Servlet Redirector) (VMA) Thanks to Jari Worsley. `HttpServletRequestWrapper.getRequestDispatcher()` was not returning a wrapped request dispatcher, thus causing error when forward() or include() was used afterwards. (VMA) Thanks to Jari Worsley. New tutorial for integration within VisualAge for Java. Thanks to Todd Idler and Andrew B Forman for providing the information for this tutorial. (VMA) Added automatic Ant script support for Tomcat 3.3. (VMA) Now all HTTP parameters specified in the URL when using the `ServletTestRequest.setURL()` method are automatically passed as real HTTP parameters to the server side, meaning you don't have to manually call `addParameters()`. (VMA) Thanks to Jari Worsley. Fixed bug: URL encoding was applied to cookies so that when passing a special in a cookie it would get encoded when trying to retrieve it. Thanks to Jari Worsley for fixing it. (VMA) Thanks to Kunal Vaishnav. ## Cactus 1.1 (released on June 18 2001) Added automatic script support for Enhydra 3.1 (VMA) Thanks to Robert Leftwich. Tested with JUnit 3.7. (VMA) Added automatic script support for Resin 2.0 (VMA) Added logging facility to Cactus, using the Log4j logging framework. In order to make it easy on end users, Log4j is only required when building Cactus from the sources. It is however optional when running Cactus tests. If the log4j jar is present logs will be generated and if not, then no log will be generated. (VMA) With some servlet engines (like Tomcat) there is a risk that the test result will not be committed to the servlet application scope *before* the client requests the test result, thus getting a no result exception or, worse, getting the result from the previous test. Also, if the returned result is bigger than the default buffer the server would block until the client side reads the data, thus resulting in a deadlock with the above-mentionned bug. (VMA) Thanks to Bob Davison. Fixes issue CACTUS-4. Added a new mehod `AssertUtils.getResponseAsStringArray()` that returns the servlet output stream as an array of string (each line terminated by a end of line is a string) in the same spirit as the `AssertUtils.getResponseAsString()` method which returnes the result as a single string. (VMA) Corrected handling of multi-line text in `AssertUtils.getResponseAsString()` which was not handling correctly line terminators (they were skipped). (VMA) Thanks to Bob Davison. Fixes issue CACTUS-3. ## Cactus 1.0 (released on May 2 2001) Applied patch from Arun Katkere in order to prevent the "connexion reset by peer" error message that may appear in Tomcat when the connection is broken without reading the requested URL by the custom Ant tasks to start and stop a server. (VMA) Thanks to Arun Katkere. Fixes issue CACTUS-2. Added a contributing section that explains how to contribute to Cactus. (VMA) Added a license page on the Cactus web site that explains that Cactus is under the APL license. (VMA) Added a new target called `deploy-site` that automatically deploy the generated web site to its home page on the Jakarta server. This will be very useful when integrated with GUMP nightly builds so that the web site is always up to date. (VMA) Added a "assigned to" description for items assigned to someone on the todo page + lists all the developers already assigned to tasks. (VMA) Make the `ChangeLogTask` work even when not connected to the Internet (i.e. use previous `cvslog.xml` file or generate an empty one if non already exists). (VMA) Modified the Changes page so that users can see at a glance the list of pages that have been modified recently on the Cactus web site. (VMA) Display the last updated date on the Cactus web site, in the left menu (VMA) ## Cactus 1.0b2 (released on April 20 2001) Some minor refactoring of code (added `AbstractTestCase`, modified `AbstractHttpClient`, `JspHttpClient`, `ServletHttpClient`). (VMA) Add handling of multivalued HTTP headers (same header name with different values) in `ServletTestRequest`. (VMA) Thanks to Hoani Cross. Made the methods `setUp()` and `tearDown()` protected on the server side so that it is consistent with JUnit. (VMA) Modified the Ant `runservertest` task so that it also works when a servlet engine is already up and running and when a server is already stopped prior. This is to support intensive debugging mode when we don't want to start/stop the server all the time. (VMA) Thanks to Philip Aston. Added a "Cactus scope and status" page on the web site that explains the current scope and status of Cactus. (VMA) Added a "Cactus goals" page on the web site that gives rough goals and guidelines for the future of Cactus. (VMA) Improved build process so that it nows works even if junit, stylebook, .. jars are not in the `CLASSPATH` prior to running the build. (VMA) Thanks to Jeff Turner. ## Cactus 1.0b1 (released on April 9 2001) Updated the Cactus distribution so that everything is contained into one single file (doc + jars + sample). The sources are available separately in a second file. (VMA) Added a section on the main web site page to explain the reason for the Cactus name. (VMA) Tested with JUnit 3.6. (VMA) Changed the web site skin to be the Jakarta skin and not the Apache XML skin. This is because Cactus is now part of the Jakarta Commons project. (VMA) Updated the web site installation section to better explain the required steps to install Cactus. Namely, it covers installing Ant and installing the Cactus Sample application. (VMA) Removed the deliverable dependencies jar. Instead, provides a zipped installation of Ant containing the needed jars for tasks used by Cactus and Cactus Sample build files. (VMA) Removed the `misc/` directory and JBuilder files from CVS and source distribution. (VMA) Renamed the project from J2EEUnit to Cactus. Although it was a difficult decision to make, it had to be done as J2EE is a Sun trademark. Renamed all occurrences of J2EEUnit to Cactus and changed package names (from `j2eeunit.*` to `org.apache.commons.cactus.*`. (VMA) The sample application sources now contains all needed configuration files (the manifest and web.xml files were missing in the previous release). (VMA) Donated the project to the Apache Software Foundation. Changed license from GPL to APL. Moved packages from `j2eeunit.*` to `org.apache.commons.j2eeunit.*` and changed copyrights (VMA)