Ejemplo n.º 1
0
        private static void RunAssertion(
            RegressionEnvironment env,
            RegressionPath path,
            EPStage stage,
            string typename,
            object underlying,
            Consumer <EPEventService> sender)
        {
            string epl = "@public @buseventtype create schema TriggerEvent();\n" +
                         "@public @buseventtype @name('schema') create json schema " +
                         JSON_TYPENAME +
                         "();\n" +
                         "@Name('trigger') select * from TriggerEvent;\n" +
                         "@Name('s0') select * from " +
                         typename +
                         ";\n";

            env.CompileDeploy(epl, path).AddListener("s0");
            string deploymentId = env.DeploymentId("s0");

            StageIt(env, "ST", deploymentId);

            // test normal send
            sender.Invoke(stage.EventService);
            AssertUnderlying(env, typename, underlying);

            // test EventSender#send
            EventSender eventSender = stage.EventService.GetEventSender(typename);

            eventSender.SendEvent(underlying);
            AssertUnderlying(env, typename, underlying);

            // test EventSender#route
            GetStatement("trigger", "ST", env.Runtime).Events += (_, args) => { eventSender.RouteEvent(underlying); };
            stage.EventService.SendEventMap(new Dictionary <string, object>(), "TriggerEvent");
            AssertUnderlying(env, typename, underlying);

            UnstageIt(env, "ST", deploymentId);

            path.Clear();
            env.UndeployModuleContaining("s0");
        }