risdenk commented on code in PR #717: URL: https://github.com/apache/solr/pull/717#discussion_r858020451
########## solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java: ########## @@ -2320,81 +2610,90 @@ public void testTopicStream() throws Exception { assertEquals((long) tuple1.getLong("id"), 10l); cluster.getSolrClient().commit("collection1"); - // Checkpoint should not have changed. - expression = StreamExpressionParser.parse("search(collection1, q=\"id:1000000\", fl=\"id, checkpoint_ss, _version_\", sort=\"id asc\")"); - TupleStream cstream = factory.constructStream(expression); - context = new StreamContext(); - context.setSolrClientCache(cache); - cstream.setStreamContext(context); - tuples = getTuples(cstream); + // Checkpoint should not have changed. + expression = + StreamExpressionParser.parse( + "search(collection1, q=\"id:1000000\", fl=\"id, checkpoint_ss, _version_\", sort=\"id asc\")"); + TupleStream cstream = factory.constructStream(expression); + context = new StreamContext(); + context.setSolrClientCache(cache); + cstream.setStreamContext(context); + tuples = getTuples(cstream); - assertEquals(tuples.size(), 1); - checkpoints = tuples.get(0).getStrings("checkpoint_ss"); - assertEquals(checkpoints.size(), 2); - Long version2 = tuples.get(0).getLong("_version_"); - assertEquals(version1, version2); + assertEquals(tuples.size(), 1); + checkpoints = tuples.get(0).getStrings("checkpoint_ss"); + assertEquals(checkpoints.size(), 2); + Long version2 = tuples.get(0).getLong("_version_"); + assertEquals(version1, version2); Tuple tuple2 = stream.read(); cluster.getSolrClient().commit("collection1"); assertEquals((long) tuple2.getLong("id"), 11l); - //Checkpoint should have changed. - expression = StreamExpressionParser.parse("search(collection1, q=\"id:1000000\", fl=\"id, checkpoint_ss, _version_\", sort=\"id asc\")"); - cstream = factory.constructStream(expression); - context = new StreamContext(); - context.setSolrClientCache(cache); - cstream.setStreamContext(context); - tuples = getTuples(cstream); + // Checkpoint should have changed. + expression = + StreamExpressionParser.parse( + "search(collection1, q=\"id:1000000\", fl=\"id, checkpoint_ss, _version_\", sort=\"id asc\")"); + cstream = factory.constructStream(expression); + context = new StreamContext(); + context.setSolrClientCache(cache); + cstream.setStreamContext(context); + tuples = getTuples(cstream); - assertEquals(tuples.size(), 1); - checkpoints = tuples.get(0).getStrings("checkpoint_ss"); - assertEquals(checkpoints.size(), 2); - Long version3 = tuples.get(0).getLong("_version_"); - assertTrue(version3 > version2); + assertEquals(tuples.size(), 1); + checkpoints = tuples.get(0).getStrings("checkpoint_ss"); + assertEquals(checkpoints.size(), 2); + Long version3 = tuples.get(0).getLong("_version_"); + assertTrue(version3 > version2); Tuple tuple3 = stream.read(); assertTrue(tuple3.EOF); } finally { stream.close(); } - //Test with the DaemonStream + // Test with the DaemonStream DaemonStream dstream = null; try { - expression = StreamExpressionParser.parse("daemon(topic(collection1, collection1, fl=\"id\", q=\"a_s:hello\", id=\"1000000\", checkpointEvery=2), id=\"test\", runInterval=\"1000\", queueSize=\"9\")"); + expression = + StreamExpressionParser.parse( + "daemon(topic(collection1, collection1, fl=\"id\", q=\"a_s:hello\", id=\"1000000\", checkpointEvery=2), id=\"test\", runInterval=\"1000\", queueSize=\"9\")"); dstream = (DaemonStream) factory.constructStream(expression); context = new StreamContext(); context.setSolrClientCache(cache); dstream.setStreamContext(context); - //Index a few more documents + // Index a few more documents new UpdateRequest() .add(id, "12", "a_s", "hello", "a_i", "13", "a_f", "9") .add(id, "13", "a_s", "hello", "a_i", "14", "a_f", "10") .commit(cluster.getSolrClient(), COLLECTIONORALIAS); - //Start reading from the DaemonStream + // Start reading from the DaemonStream Tuple tuple = null; dstream.open(); tuple = dstream.read(); assertEquals(12, (long) tuple.getLong(id)); tuple = dstream.read(); assertEquals(13, (long) tuple.getLong(id)); - cluster.getSolrClient().commit("collection1"); // We want to see if the version has been updated after reading two tuples + // We want to see if the version has been updated after reading two tuples + cluster.getSolrClient().commit("collection1"); - //Index a few more documents + // Index a few more documents new UpdateRequest() .add(id, "14", "a_s", "hello", "a_i", "13", "a_f", "9") .add(id, "15", "a_s", "hello", "a_i", "14", "a_f", "10") .commit(cluster.getSolrClient(), COLLECTIONORALIAS); - //Read from the same DaemonStream stream + // Read from the same DaemonStream stream tuple = dstream.read(); assertEquals(14, (long) tuple.getLong(id)); - tuple = dstream.read(); // This should trigger a checkpoint as it's the 4th read from the stream. + tuple = + dstream + .read(); // This should trigger a checkpoint as it's the 4th read from the stream. Review Comment: Fix this -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org