當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。