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! --- A. Soroka The University of Virginia Library > On Mar 2, 2017, at 3:54 PM, 'Achim Nierbeck' via OPS4J > <ops4j@googlegroups.com> wrote: > > Hi, > > this is a rather interesting problem you need to solve. > As your tests do run within the OSGi environment you'll need to use some OSGi > ways of requesting the file. > Best is to include it in your classpath, as you'll never know what the actual > location on the system path is. > Right now I'd consider the Bundle.getEntry approach as being the best to > match. > > regards, Achim > > > 2017-03-02 16:19 GMT+01:00 sorok...@gmail.com <sorok...@gmail.com>: > Hi, OPS4J folks, > > I'm building up some tests using Pax Exam with Apache Camel in Apache Karaf. > The basic form of each test is just "Make an HTTP request to a given URI with > a Camel route behind it, then compare the response with a known-good answer." > > I'd like to include my known-good answers as data files (they are RDF and > have well-known serializations) instead of inline strings, but I'm not > totally sure about the best way to do that. I've been tinkering with adding > them to the source tree and using Bundle.getEntry() and so forth, but this > seems rather fragile. > > Is there an accepted pattern for this use case, i.e. bringing data files > along with the code for a test probe? > > I hope this is a reasonable question to ask this forum. Thanks for the > excellent product that is Pax Exam. It's definitely the best way to do > testing with Karaf! > > --- > A. Soroka > The University of Virginia Library > > > > -- > -- > ------------------ > 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. > > > > -- > > 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 > > > -- > -- > ------------------ > 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.