You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jb...@apache.org on 2017/04/22 21:29:33 UTC

[2/2] lucene-solr:master: SOLR-10551: Improve tests

SOLR-10551: Improve tests


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/99ce2341
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/99ce2341
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/99ce2341

Branch: refs/heads/master
Commit: 99ce2341628ea59f4821e3314e55758a2a406512
Parents: f6af8d0
Author: Joel Bernstein <jb...@apache.org>
Authored: Sat Apr 22 17:26:19 2017 -0400
Committer: Joel Bernstein <jb...@apache.org>
Committed: Sat Apr 22 17:26:19 2017 -0400

----------------------------------------------------------------------
 .../solr/client/solrj/io/stream/CellStream.java |  1 +
 .../solrj/io/stream/StreamExpressionTest.java   | 24 ++++++++++++++------
 2 files changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/99ce2341/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CellStream.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CellStream.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CellStream.java
index 1696a1a..aad99f6 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CellStream.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/CellStream.java
@@ -69,6 +69,7 @@ public class CellStream extends TupleStream implements Expressible {
   private StreamExpression toExpression(StreamFactory factory, boolean includeStreams) throws IOException {
     // function name
     StreamExpression expression = new StreamExpression(factory.getFunctionName(this.getClass()));
+    expression.addParameter(name);
     if(includeStreams) {
       expression.addParameter(((Expressible)stream).toExpression(factory));
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/99ce2341/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
index 2505639..bb771b6 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
@@ -5041,10 +5041,16 @@ public class StreamExpressionTest extends SolrCloudTestCase {
   public void testListStream() throws Exception {
     UpdateRequest updateRequest = new UpdateRequest();
     updateRequest.add(id, "hello", "test_t", "l b c d c");
+    updateRequest.add(id, "hello1", "test_t", "l b c d c");
+    updateRequest.add(id, "hello2", "test_t", "l b c d c");
+
     updateRequest.commit(cluster.getSolrClient(), COLLECTIONORALIAS);
 
-    String expr = "search("+COLLECTIONORALIAS+", q=\"*:*\", fl=id, sort=\"id desc\")";
-    String cat = "list("+expr+","+expr+")";
+    String expr1 = "search("+COLLECTIONORALIAS+", q=\"id:hello\",  fl=id, sort=\"id desc\")";
+    String expr2 = "search("+COLLECTIONORALIAS+", q=\"id:hello1\", fl=id, sort=\"id desc\")";
+    String expr3 = "search("+COLLECTIONORALIAS+", q=\"id:hello2\", fl=id, sort=\"id desc\")";
+
+    String cat = "list("+expr1+","+expr2+","+expr3+")";
     ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
     paramsLoc.set("expr", cat);
     paramsLoc.set("qt", "/stream");
@@ -5055,23 +5061,24 @@ public class StreamExpressionTest extends SolrCloudTestCase {
     StreamContext context = new StreamContext();
     solrStream.setStreamContext(context);
     List<Tuple> tuples = getTuples(solrStream);
-    assertTrue(tuples.size() == 2);
+    assertTrue(tuples.size() == 3);
     String s = (String)tuples.get(0).get("id");
     assertTrue(s.equals("hello"));
     s = (String)tuples.get(1).get("id");
-    assertTrue(s.equals("hello"));
-
+    assertTrue(s.equals("hello1"));
+    s = (String)tuples.get(2).get("id");
+    assertTrue(s.equals("hello2"));
   }
 
   @Test
   public void testCellStream() throws Exception {
     UpdateRequest updateRequest = new UpdateRequest();
-    updateRequest.add(id, "hello", "test_t", "l b c d c");
+    updateRequest.add(id, "hello", "test_t", "l b c d c e");
     updateRequest.add(id, "hello1", "test_t", "l b c d c");
 
     updateRequest.commit(cluster.getSolrClient(), COLLECTIONORALIAS);
 
-    String expr = "search("+COLLECTIONORALIAS+", q=\"*:*\", fl=id, sort=\"id desc\")";
+    String expr = "search("+COLLECTIONORALIAS+", q=\"*:*\", fl=\"id,test_t\", sort=\"id desc\")";
     String cat = "cell(results,"+expr+")";
     ModifiableSolrParams paramsLoc = new ModifiableSolrParams();
     paramsLoc.set("expr", cat);
@@ -5086,7 +5093,10 @@ public class StreamExpressionTest extends SolrCloudTestCase {
     assertTrue(tuples.size() == 1);
     List<Map> results  = (List<Map>)tuples.get(0).get("results");
     assertTrue(results.get(0).get("id").equals("hello1"));
+    assertTrue(results.get(0).get("test_t").equals("l b c d c"));
     assertTrue(results.get(1).get("id").equals("hello"));
+    assertTrue(results.get(1).get("test_t").equals("l b c d c e"));
+
   }
 
   @Test