예제 #1
0
        private void RunAssertionExtBatchedNoReference(EPServiceProvider epService)
        {
            string[]    fields   = "id".Split(',');
            EPStatement stmt     = epService.EPAdministrator.CreateEPL("select irstream * from MyEvent#ext_timed_batch(mytimestamp, 1 minute)");
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E1", "8:00:00.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E2", "8:00:30.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E3", "8:00:59.999"));
            Assert.IsFalse(listener.IsInvoked);

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E4", "8:01:00.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E1" }, new object[] { "E2" }, new object[] { "E3" } }, (object[][])null);

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E5", "8:01:02.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E6", "8:01:05.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E7", "8:02:00.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E4" }, new object[] { "E5" }, new object[] { "E6" } }, new object[][] { new object[] { "E1" }, new object[] { "E2" }, new object[] { "E3" } });

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E8", "8:03:59.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E7" } }, new object[][] { new object[] { "E4" }, new object[] { "E5" }, new object[] { "E6" } });

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E9", "8:03:59.000"));
            Assert.IsFalse(listener.IsInvoked);

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E10", "8:04:00.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E8" }, new object[] { "E9" } }, new object[][] { new object[] { "E7" } });

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E11", "8:06:30.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E10" } }, new object[][] { new object[] { "E8" }, new object[] { "E9" } });

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E12", "8:06:59.999"));
            Assert.IsFalse(listener.IsInvoked);

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E13", "8:07:00.001"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E11" }, new object[] { "E12" } }, new object[][] { new object[] { "E10" } });

            stmt.Dispose();
        }
예제 #2
0
        private void TryAssertionWithRefTime(EPServiceProvider epService, string epl)
        {
            string[]    fields   = "id".Split(',');
            EPStatement stmt     = epService.EPAdministrator.CreateEPL(epl);
            var         listener = new SupportUpdateListener();

            stmt.Events += listener.Update;

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E1", "8:00:00.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E2", "8:00:04.999"));
            Assert.IsFalse(listener.IsInvoked);

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E3", "8:00:05.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E1" }, new object[] { "E2" } }, null);

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E4", "8:00:04.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E5", "7:00:00.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E6", "8:01:04.999"));
            Assert.IsFalse(listener.IsInvoked);

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E7", "8:01:05.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E3" }, new object[] { "E4" }, new object[] { "E5" }, new object[] { "E6" } }, new object[][] { new object[] { "E1" }, new object[] { "E2" } });

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E8", "8:03:55.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E7" } }, new object[][] { new object[] { "E3" }, new object[] { "E4" }, new object[] { "E5" }, new object[] { "E6" } });

            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E9", "0:00:00.000"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E10", "8:04:04.999"));
            epService.EPRuntime.SendEvent(MyEvent.MakeTime("E11", "8:04:05.000"));
            EPAssertionUtil.AssertPropsPerRow(listener.AssertInvokedAndReset(), fields,
                                              new object[][] { new object[] { "E8" }, new object[] { "E9" }, new object[] { "E10" } }, new object[][] { new object[] { "E7" } });

            stmt.Dispose();
        }
예제 #3
0
        private void RunAssertionWithRefTime(String epl)
        {
            String[]    fields = "id".Split(',');
            EPStatement stmt   = _epService.EPAdministrator.CreateEPL(epl);

            stmt.Events += _listener.Update;

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E1", "08:00:00.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E2", "08:00:04.999"));
            Assert.IsFalse(_listener.IsInvoked);

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E3", "08:00:05.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[]
                {
                    "E1"
                }, new Object[]
                {
                    "E2"
                }
            }, null);

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E4", "08:00:04.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E5", "07:00:00.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E6", "08:01:04.999"));
            Assert.IsFalse(_listener.IsInvoked);

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E7", "08:01:05.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E3" },
                new Object[] { "E4" },
                new Object[] { "E5" },
                new Object[] { "E6" }
            },
                new Object[][]
            {
                new Object[] { "E1" },
                new Object[] { "E2" }
            });

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E8", "08:03:55.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E7" }
            },
                new Object[][]
            {
                new Object[] { "E3" },
                new Object[] { "E4" },
                new Object[] { "E5" },
                new Object[] { "E6" }
            });

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E9", "00:00:00.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E10", "08:04:04.999"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E11", "08:04:05.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E8" },
                new Object[] { "E9" },
                new Object[] { "E10" }
            },
                new Object[][]
            {
                new Object[] { "E7" }
            });

            stmt.Dispose();
        }
예제 #4
0
        public void TestExtBatchedNoReference()
        {
            String[]    fields = "id".Split(',');
            EPStatement stmt   =
                _epService.EPAdministrator.CreateEPL(
                    "select irstream * from MyEvent.win:ext_timed_batch(mytimestamp, 1 minute)");

            stmt.Events += _listener.Update;

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E1", "08:00:00.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E2", "08:00:30.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E3", "08:00:59.999"));
            Assert.IsFalse(_listener.IsInvoked);

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E4", "08:01:00.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E1" },
                new Object[] { "E2" },
                new Object[] { "E3" }
            }, null);

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E5", "08:01:02.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E6", "08:01:05.000"));
            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E7", "08:02:00.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E4" },
                new Object[] { "E5" },
                new Object[] { "E6" }
            },
                new Object[][]
            {
                new Object[] { "E1" },
                new Object[] { "E2" },
                new Object[] { "E3" }
            });

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E8", "08:03:59.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E7" }
            },
                new Object[][]
            {
                new Object[] { "E4" },
                new Object[] { "E5" },
                new Object[] { "E6" }
            });

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E9", "08:03:59.000"));
            Assert.IsFalse(_listener.IsInvoked);

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E10", "08:04:00.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E8" },
                new Object[] { "E9" }
            },
                new Object[][]
            {
                new Object[] { "E7" }
            });

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E11", "08:06:30.000"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E10" }
            },
                new Object[][]
            {
                new Object[] { "E8" },
                new Object[] { "E9" }
            });

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E12", "08:06:59.999"));
            Assert.IsFalse(_listener.IsInvoked);

            _epService.EPRuntime.SendEvent(MyEvent.MakeTime("E13", "08:07:00.001"));
            EPAssertionUtil.AssertPropsPerRow(
                _listener.AssertInvokedAndReset(), fields,
                new Object[][]
            {
                new Object[] { "E11" },
                new Object[] { "E12" }
            },
                new Object[][]
            {
                new Object[] { "E10" }
            });
        }