Skip to content

Commit

Permalink
Add testcase for siddhi-io#1542
Browse files Browse the repository at this point in the history
  • Loading branch information
dilini-muthumala committed Apr 22, 2021
1 parent ab58ff0 commit de77cce
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,40 @@ public void receive(Event[] events) {

}

@Test(dependsOnMethods = "testQuery7")
public void testQuery8() throws InterruptedException {
//see https://github.com/siddhi-io/siddhi/issues/1542
log.info("test case for https://github.com/siddhi-io/siddhi/issues/1542");

SiddhiManager siddhiManager = new SiddhiManager();

String plan = "" +
"define trigger AlertTypeReadTrigger at 'start';" +
"@sink(type='log')\n" +
"define stream logStream (foo string);\n" +
"\n" +
"from AlertTypeReadTrigger\n" +
"select \"hello\" as foo\n" +
"insert into logStream;";

SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(plan);

siddhiAppRuntime.addCallback("logStream", new StreamCallback() {

@Override
public void receive(Event[] events) {
EventPrinter.print(events);
count += events.length;
eventArrived = true;
}
});

siddhiAppRuntime.start();

Thread.sleep(1000);
siddhiAppRuntime.shutdown();
AssertJUnit.assertEquals(1, count);
AssertJUnit.assertEquals(true, eventArrived);
}

}

0 comments on commit de77cce

Please sign in to comment.