public void TestRuntimePropertyTypes() { var adapterSpec = new CSVInputAdapterSpec(new AdapterInputSource("regression/noTimestampOne.csv"), "propertyTypeEvent"); adapterSpec.EventsPerSec = 10; adapterSpec.PropertyOrder = new[] { "myInt", "myDouble", "myString" }; adapterSpec.PropertyTypes = propertyTypes; adapterSpec.IsUsingEngineThread = true; adapter = new CSVInputAdapter(epService, adapterSpec); const string statementText = "select * from propertyTypeEvent#length(5)"; EPStatement statement = epService.EPAdministrator.CreateEPL(statementText); statement.Events += listener.Update; adapter.Start(); SendTimeEvent(100); AssertEvent(1, 1.1, "noTimestampOne.one"); SendTimeEvent(100); AssertEvent(2, 2.2, "noTimestampOne.two"); SendTimeEvent(100); AssertEvent(3, 3.3, "noTimestampOne.three"); }
public void TestRuntimePropertyTypes() { CompileDeploy(_runtime, "@public @buseventtype create schema propertyTypeEvent(MyInt int, MyDouble double, MyString string)"); var adapterSpec = new CSVInputAdapterSpec( new AdapterInputSource(_container, "regression/noTimestampOne.csv"), "propertyTypeEvent"); adapterSpec.EventsPerSec = 10; adapterSpec.PropertyOrder = new[] {"MyInt", "MyDouble", "MyString"}; adapterSpec.PropertyTypes = _propertyTypes; adapterSpec.IsUsingEngineThread = true; _adapter = new CSVInputAdapter(_runtime, adapterSpec); const string statementText = "select * from propertyTypeEvent#length(5)"; var statement = CompileDeploy(_runtime, statementText).Statements[0]; statement.Events += _listener.Update; _adapter.Start(); SendTimeEvent(100); AssertEvent(1, 1.1, "noTimestampOne.one"); SendTimeEvent(100); AssertEvent(2, 2.2, "noTimestampOne.two"); SendTimeEvent(100); AssertEvent(3, 3.3, "noTimestampOne.three"); }
public void TestConflictingPropertyOrder() { CompileDeploy(_runtime, "@public @buseventtype create schema intsTitleRowEvent(intOne string, intTwo string)"); var adapterSpec = new CSVInputAdapterSpec( new AdapterInputSource(_container, "regression/intsTitleRow.csv"), "intsTitleRowEvent"); adapterSpec.EventsPerSec = 10; adapterSpec.PropertyOrder = new[] {"intTwo", "intOne"}; adapterSpec.IsUsingEngineThread = true; _adapter = new CSVInputAdapter(_runtime, adapterSpec); const string statementText = "select * from intsTitleRowEvent#length(5)"; var statement = CompileDeploy(_runtime, statementText).Statements[0]; statement.Events += _listener.Update; _adapter.Start(); SendTimeEvent(100); Assert.IsTrue(_listener.GetAndClearIsInvoked()); Assert.AreEqual(1, _listener.GetLastNewData().Length); Assert.AreEqual("1", _listener.GetLastNewData()[0].Get("intTwo")); Assert.AreEqual("0", _listener.GetLastNewData()[0].Get("intOne")); }
public void TestNoPropertyTypes() { var adapterSpec = new CSVInputAdapterSpec(new AdapterInputSource("regression/noTimestampOne.csv"), "allStringEvent"); adapterSpec.EventsPerSec = 10; adapterSpec.PropertyOrder = new[] { "myInt", "myDouble", "myString" }; adapterSpec.IsUsingEngineThread = true; _adapter = new CSVInputAdapter(_container, _epService, adapterSpec); const string statementText = "select * from allStringEvent#length(5)"; EPStatement statement = _epService.EPAdministrator.CreateEPL(statementText); statement.Events += _listener.Update; _adapter.Start(); SendTimeEvent(100); AssertEvent("1", "1.1", "noTimestampOne.one"); SendTimeEvent(100); AssertEvent("2", "2.2", "noTimestampOne.two"); SendTimeEvent(100); AssertEvent("3", "3.3", "noTimestampOne.three"); }
public void TestNoPropertyTypes() { CompileDeploy(_runtime, "@public @buseventtype create schema allStringEvent(myInt string, myDouble string, myString string)"); var adapterSpec = new CSVInputAdapterSpec( new AdapterInputSource(_container, "regression/noTimestampOne.csv"), "allStringEvent"); adapterSpec.EventsPerSec = 10; adapterSpec.PropertyOrder = new[] { "myInt", "myDouble", "myString" }; adapterSpec.IsUsingEngineThread = true; _adapter = new CSVInputAdapter(_runtime, adapterSpec); const string statementText = "select * from allStringEvent#length(5)"; var statement = CompileDeploy(_runtime, statementText).Statements[0]; statement.Events += _listener.Update; _adapter.Start(); SendTimeEvent(100); AssertEvent("1", "1.1", "noTimestampOne.one"); SendTimeEvent(100); AssertEvent("2", "2.2", "noTimestampOne.two"); SendTimeEvent(100); AssertEvent("3", "3.3", "noTimestampOne.three"); }
private void StartAdapter(String filename, int eventsPerSec, bool isLooping, bool usingEngineThread, String timestampColumn, String[] propertyOrder) { var adapterSpec = new CSVInputAdapterSpec(new AdapterInputSource(filename), eventTypeName); if (eventsPerSec != -1) { adapterSpec.EventsPerSec = eventsPerSec; } adapterSpec.IsLooping = isLooping; adapterSpec.PropertyOrder = propertyOrder; adapterSpec.IsUsingEngineThread = usingEngineThread; adapterSpec.TimestampColumn = timestampColumn; adapter = new CSVInputAdapter(epService, adapterSpec); adapter.Start(); }
public void TestStop() { const string filename = "regression/timestampOne.csv"; const int eventsPerSec = -1; IList<Object[]> events = new List<Object[]>(); events.Add(new Object[] {100, 1, 1.1, "timestampOne.one"}); events.Add(new Object[] {200, 3, 3.3, "timestampOne.three"}); const bool isLooping = false; StartAdapter(filename, eventsPerSec, isLooping, true, "timestamp", _propertyOrderTimestamps); AssertFlatEvents(events); _adapter.Stop(); SendTimeEvent(1000); Assert.IsFalse(_listener.GetAndClearIsInvoked()); _adapter.Start(); AssertFlatEvents(events); }
public void TestConflictingPropertyOrder() { var adapterSpec = new CSVInputAdapterSpec(new AdapterInputSource("regression/intsTitleRow.csv"), "intsTitleRowEvent"); adapterSpec.EventsPerSec = 10; adapterSpec.PropertyOrder = new[] { "intTwo", "intOne" }; adapterSpec.IsUsingEngineThread = true; adapter = new CSVInputAdapter(epService, adapterSpec); const string statementText = "select * from intsTitleRowEvent#length(5)"; EPStatement statement = epService.EPAdministrator.CreateEPL(statementText); statement.Events += listener.Update; adapter.Start(); SendTimeEvent(100); Assert.IsTrue(listener.GetAndClearIsInvoked()); Assert.AreEqual(1, listener.GetLastNewData().Length); Assert.AreEqual("1", listener.GetLastNewData()[0].Get("intTwo")); Assert.AreEqual("0", listener.GetLastNewData()[0].Get("intOne")); }