当前位置: 首页>>代码示例>>Java>>正文


Java Event类代码示例

本文整理汇总了Java中org.wso2.siddhi.core.event.Event的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Event类属于org.wso2.siddhi.core.event包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testClusTree2D_24

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testClusTree2D_24() throws Exception {
    logger.info("ClusTreeStreamProcessorExtension Test - Test case with non-numeric event data");
    SiddhiManager siddhiManager = new SiddhiManager();
    String inputStream = "define stream InputStream (x double, y double);";

    String query = (
            "@info(name = 'query1') " +
                    "from InputStream#streamingml:clusTree(2, x, y) " +
                    "select closestCentroidCoordinate1, closestCentroidCoordinate2, x, y " +
                    "insert into OutputStream;");
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inputStream + query);

    siddhiAppRuntime.addCallback("query1", new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(inEvents);
        }
    });


    siddhiAppRuntime.start();
    InputHandler inputHandler = siddhiAppRuntime.getInputHandler("InputStream");
    inputHandler.send(new Object[]{5.7905, "hi"});
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:26,代码来源:ClusTreeStreamProcessorExtensionTest.java

示例2: mapAndSend

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Override
public void mapAndSend(Event[] events, OptionHolder optionHolder,
                       Map<String, TemplateBuilder> payloadTemplateBuilderMap, SinkListener sinkListener) {

    StringBuilder sb = new StringBuilder();
    if (payloadTemplateBuilderMap == null) {
        String jsonString = constructJsonForDefaultMapping(events);
        sb.append(jsonString);
    } else {
        sb.append(constructJsonForCustomMapping(events,
                payloadTemplateBuilderMap.get(payloadTemplateBuilderMap.keySet().iterator().next())));
    }

    if (!isJsonValidationEnabled) {
        sinkListener.publish(sb.toString());
    } else if (isValidJson(sb.toString())) {
        sinkListener.publish(sb.toString());
    } else {
        log.error("Invalid json string : " + sb.toString() + ". Hence dropping the message.");
    }
}
 
开发者ID:wso2-extensions,项目名称:siddhi-map-json,代码行数:22,代码来源:JsonSinkMapper.java

示例3: testConvertFunctionQuery8

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testConvertFunctionQuery8() throws InterruptedException {
    log.info("ConvertFunction test8");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream("define stream typeStream (typeS string, typeF float, typeD double, typeI int, typeL long, typeB bool) ");


    String queryReference = siddhiManager.addQuery("from typeStream " +
                                                   " select convert(typeL,string,'dd:MM:yy') as type1;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            eventCount++;
            Assert.assertEquals("05:07:13", inEvents[0].getData0());
        }
    });

    inputHandler.send(new Object[]{"23:01:13", 1f, 1d, 1, 1373043027082l, true});
    junit.framework.Assert.assertEquals(1, eventCount);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:25,代码来源:ConvertTestCase.java

示例4: testFilterQuery89

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery89() throws InterruptedException {
    log.info("Filter test89");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE).attribute("quantity", Attribute.Type.INT));

    String queryReference = siddhiManager.addQuery("from cseEventStream[quantity < 50d] select symbol,price,quantity;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d, 10});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d, 56});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例5: testFilterQuery87

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery87() throws InterruptedException {
    log.info("Filter test87");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[price < 50d] select symbol,price;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例6: process

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
public BundleEvent process(BundleEvent bundleEvent) {
    BundleEvent resultEvent = bundleEvent.getNewInstance();
    for (AtomicEvent event : bundleEvent.getEvents()) {
        if (conditionExecutor.execute(event)) {
            if (bundleEvent instanceof ListEvent) {
                ((ListEvent) resultEvent).addEvent((Event) event);
            } else {
                ((ListAtomicEvent) resultEvent).addEvent(event);

            }
        }
    }
    if (resultEvent.getActiveEvents() > 0) {
        return resultEvent;
    }
    return null;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:18,代码来源:FilterProcessor.java

示例7: testFilterQuery35

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery35() throws InterruptedException {
    log.info("Filter test35");

    SiddhiManager siddhiManager = new SiddhiManager();

    InputHandler inputHandler = siddhiManager.defineStream("define stream cseEventStream (symbol string, price double, volume int)");
    String queryReference = siddhiManager.addQuery("from cseEventStream[price != 50f ] select symbol,price,volume insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50d, 50});
    inputHandler.send(new Object[]{"IBM", 55d, 100});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:24,代码来源:FilterTestCase.java

示例8: testFilterQuery102

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery102() throws InterruptedException {
    log.info("Filter test102");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.DOUBLE));

    String queryReference = siddhiManager.addQuery("from cseEventStream[price >= 55f] select symbol,price;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60d});
    inputHandler.send(new Object[]{"WSO2", 70f, 40d});
    inputHandler.send(new Object[]{"WSO2", 44f, 200d});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例9: testConvertFunctionQuery7

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test(expected = QueryCreationException.class)
public void testConvertFunctionQuery7() throws InterruptedException {
    log.info("ConvertFunction test7");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream("define stream typeStream (typeS string, typeF float, typeD double, typeI int, typeL long, typeB bool) ");


    String queryReference = siddhiManager.addQuery("from typeStream " +
                                                   " select convert(typeS,int,'dd:MM:yy') as type1;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            eventCount++;
        }
    });

    inputHandler.send(new Object[]{"23:01:13", 1f, 1d, 1, 1l, true});
    junit.framework.Assert.assertEquals(1, eventCount);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:24,代码来源:ConvertTestCase.java

示例10: testFilterQuery36

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery36() throws InterruptedException {
    log.info("Filter test36");

    SiddhiManager siddhiManager = new SiddhiManager();

    InputHandler inputHandler = siddhiManager.defineStream("define stream cseEventStream (symbol string, price double, volume int)");
    String queryReference = siddhiManager.addQuery("from cseEventStream[price != 50d ] select symbol,price,volume insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50d, 50});
    inputHandler.send(new Object[]{"IBM", 55d, 100});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:24,代码来源:FilterTestCase.java

示例11: testConvertFunctionQuery14

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testConvertFunctionQuery14() throws InterruptedException {
    log.info("ConvertFunction test14");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream("define stream typeStream (typeS string, typeSF string, typeSF2 string, typeD double, typeI int, typeL long, typeB bool) ");


    String queryReference = siddhiManager.addQuery("from typeStream " +
                                                   " select convert(typeS, string,\"dd:MM:yy\",typeSF2) as type1;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            eventCount++;
            Assert.assertEquals("01-23-13", inEvents[0].getData0());
        }
    });

    inputHandler.send(new Object[]{"23:01:13", "", "MM-dd-yy", 1d, 1, 1373043027082l, true});
    junit.framework.Assert.assertEquals(1, eventCount);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:25,代码来源:ConvertTestCase.java

示例12: testFilterQuery64

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery64() throws InterruptedException {
    log.info("Filter test64");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.LONG));

    String queryReference = siddhiManager.addQuery("from cseEventStream[volume == 40f ] select symbol,price insert into outputStream;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50f, 60l});
    inputHandler.send(new Object[]{"WSO2", 70f, 40l});
    inputHandler.send(new Object[]{"WSO2", 44f, 200l});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java

示例13: testConvertFunctionQuery4

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test(expected = QueryCreationException.class)
public void testConvertFunctionQuery4() throws InterruptedException {
    log.info("ConvertFunction test4");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream("define stream typeStream (typeS string, typeF float, typeD double, typeI int, typeL long, typeB bool) ");


    String queryReference = siddhiManager.addQuery("from typeStream " +
                                                   " select convert(string) as type1;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            eventCount++;
        }
    });

    inputHandler.send(new Object[]{"true", 1f, 1d, 1, 1l, true});
    junit.framework.Assert.assertEquals(0, eventCount);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:25,代码来源:ConvertTestCase.java

示例14: testFilterQuery41

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery41() throws InterruptedException {
    log.info("Filter test41");

    SiddhiManager siddhiManager = new SiddhiManager();

    InputHandler inputHandler = siddhiManager.defineStream("define stream cseEventStream (symbol string, price double, volume int)");
    String queryReference = siddhiManager.addQuery("from cseEventStream[price > 50 ] select symbol,price,volume insert into outputStream ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50d, 50});
    inputHandler.send(new Object[]{"IBM", 55d, 100});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:24,代码来源:FilterTestCase.java

示例15: testFilterQuery68

import org.wso2.siddhi.core.event.Event; //导入依赖的package包/类
@Test
public void testFilterQuery68() throws InterruptedException {
    log.info("Filter test68");

    SiddhiManager siddhiManager = new SiddhiManager();
    InputHandler inputHandler = siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("cseEventStream").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.DOUBLE).attribute("volume", Attribute.Type.LONG));

    String queryReference = siddhiManager.addQuery("from cseEventStream[price <= 100f] select symbol,price insert into outputStream;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            count++;
        }
    });

    inputHandler.send(new Object[]{"WSO2", 50d, 60l});
    inputHandler.send(new Object[]{"WSO2", 70d, 40l});
    inputHandler.send(new Object[]{"WSO2", 44d, 200l});
    Thread.sleep(100);
    Assert.assertEquals(3, count);
    siddhiManager.shutdown();

}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:26,代码来源:FilterTestCase.java


注:本文中的org.wso2.siddhi.core.event.Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。