public void run(RegressionEnvironment env) { RegressionPath path = new RegressionPath(); env.compileDeploy("insert into MyVariantTwoTypedSBVariant select * from SupportBean"); env.compileDeploy("create window MainEventWindow#length(10000) as MyVariantTwoTypedSBVariant", path); env.compileDeploy("insert into MainEventWindow select " + EventVariantStream.class.getSimpleName() + ".preProcessEvent(event) from MyVariantTwoTypedSBVariant as event", path); env.compileDeploy("@name('s0') select * from MainEventWindow where theString = 'E'", path); env.statement("s0").addListenerWithReplay(env.listenerNew()); env.sendEventBean(new SupportBean("E1", 1)); env.undeployAll(); } }
public void run(RegressionEnvironment env) { tryOrAndNot(env, "(a=SupportBean_A -> b=SupportBean_B) or (a=SupportBean_A -> not b=SupportBean_B)"); tryOrAndNot(env, "a=SupportBean_A -> (b=SupportBean_B or not SupportBean_B)"); // try zero-time start env.advanceTime(0); SupportUpdateListener listener = new SupportUpdateListener(); env.compileDeploy("@name('s0') select * from pattern [timer:interval(0) or every timer:interval(1 min)]").statement("s0").addListenerWithReplay(listener); assertTrue(listener.isInvoked()); env.undeployAll(); } }
public void run(RegressionEnvironment env) { // smoke test, need to consider log file; test for ESPER-331 EPStatement stmt = env.compileDeploy("@name('s0') select * from SupportMarketDataBean").statement("s0"); stmt.setSubscriber(new DummySubscriberException()); stmt.addListener(new UpdateListener() { public void update(EventBean[] newEvents, EventBean[] oldEvents, EPStatement statement, EPRuntime runtime) { throw new RuntimeException("test exception 2"); } }); stmt.addListenerWithReplay(new UpdateListener() { public void update(EventBean[] newEvents, EventBean[] oldEvents, EPStatement statement, EPRuntime runtime) { throw new RuntimeException("test exception 3"); } }); // no exception expected env.sendEventBean(new SupportMarketDataBean("IBM", 0, 0L, "")); env.undeployAll(); } }
public void run(RegressionEnvironment env) { env.compileDeploy("@name('s0') select * from SupportBean"); EPStatement statement = env.statement("s0"); env.undeployAll(); assertTrue(statement.isDestroyed()); tryInvalid(statement, stmt -> stmt.iterator()); tryInvalid(statement, stmt -> stmt.iterator(new ContextPartitionSelectorAll())); tryInvalid(statement, stmt -> stmt.safeIterator()); tryInvalid(statement, stmt -> stmt.safeIterator(new ContextPartitionSelectorAll())); tryInvalid(statement, stmt -> stmt.addListenerWithReplay(new SupportUpdateListener())); tryInvalid(statement, stmt -> stmt.addListener(new SupportUpdateListener())); tryInvalid(statement, stmt -> stmt.setSubscriber(this)); tryInvalid(statement, stmt -> stmt.setSubscriber(this, "somemethod")); } }
env.statement("s0").addListenerWithReplay(listener); assertTrue(listener.isInvoked()); assertEquals(1, listener.getNewDataList().size()); env.statement("s0").addListenerWithReplay(listener); assertEquals("E1", listener.assertOneGetNewAndReset().get("theString")); env.undeployAll(); env.sendEventBean(new SupportBean("E1", 1)); env.sendEventBean(new SupportBean("E2", 1)); env.statement("s0").addListenerWithReplay(listener); EPAssertionUtil.assertPropsPerRow(listener.getLastNewData(), new String[]{"theString"}, new Object[][]{{"E1"}, {"E2"}}); EPStatement stmt = env.statement("s0");