Hello,
yes this might help.
Bundle under test is a blueprint bundle with a camel jpa endpoint/component
<bean
id="jpa"
class="org.apache.camel.component.jpa.JpaComponent">
<jpa:unit
unitname="shipment"
property="entityManagerFactory" />
<property
name="transactionManager"
ref="transactionManager" />
</bean>
and a persistence.xml
<persistence-unit
name="shipment"
transaction-type="JTA">
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/scv_xa)</jta-data-source>
a running live pax-jdbc configuration
this works also for the pax exam test
osgi.jdbc.driver.name = PostgreSQL JDBC Driver-pool-xa
databaseName=scv
dataSourceName=jdbc/scv_xa
user=xxx
password=xxx
url = jdbc:postgresql:// 155:155:155:155:5432/scv
What does not work:
A pax exam pax-jdbc configuration which I expect starts up the db before
starting the test like:
osgi.jdbc.driver.name=derby-pool-xa
databaseName=scv
dataSourceName=jdbc/scv_xa
user=xxx
password=xxx
url=jdbc:derby:target/scvdev;create=true;user=xxx;password=xxx
or similar with H2
For the different test methods I need different test data inserted into the db.
So a single startup script is not sufficient.
For the pax exam tests
How can a startup the db, modify it per test method and publish it so that the
probe and the bundle under test can access it?
Regards
Karsten
From: laeubi.mobile via OPS4J [mailto:[email protected]]
Sent: Dienstag, 29. August 2017 15:37
To: OPS4J
Subject: Re: Setup database structure before bundle under test is started with
pax exam + karaf
You should provide a little more info about your setup, e.g. "working" vs "not
working" configs, how you run the camel bundle (bluprint? spring?
Routebuilders?)
I assume you want to test the route itself not the pax-jdbc setup, then you
should configure your datasource that way that it can either run from JNDI or
or a local jdbc-url to make testing easier.
You can the provide a config for test and one for deployment that contains
either jndi or plain jdbc with e.g. inmemory db of h2 (which can be configured
to init the db from a file).
Am Donnerstag, 24. August 2017 09:36:05 UTC+2 schrieb
[email protected]<mailto:[email protected]>:
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<http://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 -
[email protected]<mailto:[email protected]>
---
You received this message because you are subscribed to a topic in the Google
Groups "OPS4J" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ops4j/F1YhX1Fvq_Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
--
------------------
OPS4J - http://www.ops4j.org - [email protected]
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.