if you want to have your datasource injected into your test, you can also
add a timeout on that @Filter annotation.
That might help already, especially since your datasource is managed
service.

regards, Achim


2015-12-21 14:29 GMT+01:00 Tom Barber <[email protected]>:

> Okay I give up, sometimes pax exam runs okay, sometimes it doesn't, and I
> can't work out how to get it to wait for the datasource to become available.
>
> I've tried:
>
>   <reference id="emDataSource" interface="javax.sql.DataSource"
>                filter="(osgi.jndi.service.name=jdbc/userlist)"
> availability="mandatory"/>
> in blueprint
>
> and
>
>   @Inject
>   @Filter("(osgi.jdbc.driver.class=org.h2.Driver)")
>   private DataSourceFactory dsf;
>
> in the test suite and neither consistently run the test suite.
>
>
>
> On Mon, Dec 21, 2015 at 12:07 PM, Tom Barber <[email protected]>
> wrote:
>
>> Hmm yeah, although running my Karaf container in pax exam, reverts back
>> to throwing the same error, even though running it manually doesn't.....
>>
>> On Sun, Dec 20, 2015 at 9:42 PM, Jean-Baptiste Onofré <[email protected]>
>> wrote:
>>
>>> OK, it's what I thought. That's why I added the pax-jdbc feature
>>> dependency in jdbc now.
>>>
>>> Regards
>>> JB
>>>
>>> On 12/20/2015 09:29 PM, Tom Barber wrote:
>>>
>>>> Looks like I was missing pax-jdbc, although I did have 3 other pax jdbc
>>>> related features..... *facepalm*
>>>>
>>>> On Sun, Dec 20, 2015 at 5:37 PM, Jean-Baptiste Onofré <[email protected]
>>>> <mailto:[email protected]>> wrote:
>>>>
>>>>     Can you check if pax-jdbc and pax-jdbc-config feature are installed
>>>>     (boot features in your case I guess) ?
>>>>
>>>>     Regards
>>>>     JB
>>>>
>>>>     On 12/20/2015 06:00 PM, Tom Barber wrote:
>>>>
>>>>         Okay so I tried something.
>>>>
>>>>         If I unzip my distro and start it up and run jdbc:ds-list the
>>>> data
>>>>         source is listed. If I then install my persistence bundle it
>>>>         finds it.
>>>>
>>>>         If I unzip my distro and start up my persistence bundle, it
>>>> doesn't
>>>>         detect the datasource.
>>>>
>>>>         Am I missing some bootstrap?
>>>>
>>>>         Tom
>>>>
>>>>
>>>>         On Sun, Dec 20, 2015 at 3:52 PM, Jean-Baptiste Onofré
>>>>         <[email protected] <mailto:[email protected]>
>>>>         <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>>>
>>>>              Hi Tomn
>>>>
>>>>              what did you define in the cfg file ?
>>>>              Anything special in the log ?
>>>>
>>>>              I guess you use Karaf 4.0.2. Did you install the pax-jdbc
>>>>         feature:
>>>>
>>>>              feature:install pax-jdbc
>>>>
>>>>              ?
>>>>
>>>>              I fixed that in next Karaf version: now the jdbc feature
>>>>         installs
>>>>              pax-jdbc (it wasn't the case before).
>>>>
>>>>              Regards
>>>>              JB
>>>>
>>>>              On 12/20/2015 11:21 AM, Tom Barber wrote:
>>>>
>>>>                  Hello folks
>>>>
>>>>                  i have a datasource define in
>>>>         etc/org.ops4j.datasource-users.cfg
>>>>
>>>>                  When I install my feature I have a persistence bundle
>>>> that
>>>>                  starts but I get:
>>>>
>>>>                  apache.aries.jpa.container - 1.0.2 | The DataSource
>>>>
>>>>         osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
>>>>         <http://osgi.jndi.service.name>
>>>>                  <http://osgi.jndi.service.name>
>>>>                  <http://osgi.jndi.service.name>=userlist) required by
>>>>         bundle
>>>>                  bi.meteorite.persistence/1.0.0.SNAPSHOT could not be
>>>> found.
>>>>
>>>>                  And my bundle hangs in grace period.
>>>>
>>>>                  If I then stop and start karaf all my bundles start.
>>>>
>>>>                  So how do I get it to find the datasource before trying
>>>>         to start my
>>>>                  bundle with blueprint?
>>>>
>>>>                  Thanks
>>>>
>>>>                  Tom
>>>>
>>>>
>>>>              --
>>>>              Jean-Baptiste Onofré
>>>>         [email protected] <mailto:[email protected]>
>>>>         <mailto:[email protected] <mailto:[email protected]>>
>>>>         http://blog.nanthrax.net
>>>>              Talend - http://www.talend.com
>>>>
>>>>
>>>>
>>>>     --
>>>>     Jean-Baptiste Onofré
>>>>     [email protected] <mailto:[email protected]>
>>>>     http://blog.nanthrax.net
>>>>     Talend - http://www.talend.com
>>>>
>>>>
>>>>
>>> --
>>> Jean-Baptiste Onofré
>>> [email protected]
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>>
>>
>>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Reply via email to