public void TestWildcardJoinPattern() { var epl = "select distinct * from " + "SupportBean(IntPrimitive=0) as fooB unidirectional " + "inner join " + "pattern [" + "every-distinct(fooA.TheString) fooA=SupportBean(IntPrimitive=1)" + "->" + "every-distinct(wooA.TheString) wooA=SupportBean(IntPrimitive=2)" + " where timer:within(1 hour)" + "]#time(1 hour) as fooWooPair " + "on fooB.LongPrimitive = fooWooPair.fooA.LongPrimitive" + " order by fooWooPair.wooA.TheString asc"; var stmt = _epService.EPAdministrator.CreateEPL(epl); stmt.Subscriber = _subscriber; Log.Info("Sending event (fooA) starting pattern subexpression..."); SendEvent("E1", 1, 10L); Log.Info("Sending event (wooA 1) matching pattern subexpression..."); SendEvent("E2", 2, 10L); Log.Info("Sending event (wooA 2) matching pattern subexpression..."); SendEvent("E3", 2, 10L); Log.Info("Sending event (fooB) causing join with matched patterns..."); SendEvent("Query", 0, 10L); Assert.IsTrue(_subscriber.IsInvoked()); Assert.AreEqual(1, _subscriber.InsertStreamList.Count); var inserted = _subscriber.InsertStreamList[0]; Assert.AreEqual(2, inserted.Length); Assert.AreEqual("Query", ((SupportBean)inserted[0][0]).TheString); Assert.AreEqual("Query", ((SupportBean)inserted[1][0]).TheString); var mapOne = (IDictionary <string, object>)inserted[0][1]; Assert.AreEqual("E2", ((EventBean)mapOne.Get("wooA")).Get("TheString")); Assert.AreEqual("E1", ((EventBean)mapOne.Get("fooA")).Get("TheString")); var mapTwo = (IDictionary <string, object>)inserted[1][1]; Assert.AreEqual("E3", ((EventBean)mapTwo.Get("wooA")).Get("TheString")); Assert.AreEqual("E1", ((EventBean)mapTwo.Get("fooA")).Get("TheString")); }
public override void Run(EPServiceProvider epService) { epService.EPAdministrator.Configuration.AddEventType <SupportBean>(); string epl = "select distinct * from " + "SupportBean(IntPrimitive=0) as fooB unidirectional " + "inner join " + "pattern [" + "every-distinct(fooA.TheString) fooA=SupportBean(IntPrimitive=1)" + "->" + "every-distinct(wooA.TheString) wooA=SupportBean(IntPrimitive=2)" + " where timer:within(1 hour)" + "]#time(1 hour) as fooWooPair " + "on fooB.LongPrimitive = fooWooPair.fooA.LongPrimitive" + " order by fooWooPair.wooA.TheString asc"; EPStatement stmt = epService.EPAdministrator.CreateEPL(epl); var subscriber = new SupportSubscriberMRD(); stmt.Subscriber = subscriber; SendEvent(epService, "E1", 1, 10L); SendEvent(epService, "E2", 2, 10L); SendEvent(epService, "E3", 2, 10L); SendEvent(epService, "Query", 0, 10L); Assert.IsTrue(subscriber.IsInvoked()); Assert.AreEqual(1, subscriber.InsertStreamList.Count); object[][] inserted = subscriber.InsertStreamList[0]; Assert.AreEqual(2, inserted.Length); Assert.AreEqual("Query", ((SupportBean)inserted[0][0]).TheString); Assert.AreEqual("Query", ((SupportBean)inserted[1][0]).TheString); Map mapOne = (Map)inserted[0][1]; Assert.AreEqual("E2", ((EventBean)mapOne.Get("wooA")).Get("TheString")); Assert.AreEqual("E1", ((EventBean)mapOne.Get("fooA")).Get("TheString")); Map mapTwo = (Map)inserted[1][1]; Assert.AreEqual("E3", ((EventBean)mapTwo.Get("wooA")).Get("TheString")); Assert.AreEqual("E1", ((EventBean)mapTwo.Get("fooA")).Get("TheString")); }
public void Run(RegressionEnvironment env) { var epl = "@Name('s0') select distinct * from " + "SupportBean(IntPrimitive=0) as fooB unidirectional " + "inner join " + "pattern [" + "every-distinct(fooA.TheString) fooA=SupportBean(IntPrimitive=1)" + "->" + "every-distinct(wooA.TheString) wooA=SupportBean(IntPrimitive=2)" + " where timer:within(1 hour)" + "]#time(1 hour) as fooWooPair " + "on fooB.LongPrimitive = fooWooPair.fooA.LongPrimitive" + " order by fooWooPair.wooA.TheString asc"; env.CompileDeploy(epl); var subscriber = new SupportSubscriberMRD(); env.Statement("s0").Subscriber = subscriber; SendEvent(env, "E1", 1, 10L); SendEvent(env, "E2", 2, 10L); SendEvent(env, "E3", 2, 10L); SendEvent(env, "Query", 0, 10L); Assert.IsTrue(subscriber.IsInvoked()); Assert.AreEqual(1, subscriber.InsertStreamList.Count); var inserted = subscriber.InsertStreamList[0]; Assert.AreEqual(2, inserted.Length); Assert.AreEqual("Query", ((SupportBean) inserted[0][0]).TheString); Assert.AreEqual("Query", ((SupportBean) inserted[1][0]).TheString); var mapOne = (IDictionary<string, object>) inserted[0][1]; Assert.AreEqual("E2", ((EventBean) mapOne.Get("wooA")).Get("TheString")); Assert.AreEqual("E1", ((EventBean) mapOne.Get("fooA")).Get("TheString")); var mapTwo = (IDictionary<string, object>) inserted[1][1]; Assert.AreEqual("E3", ((EventBean) mapTwo.Get("wooA")).Get("TheString")); Assert.AreEqual("E1", ((EventBean) mapTwo.Get("fooA")).Get("TheString")); env.UndeployAll(); }