Beispiel #1
0
        private void TryAssertionOutputSnapshotGetValue(EPServiceProvider epService, bool join)
        {
            EPStatement stmt = epService.EPAdministrator.CreateEPL(
                "select Customagg(IntPrimitive) as c0 from SupportBean" +
                (join ? "#keepall, SupportBean_S0#lastevent" : "") +
                " output snapshot every 3 events");
            var listener = new SupportUpdateListener();

            stmt.Events += listener.Update;
            epService.EPRuntime.SendEvent(new SupportBean_S0(1));

            MyContextAggFunc.ResetGetValueInvocationCount();

            epService.EPRuntime.SendEvent(new SupportBean("E1", 10));
            epService.EPRuntime.SendEvent(new SupportBean("E2", 20));
            Assert.AreEqual(0, MyContextAggFunc.GetValueInvocationCount);

            epService.EPRuntime.SendEvent(new SupportBean("E3", 30));
            Assert.AreEqual(60, listener.AssertOneGetNewAndReset().Get("c0"));
            Assert.AreEqual(1, MyContextAggFunc.GetValueInvocationCount);

            epService.EPRuntime.SendEvent(new SupportBean("E3", 40));
            epService.EPRuntime.SendEvent(new SupportBean("E4", 50));
            epService.EPRuntime.SendEvent(new SupportBean("E5", 60));
            Assert.AreEqual(210, listener.AssertOneGetNewAndReset().Get("c0"));
            Assert.AreEqual(2, MyContextAggFunc.GetValueInvocationCount);

            stmt.Dispose();
        }
Beispiel #2
0
        private void RunAssertionOutputSnapshotGetValue(bool join)
        {
            var stmt = _epService.EPAdministrator.CreateEPL(
                "select customagg(IntPrimitive) as c0 from SupportBean" +
                (join ? ".win:keepall(), SupportBean_S0.std:lastevent()" : "") +
                " output snapshot every 3 events");

            stmt.AddListener(_listener);
            _epService.EPRuntime.SendEvent(new SupportBean_S0(1));

            MyContextAggFunc.ResetGetValueInvocationCount();

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 10));
            _epService.EPRuntime.SendEvent(new SupportBean("E2", 20));
            Assert.AreEqual(0, MyContextAggFunc.GetValueInvocationCount);

            _epService.EPRuntime.SendEvent(new SupportBean("E3", 30));
            Assert.AreEqual(60, _listener.AssertOneGetNewAndReset().Get("c0"));
            Assert.AreEqual(1, MyContextAggFunc.GetValueInvocationCount);

            _epService.EPRuntime.SendEvent(new SupportBean("E3", 40));
            _epService.EPRuntime.SendEvent(new SupportBean("E4", 50));
            _epService.EPRuntime.SendEvent(new SupportBean("E5", 60));
            Assert.AreEqual(210, _listener.AssertOneGetNewAndReset().Get("c0"));
            Assert.AreEqual(2, MyContextAggFunc.GetValueInvocationCount);

            stmt.Dispose();
        }