p6spy for unit testing not for integration test

82 views
Skip to first unread message

Ricardo Cunha

unread,
Jun 20, 2014, 3:33:45 PM6/20/14
to p6spy...@googlegroups.com
Hi, I want use a p6spy for unit testing so, my data source has a simple propertie file with url, user and password. My real database is an oracle.

My Connection for junit is:

OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource();
ds.setURL(prop.getProperty("jdbc.url"));
ds.setUser(prop.getProperty("jdbc.username"));
ds.setPassword(prop.getProperty("jdbc.password"));
   ic.bind("java:/efomentoDS", ds);


So I try to change for:

OracleConnectionPoolDataSource ds = new OracleConnectionPoolDataSource();
ds.setURL(prop.getProperty("jdbc.url"));
ds.setUser(prop.getProperty("jdbc.username"));
ds.setPassword(prop.getProperty("jdbc.password"));
P6DataSource myDs = new P6DataSource(ds);
myDs .setRealDataSource("java:/efomentoDS");
   ic.bind("java:/efomentoDS", myDs );


Any help on this?


Quinton McCombs

unread,
Jun 20, 2014, 10:00:05 PM6/20/14
to p6spy users on behalf of Ricardo Cunha
What sort of problem are you having?  Do you get a stack trace?  

If you can make a code change when you retrieve the data source from the JNDI lookup, your integration will be simpler.  For example:

DataSource ds = getDataSourceFromJNDI(jndiName);

would become

DataSource ds = new P6DataSource(getDataSourceFromJNDI(jndiName));



--
You received this message because you are subscribed to the Google Groups "p6spy users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p6spy-users...@googlegroups.com.
To post to this group, send email to p6spy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/p6spy-users/fd8c91eb-7d06-4ba8-a25d-923e0536ed82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages