lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [2/4] lucenenet git commit: Lucene.Net.Tests.Benchmark.ByTask.Tasks.WriteLineDocTaskTest: Changed implementation to throw exceptions on the main thread.
Date Mon, 11 Sep 2017 14:34:57 GMT
Lucene.Net.Tests.Benchmark.ByTask.Tasks.WriteLineDocTaskTest: Changed implementation to throw
exceptions on the main thread.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/f6475cbc
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/f6475cbc
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/f6475cbc

Branch: refs/heads/master
Commit: f6475cbcff69f0b1b295324e5bfab92181fa6a01
Parents: d1a5769
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Mon Sep 11 20:26:46 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Sep 11 20:26:46 2017 +0700

----------------------------------------------------------------------
 .../ByTask/Tasks/WriteLineDocTaskTest.cs           | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f6475cbc/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/WriteLineDocTaskTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/WriteLineDocTaskTest.cs b/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/WriteLineDocTaskTest.cs
index 8edad56..6573184 100644
--- a/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/WriteLineDocTaskTest.cs
+++ b/src/Lucene.Net.Tests.Benchmark/ByTask/Tasks/WriteLineDocTaskTest.cs
@@ -370,6 +370,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
         private class ThreadAnonymousHelper : ThreadClass
         {
             private readonly WriteLineDocTask wldt;
+            internal Exception Exception { get; private set; }
             public ThreadAnonymousHelper(string name, WriteLineDocTask wldt)
                 : base(name)
             {
@@ -384,7 +385,8 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
                 }
                 catch (Exception e)
                 {
-                    throw new Exception(e.ToString(), e);
+                    //throw new Exception(e.ToString(), e);
+                    this.Exception = e;
                 }
             }
         }
@@ -406,6 +408,17 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
 
             wldt.Dispose();
 
+            // LUCENENET specific - need to transfer any exception that occurred back to
this thread
+            foreach (ThreadClass t in threads)
+            {
+                var thread = t as ThreadAnonymousHelper;
+
+                if (thread?.Exception != null)
+                {
+                    throw thread.Exception;
+                }
+            }
+
             ISet<String> ids = new HashSet<string>();
             TextReader br = new StreamReader(new FileStream(file.FullName, FileMode.Open,
FileAccess.Read), Encoding.UTF8);
             try
@@ -416,7 +429,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Tasks
                 {
                     line = br.ReadLine();
                     String[] parts = line.Split(WriteLineDocTask.SEP).TrimEnd();
-                    assertEquals(3, parts.Length);
+                    assertEquals(line, 3, parts.Length);
                     // check that all thread names written are the same in the same line
                     String tname = parts[0].Substring(parts[0].IndexOf('_'));
                     ids.add(tname);


Mime
View raw message