public void Run(RegressionEnvironment env) { // relational op tests handled by relational op unit test var epl = "@Name('s0') select * from SupportBeanNumeric where DecimalOne < 10 and Bigint > 10"; env.CompileDeploy(epl).AddListener("s0"); SendBigNumEvent(env, 10, 10m); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); SendBigNumEvent(env, 11, 9m); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); epl = "@Name('s0') select * from SupportBeanNumeric where DecimalOne < 10.0"; env.CompileDeployAddListenerMile(epl, "s0", 1); SendBigNumEvent(env, 0, 11m); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(null, 9.999m)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); // test float env.CompileDeployAddListenerMile("@Name('s0') select * from SupportBeanNumeric where FloatOne < 10f and FloatTwo > 10f", "s0", 1); env.SendEventBean(new SupportBeanNumeric(true, 1f, 20f)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(true, 20f, 1f)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var fieldList = "DecimalOne".SplitCsv(); var epl = "@Name('s0') select DecimalOne from SupportBeanNumeric(DecimalOne = 4)"; env.CompileDeploy(epl).AddListener("s0"); SendBigNumEvent(env, 0, 2); Assert.IsFalse(env.Listener("s0").IsInvoked); SendBigNumEvent(env, 0, 4); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fieldList, 4m); env.UndeployAll(); env.CompileDeployAddListenerMile("@Name('s0') select DecimalOne from SupportBeanNumeric(DecimalOne = 4d)", "s0", 1); SendBigNumEvent(env, 0, 4m); Assert.IsTrue(env.Listener("s0").IsInvoked); env.Listener("s0").Reset(); env.SendEventBean(new SupportBeanNumeric(new BigInteger(0), 4m)); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fieldList, 4m); env.UndeployAll(); env.CompileDeployAddListenerMile("@Name('s0') select DecimalOne from SupportBeanNumeric(Bigint = 4)", "s0", 2); SendBigNumEvent(env, 3, 4m); Assert.IsFalse(env.Listener("s0").IsInvoked); SendBigNumEvent(env, 4, 3m); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fieldList, 3m); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select * from pattern [a=SupportBeanNumeric -> every b=SupportBean(IntPrimitive in (a.IntOne, a.IntTwo))]"; env.CompileDeployAddListenerMile(epl, "s0", 0); SendBeanNumeric(env, 10, 20); SendBeanInt(env, 10); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); SendBeanInt(env, 11); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); SendBeanInt(env, 20); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); epl = "@Name('s0') select * from pattern [a=SupportBean_S0 -> every b=SupportBean(TheString in (a.P00, a.P01, a.P02))]"; env.CompileDeployAddListenerMile(epl, "s0", 1); env.SendEventBean(new SupportBean_S0(1, "a", "b", "c", "d")); SendBeanString(env, "a"); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); SendBeanString(env, "x"); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); SendBeanString(env, "b"); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); SendBeanString(env, "c"); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); SendBeanString(env, "d"); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { // subselect in pattern var stmtTextOne = "@Name('s0') select s.Id as myId from pattern [every s=SupportBean_S0(P00 in (select P10 from SupportBean_S1#lastevent))]"; env.CompileDeployAddListenerMileZero(stmtTextOne, "s0"); TryAssertion(env); env.UndeployAll(); // subselect in filter var stmtTextTwo = "@Name('s0') select Id as myId from SupportBean_S0(P00 in (select P10 from SupportBean_S1#lastevent))"; env.CompileDeployAddListenerMile(stmtTextTwo, "s0", 1); TryAssertion(env); env.UndeployAll(); // subselect in filter with named window var epl = "create window MyS1Window#lastevent as select * from SupportBean_S1;\n" + "insert into MyS1Window select * from SupportBean_S1;\n" + "@Name('s0') select Id as myId from SupportBean_S0(P00 in (select P10 from MyS1Window))"; env.CompileDeployAddListenerMile(epl, "s0", 2); TryAssertion(env); env.UndeployAll(); // subselect in pattern with named window epl = "create window MyS1Window#lastevent as select * from SupportBean_S1;\n" + "insert into MyS1Window select * from SupportBean_S1;\n" + "@Name('s0') select s.Id as myId from pattern [every s=SupportBean_S0(P00 in (select P10 from MyS1Window))];\n"; env.CompileDeployAddListenerMile(epl, "s0", 3); TryAssertion(env); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var fields = new [] { "val0", "val1", "val2", "val3" }; var epl = "@Name('s0') select " + "DateTimeEx.get('month') as val0," + "DateTimeOffset.get('month') as val1," + "DateTime.get('month') as val2," + "LongDate.get('month') as val3" + " from SupportDateTime"; env.CompileDeploy(epl).AddListener("s0"); LambdaAssertionUtil.AssertTypes( env.Statement("s0").EventType, fields, new[] { typeof(int?), typeof(int?), typeof(int?), typeof(int?) }); var startTime = "2002-05-30T09:00:00.000"; env.SendEventBean(SupportDateTime.Make(startTime)); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { 5, 5, 5, 5 }); env.UndeployAll(); // try event as input epl = "@Name('s0') select abc.Get('month') as val0 from SupportTimeStartEndA as abc"; env.CompileDeployAddListenerMile(epl, "s0", 1); env.SendEventBean(SupportTimeStartEndA.Make("A0", startTime, 0)); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), new [] { "val0" }, new object[] { 5 }); env.UndeployAll(); // test "Get" method on object is preferred epl = "@Name('s0') select e.Get() as c0, e.Get('abc') as c1 from SupportEventWithJustGet as e"; env.CompileDeployAddListenerMile(epl, "s0", 1); env.SendEventBean(new SupportEventWithJustGet()); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), new [] { "c0", "c1" }, new object[] {1, 2}); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var filtersAB = new[] { "(TheString = 'a' and IntPrimitive = 1) or (TheString = 'b' and IntPrimitive = 2)", "(IntPrimitive = 1 and TheString = 'a') or (IntPrimitive = 2 and TheString = 'b')", "(TheString = 'b' and IntPrimitive = 2) or (TheString = 'a' and IntPrimitive = 1)", }; foreach (var filter in filtersAB) { var epl = "@Name('s0') select * from SupportBean(" + filter + ")"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean", new[] { new[] {new FilterItem("TheString", FilterOperator.EQUAL), new FilterItem("IntPrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("TheString", FilterOperator.EQUAL), new FilterItem("IntPrimitive", FilterOperator.EQUAL)}, }); } SendAssertEvents( env, new[] {MakeEvent("a", 1), MakeEvent("b", 2)}, new[] {MakeEvent("x", 0), MakeEvent("a", 0), MakeEvent("a", 2), MakeEvent("b", 1)} ); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); // test 'or' rewrite var filtersAB = new[] { "select * from SupportBean(TheString = 'a' or IntPrimitive = 1)", "select * from SupportBean(TheString = 'a' or 1 = IntPrimitive)", "select * from SupportBean('a' = TheString or 1 = IntPrimitive)", "select * from SupportBean('a' = TheString or IntPrimitive = 1)", }; foreach (var filter in filtersAB) { env.CompileDeployAddListenerMile("@Name('s0')" + filter, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean", new[] { new[] {new FilterItem("IntPrimitive", FilterOperator.EQUAL)}, new[] {new FilterItem("TheString", FilterOperator.EQUAL)}, }); } env.SendEventBean(new SupportBean("a", 0)); env.Listener("s0").AssertOneGetNewAndReset(); env.SendEventBean(new SupportBean("b", 1)); env.Listener("s0").AssertOneGetNewAndReset(); env.SendEventBean(new SupportBean("c", 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var filters = new[] { "A!=1 and A!=2 and (B=1 or C=1)", }; foreach (var filter in filters) { var epl = "@Name('s0') select * from SupportBean_IntAlphabetic(" + filter + ")"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean_IntAlphabetic", new[] { new[] {new FilterItem("A", FilterOperator.NOT_IN_LIST_OF_VALUES), new FilterItem("B", FilterOperator.EQUAL)}, new[] {new FilterItem("A", FilterOperator.NOT_IN_LIST_OF_VALUES), new FilterItem("C", FilterOperator.EQUAL)}, }); } SendAssertEvents( env, new object[] {IntEvent(3, 1, 0), IntEvent(3, 0, 1), IntEvent(0, 1, 0)}, new object[] {IntEvent(2, 0, 0), IntEvent(1, 0, 0), IntEvent(3, 0, 0)} ); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var filters = new[] { "A like 'a%' and (B='b' or C='c')", }; foreach (var filter in filters) { var epl = "@Name('s0') select * from SupportBean_StringAlphabetic(" + filter + ")"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (SupportFilterOptimizableHelper.HasFilterIndexPlanBasic(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean_StringAlphabetic", new[] { new[] {new FilterItem("B", FilterOperator.EQUAL), FilterItem.BoolExprFilterItem}, new[] {new FilterItem("C", FilterOperator.EQUAL), FilterItem.BoolExprFilterItem}, }); } SendAssertEvents( env, new object[] {StringEvent("a1", "b", null), StringEvent("a1", null, "c")}, new object[] {StringEvent("x", "b", null), StringEvent("a1", null, null), StringEvent("a1", null, "x")} ); env.UndeployAll(); } }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select P00 from SupportBean_S0 as S0 where Id > " + "(select sum(IntPrimitive) from SupportBean#keepall where TheString = S0.P00)"; env.CompileDeployAddListenerMile(epl, "s0", 0); RunAssertionCorrAggWhereGreater(env); env.UndeployAll(); epl = "@Name('s0') select P00 from SupportBean_S0 as S0 where Id > " + "(select sum(IntPrimitive) from SupportBean#keepall where TheString||'X' = S0.P00||'X')"; env.CompileDeployAddListenerMile(epl, "s0", 1); RunAssertionCorrAggWhereGreater(env); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select irstream size from SupportMarketDataBean#size"; env.CompileDeployAddListenerMileZero(epl, "s0"); SendEventWithPrice(env, "DELL", price: 1L); AssertSize(env, 1, 0); SendEventWithPrice(env, "DELL", price: 1L); AssertSize(env, 2, 1); env.UndeployAll(); epl = "@Name('s0') select size, Symbol, Feed from SupportMarketDataBean#size(Symbol, Feed)"; env.CompileDeployAddListenerMile(epl, "s0", 1); var fields = new[] {"size", "Symbol", "Feed"}; SendEventWithPrice(env, "DELL", price: 1L); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] {1L, "DELL", "feed1"}); SendEventWithPrice(env, "DELL", price: 1L); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] {2L, "DELL", "feed1"}); env.UndeployAll(); }
private void RunVarargAssertion( RegressionEnvironment env, AtomicLong milestone, params UniformPair<string>[] pairs) { var buf = new StringBuilder(); buf.Append("@Name('test') select "); var count = 0; foreach (var pair in pairs) { buf.Append(pair.First); buf.Append(" as c"); buf.Append(Convert.ToString(count)); count++; buf.Append(","); } buf.Append("IntPrimitive from SupportBean"); env.CompileDeployAddListenerMile(buf.ToString(), "test", milestone.GetAndIncrement()); env.SendEventBean(new SupportBean()); var @out = env.Listener("test").AssertOneGetNewAndReset(); count = 0; foreach (var pair in pairs) { Assert.AreEqual(pair.Second, @out.Get("c" + count), "failed for '" + pair.First + "'"); count++; } env.UndeployAll(); }
private static void RunAssertionDateformatNonString( RegressionEnvironment env, AtomicLong milestone) { var sdt = SupportDateTime.Make("2002-05-30T09:00:00.000"); var sdfDate = sdt.DateTimeEx.DateTime.ToString("s"); var sdf = typeof(SimpleDateFormat).FullName; var epl = "@Name('s0') select " + $"cast('{sdfDate}',dtx,dateformat:{sdf}.GetInstance()) as c0," + $"cast('{sdfDate}',datetimeoffset,dateformat:{sdf}.GetInstance()) as c1," + $"cast('{sdfDate}',datetime,dateformat:{sdf}.GetInstance()) as c2," + $"cast('{sdfDate}',long,dateformat:{sdf}.GetInstance()) as c3" + " from SupportBean"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); env.SendEventBean(new SupportBean()); var @event = env.Listener("s0").AssertOneGetNewAndReset(); Assert.That(@event.Get("c0"), Is.EqualTo(sdt.DateTimeEx)); Assert.That(@event.Get("c1"), Is.EqualTo(sdt.DateTimeEx.DateTime)); Assert.That(@event.Get("c2"), Is.EqualTo(sdt.DateTimeEx.DateTime.DateTime)); Assert.That(@event.Get("c3"), Is.EqualTo(sdt.DateTimeEx.UtcMillis)); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Hint('MAX_FILTER_WIDTH=0') @name('s0') select * from SupportBean_IntAlphabetic((B=1 or C=1) and (D=1 or E=1))"; env.CompileDeployAddListenerMile(epl, "s0", 0); SupportFilterServiceHelper.AssertFilterSvcSingle(env.Statement("s0"), ".boolean_expression", FilterOperator.BOOLEAN_EXPRESSION); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select * from SupportBean(IntPrimitive in (1, 10))"; env.CompileDeployAddListenerMile(epl, "s0", 0); SendBeanInt(env, 10); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); SendBeanInt(env, 11); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); SendBeanInt(env, 1); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); // try enum collection with substitution param ISet<SupportEnum> types = new HashSet<SupportEnum>(); types.Add(SupportEnum.ENUM_VALUE_2); var collectionType = typeof(ICollection<SupportEnum>).CleanName(); var compiled = env.Compile( "@Name('s0') select * from SupportBean ev " + "where ev.EnumValue in (?::`" + collectionType + "`)"); env.Deploy( compiled, new DeploymentOptions().WithStatementSubstitutionParameter( prepared => prepared.SetObject(1, types))); env.AddListener("s0"); var theEvent = new SupportBean(); theEvent.EnumValue = SupportEnum.ENUM_VALUE_2; env.SendEventBean(theEvent); Assert.IsTrue(env.Listener("s0").IsInvoked); env.UndeployAll(); }
private static void TryNotInKeywordPattern( RegressionEnvironment env, string field, SupportInKeywordBean prototype, AtomicLong milestone) { var epl = "@Name('s0') select * from pattern[every a=SupportInKeywordBean -> SupportBean(IntPrimitive not in (a." + field + "))]"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); AssertInKeywordReceivedPattern(env, SerializableObjectCopier.CopyMayFail(env.Container, prototype), 0, true); AssertInKeywordReceivedPattern(env, SerializableObjectCopier.CopyMayFail(env.Container, prototype), 3, true); AssertInKeywordReceivedPattern(env, SerializableObjectCopier.CopyMayFail(env.Container, prototype), 1, false); if (HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcByTypeMulti( env.Statement("s0"), "SupportBean", new[] { new[] { new FilterItem("IntPrimitive", FilterOperator.NOT_IN_LIST_OF_VALUES) }, }); } env.UndeployAll(); }
public void Run(RegressionEnvironment env) { AtomicLong milestone = new AtomicLong(); // test equals BigDecimal var epl = "@Name('s0') select * from SupportBeanNumeric where DecimalOne = 1 or DecimalOne = IntOne or DecimalOne = DoubleOne"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); SendBigNumEvent(env, -1, 1m); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); SendBigNumEvent(env, -1, 2m); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(2, 0, null, 2m, 0, 0)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(3, 0, null, 2m, 0, 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(0, 0, null, 3m, 3d, 0)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(0, 0, null, 3.9999m, 4d, 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); // test equals BigInteger env.UndeployAll(); epl = "@Name('s0') select * from SupportBeanNumeric where DecimalOne = Bigint or Bigint = IntOne or Bigint = 1"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); env.SendEventBean(new SupportBeanNumeric(0, 0, new BigInteger(2), 2m, 0, 0)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(0, 0, new BigInteger(3), 2m, 0, 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(2, 0, new BigInteger(2), null, 0, 0)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(3, 0, new BigInteger(2), null, 0, 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(0, 0, BigInteger.One, null, 0, 0)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBeanNumeric(0, 0, new BigInteger(4), null, 0, 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var eplSingleIndex = "@Name('s0') select (select P00 from SupportBean_S0#keepall as S0 where S0.P01 in (S1.P10, S1.P11)) as c0 from SupportBean_S1 as S1"; env.CompileDeployAddListenerMile(eplSingleIndex, "s0", milestone.GetAndIncrement()); TryAssertionPerformanceInKeywordAsPartOfSubquery(env); env.UndeployAll(); var eplMultiIdx = "@Name('s0') select (select P00 from SupportBean_S0#keepall as S0 where S1.P11 in (S0.P00, S0.P01)) as c0 from SupportBean_S1 as S1"; env.CompileDeployAddListenerMile(eplMultiIdx, "s0", milestone.GetAndIncrement()); TryAssertionPerformanceInKeywordAsPartOfSubquery(env); env.UndeployAll(); }
private static void RunAssertionISO8601Date( RegressionEnvironment env, AtomicLong milestone) { var epl = "@Name('s0') select " + "cast('1997-07-16T19:20:30Z',dtx,dateformat:'iso') as c0," + "cast('1997-07-16T19:20:30+01:00',dtx,dateformat:'iso') as c1," + "cast('1997-07-16T19:20:30',dtx,dateformat:'iso') as c2," + "cast('1997-07-16T19:20:30.45Z',dtx,dateformat:'iso') as c3," + "cast('1997-07-16T19:20:30.45+01:00',dtx,dateformat:'iso') as c4," + "cast('1997-07-16T19:20:30.45',dtx,dateformat:'iso') as c5," + "cast('1997-07-16T19:20:30.45',long,dateformat:'iso') as c6," + "cast('1997-07-16T19:20:30.45',datetime,dateformat:'iso') as c7," + "cast(TheString,dtx,dateformat:'iso') as c8," + "cast(TheString,long,dateformat:'iso') as c9," + "cast(TheString,datetime,dateformat:'iso') as c10," + "cast('1997-07-16T19:20:30.45',datetimeoffset,dateformat:'iso') as c11," + "cast('1997-07-16T19:20:30+01:00',datetime,dateformat:'iso') as c12," + "cast('1997-07-16',datetimeoffset,dateformat:'iso') as c13," + "cast('19:20:30',datetimeoffset,dateformat:'iso') as c14" + " from SupportBean"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); env.SendEventBean(new SupportBean()); var @event = env.Listener("s0").AssertOneGetNewAndReset(); SupportDateTimeUtil.CompareDate((DateTimeEx)@event.Get("c0"), 1997, 7, 16, 19, 20, 30, 0, "UTC"); SupportDateTimeUtil.CompareDate((DateTimeEx)@event.Get("c1"), 1997, 7, 16, 19, 20, 30, 0, "GMT+01:00"); SupportDateTimeUtil.CompareDate((DateTimeEx)@event.Get("c2"), 1997, 7, 16, 19, 20, 30, 0, "UTC"); SupportDateTimeUtil.CompareDate((DateTimeEx)@event.Get("c3"), 1997, 7, 16, 19, 20, 30, 450, "UTC"); SupportDateTimeUtil.CompareDate((DateTimeEx)@event.Get("c4"), 1997, 7, 16, 19, 20, 30, 450, "GMT+01:00"); SupportDateTimeUtil.CompareDate((DateTimeEx)@event.Get("c5"), 1997, 7, 16, 19, 20, 30, 450, "UTC"); Assert.That(@event.Get("c6"), Is.InstanceOf <long>()); Assert.That(@event.Get("c7"), Is.InstanceOf <DateTime>()); foreach (var prop in "c8,c9,c10".SplitCsv()) { Assert.IsNull(@event.Get(prop)); } var isoDateTimeFormat = DateTimeFormat.ISO_DATE_TIME; var expectedC11 = isoDateTimeFormat.Parse("1997-07-16T19:20:30.45").DateTime; var expectedC12 = isoDateTimeFormat.Parse("1997-07-16T19:20:30+01:00").DateTime.DateTime; var expectedC13 = DateTimeParsingFunctions.ParseDefault("1997-07-16"); var expectedC14 = DateTimeParsingFunctions.ParseDefault("19:20:30"); Assert.That(@event.Get("c11"), Is.EqualTo(expectedC11)); Assert.That(@event.Get("c12"), Is.EqualTo(expectedC12)); Assert.That(@event.Get("c13"), Is.EqualTo(expectedC13)); Assert.That(@event.Get("c14"), Is.EqualTo(expectedC14)); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var fields = new [] { "val0", "val1", "val2", "val3" }; var eplFragment = "@Name('s0') select " + "LongDate.set('hour', 1).set('minute', 2).set('second', 3) as val0," + "DateTimeEx.set('hour', 1).set('minute', 2).set('second', 3) as val1," + "DateTimeOffset.set('hour', 1).set('minute', 2).set('second', 3) as val2," + "DateTime.set('hour', 1).set('minute', 2).set('second', 3) as val3" + " from SupportDateTime"; env.CompileDeploy(eplFragment).AddListener("s0"); LambdaAssertionUtil.AssertTypes( env.Statement("s0").EventType, fields, new[] { typeof(long?), typeof(DateTimeEx), typeof(DateTimeOffset?), typeof(DateTime?) }); var startTime = "2002-05-30T09:00:00.000"; var expectedTime = "2002-05-30T01:02:03.000"; env.SendEventBean(SupportDateTime.Make(startTime)); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fields, SupportDateTime.GetArrayCoerced(expectedTime, "long", "dtx", "dto", "date")); env.UndeployAll(); eplFragment = "@Name('s0') select " + "LongDate.set('hour', 1).set('minute', 2).set('second', 3).toDateTimeEx() as val0," + "DateTimeEx.set('hour', 1).set('minute', 2).set('second', 3).toDateTimeEx() as val1," + "DateTimeOffset.set('hour', 1).set('minute', 2).set('second', 3).toDateTimeEx() as val2," + "DateTime.set('hour', 1).set('minute', 2).set('second', 3).toDateTimeEx() as val3" + " from SupportDateTime"; env.CompileDeployAddListenerMile(eplFragment, "s0", 1); LambdaAssertionUtil.AssertTypes( env.Statement("s0").EventType, fields, new[] { typeof(DateTimeEx), typeof(DateTimeEx), typeof(DateTimeEx), typeof(DateTimeEx) }); env.SendEventBean(SupportDateTime.Make(startTime)); EPAssertionUtil.AssertProps( env.Listener("s0").AssertOneGetNewAndReset(), fields, SupportDateTime.GetArrayCoerced(expectedTime, "dtx", "dtx", "dtx", "dtx")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { // test fixed array case string[] fields; string epl; fields = "eall,eany,neall,neany,isin".SplitCsv(); epl = "@Name('s0') select " + "IntBoxed = all ({DoubleBoxed, LongBoxed}) as eall, " + "IntBoxed = any ({DoubleBoxed, LongBoxed}) as eany, " + "IntBoxed != all ({DoubleBoxed, LongBoxed}) as neall, " + "IntBoxed != any ({DoubleBoxed, LongBoxed}) as neany, " + "IntBoxed in ({DoubleBoxed, LongBoxed}) as isin " + " from SupportBean"; env.CompileDeploy(epl).AddListener("s0"); SendEvent(env, "E3", null, null, null); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, null, null, null, null); SendEvent(env, "E4", 1, null, null); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, null, null, null, null); SendEvent(env, "E5", null, null, 1L); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, null, null, null, null); SendEvent(env, "E6", 1, null, 1L); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, true, false, null, true); SendEvent(env, "E7", 0, null, 1L); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, false, null, null, true, null); env.UndeployAll(); // test non-array case fields = "eall,eany,neall,neany,isin".SplitCsv(); epl = "@Name('s0') select " + "IntBoxed = all (DoubleBoxed, LongBoxed) as eall, " + "IntBoxed = any (DoubleBoxed, LongBoxed) as eany, " + "IntBoxed != all (DoubleBoxed, LongBoxed) as neall, " + "IntBoxed != any (DoubleBoxed, LongBoxed) as neany, " + "IntBoxed in (DoubleBoxed, LongBoxed) as isin " + " from SupportBean"; env.CompileDeployAddListenerMile(epl, "s0", 1); SendEvent(env, "E3", null, null, null); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, null, null, null, null); SendEvent(env, "E4", 1, null, null); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, null, null, null, null); SendEvent(env, "E5", null, null, 1L); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, null, null, null, null); SendEvent(env, "E6", 1, null, 1L); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, null, true, false, null, true); SendEvent(env, "E7", 0, null, 1L); EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, false, null, null, true, null); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "create context MyContext initiated by SupportBean terminated after 24 hours;" + "@Name('s0') context MyContext select * from SupportBean(TheString='A' or IntPrimitive=1)"; env.CompileDeployAddListenerMile(epl, "s0", 0); env.SendEventBean(new SupportBean("A", 1)); env.Listener("s0").AssertOneGetNewAndReset(); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var epl = "@Name('s0') @Name('s0') select (" + "select sum(IntPrimitive) as sumi from SupportBean#keepall where TheString = st2.Key2 and IntPrimitive between S0.P01Long and S1.P11Long) " + "from SupportBean_ST2#lastevent st2, SupportBean_ST0#lastevent S0, SupportBean_ST1#lastevent S1"; TryAssertion3StreamKeyRangeCoercion(env, milestone, epl, true); epl = "@Name('s0') select (" + "select sum(IntPrimitive) as sumi from SupportBean#keepall where TheString = st2.Key2 and S1.P11Long >= IntPrimitive and S0.P01Long <= IntPrimitive) " + "from SupportBean_ST2#lastevent st2, SupportBean_ST0#lastevent S0, SupportBean_ST1#lastevent S1"; TryAssertion3StreamKeyRangeCoercion(env, milestone, epl, false); epl = "@Name('s0') select (" + "select sum(IntPrimitive) as sumi from SupportBean#keepall where TheString = st2.Key2 and S1.P11Long > IntPrimitive) " + "from SupportBean_ST2#lastevent st2, SupportBean_ST0#lastevent S0, SupportBean_ST1#lastevent S1"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); env.SendEventBean(new SupportBean("G", 21)); env.SendEventBean(new SupportBean("G", 13)); env.SendEventBean(new SupportBean_ST2("ST2", "G", 0)); env.SendEventBean(new SupportBean_ST0("ST0", -1L)); env.SendEventBean(new SupportBean_ST1("ST1", 20L)); Assert.AreEqual(13, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.UndeployAll(); epl = "@Name('s0') select (" + "select sum(IntPrimitive) as sumi from SupportBean#keepall where TheString = st2.Key2 and S1.P11Long < IntPrimitive) " + "from SupportBean_ST2#lastevent st2, SupportBean_ST0#lastevent S0, SupportBean_ST1#lastevent S1"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); env.SendEventBean(new SupportBean("G", 21)); env.SendEventBean(new SupportBean("G", 13)); env.SendEventBean(new SupportBean_ST2("ST2", "G", 0)); env.SendEventBean(new SupportBean_ST0("ST0", -1L)); env.SendEventBean(new SupportBean_ST1("ST1", 20L)); Assert.AreEqual(21, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { methodInvocationContextFilterOptimized = null; env.CompileDeployAddListenerMile("@Name('s0') select * from SupportBean e where myCustomOkFunction(e) = \"OK\"", "s0", 0); env.SendEventBean(new SupportBean()); Assert.AreEqual("default", methodInvocationContextFilterOptimized.RuntimeURI); Assert.AreEqual("myCustomOkFunction", methodInvocationContextFilterOptimized.FunctionName); Assert.IsNull(methodInvocationContextFilterOptimized.StatementUserObject); Assert.AreEqual(-1, methodInvocationContextFilterOptimized.ContextPartitionId); methodInvocationContextFilterOptimized = null; env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); // test 'or' rewrite var filtersAB = new[] { "TheString = 'a' or TheString = 'b'", "TheString = 'a' or 'b' = TheString", "'a' = TheString or 'b' = TheString", "'a' = TheString or TheString = 'b'", }; foreach (var filter in filtersAB) { var eplX = "@Name('s0') select * from SupportBean(" + filter + ")"; env.CompileDeployAddListenerMile(eplX, "s0", milestone.GetAndIncrement()); if (HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcSingle(env.Statement("s0"), "TheString", FilterOperator.IN_LIST_OF_VALUES); } env.SendEventBean(new SupportBean("a", 0)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBean("b", 0)); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBean("c", 0)); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); } var epl = "@Name('s0') select * from SupportBean(IntPrimitive = 1 and (TheString='a' or TheString='b'))"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); if (HasFilterIndexPlanBasicOrMore(env)) { SupportFilterServiceHelper.AssertFilterSvcTwo( env.Statement("s0"), "IntPrimitive", FilterOperator.EQUAL, "TheString", FilterOperator.IN_LIST_OF_VALUES); } env.UndeployAll(); }
public void Run(RegressionEnvironment env) { string epl; epl = "@Name('s0') select sp1.Id as myId from pattern[every sp1=SupportBean_S0(exists (select * from SupportBean_S1#keepall as stream1 where stream1.P10 = sp1.P00))]"; env.CompileDeployAddListenerMile(epl, "s0", 0); TryAssertionCorrelated(env); env.UndeployAll(); epl = "@Name('s0') select Id as myId from SupportBean_S0(exists (select stream1.Id from SupportBean_S1#keepall as stream1 where stream1.P10 = stream0.P00)) as stream0"; env.CompileDeployAddListenerMile(epl, "s0", 1); TryAssertionCorrelated(env); env.UndeployAll(); epl = "@Name('s0') select sp0.P00||'+'||sp1.P10 as myId from pattern[" + "every sp0=SupportBean_S0 -> sp1=SupportBean_S1(P11 = (select stream2.P21 from SupportBean_S2#keepall as stream2 where stream2.P20 = sp0.P00))]"; env.CompileDeployAddListenerMile(epl, "s0", 2); env.SendEventBean(new SupportBean_S2(21, "X", "A")); env.SendEventBean(new SupportBean_S2(22, "Y", "B")); env.SendEventBean(new SupportBean_S2(23, "Z", "C")); env.SendEventBean(new SupportBean_S0(1, "A")); env.SendEventBean(new SupportBean_S0(2, "Y")); env.SendEventBean(new SupportBean_S0(3, "C")); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportBean_S1(4, "B", "B")); Assert.AreEqual("Y+B", env.Listener("s0").AssertOneGetNewAndReset().Get("myId")); env.SendEventBean(new SupportBean_S1(4, "B", "C")); env.SendEventBean(new SupportBean_S1(5, "C", "B")); env.SendEventBean(new SupportBean_S1(6, "X", "A")); env.SendEventBean(new SupportBean_S1(7, "A", "C")); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); }
private static void TryAssertion3StreamKeyRangeCoercion( RegressionEnvironment env, AtomicLong milestone, string epl, bool isHasRangeReversal) { env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); env.SendEventBean(new SupportBean("G", -1)); env.SendEventBean(new SupportBean("G", 9)); env.SendEventBean(new SupportBean("G", 21)); env.SendEventBean(new SupportBean("G", 13)); env.SendEventBean(new SupportBean("G", 17)); env.SendEventBean(new SupportBean_ST2("ST21", "X", 0)); env.SendEventBean(new SupportBean_ST0("ST01", 10L)); env.SendEventBean(new SupportBean_ST1("ST11", 20L)); Assert.AreEqual(null, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); // range 10 to 20 env.SendEventBean(new SupportBean_ST2("ST22", "G", 0)); Assert.AreEqual(30, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST0("ST01", 0L)); // range 0 to 20 Assert.AreEqual(39, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST2("ST21", null, 0)); Assert.AreEqual(null, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST2("ST21", "G", 0)); Assert.AreEqual(39, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST1("ST11", 100L)); // range 0 to 100 Assert.AreEqual(60, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST1("ST11", null)); // range 0 to null Assert.AreEqual(null, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST0("ST01", null)); // range null to null Assert.AreEqual(null, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST1("ST11", -1L)); // range null to -1 Assert.AreEqual(null, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); env.SendEventBean(new SupportBean_ST0("ST01", 10L)); // range 10 to -1 if (isHasRangeReversal) { Assert.AreEqual(8, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); } else { Assert.AreEqual(null, env.Listener("s0").AssertOneGetNewAndReset().Get("sumi")); } env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select * from SupportOverrideBase(typeof(e) = 'SupportOverrideBase') as e"; env.CompileDeployAddListenerMile(epl, "s0", 0); env.SendEventBean(new SupportOverrideBase("")); Assert.IsTrue(env.Listener("s0").GetAndClearIsInvoked()); env.SendEventBean(new SupportOverrideOne("a", "b")); Assert.IsFalse(env.Listener("s0").GetAndClearIsInvoked()); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var milestone = new AtomicLong(); var epl = "@Name('s0') select (select * from SupportBean_IntAlphabetic(A=1 or B=1)#keepall) as c0 from SupportBean"; env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement()); var iaOne = IntEvent(1, 1); env.SendEventBean(iaOne); env.SendEventBean(new SupportBean()); Assert.AreEqual(iaOne, env.Listener("s0").AssertOneGetNewAndReset().Get("c0")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "create context MyContext partition by A from SupportBean_IntAlphabetic(B=1 or C=1);" + "@Name('s0') context MyContext select * from SupportBean_IntAlphabetic(D=1)"; env.CompileDeployAddListenerMile(epl, "s0", 0); SendAssertEvents( env, new object[] {IntEvent(100, 1, 0, 1), IntEvent(100, 0, 1, 1)}, new object[] {IntEvent(100, 0, 0, 1), IntEvent(100, 1, 0, 0)} ); env.UndeployAll(); }