public static FlatFileSourceComponentWrapper CreateComponent(FlatFileSource flatFileSource, DataFlowTaskWrapper dataFlowTaskWrapper, PackageWrapper packageWrapper, ProjectWrapper projectWrapper) { FlatFileSourceComponentWrapper flatFileSourceComponentWrapper = new FlatFileSourceComponentWrapper(dataFlowTaskWrapper) { Name = flatFileSource.Name, RetainNulls = flatFileSource.RetainNulls }; if (flatFileSource.FlatFileSourceColumns != null) { foreach (DataFlowColumnMapping dataFlowColumnMapping in flatFileSource.FlatFileSourceColumns) { flatFileSourceComponentWrapper.CustomMappingColumns.Add((dataFlowColumnMapping.SourceColumn, dataFlowColumnMapping.TargetColumn)); } } SetConnectionManager(projectWrapper, packageWrapper, flatFileSourceComponentWrapper, flatFileSource.ConnectionName); try { flatFileSourceComponentWrapper.GetMetadata(); } catch (Exception e) { throw new Exception($"Failed to get metadata for data flow component {flatFileSourceComponentWrapper.Name}!", e); } return(flatFileSourceComponentWrapper); }
public void FlatFileSource_FullLoadTest() { var schema = new FlatFileSource("./TestMultilineFile.txt", RuntimeContext.Empty); int fires = 0; foreach (var item in schema.Rows) { fires += 1; } Assert.AreEqual(6, fires); }
public void FlatFileSource_CancelledLoadTest() { var endWorkTokenSource = new CancellationTokenSource(); endWorkTokenSource.Cancel(); var schema = new FlatFileSource("./TestMultilineFile.txt", new RuntimeContext(endWorkTokenSource.Token, new ISchemaColumn[0])); int fires = 0; foreach (var item in schema.Rows) { fires += 1; } Assert.AreEqual(0, fires); }
public void FlatFileSource_CancelledLoadTest() { var endWorkTokenSource = new CancellationTokenSource(); endWorkTokenSource.Cancel(); var schema = new FlatFileSource("./TestMultilineFile.txt", new InterCommunicator(endWorkTokenSource.Token)); int fires = 0; foreach (var item in schema.Rows) { fires += 1; } Assert.AreEqual(0, fires); }