Esempio n. 1
0
        private void RunAssertionSubscriberOnly(EPServiceProvider epService)
        {
            var subscriber = new SupportSubscriberMRD();

            SendTimer(epService, 0);
            EPStatement stmt = epService.EPAdministrator.CreateEPL("select irstream TheString,IntPrimitive from SupportBean#time_batch(1) for discrete_delivery");

            stmt.Subscriber = subscriber;

            epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            epService.EPRuntime.SendEvent(new SupportBean("E3", 1));
            SendTimer(epService, 1000);
            Assert.AreEqual(3, subscriber.InsertStreamList.Count);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E1", 1 }, subscriber.InsertStreamList[0][0]);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E2", 2 }, subscriber.InsertStreamList[1][0]);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E3", 1 }, subscriber.InsertStreamList[2][0]);

            stmt.Dispose();
            subscriber.Reset();
            stmt            = epService.EPAdministrator.CreateEPL("select irstream TheString,IntPrimitive from SupportBean#time_batch(1) for grouped_delivery(IntPrimitive)");
            stmt.Subscriber = subscriber;

            epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            epService.EPRuntime.SendEvent(new SupportBean("E3", 1));
            SendTimer(epService, 2000);
            Assert.AreEqual(2, subscriber.InsertStreamList.Count);
            Assert.AreEqual(2, subscriber.RemoveStreamList.Count);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E1", 1 }, subscriber.InsertStreamList[0][0]);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E3", 1 }, subscriber.InsertStreamList[0][1]);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E2", 2 }, subscriber.InsertStreamList[1][0]);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E1", 1 }, subscriber.RemoveStreamList[0][0]);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E3", 1 }, subscriber.RemoveStreamList[0][1]);
            EPAssertionUtil.AssertEqualsExactOrder(new object[] { "E2", 2 }, subscriber.RemoveStreamList[1][0]);

            stmt.Dispose();
        }
Esempio n. 2
0
            public void Run(RegressionEnvironment env)
            {
                SupportSubscriberMRD subscriber = new SupportSubscriberMRD();
                SendTimer(env, 0);
                env.CompileDeploy("@Name('s0') select irstream TheString,IntPrimitive from SupportBean#time_batch(1) for discrete_delivery");
                env.Statement("s0").Subscriber = subscriber;

                env.SendEventBean(new SupportBean("E1", 1));
                env.SendEventBean(new SupportBean("E2", 2));
                env.SendEventBean(new SupportBean("E3", 1));
                SendTimer(env, 1000);
                Assert.AreEqual(3, subscriber.InsertStreamList.Count);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E1", 1}, subscriber.InsertStreamList[0][0]);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E2", 2}, subscriber.InsertStreamList[1][0]);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E3", 1}, subscriber.InsertStreamList[2][0]);

                env.UndeployAll();
                subscriber.Reset();
                env.CompileDeploy("@Name('s0') select irstream TheString,IntPrimitive from SupportBean#time_batch(1) for grouped_delivery(IntPrimitive)");
                env.Statement("s0").Subscriber = subscriber;

                env.SendEventBean(new SupportBean("E1", 1));
                env.SendEventBean(new SupportBean("E2", 2));
                env.SendEventBean(new SupportBean("E3", 1));
                SendTimer(env, 2000);
                Assert.AreEqual(2, subscriber.InsertStreamList.Count);
                Assert.AreEqual(2, subscriber.RemoveStreamList.Count);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E1", 1}, subscriber.InsertStreamList[0][0]);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E3", 1}, subscriber.InsertStreamList[0][1]);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E2", 2}, subscriber.InsertStreamList[1][0]);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E1", 1}, subscriber.RemoveStreamList[0][0]);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E3", 1}, subscriber.RemoveStreamList[0][1]);
                EPAssertionUtil.AssertEqualsExactOrder(new object[] {"E2", 2}, subscriber.RemoveStreamList[1][0]);

                env.UndeployAll();
            }