• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java EventPrinter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testClusTree2D_24

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的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: testFilterQuery68

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的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


示例3: testFilterQuery102

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的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


示例4: testFilterQuery40

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testFilterQuery40() throws InterruptedException {
    log.info("Filter test40");

    SiddhiManager siddhiManager = new SiddhiManager();

    InputHandler inputHandler = siddhiManager.defineStream("define stream cseEventStream (symbol string, price float, 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", 50f, 50});
    inputHandler.send(new Object[]{"IBM", 55f, 100});
    Thread.sleep(100);
    Assert.assertEquals(1, count);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:24,代码来源:FilterTestCase.java


示例5: testFilterQuery64

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的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


示例6: testFilterQuery48

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testFilterQuery48() throws InterruptedException {
    log.info("Filter test48");

    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 > 50d] 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(2, count);
    siddhiManager.shutdown();

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


示例7: testFilterQuery67

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testFilterQuery67() throws InterruptedException {
    log.info("Filter test67");

    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 <= 60d] 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(2, count);
    siddhiManager.shutdown();

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


示例8: testFunctionQuery9

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testFunctionQuery9() throws InterruptedException {
    log.info("Function test9");

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

    String queryReference = siddhiManager.addQuery("from cseEventStream" +
            " select symbol, concat(price1,price2) as price,quantity;");

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

    inputHandler.send(new Object[]{"WSO2", 50f, 60f, 60l, 6});
    Thread.sleep(100);
    junit.framework.Assert.assertEquals(1, eventCount);
    siddhiManager.shutdown();

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


示例9: testFunctionQuery10

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testFunctionQuery10() throws InterruptedException {
    log.info("Function test10");

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

    String queryReference = siddhiManager.addQuery("from cseEventStream" +
            " select symbol, concat(symbol,' ',price2) as price,quantity;");

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

    inputHandler.send(new Object[]{"WSO2", 50f, 60f, 60l, 6});
    Thread.sleep(100);
    junit.framework.Assert.assertEquals(1, eventCount);
    siddhiManager.shutdown();

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


示例10: testConvertFunctionQuery4

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的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


示例11: testConvertFunctionQuery5

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

    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,typeS,typeS,typeS) 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


示例12: testConvertFunctionQuery7

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的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


示例13: testFilterQuery49

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testFilterQuery49() throws InterruptedException {
    log.info("Filter test49");

    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.INT));


    String queryReference = siddhiManager.addQuery("from cseEventStream[volume > 50d] 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, 60});
    inputHandler.send(new Object[]{"WSO2", 70f, 40});
    inputHandler.send(new Object[]{"WSO2", 44f, 200});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

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


示例14: testConvertFunctionQuery12

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testConvertFunctionQuery12() throws InterruptedException {
    log.info("ConvertFunction test12");

    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,typeSF,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", "dd:MM:yy", "MM-dd-yy", 1d, 1, 1373043027082l, true});
    junit.framework.Assert.assertEquals(1, eventCount);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:25,代码来源:ConvertTestCase.java


示例15: testClusTree2D_27

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testClusTree2D_27() throws Exception {
    logger.info("ClusTreeStreamProcessorExtension Test - Test case to demo separate thread training");
    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");
    Random random = new Random();
    try {
        for (int i = 0; i < 1100; i++) {
            inputHandler.send(new Object[]{random.nextInt(50), random.nextInt(50)});
            inputHandler.send(new Object[]{random.nextInt(50) + 100, random.nextInt(50) + 100});
        }
    } catch (Exception e) {
        logger.error(e.getCause().getMessage());
    } finally {
        siddhiAppRuntime.shutdown();
    }
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:35,代码来源:ClusTreeStreamProcessorExtensionTest.java


示例16: testHoeffdingClassifierLearningExtension5

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testHoeffdingClassifierLearningExtension5() throws InterruptedException {
    logger.info("HoeffdingClassifierUpdaterStreamProcessorExtension TestCase - Label is of bool type");

    SiddhiManager siddhiManager = new SiddhiManager();

    String inStreamDefinition = "define stream StreamA (attribute_0 double, attribute_1 double, attribute_2 "
            + "double, attribute_3 double, attribute_4 bool );";

    String query = ("@info(name = 'query1') from StreamA#streamingml:updateHoeffdingTree('model1', 2, "
            + "attribute_0, attribute_1 , attribute_2 ,attribute_3,attribute_4) select attribute_0, "
            + "attribute_1, attribute_2, attribute_3, accuracy insert into"
            + " outputStream;");

    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(inStreamDefinition + query);
    siddhiAppRuntime.addCallback("query1", new QueryCallback() {

        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            count.incrementAndGet();
            EventPrinter.print(inEvents);
        }
    });
    try {
        InputHandler inputHandler = siddhiAppRuntime.getInputHandler("StreamA");
        siddhiAppRuntime.start();
        inputHandler.send(new Object[]{0.1, 0.8, 0.2, 0.03, true});
        inputHandler.send(new Object[]{0.2, 0.95, 0.22, 0.1, true});
        inputHandler.send(new Object[]{0.8, 0.1, 0.65, 0.92, false});
        inputHandler.send(new Object[]{0.75, 0.1, 0.58, 0.71, false});

        SiddhiTestHelper.waitForEvents(200, 4, count, 60000);

    } catch (Exception e) {
        logger.error(e.getCause().getMessage());
    } finally {
        siddhiAppRuntime.shutdown();
    }
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:40,代码来源:HoeffdingClassifierUpdaterStreamProcessorExtensionTestCase.java


示例17: testBasicAuthTrueWrongConf

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testBasicAuthTrueWrongConf() throws Exception {
    URI baseURI = URI.create(String.format("http://%s:%d", "localhost", 8009));
    receivedEventNameList = new ArrayList<>(2);
    PersistenceStore persistenceStore = new InMemoryPersistenceStore();
    SiddhiManager siddhiManager = new SiddhiManager();
    siddhiManager.setPersistenceStore(persistenceStore);
    siddhiManager.setExtension("text", TextSourceMapper.class);
    String inStreamDefinition = "" + "@source(type='http', @map(type='text'), "
            + "receiver.url='http://localhost:8009/endpoints/RecPro', " + "basic.auth.enabled='true'" + ")"
            + "define stream inputStream (name string, age int, country string);";
    String query = ("@info(name = 'query1') " + "from inputStream " + "select *  " + "insert into outputStream;");
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager
            .createSiddhiAppRuntime(inStreamDefinition + query);
    siddhiAppRuntime.addCallback("query1", new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            for (Event event : inEvents) {
                eventCount.incrementAndGet();
                receivedEventNameList.add(event.getData(0).toString());
            }
        }
    });
    siddhiAppRuntime.start();
    // publishing events
    List<String> expected = new ArrayList<>();
    String event1 = "name:\"John\",\n" +
            "age:100,\n" +
            "country:\"USA\"";
    String event2 = "name:\"Mike\",\n" +
            "age:100,\n" +
            "country:\"USA\"";
    new TestUtil().httpPublishEventAuthIncorrect(event1, baseURI, true, "plain/text");
    new TestUtil().httpPublishEventAuthIncorrect(event2, baseURI, true, "plain/text");
    SiddhiTestHelper.waitForEvents(waitTime, 0, eventCount, timeout);
    Assert.assertEquals(receivedEventNameList, expected);
    siddhiAppRuntime.shutdown();
}
 
开发者ID:wso2-extensions,项目名称:siddhi-io-http,代码行数:40,代码来源:HttpSourceTestCase.java


示例18: testHTTPInputTransportEmployPayload

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
/**
 * Creating test for publishing events with empty payload.
 * @throws Exception Interrupted exception
 */
@Test
public void testHTTPInputTransportEmployPayload() throws Exception {
    logger.info("Creating test for publishing events with empty payload.");
    URI baseURI = URI.create(String.format("http://%s:%d", "localhost", 8005));
    List<String> receivedEventNameList = new ArrayList<>(2);
    SiddhiManager siddhiManager = new SiddhiManager();
    siddhiManager.setExtension("xml-input-mapper", XmlSourceMapper.class);
    String inStreamDefinition = "@source(type='http', @map(type='xml'), receiver.url='http://localhost:8005" +
            "/endpoints/RecPro', basic.auth.enabled='false')"
            + "define stream inputStream (name string, age int, country string);";
    String query = (
            "@info(name = 'query') "
                    + "from inputStream "
                    + "select *  "
                    + "insert into outputStream;"
                    );
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager
            .createSiddhiAppRuntime(inStreamDefinition + query);
    siddhiAppRuntime.addCallback("query", new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            for (Event event : inEvents) {
                eventCount.incrementAndGet();
                receivedEventNameList.add(event.getData(0).toString());
            }
        }
    });
    siddhiAppRuntime.start();
    // publishing events
    List<String> expected = new ArrayList<>(2);
    HttpTestUtil.httpPublishEmptyPayload(baseURI);
    HttpTestUtil.httpPublishEmptyPayload(baseURI);
    SiddhiTestHelper.waitForEvents(waitTime, 0, eventCount, timeout);
    Assert.assertEquals(receivedEventNameList.toString(), expected.toString());
    siddhiAppRuntime.shutdown();
}
 
开发者ID:wso2-extensions,项目名称:siddhi-io-http,代码行数:42,代码来源:HttpBasicTestCase.java


示例19: testFilterQuery100

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testFilterQuery100() throws InterruptedException {
    log.info("Filter test100");

    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).attribute("quantity", Attribute.Type.INT));

    Query query = QueryFactory.createQuery();
    query.from(QueryFactory.inputStream("cseEventStream").filter(Condition.compare(Expression.variable("volume"), Condition.Operator.GREATER_THAN_EQUAL, Expression.value(40l))));
    query.select(QueryFactory.outputSelector().select("symbol", Expression.variable("symbol")).select("price", Expression.variable("price")).select("quantity", Expression.variable("quantity")));
    query.insertInto("outputStream");
    String queryReference = siddhiManager.addQuery(query);
    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", 500f, 50l, 6});
    inputHandler.send(new Object[]{"WSO2", 70f, 20l, 2});
    inputHandler.send(new Object[]{"WSO2", 50f, 300l, 4});
    Thread.sleep(100);
    Assert.assertEquals(2, count);
    siddhiManager.shutdown();

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


示例20: testWindowDistributedQuery12

import org.wso2.siddhi.core.util.EventPrinter; //导入依赖的package包/类
@Test
public void testWindowDistributedQuery12() throws InterruptedException {
    log.info("WindowDistributed test12");

    SiddhiConfiguration configuration = new SiddhiConfiguration();
    configuration.setDistributedProcessing(true);
    SiddhiManager siddhiManager = new SiddhiManager(configuration);

    siddhiManager.defineStream("define stream LoginEvents (timeStamp long, ip string) ");

    String queryReference = siddhiManager.addQuery("from LoginEvents#window.unique(ip) " +
                                                   "select count(ip) as ipCount, ip " +
                                                   "insert into uniqueIps ;");

    siddhiManager.addCallback(queryReference, new QueryCallback() {
        @Override
        public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
            EventPrinter.print(timeStamp, inEvents, removeEvents);
            if (inEvents != null) {
                lastValue = (Long) inEvents[inEvents.length - 1].getData0();
            }
            eventArrived = true;
        }

    });
    InputHandler loginSucceedEvents = siddhiManager.getInputHandler("LoginEvents");

    loginSucceedEvents.send(new Object[]{System.currentTimeMillis(), "192.10.1.3"});
    loginSucceedEvents.send(new Object[]{System.currentTimeMillis(), "192.10.1.3"});
    Thread.sleep(1000);
    loginSucceedEvents.send(new Object[]{System.currentTimeMillis(), "192.10.1.4"});
    loginSucceedEvents.send(new Object[]{System.currentTimeMillis(), "192.10.1.3"});
    loginSucceedEvents.send(new Object[]{System.currentTimeMillis(), "192.10.1.5"});

    Thread.sleep(1000);

    Assert.assertEquals("Event arrived", true, eventArrived);
    Assert.assertEquals("Unique event value", Long.valueOf(3), lastValue);
    siddhiManager.shutdown();
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:41,代码来源:WindowDistributedTestCase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MatFileReader类代码示例发布时间:2022-05-23
下一篇:
Java AttribFlags类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap