コード例 #1
0
  public void testStartStopStatement() {
    String stmtText = "select id from S0 where (select true from S1.win:length(1000))";

    EPStatement stmt = epService.getEPAdministrator().createEPL(stmtText);
    stmt.addListener(listener);

    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertFalse(listener.isInvoked());

    epService.getEPRuntime().sendEvent(new SupportBean_S1(10));
    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertEquals(2, listener.assertOneGetNewAndReset().get("id"));

    stmt.stop();
    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertFalse(listener.isInvoked());

    stmt.start();
    epService.getEPRuntime().sendEvent(new SupportBean_S0(2));
    assertFalse(listener.isInvoked());

    epService.getEPRuntime().sendEvent(new SupportBean_S1(10));
    epService.getEPRuntime().sendEvent(new SupportBean_S0(3));
    assertEquals(3, listener.assertOneGetNewAndReset().get("id"));
  }