search/indexer/mmm-search-indexer-impl-lucene/src/test/java/net/sf/mmm/search/indexer/impl/lucene/LuceneSearchIndexerTest.java
/**
   * This method indexes the complete sources of this maven module. It will then perform a search and check if
   * it gets the correct results.
   */
This method indexes the complete sources of this maven module. It will then perform a search and check if
it gets the correct results.
This method indexes the complete sources of this maven module . It will then perform a search and check if it gets the correct results .
@Test
  public void testIndexer() {
    SearchIndexerMain main = new SearchIndexerMain();
    String configLocation = TestResourceHelper.getTestPath(LuceneSearchIndexerTest.class, ".xml");
    int exitCode = main.run("--config", configLocation, "--overwrite");
    Assert.assertEquals(0, exitCode);
    SearchEngineConfigurationHolder configurationHolder = this.searchEngineConfigurationLoader
        .loadConfiguration(configLocation);
    String path = LuceneSearchIndexerTest.class.getName().replace('.', '/');
    ManagedSearchEngine searchEngine = this.searchEngineBuilder.createSearchEngine(configurationHolder);
    try {
      SearchHit hit;
      hit = getSingleHit(searchEngine, "Xulawolratzuwki");
      Assert.assertEquals(path + ".java", hit.getUri());
      Assert.assertEquals("Joerg Hohwiller", hit.getCreator());
      Assert.assertEquals("test-java", hit.getSource());
      hit = getSingleHit(searchEngine, "androgynous +source:test-resources");
      Assert.assertEquals(path + ".xml", hit.getUri());
    } finally {
      searchEngine.close();
    }
  }
@ Test public void testIndexer ( ) { SearchIndexerMain main = new SearchIndexerMain ( ) ; String configLocation = TestResourceHelper . getTestPath ( LuceneSearchIndexerTest . class , ".xml" ) ; int exitCode = main . run ( "--config" , configLocation , "--overwrite" ) ; Assert . assertEquals ( 0 , exitCode ) ; SearchEngineConfigurationHolder configurationHolder = this . searchEngineConfigurationLoader . loadConfiguration ( configLocation ) ; String path = LuceneSearchIndexerTest . class . getName ( ) . replace ( '.' , '/' ) ; ManagedSearchEngine searchEngine = this . searchEngineBuilder . createSearchEngine ( configurationHolder ) ; try { SearchHit hit ; hit = getSingleHit ( searchEngine , "Xulawolratzuwki" ) ; Assert . assertEquals ( path + ".java" , hit . getUri ( ) ) ; Assert . assertEquals ( "Joerg Hohwiller" , hit . getCreator ( ) ) ; Assert . assertEquals ( "test-java" , hit . getSource ( ) ) ; hit = getSingleHit ( searchEngine , "androgynous +source:test-resources" ) ; Assert . assertEquals ( path + ".xml" , hit . getUri ( ) ) ; } finally { searchEngine . close ( ) ; } }
This method indexes the complete sources of this maven module.
This method indexes the complete sources of this maven module .
// this query contains a crazy word that is unique in this project, it // only occurs once: in this source-file (which has been previously // indexed).