tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fraser, James" <James.Fra...@dsto.defence.gov.au>
Subject RE: Embedded tomcat and unit testing.. Tomcat either stops or my unit tests don't execute? [SEC=UNCLASSIFIED]
Date Wed, 15 Jun 2011 23:27:43 GMT
UNCLASSIFIED

Thanks Chris! 

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net]
Sent: Thursday, 16 June 2011 5:01 AM
To: Tomcat Users List
Subject: Re: Embedded tomcat and unit testing.. Tomcat either stops or
my unit tests don't execute? [SEC=UNCLASSIFIED]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

James,

On 6/15/2011 12:09 AM, Fraser, James wrote:
> Thanks for your help. I got it working in the end. I suspect the main 
> problem had to do with not terminating the running instance of Tomcat 
> correctly in a tear-down method.

That might do it, depending on what resource was under contention (such
as a port number).

Also, calling Tomcat.getServer().await() is /intended/ to block until
the server shuts down. If you run that in your test setup, the test will
never run because it's waiting for Tomcat to shut down.

Instead, I suspect you want to do everything but the "await" in your
test setup, and as you discovered, make sure you shut it down in your
teardown code.

As Chuck points out, Tomcat's internal unit-testing code uses the Tomcat
class and can serve as a useful set of examples if you need further
inspiration.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk35CHgACgkQ9CaO5/Lv0PABxQCeOeNtdE7PjvoyuSDywzV3WSla
2PkAnRWemhH6FeJJ8PlnXT3rfFuhBgRa
=JYsd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


IMPORTANT: This email remains the property of the Department of Defence
and is subject to the jurisdiction of section 70 of the Crimes Act 1914.
If you have received this email in error, you are requested to contact
the sender and delete the email.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message