public void Run(RegressionEnvironment env) { var epl = "create table MyTable(sortcol sorted(IntPrimitive) @type('SupportBean'));\n" + "into table MyTable select sorted(*) as sortcol from SupportBean;\n" + "@Name('s0') select " + "MyTable.sortcol.firstEvent() as fe," + "MyTable.sortcol.minBy() as minb," + "MyTable.sortcol.firstEvents() as fes," + "MyTable.sortcol.firstKey() as fk," + "MyTable.sortcol.lastEvent() as le," + "MyTable.sortcol.maxBy() as maxb," + "MyTable.sortcol.lastEvents() as les," + "MyTable.sortcol.lastKey() as lk" + " from SupportBean_S0"; env.CompileDeploy(epl).AddListener("s0"); AssertType(env, typeof(SupportBean), "fe,le,minb,maxb"); AssertType(env, typeof(SupportBean[]), "fes,les"); AssertType(env, typeof(int?), "fk,lk"); var treemap = new OrderedListDictionary <int, IList <SupportBean> >(); PrepareTestData(env, treemap); // 1, 1, 4, 6, 6, 8, 9 var treeMapFirst = treemap.First(); var treeMapLast = treemap.Last(); env.SendEventBean(new SupportBean_S0(-1)); var @event = env.Listener("s0").AssertOneGetNewAndReset(); Assert.AreEqual(FirstEvent <IList <SupportBean> >(treeMapFirst), @event.Get("fe")); Assert.AreEqual(FirstEvent <IList <SupportBean> >(treeMapFirst), @event.Get("minb")); EPAssertionUtil.AssertEqualsExactOrder(AllEvents <IList <SupportBean> >(treeMapFirst), (SupportBean[])@event.Get("fes")); Assert.AreEqual(treeMapFirst.Key, @event.Get("fk")); Assert.AreEqual(FirstEvent <IList <SupportBean> >(treeMapLast), @event.Get("le")); Assert.AreEqual(FirstEvent <IList <SupportBean> >(treeMapLast), @event.Get("maxb")); EPAssertionUtil.AssertEqualsExactOrder(AllEvents <IList <SupportBean> >(treeMapLast), (SupportBean[])@event.Get("les")); Assert.AreEqual(treeMapLast.Key, @event.Get("lk")); env.UndeployAll(); }
public void Run(RegressionEnvironment env) { var epl = "create table MyTable(sortcol sorted(IntPrimitive) @type('SupportBean'));\n" + "into table MyTable select sorted(*) as sortcol from SupportBean;\n" + "@Name('s0') select " + "MyTable.sortcol.firstEvent().TheString as feid," + "MyTable.sortcol.firstEvent().firstOf() as fefo," + "MyTable.sortcol.firstEvents().lastOf() as feslo," + "MyTable.sortcol.lastEvent().TheString() as leid," + "MyTable.sortcol.lastEvent().firstOf() as lefo," + "MyTable.sortcol.lastEvents().lastOf as leslo" + " from SupportBean_S0"; env.CompileDeploy(epl).AddListener("s0"); AssertType(env, typeof(string), "feid,leid"); AssertType(env, typeof(SupportBean), "fefo,feslo,lefo,leslo"); var treemap = new OrderedListDictionary <int, IList <SupportBean> >(); PrepareTestData(env, treemap); // 1, 1, 4, 6, 6, 8, 9 var treeMapFirst = treemap.First(); var treeMapLast = treemap.Last(); env.SendEventBean(new SupportBean_S0(-1)); var @event = env.Listener("s0").AssertOneGetNewAndReset(); Assert.AreEqual(FirstEventString <IList <SupportBean> >(treeMapFirst), @event.Get("feid")); Assert.AreEqual(FirstEvent <IList <SupportBean> >(treeMapFirst), @event.Get("fefo")); Assert.AreEqual(LastEvent <IList <SupportBean> >(treeMapFirst), @event.Get("feslo")); Assert.AreEqual(FirstEventString <IList <SupportBean> >(treeMapLast), @event.Get("leid")); Assert.AreEqual(FirstEvent <IList <SupportBean> >(treeMapLast), @event.Get("lefo")); Assert.AreEqual(LastEvent <IList <SupportBean> >(treeMapLast), @event.Get("leslo")); env.UndeployAll(); }