@Test public void testBatchIndexing() throws Exception { SessionFactory sessionFactory = (SessionFactory) bundleContext.getService( serviceReference ); FullTextSession fullTextSession = Search.getFullTextSession( sessionFactory.openSession() ); AssertingMassIndexerProgressMonitor progressMonitor = new AssertingMassIndexerProgressMonitor( 0 ); fullTextSession.createIndexer( Muppet.class ).progressMonitor( progressMonitor ).startAndWait(); progressMonitor.assertExpectedProgressMade(); persistElmo( fullTextSession ); progressMonitor = new AssertingMassIndexerProgressMonitor( 1 ); fullTextSession.createIndexer( Muppet.class ).progressMonitor( progressMonitor ).startAndWait(); progressMonitor.assertExpectedProgressMade(); }
private void massIndexFooInstances(MassIndexerProgressMonitor monitor) throws InterruptedException { FullTextSession fullTextSession = Search.getFullTextSession( openSession() ); MassIndexer massIndexer = fullTextSession.createIndexer( Foo.class ); massIndexer.progressMonitor( monitor ); massIndexer.startAndWait(); fullTextSession.close(); }
@Test public void testAllRelevantProgressMonitoringOperationsCalled() throws InterruptedException { // let mass indexer re-index the data in the db (created in initializeData()) AssertingMassIndexerProgressMonitor monitor = new AssertingMassIndexerProgressMonitor( 10, 10 ); fullTextSession.createIndexer( LegacyCar.class ) .progressMonitor( monitor ) .startAndWait(); fullTextSession.createFullTextQuery( new MatchAllDocsQuery(), LegacyCar.class ) .getResultSize(); monitor.assertExpectedProgressMade(); }
private void reindexAll() throws InterruptedException { FullTextSession fullTextSession = builder.openFullTextSession(); SilentProgressMonitor progressMonitor = new SilentProgressMonitor(); Assert.assertFalse( progressMonitor.finished ); try { fullTextSession.createIndexer( Object.class ) .threadsForSubsequentFetching( 8 ) .threadsToLoadObjects( 4 ) .batchSizeToLoadObjects( 30 ) .progressMonitor( progressMonitor ) .startAndWait(); } finally { fullTextSession.close(); } Assert.assertTrue( progressMonitor.finished ); }