示例#1
0
        public void TestOutputCrontabAtOMCreate()
        {
            // every 15 minutes 8am to 5pm
            SendTimeEvent(1, 17, 10, 0, 0);
            var expression = "select * from MarketData.std:lastevent() output at (*/15, 8:17, *, *, *)";

            var model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            model.FromClause   = FromClause.Create(FilterStream.Create("MarketData").AddView("std", "lastevent"));
            var crontabParams = new Expression[] {
                Expressions.CrontabScheduleFrequency(15),
                Expressions.CrontabScheduleRange(8, 17),
                Expressions.CrontabScheduleWildcard(),
                Expressions.CrontabScheduleWildcard(),
                Expressions.CrontabScheduleWildcard()
            };

            model.OutputLimitClause = OutputLimitClause.CreateSchedule(crontabParams);

            var epl = model.ToEPL();

            Assert.AreEqual(expression, epl);
            var stmt = _epService.EPAdministrator.Create(model);

            stmt.AddListener(_listener);
            RunAssertionCrontab(1, stmt);
        }
示例#2
0
        private void RunAssertionOutputCrontabAtOMCreate(EPServiceProvider epService)
        {
            // every 15 minutes 8am to 5pm
            SendTimeEvent(epService, 1, 17, 10, 0, 0);
            string expression = "select * from MarketData#lastevent output at (*/15, 8:17, *, *, *)";

            var model = new EPStatementObjectModel();

            model.SelectClause = SelectClause.CreateWildcard();
            model.FromClause   = FromClause.Create(FilterStream.Create("MarketData")
                                                   .AddView("lastevent"));
            var crontabParams = new Expression[] {
                Expressions.CrontabScheduleFrequency(15),
                Expressions.CrontabScheduleRange(8, 17),
                Expressions.CrontabScheduleWildcard(),
                Expressions.CrontabScheduleWildcard(),
                Expressions.CrontabScheduleWildcard()
            };

            model.OutputLimitClause = OutputLimitClause.CreateSchedule(crontabParams);

            string epl = model.ToEPL();

            Assert.AreEqual(expression, epl);
            EPStatement stmt     = epService.EPAdministrator.Create(model);
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;
            TryAssertionCrontab(epService, 1, stmt, listener);
        }
示例#3
0
            public void Run(RegressionEnvironment env)
            {
                // every 15 minutes 8am to 5pm
                SendTimeEvent(env, 1, 17, 10, 0, 0);
                var expression = "select * from SupportMarketDataBean#lastevent output at (*/15, 8:17, *, *, *)";

                var model = new EPStatementObjectModel();
                model.SelectClause = SelectClause.CreateWildcard();
                model.FromClause = FromClause.Create(FilterStream.Create("SupportMarketDataBean").AddView("lastevent"));
                Expression[] crontabParams = {
                    Expressions.CrontabScheduleFrequency(15),
                    Expressions.CrontabScheduleRange(8, 17),
                    Expressions.CrontabScheduleWildcard(),
                    Expressions.CrontabScheduleWildcard(),
                    Expressions.CrontabScheduleWildcard()
                };
                model.OutputLimitClause = OutputLimitClause.CreateSchedule(crontabParams);

                var epl = model.ToEPL();
                Assert.AreEqual(expression, epl);

                model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("s0"));
                env.CompileDeploy(model).AddListener("s0");

                TryAssertionCrontab(env, 1);
            }
示例#4
0
        /// <summary>
        /// Limit the output of the query.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="esperQuery">The esper query.</param>
        /// <param name="scheduleParameters">the crontab schedule parameters</param>
        /// <returns>clause</returns>
        public static EsperQuery <T> OutputLimit <T>(this EsperQuery <T> esperQuery, client.soda.Expression[] scheduleParameters)
        {
            var parentObjectModel = esperQuery.ObjectModel;
            var deriveObjectModel = parentObjectModel.ShallowCopy();

            deriveObjectModel.OutputLimitClause = OutputLimitClause.CreateSchedule(scheduleParameters);
            return(new EsperQuery <T>(esperQuery.ServiceProvider, deriveObjectModel));
        }