View Full Version : Spring DM unit test
growing
May 22nd, 2008, 11:14 AM
I have two osgi bundle projects, A and B. Component of B refer to component of A, which declared as osgi service. Can I test the component of B outside of osgi container? Because it refer to the component of A, how does it get the reference of A? I means can I test it without using inherite from "AbstractConfigurableBundleCreatorTests" class and implement the method such as "getManifestLocation", "getTestBundlesNames"?
Costin Leau
May 24th, 2008, 05:45 AM
If you want to do unit testing then don't use Spring-DM testing framework. simply take the object that you need (in your case component B) inject its dependencies either using mocks, stubs or even actual implementations and then apply your tests.
Spring-DM provides a mocking package for OSGi which is quite useful - we make heavy use of it internally in our unit tests.
The mocking library along with mocking through EasyMock can go a long way.
growing
Jun 1st, 2008, 10:00 AM
Thanks a lot. I'll try.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.