sling-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MeriƧ Taze <merict...@gmail.com>
Subject Accessing bundles implementing same interface using TestReference annotation
Date Wed, 01 Feb 2012 13:14:27 GMT
Hi all,

I have a question about accessing bundles implementing the same
interface using TestReference annotation.
Here an example:

public interface Search {
    String search(String keyword);
}

And I have 3 classes and all implement Search interface:

OntologySearch
SolrSearch
SiteSearch

However when I use

@TestReference
Search searchRef;

public void testFunc(){
    searchRef.search("some keywords");
}

It takes OntologySearch.search(String keyword) and I can not reach
other classes.
How can I reach all of them.

In other words, I am looking for something like this in junit:
    @Reference(cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE ...
    private List<Search> searchers = new CopyOnWriteArrayList<Search>();

Thanks in advance.

Mime
View raw message