torsdag 8. mai 2008

JNDI in JUnit tests

Sun har også en provider som kan brukes - se jndi-tutorial.
I ended up using Simple-JNDI - simple-jndi, thanks to:
James Strachan's Weblog
Injecting Constants as Spring Bean Properties | Unicon

My setup for lookup-key "java:comp/env/jdbc/ds":

jndi.properties:
java.naming.factory.initial=org.osjava.sj.SimpleContextFactory
org.osjava.sj.root=${project.build.directory}\\test-classes\\jndi
org.osjava.sj.colon.replace=--
org.osjava.sj.delimiter=/

src/test/resources/jndi/java--comp/env/jdbc/ds.properties:
type=javax.sql.DataSource
driver=oracle.jdbc.OracleDriver
url=${db.url}
user=${db.user}
password=${db.password}



Ingen kommentarer: