private static void ComparePlan(string[] expectedCSV) { var plan = SupportGroupRollupPlanHook.GetPlan(); var levels = plan.RollupDesc.Levels; var received = new string[levels.Length][]; for (var i = 0; i < levels.Length; i++) { var level = levels[i]; if (level.IsAggregationTop) { received[i] = new string[0]; } else { received[i] = new string[level.RollupKeys.Length]; for (var j = 0; j < received[i].Length; j++) { var key = level.RollupKeys[j]; received[i][j] = ExprNodeUtilityPrint.ToExpressionStringMinPrecedenceSafe(plan.Expressions[key]); } } } Assert.AreEqual(expectedCSV.Length, received.Length, "Received: " + ToCSV(received)); for (var i = 0; i < expectedCSV.Length; i++) { var receivedCSV = ToCSV(received[i]); Assert.AreEqual(expectedCSV[i], receivedCSV, "Failed at row " + i); } }
private static void Validate( RegressionEnvironment env, string selectClause, string groupByClause, string[] expectedCSV) { var epl = PLAN_CALLBACK_HOOK + " select " + selectClause + ", count(*) from SupportEventABCProp group by " + groupByClause; SupportGroupRollupPlanHook.Reset(); env.Compile(epl); ComparePlan(expectedCSV); env.UndeployAll(); var model = env.EplToModel(epl); Assert.AreEqual(epl, model.ToEPL()); SupportGroupRollupPlanHook.Reset(); model.Annotations.Add(AnnotationPart.NameAnnotation("s0")); env.CompileDeploy(model).AddListener("s0"); ComparePlan(expectedCSV); env.UndeployAll(); }
private void Validate(string selectClause, string groupByClause, string[] expectedCSV) { var epl = PLAN_CALLBACK_HOOK + " select " + selectClause + ", count(*) from ABCProp group by " + groupByClause; SupportGroupRollupPlanHook.Reset(); var stmt = epService.EPAdministrator.CreateEPL(epl); ComparePlan(expectedCSV); stmt.Dispose(); var model = epService.EPAdministrator.CompileEPL(epl); Assert.AreEqual(epl, model.ToEPL()); SupportGroupRollupPlanHook.Reset(); stmt = epService.EPAdministrator.Create(model); ComparePlan(expectedCSV); Assert.AreEqual(epl, stmt.Text); stmt.Dispose(); }