コード例 #1
0
        private void TryAssertion(
            RegressionEnvironment env,
            AtomicLong currentTime,
            SupportOutputLimitOpt hint,
            int expected,
            string selectClause,
            string groupBy,
            string having,
            string outputKeyword,
            string orderBy)
        {
            var epl = hint.GetHint() +
                      "@Name('s0') select irstream " +
                      selectClause +
                      " " +
                      "from SupportBean#length(2) " +
                      (groupBy == null ? "" : groupBy + " ") +
                      (having == null ? "" : having + " ") +
                      "output " +
                      outputKeyword +
                      " every 1 seconds " +
                      (orderBy == null ? "" : orderBy);
            env.CompileDeploy(epl).AddListener("s0");

            for (var i = 0; i < 5; i++) {
                env.SendEventBean(new SupportBean("E" + i, i));
            }

            AssertResourcesOutputRate(env, expected);

            SendTime(env, currentTime.IncrementAndGet(1000));

            AssertResourcesOutputRate(env, 0);
            env.UndeployAll();
        }
コード例 #2
0
        private static void RunAssertionAfterWithOutputLast(
            RegressionEnvironment env,
            SupportOutputLimitOpt opt)
        {
            var epl = opt.GetHint() +
                      "@Name('s0') select sum(IntPrimitive) as thesum " +
                      "from SupportBean#keepall " +
                      "output after 4 events last every 2 events";
            env.CompileDeploy(epl).AddListener("s0");

            env.SendEventBean(new SupportBean("E1", 10));
            env.SendEventBean(new SupportBean("E2", 20));

            env.Milestone(0);

            env.SendEventBean(new SupportBean("E3", 30));
            env.SendEventBean(new SupportBean("E4", 40));

            env.Milestone(1);

            env.SendEventBean(new SupportBean("E5", 50));
            Assert.IsFalse(env.Listener("s0").IsInvoked);

            env.SendEventBean(new SupportBean("E6", 60));
            EPAssertionUtil.AssertProps(
                env.Listener("s0").AssertOneGetNewAndReset(),
                new [] { "thesum" },
                new object[] {210});

            env.UndeployAll();
        }
コード例 #3
0
 public static string GetEPL(
     bool join,
     bool irstream,
     SupportOutputLimitOpt opt,
     string eplNonJoin,
     string eplJoin)
 {
     return opt.GetHint() + GetEPL(join, irstream, eplNonJoin, eplJoin);
 }
コード例 #4
0
 private static void RunAssertion9AllNoHavingNoJoin(
     RegressionEnvironment env,
     SupportOutputLimitOpt opt)
 {
     var stmtText = opt.GetHint() +
                    "@Name('s0') select sum(Price) " +
                    "from SupportMarketDataBean#time(5.5 sec) " +
                    "output all every 1 seconds";
     TryAssertion56(env, stmtText, "all");
 }
コード例 #5
0
 private static void RunAssertion15LastHavingNoJoin(
     RegressionEnvironment env,
     SupportOutputLimitOpt opt)
 {
     var stmtText = opt.GetHint() +
                    "@Name('s0') select sum(Price) " +
                    "from SupportMarketDataBean#time(5.5 sec)" +
                    "having sum(Price) > 100 " +
                    "output last every 1 seconds";
     TryAssertion15_16(env, stmtText, "last");
 }
コード例 #6
0
 private static void RunAssertion14LastNoHavingJoin(
     RegressionEnvironment env,
     SupportOutputLimitOpt opt)
 {
     var stmtText = opt.GetHint() +
                    "@Name('s0') select sum(Price) " +
                    "from SupportMarketDataBean#time(5.5 sec), " +
                    "SupportBean#keepall where TheString=Symbol " +
                    "output last every 1 seconds";
     TryAssertion13_14(env, stmtText, "last");
 }
コード例 #7
0
        public static string GetHint(this SupportOutputLimitOpt value)
        {
            switch (value) {
                case SupportOutputLimitOpt.DEFAULT:
                    return "";

                case SupportOutputLimitOpt.ENABLED:
                    return "@Hint('" + HintEnum.ENABLE_OUTPUTLIMIT_OPT.GetValue() + "')";

                case SupportOutputLimitOpt.DISABLED:
                    return "@Hint('" + HintEnum.DISABLE_OUTPUTLIMIT_OPT.GetValue() + "')";

                default:
                    throw new ArgumentException(nameof(value));
            }
        }
コード例 #8
0
        private static void TryAssertionOuputLastWithInsertInto(
            RegressionEnvironment env,
            SupportOutputLimitOpt opt)
        {
            var epl = opt.GetHint() +
                      "insert into MyStream select sum(IntPrimitive) as thesum from SupportBean#keepall " +
                      "output last every 2 events;\n" +
                      "@Name('s0') select * from MyStream;\n";
            env.CompileDeploy(epl).AddListener("s0");

            env.SendEventBean(new SupportBean("E1", 10));
            env.SendEventBean(new SupportBean("E2", 20));
            EPAssertionUtil.AssertProps(
                env.Listener("s0").AssertOneGetNewAndReset(),
                new [] { "thesum" },
                new object[] {30});

            env.UndeployAll();
        }