private void RunAssertionStartStopStatement(EPServiceProvider epService) { var subscriber = new SubscriberInterface(); var stmt = epService.EPAdministrator.CreateEPL("select * from SupportMarkerInterface"); stmt.Subscriber = subscriber; var a1 = new SupportBean_A("A1"); epService.EPRuntime.SendEvent(a1); EPAssertionUtil.AssertEqualsExactOrder(new object[] { a1 }, subscriber.GetAndResetIndicate().ToArray()); var b1 = new SupportBean_B("B1"); epService.EPRuntime.SendEvent(b1); EPAssertionUtil.AssertEqualsExactOrder(new object[] { b1 }, subscriber.GetAndResetIndicate().ToArray()); stmt.Stop(); var c1 = new SupportBean_C("C1"); epService.EPRuntime.SendEvent(c1); Assert.AreEqual(0, subscriber.GetAndResetIndicate().Count); stmt.Start(); var d1 = new SupportBean_D("D1"); epService.EPRuntime.SendEvent(d1); EPAssertionUtil.AssertEqualsExactOrder(new object[] { d1 }, subscriber.GetAndResetIndicate().ToArray()); stmt.Dispose(); }
public void TestStartStopStatement() { SubscriberInterface subscriber = new SubscriberInterface(); EPStatement stmt = _epService.EPAdministrator.CreateEPL("select * from SupportMarkerInterface"); stmt.Subscriber = subscriber; SupportBean_A a1 = new SupportBean_A("A1"); _epService.EPRuntime.SendEvent(a1); EPAssertionUtil.AssertEqualsExactOrder(new Object[] { a1 }, subscriber.GetAndResetIndicate().ToArray()); SupportBean_B b1 = new SupportBean_B("B1"); _epService.EPRuntime.SendEvent(b1); EPAssertionUtil.AssertEqualsExactOrder(new Object[] { b1 }, subscriber.GetAndResetIndicate().ToArray()); stmt.Stop(); SupportBean_C c1 = new SupportBean_C("C1"); _epService.EPRuntime.SendEvent(c1); Assert.AreEqual(0, subscriber.GetAndResetIndicate().Count); stmt.Start(); SupportBean_D d1 = new SupportBean_D("D1"); _epService.EPRuntime.SendEvent(d1); EPAssertionUtil.AssertEqualsExactOrder(new Object[] { d1 }, subscriber.GetAndResetIndicate().ToArray()); }
private IDictionary <String, Object> GetTestData() { IDictionary <String, Object> levelThree = new Dictionary <String, Object>(); levelThree["simpleThree"] = 4000L; levelThree["objThree"] = new SupportBean_D("D1"); IDictionary <String, Object> levelTwo = new Dictionary <String, Object>(); levelTwo["simpleTwo"] = 300f; levelTwo["objTwo"] = new SupportBean_C("C1"); levelTwo["mapTwo"] = levelThree; IDictionary <String, Object> levelOne = new Dictionary <String, Object>(); levelOne["simpleOne"] = 20; levelOne["objOne"] = new SupportBean_B("B1"); levelOne["mapOne"] = levelTwo; IDictionary <String, Object> levelZero = new Dictionary <String, Object>(); levelZero["simple"] = 1d; levelZero["obj"] = new SupportBean_A("A1"); levelZero["map"] = levelOne; IDictionary <String, Object> noDefZero = new Dictionary <String, Object>(); noDefZero["item"] = "|nodefmap.item|"; levelZero["nodefmap"] = noDefZero; return(levelZero); }
public static EventBean[] MakeEvents_D(String[] ids) { EventBean[] events = new EventBean[ids.Length]; for (int i = 0; i < events.Length; i++) { SupportBean_D bean = new SupportBean_D(ids[i]); events[i] = CreateObject(bean); } return(events); }
public void TestFollowedEveryMultiple() { String expression = "select * from pattern [every a=" + typeof(SupportBean_A).FullName + " -> b=" + typeof(SupportBean_B).FullName + " -> c=" + typeof(SupportBean_C).FullName + " -> d=" + typeof(SupportBean_D).FullName + "]"; Configuration config = SupportConfigFactory.GetConfiguration(); EPServiceProvider epService = EPServiceProviderManager.GetDefaultProvider(config); epService.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(epService, GetType(), GetType().FullName); } EPStatement statement = epService.EPAdministrator.CreateEPL(expression); var listener = new SupportUpdateListener(); statement.Events += listener.Update; var events = new Object[10]; events[0] = new SupportBean_A("A1"); epService.EPRuntime.SendEvent(events[0]); events[1] = new SupportBean_A("A2"); epService.EPRuntime.SendEvent(events[1]); events[2] = new SupportBean_B("B1"); epService.EPRuntime.SendEvent(events[2]); events[3] = new SupportBean_C("C1"); epService.EPRuntime.SendEvent(events[3]); Assert.IsFalse(listener.IsInvoked); events[4] = new SupportBean_D("D1"); epService.EPRuntime.SendEvent(events[4]); Assert.AreEqual(2, listener.LastNewData.Length); var fields = new[] { "a", "b", "c", "d" }; EPAssertionUtil.AssertProps(listener.LastNewData[0], fields, new[] { events[0], events[2], events[3], events[4] }); EPAssertionUtil.AssertProps(listener.LastNewData[1], fields, new[] { events[1], events[2], events[3], events[4] }); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.EndTest(); } }
private static LinkedHashMap <String, Object> MakeMixedSet() { LinkedHashMap <String, Object> testData = new LinkedHashMap <String, Object>(); testData["A1"] = new SupportBean_A("A1"); testData["B1"] = new SupportBean_B("B1"); testData["C1"] = new SupportBean_C("C1"); testData["B2"] = new SupportBean_B("B2"); testData["A2"] = new SupportBean_A("A2"); testData["D1"] = new SupportBean_D("D1"); testData["E1"] = new SupportBean_E("E1"); testData["F1"] = new SupportBean_F("F1"); testData["D2"] = new SupportBean_D("D2"); testData["B3"] = new SupportBean_B("B3"); testData["G1"] = new SupportBean_G("G1"); testData["D3"] = new SupportBean_D("D3"); return(testData); }
private void RunAssertionFollowedEveryMultiple(EPServiceProvider epService) { string expression = "select * from pattern [every a=" + typeof(SupportBean_A).FullName + " -> b=" + typeof(SupportBean_B).FullName + " -> c=" + typeof(SupportBean_C).FullName + " -> d=" + typeof(SupportBean_D).FullName + "]"; EPStatement statement = epService.EPAdministrator.CreateEPL(expression); var listener = new SupportUpdateListener(); statement.Events += listener.Update; var events = new Object[10]; events[0] = new SupportBean_A("A1"); epService.EPRuntime.SendEvent(events[0]); events[1] = new SupportBean_A("A2"); epService.EPRuntime.SendEvent(events[1]); events[2] = new SupportBean_B("B1"); epService.EPRuntime.SendEvent(events[2]); events[3] = new SupportBean_C("C1"); epService.EPRuntime.SendEvent(events[3]); Assert.IsFalse(listener.IsInvoked); events[4] = new SupportBean_D("D1"); epService.EPRuntime.SendEvent(events[4]); Assert.AreEqual(2, listener.LastNewData.Length); var fields = new string[] { "a", "b", "c", "d" }; EPAssertionUtil.AssertProps(listener.LastNewData[0], fields, new object[] { events[0], events[2], events[3], events[4] }); EPAssertionUtil.AssertProps(listener.LastNewData[1], fields, new object[] { events[1], events[2], events[3], events[4] }); statement.Dispose(); }
public void Run(RegressionEnvironment env) { var expression = "@Name('s0') select * from pattern [every a=SupportBean_A -> b=SupportBean_B -> c=SupportBean_C -> d=SupportBean_D]"; env.CompileDeploy(expression); env.AddListener("s0"); var events = new object[10]; events[0] = new SupportBean_A("A1"); env.SendEventBean(events[0]); events[1] = new SupportBean_A("A2"); env.SendEventBean(events[1]); events[2] = new SupportBean_B("B1"); env.SendEventBean(events[2]); events[3] = new SupportBean_C("C1"); env.SendEventBean(events[3]); Assert.IsFalse(env.Listener("s0").IsInvoked); events[4] = new SupportBean_D("D1"); env.SendEventBean(events[4]); Assert.AreEqual(2, env.Listener("s0").LastNewData.Length); string[] fields = {"a", "b", "c", "d"}; EPAssertionUtil.AssertProps( env.Listener("s0").LastNewData[0], fields, new[] {events[0], events[2], events[3], events[4]}); EPAssertionUtil.AssertProps( env.Listener("s0").LastNewData[1], fields, new[] {events[1], events[2], events[3], events[4]}); env.UndeployAll(); }