Beispiel #1
0
            public void Run(RegressionEnvironment env)
            {
                string epl = "@public @buseventtype @JsonSchema(ClassName='" +
                             typeof(SupportUsersEvent).FullName +
                             "') create json schema Users();\n" +
                             "@Name('s0') select * from Users;";

                env.CompileDeploy(epl).AddListener("s0");

                // try sender parse-only
                EventSenderJson   sender = (EventSenderJson)env.Runtime.EventService.GetEventSender("Users");
                SupportUsersEvent users  = (SupportUsersEvent)sender.Parse(UsersJson);

                AssertUsersPremade(users);

                // try send-event
                sender.SendEvent(UsersJson);
                EventBean @event = env.Listener("s0").AssertOneGetNewAndReset();

                AssertUsersPremade((SupportUsersEvent)@event.Underlying);

                // try write
                JSONEventRenderer render = env.Runtime.RenderEventService.GetJSONRenderer(@event.EventType);

                Assert.AreEqual(UsersJsonReplaceWhitespace, render.Render(@event));

                env.UndeployAll();
            }
Beispiel #2
0
            public void Run(RegressionEnvironment env)
            {
                string epl =
                    "@public @buseventtype @JsonSchema create json schema MyEvent(p1 string);\n" +
                    "@Name('s0') select * from MyEvent;\n";

                env.CompileDeploy(epl).AddListener("s0");

                EventSenderJson sender     = (EventSenderJson)env.Runtime.EventService.GetEventSender("MyEvent");
                JsonEventObject underlying = (JsonEventObject)sender.Parse("{\"p1\": \"abc\"}");

                sender.SendEvent(underlying);
                env.Listener("s0").AssertInvokedAndReset();

                env.UndeployAll();
            }