Yup maybe it would be nice to be able to removeResource() with a wildcard pattern.
However I am curious about a way to get the job done with modifyBundle(stream) ... .build(withBnd()) I need to retain only the JUnit code and re-generate imports for everything else. I tried like this: modifyBundle(probe) .removeHeader(IMPORT_PACKAGE) .removeHeader(DYNAMICIMPORT_PACKAGE) .removeHeader(EXPORT_PACKAGE) .set("Private-Package", getClass().getPackage().getName()) //Test code package. .build(withBnd()); It seems that no matter how I try if I use BND I get basically the same huge Export-Package, Import-Package clauses and also the test probe always contains all the code found in /src/test/java. I expected BND to honor Private-Package and rebuild the bundle with only that stuff inside. Rude of me huh? :) Cheers, Todor Toni Menzel wrote: > On Mon, Dec 21, 2009 at 4:10 PM, Toni Menzel <t...@okidokiteam.com> wrote: > >> >> On Mon, Dec 21, 2009 at 4:07 PM, Todor Boev <rinsv...@gmail.com> wrote: >> >>> On Mon, Dec 21, 2009 at 4:18 PM, Toni Menzel <t...@okidokiteam.com>wrote: >>> >>>> well, thats possible but not too simple. >>>> There are different approaches: >>>> - give the auxiliary and test code different source folders. (exam just >>>> packs the one where the test sits in) >>>> >>> How can I do that with maven? Or you mean I can make a separate maven >>> project where all the tiny bundle code will live? >>> >> yes.. Tinybundles loads from classpath.. so it does not care where the >> stuff comes from physically. >> > http://issues.ops4j.org/browse/PAXSB-32 > So, once we support that, you lose that "feature". > >> >>> - remove the unwanted classes using >>>> http://paxexam.ops4j.org/display/paxexam/How+to+customize+the+test+environment(see >>>> customizeTestProbe) >>>> >>> Yup this worked :) However for some reason ".build(withBnd())" did not >>> work. The plan was to remove the BND generated Export-Packages header and >>> just add a Private-Packages header for the single package where the JUnit >>> code is. In the end I used the brute force approach :P >>> >>> new Customizer() { >>> @Override >>> public InputStream customizeTestProbe(InputStream probe) throws >>> IOException { >>> return modifyBundle(probe) >>> .removeHeader(EXPORT_PACKAGE) >>> .removeHeader(DYNAMICIMPORT_PACKAGE) >>> .set(IMPORT_PACKAGE, >>> "org.ops4j.peaberry.activation.invocations, " + >>> "org.ops4j.peaberry.activation.examples.export, " + >>> "org.ops4j.peaberry.activation.examples.singleton, " + >>> "com.google.inject; resolution:=optional, " + >>> "com.google.inject.binder; resolution:=optional, " + >>> "com.google.inject.matcher; resolution:=optional, " + >>> "org.aopalliance.intercept; resolution:=optional, " + >>> "junit.framework; resolution:=optional, " + >>> "org.junit; resolution:=optional, " + >>> "org.junit.runner; resolution:=optional, " + >>> "org.ops4j.pax.exam; resolution:=optional, " + >>> "org.ops4j.pax.exam.junit; resolution:=optional, " + >>> "org.ops4j.pax.exam.options; resolution:=optional, " + >>> "org.ops4j.pax.swissbox.tinybundles.core; >>> resolution:=optional, " + >>> "org.ops4j.peaberry; resolution:=optional, " + >>> "org.ops4j.peaberry.activation; resolution:=optional, " + >>> "org.ops4j.peaberry.builders; resolution:=optional, " + >>> "org.ops4j.peaberry.util; resolution:=optional, " + >>> "org.osgi.framework") >>> >>> >>> .removeResource("org/ops4j/peaberry/activation/invocations/InvocationLog.class") >>> >>> .removeResource("org/ops4j/peaberry/activation/invocations/InvocationLogModule.class") >>> >>> .removeResource("org/ops4j/peaberry/activation/invocations/internal/Activator.class") >>> >>> .removeResource("org/ops4j/peaberry/activation/invocations/internal/InvocationLogImpl.class") >>> >>> .removeResource("org/ops4j/peaberry/activation/invocations/internal/LoggingInterceptor.class") >>> >>> >>> .removeResource("org/ops4j/peaberry/activation/examples/singleton/Config.class") >>> >>> .removeResource("org/ops4j/peaberry/activation/examples/singleton/SingletonRoot.class") >>> >>> >>> .removeResource("org/ops4j/peaberry/activation/examples/export/Config.class") >>> >>> .removeResource("org/ops4j/peaberry/activation/examples/export/Hello.class") >>> >>> .removeResource("org/ops4j/peaberry/activation/examples/export/HelloImpl.class") >>> >>> .build(); >>> } >>> >> Uppss.. yes, guess a filter support ("*") would be good, he ? >> >>> >>> - wait for 2.0 release (scheduled for 1Q 2010 but.. maybe you dont wait >>>> ;)) >>>> >>> Is there a design document or something I can check out to see what's >>> coming? :) >>> >> mmhh.. mostly in my head, but probably its good to share thoughts on >> christmas.. >> >> >>> >>>> Toni >>>> >>> Cheers, >>> Todor >>> >>> -- >>> Go on! Destroy the fabric of the universe! See if I care! >>> >> >> >> -- >> Toni Menzel >> Independent Software Developer >> Professional Profile: http://okidokiteam.com >> t...@okidokiteam.com >> http://www.ops4j.org - New Energy for OSS Communities - Open >> Participation Software. >> >> > > _______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general