Hi Chris If you want to enhance @TestReference, I would suggest supporting the "target" attribute that is also present in the SCR @Reference annotation[0]. It accepts an LDAP filter expression as is commonly used in OSGi. This would allow you to select your service by "component.name" or by any other property for that matter.
Regards Julian [0] https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.component.html#service.component-reference.element On Mon, Nov 16, 2020 at 6:54 PM Cris Rockwell <[email protected]> wrote: > > Hi Bertrand > > Thanks for your response. I created Jira ticket > https://issues.apache.org/jira/browse/SLING-9915 > <https://issues.apache.org/jira/browse/SLING-9915> This can be assigned to me. > > One more question: > I would like a way to disambiguate the service returned by @TestReference > when there are multiple implementations of the interface. What would you > think about an improvement such that the annotation can take a component.name > parameter? > > For example, both MyCoolServiceImpl and MyLameServiceImpl both implement > MyService interface. I want to use MyCoolServiceImpl in the test. > > @TestReference(component.name="org.package.MyCoolServiceImpl”) > MyService myCoolService > > Does it seem feasible? > > Regards > Cris > > > > > > On Nov 10, 2020, at 3:04 PM, Cris Rockwell <[email protected]> wrote: > > > > SlingAnnotationsTestRunner >
