lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r784538 - in /lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search: RemoteCachingWrapperFilterHelper.java TestRemoteCachingWrapperFilter.java TestRemoteSearchable.java TestSort.java
Date Sun, 14 Jun 2009 11:06:16 GMT
Author: mikemccand
Date: Sun Jun 14 11:06:15 2009
New Revision: 784538

URL: http://svn.apache.org/viewvc?rev=784538&view=rev
Log:
LUCENE-1407: move RemoteSearchable out of core into contrib/remote

Removed:
    lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/RemoteCachingWrapperFilterHelper.java
    lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/TestRemoteCachingWrapperFilter.java
    lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/TestRemoteSearchable.java
Modified:
    lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/TestSort.java

Modified: lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/TestSort.java?rev=784538&r1=784537&r2=784538&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/TestSort.java
(original)
+++ lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/search/TestSort.java
Sun Jun 14 11:06:15 2009
@@ -20,7 +20,6 @@
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
-import junit.textui.TestRunner;
 import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -32,14 +31,10 @@
 
 import java.io.IOException;
 import java.io.Serializable;
-import java.rmi.Naming;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
 import java.util.BitSet;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
-import java.util.regex.Pattern;
 
 /**
  * Unit tests for sorting code.
@@ -70,21 +65,6 @@
 		super (name);
 	}
 
-	public static void main (String[] argv) {
-		if (argv == null || argv.length < 1)
-			TestRunner.run (suite());
-		else if ("server".equals (argv[0])) {
-			TestSort test = new TestSort (null);
-			try {
-				test.startServer();
-				Thread.sleep (500000);
-			} catch (Exception e) {
-				System.out.println (e);
-				e.printStackTrace();
-			}
-		}
-	}
-
 	public static Test suite() {
 		return new TestSuite (TestSort.class);
 	}
@@ -433,28 +413,6 @@
     runMultiSorts(searcher, false);
   }
 
-  // test a variety of sorts using a remote searcher
-  public void testRemoteSort() throws Exception {
-    Searchable searcher = getRemote();
-    MultiSearcher multi = new MultiSearcher(new Searchable[] { searcher });
-    runMultiSorts(multi, true); // this runs on the full index
-  }
-
-	// test custom search when remote
-	public void testRemoteCustomSort() throws Exception {
-		Searchable searcher = getRemote();
-		MultiSearcher multi = new MultiSearcher (new Searchable[] { searcher });
-		sort.setSort (new SortField ("custom", SampleComparable.getComparatorSource()));
-		assertMatches (multi, queryX, sort, "CAIEG");
-		sort.setSort (new SortField ("custom", SampleComparable.getComparatorSource(), true));
-		assertMatches (multi, queryY, sort, "HJDBF");
-		SortComparator custom = SampleComparable.getComparator();
-		sort.setSort (new SortField ("custom", custom));
-		assertMatches (multi, queryX, sort, "CAIEG");
-		sort.setSort (new SortField ("custom", custom, true));
-		assertMatches (multi, queryY, sort, "HJDBF");
-	}
-
 	// test that the relevancy scores are the same even if
 	// hits are sorted
 	public void testNormalizedScores() throws Exception {
@@ -465,97 +423,72 @@
     HashMap scoresA = getScores (full.search (queryA, null, 1000).scoreDocs, full);
 
 		// we'll test searching locally, remote and multi
-		MultiSearcher remote = new MultiSearcher (new Searchable[] { getRemote() });
 		MultiSearcher multi  = new MultiSearcher (new Searchable[] { searchX, searchY });
 
 		// change sorting and make sure relevancy stays the same
 
 		sort = new Sort();
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 		sort.setSort(SortField.FIELD_DOC);
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 		sort.setSort ("int");
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 		sort.setSort ("float");
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 		sort.setSort ("string");
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 		sort.setSort (new String[] {"int","float"});
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 		sort.setSort (new SortField[] { new SortField ("int", true), new SortField (null, SortField.DOC,
true) });
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 		sort.setSort (new String[] {"float","string"});
     assertSameValues (scoresX, getScores (full.search (queryX, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresX, getScores (remote.search (queryX, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresX, getScores (multi.search (queryX, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresY, getScores (full.search (queryY, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresY, getScores (remote.search (queryY, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresY, getScores (multi.search (queryY, null, 1000, sort).scoreDocs,
multi));
     assertSameValues (scoresA, getScores (full.search (queryA, null, 1000, sort).scoreDocs,
full));
-    assertSameValues (scoresA, getScores (remote.search (queryA, null, 1000, sort).scoreDocs,
remote));
     assertSameValues (scoresA, getScores (multi.search (queryA, null, 1000, sort).scoreDocs,
multi));
 
 	}
@@ -700,29 +633,4 @@
       }
 		}
 	}
-
-	private Searchable getRemote () throws Exception {
-		try {
-			return lookupRemote ();
-		} catch (Throwable e) {
-			startServer ();
-			return lookupRemote ();
-		}
-	}
-
-	private Searchable lookupRemote () throws Exception {
-		return (Searchable) Naming.lookup ("//localhost/SortedSearchable");
-	}
-
-	private void startServer () throws Exception {
-		// construct an index
-		Searcher local = getFullIndex();
-		// local.search (queryA, new Sort());
-
-		// publish it
-		Registry reg = LocateRegistry.createRegistry (1099);
-		RemoteSearchable impl = new RemoteSearchable (local);
-		Naming.rebind ("//localhost/SortedSearchable", impl);
-	}
-
 }



Mime
View raw message