From 90ef668a99bd864a66757534092649ac9c269895 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Wed, 9 Jul 2008 06:12:15 +0000 Subject: [PATCH] remove unneccessary codes in the searcher for tests git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@675099 13f79535-47bb-0310-9956-ffa450edef68 --- ...avaPublicMethodsCrossRepositorySearch.java | 48 ++++--------------- 1 file changed, 9 insertions(+), 39 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsCrossRepositorySearch.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsCrossRepositorySearch.java index 3d6896cba..ea9f13311 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsCrossRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/maven/archiva/consumers/lucene/IndexJavaPublicMethodsCrossRepositorySearch.java @@ -37,7 +37,6 @@ import org.apache.maven.archiva.indexer.bytecode.BytecodeHandlers; import org.apache.maven.archiva.indexer.lucene.LuceneEntryConverter; import org.apache.maven.archiva.indexer.lucene.LuceneQuery; import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord; -import org.apache.maven.archiva.indexer.search.CrossRepositorySearch; import org.apache.maven.archiva.indexer.search.SearchResultLimits; import org.apache.maven.archiva.indexer.search.SearchResults; import org.slf4j.Logger; @@ -49,20 +48,14 @@ import org.slf4j.LoggerFactory; * @author Maria Odea Ching * @version */ -public class IndexJavaPublicMethodsCrossRepositorySearch - implements CrossRepositorySearch +public class IndexJavaPublicMethodsCrossRepositorySearch { private Logger log = LoggerFactory.getLogger( IndexJavaPublicMethodsCrossRepositorySearch.class ); private ManagedRepositoryConfiguration localIndexedRepo; private RepositoryContentIndexFactory indexFactory; - - public IndexJavaPublicMethodsCrossRepositorySearch() - { - - } - + public IndexJavaPublicMethodsCrossRepositorySearch( ManagedRepositoryConfiguration localIndexedRepo, RepositoryContentIndexFactory indexFactory ) { this.localIndexedRepo = localIndexedRepo; @@ -70,40 +63,17 @@ public class IndexJavaPublicMethodsCrossRepositorySearch } public SearchResults searchForBytecode( String principal, List selectedRepos, String term, - SearchResultLimits limits ) + SearchResultLimits limits ) throws ParseException { List indexes = new ArrayList(); indexes.add( indexFactory.createBytecodeIndex( localIndexedRepo ) ); - try - { - QueryParser parser = new BytecodeHandlers().getQueryParser(); - LuceneQuery query = new LuceneQuery( parser.parse( term ) ); - SearchResults results = searchAll( query, limits, indexes ); - results.getRepositories().add( localIndexedRepo ); - - return results; - } - catch ( ParseException e ) - { - log.error( e.getMessage() ); - } - - return new SearchResults(); - } - - public SearchResults searchForChecksum( String principal, List selectedRepos, String checksum, - SearchResultLimits limits ) - { - // TODO Auto-generated method stub - return null; - } - - public SearchResults searchForTerm( String principal, List selectedRepos, String term, - SearchResultLimits limits ) - { - // TODO Auto-generated method stub - return null; + QueryParser parser = new BytecodeHandlers().getQueryParser(); + LuceneQuery query = new LuceneQuery( parser.parse( term ) ); + SearchResults results = searchAll( query, limits, indexes ); + results.getRepositories().add( localIndexedRepo ); + + return results; } private SearchResults searchAll( LuceneQuery luceneQuery, SearchResultLimits limits, List indexes )