You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Oliver Lietz <ap...@oliverlietz.de> on 2017/03/01 12:58:12 UTC

new module resource presence

Hi,

I've added a new little module (SLING-6582) which announces presence of 
resources as OSGi services. For now a presenter per resource needs to be 
configured with a resource path. More sophisticated presenters can be added 
later (e.g. managing multiple resources or registering a single service for 
multiple resources or handling of resource provider events...) – but this is 
the very first shot.

The most prominent use case (but not the only one) is testing when resources 
are involved. Instead of polling and retrying queries (pattern often used by 
launchpad tests) one can reference a resource presence service using a path 
property.

For Pax Exam you add a factory configuration with resource path and reference 
the service in your test class:

    @Inject
    @Filter(value = "(path=/content/foo/bar)")
    private ResourcePresence bar

Tests will be executed only if resource /content/foo/bar is present (installed 
by content loader or whatever).

Any feedback is welcome.

Regards,
O.