Ejemplo n.º 1
0
        private static void TryAssertionWithRefTime(
            RegressionEnvironment env,
            string epl,
            AtomicLong milestone)
        {
            var fields = new[] {"Id"};
            env.CompileDeployAddListenerMile(epl, "s0", milestone.GetAndIncrement());

            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E1", "8:00:00.000"));
            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E2", "8:00:04.999"));
            Assert.IsFalse(env.Listener("s0").IsInvoked);

            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E3", "8:00:05.000"));
            EPAssertionUtil.AssertPropsPerRow(
                env.Listener("s0").AssertInvokedAndReset(),
                fields,
                new[] {new object[] {"E1"}, new object[] {"E2"}},
                null);

            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E4", "8:00:04.000"));
            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E5", "7:00:00.000"));
            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E6", "8:01:04.999"));
            Assert.IsFalse(env.Listener("s0").IsInvoked);

            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E7", "8:01:05.000"));
            EPAssertionUtil.AssertPropsPerRow(
                env.Listener("s0").AssertInvokedAndReset(),
                fields,
                new[] {new object[] {"E3"}, new object[] {"E4"}, new object[] {"E5"}, new object[] {"E6"}},
                new[] {new object[] {"E1"}, new object[] {"E2"}});

            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E8", "8:03:55.000"));
            EPAssertionUtil.AssertPropsPerRow(
                env.Listener("s0").AssertInvokedAndReset(),
                fields,
                new[] {new object[] {"E7"}},
                new[] {new object[] {"E3"}, new object[] {"E4"}, new object[] {"E5"}, new object[] {"E6"}});

            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E9", "0:00:00.000"));
            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E10", "8:04:04.999"));
            env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E11", "8:04:05.000"));
            EPAssertionUtil.AssertPropsPerRow(
                env.Listener("s0").AssertInvokedAndReset(),
                fields,
                new[] {new object[] {"E8"}, new object[] {"E9"}, new object[] {"E10"}},
                new[] {new object[] {"E7"}});

            env.UndeployAll();
        }
Ejemplo n.º 2
0
            public void Run(RegressionEnvironment env)
            {
                var fields = new[] {"Id"};
                var epl =
                    "@Name('s0') select irstream * from SupportEventIdWithTimestamp#ext_timed_batch(Mytimestamp, 1 minute)";
                env.CompileDeployAddListenerMileZero(epl, "s0");

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E1", "8:00:00.000"));
                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E2", "8:00:30.000"));

                env.Milestone(1);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E3", "8:00:59.999"));
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                env.Milestone(2);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E4", "8:01:00.000"));
                EPAssertionUtil.AssertPropsPerRow(
                    env.Listener("s0").AssertInvokedAndReset(),
                    fields,
                    new[] {new object[] {"E1"}, new object[] {"E2"}, new object[] {"E3"}},
                    null);

                env.Milestone(3);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E5", "8:01:02.000"));
                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E6", "8:01:05.000"));

                env.Milestone(4);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E7", "8:02:00.000"));
                EPAssertionUtil.AssertPropsPerRow(
                    env.Listener("s0").AssertInvokedAndReset(),
                    fields,
                    new[] {new object[] {"E4"}, new object[] {"E5"}, new object[] {"E6"}},
                    new[] {new object[] {"E1"}, new object[] {"E2"}, new object[] {"E3"}});

                env.Milestone(5);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E8", "8:03:59.000"));
                EPAssertionUtil.AssertPropsPerRow(
                    env.Listener("s0").AssertInvokedAndReset(),
                    fields,
                    new[] {new object[] {"E7"}},
                    new[] {new object[] {"E4"}, new object[] {"E5"}, new object[] {"E6"}});

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E9", "8:03:59.000"));
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                env.Milestone(6);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E10", "8:04:00.000"));
                EPAssertionUtil.AssertPropsPerRow(
                    env.Listener("s0").AssertInvokedAndReset(),
                    fields,
                    new[] {new object[] {"E8"}, new object[] {"E9"}},
                    new[] {new object[] {"E7"}});

                env.Milestone(7);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E11", "8:06:30.000"));
                EPAssertionUtil.AssertPropsPerRow(
                    env.Listener("s0").AssertInvokedAndReset(),
                    fields,
                    new[] {new object[] {"E10"}},
                    new[] {new object[] {"E8"}, new object[] {"E9"}});

                env.Milestone(8);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E12", "8:06:59.999"));
                Assert.IsFalse(env.Listener("s0").IsInvoked);

                env.Milestone(9);

                env.SendEventBean(SupportEventIdWithTimestamp.MakeTime("E13", "8:07:00.001"));
                EPAssertionUtil.AssertPropsPerRow(
                    env.Listener("s0").AssertInvokedAndReset(),
                    fields,
                    new[] {new object[] {"E11"}, new object[] {"E12"}},
                    new[] {new object[] {"E10"}});

                env.UndeployAll();
            }