lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r569955 - /incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs
Date Mon, 27 Aug 2007 02:06:37 GMT
Author: aroush
Date: Sun Aug 26 19:06:37 2007
New Revision: 569955

URL: http://svn.apache.org/viewvc?rev=569955&view=rev
Log:
Fix: LUCENENET-94 "NUnit test for Search.TestSort (RemoteSearchable issues)" (only TestSort.patch
applied)

Modified:
    incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestSort.cs?rev=569955&r1=569954&r2=569955&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs Sun Aug 26 19:06:37 2007
@@ -213,6 +213,8 @@
 			queryF = new TermQuery(new Term("contents", "f"));
 			queryG = new TermQuery(new Term("contents", "g"));
 			sort = new Sort();
+
+            StartServer();
 		}
 		
 		// test the sorts by score and document number
@@ -759,33 +761,33 @@
 		
 		private Lucene.Net.Search.Searchable GetRemote()
 		{
-			try
-			{
-				return LookupRemote();
-			}
-			catch (System.Exception e)
-			{
-				StartServer();
-				return LookupRemote();
-			}
+            return LookupRemote();
 		}
 		
 		private Lucene.Net.Search.Searchable LookupRemote()
 		{
-			return (Lucene.Net.Search.Searchable) Activator.GetObject(typeof(Lucene.Net.Search.Searchable),
"http://localhost/SortedSearchable");
+			return (Lucene.Net.Search.Searchable) Activator.GetObject(typeof(Lucene.Net.Search.Searchable),
@"http://localhost:1099/SortedSearchable");
 		}
 		
-		private void  StartServer()
+		public void  StartServer()
 		{
+            try
+            {
+                System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Http.HttpChannel(1099));
+            }
+            catch (System.Net.Sockets.SocketException ex)
+            {
+                if (ex.ErrorCode == 10048) return; // EADDRINUSE?
+                throw ex;
+            }
+
 			// construct an index
 			Searcher local = GetFullIndex();
 			// local.search (queryA, new Sort());
 			
 			// publish it
-			//System.Runtime.Remoting.RemotingConfiguration reg = LocateRegistry.createRegistry(1099);
-			//RemoteSearchable impl = new RemoteSearchable(local);
-			//System.Runtime.Remoting.RemotingServices.Marshal(impl, SupportClass.ParseURIBind("//localhost/SortedSearchable"));
-            Assert.Fail("Need to port Java to C#");     // {{Aroush-1.9}} We need to do this
in C#
-		}
+            RemoteSearchable impl = new RemoteSearchable(local);
+            System.Runtime.Remoting.RemotingServices.Marshal(impl, "SortedSearchable");
+        }
 	}
 }



Mime
View raw message