示例#1
0
        private static void TryOptimizableBoolean(
            RegressionEnvironment env,
            RegressionPath path,
            string epl)
        {
            // test function returns lookup value and "Equals"
            int count = 10;
            for (int i = 0; i < count; i++) {
                EPCompiled compiled = env.Compile("@Name('s" + i + "')" + epl, path);
                EPDeploymentService admin = env.Runtime.DeploymentService;
                try {
                    admin.Deploy(compiled);
                }
                catch (EPDeployException) {
                    Assert.Fail();
                }
            }

            env.Milestone(0);

            SupportUpdateListener listener = new SupportUpdateListener();
            for (int i = 0; i < 10; i++) {
                env.Statement("s" + i).AddListener(listener);
            }

            var loops = 10000;
            var delta = PerformanceObserver.TimeMillis(
                () => {
                    SupportStaticMethodLib.ResetCountInvoked();
                    for (int i = 0; i < loops; i++) {
                        string key = "E_" + i % 100;
                        env.SendEventBean(new SupportBean(key, 0));
                        if (key.Equals("E_1")) {
                            Assert.AreEqual(count, listener.NewDataList.Count);
                            listener.Reset();
                        }
                        else {
                            Assert.IsFalse(listener.IsInvoked);
                        }
                    }
                });
            Assert.AreEqual(loops, SupportStaticMethodLib.CountInvoked);

            Assert.IsTrue(delta < 1000, "Delta is " + delta);
            env.UndeployAll();
        }
示例#2
0
        private static void DeployMultiple(
            int count,
            RegressionPath path,
            string epl,
            RegressionEnvironment env)
        {
            for (int i = 0; i < count; i++) {
                EPCompiled compiled = env.Compile("@Name('s" + i + "')" + epl, path);
                EPDeploymentService admin = env.Runtime.DeploymentService;
                try {
                    admin.Deploy(compiled);
                }
                catch (EPDeployException) {
                    Assert.Fail();
                }
            }

            for (int i = 0; i < count; i++) {
                env.Statement("s" + i).AddListener(env.ListenerNew());
            }
        }