On 29.04.2009, at 03:55, Julien Bertholino wrote:
Hi all,
I'm new to pax world and was wondering how to use pax-exam with
Declarative Services. Say, is there any way to inject a
ComponentContext to a pax-exam test class? (in the same way it is
done for BundleContext)
Not sure about that because the test is just a normal class (not a DS
component).
However, if you are looking for "high-level" method to get services, I
used an OSGi Helper with pax:exam. This object provides useful methods
to interact with services and bundles. You can find it on http://svn.apache.org/viewvc/felix/trunk/ipojo/tests/api/src/test/java/org/apache/felix/ipojo/tests/api/
.
Using such helper is simple:
in a @Before method you create your helper by giving the bundle context.
in a @After method you dispose the helper object (this will release
every get services....)
@Before
public void init() {
osgi = new OSGiHelper(context);
}
@After
public void stop() {
osgi.dispose();
}
Alin was thinking about providing such kind of helper object in pax-
exam but I'm not sure if he did it or if he plan to do it.
Clement
Cheers,
Julien
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general