private void RunAssertionMultipleDataWindowUnion(EPServiceProvider epService) { string stmtTextCreate = "create window MyWindowMU#unique(TheString)#length(2) retain-union as select * from SupportBean"; EPStatement stmtCreate = epService.EPAdministrator.CreateEPL(stmtTextCreate); var listenerWindow = new SupportUpdateListener(); stmtCreate.Events += listenerWindow.Update; string stmtTextInsertOne = "insert into MyWindowMU select * from SupportBean"; epService.EPAdministrator.CreateEPL(stmtTextInsertOne); string stmtTextUpdate = "on SupportBean_A update MyWindowMU mw set mw.IntPrimitive=IntPrimitive*100 where TheString=id"; epService.EPAdministrator.CreateEPL(stmtTextUpdate); epService.EPRuntime.SendEvent(new SupportBean("E1", 2)); epService.EPRuntime.SendEvent(new SupportBean("E2", 3)); epService.EPRuntime.SendEvent(new SupportBean_A("E2")); EventBean[] newevents = listenerWindow.LastNewData; EventBean[] oldevents = listenerWindow.LastOldData; Assert.AreEqual(1, newevents.Length); EPAssertionUtil.AssertProps(newevents[0], "IntPrimitive".Split(','), new object[] { 300 }); Assert.AreEqual(1, oldevents.Length); EPAssertionUtil.AssertPropsPerRow(oldevents, "TheString,IntPrimitive".Split(','), new object[][] { new object[] { "E2", 3 } }); EventBean[] events = EPAssertionUtil.Sort(stmtCreate.GetEnumerator(), "TheString"); EPAssertionUtil.AssertPropsPerRow(events, "TheString,IntPrimitive".Split(','), new object[][] { new object[] { "E1", 2 }, new object[] { "E2", 300 } }); epService.EPAdministrator.DestroyAllStatements(); }
public void TestMultipleDataWindowIntersect() { string stmtTextCreate = "create window MyWindow.std:unique(TheString).win:length(2) as select * from SupportBean"; EPStatement stmtCreate = _epService.EPAdministrator.CreateEPL(stmtTextCreate); stmtCreate.AddListener(_listenerWindow); string stmtTextInsertOne = "insert into MyWindow select * from SupportBean"; _epService.EPAdministrator.CreateEPL(stmtTextInsertOne); string stmtTextUpdate = "on SupportBean_A update MyWindow set IntPrimitive=IntPrimitive*100 where TheString=id"; _epService.EPAdministrator.CreateEPL(stmtTextUpdate); _epService.EPRuntime.SendEvent(new SupportBean("E1", 2)); _epService.EPRuntime.SendEvent(new SupportBean("E2", 3)); _epService.EPRuntime.SendEvent(new SupportBean_A("E2")); EventBean[] newevents = _listenerWindow.LastNewData; EventBean[] oldevents = _listenerWindow.LastOldData; Assert.AreEqual(1, newevents.Length); EPAssertionUtil.AssertProps(newevents[0], "IntPrimitive".Split(','), new object[] { 300 }); Assert.AreEqual(1, oldevents.Length); oldevents = EPAssertionUtil.Sort(oldevents, "TheString"); EPAssertionUtil.AssertPropsPerRow(oldevents, "TheString,IntPrimitive".Split(','), new object[][] { new object[] { "E2", 3 } }); EPAssertionUtil.AssertPropsPerRow(stmtCreate.GetEnumerator(), "TheString,IntPrimitive".Split(','), new object[][] { new object[] { "E1", 2 }, new object[] { "E2", 300 } }); }
public void Run(RegressionEnvironment env) { var epl = "@Name('create') create window MyWindowMU#unique(TheString)#length(2) retain-union as select * from SupportBean;\n" + "insert into MyWindowMU select * from SupportBean;\n" + "on SupportBean_A update MyWindowMU mw set mw.IntPrimitive=IntPrimitive*100 where TheString=Id;\n"; env.CompileDeploy(epl).AddListener("create"); env.SendEventBean(new SupportBean("E1", 2)); env.SendEventBean(new SupportBean("E2", 3)); env.SendEventBean(new SupportBean_A("E2")); var newevents = env.Listener("create").LastNewData; var oldevents = env.Listener("create").LastOldData; Assert.AreEqual(1, newevents.Length); EPAssertionUtil.AssertProps( newevents[0], new[] {"IntPrimitive"}, new object[] {300}); Assert.AreEqual(1, oldevents.Length); EPAssertionUtil.AssertPropsPerRow( oldevents, new[] {"TheString", "IntPrimitive"}, new[] {new object[] {"E2", 3}}); var events = EPAssertionUtil.Sort(env.GetEnumerator("create"), "TheString"); EPAssertionUtil.AssertPropsPerRow( events, new[] {"TheString", "IntPrimitive"}, new[] {new object[] {"E1", 2}, new object[] {"E2", 300}}); env.UndeployAll(); }