public static void verifyIndexFinishFlushing(Cache cache, String indexName, String regionName) throws InterruptedException { LuceneService luceneService = LuceneServiceProvider.get(cache); LuceneIndex index = luceneService.getIndex(indexName, regionName); boolean flushed = luceneService.waitUntilFlushed(indexName, regionName, 60000, TimeUnit.MILLISECONDS); assertTrue(flushed); }
public static void putEntries(LuceneService luceneService, Map<String, TrainStop> region) throws InterruptedException { region.put("Elmonica/SW 170th Ave", new TrainStop("Elmonica/SW 170th Ave", -122.85146341202486, 45.509962691078009)); region.put("Willow Creek/SW 185th Ave TC", new TrainStop("Willow Creek/SW 185th Ave TC", -122.87021024485213, 45.517251954169652)); region.put("Merlo Rd/SW 158th Ave", new TrainStop("Merlo Rd/SW 158th Ave", -122.84216239020598, 45.505240564251949)); // Lucene indexing happens asynchronously, so wait for // the entries to be in the lucene index. luceneService.waitUntilFlushed("simpleIndex", "example-region", 1, TimeUnit.MINUTES); } }
when(mockLuceneService.waitUntilFlushed(anyString(), anyString(), anyLong(), any(TimeUnit.class))) .thenReturn(true));