public void TestUnmatchedInsertInto() { _epService.EPAdministrator.Configuration.AddEventType <SupportBean>(); MyUnmatchedListener listener = new MyUnmatchedListener(); _epService.EPRuntime.UnmatchedEvent += listener.Update; // create insert into EPStatement insertInto = _epService.EPAdministrator.CreateEPL("insert into MyEvent select TheString from SupportBean"); // no statement, should be unmatched SendEvent("E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreEqual("E1", listener.Received[0].Get("TheString")); listener.Reset(); // stop insert into, now SupportBean itself is unmatched insertInto.Stop(); SupportBean theEvent = SendEvent("E2"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); listener.Reset(); // start insert-into SendEvent("E3"); Assert.AreEqual(1, listener.Received.Count); Assert.AreEqual("E3", listener.Received[0].Get("TheString")); listener.Reset(); }
private void RunAssertionUnmatchedInsertInto(EPServiceProvider epService) { var listener = new MyUnmatchedListener(); epService.EPRuntime.UnmatchedEvent += listener.Update; // create insert into EPStatement insertInto = epService.EPAdministrator.CreateEPL("insert into MyEvent select TheString from SupportBean"); // no statement, should be unmatched SendEvent(epService, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreEqual("E1", listener.Received[0].Get("TheString")); listener.Reset(); // stop insert into, now SupportBean itself is unmatched insertInto.Stop(); SupportBean theEvent = SendEvent(epService, "E2"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); listener.Reset(); // start insert-into SendEvent(epService, "E3"); Assert.AreEqual(1, listener.Received.Count); Assert.AreEqual("E3", listener.Received[0].Get("TheString")); listener.Reset(); epService.EPRuntime.RemoveAllUnmatchedEventHandlers(); }
public void Run(RegressionEnvironment env) { var listener = new MyUnmatchedListener(); env.EventService.UnmatchedListener = listener.Update; // create insert into env.CompileDeploy("@Name('s0') insert into MyEvent select TheString from SupportBean"); // no statement, should be unmatched SendEvent(env, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreEqual("E1", listener.Received[0].Get("TheString")); listener.Reset(); // stop insert into, now SupportBean itself is unmatched env.UndeployModuleContaining("s0"); var theEvent = SendEvent(env, "E2"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); listener.Reset(); // start insert-into SendEvent(env, "E3"); Assert.AreEqual(1, listener.Received.Count); Assert.AreEqual("E3", listener.Received[0].Get("TheString")); listener.Reset(); }
private void RunAssertionUnmatchedSendEvent(EPServiceProvider epService) { var listener = new MyUnmatchedListener(); epService.EPRuntime.UnmatchedEvent += listener.Update; // no statement, should be unmatched SupportBean theEvent = SendEvent(epService, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); listener.Reset(); // no unmatched listener epService.EPRuntime.RemoveAllUnmatchedEventHandlers(); SendEvent(epService, "E1"); Assert.AreEqual(0, listener.Received.Count); // create statement and re-register unmatched listener EPStatement stmt = epService.EPAdministrator.CreateEPL("select * from " + typeof(SupportBean).FullName); epService.EPRuntime.UnmatchedEvent += listener.Update; SendEvent(epService, "E1"); Assert.AreEqual(0, listener.Received.Count); // stop statement stmt.Stop(); theEvent = SendEvent(epService, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); listener.Reset(); // start statement stmt.Start(); SendEvent(epService, "E1"); Assert.AreEqual(0, listener.Received.Count); // destroy statement stmt.Dispose(); theEvent = SendEvent(epService, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); epService.EPRuntime.RemoveAllUnmatchedEventHandlers(); }
public void Run(RegressionEnvironment env) { var compiled = env.Compile("@Name('s0') select * from SupportBean"); var listener = new MyUnmatchedListener(); env.EventService.UnmatchedListener = listener.Update; // no statement, should be unmatched var theEvent = SendEvent(env, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); listener.Reset(); // no unmatched listener env.EventService.UnmatchedListener = null; SendEvent(env, "E1"); Assert.AreEqual(0, listener.Received.Count); // create statement and re-register unmatched listener env.Deploy(compiled); env.EventService.UnmatchedListener = listener.Update; SendEvent(env, "E1"); Assert.AreEqual(0, listener.Received.Count); // stop statement env.UndeployModuleContaining("s0"); theEvent = SendEvent(env, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); listener.Reset(); // start statement env.Deploy(compiled); SendEvent(env, "E1"); Assert.AreEqual(0, listener.Received.Count); // destroy statement env.UndeployModuleContaining("s0"); theEvent = SendEvent(env, "E1"); Assert.AreEqual(1, listener.Received.Count); Assert.AreSame(theEvent, listener.Received[0].Underlying); }