Hi Bertand,
your test looks invalid to me.
The Javadoc for BundleContext.getServiceReferences(…) doesn’t specify any order 
in which the services are returned 
(https://osgi.org/javadoc/r6/core/org/osgi/framework/BundleContext.html#getServiceReferences%28java.lang.Class,%20java.lang.String%29).
In your test you compare the order of MockBundleContext.getServiceReferences() 
with the order for PaxExam Bundle Context(). This is invalid as there is no 
contract stating that there is any specific order on that method.
Therefore you cannot decide which one is more correct.
IMHO we shouldn’t change the order of the MockBundleContext. 
But if there is an implementation relying on a specific order of this method, 
it must be fixed.
Konrad



> On 28 Jan 2016, at 12:23, Bertrand Delacretaz <[email protected]> wrote:
> 
> Hi,
> 
> It looks like we have another issue about the "correct" sort order for
> service rankings, details at SLING-5462 - MockServiceReference sorts
> the service rankings in the wrong direction compared to the OSGi
> framework.
> 
> Fixing MockServiceReference is probably easy, but might break existing tests.
> 
> Or people might have code that behaves wrongly in a real OSGi
> environment if it was tested with these mocks only.
> 
> So not sure how to proceed, thoughts?
> 
> -Bertrand

Reply via email to