[
https://issues.apache.org/jira/browse/SLING-5667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15249716#comment-15249716
]
Stefan Seifert commented on SLING-5667:
---------------------------------------
this should already work as expected? - but i've not verified it in detail.
{{getServiceReference}} returns the first one from the list returned by
{{getServiceReferences}}, which uses a TreeSet to sort all returned service
references, and the {{MockServiceReference}} implements a comarable based on
{{ServiceUtil.getComparableForServiceRanking}}.
the error is perhaps that getServiceReferences always returns a correct order
where it is not expected by the OSGi interface. although this is not explicitly
an error it may lead to false assumptions in unit tests.
> MockBundleContext.getServiceReference(...) does not return service reference
> with highest ranking
> -------------------------------------------------------------------------------------------------
>
> Key: SLING-5667
> URL: https://issues.apache.org/jira/browse/SLING-5667
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Affects Versions: Testing OSGi Mock 2.0.2
> Reporter: Konrad Windszus
>
> According to
> https://osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#getServiceReference%28java.lang.Class%29
> the service reference being returned must be the one with the highest
> ranking. Currently it returns just any service reference.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)