Esempio n. 1
0
        public void RunAssertionSplitPremptiveNamedWindow(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema TypeTwo(col2 int)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema TypeTrigger(trigger int)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window WinTwo.win:keepall() as TypeTwo");

            var stmtOrigText = "on TypeTrigger " +
                               "insert into OtherStream select 1 " +
                               "insert into WinTwo(col2) select 2 " +
                               "output all";

            _epService.EPAdministrator.CreateEPL(stmtOrigText);

            var stmt = _epService.EPAdministrator.CreateEPL("on OtherStream select col2 from WinTwo");

            stmt.Events += _listener.Update;

            // populate WinOne
            _epService.EPRuntime.SendEvent(new SupportBean("E1", 2));

            // fire trigger
            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.GetEventSender("TypeTrigger").SendEvent(new Object[] { null });
            }
            else
            {
                _epService.EPRuntime.GetEventSender("TypeTrigger").SendEvent(new DataMapImpl());
            }

            Assert.AreEqual(2, _listener.AssertOneGetNewAndReset().Get("col2"));

            _epService.Initialize();
        }
Esempio n. 2
0
        public void RunAssertionEventTypeColumnDef(EventRepresentationEnum eventRepresentationEnum)
        {
            var stmtSchema = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema SchemaOne(col1 int, col2 int)");

            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmtSchema.EventType.UnderlyingType);

            var stmt = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window SchemaWindow.std:lastevent() as (s1 SchemaOne)");

            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmt.EventType.UnderlyingType);

            stmt.AddListener(_listenerWindow);
            _epService.EPAdministrator.CreateEPL("insert into SchemaWindow (s1) select sone from SchemaOne as sone");

            IDictionary <String, object> theEvent = new LinkedHashMap <string, object>();

            theEvent.Put("col1", 10);
            theEvent.Put("col2", 11);
            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(theEvent.Values.ToArray(), "SchemaOne");
            }
            else
            {
                _epService.EPRuntime.SendEvent(theEvent, "SchemaOne");
            }
            EPAssertionUtil.AssertProps(_listenerWindow.AssertOneGetNewAndReset(), "s1.col1,s1.col2".Split(','), new object[] { 10, 11 });

            _epService.EPAdministrator.DestroyAllStatements();
            _epService.EPAdministrator.Configuration.RemoveEventType("SchemaOne", true);
            _epService.EPAdministrator.Configuration.RemoveEventType("SchemaWindow", true);
        }
Esempio n. 3
0
        public void RunAssertionCreateSchemaModelAfter(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema EventTypeOne (hsi int)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema EventTypeTwo (event EventTypeOne)");
            var stmt = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window NamedWindow.std:unique(event.hsi) as EventTypeTwo");

            _epService.EPAdministrator.CreateEPL("on EventTypeOne as ev insert into NamedWindow select ev as event");

            IDictionary <String, object> theEvent = new LinkedHashMap <string, object>();

            theEvent.Put("hsi", 10);
            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(theEvent.Values.ToArray(), "EventTypeOne");
            }
            else
            {
                _epService.EPRuntime.SendEvent(theEvent, "EventTypeOne");
            }
            var result = stmt.First();
            var getter = result.EventType.GetGetter("event.hsi");

            Assert.AreEqual(10, getter.Get(result));

            _epService.Initialize();
        }
Esempio n. 4
0
        public void RunAssertionDocExample(EventRepresentationEnum eventRepresentationEnum)
        {
            string baseModule = eventRepresentationEnum.GetAnnotationText() + " create schema OrderEvent as (orderId string, productId string, price double, quantity int, deletedFlag boolean)";

            _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(baseModule, null, null, null);

            string appModuleOne = eventRepresentationEnum.GetAnnotationText() + " create schema ProductTotalRec as (productId string, totalPrice double);" +
                                  "" +
                                  eventRepresentationEnum.GetAnnotationText() + " @Name('nwProd') create window ProductWindow.std:unique(productId) as ProductTotalRec;" +
                                  "" +
                                  "on OrderEvent oe\n" +
                                  "merge ProductWindow pw\n" +
                                  "where pw.productId = oe.productId\n" +
                                  "when matched\n" +
                                  "then update set totalPrice = totalPrice + oe.price\n" +
                                  "when not matched\n" +
                                  "then insert select productId, price as totalPrice;";

            _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(appModuleOne, null, null, null);

            string appModuleTwo = eventRepresentationEnum.GetAnnotationText() + " @Name('nwOrd') create window OrderWindow.win:keepall() as OrderEvent;" +
                                  "" +
                                  "on OrderEvent oe\n" +
                                  "  merge OrderWindow pw\n" +
                                  "  where pw.orderId = oe.orderId\n" +
                                  "  when not matched \n" +
                                  "    then insert select *\n" +
                                  "  when matched and oe.deletedFlag=true\n" +
                                  "    then delete\n" +
                                  "  when matched\n" +
                                  "    then update set pw.quantity = oe.quantity, pw.price = oe.price";

            _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(appModuleTwo, null, null, null);

            SendOrderEvent(eventRepresentationEnum, "O1", "P1", 10, 100, false);
            SendOrderEvent(eventRepresentationEnum, "O1", "P1", 11, 200, false);
            SendOrderEvent(eventRepresentationEnum, "O2", "P2", 3, 300, false);
            EPAssertionUtil.AssertPropsPerRowAnyOrder(_epService.EPAdministrator.GetStatement("nwProd").GetEnumerator(), "productId,totalPrice".Split(','), new object[][] { new object[] { "P1", 21d }, new object[] { "P2", 3d } });
            EPAssertionUtil.AssertPropsPerRowAnyOrder(_epService.EPAdministrator.GetStatement("nwOrd").GetEnumerator(), "orderId,quantity".Split(','), new object[][] { new object[] { "O1", 200 }, new object[] { "O2", 300 } });

            string module = "create schema StreetCarCountSchema (streetid string, carcount int);" +
                            "    create schema StreetChangeEvent (streetid string, action string);" +
                            "    create window StreetCarCountWindow.std:unique(streetid) as StreetCarCountSchema;" +
                            "    on StreetChangeEvent ce merge StreetCarCountWindow w where ce.streetid = w.streetid\n" +
                            "    when not matched and ce.action = 'ENTER' then insert select streetid, 1 as carcount\n" +
                            "    when matched and ce.action = 'ENTER' then update set StreetCarCountWindow.carcount = carcount + 1\n" +
                            "    when matched and ce.action = 'LEAVE' then update set StreetCarCountWindow.carcount = carcount - 1;" +
                            "    select * from StreetCarCountWindow;";

            _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(module, null, null, null);

            _epService.EPAdministrator.DestroyAllStatements();
            foreach (string name in "OrderEvent,OrderWindow,StreetCarCountSchema,StreetCarCountWindow,StreetChangeEvent,ProductWindow,ProductTotalRec".Split(','))
            {
                _epService.EPAdministrator.Configuration.RemoveEventType(name, true);
            }
        }
Esempio n. 5
0
        public void RunAssertionFragment(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema InnerSchema as (key string)");
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema MySchema as (inside InnerSchema, insidearr InnerSchema[])");

            var    fields   = new String[] { "t0", "t1" };
            String stmtText = eventRepresentationEnum.GetAnnotationText()
                              + " select Typeof(s0.inside) as t0, Typeof(s0.insidearr) as t1 from MySchema as s0";
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Events += _listener.Update;

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(new Object[2], "MySchema");
            }
            else
            {
                _epService.EPRuntime.SendEvent(new Dictionary <String, Object>(),
                                               "MySchema");
            }
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { null, null });

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(new Object[] { new Object[2], null }, "MySchema");
            }
            else
            {
                var theEvent = new Dictionary <String, Object>();
                theEvent["inside"] = new Dictionary <String, Object>();
                _epService.EPRuntime.SendEvent(theEvent, "MySchema");
            }
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { "InnerSchema", null });

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(new Object[] { null, new Object[2][] }, "MySchema");
            }
            else
            {
                var theEvent = new Dictionary <String, Object>();
                theEvent["insidearr"] = new IDictionary <string, object> [0];
                _epService.EPRuntime.SendEvent(theEvent, "MySchema");
            }

            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { null, "InnerSchema[]" });

            _epService.EPAdministrator.DestroyAllStatements();
            _epService.EPAdministrator.Configuration.RemoveEventType("InnerSchema", true);
            _epService.EPAdministrator.Configuration.RemoveEventType("MySchema", true);
        }
Esempio n. 6
0
        private void RunAssertionCreateStreamTwo(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema MyEvent(myId int)");
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema AllMyEvent as (myEvent MyEvent, class String, reverse boolean)");
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema SuspectMyEvent as (myEvent MyEvent, class String)");

            var stmtOne = _epService.EPAdministrator.CreateEPL(
                "insert into AllMyEvent "
                + "select c as myEvent, 'test' as class, false as reverse "
                + "from MyEvent(myId=1) c");

            stmtOne.Events += _listener.Update;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(),
                            stmtOne.EventType.UnderlyingType);

            var stmtTwo = _epService.EPAdministrator.CreateEPL(
                "insert into SuspectMyEvent "
                + "select c.myEvent as myEvent, class "
                + "from AllMyEvent(not reverse) c");
            var listenerTwo = new SupportUpdateListener();

            stmtTwo.Events += listenerTwo.Update;

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(MakeEvent(1).Values.ToArray(), "MyEvent");
            }
            else
            {
                _epService.EPRuntime.SendEvent(MakeEvent(1), "MyEvent");
            }

            var resultOne = _listener.AssertOneGetNewAndReset();

            Assert.IsTrue(resultOne.Get("myEvent") is EventBean);
            Assert.AreEqual(1, ((EventBean)resultOne.Get("myEvent")).Get("myId"));
            Assert.NotNull(stmtOne.EventType.GetFragmentType("myEvent"));

            var resultTwo = listenerTwo.AssertOneGetNewAndReset();

            Assert.IsTrue(resultTwo.Get("myEvent") is EventBean);
            Assert.AreEqual(1, ((EventBean)resultTwo.Get("myEvent")).Get("myId"));
            Assert.NotNull(stmtTwo.EventType.GetFragmentType("myEvent"));

            _epService.Initialize();
        }
Esempio n. 7
0
        private void RunAssertionInsertWhereOMStaggered(EventRepresentationEnum eventRepresentationEnum)
        {
            IDictionary <String, object> dataType = MakeMap(new object[][] { new object[] { "a", typeof(string) }, new object[] { "b", typeof(int) } });

            epService.EPAdministrator.Configuration.AddEventType("MyMap", dataType);

            string      stmtTextCreateOne = eventRepresentationEnum.GetAnnotationText() + " create window MyWindow.win:keepall() as select a, b from MyMap";
            EPStatement stmtCreateOne     = epService.EPAdministrator.CreateEPL(stmtTextCreateOne);

            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmtCreateOne.EventType.UnderlyingType);
            stmtCreateOne.AddListener(listeners[0]);

            // create insert into
            string stmtTextInsertOne = "insert into MyWindow select a, b from MyMap";

            epService.EPAdministrator.CreateEPL(stmtTextInsertOne);

            // populate some data
            epService.EPRuntime.SendEvent(MakeMap(new object[][] { new object[] { "a", "E1" }, new object[] { "b", 2 } }), "MyMap");
            epService.EPRuntime.SendEvent(MakeMap(new object[][] { new object[] { "a", "E2" }, new object[] { "b", 10 } }), "MyMap");
            epService.EPRuntime.SendEvent(MakeMap(new object[][] { new object[] { "a", "E3" }, new object[] { "b", 10 } }), "MyMap");

            // create window with keep-all using OM
            EPStatementObjectModel model = new EPStatementObjectModel();

            eventRepresentationEnum.AddAnnotation(model);
            Expression where   = Expressions.Eq("b", 10);
            model.CreateWindow = CreateWindowClause.Create("MyWindowTwo", View.Create("win", "keepall")).SetInsert(true).SetInsertWhereClause(where);
            model.SelectClause = SelectClause.CreateWildcard();
            model.FromClause   = FromClause.Create(FilterStream.Create("MyWindow"));
            string text = eventRepresentationEnum.GetAnnotationText() + " create window MyWindowTwo.win:keepall() as select * from MyWindow insert where b=10";

            Assert.AreEqual(text.Trim(), model.ToEPL());

            EPStatementObjectModel modelTwo = epService.EPAdministrator.CompileEPL(text);

            Assert.AreEqual(text.Trim(), modelTwo.ToEPL());

            EPStatement stmt = epService.EPAdministrator.Create(modelTwo);

            EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), "a,b".Split(','), new object[][] { new object[] { "E2", 10 }, new object[] { "E3", 10 } });

            // test select individual fields and from an insert-from named window
            stmt = epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window MyWindowThree.win:keepall() as select a from MyWindowTwo insert where a = 'E2'");
            EPAssertionUtil.AssertPropsPerRow(stmt.GetEnumerator(), "a".Split(','), new object[][] { new object[] { "E2" } });

            epService.EPAdministrator.DestroyAllStatements();
            epService.EPAdministrator.Configuration.RemoveEventType("MyWindow", true);
            epService.EPAdministrator.Configuration.RemoveEventType("MyWindowTwo", true);
            epService.EPAdministrator.Configuration.RemoveEventType("MyWindowThree", true);
        }
Esempio n. 8
0
        public void RunAssertionNestableMapArray(EventRepresentationEnum eventRepresentationEnum)
        {
            EPStatement stmtInner = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema MyInnerType as (col1 string[], col2 int[])");
            EventType   inner     = stmtInner.EventType;

            Assert.AreEqual(typeof(string[]), inner.GetPropertyType("col1"));
            Assert.IsTrue(inner.GetPropertyDescriptor("col1").IsIndexed);
            Assert.AreEqual(typeof(int[]), inner.GetPropertyType("col2"));
            Assert.IsTrue(inner.GetPropertyDescriptor("col2").IsIndexed);
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), inner.UnderlyingType);

            EPStatement       stmtOuter = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema MyOuterType as (col1 MyInnerType, col2 MyInnerType[])");
            FragmentEventType type      = stmtOuter.EventType.GetFragmentType("col1");

            Assert.AreEqual("MyInnerType", type.FragmentType.Name);
            Assert.IsFalse(type.IsIndexed);
            Assert.IsFalse(type.IsNative);
            type = stmtOuter.EventType.GetFragmentType("col2");
            Assert.AreEqual("MyInnerType", type.FragmentType.Name);
            Assert.IsTrue(type.IsIndexed);
            Assert.IsFalse(type.IsNative);

            EPStatement stmtSelect = _epService.EPAdministrator.CreateEPL("select * from MyOuterType");

            stmtSelect.Events += _listener.Update;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmtSelect.EventType.UnderlyingType);

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                Object[] innerData = { "abc,def".Split(','), new int[] { 1, 2 } };
                Object[] outerData = { innerData, new Object[] { innerData, innerData } };
                _epService.EPRuntime.SendEvent(outerData, "MyOuterType");
            }
            else
            {
                IDictionary <String, Object> innerData = new Dictionary <String, Object>();
                innerData.Put("col1", "abc,def".Split(','));
                innerData.Put("col2", new int[] { 1, 2 });
                IDictionary <String, Object> outerData = new Dictionary <String, Object>();
                outerData.Put("col1", innerData);
                outerData.Put("col2", new DataMap[] { innerData, innerData });
                _epService.EPRuntime.SendEvent(outerData, "MyOuterType");
            }
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), "col1.col1[1],col2[1].col2[1]".Split(','), new Object[] { "def", 2 });

            _epService.EPAdministrator.Configuration.RemoveEventType("MyInnerType", true);
            _epService.EPAdministrator.Configuration.RemoveEventType("MyOuterType", true);
            _epService.EPAdministrator.DestroyAllStatements();
        }
Esempio n. 9
0
        private void RunAssertionObjectArrayDelivery(EventRepresentationEnum eventRepresentationEnum)
        {
            var         subscriber = new MySubscriberRowByRowObjectArr();
            EPStatement stmt       = _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " select TheString, IntPrimitive from SupportBean.std:unique(TheString)");

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(),
                            stmt.EventType.UnderlyingType);

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            EPAssertionUtil.AssertEqualsAnyOrder(
                subscriber.GetAndResetIndicate()[0], new Object[]
            {
                "E1", 1
            }
                );

            _epService.EPRuntime.SendEvent(new SupportBean("E2", 10));
            EPAssertionUtil.AssertEqualsAnyOrder(
                subscriber.GetAndResetIndicate()[0], new Object[]
            {
                "E2", 10
            }
                );

            _epService.EPAdministrator.DestroyAllStatements();
        }
Esempio n. 10
0
        private void RunAssertionOutputLimitNoJoin(EventRepresentationEnum eventRepresentationEnum)
        {
            var         subscriber = new MySubscriberRowByRowSpecific();
            EPStatement stmt       = _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " select TheString, IntPrimitive from SupportBean output every 2 events");

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(),
                            stmt.EventType.UnderlyingType);

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            Assert.AreEqual(0, subscriber.GetAndResetIndicate().Count);
            _epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            EPAssertionUtil.AssertEqualsExactOrder(new Object[][]
            {
                new Object[]
                {
                    "E1", 1
                }
                ,
                new Object[]
                {
                    "E2", 2
                }
            }
                                                   , subscriber.GetAndResetIndicate());

            _epService.EPAdministrator.DestroyAllStatements();
        }
Esempio n. 11
0
        private void RunAssertionWidening(EventRepresentationEnum eventRepresentationEnum)
        {
            var         subscriber = new MySubscriberRowByRowSpecific();
            EPStatement stmt       = _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " select BytePrimitive, IntPrimitive, LongPrimitive, FloatPrimitive from SupportBean(TheString='E1')");

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(),
                            stmt.EventType.UnderlyingType);

            var bean = new SupportBean();

            bean.TheString      = "E1";
            bean.BytePrimitive  = 1;
            bean.IntPrimitive   = 2;
            bean.LongPrimitive  = 3;
            bean.FloatPrimitive = 4;
            _epService.EPRuntime.SendEvent(bean);
            EPAssertionUtil.AssertEqualsExactOrder(new Object[]
            {
                1, 2L, 3d, 4d
            }
                                                   , subscriber.GetAndResetIndicate()[0]);

            _epService.EPAdministrator.DestroyAllStatements();
        }
Esempio n. 12
0
        private void RunAssertionPerformance(bool namedWindow, EventRepresentationEnum outputType)
        {
            string eplCreate = namedWindow ?
                               outputType.GetAnnotationText() + " create window MyWindow.win:keepall() as (c1 string, c2 int)" :
                               "create table MyWindow(c1 string primary key, c2 int)";
            EPStatement stmtNamedWindow = _epService.EPAdministrator.CreateEPL(eplCreate);

            Assert.AreEqual(outputType.GetOutputClass(), stmtNamedWindow.EventType.UnderlyingType);

            // preload events
            EPStatement stmt         = _epService.EPAdministrator.CreateEPL("insert into MyWindow select TheString as c1, IntPrimitive as c2 from SupportBean");
            int         totalUpdated = 5000;

            for (int i = 0; i < totalUpdated; i++)
            {
                _epService.EPRuntime.SendEvent(new SupportBean("E" + i, 0));
            }
            stmt.Dispose();

            string epl = "on SupportBean sb merge MyWindow nw where nw.c1 = sb.TheString " +
                         "when matched then update set nw.c2=sb.IntPrimitive";

            stmt = _epService.EPAdministrator.CreateEPL(epl);
            stmt.AddListener(_mergeListener);

            // prime
            for (int i = 0; i < 100; i++)
            {
                _epService.EPRuntime.SendEvent(new SupportBean("E" + i, 1));
            }
            var delta = PerformanceObserver.TimeMillis(
                () =>
            {
                for (int i = 0; i < totalUpdated; i++)
                {
                    _epService.EPRuntime.SendEvent(new SupportBean("E" + i, 1));
                }
            });

            // verify
            IEnumerator <EventBean> events = stmtNamedWindow.GetEnumerator();
            int count = 0;

            while (events.MoveNext())
            {
                EventBean next = events.Current;
                Assert.AreEqual(1, next.Get("c2"));
                count++;
            }
            Assert.AreEqual(totalUpdated, count);
            Assert.IsTrue(delta < 500, "Delta=" + delta);

            _epService.EPAdministrator.DestroyAllStatements();
            _epService.EPAdministrator.Configuration.RemoveEventType("MyWindow", true);
        }
        public void RunAssertionDispatchBackQueue(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema StartValueEvent as (dummy string)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema TestForwardEvent as (prop1 string)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema TestInputEvent as (dummy string)");
            _epService.EPAdministrator.CreateEPL("insert into TestForwardEvent select'V1' as prop1 from TestInputEvent");

            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window NamedWin.std:unique(prop1) (prop1 string, prop2 string)");

            _epService.EPAdministrator.CreateEPL("insert into NamedWin select 'V1' as prop1, 'O1' as prop2 from StartValueEvent");

            _epService.EPAdministrator.CreateEPL("on TestForwardEvent update NamedWin as work set prop2 = 'U1' where work.prop1 = 'V1'");

            string[] fields    = "prop1,prop2".Split(',');
            string   eplSelect = "select irstream prop1, prop2 from NamedWin";

            _epService.EPAdministrator.CreateEPL(eplSelect).AddListener(_listener);

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(new object[] { "dummyValue" }, "StartValueEvent");
            }
            else
            {
                _epService.EPRuntime.SendEvent(new Dictionary <string, object>(), "StartValueEvent");
            }

            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new object[] { "V1", "O1" });

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(new object[] { "dummyValue" }, "TestInputEvent");
            }
            else
            {
                _epService.EPRuntime.SendEvent(new Dictionary <string, object>(), "TestInputEvent");
            }
            EPAssertionUtil.AssertProps(_listener.LastOldData[0], fields, new object[] { "V1", "O1" });
            EPAssertionUtil.AssertProps(_listener.GetAndResetLastNewData()[0], fields, new object[] { "V1", "U1" });

            _epService.Initialize();
        }
Esempio n. 14
0
        public void RunAssertionInheritance(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema BaseEvent as (b1 string)");
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema SubEvent as (s1 string) inherits BaseEvent");
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema OuterEvent as (bases BaseEvent[], subs SubEvent[])");
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " select bases.union(subs) as val from OuterEvent");

            stmt.Events += _listener.Update;

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(
                    new Object[] {
                    new Object[][] { new Object[] { "b10" } },
                    new Object[][] { new Object[] { "b10", "s10" } }
                }, "OuterEvent");
            }
            else
            {
                IDictionary <String, Object> baseEvent  = MakeMap("b1", "b10");
                IDictionary <String, Object> subEvent   = MakeMap("s1", "s10");
                IDictionary <String, Object> outerEvent = MakeMap(
                    "bases", new Map[] { baseEvent },
                    "subs", new Map[] { subEvent });

                _epService.EPRuntime.SendEvent(outerEvent, "OuterEvent");
            }

            var result = (ICollection <object>)_listener.AssertOneGetNewAndReset().Get("val");

            Assert.AreEqual(2, result.Count);

            _epService.Initialize();
        }
        private void RunAssertionScoringUseCase(EventRepresentationEnum eventRepresentationEnum)
        {
            var fields = "userId,keyword,sumScore".Split(',');
            var epl    =
                eventRepresentationEnum.GetAnnotationText() + " create schema ScoreCycle (userId string, keyword string, productId string, score long);\n" +
                eventRepresentationEnum.GetAnnotationText() + " create schema UserKeywordTotalStream (userId string, keyword string, sumScore long);\n" +
                "\n" +
                eventRepresentationEnum.GetAnnotationText() + " create context HashByUserCtx as " +
                "coalesce by Consistent_hash_crc32(userId) from ScoreCycle, " +
                "consistent_hash_crc32(userId) from UserKeywordTotalStream " +
                "granularity 1000000;\n" +
                "\n" +
                "context HashByUserCtx create window ScoreCycleWindow.std:unique(productId, keyword) as ScoreCycle;\n" +
                "\n" +
                "context HashByUserCtx insert into ScoreCycleWindow select * from ScoreCycle;\n" +
                "\n" +
                "@Name('outOne') context HashByUserCtx insert into UserKeywordTotalStream \n" +
                "select userId, keyword, Sum(score) as sumScore from ScoreCycleWindow group by keyword;\n" +
                "\n" +
                "@Name('outTwo') context HashByUserCtx on UserKeywordTotalStream(sumScore > 10000) delete from ScoreCycleWindow;\n";

            _epService.EPAdministrator.DeploymentAdmin.ParseDeploy(epl);
            _epService.EPAdministrator.GetStatement("outOne").Events += _listener.Update;

            MakeSendScoreEvent("ScoreCycle", eventRepresentationEnum, "Pete", "K1", "P1", 100);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { "Pete", "K1", 100L });

            MakeSendScoreEvent("ScoreCycle", eventRepresentationEnum, "Pete", "K1", "P2", 15);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { "Pete", "K1", 115L });

            MakeSendScoreEvent("ScoreCycle", eventRepresentationEnum, "Joe", "K1", "P2", 30);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { "Joe", "K1", 30L });

            MakeSendScoreEvent("ScoreCycle", eventRepresentationEnum, "Joe", "K2", "P1", 40);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { "Joe", "K2", 40L });

            MakeSendScoreEvent("ScoreCycle", eventRepresentationEnum, "Joe", "K1", "P1", 20);
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new Object[] { "Joe", "K1", 50L });

            _epService.Initialize();
        }
Esempio n. 16
0
        private void RunAssertionMapTranspose(EventRepresentationEnum eventRepresentationEnum)
        {
            IDictionary <String, object> innerTypeOne = new Dictionary <string, object>();

            innerTypeOne.Put("i1", typeof(int));
            IDictionary <String, object> innerTypeTwo = new Dictionary <string, object>();

            innerTypeTwo.Put("i2", typeof(int));
            IDictionary <String, object> outerType = new Dictionary <string, object>();

            outerType.Put("one", "T1");
            outerType.Put("two", "T2");
            _epService.EPAdministrator.Configuration.AddEventType("T1", innerTypeOne);
            _epService.EPAdministrator.Configuration.AddEventType("T2", innerTypeTwo);
            _epService.EPAdministrator.Configuration.AddEventType("OuterType", outerType);

            // create window
            var stmtTextCreate = eventRepresentationEnum.GetAnnotationText() + " create window MyWindow.win:keepall() as select one, two from OuterType";
            var stmtCreate     = _epService.EPAdministrator.CreateEPL(stmtTextCreate);

            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmtCreate.EventType.UnderlyingType);
            stmtCreate.AddListener(_listenerWindow);
            EPAssertionUtil.AssertEqualsAnyOrder(stmtCreate.EventType.PropertyNames, new string[] { "one", "two" });
            var eventType = stmtCreate.EventType;

            Assert.AreEqual("T1", eventType.GetFragmentType("one").FragmentType.Name);
            Assert.AreEqual("T2", eventType.GetFragmentType("two").FragmentType.Name);

            // create insert into
            var stmtTextInsertOne = "insert into MyWindow select one, two from OuterType";

            _epService.EPAdministrator.CreateEPL(stmtTextInsertOne);

            IDictionary <String, object> innerDataOne = new Dictionary <string, object>();

            innerDataOne.Put("i1", 1);
            IDictionary <String, object> innerDataTwo = new Dictionary <string, object>();

            innerDataTwo.Put("i2", 2);
            IDictionary <String, object> outerData = new Dictionary <string, object>();

            outerData.Put("one", innerDataOne);
            outerData.Put("two", innerDataTwo);

            _epService.EPRuntime.SendEvent(outerData, "OuterType");
            EPAssertionUtil.AssertProps(_listenerWindow.AssertOneGetNewAndReset(), "one.i1,two.i2".Split(','), new object[] { 1, 2 });

            _epService.EPAdministrator.DestroyAllStatements();
            _epService.EPAdministrator.Configuration.RemoveEventType("MyWindow", true);
        }
Esempio n. 17
0
        private void RunAssertionObjectArrayDelivery(EventRepresentationEnum eventRepresentationEnum, SupportSubscriberRowByRowObjectArrayBase subscriber)
        {
            var stmt = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " select TheString, IntPrimitive from SupportBean.std:unique(TheString)");

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmt.EventType.UnderlyingType);

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            subscriber.AssertOneAndReset(stmt, new object[] { "E1", 1 });

            _epService.EPRuntime.SendEvent(new SupportBean("E2", 10));
            subscriber.AssertOneAndReset(stmt, new object[] { "E2", 10 });

            stmt.Dispose();
        }
Esempio n. 18
0
        private void RunAssertionOutputLimitNoJoin(EventRepresentationEnum eventRepresentationEnum, SupportSubscriberRowByRowSpecificBase subscriber)
        {
            var stmt = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " select TheString, IntPrimitive from SupportBean output every 2 events");

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmt.EventType.UnderlyingType);

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            subscriber.AssertNoneReceived();

            _epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            subscriber.AssertMultipleReceivedAndReset(stmt, new object[][] { new object[] { "E1", 1 }, new object[] { "E2", 2 } });

            stmt.Dispose();
        }
Esempio n. 19
0
        private void RunAssertionCreateStream(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema MyEvent(myId int)");
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema CompositeEvent(c1 MyEvent, c2 MyEvent, rule string)");
            _epService.EPAdministrator.CreateEPL(
                "insert into MyStream select c, 'additionalValue' as value from MyEvent c");
            _epService.EPAdministrator.CreateEPL(
                "insert into CompositeEvent select e1.c as c1, e2.c as c2, '4' as rule "
                + "from pattern [e1=MyStream -> e2=MyStream]");
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " @Name('Target') select * from CompositeEvent");
            _epService.EPAdministrator.GetStatement("Target").Events += _listener.Update;

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(MakeEvent(10).Values.ToArray(), "MyEvent");
                _epService.EPRuntime.SendEvent(MakeEvent(11).Values.ToArray(), "MyEvent");
            }
            else
            {
                _epService.EPRuntime.SendEvent(MakeEvent(10), "MyEvent");
                _epService.EPRuntime.SendEvent(MakeEvent(11), "MyEvent");
            }
            var theEvent = _listener.AssertOneGetNewAndReset();

            Assert.AreEqual(10, theEvent.Get("c1.myId"));
            Assert.AreEqual(11, theEvent.Get("c2.myId"));
            Assert.AreEqual("4", theEvent.Get("rule"));

            _epService.Initialize();
        }
Esempio n. 20
0
        private void RunAssertionInnerJoinLateStart(EventRepresentationEnum eventRepresentationEnum)
        {
            var stmtOne = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema Product (product string, size int)");

            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmtOne.EventType.UnderlyingType);
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema Portfolio (portfolio string, product string)");
            var stmtTwo = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window ProductWin.win:keepall() as Product");

            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmtTwo.EventType.UnderlyingType);

            _epService.EPAdministrator.CreateEPL("insert into ProductWin select * from Product");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window PortfolioWin.win:keepall() as Portfolio");
            _epService.EPAdministrator.CreateEPL("insert into PortfolioWin select * from Portfolio");

            SendProduct(eventRepresentationEnum, "productA", 1);
            SendProduct(eventRepresentationEnum, "productB", 2);
            SendPortfolio(eventRepresentationEnum, "Portfolio", "productA");

            var stmtText = "@Name(\"Query2\") select portfolio, ProductWin.product, size " +
                           "from PortfolioWin unidirectional inner join ProductWin on PortfolioWin.product=ProductWin.product";
            var stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.AddListener(_listenerStmtOne);

            SendPortfolio(eventRepresentationEnum, "Portfolio", "productB");
            EPAssertionUtil.AssertProps(_listenerStmtOne.AssertOneGetNewAndReset(), new string[] { "portfolio", "ProductWin.product", "size" }, new object[] { "Portfolio", "productB", 2 });

            SendPortfolio(eventRepresentationEnum, "Portfolio", "productC");
            _listenerStmtOne.Reset();

            SendProduct(eventRepresentationEnum, "productC", 3);
            SendPortfolio(eventRepresentationEnum, "Portfolio", "productC");
            EPAssertionUtil.AssertProps(_listenerStmtOne.AssertOneGetNewAndReset(), new string[] { "portfolio", "ProductWin.product", "size" }, new object[] { "Portfolio", "productC", 3 });

            _epService.Initialize();
        }
Esempio n. 21
0
        private void RunAssertionGetDynamicWObjectArr(EventRepresentationEnum eventRepresentationEnum)
        {
            String stmtText = eventRepresentationEnum.GetAnnotationText()
                              + " select item.id? as myid from "
                              + typeof (SupportBeanDynRoot).FullName;
            using (var stmt = _epService.EPAdministrator.CreateEPL(stmtText))
            {

                stmt.Events += _listener.Update;

                // check type
                Assert.AreEqual(typeof (object), stmt.EventType.GetPropertyType("myid"));

                // check value with an object that has the property as an int
                var runtime = _epService.EPRuntime;
                runtime.SendEvent(
                    new SupportBeanDynRoot(new SupportBean_S0(101)));
                Assert.AreEqual(101, _listener.AssertOneGetNewAndReset().Get("myid"));

                // check value with an object that doesn't have the property
                runtime.SendEvent(new SupportBeanDynRoot("abc"));
                Assert.AreEqual(null, _listener.AssertOneGetNewAndReset().Get("myid"));

                // check value with an object that has the property as a string
                runtime.SendEvent(
                    new SupportBeanDynRoot(new SupportBean_A("e1")));
                Assert.AreEqual("e1", _listener.AssertOneGetNewAndReset().Get("myid"));

                runtime.SendEvent(
                    new SupportBeanDynRoot(new SupportBean_B("e2")));
                Assert.AreEqual("e2", _listener.AssertOneGetNewAndReset().Get("myid"));

                runtime.SendEvent(
                    new SupportBeanDynRoot(new SupportBean_S1(102)));
                Assert.AreEqual(102, _listener.AssertOneGetNewAndReset().Get("myid"));

                if (eventRepresentationEnum.IsObjectArrayEvent())
                {
                    Assert.AreEqual(typeof (object[]), stmt.EventType.UnderlyingType);
                }
                else
                {
                    Assert.AreEqual(typeof (IDictionary<string, object>), stmt.EventType.UnderlyingType);
                }
            }
        }
Esempio n. 22
0
        private void RunAssertionWidening(EventRepresentationEnum eventRepresentationEnum, SupportSubscriberRowByRowSpecificBase subscriber)
        {
            var stmt = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " select BytePrimitive, IntPrimitive, LongPrimitive, FloatPrimitive from SupportBean(TheString='E1')");

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmt.EventType.UnderlyingType);

            var bean = new SupportBean();

            bean.TheString      = "E1";
            bean.BytePrimitive  = (byte)1;
            bean.IntPrimitive   = 2;
            bean.LongPrimitive  = 3;
            bean.FloatPrimitive = 4;
            _epService.EPRuntime.SendEvent(bean);
            subscriber.AssertOneReceivedAndReset(stmt, new object[] { 1, 2L, 3d, 4d });

            stmt.Dispose();
        }
Esempio n. 23
0
        private void RunAssertionNamedWindow(EventRepresentationEnum eventRepresentationEnum)
        {
            String[]      fields = "key,value".Split(',');
            SubscriberMap subscriberNamedWindow = new SubscriberMap();
            String        stmtTextCreate        = eventRepresentationEnum.GetAnnotationText()
                                                  + " create window MyWindow.win:keepall() as select TheString as key, IntPrimitive as value from SupportBean";
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtTextCreate);

            stmt.Subscriber = subscriberNamedWindow;

            SubscriberFields subscriberInsertInto = new SubscriberFields();
            String           stmtTextInsertInto   = "insert into MyWindow select TheString as key, IntPrimitive as value from SupportBean";

            stmt            = _epService.EPAdministrator.CreateEPL(stmtTextInsertInto);
            stmt.Subscriber = subscriberInsertInto;

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            EPAssertionUtil.AssertPropsMap(subscriberNamedWindow.GetAndResetIndicate()[0], fields, new Object[] { "E1", 1 });
            EPAssertionUtil.AssertEqualsExactOrder(new Object[][] { new Object[] { "E1", 1 } }, subscriberInsertInto.GetAndResetIndicate());

            // test on-delete
            SubscriberMap subscriberDelete = new SubscriberMap();
            String        stmtTextDelete   = "on SupportMarketDataBean s0 delete from MyWindow s1 where s0.Symbol = s1.key";

            stmt            = _epService.EPAdministrator.CreateEPL(stmtTextDelete);
            stmt.Subscriber = subscriberDelete;

            _epService.EPRuntime.SendEvent(new SupportMarketDataBean("E1", 0, 1L, ""));
            EPAssertionUtil.AssertPropsMap(subscriberDelete.GetAndResetIndicate()[0], fields, new Object[] { "E1", 1 });

            // test on-select
            SubscriberMap subscriberSelect = new SubscriberMap();
            String        stmtTextSelect   = "on SupportMarketDataBean s0 select key, value from MyWindow s1";

            stmt            = _epService.EPAdministrator.CreateEPL(stmtTextSelect);
            stmt.Subscriber = subscriberSelect;

            _epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            _epService.EPRuntime.SendEvent(new SupportMarketDataBean("M1", 0, 1L, ""));
            EPAssertionUtil.AssertPropsMap(subscriberSelect.GetAndResetIndicate()[0], fields, new Object[] { "E2", 2 });
        }
Esempio n. 24
0
        private void RunAssertionBindMap(EventRepresentationEnum eventRepresentationEnum, SupportSubscriberMultirowMapBase subscriber)
        {
            var stmtText = eventRepresentationEnum.GetAnnotationText() + " select irstream TheString, IntPrimitive from " + typeof(SupportBean).FullName + ".win:length_batch(2)";
            var stmt     = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmt.EventType.UnderlyingType);

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            subscriber.AssertNoneReceived();

            _epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            subscriber.AssertOneReceivedAndReset(stmt, _fields, new object[][] { new object[] { "E1", 1 }, new object[] { "E2", 2 } }, null);

            _epService.EPRuntime.SendEvent(new SupportBean("E3", 3));
            subscriber.AssertNoneReceived();

            _epService.EPRuntime.SendEvent(new SupportBean("E4", 4));
            subscriber.AssertOneReceivedAndReset(stmt, _fields, new object[][] { new object[] { "E3", 3 }, new object[] { "E4", 4 } }, new object[][] { new object[] { "E1", 1 }, new object[] { "E2", 2 } });

            stmt.Dispose();
        }
Esempio n. 25
0
        private void RunAssertionInvalid(EventRepresentationEnum eventRepresentationEnum)
        {
            TryInvalid(eventRepresentationEnum.GetAnnotationText() + " create schema MyEventType as (col1 xxxx)",
                       "Error starting statement: Nestable type configuration encountered an unexpected property type name 'xxxx' for property 'col1', expected Type or DataMap or the name of a previously-declared Map or ObjectArray type [");

            TryInvalid(eventRepresentationEnum.GetAnnotationText() + " create schema MyEventType as (col1 int, col1 string)",
                       "Error starting statement: Duplicate column name 'col1' [");

            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema MyEventType as (col1 string)");
            TryInvalid("create schema MyEventType as (col1 string, col2 string)",
                       "Error starting statement: Event type named 'MyEventType' has already been declared with differing column name or type information: Type by name 'MyEventType' expects 1 properties but receives 2 properties [");

            TryInvalid(eventRepresentationEnum.GetAnnotationText() + " create schema MyEventType as () inherit ABC",
                       "Error in expression: Expected 'inherits', 'starttimestamp', 'endtimestamp' or 'copyfrom' keyword after create-schema clause but encountered 'inherit' [");

            TryInvalid(eventRepresentationEnum.GetAnnotationText() + " create schema MyEventType as () inherits ABC",
                       "Error starting statement: Supertype by name 'ABC' could not be found [");

            TryInvalid(eventRepresentationEnum.GetAnnotationText() + " create schema MyEventType as () inherits",
                       "Incorrect syntax near end-of-input expecting an identifier but found end-of-input at line 1 column ");

            _epService.EPAdministrator.Configuration.RemoveEventType("MyEventType", true);
        }
Esempio n. 26
0
        private void RunAssertionBindObjectArr(EventRepresentationEnum eventRepresentationEnum)
        {
            var    subscriber = new MySubscriberMultirowObjectArr();
            String stmtText   = eventRepresentationEnum.GetAnnotationText()
                                + " select irstream TheString, IntPrimitive from "
                                + typeof(SupportBean).FullName + ".win:length_batch(2)";
            EPStatement stmt = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Subscriber = subscriber;
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(),
                            stmt.EventType.UnderlyingType);

            _epService.EPRuntime.SendEvent(new SupportBean("E1", 1));
            Assert.AreEqual(0, subscriber.IndicateArr.Count);
            _epService.EPRuntime.SendEvent(new SupportBean("E2", 2));
            Assert.AreEqual(1, subscriber.IndicateArr.Count);
            UniformPair <Object[][]> result = subscriber.GetAndResetIndicateArr()[0];

            Assert.IsNull(result.Second);
            Assert.AreEqual(2, result.First.Length);
            EPAssertionUtil.AssertEqualsExactOrder(
                result.First, _fields,
                new Object[][]
            {
                new Object[]
                {
                    "E1", 1
                }
                ,
                new Object[]
                {
                    "E2", 2
                }
            }
                );

            _epService.EPRuntime.SendEvent(new SupportBean("E3", 3));
            Assert.AreEqual(0, subscriber.IndicateArr.Count);
            _epService.EPRuntime.SendEvent(new SupportBean("E4", 4));
            Assert.AreEqual(1, subscriber.IndicateArr.Count);
            result = subscriber.GetAndResetIndicateArr()[0];
            Assert.AreEqual(2, result.First.Length);
            Assert.AreEqual(2, result.Second.Length);
            EPAssertionUtil.AssertEqualsExactOrder(
                result.First, _fields,
                new Object[][]
            {
                new Object[]
                {
                    "E3", 3
                }
                ,
                new Object[]
                {
                    "E4", 4
                }
            }
                );
            EPAssertionUtil.AssertEqualsExactOrder(
                result.Second, _fields,
                new Object[][]
            {
                new Object[]
                {
                    "E1", 1
                }
                ,
                new Object[]
                {
                    "E2", 2
                }
            }
                );

            _epService.EPAdministrator.DestroyAllStatements();
        }
Esempio n. 27
0
        private void RunAssertionArrayMapInsert(EventRepresentationEnum eventRepresentationEnum)
        {
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema EventOne(id string)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema EventTwo(id string, val int)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema FinalEventValid (startEvent EventOne, endEvent EventTwo[])");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema FinalEventInvalidNonArray (startEvent EventOne, endEvent EventTwo)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema FinalEventInvalidArray (startEvent EventOne, endEvent EventTwo)");

            _epService.EPRuntime.SendEvent(new CurrentTimeEvent(0));

            // Test valid case of array insert
            var validEpl = "INSERT INTO FinalEventValid SELECT s as startEvent, e as endEvent FROM PATTERN [" +
                           "every s=EventOne -> e=EventTwo(id=s.id) until timer:interval(10 sec)]";
            var stmt = _epService.EPAdministrator.CreateEPL(validEpl);

            stmt.Events += _listener.Update;

            SendEventOne(_epService, eventRepresentationEnum, "G1");
            SendEventTwo(_epService, eventRepresentationEnum, "G1", 2);
            SendEventTwo(_epService, eventRepresentationEnum, "G1", 3);
            _epService.EPRuntime.SendEvent(new CurrentTimeEvent(10000));

            EventBean startEventOne;
            EventBean endEventOne;
            EventBean endEventTwo;

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                var outArray = ((Object[])_listener.AssertOneGetNewAndReset().Underlying);
                startEventOne = (EventBean)outArray[0];
                endEventOne   = ((EventBean[])outArray[1])[0];
                endEventTwo   = ((EventBean[])outArray[1])[1];
            }
            else
            {
                var outMap = ((IDictionary <string, object>)_listener.AssertOneGetNewAndReset().Underlying);
                startEventOne = (EventBean)outMap.Get("startEvent");
                endEventOne   = ((EventBean[])outMap.Get("endEvent"))[0];
                endEventTwo   = ((EventBean[])outMap.Get("endEvent"))[1];
            }
            Assert.AreEqual("G1", startEventOne.Get("id"));
            Assert.AreEqual(2, endEventOne.Get("val"));
            Assert.AreEqual(3, endEventTwo.Get("val"));

            // Test invalid case of non-array destination insert
            var invalidEpl = "INSERT INTO FinalEventInvalidNonArray SELECT s as startEvent, e as endEvent FROM PATTERN [" +
                             "every s=EventOne -> e=EventTwo(id=s.id) until timer:interval(10 sec)]";

            try {
                _epService.EPAdministrator.CreateEPL(invalidEpl);
                Assert.Fail();
            }
            catch (EPException ex) {
                Assert.AreEqual("Error starting statement: Event type named 'FinalEventInvalidNonArray' has already been declared with differing column name or type information: Type by name 'FinalEventInvalidNonArray' in property 'endEvent' expected event type 'EventTwo' but receives event type 'EventTwo[]' [INSERT INTO FinalEventInvalidNonArray SELECT s as startEvent, e as endEvent FROM PATTERN [every s=EventOne -> e=EventTwo(id=s.id) until timer:interval(10 sec)]]", ex.Message);
            }

            // Test invalid case of array destination insert from non-array var
            var invalidEplTwo = "INSERT INTO FinalEventInvalidArray SELECT s as startEvent, e as endEvent FROM PATTERN [" +
                                "every s=EventOne -> e=EventTwo(id=s.id) until timer:interval(10 sec)]";

            try {
                _epService.EPAdministrator.CreateEPL(invalidEplTwo);
                Assert.Fail();
            }
            catch (EPException ex) {
                Assert.AreEqual("Error starting statement: Event type named 'FinalEventInvalidArray' has already been declared with differing column name or type information: Type by name 'FinalEventInvalidArray' in property 'endEvent' expected event type 'EventTwo' but receives event type 'EventTwo[]' [INSERT INTO FinalEventInvalidArray SELECT s as startEvent, e as endEvent FROM PATTERN [every s=EventOne -> e=EventTwo(id=s.id) until timer:interval(10 sec)]]", ex.Message);
            }

            _epService.Initialize();
        }
Esempio n. 28
0
        private void RunAssertionSingleRowSplitAndType(EventRepresentationEnum eventRepresentationEnum)
        {
            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPAdministrator.Configuration.AddPlugInSingleRowFunction("splitSentence", GetType().FullName, "SplitSentenceMethodReturnObjectArray");
                _epService.EPAdministrator.Configuration.AddPlugInSingleRowFunction("splitSentenceBean", GetType().FullName, "SplitSentenceBeanMethodReturnObjectArray");
                _epService.EPAdministrator.Configuration.AddPlugInSingleRowFunction("splitWord", GetType().FullName, "SplitWordMethodReturnObjectArray");
            }
            else
            {
                _epService.EPAdministrator.Configuration.AddPlugInSingleRowFunction("splitSentence", GetType().FullName, "SplitSentenceMethodReturnMap");
                _epService.EPAdministrator.Configuration.AddPlugInSingleRowFunction("splitSentenceBean", GetType().FullName, "SplitSentenceBeanMethodReturnMap");
                _epService.EPAdministrator.Configuration.AddPlugInSingleRowFunction("splitWord", GetType().FullName, "SplitWordMethodReturnMap");
            }
            _epService.EPAdministrator.Configuration.AddPlugInSingleRowFunction("invalidSentence", GetType().FullName, "InvalidSentenceMethod");

            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema SentenceEvent(sentence String)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema WordEvent(word String)");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema CharacterEvent(char String)");

            string      stmtText;
            EPStatement stmt;
            var         fields = "word".Split(',');

            // test single-row method
            stmtText = "select * from SentenceEvent[splitSentence(sentence)@type(WordEvent)]";
            stmt     = _epService.EPAdministrator.CreateEPL(stmtText);
            stmt.AddListener(_listener);
            Assert.AreEqual("WordEvent", stmt.EventType.Name);
            Assert.AreEqual(eventRepresentationEnum.GetOutputClass(), stmt.EventType.UnderlyingType);

            SendSentenceEvent(eventRepresentationEnum, "I am testing this code");
            EPAssertionUtil.AssertPropsPerRow(
                _listener.GetAndResetLastNewData(), fields,
                new object[][]
            {
                new object[] { "I" },
                new object[] { "am" },
                new object[] { "testing" },
                new object[] { "this" },
                new object[] { "code" }
            });

            SendSentenceEvent(eventRepresentationEnum, "the second event");
            EPAssertionUtil.AssertPropsPerRow(
                _listener.GetAndResetLastNewData(), fields,
                new object[][]
            {
                new object[] { "the" },
                new object[] { "second" },
                new object[] { "event" }
            });

            stmt.Dispose();

            // test SODA
            var model = _epService.EPAdministrator.CompileEPL(stmtText);

            Assert.AreEqual(stmtText, model.ToEPL());
            stmt = _epService.EPAdministrator.Create(model);
            Assert.AreEqual(stmtText, stmt.Text);
            stmt.AddListener(_listener);

            SendSentenceEvent(eventRepresentationEnum, "the third event");
            EPAssertionUtil.AssertPropsPerRow(
                _listener.GetAndResetLastNewData(), fields,
                new object[][]
            {
                new object[] { "the" },
                new object[] { "third" },
                new object[] { "event" }
            });

            stmt.Dispose();

            // test script
            if (!eventRepresentationEnum.IsObjectArrayEvent())
            {
                stmtText = "expression com.espertech.esper.support.collections.ISupportDataMapCollection js:splitSentenceJS(sentence) [" +
                           "  var words = clr.New('com.espertech.esper.support.collections.SupportDataMapList',[]);" +
                           "  var factory = clr.New('com.espertech.esper.support.collections.SupportDataMapFactory',[]);" +
                           "  words.Add(factory.Create('word', 'wordOne'));" +
                           "  words.Add(factory.Create('word', 'wordTwo'));" +
                           "  words;" +
                           "]" +
                           "select * from SentenceEvent[splitSentenceJS(sentence)@type(WordEvent)]";
                stmt = _epService.EPAdministrator.CreateEPL(stmtText).AddListener(_listener);
                Assert.AreEqual("WordEvent", stmt.EventType.Name);

                _epService.EPRuntime.SendEvent(Collections.EmptyDataMap, "SentenceEvent");
                EPAssertionUtil.AssertPropsPerRowAnyOrder(
                    _listener.GetAndResetLastNewData(), fields,
                    new object[][]
                {
                    new object[] { "wordOne" },
                    new object[] { "wordTwo" }
                });

                stmt.Dispose();
            }

            // test multiple splitters
            stmtText = "select * from SentenceEvent[splitSentence(sentence)@type(WordEvent)][splitWord(word)@type(CharacterEvent)]";
            stmt     = _epService.EPAdministrator.CreateEPL(stmtText);
            stmt.AddListener(_listener);
            Assert.AreEqual("CharacterEvent", stmt.EventType.Name);

            SendSentenceEvent(eventRepresentationEnum, "I am");
            EPAssertionUtil.AssertPropsPerRowAnyOrder(
                _listener.GetAndResetLastNewData(), "char".Split(','),
                new object[][]
            {
                new object[] { "I" },
                new object[] { "a" },
                new object[] { "m" }
            });

            stmt.Dispose();

            // test wildcard parameter
            stmtText = "select * from SentenceEvent[splitSentenceBean(*)@type(WordEvent)]";
            stmt     = _epService.EPAdministrator.CreateEPL(stmtText);
            stmt.AddListener(_listener);
            Assert.AreEqual("WordEvent", stmt.EventType.Name);

            SendSentenceEvent(eventRepresentationEnum, "another test sentence");
            EPAssertionUtil.AssertPropsPerRowAnyOrder(
                _listener.GetAndResetLastNewData(), fields,
                new object[][]
            {
                new object[] { "another" },
                new object[] { "test" },
                new object[] { "sentence" }
            });

            stmt.Dispose();

            // test property returning untyped collection
            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPAdministrator.Configuration.AddEventType(typeof(ObjectArrayEvent));
                stmtText = eventRepresentationEnum.GetAnnotationText() + " select * from ObjectArrayEvent[someObjectArray@type(WordEvent)]";
                stmt     = _epService.EPAdministrator.CreateEPL(stmtText);
                stmt.AddListener(_listener);
                Assert.AreEqual("WordEvent", stmt.EventType.Name);

                var rows = new object[][] { new object[] { "this" }, new object[] { "is" }, new object[] { "collection" } };
                _epService.EPRuntime.SendEvent(new ObjectArrayEvent(rows));
                EPAssertionUtil.AssertPropsPerRow(
                    _listener.GetAndResetLastNewData(), fields,
                    new object[][]
                {
                    new object[] { "this" },
                    new object[] { "is" },
                    new object[] { "collection" }
                });
            }
            else
            {
                _epService.EPAdministrator.Configuration.AddEventType <CollectionEvent <IDictionary <string, object> > >("CollectionEvent");
                stmtText = eventRepresentationEnum.GetAnnotationText() + " select * from CollectionEvent[someCollection@type(WordEvent)]";
                stmt     = _epService.EPAdministrator.CreateEPL(stmtText);
                stmt.AddListener(_listener);
                Assert.AreEqual("WordEvent", stmt.EventType.Name);

                var coll = new List <IDictionary <string, object> >();
                coll.Add(Collections.SingletonDataMap("word", "this"));
                coll.Add(Collections.SingletonDataMap("word", "is"));
                coll.Add(Collections.SingletonDataMap("word", "collection"));

                _epService.EPRuntime.SendEvent(new CollectionEvent <IDictionary <string, object> >(coll));
                EPAssertionUtil.AssertPropsPerRowAnyOrder(
                    _listener.GetAndResetLastNewData(), fields,
                    new object[][]
                {
                    new object[] { "this" },
                    new object[] { "is" },
                    new object[] { "collection" }
                });
            }

            // invalid: event type not found
            TryInvalid("select * from SentenceEvent[splitSentence(sentence)@type(XYZ)]",
                       "Event type by name 'XYZ' could not be found [select * from SentenceEvent[splitSentence(sentence)@type(XYZ)]]");

            // invalid lib-function annotation
            TryInvalid("select * from SentenceEvent[splitSentence(sentence)@dummy(WordEvent)]",
                       "Invalid annotation for property selection, expected 'type' but found 'dummy' in text '[splitSentence(sentence)@dummy(WordEvent)]' [select * from SentenceEvent[splitSentence(sentence)@dummy(WordEvent)]]");

            // invalid type assignment to event type
            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                TryInvalid("select * from SentenceEvent[invalidSentence(sentence)@type(WordEvent)]",
                           "Event type 'WordEvent' underlying type System.Object[] cannot be assigned a value of type");
            }
            else
            {
                TryInvalid("select * from SentenceEvent[invalidSentence(sentence)@type(WordEvent)]",
                           "Event type 'WordEvent' underlying type " + Name.Of <IDictionary <string, object> >() + " cannot be assigned a value of type");
            }

            // invalid subquery
            TryInvalid("select * from SentenceEvent[splitSentence((select * from SupportBean.win:keepall()))@type(WordEvent)]",
                       "Invalid contained-event expression 'splitSentence(subselect_0)': Aggregation, sub-select, previous or prior functions are not supported in this context [select * from SentenceEvent[splitSentence((select * from SupportBean.win:keepall()))@type(WordEvent)]]");

            _epService.Initialize();
        }
Esempio n. 29
0
        private void RunAssertionSetMapProps(EventRepresentationEnum eventRepresentationEnum)
        {
            // test Update-istream with bean
            _epService.EPAdministrator.Configuration.AddEventType(
                typeof(MyMapPropEvent));
            _epService.EPAdministrator.Configuration.AddEventType(
                typeof(SupportBean));

            _epService.EPAdministrator.CreateEPL(
                "insert into MyStream select * from MyMapPropEvent");

            EPStatement stmtUpdOne = _epService.EPAdministrator.CreateEPL(
                "update istream MyStream set Props('abc') = 1, Array[2] = 10");

            stmtUpdOne.Events += _listener.Update;

            _epService.EPRuntime.SendEvent(new MyMapPropEvent());
            EPAssertionUtil.AssertProps(
                _listener.AssertPairGetIRAndReset(),
                "Props('abc'),Array[2]".Split(','),
                new Object[]
            {
                1, 10
            },
                new Object[]
            {
                null, null
            });

            // test Update-istream with map
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema MyMapType(Simple String, MyArray System.Object[], MyMap com.espertech.esper.support.util.QuickMap)");
            EPStatement stmtUpdTwo = _epService.EPAdministrator.CreateEPL(
                "Update istream MyMapType set Simple='A', MyMap('abc') = 1, MyArray[2] = 10");

            stmtUpdTwo.Events += _listener.Update;

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(
                    new Object[]
                {
                    null, new Object[10], new Dictionary <String, Object>()
                },
                    "MyMapType");
            }
            else
            {
                _epService.EPRuntime.SendEvent(
                    MakeMapEvent(new Dictionary <String, Object>(), new Object[10]),
                    "MyMapType");
            }
            EPAssertionUtil.AssertProps(
                _listener.AssertPairGetIRAndReset(),
                "Simple,MyMap('abc'),MyArray[2]".Split(','),
                new Object[]
            {
                "A", 1, 10
            },
                new Object[]
            {
                null, null, null
            });

            // test named-window Update
            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " create schema MyNWMapType(Simple String, MyArray System.Object[], MyMap com.espertech.esper.support.util.QuickMap)");
            EPStatement stmtWin = _epService.EPAdministrator.CreateEPL(
                "create window MyWindow.win:keepall() as MyNWMapType");

            _epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText()
                + " insert into MyWindow select * from MyNWMapType");

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(
                    new Object[]
                {
                    null, new Object[10], new Dictionary <String, Object>()
                },
                    "MyNWMapType");
            }
            else
            {
                _epService.EPRuntime.SendEvent(
                    MakeMapEvent(new Dictionary <String, Object>(), new Object[10]),
                    "MyNWMapType");
            }
            _epService.EPAdministrator.CreateEPL(
                "on SupportBean Update MyWindow set Simple='A', MyMap('abc') = IntPrimitive, MyArray[2] = IntPrimitive");
            _epService.EPRuntime.SendEvent(new SupportBean("E1", 10));
            EPAssertionUtil.AssertPropsPerRow(
                stmtWin.GetEnumerator(),
                "Simple,MyMap('abc'),MyArray[2]".Split(','),
                new Object[][]
            {
                new Object[]
                {
                    "A", 10, 10
                }
            });

            // test null and array too small
            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(
                    new Object[]
                {
                    null, new Object[2], null
                },
                    "MyNWMapType");
            }
            else
            {
                _epService.EPRuntime.SendEvent(MakeMapEvent(null, new Object[2]), "MyNWMapType");
            }

            _epService.EPRuntime.SendEvent(new SupportBean("E2", 20));
            EPAssertionUtil.AssertPropsPerRowAnyOrder(
                stmtWin.GetEnumerator(),
                "Simple,MyMap('abc'),MyArray[2]".Split(','), new Object[][]
            {
                new Object[]
                {
                    "A", 20, 20
                },
                new Object[]
                {
                    "A", null, null
                }
            });

            _epService.Initialize();
        }
Esempio n. 30
0
        private void RunAssertionFullJoin_2sides_multicolumn(EventRepresentationEnum eventRepresentationEnum)
        {
            String[] fields = "s0.id, s0.P00, s0.p01, s1.id, s1.p10, s1.p11, s2.id, s2.p20, s2.p21".Split(',');

            String joinStatement = eventRepresentationEnum.GetAnnotationText() + " select * from " +
                                   EVENT_S0 + ".win:length(1000) as s0 " +
                                   " full outer join " + EVENT_S1 + ".win:length(1000) as s1 on s0.P00 = s1.p10 and s0.p01 = s1.p11" +
                                   " full outer join " + EVENT_S2 + ".win:length(1000) as s2 on s0.P00 = s2.p20 and s0.p01 = s2.p21";

            EPStatement joinView = _epService.EPAdministrator.CreateEPL(joinStatement);

            joinView.Events += _updateListener.Update;

            _epService.EPRuntime.SendEvent(new SupportBean_S1(10, "A_1", "B_1"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, 10, "A_1", "B_1", null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S1(11, "A_2", "B_1"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, 11, "A_2", "B_1", null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S1(12, "A_1", "B_2"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, 12, "A_1", "B_2", null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S1(13, "A_2", "B_2"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, 13, "A_2", "B_2", null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S2(20, "A_1", "B_1"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, null, null, null, 20, "A_1", "B_1" });

            _epService.EPRuntime.SendEvent(new SupportBean_S2(21, "A_2", "B_1"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, null, null, null, 21, "A_2", "B_1" });

            _epService.EPRuntime.SendEvent(new SupportBean_S2(22, "A_1", "B_2"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, null, null, null, 22, "A_1", "B_2" });

            _epService.EPRuntime.SendEvent(new SupportBean_S2(23, "A_2", "B_2"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, null, null, null, 23, "A_2", "B_2" });

            _epService.EPRuntime.SendEvent(new SupportBean_S0(1, "A_3", "B_3"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { 1, "A_3", "B_3", null, null, null, null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S0(2, "A_1", "B_3"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { 2, "A_1", "B_3", null, null, null, null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S0(3, "A_3", "B_1"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { 3, "A_3", "B_1", null, null, null, null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S0(4, "A_2", "B_2"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { 4, "A_2", "B_2", 13, "A_2", "B_2", 23, "A_2", "B_2" });

            _epService.EPRuntime.SendEvent(new SupportBean_S0(5, "A_2", "B_1"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { 5, "A_2", "B_1", 11, "A_2", "B_1", 21, "A_2", "B_1" });

            _epService.EPRuntime.SendEvent(new SupportBean_S1(14, "A_4", "B_3"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, 14, "A_4", "B_3", null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S1(15, "A_1", "B_3"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { 2, "A_1", "B_3", 15, "A_1", "B_3", null, null, null });

            _epService.EPRuntime.SendEvent(new SupportBean_S2(24, "A_1", "B_3"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { 2, "A_1", "B_3", 15, "A_1", "B_3", 24, "A_1", "B_3" });

            _epService.EPRuntime.SendEvent(new SupportBean_S2(25, "A_2", "B_3"));
            EPAssertionUtil.AssertProps(_updateListener.AssertOneGetNewAndReset(), fields, new Object[] { null, null, null, null, null, null, 25, "A_2", "B_3" });

            _epService.EPAdministrator.DestroyAllStatements();
        }