private String getConfigDocumentHandlerLocation() {
return "/org/springmodules/lucene/index/config/applicationContext-document-handler.xml";
}
public void testLuceneDocumentHandlerNamespace() throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext(getConfigDocumentHandlerLocation());
DocumentHandlerManagerFactoryBean documentHandlerManagerFB1
= (DocumentHandlerManagerFactoryBean)context.getBean("&documentHandlerManager1");
assertNotNull(documentHandlerManagerFB1);
assertEquals(documentHandlerManagerFB1.getDocumentMatchingClass(), ExtensionDocumentMatching.class);
assertEquals(documentHandlerManagerFB1.getDocumentHandlerManagerClass(), ExtensionDocumentHandlerManager.class);
DocumentHandlerManager documentHandlerManager1
= (DocumentHandlerManager)context.getBean("documentHandlerManager1");
assertNotNull(documentHandlerManager1);
assertTrue(documentHandlerManager1 instanceof ExtensionDocumentHandlerManager);
assertNotNull(documentHandlerManager1.getDocumentHandler("test.txt"));
assertNotNull(documentHandlerManager1.getDocumentHandler("test.properties"));
DocumentHandlerManagerFactoryBean documentHandlerManagerFB2
= (DocumentHandlerManagerFactoryBean)context.getBean("&documentHandlerManager2");
assertNotNull(documentHandlerManagerFB2);
assertEquals(documentHandlerManagerFB2.getDocumentMatchingClass(), IdentityDocumentMatching.class);
assertEquals(documentHandlerManagerFB2.getDocumentHandlerManagerClass(), DefaultDocumentHandlerManager.class);
DocumentHandlerManager documentHandlerManager2
= (DocumentHandlerManager)context.getBean("documentHandlerManager2");
assertNotNull(documentHandlerManager2);
}