]> source.dussan.org Git - archiva.git/commitdiff
[MRM-749]
authorMaria Odea B. Ching <oching@apache.org>
Fri, 23 Jan 2009 05:47:51 +0000 (05:47 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Fri, 23 Jan 2009 05:47:51 +0000 (05:47 +0000)
additional test case

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-nexus-indexer@736944 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java

index ab07d0a5d1b04f86792b91606d6d8e882c0aae9c..16dbfd8749d3ab1b5f9d2fb4011416318f053999 100644 (file)
@@ -151,19 +151,33 @@ public class NexusIndexerConsumerTest
         assertEquals( 1, topDocs.totalHits );
     }
     
-    /*
     public void testIndexerIndexArtifactThenPom()
         throws Exception
     {        
         // begin scan
         Date now = Calendar.getInstance().getTime();
         nexusIndexerConsumer.beginScan( repositoryConfig, now );
+        nexusIndexerConsumer.processFile( "org/apache/archiva/archiva-index-methods-jar-test/1.0/archiva-index-methods-jar-test-1.0.jar" );
+        nexusIndexerConsumer.completeScan();
         
-        // process file
-        //nexusIndexerConsumer.processFile(  )
-        
-        // end scan
+        // scan and index again
+        now = Calendar.getInstance().getTime();
+        nexusIndexerConsumer.beginScan( repositoryConfig, now );
+        nexusIndexerConsumer.processFile( "org/apache/archiva/archiva-index-methods-jar-test/1.0/pom.xml" );        
+        nexusIndexerConsumer.completeScan();
         
         // search!
-    }*/
+        BooleanQuery q = new BooleanQuery();        
+        q.add( nexusIndexer.constructQuery( ArtifactInfo.GROUP_ID, "org.apache.archiva" ), Occur.SHOULD );
+        q.add( nexusIndexer.constructQuery( ArtifactInfo.ARTIFACT_ID, "archiva-index-methods-jar-test" ), Occur.SHOULD );
+        
+        IndexSearcher searcher = new IndexSearcher( repositoryConfig.getLocation() + "/.indexer" );
+        TopDocs topDocs = searcher.search( q, null, 10 );
+        
+        assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
+        assertTrue( new File( repositoryConfig.getLocation(), ".index" ).exists() );
+        
+        // should return only 1 hit 
+        assertEquals( 1, topDocs.totalHits );
+    }
 }