I am trying to execute a TestNG test case in a SpringDM bundle which uses the Spring TestContext framework to test an OSGi service exposed by another bundle. My issue is that the @ContextConfiguration directive does not work as expected and the service dependency is not injected. I even try to invoke a local bean, something which works outside of springDM, and that does not work either. It seems as if @ContextConfiguration has problems in SpringDM. Is it supposed to work and has anyone tried it?
I have attached my sample provider and sample consumer bundles, based on examples provided by Spring source. The TestExecutionComponent class is @Component, which launches TestNG in the @PostConstruct method. The test class is launches is TeamAdminServiceTests. There are three context files under META-INF/spring: module-context.xml, osgi-context.xml, and test-context.xml.
I have also attached the trace files.
If I point the @ContextConfiguration annotation in TeamAdminServiceTests to test-context.xml, nothing is injected. If I point it to module-context.xml or osgi-context.xml, it tells me the bindings for the XML file could not be found.
Any ideas would be very appreciated, as I have been stuck on this for a few days and starting to wonder if the TestContext framework is supposedto work at all in SpringDM.