From c18e8bc723fc492f1c676d01f01f013bc22159bb Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Fri, 23 Jan 2009 05:47:51 +0000 Subject: [PATCH] [MRM-749] additional test case git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-nexus-indexer@736944 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/NexusIndexerConsumerTest.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index ab07d0a5d..16dbfd874 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -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 ); + } } -- 2.39.5