@Test public void testReindex() { final SearchIndexManager searchIndexManagerMock = context.mock(SearchIndexManager.class); final EntityManager emMock = context.mock(EntityManager.class); context.checking(new Expectations() { { one(searchIndexManagerMock).reindexEntities(TestClass1.class, fullTextSessionMock); one(searchIndexManagerMock).reindexEntities(TestClass2.class, fullTextSessionMock); } }); EntityReindexerTester reindexer = new EntityReindexerTester(); reindexer.setFullTextSession(fullTextSessionMock); reindexer.setSearchIndexManager(searchIndexManagerMock); reindexer.setEntityManager(emMock); reindexer.setEntitiesToReindex(new Class[] { TestClass1.class, TestClass2.class }); reindexer.reindex(); context.assertIsSatisfied(); }
@SuppressWarnings("unchecked") public void reindex() { FullTextSession search = getFullTextSession(); log.info("reindex()"); for (Class entityClass : entitiesToReindex) { log.info("Reindexing entity of type " + entityClass.toString()); searchIndexManager.reindexEntities(entityClass, search); log.info("Done reindexing entity of type " + entityClass.toString()); } }
EntityReindexer { @SuppressWarnings("unchecked") public void reindex() { FullTextSession search = getFullTextSession(); log.info("reindex()"); for (Class entityClass : entitiesToReindex) { log.info("Reindexing entity of type " + entityClass.toString()); searchIndexManager.reindexEntities(entityClass, search); log.info("Done reindexing entity of type " + entityClass.toString()); } } }
EntityReindexer { @SuppressWarnings("unchecked") public void reindex() { FullTextSession search = getFullTextSession(); log.info("reindex()"); for (Class entityClass : entitiesToReindex) { log.info("Reindexing entity of type " + entityClass.toString()); searchIndexManager.reindexEntities(entityClass, search); log.info("Done reindexing entity of type " + entityClass.toString()); } }  }
EntityReindexer { @SuppressWarnings("unchecked") public void reindex() { FullTextSession search = getFullTextSession(); log.info("reindex()"); for (Class entityClass : entitiesToReindex) { log.info("Reindexing entity of type " + entityClass.toString()); searchIndexManager.reindexEntities(entityClass, search); log.info("Done reindexing entity of type " + entityClass.toString()); } }  @SuppressWarnings("unchecked") void setEntitiesToReindex(final Class[] theEntitiesToReindex); @SuppressWarnings("unchecked") void reindex(); void setSearchIndexManager(final SearchIndexManager theSearchIndexManager); @PersistenceContext void setEntityManager(final EntityManager theEntityManager); }
EntityReindexer { @SuppressWarnings("unchecked") public void reindex() { FullTextSession search = getFullTextSession(); log.info("reindex()"); for (Class entityClass : entitiesToReindex) { log.info("Reindexing entity of type " + entityClass.toString()); searchIndexManager.reindexEntities(entityClass, search); log.info("Done reindexing entity of type " + entityClass.toString()); } }  @SuppressWarnings("unchecked") void setEntitiesToReindex(final Class[] theEntitiesToReindex); @SuppressWarnings("unchecked") void reindex(); void setSearchIndexManager(final SearchIndexManager theSearchIndexManager); @PersistenceContext void setEntityManager(final EntityManager theEntityManager);  }