You can use the new PreHook of pax-jdbc.
It allows to run an OSGi service before the datasource is published.

This can be used in production and test for db migration as well as for setup of a temp db before each test.

This is an example for a migration hook:
https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/service/src/main/java/net/lr/tutorial/db/service/Migrator.java

and this is how to use it in the config:
https://github.com/cschneider/Karaf-Tutorial/blob/master/liquibase/org.ops4j.datasource-person.cfg

Christian


On 24.08.2017 09:36, karsten.bl...@hermes-ottoint.com wrote:
Hello everybody,
i am running pax exam 4 with a karaf 3 container.
The bundle under test is a camel 2.16.3 bundle.
The bundle uses a time triggered camel jpa component and pax-jdbc with (XA and pooling) to instantiate the datasource.
For the test i need some table and some test data in a schema.
If i run the test with an existing postgres database everything is fine. If i try to instantiate and setup the database first (H2 or Derby) the bundle under test does not
find the database with the jndi name:
javax.naming.NameNotFoundException: osgi:service/javax.sql.DataSource/"(osgi.jndi.service.name=jdbc/scv_xa)"

How can i startup and setup the temporary db before the bundle under test is started?

Thanks and best regards
Karsten
--
--
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+unsubscr...@googlegroups.com <mailto:ops4j+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.


--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

--
--
------------------
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to