You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2016/04/20 14:19:25 UTC

[jira] [Comment Edited] (SLING-5667) MockBundleContext.getServiceReference(...) does not return service reference with highest ranking

    [ https://issues.apache.org/jira/browse/SLING-5667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15249738#comment-15249738 ] 

Konrad Windszus edited comment on SLING-5667 at 4/20/16 12:17 PM:
------------------------------------------------------------------

The problem is that the comparable being used is the other way round. So first the servicereference is the one with the lowest ranking! Therefore you either have to revert the order or you access the last element in https://github.com/apache/sling/blob/c9e59667d8f9cd698bc33a51f3e6a22e85d4a952/testing/mocks/osgi-mock/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java#L191 instead of the first one. We should definitely have a test for this, as this was too often wrong in the past in other places in the code.


was (Author: kwin):
The problem is that the natural order of {{ServiceReference}} is the other way round. So first the service with the lowest ranking! Therefore you either have to revert the order or you access the last element in https://github.com/apache/sling/blob/c9e59667d8f9cd698bc33a51f3e6a22e85d4a952/testing/mocks/osgi-mock/src/main/java/org/apache/sling/testing/mock/osgi/MockBundleContext.java#L191 instead of the first one. We should definitely have a test for this, as this was too often wrong in the past in other places in the code.

> 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)