[SJN-75] Using simple-jndi for testing with Maven 2 | |
| Status: | Closed |
| Project: | Simple-JNDI |
| Component/s: | |
| Affects Version/s: | 0.11.1 |
| Fix Version/s: | 0.11.3 |
| Type: | Improvement | Priority: | Major |
| Reporter: | Paul Spencer | Assignee: | Henri Yandell |
| Resolution: | Fixed | ||
| Environment: | Maven 2.0.4<br/> | ||
| Description |
| I am using Simple-JNDI to define a datasource used during unit testing. The project used Maven 2 as the build tool. 1) Add simple-jndi dependency to pom.xml: <dependency> <groupId>simple-jndi</groupId> <artifactId>simple-jndi</artifactId> <version>0.11.1</version> <scope>test</scope> <exclusions> <!-- See Simple-JNDI Issue <exclusion> <groupId>javax.sql</groupId> <artifactId>jdbc-stdext</artifactId> </exclusion> </exclusions> </dependency> 2) Add you jdbc driver to the dependency with <scope>test</scope> to pom.xml: 3) Tell the JVM to use simple-jndi by creating jndi.properties in the test resource directory. By default the directory is src/test/resources. jndi.properties contains the following lines. The properties org.osjava.sj.colon.replace and org.osjava.sj.delimiter are used because the application being tested will run on a tomcat server. java.naming.factory.initial=org.osjava.sj.SimpleContextFactory org.osjava.sj.root=src/test/resources/simple-jndi org.osjava.sj.colon.replace=-- org.osjava.sj.delimiter=/ 4) Create the files to define the JNDI datasource myDataSource. Please note the directory below is in the directory defined by os.java.js.root. /java--comp /env default.properties default.properties contains the following: myDataSource/type=javax.sql.DataSource myDataSource/driver=<jdbc driver class> myDataSource/url=<jdbc url> myDataSource/user=foo myDataSource/password=bar Please incorporate this into the documentation. |
| Comment by bayard [ Sun, 6 Apr 2008 01:33:04 -0700 (PDT) ] |
| svn ci -m "Adding the Maven2 page from Paul Spencer - Sending manual/Configuring.xml Adding manual/ConfiguringWithMaven2.xml Sending manual/GeneralDesign.xml Sending manual/index.xml Transmitting file data .... Committed revision 2671. |