Ejemplo n.º 1
0
        private void RunAssertionDocSample(EPServiceProvider epService)
        {
            epService.EPAdministrator.Configuration.AddEventType(typeof(AEvent));
            epService.EPAdministrator.Configuration.AddEventType(typeof(BEvent));

            var hints = new string[] {
                "@Hint('Exclude_plan(true)')",
                "@Hint('Exclude_plan(opname=\"equals\")')",
                "@Hint('Exclude_plan(opname=\"equals\" and from_streamname=\"a\")')",
                "@Hint('Exclude_plan(opname=\"equals\" and from_streamname=\"b\")')",
                "@Hint('Exclude_plan(exprs[0]=\"aprop\")')"
            };

            foreach (string hint in hints)
            {
                epService.EPAdministrator.CreateEPL("@Audit " + hint +
                                                    "select * from AEvent#keepall as a, BEvent#keepall as b where aprop = bprop");
            }

            // test subquery
            SupportQueryPlanIndexHook.Reset();
            epService.EPAdministrator.CreateEPL(INDEX_CALLBACK_HOOK + "@Hint('Exclude_plan(true)') select (select * from S0#unique(p00) as s0 where s1.p10 = p00) from S1 as s1");
            QueryPlanIndexDescSubquery subq = SupportQueryPlanIndexHook.GetAndResetSubqueries()[0];

            Assert.AreEqual(typeof(SubordFullTableScanLookupStrategyFactory).Name, subq.TableLookupStrategy);

            // test named window
            epService.EPAdministrator.CreateEPL("create window S0Window#keepall as S0");
            epService.EPAdministrator.CreateEPL(INDEX_CALLBACK_HOOK + "@Hint('Exclude_plan(true)') on S1 as s1 select * from S0Window as s0 where s1.p10 = s0.p00");
            QueryPlanIndexDescOnExpr onExpr = SupportQueryPlanIndexHook.GetAndResetOnExpr();

            Assert.AreEqual(typeof(SubordWMatchExprLookupStrategyFactoryAllFiltered).Name, onExpr.StrategyName);

            epService.EPAdministrator.DestroyAllStatements();
        }
        public static QueryPlanIndexDescOnExpr GetAndResetOnExpr()
        {
            QueryPlanIndexDescOnExpr onexpr = OnExprs[0];

            Reset();
            return(onexpr);
        }
        public static QueryPlanIndexDescOnExpr AssertOnExprAndReset()
        {
            Assert.IsTrue(OnExprs.Count == 1);
            QueryPlanIndexDescOnExpr onexp = OnExprs[0];

            Reset();
            return(onexp);
        }
        public static void AssertOnExprTableAndReset(string indexName, string indexDescription)
        {
            Assert.IsTrue(OnExprs.Count == 1);
            QueryPlanIndexDescOnExpr onexp = OnExprs[0];

            if (indexDescription != null)
            {
                Assert.AreEqual(indexDescription, onexp.Tables[0].IndexDesc);
                Assert.AreEqual(indexName, onexp.Tables[0].IndexName); // can be null
            }
            else
            {
                Assert.IsNull(onexp.Tables);
                Assert.IsNull(indexDescription);
            }
            Reset();
        }
 public void InfraOnExpr(QueryPlanIndexDescOnExpr onexprdesc)
 {
     OnExprs.Add(onexprdesc);
 }