portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jf...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/search/src/test/org/apache/jetpseed/search TestSearch.java
Date Wed, 13 Oct 2004 22:24:38 GMT
jford       2004/10/13 15:24:38

  Modified:    components/search/src/test/org/apache/jetpseed/search
                        TestSearch.java
  Log:
  Return SearchResults interface instead of iterator
  
  Revision  Changes    Path
  1.2       +18 -12    jakarta-jetspeed-2/components/search/src/test/org/apache/jetpseed/search/TestSearch.java
  
  Index: TestSearch.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/search/src/test/org/apache/jetpseed/search/TestSearch.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestSearch.java	28 Sep 2004 20:42:32 -0000	1.1
  +++ TestSearch.java	13 Oct 2004 22:24:38 -0000	1.2
  @@ -23,6 +23,7 @@
   
   import org.apache.jetspeed.search.ParsedObject;
   import org.apache.jetspeed.search.SearchEngine;
  +import org.apache.jetspeed.search.SearchResults;
   import org.apache.jetspeed.search.handlers.HandlerFactoryImpl;
   import org.apache.jetspeed.search.lucene.SearchEngineImpl;
   
  @@ -134,12 +135,13 @@
           //because tear down deletes files, need to do add again
           testPutWebPage();
           
  -        Iterator results  = searchEngine.search("YourResultsBelongToUs");
  +        SearchResults results  = searchEngine.search("YourResultsBelongToUs");
           //System.out.println("Query 'YourResultsBelongToUs' hits = " + results.size());
  -        assertTrue(" Hit count == 0", results.hasNext() == false);
  -        while (results.hasNext())
  +        assertTrue(" Hit count == 0", results.size() == 0);
  +        Iterator resultIter = results.iterator();
  +        while (resultIter.hasNext())
           {
  -            ParsedObject result = (ParsedObject) results.next();
  +            ParsedObject result = (ParsedObject) resultIter.next();
               
               System.out.println("Score = " + result.getScore());
               System.out.println("title = " + result.getTitle());
  @@ -153,11 +155,13 @@
   //      because tear down deletes files, need to do add again
           testPutWebPage();
           
  -        Iterator results  = searchEngine.search("Jetspeed");
  -        assertTrue(" Hit count == 0", results.hasNext());
  -        while (results.hasNext())
  +        SearchResults results  = searchEngine.search("Jetspeed");
  +        assertTrue(" Hit count == 0", results.size() > 0);
  +        
  +        Iterator resultIter = results.iterator();
  +        while (resultIter.hasNext())
           {
  -            ParsedObject result = (ParsedObject) results.next();
  +            ParsedObject result = (ParsedObject) resultIter.next();
               System.out.println("Score = " + result.getScore());
               System.out.println("title = " + result.getTitle());
               System.out.println("summary = " + result.getDescription());
  @@ -170,11 +174,13 @@
   //      because tear down deletes files, need to do add again
           testPutWebPage();
           
  -        Iterator results  = searchEngine.search("community");
  -        assertTrue(" Hit count == 0", results.hasNext());
  -        while (results.hasNext())
  +        SearchResults results  = searchEngine.search("community");
  +        assertTrue(" Hit count == 0", results.size() > 0);
  +        
  +        Iterator resultIter = results.iterator();
  +        while (resultIter.hasNext())
           {
  -            ParsedObject result = (ParsedObject) results.next();
  +            ParsedObject result = (ParsedObject) resultIter.next();
               System.out.println("Score = " + result.getScore());
               System.out.println("title = " + result.getTitle());
               System.out.println("summary = " + result.getDescription());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message