LogicalCompareToConstant extends
    BaseOperator { public void setConstant(T constant) { this.constant = constant; }  void setConstant(T constant); T getConstant(); final transient DefaultInputPort<T> input; final transient DefaultOutputPort<T> equalTo; final transient DefaultOutputPort<T> notEqualTo; final transient DefaultOutputPort<T> lessThan; final transient DefaultOutputPort<T> greaterThan; final transient DefaultOutputPort<T> lessThanOrEqualTo; final transient DefaultOutputPort<T> greaterThanOrEqualTo; }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testNodeProcessing() { LogicalCompareToConstant<Integer> oper = new LogicalCompareToConstant<Integer>() { }; CollectorTestSink eSink = new CollectorTestSink(); CollectorTestSink neSink = new CollectorTestSink(); CollectorTestSink gtSink = new CollectorTestSink(); CollectorTestSink gteSink = new CollectorTestSink(); CollectorTestSink ltSink = new CollectorTestSink(); CollectorTestSink lteSink = new CollectorTestSink(); oper.equalTo.setSink(eSink); oper.notEqualTo.setSink(neSink); oper.greaterThan.setSink(gtSink); oper.greaterThanOrEqualTo.setSink(gteSink); oper.lessThan.setSink(ltSink); oper.lessThanOrEqualTo.setSink(lteSink); oper.setConstant(2); oper.beginWindow(0); oper.input.process(1); oper.input.process(2); oper.input.process(3); oper.endWindow(); Assert.assertEquals("number emitted tuples", 1, eSink.collectedTuples.size()); Assert.assertEquals("tuples were", eSink.collectedTuples.get(0).equals(2), true); Assert.assertEquals("number emitted tuples", 2, neSink.collectedTuples.size()); Assert.assertEquals("tuples were", neSink.collectedTuples.get(0).equals(1), true); Assert.assertEquals("tuples were", neSink.collectedTuples.get(1).equals(3), true); Assert.assertEquals("number emitted tuples", 1, gtSink.collectedTuples.size()); Assert.assertEquals("tuples were", gtSink.collectedTuples.get(0).equals(1), true); Assert.assertEquals("number emitted tuples", 2, gteSink.collectedTuples.size()); Assert.assertEquals("tuples were", gteSink.collectedTuples.get(0).equals(1), true); Assert.assertEquals("tuples were", gteSink.collectedTuples.get(1).equals(2), true); Assert.assertEquals("number emitted tuples", 1, ltSink.collectedTuples.size()); Assert.assertEquals("tuples were", ltSink.collectedTuples.get(0).equals(3), true); Assert.assertEquals("number emitted tuples", 2, lteSink.collectedTuples.size()); Assert.assertEquals("tuples were", lteSink.collectedTuples.get(0).equals(2), true); Assert.assertEquals("tuples were", lteSink.collectedTuples.get(1).equals(3), true); }