public void Test2PatternJoinWildcard() { String stmtText = "select * " + " from " + " pattern [every (es0=" + typeof(SupportBean_S0).FullName + " and es1=" + typeof(SupportBean_S1).FullName + ")].win:length(5) as s0," + " pattern [every (es2=" + typeof(SupportBean_S2).FullName + " and es3=" + typeof(SupportBean_S3).FullName + ")].win:length(5) as s1" + " where s0.es0.Id = s1.es2.Id"; EPStatement statement = epService.EPAdministrator.CreateEPL(stmtText); SupportUpdateListener updateListener = new SupportUpdateListener(); statement.Events += updateListener.Update; SupportBean_S0 s0 = SendEventS0(100, ""); SupportBean_S1 s1 = SendEventS1(1, ""); SupportBean_S2 s2 = SendEventS2(100, ""); SupportBean_S3 s3 = SendEventS3(2, ""); EventBean theEvent = updateListener.AssertOneGetNewAndReset(); var result = (IDictionary <String, Object>)theEvent.Get("s0"); Assert.AreSame(s0, ((EventBean)result.Get("es0")).Underlying); Assert.AreSame(s1, ((EventBean)result.Get("es1")).Underlying); result = (IDictionary <String, Object>)theEvent.Get("s1"); Assert.AreSame(s2, ((EventBean)result.Get("es2")).Underlying); Assert.AreSame(s3, ((EventBean)result.Get("es3")).Underlying); }
private SupportBean_S1 MakeSendS1(int id, string p10) { var bean = new SupportBean_S1(id, p10); _epService.EPRuntime.SendEvent(bean); return(bean); }
public bool Call() { try { for (int loop = 0; loop < _numRepeats; loop++) { int id = _threadNum * 10000000 + loop; Object eventS0 = new SupportBean_S0(id); Object eventS1 = new SupportBean_S1(id); _engine.EPRuntime.SendEvent(eventS0); _engine.EPRuntime.SendEvent(eventS1); } return(true); } catch (AssertionException ex) { Log.Error("Assertion error in thread " + Thread.CurrentThread.ManagedThreadId, ex); return(false); } catch (Exception ex) { Log.Error("Error in thread " + Thread.CurrentThread.ManagedThreadId, ex); return(false); } }
public void TestWhereJoinOrNull() { SetupStatement("where s0.p01 = s1.p11 or s1.p11 is null"); // Send S0[0] p01=a _eventsS0[0].P01 = "[a]"; SendEvent(_eventsS0[0]); CompareEvent(_updateListener.AssertOneGetNewAndReset(), _eventsS0[0], null); // Send events to test the join for multiple rows incl. null value SupportBean_S1 s1_1 = new SupportBean_S1(1000, "5", "X"); SupportBean_S1 s1_2 = new SupportBean_S1(1001, "5", "Y"); SupportBean_S1 s1_3 = new SupportBean_S1(1002, "5", "X"); SupportBean_S1 s1_4 = new SupportBean_S1(1003, "5", null); SupportBean_S0 s0 = new SupportBean_S0(1, "5", "X"); SendEvent(new Object[] { s1_1, s1_2, s1_3, s1_4, s0 }); Assert.AreEqual(3, _updateListener.LastNewData.Length); Object[] received = new Object[3]; for (int i = 0; i < 3; i++) { Assert.AreSame(s0, _updateListener.LastNewData[i].Get("s0")); received[i] = _updateListener.LastNewData[i].Get("s1"); } EPAssertionUtil.AssertEqualsAnyOrder(new Object[] { s1_1, s1_3, s1_4 }, received); }
private void RunAssertionSameEventCompile(EPServiceProvider epService) { string stmtText = "select (select * from S1#length(1000)) as events1 from S1"; EPStatementObjectModel subquery = epService.EPAdministrator.CompileEPL(stmtText); subquery = (EPStatementObjectModel)SerializableObjectCopier.Copy(epService.Container, subquery); EPStatement stmt = epService.EPAdministrator.Create(subquery); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; EventType type = stmt.EventType; Assert.AreEqual(typeof(SupportBean_S1), type.GetPropertyType("events1")); var theEvent = new SupportBean_S1(-1, "Y"); epService.EPRuntime.SendEvent(theEvent); EventBean result = listener.AssertOneGetNewAndReset(); Assert.AreSame(theEvent, result.Get("events1")); stmt.Dispose(); }
private SupportBean_S1 SendEventS1(int id, String p10) { SupportBean_S1 theEvent = new SupportBean_S1(id, p10); _epService.EPRuntime.SendEvent(theEvent); return(theEvent); }
private void RunAssertionWhereJoinOrNull(EPServiceProvider epService) { EPStatement stmt = SetupStatement(epService, "where s0.p01 = s1.p11 or s1.p11 is null"); var updateListener = new SupportUpdateListener(); stmt.Events += updateListener.Update; var eventS0 = new SupportBean_S0(0, "0", "[a]"); SendEvent(eventS0, epService); CompareEvent(updateListener.AssertOneGetNewAndReset(), eventS0, null); // Send events to test the join for multiple rows incl. null value var s1_1 = new SupportBean_S1(1000, "5", "X"); var s1_2 = new SupportBean_S1(1001, "5", "Y"); var s1_3 = new SupportBean_S1(1002, "5", "X"); var s1_4 = new SupportBean_S1(1003, "5", null); var s0 = new SupportBean_S0(1, "5", "X"); SendEvent(epService, new object[] { s1_1, s1_2, s1_3, s1_4, s0 }); Assert.AreEqual(3, updateListener.LastNewData.Length); var received = new Object[3]; for (int i = 0; i < 3; i++) { Assert.AreSame(s0, updateListener.LastNewData[i].Get("s0")); received[i] = updateListener.LastNewData[i].Get("s1"); } EPAssertionUtil.AssertEqualsAnyOrder(new object[] { s1_1, s1_3, s1_4 }, received); stmt.Dispose(); }
private static void SendEventS1( RegressionEnvironment env, int id) { var theEvent = new SupportBean_S1(id); env.SendEventBean(theEvent); }
public void SetUp() { Configuration config = SupportConfigFactory.GetConfiguration(); config.EngineDefaults.LoggingConfig.IsEnableQueryPlan = true; _epService = EPServiceProviderManager.GetDefaultProvider(config); _epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(_epService, GetType(), GetType().FullName); } _listener = new SupportUpdateListener(); _eventsS0 = new SupportBean_S0[15]; _eventsS1 = new SupportBean_S1[15]; int count = 100; for (int i = 0; i < _eventsS0.Length; i++) { _eventsS0[i] = new SupportBean_S0(count++, Convert.ToString(i)); } count = 200; for (int i = 0; i < _eventsS1.Length; i++) { _eventsS1[i] = new SupportBean_S1(count++, Convert.ToString(i)); } }
private void RunAssertionInWildcard(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddEventType("ArrayBean", typeof(SupportBeanArrayCollMap)); string stmtText = "select s0.anyObject in (select * from S1#length(1000)) as value from ArrayBean s0"; EPStatement stmt = epService.EPAdministrator.CreateEPL(stmtText); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var s1 = new SupportBean_S1(100); var arrayBean = new SupportBeanArrayCollMap(s1); epService.EPRuntime.SendEvent(s1); epService.EPRuntime.SendEvent(arrayBean); Assert.AreEqual(true, listener.AssertOneGetNewAndReset().Get("value")); var s2 = new SupportBean_S2(100); arrayBean.AnyObject = s2; epService.EPRuntime.SendEvent(s2); epService.EPRuntime.SendEvent(arrayBean); Assert.AreEqual(false, listener.AssertOneGetNewAndReset().Get("value")); stmt.Dispose(); }
public void TestSameEventOM() { EPStatementObjectModel subquery = new EPStatementObjectModel(); subquery.SelectClause = SelectClause.CreateWildcard(); subquery.FromClause = FromClause.Create(FilterStream.Create("S1").AddView(View.Create("win", "length", Expressions.Constant(1000)))); EPStatementObjectModel model = new EPStatementObjectModel(); model.FromClause = FromClause.Create(FilterStream.Create("S1")); model.SelectClause = SelectClause.Create().Add(Expressions.Subquery(subquery), "events1"); model = (EPStatementObjectModel)SerializableObjectCopier.Copy(model); String stmtText = "select (select * from S1.win:length(1000)) as events1 from S1"; Assert.AreEqual(stmtText, model.ToEPL()); EPStatement stmt = _epService.EPAdministrator.Create(model); stmt.Events += _listener.Update; EventType type = stmt.EventType; Assert.AreEqual(typeof(SupportBean_S1), type.GetPropertyType("events1")); Object theEvent = new SupportBean_S1(-1, "Y"); _epService.EPRuntime.SendEvent(theEvent); EventBean result = _listener.AssertOneGetNewAndReset(); Assert.AreSame(theEvent, result.Get("events1")); }
private SupportBean_S1 SendEventS1(EPServiceProvider epService, int id, string p10) { var theEvent = new SupportBean_S1(id, p10); epService.EPRuntime.SendEvent(theEvent); return(theEvent); }
public void Run(RegressionEnvironment env) { SetupStatement(env, "where S0.P01 = S1.P11 or S1.P11 is null"); var eventS0 = new SupportBean_S0(0, "0", "[a]"); SendEvent(eventS0, env); CompareEvent(env.Listener("s0").AssertOneGetNewAndReset(), eventS0, null); // Send events to test the join for multiple rows incl. null value var s1Bean1 = new SupportBean_S1(1000, "5", "X"); var s1Bean2 = new SupportBean_S1(1001, "5", "Y"); var s1Bean3 = new SupportBean_S1(1002, "5", "X"); var s1Bean4 = new SupportBean_S1(1003, "5", null); var s0 = new SupportBean_S0(1, "5", "X"); SendEvent( env, new object[] {s1Bean1, s1Bean2, s1Bean3, s1Bean4, s0}); Assert.AreEqual(3, env.Listener("s0").LastNewData.Length); var received = new object[3]; for (var i = 0; i < 3; i++) { Assert.AreSame(s0, env.Listener("s0").LastNewData[i].Get("S0")); received[i] = env.Listener("s0").LastNewData[i].Get("S1"); } EPAssertionUtil.AssertEqualsAnyOrder(new object[] {s1Bean1, s1Bean3, s1Bean4}, received); env.UndeployAll(); }
private static SupportBeanArrayCollMap Make() { var s1 = new SupportBean_S1(100); var arrayBean = new SupportBeanArrayCollMap(s1); arrayBean.ObjectArr = new object[] { null, "a", false, s1 }; return(arrayBean); }
private static void CompareEvent( EventBean receivedEvent, SupportBean_S0 expectedS0, SupportBean_S1 expectedS1) { Assert.AreSame(expectedS0, receivedEvent.Get("S0")); Assert.AreSame(expectedS1, receivedEvent.Get("S1")); }
private static SupportBean_S1 SendEventS1( RegressionEnvironment env, int id, string p10) { var theEvent = new SupportBean_S1(id, p10); env.SendEventBean(theEvent); return theEvent; }
private void RunAssertionWhereJoin(EPServiceProvider epService) { EPStatement stmt = SetupStatement(epService, "where s0.p01 = s1.p11"); var updateListener = new SupportUpdateListener(); stmt.Events += updateListener.Update; var eventsS0 = new SupportBean_S0[15]; var eventsS1 = new SupportBean_S1[15]; int count = 100; for (int i = 0; i < eventsS0.Length; i++) { eventsS0[i] = new SupportBean_S0(count++, Convert.ToString(i)); } count = 200; for (int i = 0; i < eventsS1.Length; i++) { eventsS1[i] = new SupportBean_S1(count++, Convert.ToString(i)); } // Send S0[0] p01=a eventsS0[0].P01 = "[a]"; SendEvent(eventsS0[0], epService); Assert.IsFalse(updateListener.IsInvoked); // Send S1[1] p11=b eventsS1[1].P11 = "[b]"; SendEvent(eventsS1[1], epService); Assert.IsFalse(updateListener.IsInvoked); // Send S0[1] p01=c, no match expected eventsS0[1].P01 = "[c]"; SendEvent(eventsS0[1], epService); Assert.IsFalse(updateListener.IsInvoked); // Send S1[2] p11=d eventsS1[2].P11 = "[d]"; SendEvent(eventsS1[2], epService); // Send S0[2] p01=d eventsS0[2].P01 = "[d]"; SendEvent(eventsS0[2], epService); CompareEvent(updateListener.AssertOneGetNewAndReset(), eventsS0[2], eventsS1[2]); // Send S1[3] and S0[3] with differing props, no match expected eventsS1[3].P11 = "[e]"; SendEvent(eventsS1[3], epService); eventsS0[3].P01 = "[e1]"; SendEvent(eventsS0[3], epService); Assert.IsFalse(updateListener.IsInvoked); stmt.Dispose(); }
private void TryWhereNull(EPServiceProvider epService, SupportUpdateListener updateListener) { var s1_1 = new SupportBean_S1(1000, "5", "X"); var s1_2 = new SupportBean_S1(1001, "5", null); var s1_3 = new SupportBean_S1(1002, "6", null); SendEvent(epService, new object[] { s1_1, s1_2, s1_3 }); Assert.IsFalse(updateListener.IsInvoked); var s0 = new SupportBean_S0(1, "5", "X"); SendEvent(s0, epService); CompareEvent(updateListener.AssertOneGetNewAndReset(), s0, s1_2); }
private void TryWhereNull() { SupportBean_S1 s1_1 = new SupportBean_S1(1000, "5", "X"); SupportBean_S1 s1_2 = new SupportBean_S1(1001, "5", null); SupportBean_S1 s1_3 = new SupportBean_S1(1002, "6", null); SendEvent(new Object[] { s1_1, s1_2, s1_3 }); Assert.IsFalse(_updateListener.IsInvoked); SupportBean_S0 s0 = new SupportBean_S0(1, "5", "X"); SendEvent(s0); CompareEvent(_updateListener.AssertOneGetNewAndReset(), s0, s1_2); }
static EPLOuterJoin2Stream() { EVENTS_S0 = new SupportBean_S0[15]; EVENTS_S1 = new SupportBean_S1[15]; var count = 100; for (var i = 0; i < EVENTS_S0.Length; i++) { EVENTS_S0[i] = new SupportBean_S0(count++, Convert.ToString(i)); } count = 200; for (var i = 0; i < EVENTS_S1.Length; i++) { EVENTS_S1[i] = new SupportBean_S1(count++, Convert.ToString(i)); } }
private static void TryWhereNull(RegressionEnvironment env) { var s1Bean1 = new SupportBean_S1(1000, "5", "X"); var s1Bean2 = new SupportBean_S1(1001, "5", null); var s1Bean3 = new SupportBean_S1(1002, "6", null); SendEvent( env, new object[] {s1Bean1, s1Bean2, s1Bean3}); Assert.IsFalse(env.Listener("s0").IsInvoked); var s0 = new SupportBean_S0(1, "5", "X"); SendEvent(s0, env); CompareEvent(env.Listener("s0").AssertOneGetNewAndReset(), s0, s1Bean2); }
public void Run(RegressionEnvironment env) { SetupStatement(env, "where S0.P01 = S1.P11"); var eventsS0 = new SupportBean_S0[15]; var eventsS1 = new SupportBean_S1[15]; var count = 100; for (var i = 0; i < eventsS0.Length; i++) { eventsS0[i] = new SupportBean_S0(count++, Convert.ToString(i)); } count = 200; for (var i = 0; i < eventsS1.Length; i++) { eventsS1[i] = new SupportBean_S1(count++, Convert.ToString(i)); } // Send S0[0] p01=a eventsS0[0].P01 = "[a]"; SendEvent(eventsS0[0], env); Assert.IsFalse(env.Listener("s0").IsInvoked); // Send S1[1] p11=b eventsS1[1].P11 = "[b]"; SendEvent(eventsS1[1], env); Assert.IsFalse(env.Listener("s0").IsInvoked); // Send S0[1] p01=c, no match expected eventsS0[1].P01 = "[c]"; SendEvent(eventsS0[1], env); Assert.IsFalse(env.Listener("s0").IsInvoked); // Send S1[2] p11=d eventsS1[2].P11 = "[d]"; SendEvent(eventsS1[2], env); // Send S0[2] p01=d eventsS0[2].P01 = "[d]"; SendEvent(eventsS0[2], env); CompareEvent(env.Listener("s0").AssertOneGetNewAndReset(), eventsS0[2], eventsS1[2]); // Send S1[3] and S0[3] with differing props, no match expected eventsS1[3].P11 = "[e]"; SendEvent(eventsS1[3], env); eventsS0[3].P01 = "[e1]"; SendEvent(eventsS0[3], env); Assert.IsFalse(env.Listener("s0").IsInvoked); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('stmt1') select S0.AnyObject in (ObjectArr) as value from SupportBeanArrayCollMap S0"; env.CompileDeploy(epl).AddListener("stmt1"); var s1 = new SupportBean_S1(100); var arrayBean = new SupportBeanArrayCollMap(s1); arrayBean.ObjectArr = new object[] {null, "a", false, s1}; env.SendEventBean(arrayBean); Assert.AreEqual(true, env.Listener("stmt1").AssertOneGetNewAndReset().Get("value")); arrayBean.AnyObject = null; env.SendEventBean(arrayBean); Assert.IsNull(env.Listener("stmt1").AssertOneGetNewAndReset().Get("value")); env.UndeployAll(); }
public void TestSameEvent() { String stmtText = "select (select * from S1.win:length(1000)) as events1 from S1"; EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText); stmt.Events += _listener.Update; EventType type = stmt.EventType; Assert.AreEqual(typeof(SupportBean_S1), type.GetPropertyType("events1")); Object theEvent = new SupportBean_S1(-1, "Y"); _epService.EPRuntime.SendEvent(theEvent); EventBean result = _listener.AssertOneGetNewAndReset(); Assert.AreSame(theEvent, result.Get("events1")); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select * from SupportBean_S0#lastevent as `order`, SupportBean_S1#lastevent as `select`"; env.CompileDeploy(epl).AddListener("s0"); var s0 = new SupportBean_S0(1, "S0_1"); env.SendEventBean(s0); env.Milestone(0); var s1 = new SupportBean_S1(10, "S1_1"); env.SendEventBean(s1); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), new[] {"order", "select", "order.P00", "select.P10"}, new object[] {s0, s1, "S0_1", "S1_1"}); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var stmtText = "@Name('s0') select S0.AnyObject in (select * from SupportBean_S1#length(1000)) as value from SupportBeanArrayCollMap S0"; env.CompileDeployAddListenerMileZero(stmtText, "s0"); var s1 = new SupportBean_S1(100); var arrayBean = new SupportBeanArrayCollMap(s1); env.SendEventBean(s1); env.SendEventBean(arrayBean); Assert.AreEqual(true, env.Listener("s0").AssertOneGetNewAndReset().Get("value")); var s2 = new SupportBean_S2(100); arrayBean.AnyObject = s2; env.SendEventBean(s2); env.SendEventBean(arrayBean); Assert.AreEqual(false, env.Listener("s0").AssertOneGetNewAndReset().Get("value")); env.UndeployAll(); }
public object Call() { try { for (var loop = 0; loop < numRepeats; loop++) { var id = threadNum * 10000000 + loop; object eventS0 = new SupportBean_S0(id); object eventS1 = new SupportBean_S1(id); runtime.EventService.SendEventBean(eventS0, "SupportBean_S0"); runtime.EventService.SendEventBean(eventS1, "SupportBean_S1"); } } catch (AssertionException ex) { log.Error("Assertion error in thread " + Thread.CurrentThread.ManagedThreadId, ex); return false; } catch (Exception ex) { log.Error("Error in thread " + Thread.CurrentThread.ManagedThreadId, ex); return false; } return true; }
private void RunAssertionInObject(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddEventType("ArrayBean", typeof(SupportBeanArrayCollMap)); var stmtText = "select s0.anyObject in (objectArr) as value from ArrayBean s0"; var stmt = epService.EPAdministrator.CreateEPL(stmtText); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; var s1 = new SupportBean_S1(100); var arrayBean = new SupportBeanArrayCollMap(s1); arrayBean.ObjectArr = new object[] { null, "a", false, s1 }; epService.EPRuntime.SendEvent(arrayBean); Assert.AreEqual(true, listener.AssertOneGetNewAndReset().Get("value")); arrayBean.AnyObject = null; epService.EPRuntime.SendEvent(arrayBean); Assert.IsNull(listener.AssertOneGetNewAndReset().Get("value")); stmt.Dispose(); }
public void TestInWildcard() { _epService.EPAdministrator.Configuration.AddEventType("ArrayBean", typeof(SupportBeanArrayCollMap)); String stmtText = "select s0.anyObject in (select * from S1#length(1000)) as value from ArrayBean s0"; EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText); stmt.Events += _listener.Update; SupportBean_S1 s1 = new SupportBean_S1(100); SupportBeanArrayCollMap arrayBean = new SupportBeanArrayCollMap(s1); _epService.EPRuntime.SendEvent(s1); _epService.EPRuntime.SendEvent(arrayBean); Assert.AreEqual(true, _listener.AssertOneGetNewAndReset().Get("value")); SupportBean_S2 s2 = new SupportBean_S2(100); arrayBean.AnyObject = s2; _epService.EPRuntime.SendEvent(s2); _epService.EPRuntime.SendEvent(arrayBean); Assert.AreEqual(false, _listener.AssertOneGetNewAndReset().Get("value")); }
private void RunAssertionSelectWildcardNoName(EPServiceProvider epService) { string stmtText = "select (select * from S1#length(1000)) from S0"; EPStatement stmt = epService.EPAdministrator.CreateEPL(stmtText); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; EventType type = stmt.EventType; Assert.AreEqual(typeof(SupportBean_S1), type.GetPropertyType("subselect_1")); var theEvent = new SupportBean_S1(-1, "Y"); epService.EPRuntime.SendEvent(theEvent); epService.EPRuntime.SendEvent(new SupportBean_S0(0)); EventBean result = listener.AssertOneGetNewAndReset(); Assert.AreSame(theEvent, result.Get("subselect_1")); stmt.Dispose(); }