The problem is that resources are not packed inside the bundle probe.

Instead af working with classpathentries etc. directly in your test-probe, you can create a "test-resource-bundle" that includes all resources needed for the test, and include this in your test-setup, beside the resources, your bundle should include a class or interface in a package you export. You can the use MyTestResources.class.getClassloader().getResource(....) to fetch resources from there, or even create helper methods to prepare those resources (e.g. return a properties or parsed XML file or whatever). This is the most generic aproach.

You can even build a bundle on-the-fly with tinyBundles() if you do not want to create a new maven module.

Beside this, it might be a good idea to have a pax exam option to include resources in the test-probe.

Am 02.03.2017 22:10, schrieb sorok...@gmail.com:
Thanks for the advice! Maybe simple is good here. :grin:

I may end up using some facilities that are particular to my project and 
unrelated to OSGi, but if I don't, I will follow out my experiments with 
Bundle.getEntry(). On that topic, another question:

I am using Maven to build my project, in a very standard setup. I have tried 
putting test resources in my integration test module in src/main/resources and 
in src/test/resources. During the operation of the Pax Exam tests, nothing in 
those folders appears visible to Bundle.getEntry() (I double-checked with 
Bundle.findEntries() ). I've also tried sticking these resources (which are not 
Java, of course) in the actual package folders in src/test/java next to the 
code that uses them, but no luck there either.

Is there some way I can understand how the resources of a Maven module get 
translated into the bundle-structure of the test probe?

Thanks!


--
--
------------------
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