public void TestResolveTitleRow() { // Use first row var firstRow = new String[] { "MyDouble", "MyInt", "MyString" }; Assert.AreEqual(firstRow, CSVPropertyOrderHelper.ResolvePropertyOrder(firstRow, _propertyTypes)); }
private void FinishInitialization(EPRuntime runtime, CSVInputAdapterSpec spec) { AssertValidParameters(runtime, spec); var spi = (EPRuntimeSPI)runtime; ScheduleSlot = new ScheduleBucket(-1).AllocateSlot(); _reader = new CSVReader(spec.AdapterInputSource); _reader.Looping = spec.IsLooping; var firstRow = FirstRow; var givenPropertyTypes = ConstructPropertyTypes( spec.EventTypeName, spec.PropertyTypes, spi.ServicesContext.EventTypeRepositoryBus); _propertyOrder = spec.PropertyOrder ?? CSVPropertyOrderHelper.ResolvePropertyOrder(firstRow, givenPropertyTypes); _reader.IsUsingTitleRow = IsUsingTitleRow(firstRow, _propertyOrder); if (!IsUsingTitleRow(firstRow, _propertyOrder)) { this._firstRow = firstRow; } _propertyTypes = ResolvePropertyTypes(givenPropertyTypes); if (givenPropertyTypes == null) { throw new EPException("CSV adapter requires a predefined event type name, the event type named '" + spec.EventTypeName + "' could not be found"); } Coercer.SetPropertyTypes(_propertyTypes); }
private void FinishInitialization(EPServiceProvider epService, CSVInputAdapterSpec spec) { AssertValidParameters(epService, spec); var spi = (EPServiceProviderSPI)epService; ScheduleSlot = spi.SchedulingMgmtService.AllocateBucket().AllocateSlot(); _reader = new CSVReader(_container, spec.AdapterInputSource); _reader.Looping = spec.IsLooping; var firstRow = FirstRow; var givenPropertyTypes = ConstructPropertyTypes( spec.EventTypeName, spec.PropertyTypes, spi.EventAdapterService); _propertyOrder = spec.PropertyOrder ?? CSVPropertyOrderHelper.ResolvePropertyOrder(firstRow, givenPropertyTypes); _reader.IsUsingTitleRow = IsUsingTitleRow(firstRow, _propertyOrder); if (!IsUsingTitleRow(firstRow, _propertyOrder)) { this._firstRow = firstRow; } _propertyTypes = ResolvePropertyTypes(givenPropertyTypes); if (givenPropertyTypes == null) { spi.EventAdapterService.AddNestableMapType(_eventTypeName, new Dictionary <string, object>(_propertyTypes), null, true, true, true, false, false); } Coercer.SetPropertyTypes(_propertyTypes); }