private void SendTimer(long time) { CurrentTimeEvent theEvent = new CurrentTimeEvent(time); EPRuntime runtime = _epService.EPRuntime; runtime.SendEvent(theEvent); }
private void SendTimer(long timeInMSec) { CurrentTimeEvent theEvent = new CurrentTimeEvent(timeInMSec); EPRuntime runtime = _engine.EPRuntime; runtime.SendEvent(theEvent); }
private void SendTimer(long timeInMSec) { var theEvent = new CurrentTimeEvent(timeInMSec); EPRuntime runtime = _epService.EPRuntime; runtime.SendEvent(theEvent); }
private void SendTimer(long timeInMSec, EPServiceProvider epService) { CurrentTimeEvent theEvent = new CurrentTimeEvent(timeInMSec); EPRuntime runtime = epService.EPRuntime; runtime.SendEvent(theEvent); }
private void RunAssertion(EPStatement selectTestView) { AssertSelectResultType(selectTestView); var currentTime = new CurrentTimeEvent(0); _epService.EPRuntime.SendEvent(currentTime); SendEvent(SYMBOL_DELL, 10000, 51); AssertEvents(SYMBOL_DELL, 10000, 51, false); SendEvent(SYMBOL_IBM, 20000, 52); AssertEvents(SYMBOL_IBM, 20000, 103, false); SendEvent(SYMBOL_DELL, 40000, 45); AssertEvents(SYMBOL_DELL, 40000, 148, false); _epService.EPRuntime.SendEvent(new CurrentTimeEvent(35000)); //These events are out of the window and new sums are generated SendEvent(SYMBOL_IBM, 30000, 70); AssertEvents(SYMBOL_IBM, 30000, 70, false); SendEvent(SYMBOL_DELL, 10000, 20); AssertEvents(SYMBOL_DELL, 10000, 90, false); }
private void SendTimer(EPServiceProvider engine, long timeInMSec) { var theEvent = new CurrentTimeEvent(timeInMSec); var runtime = engine.EPRuntime; runtime.SendEvent(theEvent); }
private void SendTimer(long time, EPServiceProvider epService) { var theEvent = new CurrentTimeEvent(time); var runtime = epService.EPRuntime; runtime.SendEvent(theEvent); }
private void SendTimeEventRelative(EPServiceProvider epService, int timeIncrement, AtomicLong currentTime) { currentTime.IncrementAndGet(timeIncrement); var theEvent = new CurrentTimeEvent(currentTime.Get()); epService.EPRuntime.SendEvent(theEvent); }
private void SendTimeEvent(int timeIncrement) { currentTime += timeIncrement; var theEvent = new CurrentTimeEvent(currentTime); epService.EPRuntime.SendEvent(theEvent); }
private void TryAssertion(EPServiceProvider epService, SupportUpdateListener testListener, EPStatement stmt) { AssertSelectResultType(stmt); var currentTime = new CurrentTimeEvent(0); epService.EPRuntime.SendEvent(currentTime); SendEvent(epService, SYMBOL_DELL, 10000, 51); AssertEvents(testListener, SYMBOL_DELL, 10000, 51, false); SendEvent(epService, SYMBOL_IBM, 20000, 52); AssertEvents(testListener, SYMBOL_IBM, 20000, 103, false); SendEvent(epService, SYMBOL_DELL, 40000, 45); AssertEvents(testListener, SYMBOL_DELL, 40000, 148, false); epService.EPRuntime.SendEvent(new CurrentTimeEvent(35000)); //These events are out of the window and new sums are generated SendEvent(epService, SYMBOL_IBM, 30000, 70); AssertEvents(testListener, SYMBOL_IBM, 30000, 70, false); SendEvent(epService, SYMBOL_DELL, 10000, 20); AssertEvents(testListener, SYMBOL_DELL, 10000, 90, false); }
private void SendTimeEvent(int timeIncrement) { _currentTime += timeIncrement; CurrentTimeEvent theEvent = new CurrentTimeEvent(_currentTime); _epService.EPRuntime.SendEvent(theEvent); }
public void Start() { while (TimeSpan.TotalSeconds > 0) { Thread.Sleep(1000); TimeSpan = TimeSpan.Add(new TimeSpan(0, 0, -1)); CurrentTimeEvent?.Invoke(this, TimeSpan.ToString()); } CountdownEndedEvent?.Invoke(this, EventArgs.Empty); }
private void RunSingleAssertion(EPStatement selectTestView) { AssertSelectResultType(selectTestView); var currentTime = new CurrentTimeEvent(0); _epService.EPRuntime.SendEvent(currentTime); SendEvent(SYMBOL_IBM, 20000, 52); AssertEvents(SYMBOL_IBM, 20000, 52, false); SendEvent(SYMBOL_IBM, 20000, 100); AssertEvents(SYMBOL_IBM, 20000, 152, false); _epService.EPRuntime.SendEvent(new CurrentTimeEvent(35000)); //These events are out of the window and new sums are generated SendEvent(SYMBOL_IBM, 20000, 252); AssertEvents(SYMBOL_IBM, 20000, 252, false); SendEvent(SYMBOL_IBM, 20000, 100); AssertEvents(SYMBOL_IBM, 20000, 352, false); }
private void SendTimer(EPServiceProviderIsolated isolated, long time) { CurrentTimeEvent theEvent = new CurrentTimeEvent(time); isolated.EPRuntime.SendEvent(theEvent); }
private void SendTimer(long timeInMSec) { CurrentTimeEvent theEvent = new CurrentTimeEvent(timeInMSec); _epService.EPRuntime.SendEvent(theEvent); }
private void RunTest(PatternTestStyle testStyle) { Configuration config = SupportConfigFactory.GetConfiguration(); config.AddEventType("A", typeof(SupportBean_A)); config.AddEventType("B", typeof(SupportBean_B)); config.AddEventType("C", typeof(SupportBean_C)); config.AddEventType("D", typeof(SupportBean_D)); config.AddEventType("E", typeof(SupportBean_E)); config.AddEventType("F", typeof(SupportBean_F)); config.AddEventType("G", typeof(SupportBean_G)); EPServiceProvider serviceProvider = EPServiceProviderManager.GetDefaultProvider(config); serviceProvider.Initialize(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.StartTest(serviceProvider, _testClass, _testMethodName); } EPRuntime runtime = serviceProvider.EPRuntime; // Send the start time to the runtime if (_sendEventCollection.GetTime(EventCollection.ON_START_EVENT_ID) != null) { TimerEvent startTime = new CurrentTimeEvent(_sendEventCollection.GetTime(EventCollection.ON_START_EVENT_ID).Value); runtime.SendEvent(startTime); Log.Debug("RunTest: Start time is " + startTime); } // Set up expression filters and match listeners int index = 0; foreach (EventExpressionCase descriptor in _caseList.Results) { String expressionText = descriptor.ExpressionText; EPStatementObjectModel model = descriptor.ObjectModel; EPStatement statement = null; try { if (model != null) { statement = serviceProvider.EPAdministrator.Create(model, "name--" + expressionText); } else { if (testStyle == PatternTestStyle.USE_PATTERN_LANGUAGE) { statement = serviceProvider.EPAdministrator.CreatePattern(expressionText, "name--" + expressionText); } else if (testStyle == PatternTestStyle.USE_EPL) { String text = "@Audit('pattern') @Audit('pattern-instances') select * from pattern [" + expressionText + "]"; statement = serviceProvider.EPAdministrator.CreateEPL(text); expressionText = text; } else if (testStyle == PatternTestStyle.USE_EPL_AND_CONSUME_NOCHECK) { String text = "select * from pattern @DiscardPartialsOnMatch @SuppressOverlappingMatches [" + expressionText + "]"; statement = serviceProvider.EPAdministrator.CreateEPL(text); expressionText = text; } else if (testStyle == PatternTestStyle.COMPILE_TO_MODEL) { String text = "select * from pattern [" + expressionText + "]"; EPStatementObjectModel mymodel = serviceProvider.EPAdministrator.CompileEPL(text); statement = serviceProvider.EPAdministrator.Create(mymodel); expressionText = text; } else if (testStyle == PatternTestStyle.COMPILE_TO_EPL) { String text = "select * from pattern [" + expressionText + "]"; EPStatementObjectModel mymodel = serviceProvider.EPAdministrator.CompileEPL(text); String reverse = mymodel.ToEPL(); statement = serviceProvider.EPAdministrator.CreateEPL(reverse); expressionText = reverse; } else { throw new ArgumentException("Unknown test style"); } } } catch (Exception ex) { String text = expressionText; if (model != null) { text = "Model: " + model.ToEPL(); } Log.Error(".runTest Failed to create statement for style " + testStyle + " pattern expression=" + text, ex); Assert.Fail(".runTest Failed to create statement for style " + testStyle + " pattern expression=" + text); } // We stop the statement again and start after the first listener was added. // Thus we can handle patterns that fireStatementStopped on startup. statement.Stop(); _expressions[index] = statement; _expressions[index].Events += _listeners[index].Update; // Start the statement again: listeners now got called for on-start events such as for a "not" statement.Start(); index++; } // Some expressions may fireStatementStopped as soon as they are started, such as a "not b()" expression, for example. // Check results for any such listeners/expressions. // NOTE: For EPL statements we do not support calling listeners when a pattern that fires upon start. // Reason is that this should not be a relevant functionality of a pattern, the start pattern // event itself cannot carry any information and is thus ignore. Note subsequent events // generated by the same pattern are fine. int totalEventsReceived = 0; if (testStyle != PatternTestStyle.USE_PATTERN_LANGUAGE) { ClearListenerEvents(); totalEventsReceived += CountExpectedEvents(EventCollection.ON_START_EVENT_ID); } else // Patterns do need to handle event publishing upon pattern expression start (patterns that turn true right away) { CheckResults(testStyle, EventCollection.ON_START_EVENT_ID); totalEventsReceived += CountListenerEvents(); ClearListenerEvents(); } // Send actual test events var entryCollection = _sendEventCollection.ToArray(); for (int ii = 0; ii < entryCollection.Length; ii++) { var entry = entryCollection[ii]; var eventId = entry.Key; // Manipulate the time when this event was send if (_sendEventCollection.GetTime(eventId) != null) { TimerEvent currentTimeEvent = new CurrentTimeEvent(_sendEventCollection.GetTime(eventId).Value); runtime.SendEvent(currentTimeEvent); Log.Debug("RunTest: Sending event {0} = {1} timed {2}", entry.Key, entry.Value, currentTimeEvent); } // Send event itself runtime.SendEvent(entry.Value); // Check expected results for this event if (testStyle != PatternTestStyle.USE_EPL_AND_CONSUME_NOCHECK) { CheckResults(testStyle, eventId); // Count and clear the list of events that each listener has received totalEventsReceived += CountListenerEvents(); } ClearListenerEvents(); } // Count number of expected matches int totalExpected = 0; foreach (EventExpressionCase descriptor in _caseList.Results) { totalExpected += descriptor.ExpectedResults.Values.Sum(events => events.Count); } if (totalExpected != totalEventsReceived && testStyle != PatternTestStyle.USE_EPL_AND_CONSUME_NOCHECK) { Log.Debug(".test Count expected does not match count received, expected=" + totalExpected + " received=" + totalEventsReceived); Assert.Fail(); } // Kill all expressions foreach (EPStatement expression in _expressions) { expression.RemoveAllEventHandlers(); } // Send test events again to also test that all were indeed killed foreach (var entry in _sendEventCollection) { runtime.SendEvent(entry.Value); } // Make sure all listeners are still at zero foreach (SupportUpdateListener listener in _listeners) { if (listener.NewDataList.Count > 0) { Log.Debug(".test A match was received after stopping all expressions"); Assert.Fail(); } } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.EndTest(); } }
private static void SendTimer(long time, EPServiceProvider epService) { CurrentTimeEvent theEvent = new CurrentTimeEvent(time); epService.EPRuntime.SendEvent(theEvent); }