The changes below are important changes visible to the user. Small scale changes that are not externally visible are available from the Cactus CVS using the cvs log feature or using the ViewCVS interface.
cactus.jar
in your
WEB-INF/lib
directory).
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).
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.
HttpServletContextWrapper.getRequestDispatcher()
now throws
null
when the wrapped servlet context returns
null
when asked for a request dispatcher.
HttpServletRequest.getRequestURL()
(Servlet API
2.3 only) to take into account the simulated URL (if any).
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.
assertXXX()
methods of JUnit instead of
the assert()
one, which is now a reserved keyword in
JDK 1.4.
TestServletTestCase_Authentication
in the sample unit
tests for an example on how to use it.
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.
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
.
META-INF/
directory.
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.
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.).
URL.getPath()
in HttpClientHelper
. It is now
fixed and should work both for JDK 1.2 and 1.3.
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.
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.
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.
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).
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".
name()
method by a getName()
one). Note that Cactus is still
supporting earlier versions of JUnit.
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()
.
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.
HttpServletRequest.getReader()
. Note: there seems to be
a bug in Orion 1.4 for using getReader()
. It runs fine
on Orion 1.5 however.
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).
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)
.
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.
ServletTestRequest
. It was deprecated in version
1.2 and is now removed in 1.3. You should use WebRequest
instead.
HttpServletRequestWrapper.getPathTranslated()
now takes
into account any path info set up in WebRequest.setURL()
.
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).
org.apache.commons.cactus
to
org.apache.cactus
.
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.
FilterTestCase
test case class. Also
added some filter unit testing samples in the distribution.
WebRequest.addCookie(String theDomain, String
theName, String theValue)
and
WebRequest.addCookie(Cookie theCookie)
methods for
adding cookies to the request.
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.
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.
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
.
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.
ServletContext
scope was not serializable, causing errors
on IPlanet 6.x
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, ...).
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.
ServletTestRequest
. New correct way of writing
a begin method is beginXXX(WebRequest theRequest)
. The
class methods are the same.
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.
HttpServletRequestWrapper.getRequestDispatcher()
was not
returning a wrapped request dispatcher, thus causing error when
forward() or include() was used afterwards.
ServletTestRequest.setURL()
method are automatically
passed as real HTTP parameters to the server side, meaning you don't
have to manually call addParameters()
.
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.
AssertUtils.getResponseAsString()
which was not handling
correctly line terminators (they were skipped).
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.
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).
AbstractTestCase
,
modified AbstractHttpClient
, JspHttpClient
,
ServletHttpClient
).
ServletTestRequest
.
setUp()
and tearDown()
protected on the server side so that it is consistent with JUnit.
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.
CLASSPATH
prior to running the build.
misc/
directory and JBuilder files from CVS
and source distribution.
j2eeunit.*
to org.apache.commons.cactus.*
.
j2eeunit.*
to org.apache.commons.j2eeunit.*
and changed copyrights