public void testGetServiceSearcher() {
this.controller.initialize();
ReferenceCounter<IndexSearcher> refCounter = this.controller.indexerMap
.get(ProvidedServiceStub.SERVICE_NAME).getSearcher();
GDataSearcher searcher = this.controller
.getServiceSearcher(new ProvidedServiceStub());
assertNotNull(searcher);
GDataSearcher sameSearcher = this.controller
.getServiceSearcher(new ProvidedServiceStub());
assertSame(refCounter, this.controller.indexerMap.get(
ProvidedServiceStub.SERVICE_NAME).getSearcher());
this.controller.commitCallBack(ProvidedServiceStub.SERVICE_NAME);
GDataSearcher newSearcher = this.controller
.getServiceSearcher(new ProvidedServiceStub());
assertNotSame(refCounter, this.controller.indexerMap.get(
ProvidedServiceStub.SERVICE_NAME).getSearcher());
sameSearcher.close();
searcher.close();
newSearcher.close();
}