Example #1
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var milestone = new AtomicLong();
                var ctx = "CategorizedContext";
                var eplCtx = "@Name('context') create context " +
                             ctx +
                             " as " +
                             "group IntPrimitive<10 as cat1 " +
                             "from SupportBean";
                env.CompileDeploy(eplCtx, path);

                var eplStmt =
                    "@Name('s0') context CategorizedContext select context.name as c0, context.label as c1, prior(1,IntPrimitive) as c2 from SupportBean";
                env.CompileDeploy(eplStmt, path).AddListener("s0");

                RunAssertion(env, ctx, milestone);

                // test SODA
                path.Clear();
                env.EplToModelCompileDeploy(eplCtx, path);
                env.EplToModelCompileDeploy(eplStmt, path);
                env.AddListener("s0");

                RunAssertion(env, ctx, milestone);
            }
Example #2
0
            public void Run(RegressionEnvironment env)
            {
                var stmtText = "@Name('s0') select var1C, var2C, Id from SupportBean_A";

                env.EplToModelCompileDeploy(stmtText).AddListener("s0");
                var fieldsSelect = new string[] { "var1C", "var2C", "Id" };

                SendSupportBean_A(env, "E1");
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fieldsSelect, new object[] { 10d, 11L, "E1" });
                var stmtTextSet = "@Name('set') on SupportBean set var1C=IntPrimitive, var2C=IntBoxed";

                env.EplToModelCompileDeploy(stmtTextSet).AddListener("set");
                var typeSet = env.Statement("set").EventType;

                Assert.AreEqual(typeof(double?), typeSet.GetPropertyType("var1C"));
                Assert.AreEqual(typeof(long?), typeSet.GetPropertyType("var2C"));
                Assert.AreEqual(typeof(IDictionary <string, object>), typeSet.UnderlyingType);
                var fieldsVar = new string[] { "var1C", "var2C" };

                EPAssertionUtil.AssertEqualsAnyOrder(fieldsVar, typeSet.PropertyNames);
                EPAssertionUtil.AssertPropsPerRow(env.GetEnumerator("set"), fieldsVar, new object[][] { new object[] { 10d, 11L } });
                SendSupportBean(env, "S1", 3, 4);
                EPAssertionUtil.AssertProps(env.Listener("set").AssertOneGetNewAndReset(), fieldsVar, new object[] { 3d, 4L });
                EPAssertionUtil.AssertPropsPerRow(env.GetEnumerator("set"), fieldsVar, new object[][] { new object[] { 3d, 4L } });
                SendSupportBean_A(env, "E2");
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fieldsSelect, new object[] { 3d, 4L, "E2" });
                env.UndeployModuleContaining("set");
                env.UndeployModuleContaining("s0");
            }
Example #3
0
            public void Run(RegressionEnvironment env)
            {
                env.AdvanceTime(0);
                var path = new RegressionPath();
                var contextExpr = "create context MyContext " +
                                  "as start @now end after 10 seconds";
                env.CompileDeploy(contextExpr, path);

                string[] fields = {"cnt"};
                var streamExpr = "@Name('s0') context MyContext " +
                                 "select count(*) as cnt from SupportBean output last when terminated";
                env.CompileDeploy(streamExpr, path).AddListener("s0");

                env.SendEventBean(new SupportBean("E1", 1));

                env.Milestone(0);

                env.SendEventBean(new SupportBean("E2", 2));
                env.AdvanceTime(8000);

                env.Milestone(1);

                env.SendEventBean(new SupportBean("E3", 3));
                env.AdvanceTime(10000);
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    new object[] {3L});

                env.Milestone(2);

                env.SendEventBean(new SupportBean("E4", 4));
                env.AdvanceTime(19999);
                Assert.IsFalse(env.Listener("s0").IsInvoked);
                env.AdvanceTime(20000);
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    new object[] {1L});

                env.Milestone(3);

                env.AdvanceTime(30000);
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    new object[] {0L});

                env.EplToModelCompileDeploy(streamExpr, path);

                env.UndeployAll();

                env.EplToModelCompileDeploy(contextExpr);
                env.UndeployAll();
            }
Example #4
0
            public void Run(RegressionEnvironment env)
            {
                // widen to long
                var path = new RegressionPath();
                var eplCreate = namedWindow
                    ? "create window MyInfraHBTW#keepall as (f1 long, f2 string)"
                    : "create table MyInfraHBTW as (f1 long primary key, f2 string primary key)";
                env.CompileDeploy(eplCreate, path);

                var eplInsert = "insert into MyInfraHBTW(f1, f2) select LongPrimitive, TheString from SupportBean";
                env.CompileDeploy(eplInsert, path);

                env.CompileDeploy("create index MyInfraHBTWIndex1 on MyInfraHBTW(f1 btree)", path);
                var fields = new [] { "f1","f2" };

                SendEventLong(env, "E1", 10L);
                var result = env.CompileExecuteFAF("select * from MyInfraHBTW where f1>9", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {10L, "E1"}});

                // SODA
                var epl = "create index IX1 on MyInfraHBTW(f1, f2 btree)";
                env.EplToModelCompileDeploy(epl, path);

                // SODA with unique
                var eplUnique = "create unique index IX2 on MyInfraHBTW(f1)";
                env.EplToModelCompileDeploy(eplUnique, path);

                // coerce to short
                var eplCreateTwo = namedWindow
                    ? "create window MyInfraHBTWTwo#keepall as (f1 short, f2 string)"
                    : "create table MyInfraHBTWTwo as (f1 short primary key, f2 string primary key)";
                env.CompileDeploy(eplCreateTwo, path);

                var eplInsertTwo =
                    "insert into MyInfraHBTWTwo(f1, f2) select ShortPrimitive, TheString from SupportBean";
                env.CompileDeploy(eplInsertTwo, path);
                env.CompileDeploy("create index MyInfraHBTWTwoIndex1 on MyInfraHBTWTwo(f1 btree)", path);

                SendEventShort(env, "E1", 2);

                result = env.CompileExecuteFAF("select * from MyInfraHBTWTwo where f1>=2", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {(short) 2, "E1"}});

                env.UndeployAll();
            }
            public void Run(RegressionEnvironment env)
            {
                var milestone = new AtomicLong();

                // try simple
                var epl =
                    "@Name('s0') select Name, Place, sum(Count), grouping(Name), grouping(Place), grouping_id(Name,Place) as gId " +
                    "from SupportCarEvent group by grouping sets((Name, Place), Name, Place, ())";
                env.CompileDeploy(epl).AddListener("s0");

                TryAssertionDocSampleCarEvent(env, milestone);
                env.UndeployAll();

                // try audit
                env.CompileDeploy("@Audit " + epl).AddListener("s0");
                TryAssertionDocSampleCarEvent(env, milestone);
                env.UndeployAll();

                // try model
                env.EplToModelCompileDeploy(epl).AddListener("s0");

                TryAssertionDocSampleCarEvent(env, milestone);

                env.UndeployAll();
            }
Example #6
0
            public void Run(RegressionEnvironment env)
            {
                var subexpr = "top.GetChildOne(\"abc\",10).GetChildTwo(\"append\")";
                var epl = "@Name('s0') select " + subexpr + " from SupportChainTop as top";
                env.CompileDeploy(epl).AddListener("s0");
                TryAssertionChainedParam(env, subexpr);
                env.UndeployAll();

                env.EplToModelCompileDeploy(epl).AddListener("s0");
                TryAssertionChainedParam(env, subexpr);
                env.UndeployAll();

                // test property hosts a method
                env.CompileDeploy(
                        "@Name('s0') select " +
                        "Inside.GetMyString() as val," +
                        "Inside.InsideTwo.GetMyOtherString() as val2 " +
                        "from SupportBeanStaticOuter")
                    .AddListener("s0");

                env.SendEventBean(new SupportBeanStaticOuter());
                var result = env.Listener("s0").AssertOneGetNewAndReset();
                Assert.AreEqual("hello", result.Get("val"));
                Assert.AreEqual("hello2", result.Get("val2"));
                env.UndeployAll();
            }
Example #7
0
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('s0') select cast(Item?,System.String) as t0 from SupportBeanDynRoot";

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

                Assert.AreEqual(typeof(string), env.Statement("s0").EventType.GetPropertyType("t0"));

                env.SendEventBean(new SupportBeanDynRoot(100));
                Assert.AreEqual("100", env.Listener("s0").AssertOneGetNewAndReset().Get("t0"));

                env.SendEventBean(new SupportBeanDynRoot((byte)2));
                Assert.AreEqual("2", env.Listener("s0").AssertOneGetNewAndReset().Get("t0"));

                env.SendEventBean(new SupportBeanDynRoot(77.7777));
                Assert.AreEqual("77.7777", env.Listener("s0").AssertOneGetNewAndReset().Get("t0"));

                env.SendEventBean(new SupportBeanDynRoot(6L));
                Assert.AreEqual("6", env.Listener("s0").AssertOneGetNewAndReset().Get("t0"));

                env.SendEventBean(new SupportBeanDynRoot(null));
                Assert.AreEqual(null, env.Listener("s0").AssertOneGetNewAndReset().Get("t0"));

                env.SendEventBean(new SupportBeanDynRoot("abc"));
                Assert.AreEqual("abc", env.Listener("s0").AssertOneGetNewAndReset().Get("t0"));

                env.UndeployAll();
            }
Example #8
0
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('s0') select " +
                          "case TheString" +
                          " when \"A\" then new{TheString=\"Q\",IntPrimitive,col2=TheString||\"A\"}" +
                          " when \"B\" then new{TheString,IntPrimitive=10,col2=TheString||\"B\"} " +
                          "end as val0 from SupportBean as sb";

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

                env.EplToModelCompileDeploy(epl).AddListener("s0");
                TryAssertionDefault(env);
                env.UndeployAll();

                // test to-expression string
                epl = "@Name('s0') select " +
                      "case TheString" +
                      " when \"A\" then new{TheString=\"Q\",IntPrimitive,col2=TheString||\"A\" }" +
                      " when \"B\" then new{TheString,IntPrimitive = 10,col2=TheString||\"B\" } " +
                      "end from SupportBean as sb";
                env.CompileDeploy(epl).AddListener("s0");
                Assert.AreEqual(
                    "case TheString when \"A\" then new{TheString=\"Q\",IntPrimitive,col2=TheString||\"A\"} when \"B\" then new{TheString,IntPrimitive=10,col2=TheString||\"B\"} end",
                    env.Statement("s0").EventType.PropertyNames[0]);
                env.UndeployAll();
            }
            public void Run(RegressionEnvironment env)
            {
                var fields  = "c0".SplitCsv();
                var treemap = new OrderedListDictionary <int, IList <SupportBean> >();

                var epl = "@Name('s0') select sorted(IntPrimitive).floorEvent(IntPrimitive-1) as c0 from SupportBean#length(3) as sb";

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

                MakeSendBean(env, treemap, "E1", 10);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { LessThanOrEqualToFirstEvent(treemap, 10 - 1) });

                MakeSendBean(env, treemap, "E2", 20);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { LessThanOrEqualToFirstEvent(treemap, 20 - 1) });

                env.Milestone(0);

                MakeSendBean(env, treemap, "E3", 15);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { LessThanOrEqualToFirstEvent(treemap, 15 - 1) });

                MakeSendBean(env, treemap, "E3", 17);
                EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields, new object[] { LessThanOrEqualToFirstEvent(treemap, 17 - 1) });

                env.UndeployAll();
            }
Example #10
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var stmtOrigText = "@Name('split') on SupportBean " +
                                   "insert into AStream2SP select * where IntPrimitive=1 " +
                                   "insert into BStream2SP select * where IntPrimitive=1 or IntPrimitive=2";
                env.CompileDeploy(stmtOrigText, path).AddListener("split");
                TryAssertion(env, path);
                path.Clear();

                // statement object model
                var model = new EPStatementObjectModel();
                model.Annotations = Collections.SingletonList(new AnnotationPart("Audit"));
                model.FromClause = FromClause.Create(FilterStream.Create("SupportBean"));
                model.InsertInto = InsertIntoClause.Create("AStream2SP");
                model.SelectClause = SelectClause.CreateWildcard();
                model.WhereClause = Expressions.Eq("IntPrimitive", 1);
                var clause = OnClause.CreateOnInsertSplitStream();
                model.OnExpr = clause;
                var item = OnInsertSplitStreamItem.Create(
                    InsertIntoClause.Create("BStream2SP"),
                    SelectClause.CreateWildcard(),
                    Expressions.Or(Expressions.Eq("IntPrimitive", 1), Expressions.Eq("IntPrimitive", 2)));
                clause.AddItem(item);
                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("split"));
                Assert.AreEqual(stmtOrigText, model.ToEPL());
                env.CompileDeploy(model, path).AddListener("split");
                TryAssertion(env, path);
                path.Clear();

                env.EplToModelCompileDeploy(stmtOrigText, path).AddListener("split");
                TryAssertion(env, path);
            }
Example #11
0
        private static void TryEnumeration(
            RegressionEnvironment env,
            string expression)
        {
            var epl = "@Name('s0') " + expression + " select callIt().countOf(v => v<6) as val0 from SupportBean";
            env.CompileDeploy(epl).AddListener("s0");
            Assert.AreEqual(typeof(int?), env.Statement("s0").EventType.GetPropertyType("val0"));

            env.SendEventBean(new SupportBean());
            EPAssertionUtil.AssertProps(
                env.Listener("s0").AssertOneGetNewAndReset(),
                new[] {"val0"},
                new object[] {2});

            env.UndeployAll();

            env.EplToModelCompileDeploy(epl).AddListener("s0");
            env.SendEventBean(new SupportBean());
            EPAssertionUtil.AssertProps(
                env.Listener("s0").AssertOneGetNewAndReset(),
                new[] {"val0"},
                new object[] {2});

            env.UndeployAll();
        }
Example #12
0
            public void Run(RegressionEnvironment env)
            {
                SendTimer(env, 0);
                var milestone = new AtomicLong();

                var epl = "@Name('s0') select rate(10) as myrate from SupportBean";
                env.CompileDeploy(epl).AddListener("s0");

                TryAssertion(env, milestone);

                env.UndeployAll();

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

                TryAssertion(env, milestone);

                env.UndeployAll();

                TryInvalidCompile(
                    env,
                    "select rate() from SupportBean",
                    "Failed to validate select-clause expression 'rate(*)': The rate aggregation function minimally requires a numeric constant or expression as a parameter. [select rate() from SupportBean]");
                TryInvalidCompile(
                    env,
                    "select rate(true) from SupportBean",
                    "Failed to validate select-clause expression 'rate(true)': The rate aggregation function requires a numeric constant or time period as the first parameter in the constant-value notation [select rate(true) from SupportBean]");
            }
Example #13
0
        public void Run(RegressionEnvironment env)
        {
            var milestone = new AtomicLong();

            var epl = "@Name('s0') select " +
                      "TheString, " +
                      "nth(IntPrimitive,0) as int1, " + // current
                      "nth(IntPrimitive,1) as int2 " + // one before
                      "from SupportBean#keepall group by TheString output last every 3 events order by TheString";
            env.CompileDeploy(epl).AddListener("s0");

            RunAssertion(env, milestone);

            env.MilestoneInc(milestone);
            env.UndeployAll();

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

            RunAssertion(env, milestone);

            env.UndeployAll();

            TryInvalidCompile(
                env,
                "select nth() from SupportBean",
                "Failed to validate select-clause expression 'nth(*)': The nth aggregation function requires two parameters, an expression returning aggregation values and a numeric index constant [select nth() from SupportBean]");
        }
Example #14
0
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                env.CompileDeploy("create variable int myrows = 2", path);
                env.CompileDeploy("create variable int myoffset = 1", path);
                env.CompileDeploy("on SupportBeanNumeric set myrows = IntOne, myoffset = IntTwo", path);

                string epl;

                epl = "@Name('s0') select * from SupportBean#length(5) output every 5 events limit myoffset, myrows";
                env.CompileDeploy(epl, path).AddListener("s0");
                TryAssertionVariable(env);
                env.UndeployModuleContaining("s0");

                env.SendEventBean(new SupportBeanNumeric(2, 1));

                epl =
                    "@Name('s0') select * from SupportBean#length(5) output every 5 events limit myrows offset myoffset";
                env.CompileDeploy(epl, path).AddListener("s0");
                TryAssertionVariable(env);
                env.UndeployModuleContaining("s0");

                env.SendEventBean(new SupportBeanNumeric(2, 1));

                env.EplToModelCompileDeploy(epl, path).AddListener("s0");
                TryAssertionVariable(env);

                env.UndeployAll();
            }
            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);

                env.EplToModelCompileDeploy("@Name('s0') select sortcol.floorEvent(Id) as c0 from SupportBean_S0, MyTable", path)
                .AddListener("s0");

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

                MakeSendBean(env, treemap, "E1", 10);
                MakeSendBean(env, treemap, "E2", 20);
                MakeSendBean(env, treemap, "E3", 30);

                env.Milestone(0);

                for (var i = 0; i < 40; i++)
                {
                    env.SendEventBean(new SupportBean_S0(i));
                    Assert.AreEqual(LessThanOrEqualToFirstEvent(treemap, i), env.Listener("s0").AssertOneGetNewAndReset().Get("c0"));
                }

                env.UndeployAll();
            }
Example #16
0
        private static void TryDatetime(
            RegressionEnvironment env,
            string dialect)
        {
            var dayOfWeek = (int) DayOfWeek.Thursday;
            var msecDate = DateTimeParsingFunctions.ParseDefaultMSec("2002-05-30T09:00:00.000");
            var expression = $"expression long {dialect}:callIt() [return {msecDate}]";
            var epl = $"@Name('s0') {expression} select callIt().getHourOfDay() as val0, callIt().getDayOfWeek() as val1 from SupportBean";
            env.CompileDeploy(epl).AddListener("s0");
            Assert.AreEqual(typeof(int?), env.Statement("s0").EventType.GetPropertyType("val0"));

            env.SendEventBean(new SupportBean());
            EPAssertionUtil.AssertProps(
                env.Listener("s0").AssertOneGetNewAndReset(),
                new[] {"val0", "val1"},
                new object[] {9, dayOfWeek});

            env.UndeployAll();

            env.EplToModelCompileDeploy(epl).AddListener("s0");
            env.SendEventBean(new SupportBean());
            EPAssertionUtil.AssertProps(
                env.Listener("s0").AssertOneGetNewAndReset(),
                new[] {"val0", "val1"},
                new object[] {9, dayOfWeek});

            env.UndeployAll();
        }
            public void Run(RegressionEnvironment env)
            {
                var context = SupportConditionHandlerFactory.FactoryContexts[0];
                Assert.AreEqual(env.RuntimeURI, context.RuntimeURI);
                var handler = SupportConditionHandlerFactory.LastHandler;

                var expression =
                    "@Name('s0') select a.Id as a, b.Id as b from pattern [every a=SupportBean_A -[2]> b=SupportBean_B]";
                env.CompileDeploy(expression).AddListener("s0");
                RunAssertionSingleMaxSimple(env, handler);
                env.UndeployAll();

                // test SODA
                env.EplToModelCompileDeploy(expression).AddListener("s0");
                RunAssertionSingleMaxSimple(env, handler);
                env.UndeployAll();

                // test variable
                var path = new RegressionPath();
                env.CompileDeploy("create variable int myvar=3", path);
                expression =
                    "@Name('s0') select a.Id as a, b.Id as b from pattern [every a=SupportBean_A -[myvar-1]> b=SupportBean_B]";
                env.CompileDeploy(expression, path).AddListener("s0");
                RunAssertionSingleMaxSimple(env, handler);

                env.UndeployAll();
            }
Example #18
0
 public void Run(RegressionEnvironment env)
 {
     var stmtText =
         "@Name('s0') select (select prior(0,Id) from SupportBean_S1#length(1000)) as IdS1 from SupportBean_S0";
     env.EplToModelCompileDeploy(stmtText).AddListener("s0");
     RunUnfilteredStreamPrior(env);
     env.UndeployAll();
 }
Example #19
0
 private static void AssertStmt(
     RegressionEnvironment env,
     RegressionPath path,
     string epl)
 {
     env.CompileDeploy("@Name('s0')" + epl, path).UndeployModuleContaining("s0");
     env.EplToModelCompileDeploy("@Name('s0') " + epl, path).UndeployModuleContaining("s0");
 }
Example #20
0
 public void Run(RegressionEnvironment env)
 {
     var patternText =
         "@Name('s0') select * from pattern [every a=SupportBeanComplexProps -> b=SupportBeanComplexProps(Indexed[0]=a.Indexed[0])]";
     env.EplToModelCompileDeploy(patternText).AddListener("s0");
     RunIndexedValueProp(env);
     env.UndeployAll();
 }
 public void Run(RegressionEnvironment env)
 {
     var epl = "@public @buseventtype " +
               "@XMLSchema(RootElementName='simpleEvent')" +
               " create xml schema MyEventCreateSchema as ()";
     var path = new RegressionPath();
     env.EplToModelCompileDeploy(epl, path);
     runAssertion(env, "MyEventCreateSchema", path);
 }
Example #22
0
            public void Run(RegressionEnvironment env)
            {
                var stmtText =
                    "@Name('s0') select Id in (select Id from SupportBean_S1#length(1000)) as value from SupportBean_S0";
                env.EplToModelCompileDeploy(stmtText).AddListener("s0");

                RunTestInSelect(env);

                env.UndeployAll();
            }
Example #23
0
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('s0') select * from " +
                          "SupportBean_S0#length(1000) as S0 " +
                          "left outer join SupportBean_S1#length(1000) as S1 on S0.P00 = S1.P10 " +
                          "left outer join SupportBean_S2#length(1000) as S2 on S0.P00 = S2.P20";
                env.EplToModelCompileDeploy(epl).AddListener("s0");

                TryAssertion(env);
            }
Example #24
0
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('s0') select exists(item?.IntBoxed) as t0 from SupportMarkerInterface";

                env.EplToModelCompileDeploy(epl).AddListener("s0").Milestone(0);

                AssertStringAndNull(env);

                env.UndeployAll();
            }
            public void Run(RegressionEnvironment env)
            {
                var text = "@Name('s0') select chainTop().ChainValue(12,IntPrimitive) as val from SupportBean";

                env.CompileDeploy(text).AddListener("s0");
                TryAssertionChainMethod(env);

                env.EplToModelCompileDeploy(text).AddListener("s0");
                TryAssertionChainMethod(env);
            }
Example #26
0
            public void Run(RegressionEnvironment env)
            {
                // every 15 minutes 8am to 5pm
                SendTimeEvent(env, 1, 17, 10, 0, 0);
                var expression =
                    "@Name('s0') select * from SupportMarketDataBean#lastevent output at (*/15, 8:17, *, *, *)";

                env.EplToModelCompileDeploy(expression).AddListener("s0");

                TryAssertionCrontab(env, 1);
            }
            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();
            }
            public void Run(RegressionEnvironment env)
            {
                var stmtText = "@Name('s0') select Symbol, Volume, TheString, IntPrimitive " +
                               "from SupportMarketDataBean unidirectional " +
                               "full outer join SupportBean#keepall on TheString = Symbol";
                env.EplToModelCompileDeploy(stmtText).AddListener("s0");

                TryFullOuterPassive2Stream(env);

                env.UndeployAll();
            }
Example #29
0
            public void Run(RegressionEnvironment env)
            {
                var bitWriter = typeof(BitWriter).CleanName();
                var statementText = $"@Name('s0') select {bitWriter}.Write(7) as value" + STREAM_MDB_LEN5;
                env.EplToModelCompileDeploy(statementText).AddListener("s0");

                SendEvent(env, "IBM", 10d, 4L);
                Assert.AreEqual(BitWriter.Write(7), env.Listener("s0").AssertOneGetNewAndReset().Get("value"));

                env.UndeployAll();
            }
Example #30
0
            public void Run(RegressionEnvironment env)
            {
                var epl = "@Name('s0') select coalesce(LongBoxed,IntBoxed,ShortBoxed) as result" +
                          " from SupportBean#length(1000)";

                env.EplToModelCompileDeploy(epl).AddListener("s0");
                Assert.AreEqual(typeof(long?), env.Statement("s0").EventType.GetPropertyType("result"));

                TryCoalesceLong(env);

                env.UndeployAll();
            }