1 17 package org.alfresco.repo.node.index; 18 19 import junit.framework.TestCase; 20 21 import org.alfresco.repo.search.Indexer; 22 import org.alfresco.repo.transaction.TransactionUtil; 23 import org.alfresco.repo.transaction.TransactionUtil.TransactionWork; 24 import org.alfresco.service.cmr.repository.NodeService; 25 import org.alfresco.service.transaction.TransactionService; 26 import org.alfresco.util.ApplicationContextHelper; 27 import org.springframework.context.ApplicationContext; 28 29 34 public class FtsIndexRecoveryComponentTest extends TestCase 35 { 36 private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(); 37 38 private IndexRecovery indexRecoverer; 39 private NodeService nodeService; 40 private TransactionService txnService; 41 private Indexer indexer; 42 43 public void setUp() throws Exception 44 { 45 indexRecoverer = (IndexRecovery) ctx.getBean("indexRecoveryComponent"); 46 txnService = (TransactionService) ctx.getBean("transactionComponent"); 47 nodeService = (NodeService) ctx.getBean("nodeService"); 48 indexer = (Indexer) ctx.getBean("indexerComponent"); 49 } 50 51 public void testReindexing() throws Exception 52 { 53 TransactionWork<Object > reindexWork = new TransactionWork<Object >() 55 { 56 public Object doWork() 57 { 58 indexRecoverer.reindex(); 59 return null; 60 } 61 }; 62 63 TransactionUtil.executeInNonPropagatingUserTransaction(txnService, reindexWork); 65 } 66 } 67 | Popular Tags |