use of io.siddhi.core.exception.SiddhiAppCreationException in project siddhi by wso2.
the class DelayWindowTestCase method delayWindowTest1.
@Test(description = "Check if Siddhi App Creation fails when more than one parameter is included", expectedExceptions = SiddhiAppCreationException.class)
public void delayWindowTest1() {
log.info("DelayWindow Test1 : Testing window parameter definition2");
SiddhiManager siddhiManager = new SiddhiManager();
String query = "define window eventWindow(symbol string, price int, volume float) delay(2,3) ";
SiddhiAppRuntime siddhiAppRuntime = null;
try {
siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(query);
} catch (SiddhiAppCreationException e) {
error = false;
AssertJUnit.assertEquals("There is no parameterOverload for 'delay' that matches attribute types " + "'<INT, INT>'. Supported parameter overloads are (<INT|LONG|TIME> window.delay).", e.getCause().getMessage());
throw e;
} finally {
if (siddhiAppRuntime != null) {
siddhiAppRuntime.shutdown();
}
}
}
use of io.siddhi.core.exception.SiddhiAppCreationException in project siddhi by wso2.
the class SessionWindowTestCase method testSessionWindow2.
@Test(description = "This test checks if Siddhi App creation fails when session gap parameter is dynamic", expectedExceptions = SiddhiAppCreationException.class)
public void testSessionWindow2() {
log.info("SessionWindow Test2: Testing session window with providing session gap parameter as a dynamic one");
SiddhiManager siddhiManager = new SiddhiManager();
SiddhiAppRuntime siddhiAppRuntime = null;
String purchaseEventStream = "" + "define stream purchaseEventStream (user string, item_number int, price float, quantity int);";
String query = "" + "@info(name = 'query0') " + "from purchaseEventStream#window.session(item_number, user, 2 sec) " + "select * " + "insert all events into outputStream ;";
try {
siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query);
} catch (SiddhiAppCreationException e) {
AssertJUnit.assertEquals("The 'session' expects input parameter 'session.gap' at position '0' " + "to be static, but found a dynamic attribute.", e.getCause().getMessage());
throw e;
} finally {
if (siddhiAppRuntime != null) {
siddhiAppRuntime.shutdown();
}
}
}
use of io.siddhi.core.exception.SiddhiAppCreationException in project siddhi by wso2.
the class SessionWindowTestCase method testSessionWindow9.
@Test(description = "This test checks if Siddhi App creation fails when" + " provided 2 paramters and 2nd parameter allowedLatency with wrong data type", expectedExceptions = SiddhiAppCreationException.class)
public void testSessionWindow9() {
log.info("SessionWindow Test9: Testing session window " + "with providing 2 parameters and 2nd parameter allowedLatency type is wrong");
SiddhiManager siddhiManager = new SiddhiManager();
SiddhiAppRuntime siddhiAppRuntime = null;
String purchaseEventStream = "" + "define stream purchaseEventStream (user string, item_number int, price float, quantity int);";
String query = "" + "@info(name = 'query0') " + "from purchaseEventStream#window.session(5 sec, '5') " + "select * " + "insert all events into outputStream ;";
try {
siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query);
} catch (SiddhiAppCreationException e) {
AssertJUnit.assertEquals("Session window's allowedLatency parameter should be either int or long," + " but found STRING", e.getCause().getMessage());
throw e;
} finally {
if (siddhiAppRuntime != null) {
siddhiAppRuntime.shutdown();
}
}
}
use of io.siddhi.core.exception.SiddhiAppCreationException in project siddhi by wso2.
the class SessionWindowTestCase method testSessionWindow6.
@Test(description = "This test checks if Siddhi App creation fails when" + " allowedLatency parameter with a dynamic value", expectedExceptions = SiddhiAppCreationException.class)
public void testSessionWindow6() {
log.info("SessionWindow Test6: Testing session window " + "with providing dynamic value for allowedLatency");
SiddhiManager siddhiManager = new SiddhiManager();
SiddhiAppRuntime siddhiAppRuntime = null;
String purchaseEventStream = "" + "define stream purchaseEventStream (user string, item_number int, price float, quantity int);";
String query = "" + "@info(name = 'query0') " + "from purchaseEventStream#window.session(5 sec, user, item_number) " + "select * " + "insert all events into outputStream ;";
try {
siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(purchaseEventStream + query);
} catch (SiddhiAppCreationException e) {
AssertJUnit.assertEquals("The 'session' expects input parameter 'allowed.latency' at position " + "'2' to be static, but found a dynamic attribute.", e.getCause().getMessage());
throw e;
} finally {
if (siddhiAppRuntime != null) {
siddhiAppRuntime.shutdown();
}
}
}
Aggregations