ACCUMULO-564: turn TestQueryLogic unit test into a functioning unit test by 
completing the configuration

git-svn-id: 
https://svn.apache.org/repos/asf/accumulo/trunk/examples/wikisearch@1332755 
13f79535-47bb-0310-9956-ffa450edef68
(cherry-picked from commit 7bab36a5fd968b287a4ebc1fff65bd2dcc79e8a3)

Reason: Hadoop2 compat
Author: Eric C. Newton <e...@apache.org>
Ref: ACCUMULO-1977


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

Branch: refs/heads/master
Commit: e158590545f1ee1a4a14fb63cc6b9d69066b96aa
Parents: c9f213e
Author: Eric C. Newton <e...@apache.org>
Authored: Tue May 1 17:15:24 2012 +0000
Committer: Sean Busbey <bus...@clouderagovt.com>
Committed: Tue Dec 10 14:13:49 2013 -0600

----------------------------------------------------------------------
 .../examples/wikisearch/logic/TestQueryLogic.java | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo-wikisearch/blob/e1585905/query/src/test/java/org/apache/accumulo/examples/wikisearch/logic/TestQueryLogic.java
----------------------------------------------------------------------
diff --git 
a/query/src/test/java/org/apache/accumulo/examples/wikisearch/logic/TestQueryLogic.java
 
b/query/src/test/java/org/apache/accumulo/examples/wikisearch/logic/TestQueryLogic.java
index 9079d79..24e7379 100644
--- 
a/query/src/test/java/org/apache/accumulo/examples/wikisearch/logic/TestQueryLogic.java
+++ 
b/query/src/test/java/org/apache/accumulo/examples/wikisearch/logic/TestQueryLogic.java
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map.Entry;
@@ -46,6 +47,7 @@ import 
org.apache.accumulo.examples.wikisearch.ingest.WikipediaMapper;
 import org.apache.accumulo.examples.wikisearch.parser.RangeCalculator;
 import org.apache.accumulo.examples.wikisearch.reader.AggregatingRecordReader;
 import org.apache.accumulo.examples.wikisearch.sample.Document;
+import org.apache.accumulo.examples.wikisearch.sample.Field;
 import org.apache.accumulo.examples.wikisearch.sample.Results;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -158,6 +160,7 @@ public class TestQueryLogic {
     table.setIndexTableName(INDEX_TABLE_NAME);
     table.setReverseIndexTableName(RINDEX_TABLE_NAME);
     table.setUseReadAheadIterator(false);
+    table.setUnevaluatedFields(Collections.singletonList("TEXT"));
   }
   
   void debugQuery(String tableName) throws Exception {
@@ -179,13 +182,14 @@ public class TestQueryLogic {
     List<Document> docs = results.getResults();
     assertEquals(4, docs.size());
     
-    /*
-     * debugQuery(METADATA_TABLE_NAME); debugQuery(TABLE_NAME); 
debugQuery(INDEX_TABLE_NAME); debugQuery(RINDEX_TABLE_NAME);
-     * 
-     * results = table.runQuery(c, auths, "TEXT == 'abacus'", null, null, 
null); docs = results.getResults(); assertEquals(4, docs.size()); for (Document 
doc :
-     * docs) { System.out.println("id: " + doc.getId()); for (Field field : 
doc.getFields()) System.out.println(field.getFieldName() + " -> " +
-     * field.getFieldValue()); }
-     */
+    results = table.runQuery(c, auths, "TEXT == 'abacus'", null, null, null);
+    docs = results.getResults();
+    assertEquals(1, docs.size());
+    for (Document doc : docs) {
+      System.out.println("id: " + doc.getId());
+      for (Field field : doc.getFields())
+        System.out.println(field.getFieldName() + " -> " + 
field.getFieldValue());
+    }
   }
   
 }

Reply via email to