public void Run(RegressionEnvironment env) { var path = new RegressionPath(); var stmtOrigText = "@Name('split') on SupportBean " + "insert into AStream2SP select * where IntPrimitive=1 " + "insert into BStream2SP select * where IntPrimitive=1 or IntPrimitive=2"; env.CompileDeploy(stmtOrigText, path).AddListener("split"); TryAssertion(env, path); path.Clear(); // statement object model var model = new EPStatementObjectModel(); model.Annotations = Collections.SingletonList(new AnnotationPart("Audit")); model.FromClause = FromClause.Create(FilterStream.Create("SupportBean")); model.InsertInto = InsertIntoClause.Create("AStream2SP"); model.SelectClause = SelectClause.CreateWildcard(); model.WhereClause = Expressions.Eq("IntPrimitive", 1); var clause = OnClause.CreateOnInsertSplitStream(); model.OnExpr = clause; var item = OnInsertSplitStreamItem.Create( InsertIntoClause.Create("BStream2SP"), SelectClause.CreateWildcard(), Expressions.Or(Expressions.Eq("IntPrimitive", 1), Expressions.Eq("IntPrimitive", 2))); clause.AddItem(item); model.Annotations = Collections.SingletonList(AnnotationPart.NameAnnotation("split")); Assert.AreEqual(stmtOrigText, model.ToEPL()); env.CompileDeploy(model, path).AddListener("split"); TryAssertion(env, path); path.Clear(); env.EplToModelCompileDeploy(stmtOrigText, path).AddListener("split"); TryAssertion(env, path); }
private void RunAssertion2SplitNoDefaultOutputFirst(EPServiceProvider epService) { var stmtOrigText = "@Audit on SupportBean " + "insert into AStream2SP select * where IntPrimitive=1 " + "insert into BStream2SP select * where IntPrimitive=1 or IntPrimitive=2"; var stmtOrig = epService.EPAdministrator.CreateEPL(stmtOrigText); TryAssertion(epService, stmtOrig); // statement object model var model = new EPStatementObjectModel(); model.Annotations = Collections.SingletonList(new AnnotationPart("Audit")); model.FromClause = FromClause.Create(FilterStream.Create("SupportBean")); model.InsertInto = InsertIntoClause.Create("AStream2SP"); model.SelectClause = SelectClause.CreateWildcard(); model.WhereClause = Expressions.Eq("IntPrimitive", 1); var clause = OnClause.CreateOnInsertSplitStream(); model.OnExpr = clause; var item = OnInsertSplitStreamItem.Create( InsertIntoClause.Create("BStream2SP"), SelectClause.CreateWildcard(), Expressions.Or(Expressions.Eq("IntPrimitive", 1), Expressions.Eq("IntPrimitive", 2))); clause.AddItem(item); Assert.AreEqual(stmtOrigText, model.ToEPL()); stmtOrig = epService.EPAdministrator.Create(model); TryAssertion(epService, stmtOrig); var newModel = epService.EPAdministrator.CompileEPL(stmtOrigText); stmtOrig = epService.EPAdministrator.Create(newModel); Assert.AreEqual(stmtOrigText, newModel.ToEPL()); TryAssertion(epService, stmtOrig); SupportModelHelper.CompileCreate(epService, stmtOrigText + " output all"); epService.EPAdministrator.DestroyAllStatements(); }