f.setName("myField");
f.setContentType(ContentType.KEYWORD);
f.setPath("entry/id");
this.schema.addSchemaField(f);
this.controller.initialize();
ServerBaseEntry e = new ServerBaseEntry();
e.setId("someId");
e.setFeedId("someId");
e.setServiceConfig(new ProvidedServiceStub());
CommitListener l = new CommitListener();
l.createLatch(1);
ServiceIndex sIndex = this.controller.indexerMap.get(this.schema.getName());
sIndex.getIndexer().registerIndexEventListener(l);
this.controller.fireInsertEvent(e);
l.waitOnLatch();
assertEquals(1,sIndex.getIndexer().optimized.get());
assertEquals(1,sIndex.getIndexer().committed.get());
sIndex.getIndexer().removeIndexEventListener(l);
e = new ServerBaseEntry();
e.setId("someId");
e.setFeedId("someId");
e.setServiceConfig(new ProvidedServiceStub());
l = new CommitListener();
l.createLatch(1);
sIndex = this.controller.indexerMap.get(this.schema.getName());
sIndex.getIndexer().registerIndexEventListener(l);
this.controller.fireUpdateEvent(e);
l.waitOnLatch();
assertEquals(2,sIndex.getIndexer().optimized.get());
assertEquals(2,sIndex.getIndexer().committed.get());
GDataSearcher<String> searcher = this.controller.getServiceSearcher(e.getServiceConfig());
List<String> results = searcher.search(new TermQuery(new Term(IndexDocument.FIELD_ENTRY_ID,"someId")),10,0,"someId");
assertEquals(1,results.size());
searcher.close();