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


Java EPDataFlowInstantiationOptions类代码示例

本文整理汇总了Java中com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions的典型用法代码示例。如果您正苦于以下问题:Java EPDataFlowInstantiationOptions类的具体用法?Java EPDataFlowInstantiationOptions怎么用?Java EPDataFlowInstantiationOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: runAssertionCSVGraphSchema

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertionCSVGraphSchema(EventRepresentationChoice representationEnum) throws Exception {

        String[] fields = "myString,myInt,timestamp, myDouble".split(",");
        epService.getEPAdministrator().createEPL(representationEnum.getAnnotationText() + " create schema MyEvent(myString string, myInt int, timestamp long, myDouble double)");
        String graph = "create dataflow ReadCSV " +
                "FileSource -> mystream<MyEvent> { file: 'regression/titleRow.csv', hasHeaderLine: true, classpathFile: true }" +
                "DefaultSupportCaptureOp(mystream) {}";
        epService.getEPAdministrator().createEPL(graph);

        DefaultSupportCaptureOp outputOp = new DefaultSupportCaptureOp();
        EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("ReadCSV", new EPDataFlowInstantiationOptions().operatorProvider(new DefaultSupportGraphOpProvider(outputOp)));
        instance.run();
        List<List<Object>> received = outputOp.getAndReset();
        assertEquals(1, received.size());
        EPAssertionUtil.assertPropsPerRow(received.get(0).toArray(), fields, new Object[][]{{"one", 1, 100L, 1.1}, {"three", 3, 300L, 3.3}, {"five", 5, 500L, 5.5}});
        assertTrue(representationEnum.matchesClass(received.get(0).toArray()[0].getClass()));

        epService.getEPAdministrator().destroyAllStatements();
        epService.getEPAdministrator().getConfiguration().removeEventType("MyEvent", true);
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:TestFileSourceGraphs.java

示例2: testExistingTypeNoOptions

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
/**
 * Play a CSV file using an existing event type definition (no timestamps).
 * <p>
 * Should not require a timestamp column, should block thread until played in.
 */
public void testExistingTypeNoOptions() {
    epService = EPServiceProviderManager.getProvider("testExistingTypeNoOptions", makeConfig("TypeA", useBean));
    epService.initialize();

    EPStatement stmt = epService.getEPAdministrator().createEPL("select symbol, price, volume from TypeA#length(100)");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    (new CSVInputAdapter(epService, new AdapterInputSource(CSV_FILENAME_ONELINE_TRADE), "TypeA")).start();

    assertEquals(1, listener.getNewDataList().size());

    // test graph
    String graph = "create dataflow ReadCSV " +
            "FileSource -> mystream<TypeA> { file: '" + CSV_FILENAME_ONELINE_TRADE + "', hasTitleLine: true, classpathFile: true }" +
            "DefaultSupportCaptureOp(mystream) {}";
    epService.getEPAdministrator().createEPL(graph);

    DefaultSupportCaptureOp<Object> outputOp = new DefaultSupportCaptureOp<Object>();
    EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("ReadCSV", new EPDataFlowInstantiationOptions().operatorProvider(new DefaultSupportGraphOpProvider(outputOp)));
    instance.run();
    List<List<Object>> received = outputOp.getAndReset();
    Object[] receivedArr = received.get(0).toArray();
    assertEquals(1, receivedArr.length);
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:31,代码来源:TestCSVAdapterUseCases.java

示例3: runAssertion

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertion(String typeName, Object[] events, boolean append) throws Exception {
    // test classpath file
    String filename = "regression/out_1.csv";
    FileUtil.findDeleteClasspathFile(filename);

    String graph = "create dataflow WriteCSV " +
            "DefaultSupportSourceOp -> instream<" + typeName + ">{}" +
            "FileSink(instream) { file: '" + filename + "', classpathFile: true, append: " + append + "}";
    EPStatement stmtGraph = epService.getEPAdministrator().createEPL(graph);

    DefaultSupportSourceOp source = new DefaultSupportSourceOp(events);
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();
    options.operatorProvider(new DefaultSupportGraphOpProvider(source));
    EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("WriteCSV", options);
    instance.run();

    String[] contents = FileUtil.readClasspathTextFile(filename);
    EPAssertionUtil.assertEqualsExactOrder("1.1,1,\"one\";2.2,2,\"two\"".split(";"), contents);
    FileUtil.findDeleteClasspathFile(filename);

    stmtGraph.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:TestFileSinkGraphs.java

示例4: run

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {
    epService.getEPAdministrator().getConfiguration().addImport(MyTokenizerCounter.class.getPackage().getName() + ".*");
    epService.getEPAdministrator().getConfiguration().addImport(DefaultSupportCaptureOp.class.getPackage().getName() + ".*");

    String epl = "create dataflow WordCount " +
            "MyLineFeedSource -> LineOfTextStream {} " +
            "MyTokenizerCounter(LineOfTextStream) -> SingleLineCountStream {}" +
            "MyWordCountAggregator(SingleLineCountStream) -> WordCountStream {}" +
            "DefaultSupportCaptureOp(WordCountStream) {}";
    epService.getEPAdministrator().createEPL(epl);

    DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<Object>(1);
    MyLineFeedSource source = new MyLineFeedSource(Arrays.asList("Test this code", "Test line two").iterator());

    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
            .operatorProvider(new DefaultSupportGraphOpProvider(future, source));

    epService.getEPRuntime().getDataFlowRuntime().instantiate("WordCount", options).start();

    Object[] received = future.get(3, TimeUnit.SECONDS);
    assertEquals(1, received.length);
    MyWordCountStats stats = (MyWordCountStats) received[0];
    EPAssertionUtil.assertProps(stats, "lines,words,chars".split(","), new Object[]{2, 6, 23});
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecDataflowExampleWordCount.java

示例5: runAssertionBeanType

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertionBeanType(EPServiceProvider epService) throws Exception {
    epService.getEPAdministrator().getConfiguration().addImport(SupportBean.class);
    epService.getEPAdministrator().createEPL("create schema SupportBean SupportBean");
    epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "DefaultSupportSourceOp -> outstream<SupportBean> {}" +
            "MySupportBeanOutputOp(outstream) {}" +
            "SupportGenericOutputOpWPort(outstream) {}");

    DefaultSupportSourceOp source = new DefaultSupportSourceOp(new Object[]{new SupportBean("E1", 1)});
    MySupportBeanOutputOp outputOne = new MySupportBeanOutputOp();
    SupportGenericOutputOpWPort<SupportBean> outputTwo = new SupportGenericOutputOpWPort<SupportBean>();
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions().operatorProvider(new DefaultSupportGraphOpProvider(source, outputOne, outputTwo));
    EPDataFlowInstance dfOne = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    dfOne.run();

    EPAssertionUtil.assertPropsPerRow(outputOne.getAndReset().toArray(), "theString,intPrimitive".split(","), new Object[][]{{"E1", 1}});
    Pair<List<SupportBean>, List<Integer>> received = outputTwo.getAndReset();
    EPAssertionUtil.assertPropsPerRow(received.getFirst().toArray(), "theString,intPrimitive".split(","), new Object[][]{{"E1", 1}});
    EPAssertionUtil.assertEqualsExactOrder(new Integer[]{0}, received.getSecond().toArray());

    epService.getEPAdministrator().destroyAllStatements();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:ExecDataflowTypes.java

示例6: runAssertionMapType

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertionMapType(EPServiceProvider epService) throws Exception {
    epService.getEPAdministrator().getConfiguration().addImport(SupportBean.class);
    epService.getEPAdministrator().createEPL("create map schema MyMap (p0 String, p1 int)");
    epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "DefaultSupportSourceOp -> outstream<MyMap> {}" +
            "MyMapOutputOp(outstream) {}" +
            "DefaultSupportCaptureOp(outstream) {}");

    DefaultSupportSourceOp source = new DefaultSupportSourceOp(new Object[]{makeMap("E1", 1)});
    MyMapOutputOp outputOne = new MyMapOutputOp();
    DefaultSupportCaptureOp<SupportBean> outputTwo = new DefaultSupportCaptureOp<SupportBean>();
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions().operatorProvider(new DefaultSupportGraphOpProvider(source, outputOne, outputTwo));
    EPDataFlowInstance dfOne = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    dfOne.run();

    EPAssertionUtil.assertPropsPerRow(outputOne.getAndReset().toArray(), "p0,p1".split(","), new Object[][]{{"E1", 1}});
    EPAssertionUtil.assertPropsPerRow(outputTwo.getAndReset().get(0).toArray(), "p0,p1".split(","), new Object[][]{{"E1", 1}});

    epService.getEPAdministrator().destroyAllStatements();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:ExecDataflowTypes.java

示例7: runAssertion

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertion(EPServiceProvider epService) throws Exception {

        DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<Object>(1);
        MyObjectArrayGraphSource source = new MyObjectArrayGraphSource(Arrays.asList(
                new Object[]{"trade", "GE", 100d, 1000L, null, null}, // vwap = 100, minPrice=100
                new Object[]{"quote", "GE", null, null, 99.5d, 2000L}  //
        ).iterator());

        EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
                .operatorProvider(new DefaultSupportGraphOpProvider(future, source));

        epService.getEPRuntime().getDataFlowRuntime().instantiate("VWAPSample", options).start();

        Object[] received = future.get(5, TimeUnit.SECONDS);
        assertEquals(1, received.length);
        EPAssertionUtil.assertProps(received[0], "index".split(","), new Object[]{2000 * Math.exp(100 - 99.5)});
    }
 
开发者ID:espertechinc,项目名称:esper,代码行数:18,代码来源:ExecDataflowExampleVwapFilterSelectJoin.java

示例8: runAssertionAllTypes

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertionAllTypes(EPServiceProvider epService, String typeName, Object[] events) throws Exception {
    String graph = "create dataflow MyGraph " +
            "DefaultSupportSourceOp -> instream<" + typeName + ">{}" +
            "EventBusSink(instream) {}";
    EPStatement stmtGraph = epService.getEPAdministrator().createEPL(graph);

    EPStatement stmt = epService.getEPAdministrator().createEPL("select * from " + typeName);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

    DefaultSupportSourceOp source = new DefaultSupportSourceOp(events);
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();
    options.operatorProvider(new DefaultSupportGraphOpProvider(source));
    EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyGraph", options);
    instance.run();

    EPAssertionUtil.assertPropsPerRow(listener.getNewDataListFlattened(), "myDouble,myInt,myString".split(","), new Object[][]{{1.1d, 1, "one"}, {2.2d, 2, "two"}});
    listener.reset();

    stmtGraph.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:22,代码来源:ExecDataflowOpEventBusSink.java

示例9: runAssertionOA

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertionOA(EPServiceProvider epService, boolean underlying) throws Exception {
    EPStatement stmtGraph = epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "EventBusSource -> ReceivedStream<" + (underlying ? "MyEventOA" : "EventBean<MyEventOA>") + "> {} " +
            "DefaultSupportCaptureOp(ReceivedStream) {}");

    DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<>(1);
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
            .operatorProvider(new DefaultSupportGraphOpProvider(future));

    EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    instance.start();

    epService.getEPRuntime().sendEvent(new Object[]{"abc", 100L}, "MyEventOA");
    Object[] rows = future.get(1, TimeUnit.SECONDS);
    assertEquals(1, rows.length);
    if (underlying) {
        EPAssertionUtil.assertEqualsExactOrder((Object[]) rows[0], new Object[]{"abc", 100L});
    } else {
        EPAssertionUtil.assertProps((EventBean) rows[0], "p0,p1".split(","), new Object[]{"abc", 100L});
    }

    instance.cancel();
    stmtGraph.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecDataflowOpEventBusSource.java

示例10: runAssertionVariable

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertionVariable(EPServiceProvider epService) throws Exception {
    epService.getEPAdministrator().createEPL("create Schema SomeEvent()");
    epService.getEPAdministrator().createEPL("create variable int var_iterations=3");
    EPStatement stmtGraph = epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "BeaconSource -> BeaconStream<SomeEvent> {" +
            "  iterations : var_iterations" +
            "}" +
            "DefaultSupportCaptureOp(BeaconStream) {}");

    DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<>(3);
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
            .operatorProvider(new DefaultSupportGraphOpProvider(future));
    EPDataFlowInstance df = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    df.start();
    Object[] output = future.get(2, TimeUnit.SECONDS);
    assertEquals(3, output.length);
    stmtGraph.destroy();
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:19,代码来源:ExecDataflowOpBeaconSource.java

示例11: runAssertionBeans

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private Object runAssertionBeans(EPServiceProvider epService, String typeName) throws Exception {
    EPStatement stmtGraph = epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "" +
            "BeaconSource -> BeaconStream<" + typeName + "> {" +
            "  myfield : 'abc', iterations : 1" +
            "}" +
            "DefaultSupportCaptureOp(BeaconStream) {}");

    DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<>(1);
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
            .operatorProvider(new DefaultSupportGraphOpProvider(future));
    EPDataFlowInstance df = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    df.start();
    Object[] output = future.get(2, TimeUnit.SECONDS);
    assertEquals(1, output.length);
    stmtGraph.destroy();
    return output[0];
}
 
开发者ID:espertechinc,项目名称:esper,代码行数:19,代码来源:ExecDataflowOpBeaconSource.java

示例12: runAssertionAllTypes

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertionAllTypes(String typeName, Object[] events) throws Exception
{
    String graph = "create dataflow MyGraph " +
            "DefaultSupportSourceOp -> instream<" + typeName + ">{}" +
            "EventBusSink(instream) {}";
    EPStatement stmtGraph = epService.getEPAdministrator().createEPL(graph);

    EPStatement stmt = epService.getEPAdministrator().createEPL("select * from " + typeName);
    stmt.addListener(listener);

    DefaultSupportSourceOp source = new DefaultSupportSourceOp(events);
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();
    options.operatorProvider(new DefaultSupportGraphOpProvider(source));
    EPDataFlowInstance instance = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyGraph", options);
    instance.run();

    EPAssertionUtil.assertPropsPerRow(listener.getNewDataListFlattened(), "myDouble,myInt,myString".split(","), new Object[][] {{1.1d, 1, "one"}, {2.2d, 2, "two"}});
    listener.reset();

    stmtGraph.destroy();
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:22,代码来源:TestDataFlowOpEventBusSink.java

示例13: testFactorial

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
public void testFactorial() throws Exception {
    epService.getEPAdministrator().getConfiguration().addImport(MyFactorialOp.class);

    String epl = "create dataflow FactorialGraph \n" +
            "" +
            "create objectarray schema InputSchema (number int),\n" +
            "create objectarray schema TempSchema (current int, temp long),\n" +
            "create objectarray schema FinalSchema (result long),\n" +
            "\n" +
            "BeaconSource -> InputData<InputSchema> {number:5, iterations:1}\n" +
            "\n" +
            "MyFactorialOp(InputData as Input, TempResult as Temp) -> TempResult<TempSchema>, FinalResult<FinalSchema>{}\n" +
            "\n" +
            "DefaultSupportCaptureOp(FinalResult) {}\n";
    epService.getEPAdministrator().createEPL(epl);

    DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<Object>(1);
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
            .operatorProvider(new DefaultSupportGraphOpProvider(future));

    epService.getEPRuntime().getDataFlowRuntime().instantiate("FactorialGraph", options).start();

    Object[] result = future.get(3, TimeUnit.SECONDS);
    assertEquals(1, result.length);
    assertEquals((long) 5*4*3*2, ((Object[]) result[0])[0]);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:27,代码来源:TestInputOutputVariations.java

示例14: runAssertion

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
private void runAssertion() throws Exception {

        DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<Object>(1);
        MyObjectArrayGraphSource source = new MyObjectArrayGraphSource(Arrays.asList(
                new Object[] {"trade", "GE", 100d, 1000L, null, null}, // vwap = 100, minPrice=100
                new Object[] {"quote", "GE", null, null, 99.5d, 2000L}  //
                ).iterator());

        EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
                .operatorProvider(new DefaultSupportGraphOpProvider(future, source));

        epService.getEPRuntime().getDataFlowRuntime().instantiate("VWAPSample", options).start();

        Object[] received = future.get(5, TimeUnit.SECONDS);
        assertEquals(1, received.length);
        EPAssertionUtil.assertProps(received[0], "index".split(","), new Object[] {2000*Math.exp(100-99.5)});
    }
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:TestExampleVwapFilterSelectJoin.java

示例15: testBeanType

import com.espertech.esper.client.dataflow.EPDataFlowInstantiationOptions; //导入依赖的package包/类
public void testBeanType() throws Exception {
    epService.getEPAdministrator().getConfiguration().addImport(SupportBean.class);
    epService.getEPAdministrator().createEPL("create schema SupportBean SupportBean");
    epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "DefaultSupportSourceOp -> outstream<SupportBean> {}" +
            "MySupportBeanOutputOp(outstream) {}" +
            "SupportGenericOutputOpWPort(outstream) {}");

    DefaultSupportSourceOp source = new DefaultSupportSourceOp(new Object[] {new SupportBean("E1", 1)});
    MySupportBeanOutputOp outputOne = new MySupportBeanOutputOp();
    SupportGenericOutputOpWPort<SupportBean> outputTwo = new SupportGenericOutputOpWPort<SupportBean>();
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions().operatorProvider(new DefaultSupportGraphOpProvider(source, outputOne, outputTwo));
    EPDataFlowInstance dfOne = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    dfOne.run();

    EPAssertionUtil.assertPropsPerRow(outputOne.getAndReset().toArray(), "theString,intPrimitive".split(","), new Object[][] {{"E1", 1}});
    Pair<List<SupportBean>, List<Integer>> received = outputTwo.getAndReset();
    EPAssertionUtil.assertPropsPerRow(received.getFirst().toArray(), "theString,intPrimitive".split(","), new Object[][] {{"E1", 1}});
    EPAssertionUtil.assertEqualsExactOrder(new Integer[] {0}, received.getSecond().toArray());
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:21,代码来源:TestTypes.java


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