private void RunAssertionOutputRowConversion(EPServiceProvider epService) { SupportSQLColumnTypeConversion.Reset(); epService.EPAdministrator.Configuration.AddVariable("myvariableORC", typeof(int), 10); string[] fields = "TheString,IntPrimitive".Split(','); string stmtText = "@Hook(Type=HookType.SQLROW, Hook='" + typeof(SupportSQLOutputRowConversion).FullName + "')" + "select * from sql:MyDB ['select * from mytesttable where myint = ${myvariableORC}']"; EPStatement stmt = epService.EPAdministrator.CreateEPL(stmtText); var listener = new SupportUpdateListener(); stmt.Events += listener.Update; Assert.AreEqual(typeof(SupportBean), stmt.EventType.UnderlyingType); EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, new object[][] { new object[] { ">10<", 99010 } }); SQLOutputRowTypeContext type = SupportSQLOutputRowConversion.TypeContexts[0]; Assert.AreEqual("MyDB", type.Db); Assert.AreEqual("select * from mytesttable where myint = ${myvariableORC}", type.Sql); Assert.AreEqual(typeof(int?), type.Fields.Get("myint")); SQLOutputRowValueContext val = SupportSQLOutputRowConversion.ValueContexts[0]; Assert.AreEqual(10, val.Values.Get("myint")); epService.EPRuntime.SetVariableValue("myvariableORC", 60); // greater 50 turns true EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, new object[][] { new object[] { ">60<", 99060 } }); epService.EPRuntime.SetVariableValue("myvariableORC", 90); // greater 50 turns true EPAssertionUtil.AssertPropsPerRowAnyOrder(stmt.GetEnumerator(), fields, null); stmt.Dispose(); }
public Type GetOutputRowType(SQLOutputRowTypeContext sqlOutputRowTypeContext) { _typeContexts.Add(sqlOutputRowTypeContext); return(typeof(SupportBean)); }