public void Run(RegressionEnvironment env) { string eplOne = "@Name('s0') select sb.* from SupportBean#keepall sb, SupportBeanRange#lastevent where IntBoxed between RangeStart and RangeEnd"; env.CompileDeploy(eplOne).AddListener("s0"); string eplTwo = "@Name('s1') select sb.* from SupportBean#keepall sb, SupportBeanRange#lastevent where TheString = Key and IntBoxed in [RangeStart: RangeEnd]"; env.CompileDeploy(eplTwo).AddListener("s1"); // null join lookups SendEvent(env, new SupportBeanRange("R1", "G", (int?) null, null)); SendEvent(env, new SupportBeanRange("R2", "G", null, 10)); SendEvent(env, new SupportBeanRange("R3", "G", 10, null)); SendSupportBean(env, "G", -1, null); // range invalid SendEvent(env, new SupportBeanRange("R4", "G", 10, 0)); Assert.IsFalse(env.Listener("s0").IsInvoked); Assert.IsFalse(env.Listener("s1").IsInvoked); // duplicates object eventOne = SendSupportBean(env, "G", 100, 5); object eventTwo = SendSupportBean(env, "G", 101, 5); SendEvent(env, new SupportBeanRange("R4", "G", 0, 10)); EventBean[] events = env.Listener("s0").GetAndResetLastNewData(); EPAssertionUtil.AssertEqualsAnyOrder(new[] {eventOne, eventTwo}, EPAssertionUtil.GetUnderlying(events)); events = env.Listener("s1").GetAndResetLastNewData(); EPAssertionUtil.AssertEqualsAnyOrder(new[] {eventOne, eventTwo}, EPAssertionUtil.GetUnderlying(events)); // test string compare string eplThree = "@Name('s2') select sb.* from SupportBeanRange#keepall sb, SupportBean#lastevent where TheString in [RangeStartStr:RangeEndStr]"; env.CompileDeploy(eplThree).AddListener("s2"); SendSupportBean(env, "P", 1, 1); SendEvent(env, new SupportBeanRange("R5", "R5", "O", "Q")); Assert.IsTrue(env.Listener("s0").IsInvoked); env.UndeployAll(); }
public void TestRangeNullAndDupAndInvalid() { _epService.EPAdministrator.Configuration.AddEventType <SupportBean>(); _epService.EPAdministrator.Configuration.AddEventType("SupportBeanRange", typeof(SupportBeanRange)); _epService.EPAdministrator.Configuration.AddEventType("SupportBeanComplexProps", typeof(SupportBeanComplexProps)); String eplOne = "select sb.* from SupportBean#keepall sb, SupportBeanRange#lastevent where IntBoxed between rangeStart and rangeEnd"; EPStatement stmtOne = _epService.EPAdministrator.CreateEPL(eplOne); stmtOne.Events += _listener.Update; String eplTwo = "select sb.* from SupportBean#keepall sb, SupportBeanRange#lastevent where TheString = key and IntBoxed in [rangeStart: rangeEnd]"; EPStatement stmtTwo = _epService.EPAdministrator.CreateEPL(eplTwo); SupportUpdateListener listenerTwo = new SupportUpdateListener(); stmtTwo.Events += listenerTwo.Update; // null join lookups SendEvent(new SupportBeanRange("R1", "G", (int?)null, null)); SendEvent(new SupportBeanRange("R2", "G", null, 10)); SendEvent(new SupportBeanRange("R3", "G", 10, null)); SendSupportBean("G", -1, null); // range invalid SendEvent(new SupportBeanRange("R4", "G", 10, 0)); Assert.IsFalse(_listener.IsInvoked); Assert.IsFalse(listenerTwo.IsInvoked); // duplicates Object eventOne = SendSupportBean("G", 100, 5); Object eventTwo = SendSupportBean("G", 101, 5); SendEvent(new SupportBeanRange("R4", "G", 0, 10)); EventBean[] events = _listener.GetAndResetLastNewData(); EPAssertionUtil.AssertEqualsAnyOrder(new Object[] { eventOne, eventTwo }, EPAssertionUtil.GetUnderlying(events)); events = listenerTwo.GetAndResetLastNewData(); EPAssertionUtil.AssertEqualsAnyOrder(new Object[] { eventOne, eventTwo }, EPAssertionUtil.GetUnderlying(events)); // test string compare String eplThree = "select sb.* from SupportBeanRange#keepall sb, SupportBean#lastevent where TheString in [rangeStartStr:rangeEndStr]"; _epService.EPAdministrator.CreateEPL(eplThree); SendSupportBean("P", 1, 1); SendEvent(new SupportBeanRange("R5", "R5", "O", "Q")); Assert.IsTrue(_listener.IsInvoked); }