public static string GetOutputTypeCreateSchemaName(this EventRepresentationChoice enumValue)
        {
            switch (enumValue)
            {
            case EventRepresentationChoice.ARRAY:
                return(" objectarray");

            case EventRepresentationChoice.MAP:
                return(" map");

            case EventRepresentationChoice.AVRO:
                return(" avro");

            case EventRepresentationChoice.DEFAULT:
                return("");
            }

            throw new ArgumentException("invalid value for enumValue", "enumValue");
        }
        public static string GetOutputTypeClassName(this EventRepresentationChoice enumValue)
        {
            switch (enumValue)
            {
            case EventRepresentationChoice.ARRAY:
                return(EventUnderlyingType.OBJECTARRAY.GetUnderlyingClassName());

            case EventRepresentationChoice.MAP:
                return(EventUnderlyingType.MAP.GetUnderlyingClassName());

            case EventRepresentationChoice.AVRO:
                return(EventUnderlyingType.AVRO.GetUnderlyingClassName());

            case EventRepresentationChoice.DEFAULT:
                return(EventUnderlyingTypeExtensions.GetDefault().GetUnderlyingClassName());
            }

            throw new ArgumentException("invalid value for enumValue", "enumValue");
        }
        public static string GetAnnotationText(this EventRepresentationChoice enumValue)
        {
            switch (enumValue)
            {
            case EventRepresentationChoice.ARRAY:
                return("@EventRepresentation('objectarray')");

            case EventRepresentationChoice.MAP:
                return("@EventRepresentation('map')");

            case EventRepresentationChoice.AVRO:
                return("@EventRepresentation('avro')");

            case EventRepresentationChoice.DEFAULT:
                return("");
            }

            throw new ArgumentException("invalid value for enumValue", "enumValue");
        }
Exemple #4
0
        private static void RunAssertPopulateFromNamedWindow(
            RegressionEnvironment env,
            EventRepresentationChoice type)
        {
            var path = new RegressionPath();
            var schemaEPL = type.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedNode>() + "create schema Node(nid string)";
            env.CompileDeployWBusPublicType(schemaEPL, path);

            env.CompileDeploy("create window NodeWindow#unique(nid) as Node", path);
            env.CompileDeploy("insert into NodeWindow select * from Node", path);
            env.CompileDeploy(
                type.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedNodePlus>() + "create schema NodePlus(npid string, node Node)",
                path);
            env.CompileDeploy("@Name('s0') insert into NodePlus select 'E1' as npid, n1 as node from NodeWindow n1", path).AddListener("s0");

            if (type.IsObjectArrayEvent()) {
                env.SendEventObjectArray(new object[] {"n1"}, "Node");
            }
            else if (type.IsMapEvent()) {
                env.SendEventMap(Collections.SingletonDataMap("nid", "n1"), "Node");
            }
            else if (type.IsAvroEvent()) {
                var genericRecord = new GenericRecord(SchemaBuilder.Record("name", RequiredString("nid")));
                genericRecord.Put("nid", "n1");
                env.SendEventAvro(genericRecord, "Node");
            }
            else if (type.IsJsonEvent() || type.IsJsonProvidedClassEvent()) {
                var @object = new JObject();
                @object.Add("nid", "n1");
                env.SendEventJson(@object.ToString(), "Node");
            }
            else {
                Assert.Fail();
            }

            var @event = env.Listener("s0").AssertOneGetNewAndReset();
            Assert.AreEqual("E1", @event.Get("npid"));
            Assert.AreEqual("n1", @event.Get("node.nid"));
            var fragment = (EventBean) @event.GetFragment("node");
            Assert.AreEqual("Node", fragment.EventType.Name);

            env.UndeployAll();
        }
Exemple #5
0
 private static void MakeSendScoreEvent(
     RegressionEnvironment env,
     string typeName,
     EventRepresentationChoice eventRepresentationEnum,
     string userId,
     string keyword,
     string productId,
     long score)
 {
     if (eventRepresentationEnum.IsMapEvent()) {
         IDictionary<string, object> theEvent = new LinkedHashMap<string, object>();
         theEvent.Put("UserId", userId);
         theEvent.Put("Keyword", keyword);
         theEvent.Put("ProductId", productId);
         theEvent.Put("Score", score);
         env.SendEventMap(theEvent, typeName);
     }
     else if (eventRepresentationEnum.IsObjectArrayEvent()) {
         env.SendEventObjectArray(new object[] {userId, keyword, productId, score}, typeName);
     }
     else if (eventRepresentationEnum.IsAvroEvent()) {
         var record = new GenericRecord(
             SupportAvroUtil.GetAvroSchema(env.Runtime.EventTypeService.GetEventTypePreconfigured(typeName))
                 .AsRecordSchema());
         record.Put("UserId", userId);
         record.Put("Keyword", keyword);
         record.Put("ProductId", productId);
         record.Put("Score", score);
         env.SendEventAvro(record, typeName);
     }
     else if (eventRepresentationEnum.IsJsonEvent() || eventRepresentationEnum.IsJsonProvidedClassEvent()) {
         var jobject = new JObject();
         jobject.Add("UserId", userId);
         jobject.Add("Keyword", keyword);
         jobject.Add("ProductId", productId);
         jobject.Add("Score", score);
         env.SendEventJson(jobject.ToString(), typeName);
     }
     else {
         Assert.Fail();
     }
 }
Exemple #6
0
        private static void RunAssertionCreateStream(
            RegressionEnvironment env,
            EventRepresentationChoice representation)
        {
            var epl = representation.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedMyEvent>() +
                      " create schema MyEvent(myId int);\n" +
                      representation.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedCompositeEvent>() +
                      " create schema CompositeEvent(c1 MyEvent, c2 MyEvent, rule string);\n" +
                      "insert into MyStream select c, 'additionalValue' as value from MyEvent c;\n" +
                      "insert into CompositeEvent select e1.c as c1, e2.c as c2, '4' as rule " +
                      "  from pattern [e1=MyStream -> e2=MyStream];\n" +
                      representation.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedCompositeEvent>() +
                      " @Name('Target') select * from CompositeEvent;\n";
            env.CompileDeployWBusPublicType(epl, new RegressionPath()).AddListener("Target");

            if (representation.IsObjectArrayEvent()) {
                env.SendEventObjectArray(MakeEvent(10).Values.ToArray(), "MyEvent");
                env.SendEventObjectArray(MakeEvent(11).Values.ToArray(), "MyEvent");
            }
            else if (representation.IsMapEvent()) {
                env.SendEventMap(MakeEvent(10), "MyEvent");
                env.SendEventMap(MakeEvent(11), "MyEvent");
            }
            else if (representation.IsAvroEvent()) {
                env.SendEventAvro(MakeEventAvro(10), "MyEvent");
                env.SendEventAvro(MakeEventAvro(11), "MyEvent");
            }
            else if (representation.IsJsonEvent() || representation.IsJsonProvidedClassEvent()) {
                env.SendEventJson("{\"myId\": 10}", "MyEvent");
                env.SendEventJson("{\"myId\": 11}", "MyEvent");
            }
            else {
                Assert.Fail();
            }

            var theEvent = env.Listener("Target").AssertOneGetNewAndReset();
            Assert.AreEqual(10, theEvent.Get("c1.myId"));
            Assert.AreEqual(11, theEvent.Get("c2.myId"));
            Assert.AreEqual("4", theEvent.Get("rule"));

            env.UndeployAll();
        }
        private void RunAssertionEventTypeColumnDef(EPServiceProvider epService, EventRepresentationChoice eventRepresentationEnum)
        {
            EPStatement stmtSchema = epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema SchemaOne(col1 int, col2 int)");

            Assert.IsTrue(eventRepresentationEnum.MatchesClass(stmtSchema.EventType.UnderlyingType));

            EPStatement stmt = epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window SchemaWindow#lastevent as (s1 SchemaOne)");

            Assert.IsTrue(eventRepresentationEnum.MatchesClass(stmt.EventType.UnderlyingType));
            var listenerWindow = new SupportUpdateListener();

            stmt.Events += listenerWindow.Update;
            epService.EPAdministrator.CreateEPL("insert into SchemaWindow (s1) select sone from SchemaOne as sone");

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(new object[] { 10, 11 }, "SchemaOne");
            }
            else if (eventRepresentationEnum.IsMapEvent())
            {
                var theEvent = new LinkedHashMap <string, object>();
                theEvent.Put("col1", 10);
                theEvent.Put("col2", 11);
                epService.EPRuntime.SendEvent(theEvent, "SchemaOne");
            }
            else if (eventRepresentationEnum.IsAvroEvent())
            {
                var theEvent = new GenericRecord(SupportAvroUtil.GetAvroSchema(epService, "SchemaOne").AsRecordSchema());
                theEvent.Put("col1", 10);
                theEvent.Put("col2", 11);
                epService.EPRuntime.SendEventAvro(theEvent, "SchemaOne");
            }
            else
            {
                Assert.Fail();
            }
            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);
        }
        private void RunAssertionCreateStreamTwo(EventRepresentationChoice 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 bool)");
            epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema SuspectMyEvent as (myEvent MyEvent, class string)");

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

            stmtOne.AddListener(listener);
            Assert.IsTrue(eventRepresentationEnum.MatchesClass(stmtOne.EventType.UnderlyingType));

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

            stmtTwo.AddListener(listenerTwo);

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(MakeEvent(1).Values.ToArray(), "MyEvent");
            }
            else if (eventRepresentationEnum.IsMapEvent())
            {
                epService.EPRuntime.SendEvent(MakeEvent(1), "MyEvent");
            }
            else if (eventRepresentationEnum.IsAvroEvent())
            {
                epService.EPRuntime.SendEventAvro(MakeEventAvro(1), "MyEvent");
            }
            else
            {
                Assert.Fail();
            }

            AssertCreateStreamTwo(eventRepresentationEnum, listener.AssertOneGetNewAndReset(), stmtOne);
            AssertCreateStreamTwo(eventRepresentationEnum, listenerTwo.AssertOneGetNewAndReset(), stmtTwo);

            epService.Initialize();
        }
        private static void TryAssertionInheritance(
            RegressionEnvironment env,
            EventRepresentationChoice eventRepresentationEnum)
        {
            string epl = eventRepresentationEnum.GetAnnotationText() + " create schema BaseEvent as (b1 string);\n";

            epl += eventRepresentationEnum.GetAnnotationText() + " create schema SubEvent as (s1 string) inherits BaseEvent;\n";
            epl += eventRepresentationEnum.GetAnnotationText() + " create schema OuterEvent as (bases BaseEvent[], subs SubEvent[]);\n";
            epl += eventRepresentationEnum.GetAnnotationText() + " @name('s0') select bases.union(subs) as val from OuterEvent;\n";
            env.CompileDeployWBusPublicType(epl, new RegressionPath()).AddListener("s0");

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                env.SendEventObjectArray(
                    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 IDictionary <string, object>[] { baseEvent },
                    "subs",
                    new IDictionary <string, object>[] { subEvent });
                env.SendEventMap(outerEvent, "OuterEvent");
            }

            var result = env.Listener("s0").AssertOneGetNewAndReset().Get("val").Unwrap <object>();

            Assert.AreEqual(2, result.Count);

            env.UndeployAll();
        }
Exemple #10
0
        public void RunAssertionSplitPremptiveNamedWindow(EventRepresentationChoice 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#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 if (eventRepresentationEnum.IsMapEvent())
            {
                _epService.EPRuntime.GetEventSender("TypeTrigger").SendEvent(new Dictionary <string, object>());
            }
            else if (eventRepresentationEnum.IsAvroEvent())
            {
                var @event = new GenericRecord(SchemaBuilder.Record("name", TypeBuilder.OptionalInt("trigger")));
                _epService.EPRuntime.GetEventSender("TypeTrigger").SendEvent(@event);
            }
            else
            {
                Assert.Fail();
            }

            Assert.AreEqual(2, _listener.AssertOneGetNewAndReset().Get("col2"));
            _epService.Initialize();
        }
        private void TryAssertionNamedWindow(EPServiceProvider epService, EventRepresentationChoice eventRepresentationEnum)
        {
            var fields = "key,value".Split(',');
            var subscriberNamedWindow = new SubscriberMap();
            var stmtTextCreate        = eventRepresentationEnum.GetAnnotationText() + " create window MyWindow#keepall as select TheString as key, IntPrimitive as value from SupportBean";
            var stmt = epService.EPAdministrator.CreateEPL(stmtTextCreate);

            stmt.Subscriber = subscriberNamedWindow;

            var subscriberInsertInto = new SubscriberFields();
            var 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
            var subscriberDelete = new SubscriberMap();
            var 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
            var subscriberSelect = new SubscriberMap();
            var 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 });

            epService.EPAdministrator.DestroyAllStatements();
        }
Exemple #12
0
        public void RunAssertionInheritance(EventRepresentationChoice 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();
        }
Exemple #13
0
        private void RunAssertionCreateSchemaWTypes<T>(
            RegressionEnvironment env,
            EventRepresentationChoice eventRepresentationEnum,
            string typeOfDatetimeProp,
            object startA,
            object endA,
            object startB,
            object endB)
        {
            var epl = eventRepresentationEnum.GetAnnotationTextWJsonProvided<T>() + " create schema TypeA as (startts " + typeOfDatetimeProp + ", endts " + typeOfDatetimeProp + ") starttimestamp startts endtimestamp endts;\n";
            epl += eventRepresentationEnum.GetAnnotationTextWJsonProvided<T>() + " create schema TypeB as (startts " + typeOfDatetimeProp + ", endts " + typeOfDatetimeProp + ") starttimestamp startts endtimestamp endts;\n";
            epl += "@Name('s0') select a.includes(b) as val0 from TypeA#lastevent as a, TypeB#lastevent as b;\n";
            env.CompileDeployWBusPublicType(epl, new RegressionPath()).AddListener("s0");

            MakeSendEvent(env, "TypeA", eventRepresentationEnum, startA, endA);
            MakeSendEvent(env, "TypeB", eventRepresentationEnum, startB, endB);
            Assert.AreEqual(true, env.Listener("s0").AssertOneGetNewAndReset().Get("val0"));

            env.UndeployAll();
        }
        private void TryAssertionInnerJoinLateStart(EPServiceProvider epService, EventRepresentationChoice eventRepresentationEnum)
        {
            EPStatement stmtOne = epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema Product (product string, size int)");

            Assert.IsTrue(eventRepresentationEnum.MatchesClass(stmtOne.EventType.UnderlyingType));
            epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema Portfolio (portfolio string, product string)");
            EPStatement stmtTwo = epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window ProductWin#keepall as Product");

            Assert.IsTrue(eventRepresentationEnum.MatchesClass(stmtTwo.EventType.UnderlyingType));

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

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

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

            stmt.Events += listener.Update;

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

            SendPortfolio(epService, eventRepresentationEnum, "Portfolio", "productC");
            listener.Reset();

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

            epService.EPAdministrator.DestroyAllStatements();
            foreach (string name in "Product,Portfolio,ProductWin,PortfolioWin".Split(','))
            {
                epService.EPAdministrator.Configuration.RemoveEventType(name, true);
            }
        }
Exemple #15
0
        private void RunAssertionScoringUseCase(EventRepresentationChoice 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#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();
        }
Exemple #16
0
            private void TryAssertionCreateSchemaModelAfter(
                RegressionEnvironment env,
                EventRepresentationChoice eventRepresentationEnum)
            {
                var epl =
                    eventRepresentationEnum.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedEventTypeOne>() +
                    " create schema EventTypeOne (hsi int);\n" +
                    eventRepresentationEnum.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedEventTypeTwo>() +
                    " create schema EventTypeTwo (event EventTypeOne);\n" +
                    "@Name('create') create window NamedWindow#unique(event.hsi) as EventTypeTwo;\n" +
                    "on EventTypeOne as ev insert into NamedWindow select ev as event;\n";
                env.CompileDeployWBusPublicType(epl, new RegressionPath());

                if (eventRepresentationEnum.IsObjectArrayEvent()) {
                    env.SendEventObjectArray(new object[] {10}, "EventTypeOne");
                }
                else if (eventRepresentationEnum.IsMapEvent()) {
                    env.SendEventMap(Collections.SingletonDataMap("hsi", 10), "EventTypeOne");
                }
                else if (eventRepresentationEnum.IsAvroEvent()) {
                    var theEvent = new GenericRecord(
                        SupportAvroUtil
                            .GetAvroSchema(env.Runtime.EventTypeService.GetEventTypePreconfigured("EventTypeOne"))
                            .AsRecordSchema());
                    theEvent.Put("hsi", 10);
                    env.EventService.SendEventAvro(theEvent, "EventTypeOne");
                }
                else if (eventRepresentationEnum.IsJsonEvent() || eventRepresentationEnum.IsJsonProvidedClassEvent()) {
                    env.EventService.SendEventJson("{\"hsi\": 10}", "EventTypeOne");
                }
                else {
                    Assert.Fail();
                }

                var result = env.Statement("create").First();
                var getter = result.EventType.GetGetter("event.hsi");
                Assert.AreEqual(10, getter.Get(result));

                env.UndeployAll();
            }
 private void SendSentenceEvent(EventRepresentationChoice eventRepresentationEnum, string sentence)
 {
     if (eventRepresentationEnum.IsObjectArrayEvent())
     {
         _epService.EPRuntime.SendEvent(new Object[] { sentence }, "SentenceEvent");
     }
     else if (eventRepresentationEnum.IsMapEvent())
     {
         _epService.EPRuntime.SendEvent(Collections.SingletonDataMap("sentence", sentence), "SentenceEvent");
     }
     else if (eventRepresentationEnum.IsAvroEvent())
     {
         var schema = SchemaBuilder.Record("sentence", TypeBuilder.RequiredString("sentence"));
         var record = new GenericRecord(schema);
         record.Put("sentence", sentence);
         _epService.EPRuntime.SendEventAvro(record, "SentenceEvent");
     }
     else
     {
         throw new IllegalStateException("Unrecognized enum " + eventRepresentationEnum);
     }
 }
Exemple #18
0
        private void RunAssertionCSVGraphSchema(EventRepresentationChoice representationEnum)
        {
            var fields = "MyString,MyInt,timestamp, MyDouble".SplitCsv();

            CompileDeploy(
                runtime,
                representationEnum.GetAnnotationText() +
                " @public @buseventtype create schema MyEvent(MyString string, MyInt int, timestamp long, MyDouble double)");
            var graph = "create dataflow ReadCSV " +
                        "FileSource -> mystream<MyEvent> {" +
                        " file: '../../../etc/regression/titleRow.csv'," +
                        " hasHeaderLine: true " +
                        "}" +
                        "DefaultSupportCaptureOp(mystream) {}";
            var deployment = CompileDeploy(runtime, graph);

            var outputOp = new DefaultSupportCaptureOp();
            var instance = runtime.DataFlowService.Instantiate(
                deployment.DeploymentId,
                "ReadCSV",
                new EPDataFlowInstantiationOptions().WithOperatorProvider(new DefaultSupportGraphOpProvider(outputOp)));

            instance.Run();
            var received = outputOp.GetAndReset();

            Assert.AreEqual(1, received.Count);
            EPAssertionUtil.AssertPropsPerRow(
                container,
                received[0].ToArray(),
                fields,
                new object[][] {
                new object[] { "one", 1, 100L, 1.1 },
                new object[] { "three", 3, 300L, 3.3 },
                new object[] { "five", 5, 500L, 5.5 }
            });
            Assert.IsTrue(representationEnum.MatchesClass(received[0].ToArray()[0].GetType()));

            UndeployAll(runtime);
        }
        private void RunAssertionStreamInsertWWidenMap(EventRepresentationChoice rep)
        {
            EPServiceProvider epService = EPServiceProviderManager.GetDefaultProvider();

            epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema Src as (myint int, mystr string)");

            epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema D1 as (myint int, mystr string, addprop long)");
            var eplOne = "insert into D1 select 1 as addprop, mysrc.* from Src as mysrc";

            RunStreamInsertAssertion(rep, eplOne, "myint,mystr,addprop", new Object[] { 123, "abc", 1L });

            epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema D2 as (mystr string, myint int, addprop double)");
            var eplTwo = "insert into D2 select 1 as addprop, mysrc.* from Src as mysrc";

            RunStreamInsertAssertion(rep, eplTwo, "myint,mystr,addprop", new Object[] { 123, "abc", 1d });

            epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema D3 as (mystr string, addprop int)");
            var eplThree = "insert into D3 select 1 as addprop, mysrc.* from Src as mysrc";

            RunStreamInsertAssertion(rep, eplThree, "mystr,addprop", new Object[] { "abc", 1 });

            epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema D4 as (myint int, mystr string)");
            var eplFour = "insert into D4 select mysrc.* from Src as mysrc";

            RunStreamInsertAssertion(rep, eplFour, "myint,mystr", new Object[] { 123, "abc" });

            var eplFive = "insert into D4 select mysrc.*, 999 as myint, 'xxx' as mystr from Src as mysrc";

            RunStreamInsertAssertion(rep, eplFive, "myint,mystr", new Object[] { 999, "xxx" });
            var eplSix = "insert into D4 select 999 as myint, 'xxx' as mystr, mysrc.* from Src as mysrc";

            RunStreamInsertAssertion(rep, eplSix, "myint,mystr", new Object[] { 999, "xxx" });

            epService.EPAdministrator.DestroyAllStatements();
            foreach (string name in  new[] { "Src", "D1", "D2", "D3", "D4" })
            {
                epService.EPAdministrator.Configuration.RemoveEventType(name, false);
            }
        }
Exemple #20
0
        private void RunAssertionBindMap(EventRepresentationChoice eventRepresentationEnum, SupportSubscriberMultirowMapBase subscriber)
        {
            var stmtText = eventRepresentationEnum.GetAnnotationText() + " select irstream TheString, IntPrimitive from " + typeof(SupportBean).FullName + "#length_batch(2)";
            var stmt     = _epService.EPAdministrator.CreateEPL(stmtText);

            stmt.Subscriber = subscriber;
            Assert.IsTrue(eventRepresentationEnum.MatchesClass(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();
        }
        private void RunStreamInsertAssertion(EventRepresentationChoice rep, string epl, string fields, Object[] expected)
        {
            var stmt = _epService.EPAdministrator.CreateEPL(epl);

            stmt.AddListener(_listener);
            if (rep.IsMapEvent())
            {
                _epService.EPRuntime.SendEvent(MakeMap(123, "abc"), "Src");
            }
            else if (rep.IsObjectArrayEvent())
            {
                _epService.EPRuntime.SendEvent(new Object[] { 123, "abc" }, "Src");
            }
            else if (rep.IsAvroEvent())
            {
                GenericRecord @event = new GenericRecord(SupportAvroUtil.GetAvroSchema(_epService, "Src").AsRecordSchema());
                @event.Put("myint", 123);
                @event.Put("mystr", "abc");
                _epService.EPRuntime.SendEventAvro(@event, "Src");
            }
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields.SplitCsv(), expected);
            stmt.Dispose();
        }
        private void RunAssertionInvalid(EventRepresentationChoice rep)
        {
            _epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema Src as (myint int, mystr string)");

            // mismatch in type
            _epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema E1 as (myint long)");
            var message = !rep.IsAvroEvent() ?
                          "Error starting statement: Type by name 'E1' in property 'myint' expected " + Name.Of <int>() + " but receives " + Name.Of <long>() :
                          "Error starting statement: Type by name 'E1' in property 'myint' expected schema '{\"type\":\"long\"}' but received schema '{\"type\":\"int\"}'";

            SupportMessageAssertUtil.TryInvalid(_epService, "insert into E1 select mysrc.* from Src as mysrc", message);

            // mismatch in column name
            _epService.EPAdministrator.CreateEPL("create " + rep.GetOutputTypeCreateSchemaName() + " schema E2 as (someprop long)");
            SupportMessageAssertUtil.TryInvalid(_epService, "insert into E2 select mysrc.*, 1 as otherprop from Src as mysrc",
                                                "Error starting statement: Failed to find column 'otherprop' in target type 'E2' [insert into E2 select mysrc.*, 1 as otherprop from Src as mysrc]");

            _epService.EPAdministrator.DestroyAllStatements();
            foreach (string name in new[] { "Src", "E1", "E2" })
            {
                _epService.EPAdministrator.Configuration.RemoveEventType(name, false);
            }
        }
        private void TryAssertionCreateSchemaModelAfter(EPServiceProvider epService, EventRepresentationChoice eventRepresentationEnum)
        {
            epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema EventTypeOne (hsi int)");
            epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema EventTypeTwo (event EventTypeOne)");
            EPStatement stmt = epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window NamedWindow#unique(event.hsi) as EventTypeTwo");

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

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(new object[] { 10 }, "EventTypeOne");
            }
            else if (eventRepresentationEnum.IsMapEvent())
            {
                epService.EPRuntime.SendEvent(Collections.SingletonDataMap("hsi", 10), "EventTypeOne");
            }
            else if (eventRepresentationEnum.IsAvroEvent())
            {
                var theEvent = new GenericRecord(SupportAvroUtil.GetAvroSchema(epService, "EventTypeOne").AsRecordSchema());
                theEvent.Put("hsi", 10);
                epService.EPRuntime.SendEventAvro(theEvent, "EventTypeOne");
            }
            else
            {
                Assert.Fail();
            }
            EventBean           result = stmt.First();
            EventPropertyGetter getter = result.EventType.GetGetter("event.hsi");

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

            epService.EPAdministrator.DestroyAllStatements();
            foreach (string name in "EventTypeOne,EventTypeTwo,NamedWindow".Split(','))
            {
                epService.EPAdministrator.Configuration.RemoveEventType(name, true);
            }
        }
        private void RunAssertionCreateStream(EventRepresentationChoice 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").AddListener(listener);

            if (eventRepresentationEnum.IsObjectArrayEvent())
            {
                epService.EPRuntime.SendEvent(MakeEvent(10).Values.ToArray(), "MyEvent");
                epService.EPRuntime.SendEvent(MakeEvent(11).Values.ToArray(), "MyEvent");
            }
            else if (eventRepresentationEnum.IsMapEvent())
            {
                epService.EPRuntime.SendEvent(MakeEvent(10), "MyEvent");
                epService.EPRuntime.SendEvent(MakeEvent(11), "MyEvent");
            }
            else if (eventRepresentationEnum.IsAvroEvent())
            {
                epService.EPRuntime.SendEventAvro(MakeEventAvro(10), "MyEvent");
                epService.EPRuntime.SendEventAvro(MakeEventAvro(11), "MyEvent");
            }
            else
            {
                Assert.Fail();
            }
            EventBean 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();
        }
Exemple #25
0
        private static void TryAssertionStreamInsertWWidenMap(
            RegressionEnvironment env,
            EventRepresentationChoice rep)
        {
            RegressionPath path = new RegressionPath();
            string schemaSrc = rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedSrc>() +
                               "@Name('schema') create schema Src as (myint int, mystr string)";
            env.CompileDeployWBusPublicType(schemaSrc, path);

            env.CompileDeploy(
                rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedD1>() + "create schema D1 as (myint int, mystr string, addprop long)",
                path);
            string eplOne = "insert into D1 select 1 as addprop, mysrc.* from Src as mysrc";
            RunStreamInsertAssertion(env, path, rep, eplOne, "myint,mystr,addprop", new object[] {123, "abc", 1L});

            env.CompileDeploy(
                rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedD2>() + "create schema D2 as (mystr string, myint int, addprop double)",
                path);
            string eplTwo = "insert into D2 select 1 as addprop, mysrc.* from Src as mysrc";
            RunStreamInsertAssertion(env, path, rep, eplTwo, "myint,mystr,addprop", new object[] {123, "abc", 1d});

            env.CompileDeploy(rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedD3>() + "create schema D3 as (mystr string, addprop int)", path);
            string eplThree = "insert into D3 select 1 as addprop, mysrc.* from Src as mysrc";
            RunStreamInsertAssertion(env, path, rep, eplThree, "mystr,addprop", new object[] {"abc", 1});

            env.CompileDeploy(rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedD4>() + "create schema D4 as (myint int, mystr string)", path);
            string eplFour = "insert into D4 select mysrc.* from Src as mysrc";
            RunStreamInsertAssertion(env, path, rep, eplFour, "myint,mystr", new object[] {123, "abc"});

            string eplFive = "insert into D4 select mysrc.*, 999 as myint, 'xxx' as mystr from Src as mysrc";
            RunStreamInsertAssertion(env, path, rep, eplFive, "myint,mystr", new object[] {999, "xxx"});
            string eplSix = "insert into D4 select 999 as myint, 'xxx' as mystr, mysrc.* from Src as mysrc";
            RunStreamInsertAssertion(env, path, rep, eplSix, "myint,mystr", new object[] {999, "xxx"});

            env.UndeployAll();
        }
Exemple #26
0
        private static void TryAssertionInvalid(
            RegressionEnvironment env,
            EventRepresentationChoice rep)
        {
            RegressionPath path = new RegressionPath();
            env.CompileDeploy(rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedSrc>() + "create schema Src as (myint int, mystr string)", path);

            // mismatch in type
            env.CompileDeploy(rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedE1>() + "create schema E1 as (myint long)", path);
            string message = !rep.IsAvroEvent()
                ? "Type by name 'E1' in property 'myint' expected System.Nullable<System.Int32> but receives System.Nullable<System.Int64>"
                : "Type by name 'E1' in property 'myint' expected schema '{\"type\":\"long\"}' but received schema '{\"type\":\"int\"}'";
            SupportMessageAssertUtil.TryInvalidCompile(env, path, "insert into E1 select mysrc.* from Src as mysrc", message);

            // mismatch in column name
            env.CompileDeploy(rep.GetAnnotationTextWJsonProvided<MyLocalJsonProvidedE2>() + "create schema E2 as (someprop long)", path);
            SupportMessageAssertUtil.TryInvalidCompile(
                env,
                path,
                "insert into E2 select mysrc.*, 1 as otherprop from Src as mysrc",
                "Failed to find column 'otherprop' in target type 'E2' [insert into E2 select mysrc.*, 1 as otherprop from Src as mysrc]");

            env.UndeployAll();
        }
Exemple #27
0
        private static void RunStreamInsertAssertion(
            RegressionEnvironment env,
            RegressionPath path,
            EventRepresentationChoice rep,
            string epl,
            string fields,
            object[] expected)
        {
            env.CompileDeploy("@Name('s0') " + epl, path).AddListener("s0");

            if (rep.IsMapEvent()) {
                env.SendEventMap(MakeMap(123, "abc"), "Src");
            }
            else if (rep.IsObjectArrayEvent()) {
                env.SendEventObjectArray(new object[] {123, "abc"}, "Src");
            }
            else if (rep.IsAvroEvent()) {
                var eventType = env.Runtime.EventTypeService.GetEventType(env.DeploymentId("schema"), "Src");
                var @event = new GenericRecord(SupportAvroUtil.GetAvroSchema(eventType).AsRecordSchema());
                @event.Put("myint", 123);
                @event.Put("mystr", "abc");
                env.SendEventAvro(@event, "Src");
            }
            else if (rep.IsJsonEvent() || rep.IsJsonProvidedClassEvent()) {
                JObject @object = new JObject();
                @object.Add("myint", 123);
                @object.Add("mystr", "abc");
                env.SendEventJson(@object.ToString(), "Src");
            }
            else {
                Assert.Fail();
            }

            EPAssertionUtil.AssertProps(env.Listener("s0").AssertOneGetNewAndReset(), fields.SplitCsv(), expected);
            env.UndeployModuleContaining("s0");
        }
Exemple #28
0
        private void TryAssertionWidening(
            EPServiceProvider epService,
            EventRepresentationChoice eventRepresentationEnum,
            SupportSubscriberRowByRowSpecificBase subscriber)
        {
            EPStatement stmt = epService.EPAdministrator.CreateEPL(
                eventRepresentationEnum.GetAnnotationText() +
                " select bytePrimitive, IntPrimitive, LongPrimitive, FloatPrimitive from SupportBean(TheString='E1')");

            stmt.Subscriber = subscriber;
            Assert.IsTrue(eventRepresentationEnum.MatchesClass(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();
        }
Exemple #29
0
        private void RunAssertionInnerJoinLateStart(EventRepresentationChoice eventRepresentationEnum)
        {
            var stmtOne = _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create schema Product (product string, size int)");

            Assert.IsTrue(eventRepresentationEnum.MatchesClass(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#keepall as Product");

            Assert.IsTrue(eventRepresentationEnum.MatchesClass(stmtTwo.EventType.UnderlyingType));

            _epService.EPAdministrator.CreateEPL("insert into ProductWin select * from Product");
            _epService.EPAdministrator.CreateEPL(eventRepresentationEnum.GetAnnotationText() + " create window PortfolioWin#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();
        }
 public EPLInsertIntoTypableAndCaseNew(EventRepresentationChoice representation)
 {
     this.representation = representation;
 }