Java Code Examples for io.siddhi.core.SiddhiManager#validateSiddhiApp()

The following examples show how to use io.siddhi.core.SiddhiManager#validateSiddhiApp() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValidateTestCase.java    From siddhi with Apache License 2.0 6 votes vote down vote up
@Test
public void validateTest1() throws InterruptedException {
    log.info("validate test1");
    SiddhiManager siddhiManager = new SiddhiManager();

    String siddhiApp = "" +
            "@app:name('validateTest') " +
            "" +
            "define stream cseEventStream (symbol string, price float, volume long);" +
            "" +
            "@info(name = 'query1') " +
            "from cseEventStream[symbol is null] " +
            "select symbol, price " +
            "insert into outputStream;";

    siddhiManager.validateSiddhiApp(siddhiApp);

}
 
Example 2
Source File: ValidateTestCase.java    From siddhi with Apache License 2.0 6 votes vote down vote up
@Test(expectedExceptions = SiddhiAppCreationException.class)
public void validateTest2() throws InterruptedException {
    log.info("validate test2");
    SiddhiManager siddhiManager = new SiddhiManager();

    String siddhiApp = "" +
            "@app:name('validateTest') " +
            "" +
            "define stream cseEventStream (symbol string, price float, volume long);" +
            "" +
            "@info(name = 'query1') " +
            "from cseEventStreamA[symbol is null] " +
            "select symbol, price " +
            "insert into outputStream;";


    siddhiManager.validateSiddhiApp(siddhiApp);

}
 
Example 3
Source File: ValidateTestCase.java    From siddhi with Apache License 2.0 6 votes vote down vote up
@Test
public void validateTest3() throws InterruptedException {
    log.info("validate test3");
    SiddhiManager siddhiManager = new SiddhiManager();

    System.setProperty("stream", "cseEventStream");

    String siddhiApp = "" +
            "@app:name('validateTest') " +
            "" +
            "define stream ${stream} (symbol string, price float, volume long);" +
            "" +
            "@info(name = 'query1') " +
            "from cseEventStream " +
            "select symbol, price, '${JAVA_HOME}' as javaHome " +
            "insert into outputStream;";

    siddhiManager.validateSiddhiApp(siddhiApp);
    System.clearProperty("stream");

}
 
Example 4
Source File: ValidateTestCase.java    From siddhi with Apache License 2.0 6 votes vote down vote up
@Test(expectedExceptions = SiddhiParserException.class)
public void validateTest4() throws InterruptedException {
    log.info("validate test4");
    SiddhiManager siddhiManager = new SiddhiManager();

    System.setProperty("streams", "cseEventStream");
    try {
        String siddhiApp = "" +
                "@app:name('validateTest') " +
                "" +
                "define stream ${stream} (symbol string, price float, volume long);" +
                "" +
                "@info(name = 'query1') " +
                "from cseEventStream " +
                "select symbol, price " +
                "insert into outputStream;";

        siddhiManager.validateSiddhiApp(siddhiApp);
    } finally {
        System.clearProperty("streams");

    }

}
 
Example 5
Source File: AbstractSiddhiOperator.java    From flink-siddhi with Apache License 2.0 5 votes vote down vote up
/**
 * Validate execution plan during building DAG before submitting to execution environment and fail-fast.
 */
private static void validate(final SiddhiOperatorContext siddhiPlan) {
    SiddhiManager siddhiManager = siddhiPlan.createSiddhiManager();
    try {
        siddhiManager.validateSiddhiApp(siddhiPlan.getAllEnrichedExecutionPlan());
    } finally {
        siddhiManager.shutdown();
    }
}