Esempio n. 1
0
        private static void TryOptimizableEquals(
            RegressionEnvironment env,
            RegressionPath path,
            string epl,
            int numStatements)
        {
            // test function returns lookup value and "Equals"
            for (int i = 0; i < numStatements; i++) {
                string text = "@Name('s" + i + "') " + epl.Replace("!NUM!", i.ToString());
                env.CompileDeploy(text, path).AddListener("s" + i);
            }

            env.Milestone(0);

            var loops = 1000;
            var delta = PerformanceObserver.TimeMillis(
                () => {
                    SupportStaticMethodLib.ResetCountInvoked();
                    for (int i = 0; i < loops; i++) {
                        env.SendEventBean(new SupportBean("E_" + i % numStatements, 0));
                        SupportListener listener = env.Listener("s" + i % numStatements);
                        Assert.IsTrue(listener.GetAndClearIsInvoked());
                    }
                });

            Assert.AreEqual(loops, SupportStaticMethodLib.CountInvoked);

            Assert.IsTrue(delta < 1000, "Delta is " + delta);
            env.UndeployAll();
        }
Esempio n. 2
0
            public void Run(RegressionEnvironment env)
            {
                env.AdvanceTime(0);

                string epl = "@Name('s0') select irstream * from SupportBean#time(10)";

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

                env.SendEventBean(new SupportBean("E1", 1));

                env.AdvanceTime(2000);
                env.SendEventBean(new SupportBean("E2", 2));

                env.AdvanceTime(4000);
                env.SendEventBean(new SupportBean("E3", 3));
                env.Listener("s0").Reset();

                env.Milestone(0);

                env.StageService.GetStage("P1");
                StageIt(env, "P1", deploymentId);

                env.Milestone(1);

                env.AdvanceTimeStage("P1", 9999);
                Assert.IsFalse(env.ListenerStage("P1", "s0").GetAndClearIsInvoked());
                env.AdvanceTimeStage("P1", 10000);
                Assert.AreEqual("E1", env.ListenerStage("P1", "s0").AssertOneGetOldAndReset().Get("TheString"));

                env.Milestone(2);

                env.AdvanceTimeStage("P1", 11999);
                Assert.IsFalse(env.ListenerStage("P1", "s0").GetAndClearIsInvoked());
                env.AdvanceTimeStage("P1", 12000);
                Assert.AreEqual("E2", env.ListenerStage("P1", "s0").AssertOneGetOldAndReset().Get("TheString"));

                env.AdvanceTime(12000);
                Assert.IsFalse(env.ListenerStage("P1", "s0").GetAndClearIsInvoked());

                UnstageIt(env, "P1", deploymentId);

                env.Milestone(3);

                env.AdvanceTime(13999);
                env.AdvanceTimeStage("P1", 14000);
                SupportListener listener = env.Listener("s0");

                Assert.IsFalse(listener.GetAndClearIsInvoked());
                env.AdvanceTime(14000);
                Assert.AreEqual("E3", env.Listener("s0").AssertOneGetOldAndReset().Get("TheString"));

                env.UndeployAll();
            }
Esempio n. 3
0
        private static void RunAssertionSimple(
            RegressionEnvironment env,
            string epl)
        {
            env.CompileDeploy(epl).AddListener("s0");
            string deploymentId = env.DeploymentId("s0");

            SendEvent(env, null, "E1", 10);
            AssertTotal(env, null, 10);

            env.Milestone(0);

            env.StageService.GetStage("P1");
            StageIt(env, "P1", deploymentId);

            env.Milestone(1);

            Assert.IsNull(env.Deployment.GetDeployment(deploymentId));
            Assert.IsNotNull(env.StageService.GetExistingStage("P1").DeploymentService.GetDeployment(deploymentId));
            AssertEqualsAnyOrder(new string[] { deploymentId }, env.StageService.GetExistingStage("P1").DeploymentService.Deployments);
            SendEvent(env, null, "E3", 21);
            SendEvent(env, "P1", "E4", 22);
            AssertTotal(env, "P1", 10 + 22);

            env.Milestone(2);

            UnstageIt(env, "P1", deploymentId);

            env.Milestone(3);

            Assert.IsNotNull(env.Deployment.GetDeployment(deploymentId));
            Assert.IsNull(env.StageService.GetExistingStage("P1").DeploymentService.GetDeployment(deploymentId));
            SendEvent(env, null, "E5", 31);
            SendEvent(env, "P1", "E6", 32);
            AssertTotal(env, null, 10 + 22 + 31);
            SupportListener listener = env.Listener("s0");

            env.UndeployAll();

            SendEvent(env, null, "end", 99);
            Assert.IsFalse(listener.GetAndClearIsInvoked());
        }