Re: [Httpunit-develop] ServletUnit -- How to ac quire data sources?

Russell Gold <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
On Apr 2, 2006, at 4:28 PM, Gordon Henriksen wrote:

> I'm evaluating ServletUnit for a new project. It's our first major  
> server-side Java project.
>
> ServletUnit looks like a useful framework (as long as it's  
> conforming and un-buggy, anyhow), but I've got one question before  
> I move ahead. How do I configure ServletUnit to create a JDBC data  
> source? I'd like the servlet under test to be able to retrieve a  
> database connection from JNDI much as if it were configured in the  
> application server.

ServletUnit only emulates the servlet container. To use JNDI as  
though you were running in a full app server, the simplest thing to  
do would be to make an implementation of InitialContextFactory that  
could produce a Context that has the desired sources already bound in  
it and then create a java.properties file that references that factory.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.