private void TryAssertionTargetCurrentMatch(EPServiceProvider epService, bool testSoda, TargetEnum target)
        {
            var listener = new SupportUpdateListener();
            var fields   = "a1.id,aarr[0].id,b.id".Split(',');
            var epl      = "select * from pattern " + target.GetText() + "[every a1=A -> [:10] aarr=A until b=B]";

            if (testSoda)
            {
                var model = epService.EPAdministrator.CompileEPL(epl);
                Assert.AreEqual(epl, model.ToEPL());
                epService.EPAdministrator.Create(model).Events += listener.Update;
            }
            else
            {
                epService.EPAdministrator.CreateEPL(epl).Events += listener.Update;
            }

            SendAEvent(epService, "A1");
            SendAEvent(epService, "A2");
            SendBEvent(epService, "B1");

            if (target == TargetEnum.SUPPRESS_ONLY || target == TargetEnum.DISCARD_AND_SUPPRESS)
            {
                EPAssertionUtil.AssertProps(
                    listener.AssertOneGetNewAndReset(), fields, new object[] { "A1", "A2", "B1" });
            }
            else
            {
                EPAssertionUtil.AssertPropsPerRowAnyOrder(
                    listener.GetAndResetLastNewData(), fields,
                    new object[][] { new object[] { "A1", "A2", "B1" }, new object[] { "A2", null, "B1" } });
            }

            epService.EPAdministrator.DestroyAllStatements();
        }
Exemplo n.º 2
0
        private void RunAssertionTargetNextMatch(bool testSoda, TargetEnum target)
        {
            var fields = "a.id,b.id,c.id".Split(',');
            var epl    = "select * from pattern " + target.GetText() + "[every a=A -> b=B -> c=C(pc=a.pa)]";

            if (testSoda)
            {
                var model = _epService.EPAdministrator.CompileEPL(epl);
                Assert.AreEqual(epl, model.ToEPL());
                _epService.EPAdministrator.Create(model).Events += _listener.Update;
            }
            else
            {
                _epService.EPAdministrator.CreateEPL(epl).Events += _listener.Update;
            }

            SendAEvent("A1", "x");
            SendAEvent("A2", "y");
            SendBEvent("B1");
            SendCEvent("C1", "y");
            EPAssertionUtil.AssertProps(
                _listener.AssertOneGetNewAndReset(), fields, new Object[]
            {
                "A2",
                "B1",
                "C1"
            });

            SendCEvent("C2", "x");
            if (target == TargetEnum.SUPPRESS_ONLY || target == TargetEnum.NONE)
            {
                EPAssertionUtil.AssertProps(
                    _listener.AssertOneGetNewAndReset(), fields, new Object[]
                {
                    "A1",
                    "B1",
                    "C2"
                });
            }
            else
            {
                Assert.IsFalse(_listener.IsInvoked);
            }

            _epService.EPAdministrator.DestroyAllStatements();
        }