This was a fantastic idea! Thank you, Christoph Läubrich. I ended up building a dynamic bundle using TinyBundle containing my test resources just the way I want them arranged, and injecting it like any other bundle. I use a symbolic name to pick it back up inside the container and use the resources.
One note: I did need to put TinyBundle and BNDlib into the container to support my test resource bundle, but that wasn't a big deal. I will pack that part into a new Option or even pack the whole kit and kaboodle into a some kind of "TestResourceOption". Would this be a useful PR, or would folks rather have (as Christoph Läubrich mentions) the ability to directly include resources into the test probe (which does seem a bit simpler)? Thanks, OPS4J folks! --- A. Soroka The University of Virginia Library > On Mar 3, 2017, at 3:28 AM, 'Christoph Läubrich' via OPS4J > <ops4j@googlegroups.com> wrote: > > 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. -- -- ------------------ 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.