This content has been marked as final.
Show 4 replies
-
1. Re: Testing database interaction using JUnit
cluck Jan 6, 2004 9:58 AM (in response to joshlam)Can't you just look up the Datasource through JNDI?
-
2. Re: Testing database interaction using JUnit
joshlam Jan 6, 2004 11:35 AM (in response to joshlam)Yes but the jndi definitions are in the oracle-ds.xml and I need to do something like:
DataSource dataSource = null;
InitialContext naming = new InitialContext();
dataSource = (DataSource)naming.lookup("java:/OracleDS");
Connection aConn = dataSource.getConnection();
within JUnit to get the DataSource that jBoss returns.
However, I do not know how to run JUnit within the jBoss environment. -
3. Re: Testing database interaction using JUnit
darranl Jan 8, 2004 8:26 AM (in response to joshlam)Have a look at Cactus :-
http://jakarta.apache.org/cactus/index.html
It is an enhancement to the JUnit testing framework that allows you to execute unit tests inside the container. -
4. Re: Testing database interaction using JUnit
joshlam Jan 11, 2004 1:59 AM (in response to joshlam)Thanks! That is exactly what I am looking for and there is also good examples on how this can be done in the book JUnit In Action.