public Set<Class<?>> getSearchClasses() { return emf.runInTrans((emgr) -> { FullTextEntityManager femg = emgr.getFullTextEntityManager(); SearchFactory sf = femg.getSearchFactory(); Set<Class<?>> itypes = sf.getIndexedTypes(); return itypes; }); }
@Test public void testAccessSearchFactory() throws Exception { SessionFactory sessionFactory = (SessionFactory) bundleContext.getService( serviceReference ); FullTextSession fullTextSession = Search.getFullTextSession( sessionFactory.openSession() ); assertNotNull( "Unable to create fulltext session from ORM Session", fullTextSession ); SearchFactory searchFactory = fullTextSession.getSearchFactory(); assertNotNull( "Unable to access SearchFactory", searchFactory ); assertEquals( "There should only be one indexed type", 1, searchFactory.getIndexedTypes().size() ); assertEquals( "Wrong indexed type", Muppet.class, searchFactory.getIndexedTypes().iterator().next() ); }
@Test public void testCreateIndexSearchEntityWithLobField() { Set<Class<?>> indexedTypes = getSearchFactory().getIndexedTypes(); assertTrue( "There should only be one indexed entity", indexedTypes.size() == 1 ); assertTrue( "Unexpected indexed type: " + getSearchFactory().getIndexedTypes(), getSearchFactory().getIndexedTypes().contains( IndexedEntity.class ) ); assertNull( "NoSearchEntity should not have a DocumentBuilderContainedEntity", getExtendedSearchIntegrator() .unwrap( ExtendedSearchIntegrator.class ) .getDocumentBuilderContainedEntity( new PojoIndexedTypeIdentifier( NoSearchEntity.class ) ) ); }