Hi Mike,

So basically you are asking for mocking OSGi services in order to satisfy
dependencies for the service under test, right ?
Well Pax Exam itself will not help you directly but it does not have to.

Some ideas:

- You could write a mock bundle yourself (probably a lame approach, but if
you create mock bundles per subsystem - not for each single bundle - then it
could be a worthwhile approach) -> Benefit: you can use that mock bundle
elsewhere, too.

- Use Tinybundles to create a bundle on-the-fly which registers mock
versions of your services. [1].

- Last but not least the probably simpliest and most straightforward option:
create & reigster the mocked services inside your test. Like you do with
unit-tests, too. You've got everyrhing you need: decent mock fw (mockito for
example), the BundleContext in order to register the service.
For this approach you need to have scheduling in place for the services to
wire up and resolve (that also depends on the higher level service framework
you use.)

WDYT?

Toni

[1] http://wiki.ops4j.org/display/paxexam/ExamAndTinybundles


On Thu, Feb 17, 2011 at 12:35 AM, Mike Smoot <[email protected]> wrote:

> Hi,
>
> I'm currently using pax-exam in a simple integration test that just checks
> to see if the expected services get registered when the bundle starts.  This
> is meant to be a compile time check that my Spring configuration is OK.
>  This works great in cases with few dependencies, however some bundles
> require many services to be present before properly starting.  I'm wondering
> if there's an easy way to provide mock versions of these services using
> pax-exam?
>
> thanks,
> Mike
> --
> ____________________________________________________________
> Michael Smoot, Ph.D.
> UCSD Department of Medicine
> tel: 858-822-4756
>
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/general
>
>


-- 
*Toni Menzel - http://www.okidokiteam.com*
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to