public void SetUp() { IDictionary <String, Object> propertyTypes = new LinkedHashMap <String, Object>(); propertyTypes.Put("myInt", typeof(int)); propertyTypes.Put("myDouble", typeof(double?)); propertyTypes.Put("myString", typeof(String)); eventTypeName = "mapEvent"; Configuration configuration = new Configuration(); configuration.AddEventType(eventTypeName, propertyTypes); epService = EPServiceProviderManager.GetProvider("Adapter", configuration); epService.Initialize(); EPAdministrator administrator = epService.EPAdministrator; String statementText = "select * from mapEvent.win:length(5)"; EPStatement statement = administrator.CreateEPL(statementText); listener = new SupportUpdateListener(); statement.Events += listener.Update; // Turn off external clocking epService.EPRuntime.SendEvent(new TimerControlEvent(TimerControlEvent.ClockTypeEnum.CLOCK_EXTERNAL)); // Set the clock to 0 currentTime = 0; SendTimeEvent(0); coordinator = new AdapterCoordinatorImpl(epService, true); propertyOrderNoTimestamp = new String[] { "myInt", "myDouble", "myString" }; String[] propertyOrderTimestamp = new String[] { "timestamp", "myInt", "myDouble", "myString" }; // A CSVPlayer for a file with timestamps, not looping timestampsNotLooping = new CSVInputAdapterSpec(new AdapterInputSource("/regression/timestampOne.csv"), eventTypeName); timestampsNotLooping.IsUsingEngineThread = true; timestampsNotLooping.PropertyOrder = propertyOrderTimestamp; timestampsNotLooping.TimestampColumn = "timestamp"; // A CSVAdapter for a file with timestamps, looping timestampsLooping = new CSVInputAdapterSpec(new AdapterInputSource("/regression/timestampTwo.csv"), eventTypeName); timestampsLooping.IsLooping = true; timestampsLooping.IsUsingEngineThread = true; timestampsLooping.PropertyOrder = propertyOrderTimestamp; timestampsLooping.TimestampColumn = "timestamp"; // A CSVAdapter that sends 10 events per sec, not looping noTimestampsNotLooping = new CSVInputAdapterSpec(new AdapterInputSource("/regression/noTimestampOne.csv"), eventTypeName); noTimestampsNotLooping.EventsPerSec = 10; noTimestampsNotLooping.PropertyOrder = propertyOrderNoTimestamp; noTimestampsNotLooping.IsUsingEngineThread = true; // A CSVAdapter that sends 5 events per sec, looping noTimestampsLooping = new CSVInputAdapterSpec(new AdapterInputSource("/regression/noTimestampTwo.csv"), eventTypeName); noTimestampsLooping.EventsPerSec = 5; noTimestampsLooping.IsLooping = true; noTimestampsLooping.PropertyOrder = propertyOrderNoTimestamp; noTimestampsLooping.IsUsingEngineThread = true; }
public void SetUp() { _container = SupportContainer.Reset(); IDictionary <String, Object> propertyTypes = new LinkedHashMap <String, Object>(); propertyTypes.Put("myInt", typeof(int)); propertyTypes.Put("myDouble", typeof(double?)); propertyTypes.Put("myString", typeof(String)); _eventTypeName = "mapEvent"; var configuration = new Configuration(_container); configuration.Runtime.Threading.IsInternalTimerEnabled = false; configuration.Common.AddEventType(_eventTypeName, propertyTypes); _runtime = EPRuntimeProvider.GetRuntime("Adapter", configuration); _runtime.Initialize(); var statementText = "select * from mapEvent#length(5)"; var statement = CompileUtil.CompileDeploy(_runtime, statementText).Statements[0]; _listener = new SupportUpdateListener(); statement.Events += _listener.Update; // Set the clock to 0 _currentTime = 0; SendTimeEvent(0); _coordinator = new AdapterCoordinatorImpl(_runtime, true); _propertyOrderNoTimestamp = new[] { "myInt", "myDouble", "myString" }; var propertyOrderTimestamp = new[] { "timestamp", "myInt", "myDouble", "myString" }; // A CSVPlayer for a file with timestamps, not looping _timestampsNotLooping = new CSVInputAdapterSpec(new AdapterInputSource(_container, "regression/timestampOne.csv"), _eventTypeName); _timestampsNotLooping.IsUsingEngineThread = true; _timestampsNotLooping.PropertyOrder = propertyOrderTimestamp; _timestampsNotLooping.TimestampColumn = "timestamp"; // A CSVAdapter for a file with timestamps, looping _timestampsLooping = new CSVInputAdapterSpec(new AdapterInputSource(_container, "regression/timestampTwo.csv"), _eventTypeName); _timestampsLooping.IsLooping = true; _timestampsLooping.IsUsingEngineThread = true; _timestampsLooping.PropertyOrder = propertyOrderTimestamp; _timestampsLooping.TimestampColumn = "timestamp"; // A CSVAdapter that sends 10 events per sec, not looping _noTimestampsNotLooping = new CSVInputAdapterSpec(new AdapterInputSource(_container, "regression/noTimestampOne.csv"), _eventTypeName); _noTimestampsNotLooping.EventsPerSec = 10; _noTimestampsNotLooping.PropertyOrder = _propertyOrderNoTimestamp; _noTimestampsNotLooping.IsUsingEngineThread = true; // A CSVAdapter that sends 5 events per sec, looping _noTimestampsLooping = new CSVInputAdapterSpec(new AdapterInputSource(_container, "regression/noTimestampTwo.csv"), _eventTypeName); _noTimestampsLooping.EventsPerSec = 5; _noTimestampsLooping.IsLooping = true; _noTimestampsLooping.PropertyOrder = _propertyOrderNoTimestamp; _noTimestampsLooping.IsUsingEngineThread = true; }
public void TestExternalTimer() { _coordinator = new AdapterCoordinatorImpl(_epService, false, true, false); _coordinator.Coordinate(new CSVInputAdapter(_container, _epService, _noTimestampsNotLooping)); _coordinator.Coordinate(new CSVInputAdapter(_container, _epService, _timestampsNotLooping)); long startTime = Environment.TickCount; _coordinator.Start(); long endTime = Environment.TickCount; // Check that we haven't been kept waiting Assert.That(endTime - startTime, Is.LessThan(100)); Assert.AreEqual(6, _listener.GetNewDataList().Count); AssertEvent(0, 1, 1.1, "noTimestampOne.one"); AssertEvent(1, 1, 1.1, "timestampOne.one"); AssertEvent(2, 2, 2.2, "noTimestampOne.two"); AssertEvent(3, 3, 3.3, "noTimestampOne.three"); AssertEvent(4, 3, 3.3, "timestampOne.three"); AssertEvent(5, 5, 5.5, "timestampOne.five"); }
public void TestNotUsingEngineThread() { _coordinator = new AdapterCoordinatorImpl(_epService, false); _coordinator.Coordinate(new CSVInputAdapter(_container, _epService, _noTimestampsNotLooping)); _coordinator.Coordinate(new CSVInputAdapter(_container, _epService, _timestampsNotLooping)); long startTime = Environment.TickCount; _coordinator.Start(); long endTime = Environment.TickCount; // The last event should be sent after 500 ms Assert.IsTrue(endTime - startTime > 500); Assert.AreEqual(6, _listener.GetNewDataList().Count); AssertEvent(0, 1, 1.1, "noTimestampOne.one"); AssertEvent(1, 1, 1.1, "timestampOne.one"); AssertEvent(2, 2, 2.2, "noTimestampOne.two"); AssertEvent(3, 3, 3.3, "noTimestampOne.three"); AssertEvent(4, 3, 3.3, "timestampOne.three"); AssertEvent(5, 5, 5.5, "timestampOne.five"); }