Search in sources :

Example 96 with SiddhiApp

use of io.siddhi.query.api.SiddhiApp in project siddhi by wso2.

the class DefineTableTestCase method testQuery1.

@Test
public void testQuery1() throws InterruptedException {
    log.info("testTableDefinition1 - OUT 0");
    SiddhiManager siddhiManager = new SiddhiManager();
    TableDefinition tableDefinition = TableDefinition.id("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.INT);
    SiddhiApp siddhiApp = new SiddhiApp("ep1");
    siddhiApp.defineTable(tableDefinition);
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);
    siddhiAppRuntime.shutdown();
}
Also used : SiddhiApp(io.siddhi.query.api.SiddhiApp) TableDefinition(io.siddhi.query.api.definition.TableDefinition) SiddhiAppRuntime(io.siddhi.core.SiddhiAppRuntime) SiddhiManager(io.siddhi.core.SiddhiManager) Test(org.testng.annotations.Test)

Example 97 with SiddhiApp

use of io.siddhi.query.api.SiddhiApp in project siddhi by wso2.

the class TriggerTestCase method testQuery2.

@Test(expectedExceptions = SiddhiAppValidationException.class, dependsOnMethods = "testQuery1")
public void testQuery2() throws InterruptedException {
    log.info("testTrigger2 - OUT 0");
    SiddhiManager siddhiManager = new SiddhiManager();
    TriggerDefinition triggerDefinition = TriggerDefinition.id("cseEventStream").atEvery(Expression.Time.milliSec(500)).at("start");
    SiddhiApp siddhiApp = new SiddhiApp("ep1");
    siddhiApp.defineTrigger(triggerDefinition);
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);
    siddhiAppRuntime.shutdown();
}
Also used : SiddhiApp(io.siddhi.query.api.SiddhiApp) TriggerDefinition(io.siddhi.query.api.definition.TriggerDefinition) SiddhiAppRuntime(io.siddhi.core.SiddhiAppRuntime) SiddhiManager(io.siddhi.core.SiddhiManager) Test(org.testng.annotations.Test)

Aggregations

SiddhiApp (io.siddhi.query.api.SiddhiApp)97 Test (org.testng.annotations.Test)93 SiddhiAppRuntime (io.siddhi.core.SiddhiAppRuntime)90 SiddhiManager (io.siddhi.core.SiddhiManager)89 StreamDefinition (io.siddhi.query.api.definition.StreamDefinition)88 Query (io.siddhi.query.api.execution.query.Query)86 InputHandler (io.siddhi.core.stream.input.InputHandler)84 Event (io.siddhi.core.event.Event)82 QueryCallback (io.siddhi.core.query.output.callback.QueryCallback)74 Partition (io.siddhi.query.api.execution.partition.Partition)10 StreamCallback (io.siddhi.core.stream.output.StreamCallback)9 FunctionDefinition (io.siddhi.query.api.definition.FunctionDefinition)4 TriggerDefinition (io.siddhi.query.api.definition.TriggerDefinition)2 Gson (com.google.gson.Gson)1 Source (io.siddhi.core.stream.input.source.Source)1 Sink (io.siddhi.core.stream.output.sink.Sink)1 InMemoryTable (io.siddhi.core.table.InMemoryTable)1 Table (io.siddhi.core.table.Table)1 TableDefinition (io.siddhi.query.api.definition.TableDefinition)1 ExecutionElement (io.siddhi.query.api.execution.ExecutionElement)1