Hi,
Embedding Tomcat is easy.  All you need is shown in one class,
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/startup/Embedded.html
(this link is for Tomcat 5.5, but the class changed only minimally during the
past couple of years as we've moved through Tomcat 4.0, 4.1, 5.0, and 5.5).

Make sure to look at its main method
(http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/),
as it contains a complete example, including stopping and starting individual
components of Tomcat.

There are other ways to embed Tomcat or parts thereof, mostly JMX-driven, but
we use the Embedded class above to run our own unit tests, and I suspect it's
all we need for testing log4j as well.

Yoav Shapira http://www.yoavshapira.com

--- Andy McBride <[EMAIL PROTECTED]> wrote:

> On Tue, 07 Dec 2004 20:21:48 +0100
>   Ceki G�lc� <[EMAIL PROTECTED]> wrote:
> >At 04:24 AM 12/4/2004, Andy McBride wrote:
> >
> >>Ok.  The current frenzy around the 1.3 alpha release is 
> >>great to see.  I would love
> >>to help increase the quality of the release in any way I 
> >>can.  I was hoping to find some time to start increasing 
> >>the unit test coverage and javadoc along with testing the 
> >>new functionality.
> >>
> >>Apart from the new stuff in HISTORY.txt can you suggest 
> >>any other areas in need of attention or more
> >>unit testing?
> >
> >
> >If can't think of any really easy unit test. However, if 
> >you are not
> >put of by a little challenge, checking for correct 
> >release of
> >resources (by log4j) in case of web-application recycling 
> >would really
> >be useful.
> 
> Its only interesting if it's challenging!
> 
> It would indeed be comforting to know that log4 handled 
> app-server life-cycle events correctly.  
> 
> >
> >In other words, you'd to implement test cases verifying 
> >that log4j
> >behaves properly within the target environment, say a 
> >Servlet
> >Container such as Tomcat or Jetty.  I believe this kind 
> >of
> >testing is called integration testing.
> 
> sounds right up my street.  
> 
> >
> >There are two major branches to these tests, one using a 
> >log4j.jar
> >file per web-app and the other using a single log4j.jar 
> >in conjunction
> >with JNDIContextSelector. The latter requires JNDI 
> >support from the
> >Container.
> >
> >I started by looking at Jetty with JNDI support.  The 
> >last time I
> >looked this meant 'org.mortbay.jetty.plus.jar'. 
> 
> Aha, this sheds some light.  I hit jetty dependency 
> problems building the unit tests which I mentioned on 
> another thread.  
> I was confused as I had a quick look at the jetty 
> home page and FAQ and saw nothing about JNDI support.  
> Didn't notice the JettyPlus project! 
> 
> >If you can manage to
> >embed Tomcat (instead of Jetty) into the test environment 
> >that would
> >be even better. (I made no attempts at embedding Tomcat.)
> 
> An interesting idea.  I've had a fair bit of experience 
> setting up and using tomcat but so far havn't had an 
> excuse 
> to investigate the embedded side of it yet.  I'll start 
> digging.  
> 
> >
> >In any case, even the simplest test cases would be much 
> >better than
> >what we have currently.
> >
> >Interested?  
> 
> Definitely, and any pointers Yoav could share regarding 
> tomcat embedded would be useful.  
> 
> This could also aid aid in the ability to test the new 
> JndiSubstitutionPropertyAction. 
> These tests can be built and run optionally only where 
> the dependencies are satisfied.  
> 
> Regards
> 
> Andy
> 
> >
> >>Regards
> >>
> >>Andy
> >
> >-- 
> >Ceki G�lc�
> >
> >  The complete log4j manual:  http://qos.ch/log4j/  
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: 
> >[EMAIL PROTECTED]
> >For additional commands, e-mail: 
> >[EMAIL PROTECTED]
> >
> 
> 
> The information contained in this e-mail is intended only for the person or
> entity to which it is addressed and may contain confidential and/or
> privileged material.  If You are not the intended recipient of this e-mail,
> the use of this information or any disclosure, copying or distribution is
> Prohibited and may be unlawful.  If you received this in error, please
> contact the sender and delete the material from any computer.  The views
> expressed in this e-mail may not necessarily be the views of The PCMS Group
> plc and should not be taken as authority to carry out any instruction
> contained.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to