com.espertech.esper.client.scopetest.SupportUpdateListener

Here are the examples of the java api class com.espertech.esper.client.scopetest.SupportUpdateListener taken from open source projects.

1. TestNamedWindowViews#setUp()

Project: esper
File: TestNamedWindowViews.java
public void setUp() {
    Map<String, Object> types = new HashMap<String, Object>();
    types.put("key", String.class);
    types.put("value", long.class);
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MyMap", types);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listenerWindow = new SupportUpdateListener();
    listenerStmtOne = new SupportUpdateListener();
    listenerStmtTwo = new SupportUpdateListener();
    listenerStmtThree = new SupportUpdateListener();
    listenerStmtDelete = new SupportUpdateListener();
}

2. TestViewGroupBy#setUp()

Project: esper
File: TestViewGroupBy.java
public void setUp() {
    listener = new SupportUpdateListener();
    priceLast3StatsListener = new SupportUpdateListener();
    priceAllStatsListener = new SupportUpdateListener();
    volumeLast3StatsListener = new SupportUpdateListener();
    volumeAllStatsListener = new SupportUpdateListener();
    epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
}

3. TestFilterExpressions#testPromoteIndexToSetNotIn()

Project: esper
File: TestFilterExpressions.java
public void testPromoteIndexToSetNotIn() {
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    String eplOne = "select * from SupportBean(theString != 'x' and theString != 'y' and doubleBoxed is not null)";
    String eplTwo = "select * from SupportBean(theString != 'x' and theString != 'y' and longBoxed is not null)";
    epService.getEPAdministrator().createEPL(eplOne).addListener(listenerOne);
    epService.getEPAdministrator().createEPL(eplTwo).addListener(listenerTwo);
    SupportBean bean = new SupportBean("E1", 0);
    bean.setDoubleBoxed(1d);
    bean.setLongBoxed(1L);
    epService.getEPRuntime().sendEvent(bean);
    listenerOne.assertOneGetNewAndReset();
    listenerTwo.assertOneGetNewAndReset();
}

4. TestNamedWindowOnDelete#setUp()

Project: esper
File: TestNamedWindowOnDelete.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = (EPServiceProviderSPI) EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listenerWindow = new SupportUpdateListener();
    listenerWindowTwo = new SupportUpdateListener();
    listenerSelect = new SupportUpdateListener();
    listenerDelete = new SupportUpdateListener();
}

5. TestInfraSubqUncorrel#setUp()

Project: esper
File: TestInfraSubqUncorrel.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType("ABean", SupportBean_S0.class);
    listenerWindow = new SupportUpdateListener();
    listenerStmtOne = new SupportUpdateListener();
    listenerStmtTwo = new SupportUpdateListener();
    listenerStmtDelete = new SupportUpdateListener();
}

6. TestInfraSubquery#setUp()

Project: esper
File: TestInfraSubquery.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType("ABean", SupportBean_S0.class);
    listenerWindow = new SupportUpdateListener();
    listenerStmtOne = new SupportUpdateListener();
    listenerStmtTwo = new SupportUpdateListener();
    listenerStmtDelete = new SupportUpdateListener();
}

7. TestRealtimeSummaryStmt#setUp()

Project: esper
File: TestRealtimeSummaryStmt.java
public void setUp() {
    super.setUp();
    // Establish feed for combined events, which contains the latency values
    new CombinedEventStmt(epService.getEPAdministrator());
    // Establish listeners for testing
    listenerTotals = new SupportUpdateListener();
    listenerByCustomer = new SupportUpdateListener();
    listenerBySupplier = new SupportUpdateListener();
    RealtimeSummaryStmt realtimeStmt = new RealtimeSummaryStmt(epService.getEPAdministrator());
    realtimeStmt.addTotalsListener(listenerTotals);
    realtimeStmt.addByCustomerListener(listenerByCustomer);
    realtimeStmt.addBySupplierListener(listenerBySupplier);
    // Use external clocking for the test
    epService.getEPRuntime().sendEvent(new TimerControlEvent(TimerControlEvent.ClockType.CLOCK_EXTERNAL));
}

8. TestInsertInto#testStaggeredWithWildcard()

Project: esper
File: TestInsertInto.java
public void testStaggeredWithWildcard() {
    String statementOne = "insert into streamA select * from " + SupportBeanSimple.class.getName() + ".win:length(5)";
    String statementTwo = "insert into streamB select *, myInt+myInt as summed, myString||myString as concat from streamA.win:length(5)";
    String statementThree = "insert into streamC select * from streamB.win:length(5)";
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    SupportUpdateListener listenerThree = new SupportUpdateListener();
    epService.getEPAdministrator().createEPL(statementOne).addListener(listenerOne);
    epService.getEPAdministrator().createEPL(statementTwo).addListener(listenerTwo);
    epService.getEPAdministrator().createEPL(statementThree).addListener(listenerThree);
    sendSimpleEvent("one", 1);
    assertSimple(listenerOne, "one", 1, null, 0);
    assertSimple(listenerTwo, "one", 1, "oneone", 2);
    assertSimple(listenerThree, "one", 1, "oneone", 2);
    sendSimpleEvent("two", 2);
    assertSimple(listenerOne, "two", 2, null, 0);
    assertSimple(listenerTwo, "two", 2, "twotwo", 4);
    assertSimple(listenerThree, "two", 2, "twotwo", 4);
}

9. TestNamedWindowTypes#setUp()

Project: esper
File: TestNamedWindowTypes.java
public void setUp() {
    Map<String, Object> types = new HashMap<String, Object>();
    types.put("key", String.class);
    types.put("primitive", long.class);
    types.put("boxed", Long.class);
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MyMap", types);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listenerWindow = new SupportUpdateListener();
    listenerStmtOne = new SupportUpdateListener();
    listenerStmtDelete = new SupportUpdateListener();
}

10. TestNamedWindowJoin#setUp()

Project: esper
File: TestNamedWindowJoin.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listenerWindow = new SupportUpdateListener();
    listenerWindowTwo = new SupportUpdateListener();
    listenerStmtOne = new SupportUpdateListener();
    SupportQueryPlanIndexHook.reset();
}

11. TestInfraOnDelete#setUp()

Project: esper
File: TestInfraOnDelete.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = (EPServiceProviderSPI) EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listenerInfra = new SupportUpdateListener();
    listenerDelete = new SupportUpdateListener();
    listenerSelect = new SupportUpdateListener();
    for (Class clazz : new Class[] { SupportBean.class, SupportBean_A.class, SupportBean_B.class }) {
        epService.getEPAdministrator().getConfiguration().addEventType(clazz);
    }
}

12. TestContextPartitionedPrioritized#testFirstEventPrioritized()

Project: esper
File: TestContextPartitionedPrioritized.java
public void testFirstEventPrioritized() {
    epService.getEPAdministrator().createEPL("create context SegmentedByMessage partition by theString from SupportBean");
    EPStatement statementWithDropAnnotation = epService.getEPAdministrator().createEPL("@Drop @Priority(1) context SegmentedByMessage select 'test1' from SupportBean");
    SupportUpdateListener statementWithDropAnnotationListener = new SupportUpdateListener();
    statementWithDropAnnotation.addListener(statementWithDropAnnotationListener);
    EPStatement lowPriorityStatement = epService.getEPAdministrator().createEPL("@Priority(0) context SegmentedByMessage select 'test2' from SupportBean");
    SupportUpdateListener lowPriorityStatementListener = new SupportUpdateListener();
    lowPriorityStatement.addListener(lowPriorityStatementListener);
    epService.getEPRuntime().sendEvent(new SupportBean("test msg", 1));
    assertTrue(statementWithDropAnnotationListener.isInvoked());
    assertFalse(lowPriorityStatementListener.isInvoked());
}

13. TestContextPartitionedInfra#setUp()

Project: esper
File: TestContextPartitionedInfra.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.addEventType("SupportBean_S1", SupportBean_S1.class);
    configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listenerSelect = new SupportUpdateListener();
    listenerNamedWindow = new SupportUpdateListener();
}

14. TestContextNested#runAssertion()

Project: esper
File: TestContextNested.java
private void runAssertion(EPServiceProvider epService) {
    epService.getEPRuntime().sendEvent(new CurrentTimeEvent(0));
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    String[] fields = "c0,c1".split(",");
    EPStatement statementOne = epService.getEPAdministrator().createEPL("context NestedContext " + "select theString as c0, sum(intPrimitive) as c1 from SupportBean \n" + "output last when terminated");
    statementOne.addListener(listenerOne);
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
    epService.getEPRuntime().sendEvent(new CurrentTimeEvent(10000));
    EPAssertionUtil.assertPropsPerRow(listenerOne.getDataListsFlattened(), fields, new Object[][] { { "E1", 1 }, { "E2", 2 } }, null);
    listenerOne.reset();
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 3));
    epService.getEPRuntime().sendEvent(new SupportBean("E3", 4));
    epService.getEPRuntime().sendEvent(new CurrentTimeEvent(20000));
    EPAssertionUtil.assertPropsPerRow(listenerOne.getDataListsFlattened(), fields, new Object[][] { { "E1", 3 }, { "E3", 4 } }, null);
}

15. TestPriorityAndDropInstructions#setUp()

Project: esper
File: TestPriorityAndDropInstructions.java
public void setUp() {
    listener = new SupportUpdateListener();
    listenerTwo = new SupportUpdateListener();
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("SupportBean", SupportBean.class);
    // also sets share-views to false
    config.getEngineDefaults().getExecution().setPrioritized(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listeners = new SupportUpdateListener[10];
    for (int i = 0; i < listeners.length; i++) {
        listeners[i] = new SupportUpdateListener();
    }
}

16. TestUpdateDispatchView#setUp()

Project: esper
File: TestUpdateDispatchView.java
public void setUp() {
    MetricReportingPath.setMetricsEnabled(false);
    listenerOne = new SupportUpdateListener();
    listenerTwo = new SupportUpdateListener();
    EPStatementListenerSet listenerSet = new EPStatementListenerSet();
    listenerSet.addListener(listenerOne);
    listenerSet.addListener(listenerTwo);
    dispatchService = new DispatchServiceImpl();
    statementResultService = new StatementResultServiceImpl("name", null, null, new ThreadingServiceImpl(new ConfigurationEngineDefaults.Threading()));
    statementResultService.setUpdateListeners(listenerSet, false);
    statementResultService.setSelectClause(new Class[1], new String[1], false, new ExprEvaluator[1], new SupportExprEvaluatorContext(null));
    statementResultService.setContext(new SupportEPStatementSPI(), null, false, false, false, false, null);
    updateDispatchView = new UpdateDispatchViewBlockingWait(statementResultService, dispatchService, 1000);
}

17. TestCSVAdapterUseCases#testEngineThread1PerSec()

Project: esper
File: TestCSVAdapterUseCases.java
/**
     * Play a CSV file using an engine thread.
     */
public void testEngineThread1PerSec() throws Exception {
    epService = EPServiceProviderManager.getProvider("testExistingTypeNoOptions", makeConfig("TypeA"));
    epService.initialize();
    EPStatement stmt = epService.getEPAdministrator().createEPL("select symbol, price, volume from TypeA.win:length(100)");
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    CSVInputAdapterSpec spec = new CSVInputAdapterSpec(new AdapterInputSource(CSV_FILENAME_ONELINE_TRADE_MULTIPLE), "TypeA");
    spec.setEventsPerSec(1);
    spec.setUsingEngineThread(true);
    InputAdapter inputAdapter = new CSVInputAdapter(epService, spec);
    inputAdapter.start();
    Thread.sleep(1500);
    assertEquals(1, listener.getNewDataList().size());
    listener.reset();
    Thread.sleep(300);
    assertEquals(0, listener.getNewDataList().size());
    Thread.sleep(2000);
    assertTrue(listener.getNewDataList().size() >= 2);
}

18. TestViewTimeInterval#testTimeWindowVariableTimePeriodStmt()

Project: esper
File: TestViewTimeInterval.java
public void testTimeWindowVariableTimePeriodStmt() {
    epService.getEPAdministrator().getConfiguration().addVariable("TIME_WIN", double.class, 4000);
    sendTimer(0);
    String text = "select rstream theString from SupportBean.win:time(TIME_WIN milliseconds)";
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    stmtOne.addListener(listenerOne);
    text = "select rstream theString from SupportBean.win:time(TIME_WIN minutes)";
    epService.getEPRuntime().setVariableValue("TIME_WIN", 0.05);
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    stmtTwo.addListener(listenerTwo);
    runAssertion(listenerOne, listenerTwo);
}

19. TestViewTimeInterval#testTimeWindowTimePeriod()

Project: esper
File: TestViewTimeInterval.java
public void testTimeWindowTimePeriod() {
    sendTimer(0);
    String text = "select rstream theString from SupportBean.win:time(4 sec)";
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    stmtOne.addListener(listenerOne);
    text = "select rstream theString from SupportBean.win:time(3000 milliseconds)";
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    stmtTwo.addListener(listenerTwo);
    runAssertion(listenerOne, listenerTwo);
}

20. TestViewTimeInterval#testTimeWindowVariableStmt()

Project: esper
File: TestViewTimeInterval.java
public void testTimeWindowVariableStmt() {
    sendTimer(0);
    String text = "select rstream theString from SupportBean.win:time(TIME_WIN)";
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addVariable("TIME_WIN", int.class, 4);
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    stmtOne.addListener(listenerOne);
    epService.getEPRuntime().setVariableValue("TIME_WIN", 3);
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    stmtTwo.addListener(listenerTwo);
    runAssertion(listenerOne, listenerTwo);
}

21. TestViewTimeInterval#testTimeWindowPreparedStmt()

Project: esper
File: TestViewTimeInterval.java
public void testTimeWindowPreparedStmt() {
    sendTimer(0);
    String text = "select rstream theString from SupportBean.win:time(?)";
    EPPreparedStatement prepared = epService.getEPAdministrator().prepareEPL(text);
    prepared.setObject(1, 4);
    EPStatement stmtOne = epService.getEPAdministrator().create(prepared);
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    stmtOne.addListener(listenerOne);
    prepared.setObject(1, 3);
    EPStatement stmtTwo = epService.getEPAdministrator().create(prepared);
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    stmtTwo.addListener(listenerTwo);
    runAssertion(listenerOne, listenerTwo);
}

22. TestSelectExprStreamSelector#testInsertTransposeNestedProperty()

Project: esper
File: TestSelectExprStreamSelector.java
public void testInsertTransposeNestedProperty() {
    String stmtOneText = "insert into StreamA select nested.* from " + SupportBeanComplexProps.class.getName() + " as s0";
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(stmtOneText);
    stmtOne.addListener(listenerOne);
    assertEquals(SupportBeanComplexProps.SupportBeanSpecialGetterNested.class, stmtOne.getEventType().getUnderlyingType());
    String stmtTwoText = "select nestedValue from StreamA";
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(stmtTwoText);
    stmtTwo.addListener(listenerTwo);
    assertEquals(String.class, stmtTwo.getEventType().getPropertyType("nestedValue"));
    epService.getEPRuntime().sendEvent(SupportBeanComplexProps.makeDefaultBean());
    assertEquals("nestedValue", listenerOne.assertOneGetNewAndReset().get("nestedValue"));
    assertEquals("nestedValue", listenerTwo.assertOneGetNewAndReset().get("nestedValue"));
}

23. TestInsertInto#testInsertFromPattern()

Project: esper
File: TestInsertInto.java
public void testInsertFromPattern() {
    String stmtOneText = "insert into streamA select * from pattern [every " + SupportBean.class.getName() + "]";
    SupportUpdateListener listenerOne = new SupportUpdateListener();
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(stmtOneText);
    stmtOne.addListener(listenerOne);
    String stmtTwoText = "insert into streamA select * from pattern [every " + SupportBean.class.getName() + "]";
    SupportUpdateListener listenerTwo = new SupportUpdateListener();
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(stmtTwoText);
    stmtTwo.addListener(listenerTwo);
    EventType eventType = stmtOne.getEventType();
    assertEquals(Map.class, eventType.getUnderlyingType());
}

24. TestOutputLimitSimple#testAggAllHaving()

Project: esper
File: TestOutputLimitSimple.java
public void testAggAllHaving() {
    String stmtText = "select symbol, volume " + "from " + SupportMarketDataBean.class.getName() + ".win:length(10) as two " + "having volume > 0 " + "output every 5 events";
    EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    String fields[] = new String[] { "symbol", "volume" };
    sendMDEvent("S0", 20);
    sendMDEvent("IBM", -1);
    sendMDEvent("MSFT", -2);
    sendMDEvent("YAH", 10);
    assertFalse(listener.isInvoked());
    sendMDEvent("IBM", 0);
    EPAssertionUtil.assertPropsPerRow(listener.getLastNewData(), fields, new Object[][] { { "S0", 20L }, { "YAH", 10L } });
    listener.reset();
}

25. TestStaticFunctions#testPattern()

Project: esper
File: TestStaticFunctions.java
public void testPattern() {
    String className = SupportStaticMethodLib.class.getName();
    statementText = "select * from pattern [myevent=" + SupportBean.class.getName() + "(" + className + ".delimitPipe(theString) = '|a|')]";
    EPStatement stmt = epService.getEPAdministrator().createEPL(statementText);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    epService.getEPRuntime().sendEvent(new SupportBean("b", 0));
    assertFalse(listener.isInvoked());
    epService.getEPRuntime().sendEvent(new SupportBean("a", 0));
    assertTrue(listener.isInvoked());
    stmt.destroy();
    statementText = "select * from pattern [myevent=" + SupportBean.class.getName() + "(" + className + ".delimitPipe(null) = '|<null>|')]";
    stmt = epService.getEPAdministrator().createEPL(statementText);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    epService.getEPRuntime().sendEvent(new SupportBean("a", 0));
    assertTrue(listener.isInvoked());
}

26. TestVariables#setUp()

Project: esper
File: TestVariables.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getViewResources().setIterableUnbound(true);
    config.addVariable("MYCONST_THREE", "boolean", true, true);
    config.getEngineDefaults().getExecution().setAllowIsolatedService(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
    listenerSet = new SupportUpdateListener();
}

27. TestNamedWindowOnMerge#setUp()

Project: esper
File: TestNamedWindowOnMerge.java
protected void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("SupportBean", SupportBean.class);
    config.addEventType("SupportBean_A", SupportBean_A.class);
    config.addEventType("SupportBean_S0", SupportBean_S0.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    nwListener = new SupportUpdateListener();
    mergeListener = new SupportUpdateListener();
}

28. TestInfraOnMerge#setUp()

Project: esper
File: TestInfraOnMerge.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = (EPServiceProviderSPI) EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    mergeListener = new SupportUpdateListener();
    createListener = new SupportUpdateListener();
    for (Class clazz : new Class[] { SupportBean.class, SupportBean_A.class, SupportBean_B.class, SupportBean_S0.class }) {
        epService.getEPAdministrator().getConfiguration().addEventType(clazz);
    }
}

29. TestDTIntervalOps#setUp()

Project: esper
File: TestDTIntervalOps.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
    ConfigurationEventTypeLegacy configBean = new ConfigurationEventTypeLegacy();
    configBean.setStartTimestampPropertyName("msecdateStart");
    configBean.setEndTimestampPropertyName("msecdateEnd");
    epService.getEPAdministrator().getConfiguration().addEventType("A", SupportTimeStartEndA.class.getName(), configBean);
    epService.getEPAdministrator().getConfiguration().addEventType("B", SupportTimeStartEndB.class.getName(), configBean);
}

30. TestContextWDeclaredExpression#testContextFilter()

Project: esper
File: TestContextWDeclaredExpression.java
public void testContextFilter() {
    String expr = "create expression THE_EXPRESSION alias for {theString='x'}";
    epService.getEPAdministrator().createEPL(expr);
    String context = "create context context2 initiated @now and pattern[every(SupportBean(THE_EXPRESSION))] terminated after 10 minutes";
    epService.getEPAdministrator().createEPL(context);
    SupportUpdateListener listener = new SupportUpdateListener();
    String statement = "context context2 select * from pattern[e1=SupportBean(THE_EXPRESSION) -> e2=SupportBean(theString='y')]";
    epService.getEPAdministrator().createEPL(statement).addListener(listener);
    epService.getEPRuntime().sendEvent(new SupportBean("x", 1));
    epService.getEPRuntime().sendEvent(new SupportBean("y", 2));
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), "e1.intPrimitive,e2.intPrimitive".split(","), new Object[] { 1, 2 });
}

31. TestContextVariables#setUp()

Project: esper
File: TestContextVariables.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.addEventType("SupportBean_S1", SupportBean_S1.class);
    configuration.addEventType("SupportBean_S2", SupportBean_S2.class);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

32. TestContextPartitionedPrioritized#setUp()

Project: esper
File: TestContextPartitionedPrioritized.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.getEngineDefaults().getExecution().setPrioritized(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    spi = (EPServiceProviderSPI) epService;
    listener = new SupportUpdateListener();
}

33. TestContextPartitionedAggregate#setUp()

Project: esper
File: TestContextPartitionedAggregate.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
    configuration.addPlugInSingleRowFunction("toArray", this.getClass().getName(), "toArray");
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

34. TestContextPartitioned#setUp()

Project: esper
File: TestContextPartitioned.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    spi = (EPServiceProviderSPI) epService;
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

35. TestContextInitTermWithDistinct#setUp()

Project: esper
File: TestContextInitTermWithDistinct.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.addEventType("SupportBean_S1", SupportBean_S1.class);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

36. TestContextInitTerm#setUp()

Project: esper
File: TestContextInitTerm.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.addEventType("SupportBean_S1", SupportBean_S1.class);
    configuration.getEngineDefaults().getExecution().setAllowIsolatedService(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    spi = (EPServiceProviderSPI) epService;
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

37. TestContextHashSegmented#setUp()

Project: esper
File: TestContextHashSegmented.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    spi = (EPServiceProviderSPI) epService;
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

38. TestContextCategory#setUp()

Project: esper
File: TestContextCategory.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    spi = (EPServiceProviderSPI) epService;
    listener = new SupportUpdateListener();
}

39. TestAdminContextPartitionSPI#setUp()

Project: esper
File: TestAdminContextPartitionSPI.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    configuration.addEventType("SupportBean_S1", SupportBean_S1.class);
    configuration.getEngineDefaults().getLogging().setEnableExecutionDebug(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

40. TestVirtualDataWindowToLookup#setUp()

Project: esper
File: TestVirtualDataWindowToLookup.java
public void setUp() {
    listener = new SupportUpdateListener();
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addPlugInVirtualDataWindow("test", "vdw", SupportVirtualDWFactory.class.getName());
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_S0", SupportBean_S0.class);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
}

41. TestVirtualDataWindow#setUp()

Project: esper
File: TestVirtualDataWindow.java
public void setUp() {
    listener = new SupportUpdateListener();
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    configuration.addPlugInVirtualDataWindow("test", "vdw", SupportVirtualDWFactory.class.getName());
    configuration.addPlugInVirtualDataWindow("invalid", "invalid", TestCase.class.getName());
    configuration.addPlugInVirtualDataWindow("test", "testnoindex", SupportVirtualDWInvalidFactory.class.getName());
    configuration.addPlugInVirtualDataWindow("test", "exceptionvdw", SupportVirtualDWExceptionFactory.class.getName());
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_ST0", SupportBean_ST0.class);
    configuration.addEventType("SupportBeanRange", SupportBeanRange.class);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    SupportQueryPlanIndexHook.reset();
}

42. TestViewPlugin#setUp()

Project: esper
File: TestViewPlugin.java
public void setUp() {
    testListener = new SupportUpdateListener();
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("A", SupportMarketDataBean.class);
    configuration.addPlugInView("mynamespace", "flushedsimple", MyFlushedSimpleViewFactory.class.getName());
    configuration.addPlugInView("mynamespace", "invalid", String.class.getName());
    epService = EPServiceProviderManager.getProvider("TestViewPlugin", configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
}

43. TestTimeControlEvent#setUp()

Project: esper
File: TestTimeControlEvent.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.getEngineDefaults().getViewResources().setShareViews(false);
    configuration.getEngineDefaults().getExecution().setAllowIsolatedService(true);
    configuration.addEventType("SupportBean", SupportBean.class.getName());
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    runtimeSPI = (EPRuntimeSPI) epService.getEPRuntime();
    listener = new SupportUpdateListener();
}

44. TestSubscriberBind#testSubscriberandListener()

Project: esper
File: TestSubscriberBind.java
public void testSubscriberandListener() {
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    epService.getEPAdministrator().createEPL("insert into A1 select s.*, 1 as a from SupportBean as s");
    EPStatement stmt = epService.getEPAdministrator().createEPL("select a1.* from A1 as a1");
    SupportUpdateListener listener = new SupportUpdateListener();
    MySubscriberRowByRowObjectArr subscriber = new MySubscriberRowByRowObjectArr();
    stmt.addListener(listener);
    stmt.setSubscriber(subscriber);
    epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    EventBean theEvent = listener.assertOneGetNewAndReset();
    assertEquals("E1", theEvent.get("theString"));
    assertEquals(1, theEvent.get("intPrimitive"));
    assertTrue(theEvent.getUnderlying() instanceof Pair);
    for (String property : stmt.getEventType().getPropertyNames()) {
        EventPropertyGetter getter = stmt.getEventType().getGetter(property);
        getter.get(theEvent);
    }
}

45. TestIsolationUnit#setUp()

Project: esper
File: TestIsolationUnit.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_A", SupportBean_A.class);
    configuration.getEngineDefaults().getViewResources().setShareViews(false);
    configuration.getEngineDefaults().getExecution().setAllowIsolatedService(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    listener = new SupportUpdateListener();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
}

46. TestAudit#setUp()

Project: esper
File: TestAudit.java
@Before
public void setUp() {
    listener = new SupportUpdateListener();
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.addEventType("SupportBean", SupportBean.class);
    configuration.addEventType("SupportBean_ST0", SupportBean_ST0.class);
    configuration.addEventType("SupportBean_ST1", SupportBean_ST1.class);
    configuration.getEngineDefaults().getLogging().setAuditPattern("[%u] [%s] [%c] %m");
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
}

47. TestAggregationFunctionPlugIn#testMappedPropertyLookAlike()

Project: esper
File: TestAggregationFunctionPlugIn.java
public void testMappedPropertyLookAlike() {
    String text = "select irstream concatstring('a') as val from " + SupportBean.class.getName();
    EPStatement statement = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    statement.addListener(listener);
    assertEquals(String.class, statement.getEventType().getPropertyType("val"));
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { "a" }, new Object[] { "" });
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { "a a" }, new Object[] { "a" });
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { "a a a" }, new Object[] { "a a" });
}

48. TestAggregationFunctionPlugIn#testNoSubnodesRuntimeAdd()

Project: esper
File: TestAggregationFunctionPlugIn.java
public void testNoSubnodesRuntimeAdd() {
    epService.getEPAdministrator().getConfiguration().addPlugInAggregationFunctionFactory("countback", SupportPluginAggregationMethodOneFactory.class.getName());
    String text = "select irstream countback() as val from " + SupportBean.class.getName();
    EPStatement statement = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    statement.addListener(listener);
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { -1 }, new Object[] { 0 });
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { -2 }, new Object[] { -1 });
}

49. TestAggregationFunctionPlugIn#testArrayParamsAndDotMethod()

Project: esper
File: TestAggregationFunctionPlugIn.java
public void testArrayParamsAndDotMethod() {
    epService.getEPAdministrator().getConfiguration().addPlugInAggregationFunctionFactory("countback", SupportPluginAggregationMethodOneFactory.class.getName());
    String text = "select irstream countback({1,2,intPrimitive}) as val from " + SupportBean.class.getName();
    EPStatement statement = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    statement.addListener(listener);
    epService.getEPRuntime().sendEvent(new SupportBean());
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { -1 }, new Object[] { 0 });
    // test dot-method
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean_A.class);
    epService.getEPAdministrator().getConfiguration().addPlugInAggregationFunctionFactory("myagg", MyAggFuncFactory.class.getName());
    String[] fields = "val0,val1".split(",");
    epService.getEPAdministrator().createEPL("select (myagg(id)).getTheString() as val0, (myagg(id)).getIntPrimitive() as val1 from SupportBean_A").addListener(listener);
    epService.getEPRuntime().sendEvent(new SupportBean_A("A1"));
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[] { "XX", 1 });
    assertEquals(1, MyAggFuncFactory.getInstanceCount());
    epService.getEPRuntime().sendEvent(new SupportBean_A("A2"));
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[] { "XX", 2 });
}

50. TestAggregationFunctionPlugIn#testWindow()

Project: esper
File: TestAggregationFunctionPlugIn.java
public void testWindow() {
    String text = "select irstream concatstring(theString) as val from " + SupportBean.class.getName() + ".win:length(2)";
    EPStatement statement = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    statement.addListener(listener);
    epService.getEPRuntime().sendEvent(new SupportBean("a", -1));
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { "a" }, new Object[] { "" });
    epService.getEPRuntime().sendEvent(new SupportBean("b", -1));
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { "a b" }, new Object[] { "a" });
    epService.getEPRuntime().sendEvent(new SupportBean("c", -1));
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { "b c" }, new Object[] { "a b" });
    epService.getEPRuntime().sendEvent(new SupportBean("d", -1));
    EPAssertionUtil.assertPropsPerRow(listener.assertInvokedAndReset(), "val", new Object[] { "c d" }, new Object[] { "b c" });
    epService.getEPAdministrator().destroyAllStatements();
}

51. TestMTStmtStatelessEnummethod#tryCount()

Project: esper
File: TestMTStmtStatelessEnummethod.java
public void tryCount(int numThreads, int numMessages, String epl, GeneratorIteratorCallback generatorIteratorCallback) throws Exception {
    ExecutorService threadPool = Executors.newFixedThreadPool(numThreads);
    EPStatement stmt = engine.getEPAdministrator().createEPL(epl);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    Future future[] = new Future[numThreads];
    for (int i = 0; i < numThreads; i++) {
        future[i] = threadPool.submit(new SendEventCallable(i, engine, new GeneratorIterator(numMessages, generatorIteratorCallback)));
    }
    threadPool.shutdown();
    threadPool.awaitTermination(10, TimeUnit.SECONDS);
    for (int i = 0; i < numThreads; i++) {
        assertTrue((Boolean) future[i].get());
    }
    assertEquals(numMessages * numThreads, listener.getNewDataListFlattened().length);
}

52. TestMTContextMultiStmtStartEnd#assertReceived()

Project: esper
File: TestMTContextMultiStmtStartEnd.java
private void assertReceived(int eventCount, SupportUpdateListener[] listeners) {
    for (SupportUpdateListener listener : listeners) {
        EventBean[] outputEvents = listener.getNewDataListFlattened();
        long total = 0;
        for (EventBean out : outputEvents) {
            long cnt = (Long) out.get("cnt");
            total += cnt;
        }
        if (total != eventCount) {
            fail("Listener received " + total + " expected " + eventCount);
        }
    }
}

53. TestOutputConditionNull#setUp()

Project: esper
File: TestOutputConditionNull.java
public void setUp() {
    listener = new SupportUpdateListener();
    callback = new OutputCallback() {

        public void continueOutputProcessing(boolean doOutput, boolean forceUpdate) {
            listener.update(null, null);
        }
    };
    condition = new OutputConditionNull(callback);
}

54. TestViewStartStop#testSameWindowReuse()

Project: esper
File: TestViewStartStop.java
public void testSameWindowReuse() {
    String viewExpr = "select * from " + SupportBean.class.getName() + ".win:length(3)";
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(viewExpr);
    stmtOne.addListener(testListener);
    // send a couple of events
    sendEvent(1);
    sendEvent(2);
    sendEvent(3);
    sendEvent(4);
    // create same statement again
    SupportUpdateListener testListenerTwo = new SupportUpdateListener();
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(viewExpr);
    stmtTwo.addListener(testListenerTwo);
    // Send event, no old data should be received
    sendEvent(5);
    assertNull(testListenerTwo.getLastOldData());
}

55. TestViewLengthBatch#setUp()

Project: esper
File: TestViewLengthBatch.java
public void setUp() {
    listener = new SupportUpdateListener();
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getViewResources().setAllowMultipleExpiryPolicies(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    events = new SupportBean[100];
    for (int i = 0; i < events.length; i++) {
        events[i] = new SupportBean();
    }
}

56. TestViewInheritAndInterface#testOverridingSubclass()

Project: esper
File: TestViewInheritAndInterface.java
public void testOverridingSubclass() {
    String viewExpr = "select val as value from " + SupportOverrideOne.class.getName() + ".win:length(10)";
    EPStatement testView = epService.getEPAdministrator().createEPL(viewExpr);
    testListener = new SupportUpdateListener();
    testView.addListener(testListener);
    epService.getEPRuntime().sendEvent(new SupportOverrideOneA("valA", "valOne", "valBase"));
    EventBean theEvent = testListener.getAndResetLastNewData()[0];
    assertEquals("valA", theEvent.get("value"));
    epService.getEPRuntime().sendEvent(new SupportOverrideBase("x"));
    assertFalse(testListener.isInvoked());
    epService.getEPRuntime().sendEvent(new SupportOverrideOneB("valB", "valTwo", "valBase2"));
    theEvent = testListener.getAndResetLastNewData()[0];
    assertEquals("valB", theEvent.get("value"));
    epService.getEPRuntime().sendEvent(new SupportOverrideOne("valThree", "valBase3"));
    theEvent = testListener.getAndResetLastNewData()[0];
    assertEquals("valThree", theEvent.get("value"));
}

57. TestViewGroupBy#testCorrel()

Project: esper
File: TestViewGroupBy.java
public void testCorrel() {
    // further math tests can be found in the view unit test
    EPAdministrator admin = epService.getEPAdministrator();
    admin.getConfiguration().addEventType("Market", SupportMarketDataBean.class);
    EPStatement statement = admin.createEPL("select * from Market.std:groupwin(symbol).win:length(1000000).stat:correl(price, volume, feed)");
    SupportUpdateListener listener = new SupportUpdateListener();
    statement.addListener(listener);
    assertEquals(Double.class, statement.getEventType().getPropertyType("correlation"));
    String[] fields = new String[] { "symbol", "correlation", "feed" };
    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("ABC", 10.0, 1000L, "f1"));
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[] { "ABC", Double.NaN, "f1" });
    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("DEF", 1.0, 2L, "f2"));
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[] { "DEF", Double.NaN, "f2" });
    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("DEF", 2.0, 4L, "f3"));
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[] { "DEF", 1.0, "f3" });
    epService.getEPRuntime().sendEvent(new SupportMarketDataBean("ABC", 20.0, 2000L, "f4"));
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), fields, new Object[] { "ABC", 1.0, "f4" });
}

58. TestDataWindowUnionExpiry#init()

Project: esper
File: TestDataWindowUnionExpiry.java
private void init(boolean isAllowMultipleDataWindows) {
    listener = new SupportUpdateListener();
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getViewResources().setAllowMultipleExpiryPolicies(isAllowMultipleDataWindows);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_S0", SupportBean_S0.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_S1", SupportBean_S1.class);
}

59. TestDataWindowIntersectExpiry#init()

Project: esper
File: TestDataWindowIntersectExpiry.java
private void init(boolean isAllowMultipleDataWindows) {
    listener = new SupportUpdateListener();
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getViewResources().setAllowMultipleExpiryPolicies(isAllowMultipleDataWindows);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_S0", SupportBean_S0.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_S1", SupportBean_S1.class);
}

60. TestContainedEventExample#testSolutionPattern()

Project: esper
File: TestContainedEventExample.java
public void testSolutionPattern() {
    epService.getEPAdministrator().getConfiguration().addEventType("ResponseEvent", ResponseEvent.class);
    String[] fields = "category,subEventType,avgTime".split(",");
    String stmtText = "select category, subEventType, avg(responseTimeMillis) as avgTime from ResponseEvent[select category, * from subEvents].win:time(1 min) group by category, subEventType order by category, subEventType";
    EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    epService.getEPRuntime().sendEvent(new ResponseEvent("svcOne", new SubEvent[] { new SubEvent(1000, "typeA"), new SubEvent(800, "typeB") }));
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, new Object[][] { { "svcOne", "typeA", 1000.0 }, { "svcOne", "typeB", 800.0 } });
    epService.getEPRuntime().sendEvent(new ResponseEvent("svcOne", new SubEvent[] { new SubEvent(400, "typeB"), new SubEvent(500, "typeA") }));
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, new Object[][] { { "svcOne", "typeA", 750.0 }, { "svcOne", "typeB", 600.0 } });
}

61. PatternTestHarness#countListenerEvents()

Project: esper
File: PatternTestHarness.java
/**
     * Clear the event list of all listeners
     */
private int countListenerEvents() {
    int count = 0;
    for (SupportUpdateListener listener : listeners) {
        for (EventBean[] events : listener.getNewDataList()) {
            count += events.length;
        }
    }
    return count;
}

62. TestRowPatternRecognitionRepetition#runAssertionPrev()

Project: esper
File: TestRowPatternRecognitionRepetition.java
private void runAssertionPrev() {
    String text = "select * from SupportBean " + "match_recognize (" + "  measures A as a" + "  pattern (A{3}) " + "  define " + "    A as A.intPrimitive > prev(A.intPrimitive)" + ")";
    EPStatement stmt = epService.getEPAdministrator().createEPL(text);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmt.addListener(listener);
    sendEvent("A1", 1);
    sendEvent("A2", 4);
    sendEvent("A3", 2);
    sendEvent("A4", 6);
    sendEvent("A5", 5);
    SupportBean b6 = sendEvent("A6", 6);
    SupportBean b7 = sendEvent("A7", 7);
    SupportBean b8 = sendEvent("A9", 8);
    EPAssertionUtil.assertProps(listener.assertOneGetNewAndReset(), "a".split(","), new Object[] { new Object[] { b6, b7, b8 } });
}

63. TestRowPatternRecognitionIntervalOrTerminated#setUp()

Project: esper
File: TestRowPatternRecognitionIntervalOrTerminated.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getViewResources().setShareViews(false);
    config.addEventType("MyEvent", SupportRecogBean.class);
    config.getEngineDefaults().getExecution().setAllowIsolatedService(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
    epService.getEPAdministrator().getConfiguration().addEventType("TemperatureSensorEvent", "id,device,temp".split(","), new Object[] { String.class, int.class, double.class });
}

64. TestRowPatternRecognitionClausePresence#runAssertionMeasurePresence()

Project: esper
File: TestRowPatternRecognitionClausePresence.java
private void runAssertionMeasurePresence(EPServiceProvider engine, long baseTime, String select, Object value) {
    engine.getEPRuntime().sendEvent(new CurrentTimeEvent(baseTime));
    String epl = "select * from SupportBean  " + "match_recognize (" + "    measures A as a, A.theString as id, " + select + " as val " + "    pattern (A B*) " + "    interval 1 minute " + "    define " + "        A as (A.intPrimitive=1)," + "        B as (B.intPrimitive=2))";
    SupportUpdateListener listener = new SupportUpdateListener();
    engine.getEPAdministrator().createEPL(epl).addListener(listener);
    engine.getEPRuntime().sendEvent(new SupportBean("E1", 1));
    engine.getEPRuntime().sendEvent(new SupportBean("E2", 2));
    engine.getEPRuntime().sendEvent(new CurrentTimeSpanEvent(baseTime + 60 * 1000 * 2));
    assertEquals(value, listener.getNewDataListFlattened()[0].get("val"));
    engine.getEPAdministrator().destroyAllStatements();
}

65. TestOrderByEventPerRow#testLastJoin()

Project: esper
File: TestOrderByEventPerRow.java
public void testLastJoin() {
    String statementString = "select symbol, volume, sum(price) from " + SupportMarketDataBean.class.getName() + ".win:length(20) as one, " + SupportBeanString.class.getName() + ".win:length(100) as two " + "where one.symbol = two.theString " + "group by symbol " + "output last every 6 events " + "order by sum(price)";
    EPStatement statement = epService.getEPAdministrator().createEPL(statementString);
    testListener = new SupportUpdateListener();
    statement.addListener(testListener);
    epService.getEPRuntime().sendEvent(new SupportBeanString("CAT"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("IBM"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("CMU"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("KGB"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("DOG"));
    runAssertionLast();
}

66. TestOrderByEventPerRow#testLast()

Project: esper
File: TestOrderByEventPerRow.java
public void testLast() {
    String statementString = "select symbol, volume, sum(price) from " + SupportMarketDataBean.class.getName() + ".win:length(20) " + "group by symbol " + "output last every 6 events " + "order by sum(price)";
    EPStatement statement = epService.getEPAdministrator().createEPL(statementString);
    testListener = new SupportUpdateListener();
    statement.addListener(testListener);
    runAssertionLast();
}

67. TestOrderByEventPerRow#testGroupBySwitchJoin()

Project: esper
File: TestOrderByEventPerRow.java
public void testGroupBySwitchJoin() {
    String statementString = "select symbol, sum(price) from " + SupportMarketDataBean.class.getName() + ".win:length(20) as one, " + SupportBeanString.class.getName() + ".win:length(100) as two " + "where one.symbol = two.theString " + "group by symbol " + "output every 6 events " + "order by sum(price), symbol, volume";
    EPStatement statement = epService.getEPAdministrator().createEPL(statementString);
    testListener = new SupportUpdateListener();
    statement.addListener(testListener);
    epService.getEPRuntime().sendEvent(new SupportBeanString("CAT"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("IBM"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("CMU"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("KGB"));
    epService.getEPRuntime().sendEvent(new SupportBeanString("DOG"));
    runAssertionDefaultNoVolume();
}

68. TestSubselectFiltered#setUp()

Project: esper
File: TestSubselectFiltered.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("Sensor", SupportSensorEvent.class);
    config.addEventType("MyEvent", SupportBean.class);
    config.addEventType("SupportBean", SupportBean.class);
    config.addEventType("S0", SupportBean_S0.class);
    config.addEventType("S1", SupportBean_S1.class);
    config.addEventType("S2", SupportBean_S2.class);
    config.addEventType("S3", SupportBean_S3.class);
    config.addEventType("S4", SupportBean_S4.class);
    config.addEventType("S5", SupportBean_S5.class);
    config.addEventType("SupportBeanRange", SupportBeanRange.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

69. TestSubselectAggregation#setUp()

Project: esper
File: TestSubselectAggregation.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("SupportBean", SupportBean.class);
    config.addEventType("S0", SupportBean_S0.class);
    config.addEventType("S1", SupportBean_S1.class);
    config.addEventType("MarketData", SupportMarketDataBean.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

70. TestSplitStream#setUp()

Project: esper
File: TestSplitStream.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("SupportBean", SupportBean.class);
    config.addEventType("S0", SupportBean_S0.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
    listeners = new SupportUpdateListener[10];
    for (int i = 0; i < listeners.length; i++) {
        listeners[i] = new SupportUpdateListener();
    }
}

71. TestPerfSubselectIn#setUp()

Project: esper
File: TestPerfSubselectIn.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MyEvent", SupportBean.class);
    config.addEventType("S0", SupportBean_S0.class);
    config.addEventType("S1", SupportBean_S1.class);
    config.addEventType("S2", SupportBean_S2.class);
    config.addEventType("S3", SupportBean_S3.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    listener = new SupportUpdateListener();
}

72. TestPerfHistoricalMethodJoin#setUp()

Project: esper
File: TestPerfHistoricalMethodJoin.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    config.addEventType(SupportBeanInt.class);
    ConfigurationMethodRef configMethod = new ConfigurationMethodRef();
    configMethod.setLRUCache(10);
    config.addMethodRef(SupportJoinMethods.class.getName(), configMethod);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    listener = new SupportUpdateListener();
}

73. TestPerf3StreamRangeJoin#setUp()

Project: esper
File: TestPerf3StreamRangeJoin.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    listener = new SupportUpdateListener();
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_ST0", SupportBean_ST0.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_ST1", SupportBean_ST1.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBeanRange", SupportBeanRange.class);
}

74. TestPerf3StreamInKeywordJoin#setUp()

Project: esper
File: TestPerf3StreamInKeywordJoin.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    listener = new SupportUpdateListener();
    epService.getEPAdministrator().getConfiguration().addEventType("S0", SupportBean_S0.class);
    epService.getEPAdministrator().getConfiguration().addEventType("S1", SupportBean_S1.class);
    epService.getEPAdministrator().getConfiguration().addEventType("S2", SupportBean_S2.class);
}

75. TestPerf2StreamSimpleJoin#setUp()

Project: esper
File: TestPerf2StreamSimpleJoin.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    updateListener = new SupportUpdateListener();
    String joinStatement = "select * from " + SupportMarketDataBean.class.getName() + ".win:length(1000000)," + SupportBean.class.getName() + ".win:length(1000000)" + " where symbol=theString";
    joinView = epService.getEPAdministrator().createEPL(joinStatement);
    joinView.addListener(updateListener);
}

76. TestPerf2StreamExprJoin#setUp()

Project: esper
File: TestPerf2StreamExprJoin.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    listener = new SupportUpdateListener();
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_ST0", SupportBean_ST0.class);
    epService.getEPAdministrator().getConfiguration().addEventType("SupportBeanRange", SupportBeanRange.class);
}

77. TestPatternInsertInto#testNoProps()

Project: esper
File: TestPatternInsertInto.java
public void testNoProps() {
    String stmtText = "insert into MyStream " + "select es0, es1 " + "from " + "pattern [every (es0=" + SupportBean_S0.class.getName() + " or es1=" + SupportBean_S1.class.getName() + ")]";
    epService.getEPAdministrator().createEPL(stmtText);
    String stmtTwoText = "select es0.id as es0id, es1.id as es1id from MyStream.win:length(10)";
    EPStatement statement = epService.getEPAdministrator().createEPL(stmtTwoText);
    updateListener = new SupportUpdateListener();
    statement.addListener(updateListener);
    sendEventsAndAssert();
}

78. TestPatternInsertInto#testProps()

Project: esper
File: TestPatternInsertInto.java
public void testProps() {
    String stmtText = "insert into MySecondStream(s0, s1) " + "select es0, es1 " + "from " + "pattern [every (es0=" + SupportBean_S0.class.getName() + " or es1=" + SupportBean_S1.class.getName() + ")]";
    epService.getEPAdministrator().createEPL(stmtText);
    String stmtTwoText = "select s0.id as es0id, s1.id as es1id from MySecondStream";
    EPStatement statement = epService.getEPAdministrator().createEPL(stmtTwoText);
    updateListener = new SupportUpdateListener();
    statement.addListener(updateListener);
    sendEventsAndAssert();
}

79. TestPatternInsertInto#testPropsWildcard()

Project: esper
File: TestPatternInsertInto.java
public void testPropsWildcard() {
    String stmtText = "insert into MyThirdStream(es0id, es1id) " + "select es0.id, es1.id " + "from " + "pattern [every (es0=" + SupportBean_S0.class.getName() + " or es1=" + SupportBean_S1.class.getName() + ")]";
    epService.getEPAdministrator().createEPL(stmtText);
    String stmtTwoText = "select * from MyThirdStream";
    EPStatement statement = epService.getEPAdministrator().createEPL(stmtTwoText);
    updateListener = new SupportUpdateListener();
    statement.addListener(updateListener);
    sendEventsAndAssert();
}

80. TestLeftOuterJoinWhere#setUp()

Project: esper
File: TestLeftOuterJoinWhere.java
public void setUp() {
    epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    updateListener = new SupportUpdateListener();
    int count = 100;
    eventsS0 = new SupportBean_S0[15];
    eventsS1 = new SupportBean_S1[15];
    for (int i = 0; i < eventsS0.length; i++) {
        eventsS0[i] = new SupportBean_S0(count++, Integer.toString(i));
    }
    count = 200;
    for (int i = 0; i < eventsS1.length; i++) {
        eventsS1[i] = new SupportBean_S1(count++, Integer.toString(i));
    }
}

81. TestJoinStartStop#setUp()

Project: esper
File: TestJoinStartStop.java
public void setUp() {
    epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    updateListener = new SupportUpdateListener();
    long[] volumesOne = new long[] { 10, 20, 20, 40, 50 };
    long[] volumesTwo = new long[] { 10, 20, 30, 40, 50 };
    for (int i = 0; i < setOne.length; i++) {
        setOne[i] = new SupportMarketDataBean("IBM", volumesOne[i], (long) i, "");
        setTwo[i] = new SupportMarketDataBean("CSCO", volumesTwo[i], (long) i, "");
    }
}

82. TestJoinPropertyAccess#testOuterJoin()

Project: esper
File: TestJoinPropertyAccess.java
public void testOuterJoin() {
    String viewExpr = "select * from " + SupportBeanComplexProps.class.getName() + ".win:length(3) s0" + " left outer join " + SupportBeanCombinedProps.class.getName() + ".win:length(3) s1" + " on mapped('keyOne') = indexed[2].mapped('2ma').value";
    EPStatement testView = epService.getEPAdministrator().createEPL(viewExpr);
    testListener = new SupportUpdateListener();
    testView.addListener(testListener);
    SupportBeanCombinedProps combined = SupportBeanCombinedProps.makeDefaultBean();
    epService.getEPRuntime().sendEvent(combined);
    SupportBeanComplexProps complex = SupportBeanComplexProps.makeDefaultBean();
    epService.getEPRuntime().sendEvent(complex);
    // double check that outer join criteria match
    assertEquals(complex.getMapped("keyOne"), combined.getIndexed(2).getMapped("2ma").getValue());
    EventBean theEvent = testListener.getAndResetLastNewData()[0];
    assertEquals("simple", theEvent.get("s0.simpleProperty"));
    assertSame(complex, theEvent.get("s0"));
    assertSame(combined, theEvent.get("s1"));
}

83. TestJoinPropertyAccess#testRegularJoin()

Project: esper
File: TestJoinPropertyAccess.java
public void testRegularJoin() {
    SupportBeanCombinedProps combined = SupportBeanCombinedProps.makeDefaultBean();
    SupportBeanComplexProps complex = SupportBeanComplexProps.makeDefaultBean();
    assertEquals("0ma0", combined.getIndexed(0).getMapped("0ma").getValue());
    String viewExpr = "select nested.nested, s1.indexed[0], nested.indexed[1] from " + SupportBeanComplexProps.class.getName() + ".win:length(3) nested, " + SupportBeanCombinedProps.class.getName() + ".win:length(3) s1" + " where mapped('keyOne') = indexed[2].mapped('2ma').value and" + " indexed[0].mapped('0ma').value = '0ma0'";
    EPStatement testView = epService.getEPAdministrator().createEPL(viewExpr);
    testListener = new SupportUpdateListener();
    testView.addListener(testListener);
    epService.getEPRuntime().sendEvent(combined);
    epService.getEPRuntime().sendEvent(complex);
    EventBean theEvent = testListener.getAndResetLastNewData()[0];
    assertSame(complex.getNested(), theEvent.get("nested.nested"));
    assertSame(combined.getIndexed(0), theEvent.get("s1.indexed[0]"));
    assertEquals(complex.getIndexed(1), theEvent.get("nested.indexed[1]"));
}

84. TestJoinNoWhereClause#setUp()

Project: esper
File: TestJoinNoWhereClause.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.getEngineDefaults().getThreading().setListenerDispatchPreserveOrder(false);
    config.getEngineDefaults().getViewResources().setShareViews(false);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    updateListener = new SupportUpdateListener();
    setOne = new Object[5];
    setTwo = new Object[5];
    for (int i = 0; i < setOne.length; i++) {
        setOne[i] = new SupportMarketDataBean("IBM", 0, (long) i, "");
        SupportBean theEvent = new SupportBean();
        theEvent.setLongBoxed((long) i);
        setTwo[i] = theEvent;
    }
}

85. TestJoinNoTableName#setUp()

Project: esper
File: TestJoinNoTableName.java
public void setUp() {
    epService = EPServiceProviderManager.getDefaultProvider(SupportConfigFactory.getConfiguration());
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    updateListener = new SupportUpdateListener();
    String joinStatement = "select * from " + SupportMarketDataBean.class.getName() + ".win:length(3)," + SupportBean.class.getName() + ".win:length(3)" + " where symbol=theString and volume=longBoxed";
    EPStatement joinView = epService.getEPAdministrator().createEPL(joinStatement);
    joinView.addListener(updateListener);
    for (int i = 0; i < setOne.length; i++) {
        setOne[i] = new SupportMarketDataBean("IBM", 0, (long) i, "");
        SupportBean theEvent = new SupportBean();
        theEvent.setTheString("IBM");
        theEvent.setLongBoxed((long) i);
        setTwo[i] = theEvent;
    }
}

86. TestJoinMapType#setUp()

Project: esper
File: TestJoinMapType.java
public void setUp() {
    Map<String, Object> typeInfo = new HashMap<String, Object>();
    typeInfo.put("id", String.class);
    typeInfo.put("p00", int.class);
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType("MapS0", typeInfo);
    config.addEventType("MapS1", typeInfo);
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

87. TestJoinInheritAndInterface#testInterfaceJoin()

Project: esper
File: TestJoinInheritAndInterface.java
public void testInterfaceJoin() {
    String viewExpr = "select a, b from " + ISupportA.class.getName() + ".win:length(10), " + ISupportB.class.getName() + ".win:length(10)" + " where a = b";
    EPStatement testView = epService.getEPAdministrator().createEPL(viewExpr);
    testListener = new SupportUpdateListener();
    testView.addListener(testListener);
    epService.getEPRuntime().sendEvent(new ISupportAImpl("1", "ab1"));
    epService.getEPRuntime().sendEvent(new ISupportBImpl("2", "ab2"));
    assertFalse(testListener.isInvoked());
    epService.getEPRuntime().sendEvent(new ISupportBImpl("1", "ab3"));
    assertTrue(testListener.isInvoked());
    EventBean theEvent = testListener.getAndResetLastNewData()[0];
    assertEquals("1", theEvent.get("a"));
    assertEquals("1", theEvent.get("b"));
}

88. TestInsertIntoTransposeStream#setUp()

Project: esper
File: TestInsertIntoTransposeStream.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    epService.getEPAdministrator().getConfiguration().addPlugInSingleRowFunction("generateMap", this.getClass().getName(), "localGenerateMap");
    epService.getEPAdministrator().getConfiguration().addPlugInSingleRowFunction("generateOA", this.getClass().getName(), "localGenerateOA");
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

89. TestInsertInto#testNullType()

Project: esper
File: TestInsertInto.java
public void testNullType() {
    String stmtOneTxt = "insert into InZone select null as dummy from java.lang.String";
    EPStatement stmtOne = epService.getEPAdministrator().createEPL(stmtOneTxt);
    assertTrue(stmtOne.getEventType().isProperty("dummy"));
    String stmtTwoTxt = "select dummy from InZone";
    EPStatement stmtTwo = epService.getEPAdministrator().createEPL(stmtTwoTxt);
    SupportUpdateListener listener = new SupportUpdateListener();
    stmtTwo.addListener(listener);
    epService.getEPRuntime().sendEvent("a");
    assertNull(listener.assertOneGetNewAndReset().get("dummy"));
}

90. TestInKeywordQueryPlan#setUp()

Project: esper
File: TestInKeywordQueryPlan.java
public void setUp() {
    Configuration configuration = SupportConfigFactory.getConfiguration();
    configuration.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    epService = EPServiceProviderManager.getDefaultProvider(configuration);
    epService.initialize();
    listener = new SupportUpdateListener();
    epService.getEPAdministrator().getConfiguration().addEventType("S0", SupportBean_S0.class);
    epService.getEPAdministrator().getConfiguration().addEventType("S1", SupportBean_S1.class);
    epService.getEPAdministrator().getConfiguration().addEventType("S2", SupportBean_S2.class);
    epService.getEPAdministrator().getConfiguration().addEventType(SupportBean.class);
}

91. TestFromClauseMethodVariable#runAssertionNonConstantVariable()

Project: esper
File: TestFromClauseMethodVariable.java
private void runAssertionNonConstantVariable(boolean soda) {
    String modifyEPL = "on SupportBean_S0 set MyNonConstantServiceVariable.postfix=p00";
    SupportModelHelper.createByCompileOrParse(epService, soda, modifyEPL);
    String epl = "select id as c0 from SupportBean as sb, " + "method:MyNonConstantServiceVariable.fetchABean(intPrimitive) as h0";
    EPStatement stmt = SupportModelHelper.createByCompileOrParse(epService, soda, epl);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    sendEventAssert("E1", 10, "_10_postfix");
    epService.getEPRuntime().sendEvent(new SupportBean_S0(1, "newpostfix"));
    sendEventAssert("E1", 20, "_20_newpostfix");
    // return to original value
    epService.getEPRuntime().sendEvent(new SupportBean_S0(2, "postfix"));
    sendEventAssert("E1", 30, "_30_postfix");
    epService.getEPAdministrator().destroyAllStatements();
}

92. TestFromClauseMethodVariable#runAssertionConstantVariable()

Project: esper
File: TestFromClauseMethodVariable.java
private void runAssertionConstantVariable() {
    String epl = "select id as c0 from SupportBean as sb, " + "method:MyConstantServiceVariable.fetchABean(intPrimitive) as h0";
    EPStatement stmt = epService.getEPAdministrator().createEPL(epl);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    sendEventAssert("E1", 10, "_10_");
    sendEventAssert("E2", 20, "_20_");
    epService.getEPAdministrator().destroyAllStatements();
}

93. TestFromClauseMethodVariable#setUp()

Project: esper
File: TestFromClauseMethodVariable.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addMethodRef(MyStaticService.class, new ConfigurationMethodRef());
    config.addImport(MyStaticService.class);
    config.getEngineDefaults().getLogging().setEnableQueryPlan(true);
    config.addEventType(SupportBean.class);
    config.addEventType(SupportBean_S0.class);
    config.addEventType(SupportBean_S1.class);
    config.addEventType(SupportBean_S2.class);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
}

94. TestFromClauseMethodOuterNStream#setUp()

Project: esper
File: TestFromClauseMethodOuterNStream.java
public void setUp() {
    Configuration config = SupportConfigFactory.getConfiguration();
    config.addEventType(SupportBeanInt.class);
    config.addEventType(SupportBean.class);
    config.addImport(SupportJoinMethods.class.getName());
    config.addVariable("var1", Integer.class, 0);
    config.addVariable("var2", Integer.class, 0);
    config.addVariable("var3", Integer.class, 0);
    config.addVariable("var4", Integer.class, 0);
    epService = EPServiceProviderManager.getDefaultProvider(config);
    epService.initialize();
    if (InstrumentationHelper.ENABLED) {
        InstrumentationHelper.startTest(epService, this.getClass(), getName());
    }
    listener = new SupportUpdateListener();
    epService.getEPAdministrator().createEPL("on SupportBeanInt(id like 'V%') set var1=p00, var2=p01");
}

95. TestFromClauseMethodNStream#runAssertionSeven()

Project: esper
File: TestFromClauseMethodNStream.java
private void runAssertionSeven(String expression) {
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    String[] fields = "valh0,valh1,valh2".split(",");
    sendBeanInt("S00", 1, 1, 1);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "H01", "H01-H11", "H01-H11-H21" } });
    sendBeanInt("S01", 0, 1, 1);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("S02", 1, 1, 0);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("S03", 1, 1, 2);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "H01", "H01-H11", "H01-H11-H21" }, { "H01", "H01-H11", "H01-H11-H22" } });
    sendBeanInt("S04", 2, 2, 1);
    Object[][] result = new Object[][] { { "H01", "H01-H11", "H01-H11-H21" }, { "H02", "H02-H11", "H02-H11-H21" }, { "H01", "H01-H12", "H01-H12-H21" }, { "H02", "H02-H12", "H02-H12-H21" } };
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, result);
}

96. TestFromClauseMethodNStream#runAssertionSix()

Project: esper
File: TestFromClauseMethodNStream.java
private void runAssertionSix(String expression) {
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    String[] fields = "valh0,valh1,valh2".split(",");
    sendBeanInt("S00", 1, 1, 1);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "H01", "H11", "H01-H21" } });
    sendBeanInt("S01", 0, 1, 1);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("S02", 1, 1, 0);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("S03", 1, 1, 2);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "H01", "H11", "H01-H21" }, { "H01", "H11", "H01-H22" } });
    sendBeanInt("S04", 2, 2, 1);
    Object[][] result = new Object[][] { { "H01", "H11", "H01-H21" }, { "H02", "H11", "H02-H21" }, { "H01", "H12", "H01-H21" }, { "H02", "H12", "H02-H21" } };
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, result);
}

97. TestFromClauseMethodNStream#runAssertionFive()

Project: esper
File: TestFromClauseMethodNStream.java
private void runAssertionFive(String expression) {
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    String[] fields = "valh0,valh1,valh2".split(",");
    sendBeanInt("S00", 1, 1, 1);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "H01", "H11", "H21" } });
    sendBeanInt("S01", 0, 1, 1);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("S02", 1, 1, 0);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("S03", 1, 1, 2);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "H01", "H11", "H21" }, { "H01", "H11", "H22" } });
    sendBeanInt("S04", 2, 2, 1);
    Object[][] result = new Object[][] { { "H01", "H11", "H21" }, { "H02", "H11", "H21" }, { "H01", "H12", "H21" }, { "H02", "H12", "H21" } };
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, result);
}

98. TestFromClauseMethodNStream#runAssertionFour()

Project: esper
File: TestFromClauseMethodNStream.java
private void runAssertionFour(String expression) {
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    String[] fields = "id,valh0,valh1,valh2".split(",");
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("E1", 2, 2, 2, 1);
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, new Object[][] { { "E1", "H01", "H11", "H01H21" } });
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "E1", "H01", "H11", "H01H21" } });
    sendBeanInt("E2", 4, 4, 4, 3);
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, new Object[][] { { "E2", "H03", "H13", "H03H23" } });
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "E1", "H01", "H11", "H01H21" }, { "E2", "H03", "H13", "H03H23" } });
}

99. TestFromClauseMethodNStream#runAssertionThree()

Project: esper
File: TestFromClauseMethodNStream.java
private void runAssertionThree(String expression) {
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    String[] fields = "id,valh0,valh1,valh2".split(",");
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("E1", 1, 1, 1);
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, new Object[][] { { "E1", "H01", "H11", "H21" } });
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "E1", "H01", "H11", "H21" } });
    sendBeanInt("E2", 1, 1, 2);
    Object[][] result = new Object[][] { { "E2", "H01", "H11", "H21" }, { "E2", "H01", "H11", "H22" } };
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, result);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, result);
}

100. TestFromClauseMethodNStream#runAssertionOne()

Project: esper
File: TestFromClauseMethodNStream.java
private void runAssertionOne(String expression) {
    EPStatement stmt = epService.getEPAdministrator().createEPL(expression);
    listener = new SupportUpdateListener();
    stmt.addListener(listener);
    String[] fields = "id,valh0,valh1".split(",");
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, null);
    sendBeanInt("E1", 20, 20, 3);
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, new Object[][] { { "E1", "H03", "H13" } });
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "E1", "H03", "H13" } });
    sendBeanInt("E2", 20, 20, 21);
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, null);
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "E1", "H03", "H13" } });
    sendBeanInt("E3", 4, 4, 2);
    EPAssertionUtil.assertPropsPerRow(listener.getAndResetLastNewData(), fields, new Object[][] { { "E3", "H02", "H12" } });
    EPAssertionUtil.assertPropsPerRowAnyOrder(stmt.iterator(), fields, new Object[][] { { "E1", "H03", "H13" }, { "E3", "H02", "H12" } });
    stmt.destroy();
}