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


Java DefaultSupportGraphParamProvider类代码示例

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


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

示例1: trySource

import com.espertech.esper.dataflow.util.DefaultSupportGraphParamProvider; //导入依赖的package包/类
private void trySource(AdapterInputSource source) throws Exception {
    CSVInputAdapterSpec spec = new CSVInputAdapterSpec(source, "TypeC");

    epService = EPServiceProviderManager.getProvider("testPlayFromInputStream", makeConfig("TypeC"));
    epService.initialize();
    InputAdapter feed = new CSVInputAdapter(epService, spec);

    EPStatement stmt = epService.getEPAdministrator().createEPL("select * from TypeC#length(100)");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);

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

    if (source.getAsReader() != null) {
        source.getAsReader().reset();
    } else {
        source.getAsStream().reset();
    }

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

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

示例2: runAssertionSchemaObjectArray

import com.espertech.esper.dataflow.util.DefaultSupportGraphParamProvider; //导入依赖的package包/类
private void runAssertionSchemaObjectArray(EPServiceProvider epService) throws Exception {
    epService.getEPAdministrator().createEPL("create objectarray schema MyEventOA(p0 string, p1 long)");

    runAssertionOA(epService, false);
    runAssertionOA(epService, true);

    // test collector
    epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "EventBusSource -> ReceivedStream<MyEventOA> {filter: p0 like 'A%'} " +
            "DefaultSupportCaptureOp(ReceivedStream) {}");

    MyCollector collector = new MyCollector();
    DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<>();
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
            .operatorProvider(new DefaultSupportGraphOpProvider(future))
            .parameterProvider(new DefaultSupportGraphParamProvider(Collections.singletonMap("collector", collector)));

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

    epService.getEPRuntime().sendEvent(new Object[]{"B", 100L}, "MyEventOA");
    Thread.sleep(50);
    assertNull(collector.getLast());

    epService.getEPRuntime().sendEvent(new Object[]{"A", 101L}, "MyEventOA");
    future.waitForInvocation(100, 1);
    assertNotNull(collector.getLast().getEmitter());
    assertEquals("MyEventOA", collector.getLast().getEvent().getEventType().getName());
    assertEquals(false, collector.getLast().isSubmitEventBean());

    instance.cancel();

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

示例3: testSchemaObjectArray

import com.espertech.esper.dataflow.util.DefaultSupportGraphParamProvider; //导入依赖的package包/类
public void testSchemaObjectArray() throws Exception {
    epService.getEPAdministrator().createEPL("create objectarray schema MyEvent(p0 string, p1 long)");

    runAssertionOA(false);
    runAssertionOA(true);

    // test collector
    epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "EventBusSource -> ReceivedStream<MyEvent> {filter: p0 like 'A%'} " +
            "DefaultSupportCaptureOp(ReceivedStream) {}");

    MyCollector collector = new MyCollector();
    DefaultSupportCaptureOp<Object> future = new DefaultSupportCaptureOp<Object>();
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions()
            .operatorProvider(new DefaultSupportGraphOpProvider(future))
            .parameterProvider(new DefaultSupportGraphParamProvider(Collections.<String, Object>singletonMap("collector", collector)));

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

    epService.getEPRuntime().sendEvent(new Object[] {"B", 100L}, "MyEvent");
    Thread.sleep(50);
    assertNull(collector.getLast());

    epService.getEPRuntime().sendEvent(new Object[] {"A", 101L}, "MyEvent");
    future.waitForInvocation(100, 1);
    assertNotNull(collector.getLast().getEmitter());
    assertEquals("MyEvent", collector.getLast().getEvent().getEventType().getName());
    assertEquals(false, collector.getLast().isSubmitEventBean());
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:31,代码来源:TestDataFlowOpEventBusSource.java

示例4: runAssertionStatementFilter

import com.espertech.esper.dataflow.util.DefaultSupportGraphParamProvider; //导入依赖的package包/类
private void runAssertionStatementFilter(EPServiceProvider epService) throws Exception {
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean_A.class);
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean_B.class);

    // one statement exists before the data flow
    EPStatement stmt = epService.getEPAdministrator().createEPL("select id from SupportBean_B");

    epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "create schema AllObjects Object," +
            "EPStatementSource -> thedata<AllObjects> {} " +
            "DefaultSupportCaptureOp(thedata) {}");

    DefaultSupportCaptureOp<Object> captureOp = new DefaultSupportCaptureOp<Object>();
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();
    MyFilter myFilter = new MyFilter();
    options.parameterProvider(new DefaultSupportGraphParamProvider(Collections.<String, Object>singletonMap("statementFilter", myFilter)));
    options.operatorProvider(new DefaultSupportGraphOpProvider(captureOp));
    EPDataFlowInstance df = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    df.start();

    epService.getEPRuntime().sendEvent(new SupportBean_B("B1"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"B1"});

    epService.getEPAdministrator().createEPL("select theString, intPrimitive from SupportBean");
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "theString,intPrimitive".split(","), new Object[]{"E1", 1});

    EPStatement stmtTwo = epService.getEPAdministrator().createEPL("select id from SupportBean_A");
    epService.getEPRuntime().sendEvent(new SupportBean_A("A1"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"A1"});

    stmtTwo.stop();

    epService.getEPRuntime().sendEvent(new SupportBean_A("A2"));
    Thread.sleep(50);
    assertEquals(0, captureOp.getCurrent().length);

    stmtTwo.start();

    epService.getEPRuntime().sendEvent(new SupportBean_A("A3"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"A3"});

    epService.getEPRuntime().sendEvent(new SupportBean_B("B2"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"B2"});

    df.cancel();

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    epService.getEPRuntime().sendEvent(new SupportBean_A("A1"));
    epService.getEPRuntime().sendEvent(new SupportBean_B("B3"));
    assertEquals(0, captureOp.getCurrent().length);

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

示例5: testStatementFilter

import com.espertech.esper.dataflow.util.DefaultSupportGraphParamProvider; //导入依赖的package包/类
public void testStatementFilter() throws Exception {
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean_A.class);
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean_B.class);

    // one statement exists before the data flow
    EPStatement stmt = epService.getEPAdministrator().createEPL("select id from SupportBean_B");

    epService.getEPAdministrator().createEPL("create dataflow MyDataFlowOne " +
            "create schema AllObjects Object," +
            "EPStatementSource -> thedata<AllObjects> {} " +
            "DefaultSupportCaptureOp(thedata) {}");

    DefaultSupportCaptureOp<Object> captureOp = new DefaultSupportCaptureOp<Object>();
    EPDataFlowInstantiationOptions options = new EPDataFlowInstantiationOptions();
    MyFilter myFilter = new MyFilter();
    options.parameterProvider(new DefaultSupportGraphParamProvider(Collections.<String, Object>singletonMap("statementFilter", myFilter)));
    options.operatorProvider(new DefaultSupportGraphOpProvider(captureOp));
    EPDataFlowInstance df = epService.getEPRuntime().getDataFlowRuntime().instantiate("MyDataFlowOne", options);
    df.start();

    epService.getEPRuntime().sendEvent(new SupportBean_B("B1"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"B1"});

    epService.getEPAdministrator().createEPL("select theString, intPrimitive from SupportBean");
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "theString,intPrimitive".split(","), new Object[]{"E1", 1});

    EPStatement stmtTwo = epService.getEPAdministrator().createEPL("select id from SupportBean_A");
    epService.getEPRuntime().sendEvent(new SupportBean_A("A1"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"A1"});

    stmtTwo.stop();

    epService.getEPRuntime().sendEvent(new SupportBean_A("A2"));
    Thread.sleep(50);
    assertEquals(0, captureOp.getCurrent().length);

    stmtTwo.start();
    
    epService.getEPRuntime().sendEvent(new SupportBean_A("A3"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"A3"});

    epService.getEPRuntime().sendEvent(new SupportBean_B("B2"));
    captureOp.waitForInvocation(200, 1);
    EPAssertionUtil.assertProps(captureOp.getCurrentAndReset()[0], "id".split(","), new Object[]{"B2"});

    df.cancel();

    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    epService.getEPRuntime().sendEvent(new SupportBean_A("A1"));
    epService.getEPRuntime().sendEvent(new SupportBean_B("B3"));
    assertEquals(0, captureOp.getCurrent().length);
}
 
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:59,代码来源:TestDataFlowOpEPStatementSource.java


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