tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Writing unit tests
Date Mon, 20 Sep 2010 20:46:42 GMT

On 9/20/2010 4:33 PM, Mark Thomas wrote:
> On 20/09/2010 11:29, Christopher Schultz wrote:
>> All,
>> I'm attempting a patch for
>> and I'd like to
>> write a few unit tests for it. In the Tomcat 6.0.x trunk, I can only
>> find what appear to be 30-40 test files. Is there a test suite elsewhere
>> that I can download and augment in order to properly test my code, and
>> to test against regressions?
> Not for Tomcat 6.
> Best option is write the patch for Tomcat 7, add the test cases to the
> Tomcat 7 unit tests and then think about back-porting to 6.
> New features always go into the latest version and then get back-ported
> so you'll need to start with 7 anyway.

Gotcha. That also explains why you'd DUP'd the bug against a TC 7
enhancement. I'm glad to work on it either way.

I have this working with a small patch against the 6.0.x trunk, but I
have a few questions about it:

1. There's a method in catalina.connector.Connector called init(). When
does that get called? I had expected that it would be called after all
the setXXX attributes had be set on it from the digester upon start-up,
but it appears that Connector.init /never/ gets called. That means that
my defaults have a hard time being ... defaulted properly. I have a hack
in there that does a sanity check when checking the list of methods to
see if the current request should be parsed, but it seems like a waste
of processing time during the request itself. Should I put my "startup"
code somewhere other than Connector.init()?

2. Coding conventions seem to be applied ... inconsistently. Is there a
code style guide that I can actually follow so my code "looks right", or
should I just look at what's already there in the files I'm modifying
and take my best guess at what's appropriate?


View raw message