I have a Maven project that builds a very simple OSGi bundle. No activator; it's only job is to deliver some shared code to an OSGi project. I want to test that I have got the dependencies all set up and embedded correctly.
So, I've added pax-exam to the situation.
I'll paste a unit test shell at the end of this. Is my @Test method in fact running inside of a bundle that is in turn depending on the bundle built in my project?
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerClass.class)
public class CommonBundleTest {
@Configuration
public Option[] config() {
return options(
// this is the current project's result artifact
mavenBundle("com.basistech.osgi", "rosette-common-java-lib"),
junitBundles()
);
}
@Test
public void atest() {
}
}
Are the tests running inside of a bundle: yes Pax Exam creates a TinyBundle for the Unit test itself. But it doesn't add extra dependencies on any bundle declared in the config method.
If you want to make sure those packages are imported you can alter the way the TinyBundle is build.