コード例 #1
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var epl  = "create table MyTable(sortcol sorted(IntPrimitive) @type('SupportBean'));\n" +
                           "into table MyTable select sorted(*) as sortcol from SupportBean;\n";

                env.CompileDeploy(epl, path);

                var select = "@Name('s0') select " +
                             "MyTable.sortcol as sortedItself, " +
                             "MyTable.sortcol.ceilingEvent(Id) as ce, " +
                             "MyTable.sortcol.ceilingEvents(Id) as ces, " +
                             "MyTable.sortcol.ceilingKey(Id) as ck, " +
                             "MyTable.sortcol.floorEvent(Id) as fe, " +
                             "MyTable.sortcol.floorEvents(Id) as fes, " +
                             "MyTable.sortcol.floorKey(Id) as fk, " +
                             "MyTable.sortcol.higherEvent(Id) as he, " +
                             "MyTable.sortcol.higherEvents(Id) as hes, " +
                             "MyTable.sortcol.higherKey(Id) as hk, " +
                             "MyTable.sortcol.lowerEvent(Id) as le, " +
                             "MyTable.sortcol.lowerEvents(Id) as les, " +
                             "MyTable.sortcol.lowerKey(Id) as lk" +
                             " from SupportBean_S0";

                env.EplToModelCompileDeploy(select, path).AddListener("s0");

                AssertType(env, typeof(SupportBean), "ce,fe,he,le");
                AssertType(env, typeof(SupportBean[]), "ces,fes,hes,les");
                AssertType(env, typeof(int?), "ck,fk,hk,lk");

                var treemap = new OrderedListDictionary <int, IList <SupportBean> >();

                PrepareTestData(env, treemap);                 // 1, 1, 4, 6, 6, 8, 9

                for (var i = 0; i < 12; i++)
                {
                    env.SendEventBean(new SupportBean_S0(i));
                    var @event = env.Listener("s0").AssertOneGetNewAndReset();
                    Assert.AreEqual(FirstEvent(treemap.GreaterThanOrEqualTo(i)), @event.Get("ce"));
                    EPAssertionUtil.AssertEqualsExactOrder(AllEvents(treemap.GreaterThanOrEqualTo(i)), (SupportBean[])@event.Get("ces"));
                    Assert.AreEqual(treemap.GreaterThanOrEqualTo(i)?.Key, @event.Get("ck"));
                    Assert.AreEqual(FirstEvent(treemap.LessThanOrEqualTo(i)), @event.Get("fe"));
                    EPAssertionUtil.AssertEqualsExactOrder(AllEvents(treemap.LessThanOrEqualTo(i)), (SupportBean[])@event.Get("fes"));
                    Assert.AreEqual(treemap.LessThanOrEqualTo(i)?.Key, @event.Get("fk"));
                    Assert.AreEqual(FirstEvent(treemap.GreaterThan(i)), @event.Get("he"));
                    EPAssertionUtil.AssertEqualsExactOrder(AllEvents(treemap.GreaterThan(i)), (SupportBean[])@event.Get("hes"));
                    Assert.AreEqual(treemap.GreaterThan(i)?.Key, @event.Get("hk"));
                    Assert.AreEqual(FirstEvent(treemap.LessThan(i)), @event.Get("le"));
                    EPAssertionUtil.AssertEqualsExactOrder(AllEvents(treemap.LessThan(i)), (SupportBean[])@event.Get("les"));
                    Assert.AreEqual(treemap.LessThan(i)?.Key, @event.Get("lk"));
                }

                env.UndeployAll();
            }
コード例 #2
0
            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.ceilingEvent(Id).TheString as ceid," +
                          "MyTable.sortcol.ceilingEvent(Id).firstOf() as cefo," +
                          "MyTable.sortcol.ceilingEvents(Id).lastOf() as ceslo," +
                          "MyTable.sortcol.floorEvent(Id).TheString as feid," +
                          "MyTable.sortcol.floorEvent(Id).firstOf() as fefo," +
                          "MyTable.sortcol.floorEvents(Id).lastOf() as feslo," +
                          "MyTable.sortcol.higherEvent(Id).TheString as heid," +
                          "MyTable.sortcol.higherEvent(Id).firstOf() as hefo," +
                          "MyTable.sortcol.higherEvents(Id).lastOf() as heslo," +
                          "MyTable.sortcol.lowerEvent(Id).TheString as leid," +
                          "MyTable.sortcol.lowerEvent(Id).firstOf() as lefo," +
                          "MyTable.sortcol.lowerEvents(Id).lastOf() as leslo " +
                          " from SupportBean_S0";

                env.CompileDeploy(epl).AddListener("s0");

                AssertType(env, typeof(string), "ceid,feid,heid,leid");
                AssertType(env, typeof(SupportBean), "cefo,fefo,hefo,lefo,ceslo,feslo,heslo,leslo");

                var treemap = new OrderedListDictionary <int, IList <SupportBean> >();

                PrepareTestData(env, treemap);                 // 1, 1, 4, 6, 6, 8, 9

                for (var i = 0; i < 12; i++)
                {
                    env.SendEventBean(new SupportBean_S0(i));
                    var @event  = env.Listener("s0").AssertOneGetNewAndReset();
                    var message = "failed at " + i;
                    Assert.AreEqual(FirstEventString(treemap.GreaterThanOrEqualTo(i)), @event.Get("ceid"), message);
                    Assert.AreEqual(FirstEvent(treemap.GreaterThanOrEqualTo(i)), @event.Get("cefo"), message);
                    Assert.AreEqual(LastEvent(treemap.GreaterThanOrEqualTo(i)), @event.Get("ceslo"), message);
                    Assert.AreEqual(FirstEventString(treemap.LessThanOrEqualTo(i)), @event.Get("feid"), message);
                    Assert.AreEqual(FirstEvent(treemap.LessThanOrEqualTo(i)), @event.Get("fefo"), message);
                    Assert.AreEqual(LastEvent(treemap.LessThanOrEqualTo(i)), @event.Get("feslo"), message);
                    Assert.AreEqual(FirstEventString(treemap.GreaterThan(i)), @event.Get("heid"), message);
                    Assert.AreEqual(FirstEvent(treemap.GreaterThan(i)), @event.Get("hefo"), message);
                    Assert.AreEqual(LastEvent(treemap.GreaterThan(i)), @event.Get("heslo"), message);
                    Assert.AreEqual(FirstEventString(treemap.LessThan(i)), @event.Get("leid"), message);
                    Assert.AreEqual(FirstEvent(treemap.LessThan(i)), @event.Get("lefo"), message);
                    Assert.AreEqual(LastEvent(treemap.LessThan(i)), @event.Get("leslo"), message);
                }

                env.UndeployAll();
            }