use of org.wso2.siddhi.query.compiler.exception.SiddhiParserException in project siddhi by wso2.
the class DefineStreamTestCase method test1.
@Test
public void test1() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream cseStream ( symbol " + "string, price int, volume float )");
AssertJUnit.assertEquals(StreamDefinition.id("cseStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.INT).attribute("volume", Attribute.Type.FLOAT).toString(), streamDefinition.toString());
}
use of org.wso2.siddhi.query.compiler.exception.SiddhiParserException in project siddhi by wso2.
the class DefineStreamTestCase method testMultilevelNestedAnnotations1.
@Test
public void testMultilevelNestedAnnotations1() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("@sink(url='http://foo.com/test/{{data}}', " + " @map(type='xml', " + "@payload('<test><time>{{time}}</time></test>')" + " )" + ") " + "define stream fooStream (id int, name string);");
AssertJUnit.assertEquals(StreamDefinition.id("fooStream").attribute("id", Attribute.Type.INT).attribute("name", Attribute.Type.STRING).annotation(Annotation.annotation("sink").element("url", "http://foo.com/test/{{data}}").annotation(Annotation.annotation("map").element("type", "xml").annotation(Annotation.annotation("payload").element("<test><time>{{time}}</time></test>")))), streamDefinition);
}
use of org.wso2.siddhi.query.compiler.exception.SiddhiParserException in project siddhi by wso2.
the class DefineStreamTestCase method test2.
@Test
public void test2() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream `define` ( `string` " + "string, price int, volume float );");
AssertJUnit.assertEquals(StreamDefinition.id("define").attribute("string", Attribute.Type.STRING).attribute("price", Attribute.Type.INT).attribute("volume", Attribute.Type.FLOAT).toString(), streamDefinition.toString());
}
use of org.wso2.siddhi.query.compiler.exception.SiddhiParserException in project siddhi by wso2.
the class DefineStreamTestCase method testEqualObjects.
@Test
public void testEqualObjects() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("@Foo(name='bar','Custom')define " + "stream cseStream ( symbol string, price int, volume float )");
AssertJUnit.assertEquals(StreamDefinition.id("cseStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.INT).attribute("volume", Attribute.Type.FLOAT).annotation(Annotation.annotation("Foo").element("name", "bar").element("Custom")), streamDefinition);
}
use of org.wso2.siddhi.query.compiler.exception.SiddhiParserException in project siddhi by wso2.
the class DefineStreamTestCase method testMultilevelNestedAnnotations2.
@Test
public void testMultilevelNestedAnnotations2() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("" + "@source(" + " type='http', " + " context='/test', " + " transport='http,https', " + " @map(" + " type='xml', " + " namespace = \"h=uri, a=uri\", " + " @attributes(" + " '//h:time', " + " '//h:data'" + " )" + " )" + ") " + "define stream fooStream (id int, name string);");
AssertJUnit.assertEquals(StreamDefinition.id("fooStream").attribute("id", Attribute.Type.INT).attribute("name", Attribute.Type.STRING).annotation(Annotation.annotation("source").element("type", "http").element("context", "/test").element("transport", "http,https").annotation(Annotation.annotation("map").element("type", "xml").element("namespace", "h=uri, a=uri").annotation(Annotation.annotation("attributes").element("//h:time").element("//h:data")))), streamDefinition);
}
Aggregations