예제 #1
0
        private static void AssertFilterDeploySingle(
            RegressionEnvironment env,
            RegressionPath path,
            string epl,
            string expression,
            FilterOperator op,
            AtomicLong milestone)
        {
            env.CompileDeploy("@Name('s0')" + epl, path).AddListener("s0").MilestoneInc(milestone);
            var statementSPI = (EPStatementSPI) env.Statement("s0");
            if (HasFilterIndexPlanBasicOrMore(env)) {
                var param = SupportFilterServiceHelper.GetFilterSvcSingle(statementSPI);
                Assert.AreEqual(op, param.Op, "failed for '" + epl + "'");
                Assert.AreEqual(expression, param.Name);
            }

            env.UndeployModuleContaining("s0");
        }
예제 #2
0
        private static void TryOperator(
            RegressionEnvironment env,
            RegressionPath path,
            string @operator,
            object[][] testdata)
        {
            env.CompileDeploy(
                "@Name('s0') select TheString as c0,IntPrimitive as c1 from SupportBean(" + @operator + ")",
                path);
            env.AddListener("s0");

            // initiate
            env.SendEventBean(new SupportBean_S0(10, "S01"));

            for (var i = 0; i < testdata.Length; i++) {
                var bean = new SupportBean();
                var testValue = testdata[i][0];
                if (testValue is int?) {
                    bean.IntBoxed = (int?) testValue;
                }
                else if (testValue is SupportEnum) {
                    bean.EnumValue = (SupportEnum) testValue;
                }
                else {
                    bean.ShortBoxed = testValue.AsInt16();
                }

                var expected = (bool) testdata[i][1];

                env.SendEventBean(bean);
                Assert.AreEqual(expected, env.Listener("s0").GetAndClearIsInvoked(), "Failed at " + i);
            }

            // assert type of expression
            var item = SupportFilterServiceHelper.GetFilterSvcSingle(env.Statement("s0"));
            Assert.IsTrue(item.Op != FilterOperator.BOOLEAN_EXPRESSION);

            env.UndeployModuleContaining("s0");
        }