本文整理汇总了Java中org.wso2.siddhi.query.compiler.SiddhiCompiler.parseStreamDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java SiddhiCompiler.parseStreamDefinition方法的具体用法?Java SiddhiCompiler.parseStreamDefinition怎么用?Java SiddhiCompiler.parseStreamDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.siddhi.query.compiler.SiddhiCompiler
的用法示例。
在下文中一共展示了SiddhiCompiler.parseStreamDefinition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMultilevelNestedAnnotations1
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@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);
}
示例2: Test1
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test1() throws RecognitionException, SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream cseStream ( symbol string, price int, volume float )");
Assert.assertEquals(new StreamDefinition().
name("cseStream").
attribute("symbol", Attribute.Type.STRING).
attribute("price", Attribute.Type.INT).
attribute("volume", Attribute.Type.FLOAT).toString(),
streamDefinition.toString());
}
示例3: Test2
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test2() throws RecognitionException, SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream `define` ( `string` string, price int, volume float );");
Assert.assertEquals(new StreamDefinition().
name("define").
attribute("string", Attribute.Type.STRING).
attribute("price", Attribute.Type.INT).
attribute("volume", Attribute.Type.FLOAT).toString(),
streamDefinition.toString());
}
示例4: test1
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@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());
}
示例5: test2
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@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());
}
示例6: testCreatingStreamDefinition
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void testCreatingStreamDefinition() {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream StockStream ( symbol " +
"string, price int, volume float );");
StreamDefinition api = StreamDefinition.id("StockStream").attribute("symbol", Attribute.Type.STRING)
.attribute("price", Attribute.Type.INT).attribute("volume", Attribute.Type.FLOAT);
AssertJUnit.assertEquals(api, streamDefinition);
}
示例7: testCreatingStreamWithDuplicateAttribute
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test(expectedExceptions = SiddhiParserException.class)
public void testCreatingStreamWithDuplicateAttribute() {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream StockStream ( symbol " +
"string, symbol int, volume float );");
// StreamDefinition.id("StockStream").attribute("symbol", Attribute.Type.STRING).attribute("symbol", Attribute
// .Type.INT).attribute("volume", Attribute.Type.FLOAT);
}
示例8: testCreatingStreamDefinition2
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void testCreatingStreamDefinition2() {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream StockStream ( symbol " +
"string, price int, volume double, data Object );");
StreamDefinition api = StreamDefinition.id("StockStream").attribute("symbol", Attribute.Type.STRING)
.attribute("price", Attribute.Type.INT).attribute("volume", Attribute.Type.DOUBLE).attribute("data",
Attribute.Type.OBJECT);
AssertJUnit.assertEquals(api, streamDefinition);
}
示例9: testEqualObjects
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@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);
}
示例10: testMultilevelNestedAnnotations2
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@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);
}
示例11: Test1
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test1() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream cseStream ( symbol string, price int, volume float )");
Assert.assertEquals(StreamDefinition.
id("cseStream").
attribute("symbol", Attribute.Type.STRING).
attribute("price", Attribute.Type.INT).
attribute("volume", Attribute.Type.FLOAT).toString(),
streamDefinition.toString());
}
示例12: Test2
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void Test2() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream `define` ( `string` string, price int, volume float );");
Assert.assertEquals(StreamDefinition.
id("define").
attribute("string", Attribute.Type.STRING).
attribute("price", Attribute.Type.INT).
attribute("volume", Attribute.Type.FLOAT).toString(),
streamDefinition.toString());
}
示例13: testEqualObjects
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void testEqualObjects() throws SiddhiParserException {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("@Foo(name='bar','Custom')define stream cseStream ( symbol string, price int, volume float )");
Assert.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);
}
示例14: testCreatingStreamDefinition
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test
public void testCreatingStreamDefinition() {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream StockStream ( symbol string, price int, volume float );");
StreamDefinition api = StreamDefinition.id("StockStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.INT).attribute("volume", Attribute.Type.FLOAT);
Assert.assertEquals(api, streamDefinition);
}
示例15: testCreatingStreamWithDuplicateAttribute
import org.wso2.siddhi.query.compiler.SiddhiCompiler; //导入方法依赖的package包/类
@Test(expected = SiddhiParserException.class)
public void testCreatingStreamWithDuplicateAttribute() {
StreamDefinition streamDefinition = SiddhiCompiler.parseStreamDefinition("define stream StockStream ( symbol string, symbol int, volume float );");
// StreamDefinition.id("StockStream").attribute("symbol", Attribute.Type.STRING).attribute("symbol", Attribute.Type.INT).attribute("volume", Attribute.Type.FLOAT);
}