You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Matt Madhavan <ma...@gmail.com> on 2011/03/17 18:47:52 UTC

PaxExam - How to look up an OSGi Service with jndi name based Filter String

Hello,
I'm Extending Apache Aries Blog Example to use the application devlopment
guidelines I'm creating based on Pax Construct+Pax Runner+Pax Exam.

Aries Blog sample has two datasources - simple and JTA as follows.

  <service id="xaDataSource" ref="derbyXADataSource"
interface="javax.sql.XADataSource">
  <service-properties>
    <entry key="osgi.jndi.service.name" value="jdbc/blogdb"/>
   </service-properties>
  </service>


  <service ref="derbyDataSource" interface="javax.sql.DataSource">
   <service-properties>
     <entry key="osgi.jndi.service.name" value="jdbc/blogdbnojta"/>
   </service-properties>
  </service>

Inside my ITest (PaxExam based) Test class -  I would like to use the
method   *protected <T> T getOsgiService(Class<T> type, String filter, long
timeout)* to look up the datasource.

So basically how do I construct a jndi name based filter String?

Thanks in advance!

Matt

Re: PaxExam - How to look up an OSGi Service with jndi name based Filter String

Posted by Matt Madhavan <ma...@gmail.com>.
Hello,
I tried filter string to "*osgi.jndi.service.name=jdbc/blogdbnojta*" and it
worked just fine.

Sorry must have tried this before [posting!

Thanks
Matt

On Thu, Mar 17, 2011 at 12:47 PM, Matt Madhavan <ma...@gmail.com>wrote:

> Hello,
> I'm Extending Apache Aries Blog Example to use the application devlopment
> guidelines I'm creating based on Pax Construct+Pax Runner+Pax Exam.
>
> Aries Blog sample has two datasources - simple and JTA as follows.
>
>   <service id="xaDataSource" ref="derbyXADataSource"
> interface="javax.sql.XADataSource">
>   <service-properties>
>     <entry key="osgi.jndi.service.name" value="jdbc/blogdb"/>
>    </service-properties>
>   </service>
>
>
>   <service ref="derbyDataSource" interface="javax.sql.DataSource">
>    <service-properties>
>      <entry key="osgi.jndi.service.name" value="jdbc/blogdbnojta"/>
>    </service-properties>
>   </service>
>
> Inside my ITest (PaxExam based) Test class -  I would like to use the
> method   *protected <T> T getOsgiService(Class<T> type, String filter,
> long timeout)* to look up the datasource.
>
> So basically how do I construct a jndi name based filter String?
>
> Thanks in advance!
>
> Matt
>