You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/06/02 03:24:12 UTC

incubator-joshua git commit: unit test compiling (not sure how to run)

Repository: incubator-joshua
Updated Branches:
  refs/heads/master 6e2485981 -> c4ce122a7


unit test compiling (not sure how to run)


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

Branch: refs/heads/master
Commit: c4ce122a77aebddc5bae3a8e5f1b9e377a74a00f
Parents: 6e24859
Author: Matt Post <po...@cs.jhu.edu>
Authored: Wed Jun 1 23:24:09 2016 -0400
Committer: Matt Post <po...@cs.jhu.edu>
Committed: Wed Jun 1 23:24:09 2016 -0400

----------------------------------------------------------------------
 .../system/MultithreadedTranslationTests.java   | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/c4ce122a/src/test/java/org/apache/joshua/system/MultithreadedTranslationTests.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/joshua/system/MultithreadedTranslationTests.java b/src/test/java/org/apache/joshua/system/MultithreadedTranslationTests.java
index c760586..83fbce3 100644
--- a/src/test/java/org/apache/joshua/system/MultithreadedTranslationTests.java
+++ b/src/test/java/org/apache/joshua/system/MultithreadedTranslationTests.java
@@ -31,6 +31,8 @@ import java.util.ArrayList;
 import org.apache.joshua.decoder.Decoder;
 import org.apache.joshua.decoder.JoshuaConfiguration;
 import org.apache.joshua.decoder.MetaDataException;
+import org.apache.joshua.decoder.Translation;
+import org.apache.joshua.decoder.Translations;
 import org.apache.joshua.decoder.io.TranslationRequestStream;
 import org.apache.joshua.decoder.segment_file.Sentence;
 
@@ -107,7 +109,7 @@ public class MultithreadedTranslationTests {
   // data structures.
 
   @Test
-  public void givenPackedGrammar_whenNTranslationsCalledConcurrently_thenReturnNResults() {
+  public void givenPackedGrammar_whenNTranslationsCalledConcurrently_thenReturnNResults() throws IOException {
     // GIVEN
 
     int inputLines = 10000;
@@ -127,23 +129,15 @@ public class MultithreadedTranslationTests {
 
     // WHEN
     // Translate all spans in parallel.
-    try {
-      this.decoder.decodeAll(req, output);
-    } catch (IOException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
-    }
-    ArrayList<Sentence> translationResults = new ArrayList<Sentence>();
+    Translations translations = this.decoder.decodeAll(req);
+
+    ArrayList<Translation> translationResults = new ArrayList<Translation>();
 
 
     final long translationStartTime = System.nanoTime();
-    Sentence t;
     try {
-      while ((t = req.next()) != null) {
+      for (Translation t: translations)
         translationResults.add(t);
-      }
-    } catch (MetaDataException e) {
-      e.printStackTrace();
     } finally {
       if (output != null) {
         try {