Source:
<code>public void testQuery4() throws InterruptedException { log.info("testPatternWithin4 - OUT 1 : Within clause for grouped pattern states"); SiddhiManager siddhiManager = new SiddhiManager(); String streams = "" + "define stream Stream1 (symbol string, price float, volume int); "; String query = "" + "@info(name = 'query1') " + "from every (e1=Stream1 -> e2=Stream1[symbol == e1.symbol]) within 5 sec " + "select e1.symbol as symbol1, e1.volume as volume1, e2.symbol as symbol2, e2.volume as volume2 " + "insert into OutputStream ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query); siddhiAppRuntime.addCallback("query1", new QueryCallback() { @Override public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { EventPrinter.print(timestamp, inEvents, removeEvents); if (inEvents != null) { inEventCount = inEventCount + inEvents.length; <START> AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 200, "WSO2", 250}, inEvents[0].getData()); <END> eventArrived = true; } if (removeEvents != null) { removeEventCount = removeEventCount + removeEvents.length; } eventArrived = true; } }); InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1"); siddhiAppRuntime.start(); stream1.send(new Object[]{"WSO2", 55.6f, 100}); Thread.sleep(6000); stream1.send(new Object[]{"WSO2", 55.7f, 150}); Thread.sleep(500); stream1.send(new Object[]{"WSO2", 58.7f, 200}); stream1.send(new Object[]{"WSO2", 58.7f, 250}); Thread.sleep(500); AssertJUnit.assertEquals("Number of success events", 1, inEventCount); AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount); AssertJUnit.assertEquals("Event arrived", true, eventArrived); siddhiAppRuntime.shutdown(); }</code><technical_language>output need {"WSO2", 150, "WSO2", 200} ?</technical_language>

Target:
public void testQuery4() throws InterruptedException { log.info("testPatternWithin4 - OUT 1 : Within clause for grouped pattern states"); SiddhiManager siddhiManager = new SiddhiManager(); String streams = "" + "define stream Stream1 (symbol string, price float, volume int); "; String query = "" + "@info(name = 'query1') " + "from every (e1=Stream1 -> e2=Stream1[symbol == e1.symbol]) within 5 sec " + "select e1.symbol as symbol1, e1.volume as volume1, e2.symbol as symbol2, e2.volume as volume2 " + "insert into OutputStream ;"; SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query); siddhiAppRuntime.addCallback("query1", new QueryCallback() { @Override public void receive(long timestamp, Event[] inEvents, Event[] removeEvents) { EventPrinter.print(timestamp, inEvents, removeEvents); if (inEvents != null) { inEventCount = inEventCount + inEvents.length; AssertJUnit.assertArrayEquals(new Object[]{"WSO2", 150, "WSO2", 200}, inEvents[0].getData()); eventArrived = true; } if (removeEvents != null) { removeEventCount = removeEventCount + removeEvents.length; } eventArrived = true; } }); InputHandler stream1 = siddhiAppRuntime.getInputHandler("Stream1"); siddhiAppRuntime.start(); stream1.send(new Object[]{"WSO2", 55.6f, 100}); Thread.sleep(6000); stream1.send(new Object[]{"WSO2", 55.7f, 150}); Thread.sleep(500); stream1.send(new Object[]{"WSO2", 58.7f, 200}); stream1.send(new Object[]{"WSO2", 58.7f, 250}); Thread.sleep(500); AssertJUnit.assertEquals("Number of success events", 1, inEventCount); AssertJUnit.assertEquals("Number of remove events", 0, removeEventCount); AssertJUnit.assertEquals("Event arrived", true, eventArrived); siddhiAppRuntime.shutdown(); }