I am sorry, I didn’t look closely enough. You actually sort the service 
references in the test code 
https://github.com/apache/sling/commit/898f5850c82c6a621ab8fc265fdda2ad8d18349d#diff-cb38b920345df2a5f3763908befbd29dR63
 
<https://github.com/apache/sling/commit/898f5850c82c6a621ab8fc265fdda2ad8d18349d#diff-cb38b920345df2a5f3763908befbd29dR63>.
This definitely should be fixed on the MockServiceReference IMHO. All the tests 
which rely on the wrong sorting must be fixed.


> On 28 Jan 2016, at 13:38, Konrad Windszus <[email protected]> wrote:
> 
> 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