private void RunAssertionRollupOneDim(EPServiceProvider epService) { var listenerQuery = new SupportUpdateListener(); var listenerOut = new SupportUpdateListener(); string[] fieldsOut = "TheString,total".Split(','); epService.EPAdministrator.CreateEPL("create table MyTableR1D(pk string primary key, total sum(int))"); epService.EPAdministrator.CreateEPL("into table MyTableR1D insert into MyStreamOne select TheString, sum(IntPrimitive) as total from SupportBean#length(4) group by Rollup(TheString)").Events += listenerOut.Update; epService.EPAdministrator.CreateEPL("select MyTableR1D[p00].total as c0 from SupportBean_S0").Events += listenerQuery.Update; epService.EPRuntime.SendEvent(new SupportBean("E1", 10)); AssertValuesListener(epService, listenerQuery, new object[][] { new object[] { null, 10 }, new object[] { "E1", 10 }, new object[] { "E2", null } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E1", 10 }, new object[] { null, 10 } }); epService.EPRuntime.SendEvent(new SupportBean("E2", 200)); AssertValuesListener(epService, listenerQuery, new object[][] { new object[] { null, 210 }, new object[] { "E1", 10 }, new object[] { "E2", 200 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E2", 200 }, new object[] { null, 210 } }); epService.EPRuntime.SendEvent(new SupportBean("E1", 11)); AssertValuesListener(epService, listenerQuery, new object[][] { new object[] { null, 221 }, new object[] { "E1", 21 }, new object[] { "E2", 200 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E1", 21 }, new object[] { null, 221 } }); epService.EPRuntime.SendEvent(new SupportBean("E2", 201)); AssertValuesListener(epService, listenerQuery, new object[][] { new object[] { null, 422 }, new object[] { "E1", 21 }, new object[] { "E2", 401 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E2", 401 }, new object[] { null, 422 } }); epService.EPRuntime.SendEvent(new SupportBean("E1", 12)); // {"E1", 10} leaving window AssertValuesListener(epService, listenerQuery, new object[][] { new object[] { null, 424 }, new object[] { "E1", 23 }, new object[] { "E2", 401 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E1", 23 }, new object[] { null, 424 } }); epService.EPAdministrator.DestroyAllStatements(); }
public void TestOverridingSubclass() { String viewExpr = "select val as value from " + typeof(SupportOverrideOne).FullName + ".win:length(10)"; EPStatement testView = _epService.EPAdministrator.CreateEPL(viewExpr); _testListener = new SupportUpdateListener(); testView.Events += _testListener.Update; _epService.EPRuntime.SendEvent(new SupportOverrideOneA("valA", "valOne", "valBase")); EventBean theEvent = _testListener.GetAndResetLastNewData()[0]; Assert.AreEqual("valA", theEvent.Get("value")); _epService.EPRuntime.SendEvent(new SupportOverrideBase("x")); Assert.IsFalse(_testListener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportOverrideOneB("valB", "valTwo", "valBase2")); theEvent = _testListener.GetAndResetLastNewData()[0]; Assert.AreEqual("valB", theEvent.Get("value")); _epService.EPRuntime.SendEvent(new SupportOverrideOne("valThree", "valBase3")); theEvent = _testListener.GetAndResetLastNewData()[0]; Assert.AreEqual("valThree", theEvent.Get("value")); }
private void RunAssertionPartitioned(EPServiceProvider epService) { SendTimer(0, epService); string[] fields = "a,b0,b1,lastb".Split(','); string text = "select * from MyEvent#keepall " + "match_recognize (" + " partition by cat " + " measures A.TheString as a, B[0].TheString as b0, B[1].TheString as b1, last(B.TheString) as lastb" + " pattern (A B*) " + " INTERVAL 10 seconds " + " define " + " A as A.TheString like 'A%'," + " B as B.TheString like 'B%'" + ") order by a, b0, b1, lastb"; EPStatement stmt = epService.EPAdministrator.CreateEPL(text); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; SendTimer(1000, epService); epService.EPRuntime.SendEvent(new SupportRecogBean("A1", "C1", 1)); SendTimer(1000, epService); epService.EPRuntime.SendEvent(new SupportRecogBean("A2", "C2", 2)); SendTimer(2000, epService); epService.EPRuntime.SendEvent(new SupportRecogBean("A3", "C3", 3)); SendTimer(3000, epService); epService.EPRuntime.SendEvent(new SupportRecogBean("A4", "C4", 4)); epService.EPRuntime.SendEvent(new SupportRecogBean("B1", "C3", 5)); epService.EPRuntime.SendEvent(new SupportRecogBean("B2", "C1", 6)); epService.EPRuntime.SendEvent(new SupportRecogBean("B3", "C1", 7)); epService.EPRuntime.SendEvent(new SupportRecogBean("B4", "C4", 7)); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new [] { "A1", "B2", "B3", "B3" }, new [] { "A2", null, null, null }, new [] { "A3", "B1", null, "B1" }, new [] { "A4", "B4", null, "B4" } }); SendTimer(10999, epService); Assert.IsFalse(listener.IsInvoked); SendTimer(11000, epService); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "A1", "B2", "B3", "B3" }, new object[] { "A2", null, null, null } }); SendTimer(11999, epService); Assert.IsFalse(listener.IsInvoked); SendTimer(12000, epService); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "A3", "B1", null, "B1" } }); SendTimer(13000, epService); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "A4", "B4", null, "B4" } }); stmt.Dispose(); }
private void RunAssertionMultiIdxConstants(EPServiceProvider epService) { SupportQueryPlanIndexHook.Reset(); var epl = INDEX_CALLBACK_HOOK + "select * from S0 as s0 unidirectional, S1#keepall as s1 " + "where 'a' in (P10, P11)"; var fields = "s0.Id,s1.Id".Split(','); var stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var items = SupportQueryPlanIndexHook.AssertJoinAndReset().IndexSpecs[1].Items; Assert.AreEqual("[P10][P11]", SupportQueryPlanIndexHelper.GetIndexedExpressions(items)); epService.EPRuntime.SendEvent(new SupportBean_S1(100, "x", "y")); epService.EPRuntime.SendEvent(new SupportBean_S1(101, "x", "a")); epService.EPRuntime.SendEvent(new SupportBean_S0(1)); EPAssertionUtil.AssertPropsPerRowAnyOrder( listener.GetAndResetLastNewData(), fields, new[] {new object[] {1, 101}}); epService.EPRuntime.SendEvent(new SupportBean_S1(102, "b", "a")); epService.EPRuntime.SendEvent(new SupportBean_S0(2)); EPAssertionUtil.AssertPropsPerRowAnyOrder( listener.GetAndResetLastNewData(), fields, new[] {new object[] {2, 101}, new object[] {2, 102}}); stmt.Dispose(); }
public void TestLengthBatch() { String[] fields = new String[] { "TheString" }; EPStatement stmt = _epService.EPAdministrator.CreateEPL("select irstream * from SupportBean.win:expr_batch(current_count >= 3, true)"); stmt.Events += _listener.Update; _epService.EPRuntime.SendEvent(new SupportBean("E1", 1)); _epService.EPRuntime.SendEvent(new SupportBean("E2", 2)); Assert.IsFalse(_listener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportBean("E3", 3)); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new Object[][] { new Object[] { "E1" }, new Object[] { "E2" }, new Object[] { "E3" } }); _epService.EPRuntime.SendEvent(new SupportBean("E4", 4)); _epService.EPRuntime.SendEvent(new SupportBean("E5", 5)); Assert.IsFalse(_listener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportBean("E6", 6)); EPAssertionUtil.AssertPropsPerRow(_listener.LastNewData, fields, new Object[][] { new Object[] { "E4" }, new Object[] { "E5" }, new Object[] { "E6" } }); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastOldData(), fields, new Object[][] { new Object[] { "E1" }, new Object[] { "E2" }, new Object[] { "E3" } }); _epService.EPRuntime.SendEvent(new SupportBean("E7", 7)); _epService.EPRuntime.SendEvent(new SupportBean("E8", 8)); Assert.IsFalse(_listener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportBean("E9", 9)); EPAssertionUtil.AssertPropsPerRow(_listener.LastNewData, fields, new Object[][] { new Object[] { "E7" }, new Object[] { "E8" }, new Object[] { "E9" } }); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastOldData(), fields, new Object[][] { new Object[] { "E4" }, new Object[] { "E5" }, new Object[] { "E6" } }); stmt.Dispose(); }
private void RunAssertionUpdateOrderOfFields(EPServiceProvider epService, bool namedWindow) { string eplCreate = namedWindow ? "create window MyInfra#keepall as SupportBean" : "create table MyInfra(TheString string primary key, IntPrimitive int, IntBoxed int, DoublePrimitive double)"; epService.EPAdministrator.CreateEPL(eplCreate); epService.EPAdministrator.CreateEPL("insert into MyInfra select TheString, IntPrimitive, IntBoxed, DoublePrimitive from SupportBean"); EPStatement stmt = epService.EPAdministrator.CreateEPL("on SupportBean_S0 as sb " + "update MyInfra as mywin" + " set IntPrimitive=id, IntBoxed=mywin.IntPrimitive, DoublePrimitive=initial.IntPrimitive" + " where mywin.TheString = sb.p00"); var listenerWindow = new SupportUpdateListener(); stmt.Events += listenerWindow.Update; string[] fields = "IntPrimitive,IntBoxed,DoublePrimitive".Split(','); epService.EPRuntime.SendEvent(MakeSupportBean("E1", 1, 2)); epService.EPRuntime.SendEvent(new SupportBean_S0(5, "E1")); EPAssertionUtil.AssertProps(listenerWindow.GetAndResetLastNewData()[0], fields, new object[] { 5, 5, 1.0 }); epService.EPRuntime.SendEvent(MakeSupportBean("E2", 10, 20)); epService.EPRuntime.SendEvent(new SupportBean_S0(6, "E2")); EPAssertionUtil.AssertProps(listenerWindow.GetAndResetLastNewData()[0], fields, new object[] { 6, 6, 10.0 }); epService.EPRuntime.SendEvent(new SupportBean_S0(7, "E1")); EPAssertionUtil.AssertProps(listenerWindow.GetAndResetLastNewData()[0], fields, new object[] { 7, 7, 5.0 }); epService.EPAdministrator.DestroyAllStatements(); epService.EPAdministrator.Configuration.RemoveEventType("MyInfra", false); }
public void RunAssertionSegmentedOnSelect(bool namedWindow) { epService.EPAdministrator.CreateEPL("@Name('context') create context SegmentedByString " + "partition by TheString from SupportBean, p00 from SupportBean_S0"); string eplCreate = namedWindow ? "@Name('named window') context SegmentedByString create window MyInfra.win:keepall() as SupportBean" : "@Name('table') context SegmentedByString create table MyInfra(TheString string primary key, IntPrimitive int primary key)"; epService.EPAdministrator.CreateEPL(eplCreate); epService.EPAdministrator.CreateEPL("@Name('insert') context SegmentedByString insert into MyInfra select TheString, IntPrimitive from SupportBean"); string[] fieldsNW = new string[] { "TheString", "IntPrimitive" }; EPStatement stmtSelect = epService.EPAdministrator.CreateEPL("context SegmentedByString " + "on SupportBean_S0 select mywin.* from MyInfra as mywin"); stmtSelect.AddListener(listenerSelect); epService.EPRuntime.SendEvent(new SupportBean("G1", 1)); epService.EPRuntime.SendEvent(new SupportBean("G2", 2)); epService.EPRuntime.SendEvent(new SupportBean("G1", 3)); epService.EPRuntime.SendEvent(new SupportBean_S0(0, "G1")); EPAssertionUtil.AssertPropsPerRowAnyOrder(listenerSelect.GetAndResetLastNewData(), fieldsNW, new object[][] { new object[] { "G1", 1 }, new object[] { "G1", 3 } }); epService.EPRuntime.SendEvent(new SupportBean_S0(0, "G2")); EPAssertionUtil.AssertPropsPerRowAnyOrder(listenerSelect.GetAndResetLastNewData(), fieldsNW, new object[][] { new object[] { "G2", 2 } }); epService.EPAdministrator.DestroyAllStatements(); epService.EPAdministrator.Configuration.RemoveEventType("MyInfra", false); }
public void Test2StreamMaxAggregation() { var className = typeof(SupportStaticMethodLib).FullName; string stmtText; // ESPER 556 stmtText = "select max(col1) as maxcol1 from SupportBean.std:unique(theString), method:" + className + ".FetchResult100() "; var fields = "maxcol1".Split(','); var stmt = (EPStatementSPI)_epService.EPAdministrator.CreateEPL(stmtText); stmt.AddListener(_listener); Assert.IsFalse(stmt.StatementContext.IsStatelessSelect); _epService.EPRuntime.SendEvent(new SupportBean("E1", 1)); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { 9 } }); _epService.EPRuntime.SendEvent(new SupportBean("E1", 1)); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { 9 } }); stmt.Dispose(); }
private void RunAssertionOutputRateLimiting(EPServiceProvider epService) { string epl = "select sum(IntPrimitive) as si, window(sa.IntPrimitive) as wi from SupportBean#keepall as sa output every 2 events"; EPStatement stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; string[] fields = "si,wi".Split(','); epService.EPRuntime.SendEvent(new SupportBean("E1", 1)); epService.EPRuntime.SendEvent(new SupportBean("E2", 2)); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new[] { new object[] { 1, IntArray(1) }, new object[] { 3, IntArray(1, 2) }, }); epService.EPRuntime.SendEvent(new SupportBean("E3", 3)); epService.EPRuntime.SendEvent(new SupportBean("E4", 4)); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new[] { new object[] { 6, IntArray(1, 2, 3) }, new object[] { 10, IntArray(1, 2, 3, 4) }, }); stmt.Dispose(); }
private void RunAssertionTimeWindowOutputCountLast(EPServiceProvider epService) { string stmtText = "select count(*) as cnt from " + typeof(SupportBean).FullName + "#time(10 seconds) output every 10 seconds"; EPStatement stmt = epService.EPAdministrator.CreateEPL(stmtText); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; SendTimer(epService, 0); SendTimer(epService, 10000); Assert.IsFalse(listener.IsInvoked); SendTimer(epService, 20000); Assert.IsFalse(listener.IsInvoked); SendEvent(epService, "e1"); SendTimer(epService, 30000); EventBean[] newEvents = listener.GetAndResetLastNewData(); Assert.AreEqual(2, newEvents.Length); Assert.AreEqual(1L, newEvents[0].Get("cnt")); Assert.AreEqual(0L, newEvents[1].Get("cnt")); SendTimer(epService, 31000); SendEvent(epService, "e2"); SendEvent(epService, "e3"); SendTimer(epService, 40000); newEvents = listener.GetAndResetLastNewData(); Assert.AreEqual(2, newEvents.Length); Assert.AreEqual(1L, newEvents[0].Get("cnt")); Assert.AreEqual(2L, newEvents[1].Get("cnt")); stmt.Dispose(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') @IterableUnbound select * from pattern[every tag=SupportBean]"; env.CompileDeploy(epl); // Pattern started when created // Add listener var listener = new SupportUpdateListener(); env.Statement("s0").AddListener(listener); Assert.IsNull(env.Listener("s0").LastNewData); Assert.IsFalse(env.GetEnumerator("s0").MoveNext()); // Send event var theEvent = SendEvent(env); Assert.AreEqual(theEvent, listener.GetAndResetLastNewData()[0].Get("tag")); Assert.AreSame(theEvent, env.Statement("s0").First().Get("tag")); // Remove listener env.Statement("s0").RemoveListener(listener); theEvent = SendEvent(env); Assert.AreSame(theEvent, env.GetEnumerator("s0").Advance().Get("tag")); Assert.IsNull(listener.LastNewData); // Add listener back env.Statement("s0").AddListener(listener); theEvent = SendEvent(env); Assert.AreSame(theEvent, env.GetEnumerator("s0").Advance().Get("tag")); Assert.AreEqual(theEvent, listener.GetAndResetLastNewData()[0].Get("tag")); env.UndeployAll(); }
public void TestTimeWindowOutputCountLast() { var stmtText = "select count(*) as cnt from " + typeof(SupportBean).FullName + ".win:time(10 seconds) output every 10 seconds"; var stmt = _epService.EPAdministrator.CreateEPL(stmtText); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; SendTimer(0); SendTimer(10000); Assert.IsFalse(listener.IsInvoked); SendTimer(20000); Assert.IsFalse(listener.IsInvoked); SendEvent("e1"); SendTimer(30000); var newEvents = listener.GetAndResetLastNewData(); Assert.AreEqual(2, newEvents.Length); Assert.AreEqual(1L, newEvents[0].Get("cnt")); Assert.AreEqual(0L, newEvents[1].Get("cnt")); SendTimer(31000); SendEvent("e2"); SendEvent("e3"); SendTimer(40000); newEvents = listener.GetAndResetLastNewData(); Assert.AreEqual(2, newEvents.Length); Assert.AreEqual(1L, newEvents[0].Get("cnt")); Assert.AreEqual(2L, newEvents[1].Get("cnt")); }
private void RunAssertionOverridingSubclass(EPServiceProvider epService) { string epl = "select val as value from " + typeof(SupportOverrideOne).FullName + "#length(10)"; EPStatement stmt = epService.EPAdministrator.CreateEPL(epl); var testListener = new SupportUpdateListener(); stmt.Events += testListener.Update; epService.EPRuntime.SendEvent(new SupportOverrideOneA("valA", "valOne", "valBase")); EventBean theEvent = testListener.GetAndResetLastNewData()[0]; Assert.AreEqual("valA", theEvent.Get("value")); epService.EPRuntime.SendEvent(new SupportOverrideBase("x")); Assert.IsFalse(testListener.IsInvoked); epService.EPRuntime.SendEvent(new SupportOverrideOneB("valB", "valTwo", "valBase2")); theEvent = testListener.GetAndResetLastNewData()[0]; Assert.AreEqual("valB", theEvent.Get("value")); epService.EPRuntime.SendEvent(new SupportOverrideOne("valThree", "valBase3")); theEvent = testListener.GetAndResetLastNewData()[0]; Assert.AreEqual("valThree", theEvent.Get("value")); stmt.Dispose(); }
public void TestRollupOneDim() { var listenerQuery = new SupportUpdateListener(); var listenerOut = new SupportUpdateListener(); var fieldsOut = "theString,total".Split(','); _epService.EPAdministrator.CreateEPL("create table MyTable(pk string primary key, total sum(int))"); _epService.EPAdministrator.CreateEPL("into table MyTable insert into MyStream select theString, sum(intPrimitive) as total from SupportBean#length(4) group by rollup(theString)").AddListener(listenerOut); _epService.EPAdministrator.CreateEPL("select MyTable[p00].total as c0 from SupportBean_S0").AddListener(listenerQuery); _epService.EPRuntime.SendEvent(new SupportBean("E1", 10)); AssertValuesListener(listenerQuery, new object[][] { new object[] { null, 10 }, new object[] { "E1", 10 }, new object[] { "E2", null } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E1", 10 }, new object[] { null, 10 } }); _epService.EPRuntime.SendEvent(new SupportBean("E2", 200)); AssertValuesListener(listenerQuery, new object[][] { new object[] { null, 210 }, new object[] { "E1", 10 }, new object[] { "E2", 200 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E2", 200 }, new object[] { null, 210 } }); _epService.EPRuntime.SendEvent(new SupportBean("E1", 11)); AssertValuesListener(listenerQuery, new object[][] { new object[] { null, 221 }, new object[] { "E1", 21 }, new object[] { "E2", 200 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E1", 21 }, new object[] { null, 221 } }); _epService.EPRuntime.SendEvent(new SupportBean("E2", 201)); AssertValuesListener(listenerQuery, new object[][] { new object[] { null, 422 }, new object[] { "E1", 21 }, new object[] { "E2", 401 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E2", 401 }, new object[] { null, 422 } }); _epService.EPRuntime.SendEvent(new SupportBean("E1", 12)); // {"E1", 10} leaving window AssertValuesListener(listenerQuery, new object[][] { new object[] { null, 424 }, new object[] { "E1", 23 }, new object[] { "E2", 401 } }); EPAssertionUtil.AssertPropsPerRow(listenerOut.GetAndResetLastNewData(), fieldsOut, new object[][] { new object[] { "E1", 23 }, new object[] { null, 424 } }); }
public void TestOrderBy() { var statementString = "select * from SupportBean.win:length(5) output every 5 events order by IntPrimitive limit 2 offset 2"; var stmt = _epService.EPAdministrator.CreateEPL(statementString); var fields = "TheString".Split(','); stmt.AddListener(_listener); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, null); SendEvent("E1", 90); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, null); SendEvent("E2", 5); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, null); SendEvent("E3", 60); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new object[] { "E1" } }); SendEvent("E4", 99); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new object[] { "E1" }, new object[] { "E4" } }); Assert.IsFalse(_listener.IsInvoked); SendEvent("E5", 6); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new object[] { "E3" }, new object[] { "E1" } }); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "E3" }, new object[] { "E1" } }); }
private void RunAssertionNonOverlapping() { epService.EPAdministrator.CreateEPL("create context CtxNowTillS0 start @now end SupportBean_S0"); epService.EPAdministrator.CreateEPL("context CtxNowTillS0 create table MyTable(pkey string primary key, thesum sum(int), col0 string)"); epService.EPAdministrator.CreateEPL("context CtxNowTillS0 into table MyTable select sum(IntPrimitive) as thesum from SupportBean group by TheString"); epService.EPAdministrator.CreateEPL("context CtxNowTillS0 select pkey as c0, thesum as c1 from MyTable output snapshot when terminated").AddListener(listener); epService.EPRuntime.SendEvent(new SupportBean("E1", 50)); epService.EPRuntime.SendEvent(new SupportBean("E2", 20)); epService.EPRuntime.SendEvent(new SupportBean("E1", 60)); epService.EPRuntime.SendEvent(new SupportBean_S0(-1)); // terminated EPAssertionUtil.AssertPropsPerRowAnyOrder(listener.GetAndResetLastNewData(), "c0,c1".Split(','), new object[][] { new object[] { "E1", 110 }, new object[] { "E2", 20 } }); epService.EPAdministrator.CreateEPL("context CtxNowTillS0 create index MyIdx on MyTable(col0)"); epService.EPAdministrator.CreateEPL("context CtxNowTillS0 select * from MyTable, SupportBean_S1 where col0 = p11"); epService.EPRuntime.SendEvent(new SupportBean("E3", 90)); epService.EPRuntime.SendEvent(new SupportBean("E1", 30)); epService.EPRuntime.SendEvent(new SupportBean("E3", 10)); epService.EPRuntime.SendEvent(new SupportBean_S0(-1)); // terminated EPAssertionUtil.AssertPropsPerRowAnyOrder(listener.GetAndResetLastNewData(), "c0,c1".Split(','), new object[][] { new object[] { "E1", 30 }, new object[] { "E3", 100 } }); epService.EPAdministrator.DestroyAllStatements(); }
private void RunAssertionFive(String expression) { EPStatement stmt = epService.EPAdministrator.CreateEPL(expression); listener = new SupportUpdateListener(); stmt.Events += listener.Update; String[] fields = "id,valh0,valh1,valh2".Split(','); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, null); SendBeanInt("E1", 0, 0, 0, 1); Object[][] result = new Object[][] { new Object[] { "E1", null, null, null } }; EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, result); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, result); SendBeanInt("E2", 0, 1, 1, 1); result = new Object[][] { new Object[] { "E2", null, null, null } }; EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, result); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, result); SendBeanInt("E3", 1, 1, 1, 1); result = new Object[][] { new Object[] { "E3", "E3-H01", "E3-H01-H11", "E3-H01-H11-H21" } }; EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, result); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, result); SendBeanInt("E4", 1, 0, 1, 1); result = new Object[][] { new Object[] { "E4", "E4-H01", null, null } }; EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, result); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, result); SendBeanInt("E5", 4, 4, 4, 2); result = new Object[][] { new Object[] { "E5", "E5-H02", "E5-H02-H12", "E5-H02-H12-H22" } }; EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, result); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, result); }
private void RunAssertionAddRemoveListener(EPServiceProvider epService) { string epl = "@IterableUnbound every tag=" + typeof(SupportBean).FullName; EPStatement patternStmt = epService.EPAdministrator.CreatePattern(epl, "MyPattern"); Assert.AreEqual(StatementType.PATTERN, ((EPStatementSPI)patternStmt).StatementMetadata.StatementType); var listener = new SupportUpdateListener(); // Pattern started when created // Add listener patternStmt.Events += listener.Update; Assert.IsNull(listener.LastNewData); Assert.IsFalse(patternStmt.HasFirst()); // Send event SupportBean theEvent = SendEvent(epService); Assert.AreEqual(theEvent, listener.GetAndResetLastNewData()[0].Get("tag")); Assert.AreSame(theEvent, patternStmt.First().Get("tag")); // Remove listener patternStmt.Events -= listener.Update; theEvent = SendEvent(epService); Assert.AreSame(theEvent, patternStmt.First().Get("tag")); Assert.IsNull(listener.LastNewData); // Add listener back patternStmt.Events += listener.Update; theEvent = SendEvent(epService); Assert.AreSame(theEvent, patternStmt.First().Get("tag")); Assert.AreEqual(theEvent, listener.GetAndResetLastNewData()[0].Get("tag")); }
public void Test1Stream3HistChainSubordinate() { String expression; expression = "select s0.Id as id, h0.val as valh0, h1.val as valh1, h2.val as valh2 " + "from SupportBeanInt.win:keepall() as s0, " + "method:SupportJoinMethods.FetchVal('H0', p00) as h0, " + "method:SupportJoinMethods.FetchVal(h0.val||'H1', p01) as h1, " + "method:SupportJoinMethods.FetchVal(h1.val||'H2', p02) as h2 " + " where h0.index = h1.index and h1.index = h2.index and h2.index = p03"; EPStatement stmt = _epService.EPAdministrator.CreateEPL(expression); _listener = new SupportUpdateListener(); stmt.Events += _listener.Update; String[] fields = "id,valh0,valh1,valh2".Split(','); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, null); SendBeanInt("E2", 4, 4, 4, 3); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new Object[][] { new Object[] { "E2", "H03", "H03H13", "H03H13H23" } }); SendBeanInt("E2", 4, 4, 4, 5); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, null); SendBeanInt("E2", 4, 4, 0, 1); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, null); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, new Object[][] { new Object[] { "E2", "H03", "H03H13", "H03H13H23" } }); }
private void RunAssertionTwo(String expression) { EPStatement stmt = _epService.EPAdministrator.CreateEPL(expression); _listener = new SupportUpdateListener(); stmt.Events += _listener.Update; String[] fields = "id,valh0,valh1".Split(','); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, null); SendBeanInt("E1", 1, 1); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new Object[][] { new Object[] { "E1", "H01", "H011" } }); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, new Object[][] { new Object[] { "E1", "H01", "H011" } }); SendBeanInt("E2", 0, 1); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, null); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, new Object[][] { new Object[] { "E1", "H01", "H011" } }); SendBeanInt("E3", 1, 0); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, null); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, new Object[][] { new Object[] { "E1", "H01", "H011" } }); SendBeanInt("E4", 2, 2); Object[][] result = { new Object[] { "E4", "H01", "H011" }, new Object[] { "E4", "H01", "H012" }, new Object[] { "E4", "H02", "H021" }, new Object[] { "E4", "H02", "H022" } }; EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, result); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, EPAssertionUtil.ConcatenateArray2Dim(result, new Object[][] { new Object[] { "E1", "H01", "H011" } })); }
public void TestAddRemoveListener() { String viewExpr = "@IterableUnbound every tag=" + typeof(SupportBean).FullName; EPStatement patternStmt = _epService.EPAdministrator.CreatePattern(viewExpr, "MyPattern"); Assert.AreEqual(StatementType.PATTERN, ((EPStatementSPI)patternStmt).StatementMetadata.StatementType); // Pattern started when created // Add listener patternStmt.Events += _listener.Update; Assert.IsNull(_listener.LastNewData); Assert.IsFalse(patternStmt.HasFirst()); // Send event SupportBean theEvent = SendEvent(); Assert.AreEqual(theEvent, _listener.GetAndResetLastNewData()[0].Get("tag")); Assert.AreSame(theEvent, patternStmt.First().Get("tag")); // Remove listener patternStmt.Events -= _listener.Update; theEvent = SendEvent(); Assert.AreSame(theEvent, patternStmt.First().Get("tag")); Assert.IsNull(_listener.LastNewData); // Add listener back patternStmt.Events += _listener.Update; theEvent = SendEvent(); Assert.AreSame(theEvent, patternStmt.First().Get("tag")); Assert.AreEqual(theEvent, _listener.GetAndResetLastNewData()[0].Get("tag")); }
private void RunAssertionCaseSyntax2EnumResult(EPServiceProvider epService) { string caseExpr = "select case IntPrimitive * 2 " + " when 2 then " + Name.Of <SupportEnumHelper>() + ".GetValueForEnum(0) " + " when 4 then " + Name.Of <SupportEnumHelper>() + ".GetValueForEnum(1) " + " else " + Name.Of <SupportEnumHelper>() + ".GetValueForEnum(2) " + " end as p1 " + " from " + typeof(SupportBean).FullName + "#length(10)"; EPStatement stmt = epService.EPAdministrator.CreateEPL(caseExpr); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; Assert.AreEqual(typeof(SupportEnum?), stmt.EventType.GetPropertyType("p1")); SendSupportBeanEvent(epService, 1); EventBean theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(SupportEnum.ENUM_VALUE_1, theEvent.Get("p1")); SendSupportBeanEvent(epService, 2); theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(SupportEnum.ENUM_VALUE_2, theEvent.Get("p1")); SendSupportBeanEvent(epService, 3); theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(SupportEnum.ENUM_VALUE_3, theEvent.Get("p1")); stmt.Dispose(); }
private void RunAssertion() { string[] fields = "TheString,int1,int2".Split(','); _epService.EPRuntime.SendEvent(new SupportBean("G1", 10)); _epService.EPRuntime.SendEvent(new SupportBean("G2", 11)); Assert.IsFalse(_listener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportBean("G1", 12)); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "G1", 12, 10 }, new object[] { "G2", 11, null } }); _epService.EPRuntime.SendEvent(new SupportBean("G2", 30)); _epService.EPRuntime.SendEvent(new SupportBean("G2", 20)); Assert.IsFalse(_listener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportBean("G2", 25)); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "G2", 25, 20 } }); _epService.EPRuntime.SendEvent(new SupportBean("G1", -1)); _epService.EPRuntime.SendEvent(new SupportBean("G1", -2)); Assert.IsFalse(_listener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportBean("G2", 8)); EPAssertionUtil.AssertPropsPerRow(_listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "G1", -2, -1 }, new object[] { "G2", 8, 25 } }); }
private void RunAssertionCaseSyntax2EnumChecks(EPServiceProvider epService) { string caseExpr = "select case supportEnum " + " when " + Name.Of <SupportEnumHelper>() + ".GetValueForEnum(0) then 1 " + " when " + Name.Of <SupportEnumHelper>() + ".GetValueForEnum(1) then 2 " + " end as p1 " + " from " + typeof(SupportBeanWithEnum).FullName + "#length(10)"; EPStatement stmt = epService.EPAdministrator.CreateEPL(caseExpr); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; Assert.AreEqual(typeof(int?), stmt.EventType.GetPropertyType("p1")); SendSupportBeanEvent(epService, "a", SupportEnum.ENUM_VALUE_1); EventBean theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(1, theEvent.Get("p1")); SendSupportBeanEvent(epService, "b", SupportEnum.ENUM_VALUE_2); theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(2, theEvent.Get("p1")); SendSupportBeanEvent(epService, "c", SupportEnum.ENUM_VALUE_3); theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(null, theEvent.Get("p1")); stmt.Dispose(); }
private void RunAssertionCaseSyntax2WithinExpression(EPServiceProvider epService) { string caseExpr = "select 2 * (case " + " IntPrimitive when 1 then 2 " + " when 2 then 3 " + " else 10 end) as p1 " + " from " + typeof(SupportBean).FullName + "#length(1)"; EPStatement stmt = epService.EPAdministrator.CreateEPL(caseExpr); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; Assert.AreEqual(typeof(int?), stmt.EventType.GetPropertyType("p1")); SendSupportBeanEvent(epService, 1); EventBean theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(4, theEvent.Get("p1")); SendSupportBeanEvent(epService, 2); theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(6, theEvent.Get("p1")); SendSupportBeanEvent(epService, 3); theEvent = listener.GetAndResetLastNewData()[0]; Assert.AreEqual(20, theEvent.Get("p1")); stmt.Dispose(); }
private void RunAssertionPerfKeyAndRange(EPServiceProvider epService) { epService.EPAdministrator.CreateEPL("create window SBR#keepall as SupportBeanRange"); epService.EPAdministrator.CreateEPL("@Name('I1') insert into SBR select * from SupportBeanRange"); epService.EPAdministrator.CreateEPL("create window SB#keepall as SupportBean"); epService.EPAdministrator.CreateEPL("@Name('I2') insert into SB select * from SupportBean"); // Preload Log.Info("Preloading events"); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { epService.EPRuntime.SendEvent(new SupportBean(Convert.ToString(i), j)); epService.EPRuntime.SendEvent(new SupportBeanRange("R", Convert.ToString(i), j - 1, j + 1)); } } Log.Info("Done preloading"); // start query string epl = "select * from SBR sbr, SB sb where sbr.key = sb.TheString and sb.IntPrimitive between sbr.rangeStart and sbr.rangeEnd"; EPStatement stmt = epService.EPAdministrator.CreateEPL(epl); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; // repeat Log.Info("Querying"); long startTime = DateTimeHelper.CurrentTimeMillis; for (int i = 0; i < 1000; i++) { epService.EPRuntime.SendEvent(new SupportBean("55", 10)); Assert.AreEqual(3, listener.GetAndResetLastNewData().Length); epService.EPRuntime.SendEvent(new SupportBeanRange("R", "56", 12, 20)); Assert.AreEqual(9, listener.GetAndResetLastNewData().Length); } Log.Info("Done Querying"); long endTime = DateTimeHelper.CurrentTimeMillis; Log.Info("delta=" + (endTime - startTime)); // test no event found epService.EPRuntime.SendEvent(new SupportBeanRange("R", "56", 2000, 3000)); epService.EPRuntime.SendEvent(new SupportBeanRange("R", "X", 2000, 3000)); Assert.IsFalse(listener.IsInvoked); Assert.IsTrue((endTime - startTime) < 1500, "delta=" + (endTime - startTime)); stmt.Dispose(); // delete all events epService.EPAdministrator.CreateEPL("on SupportBean delete from SBR"); epService.EPAdministrator.CreateEPL("on SupportBean delete from SB"); epService.EPRuntime.SendEvent(new SupportBean("D", -1)); epService.EPAdministrator.DestroyAllStatements(); epService.EPAdministrator.Configuration.RemoveEventType("SBR", true); epService.EPAdministrator.Configuration.RemoveEventType("SB", true); }
public void TestSingleNoOperatorMax() { InitService(2L, true); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(_epService, GetType(), GetType().FullName); } String expression = "@Name('A') select a.id as a, b.id as b from pattern [every a=SupportBean_A -> b=SupportBean_B]"; EPStatement stmt = _epService.EPAdministrator.CreateEPL(expression); SupportUpdateListener listener = new SupportUpdateListener(); stmt.Events += listener.Update; _epService.EPRuntime.SendEvent(new SupportBean_A("A1")); _epService.EPRuntime.SendEvent(new SupportBean_A("A2")); _handler.Contexts.Clear(); _epService.EPRuntime.SendEvent(new SupportBean_A("A3")); AssertContextEnginePool(_epService, stmt, _handler.Contexts, 2, GetExpectedCountMap("A", 2)); String[] fields = new String[] { "a", "b" }; _epService.EPRuntime.SendEvent(new SupportBean_B("B1")); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new Object[][] { new Object[] { "A1", "B1" }, new Object[] { "A2", "B1" } }); _epService.EPRuntime.SendEvent(new SupportBean_A("A4")); _epService.EPRuntime.SendEvent(new SupportBean_B("B2")); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new Object[][] { new Object[] { "A4", "B2" } }); Assert.IsTrue(_handler.Contexts.IsEmpty()); for (int i = 5; i < 9; i++) { _epService.EPRuntime.SendEvent(new SupportBean_A("A" + i)); if (i >= 7) { AssertContextEnginePool(_epService, stmt, _handler.Contexts, 2, GetExpectedCountMap("A", 2)); } } _epService.EPRuntime.SendEvent(new SupportBean_B("B3")); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new Object[][] { new Object[] { "A5", "B3" }, new Object[] { "A6", "B3" } }); _epService.EPRuntime.SendEvent(new SupportBean_B("B4")); Assert.IsFalse(listener.IsInvoked); _epService.EPRuntime.SendEvent(new SupportBean_A("A20")); _epService.EPRuntime.SendEvent(new SupportBean_A("A21")); _epService.EPRuntime.SendEvent(new SupportBean_B("B5")); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new Object[][] { new Object[] { "A20", "B5" }, new Object[] { "A21", "B5" } }); Assert.IsTrue(_handler.Contexts.IsEmpty()); stmt.Dispose(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.EndTest(); } }
private void RunAssertionEventBeanFootprint(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddImport(this.GetType()); // test select-clause var fields = new[] {"c0", "c1"}; var text = "select isNullValue(*, 'TheString') as c0," + "ExecClientSingleRowFunctionPlugIn.LocalIsNullValue(*, 'TheString') as c1 from SupportBean"; var stmt = epService.EPAdministrator.CreateEPL(text); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; epService.EPRuntime.SendEvent(new SupportBean("a", 1)); EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] {false, false}); epService.EPRuntime.SendEvent(new SupportBean(null, 2)); EPAssertionUtil.AssertProps(listener.AssertOneGetNewAndReset(), fields, new object[] {true, true}); stmt.Dispose(); // test pattern var textPattern = "select * from pattern [a=SupportBean -> b=SupportBean(TheString=GetValueAsString(a, 'TheString'))]"; var stmtPattern = epService.EPAdministrator.CreateEPL(textPattern); stmtPattern.Events += listener.Update; epService.EPRuntime.SendEvent(new SupportBean("E1", 1)); epService.EPRuntime.SendEvent(new SupportBean("E1", 2)); EPAssertionUtil.AssertProps( listener.AssertOneGetNewAndReset(), "a.IntPrimitive,b.IntPrimitive".Split(','), new object[] {1, 2}); stmtPattern.Dispose(); // test filter var textFilter = "select * from SupportBean('E1'=GetValueAsString(*, 'TheString'))"; var stmtFilter = epService.EPAdministrator.CreateEPL(textFilter); stmtFilter.Events += listener.Update; epService.EPRuntime.SendEvent(new SupportBean("E2", 1)); epService.EPRuntime.SendEvent(new SupportBean("E1", 2)); Assert.AreEqual(1, listener.GetAndResetLastNewData().Length); stmtFilter.Dispose(); // test "first" var textAccessAgg = "select * from SupportBean#keepall having 'E2' = GetValueAsString(last(*), 'TheString')"; var stmtAccessAgg = epService.EPAdministrator.CreateEPL(textAccessAgg); stmtAccessAgg.Events += listener.Update; epService.EPRuntime.SendEvent(new SupportBean("E2", 1)); epService.EPRuntime.SendEvent(new SupportBean("E1", 2)); Assert.AreEqual(1, listener.GetAndResetLastNewData().Length); stmtAccessAgg.Dispose(); // test "window" var textWindowAgg = "select * from SupportBean#keepall having EventsCheckStrings(window(*), 'TheString', 'E1')"; var stmtWindowAgg = epService.EPAdministrator.CreateEPL(textWindowAgg); stmtWindowAgg.Events += listener.Update; epService.EPRuntime.SendEvent(new SupportBean("E2", 1)); epService.EPRuntime.SendEvent(new SupportBean("E1", 2)); Assert.AreEqual(1, listener.GetAndResetLastNewData().Length); stmtWindowAgg.Dispose(); }
private void RunAssertionPartitionBy2FieldsKeepall(EPServiceProvider epService) { string[] fields = "a_string,a_cat,a_value,b_value".Split(','); string text = "select * from MyEvent#keepall " + "match_recognize (" + " partition by TheString, cat" + " measures A.TheString as a_string, A.cat as a_cat, A.value as a_value, B.value as b_value " + " all matches pattern (A B) " + " define " + " A as (A.value > PREV(A.value))," + " B as (B.value > PREV(B.value))" + ") order by a_string, a_cat"; EPStatement stmt = epService.EPAdministrator.CreateEPL(text); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; epService.EPRuntime.SendEvent(new SupportRecogBean("S1", "T1", 5)); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T1", 110)); epService.EPRuntime.SendEvent(new SupportRecogBean("S1", "T2", 21)); epService.EPRuntime.SendEvent(new SupportRecogBean("S1", "T1", 7)); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T1", 111)); epService.EPRuntime.SendEvent(new SupportRecogBean("S1", "T2", 20)); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T1", 110)); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T2", 1000)); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T2", 1001)); epService.EPRuntime.SendEvent(new SupportRecogBean("S1", null, 9)); Assert.IsFalse(listener.IsInvoked); Assert.IsFalse(stmt.HasFirst()); epService.EPRuntime.SendEvent(new SupportRecogBean("S1", "T1", 9)); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "S1", "T1", 7, 9 } }); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new object[] { "S1", "T1", 7, 9 } }); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T2", 1001)); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T1", 109)); epService.EPRuntime.SendEvent(new SupportRecogBean("S1", "T2", 25)); Assert.IsFalse(listener.IsInvoked); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new object[] { "S1", "T1", 7, 9 } }); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T2", 1002)); epService.EPRuntime.SendEvent(new SupportRecogBean("S2", "T2", 1003)); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "S2", "T2", 1002, 1003 } }); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new object[] { "S1", "T1", 7, 9 }, new object[] { "S2", "T2", 1002, 1003 } }); epService.EPRuntime.SendEvent(new SupportRecogBean("S1", "T2", 28)); EPAssertionUtil.AssertPropsPerRow(listener.GetAndResetLastNewData(), fields, new object[][] { new object[] { "S1", "T2", 25, 28 } }); EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), fields, new object[][] { new object[] { "S1", "T1", 7, 9 }, new object[] { "S1", "T2", 25, 28 }, new object[] { "S2", "T2", 1002, 1003 } }); stmt.Dispose(); }
private void AssertEventIds(int?idS0, int?idS1) { EventBean eventBean = _updateListener.GetAndResetLastNewData()[0]; Assert.AreEqual(idS0, eventBean.Get("idS0")); Assert.AreEqual(idS1, eventBean.Get("idS1")); _updateListener.Reset(); }