[
https://issues.apache.org/jira/browse/SLING-12385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bart Thierens updated SLING-12385:
----------------------------------
Summary: OSGi mock context seems to not take service ranking into account
(was: OSGi mock context seems to not take into account service ranking)
> OSGi mock context seems to not take service ranking into account
> ----------------------------------------------------------------
>
> Key: SLING-12385
> URL: https://issues.apache.org/jira/browse/SLING-12385
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Affects Versions: Testing OSGi Mock 3.4.2
> Reporter: Bart Thierens
> Priority: Major
>
> Logging this issue here as I can't log it in github. I assume this is the
> correct approach.
> I am unable to make my registered services in a test case mimick the same
> ordering behaviour than in an actual OSGi environment. The
> AemContext/AemContextImpl/SlingContextImpl/OsgiContextImpl does not respect
> the `@ServiceRanking` annotation, nor the component property
> "service.ranking".
> It seems vital to be able to test that a certain part of application logic
> executes certain services in order, and that seems impossible now - unless
> the developer registers the services exactly in the order he expects them,
> which beats the purpose of the test.
> If this is documented behaviour, I can't find it anywhere... (And it's still
> not correct imho)
> Personal use case: A certain component that has "processors" (which are
> components implementing a single service) that are ordered by service ranking
> (low = first, high = later). When a service is disabled/unregistered,
> registered or even re-registered, the order must stay consistent (low =>
> high). This actually works perfectly, but not in test-cases.
> I created a demo (AEM) project that showcases this problem:
> [https://github.com/senn/aemcontext-no-serviceranking-ordering]
> It contains tests for the various context implementations and also a separate
> branch that has the same issue without `@ServiceRanking` and with the
> "service.ranking" properties.
> I don't have a fix ready, but might look into it in a few weeks when I have
> time.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)