示例#1
0
 private static DelimitedLineReader GetReader(IEtlContext context, string fileName, bool removeSurroundingDoubleQuotes = true)
 {
     return(new DelimitedLineReader(context)
     {
         StreamProvider = new LocalFileStreamProvider()
         {
             FileName = fileName,
         },
         Columns = new()
         {
示例#2
0
 public void WrapIsWorking()
 {
     var context = TestExecuter.GetContext();
     var builder = SequenceBuilder.Fluent
                   .ReadFromExcel(new EpPlusExcelReader(context)
     {
         StreamProvider = new LocalFileStreamProvider()
         {
             FileName = @".\TestData\Test.xlsx",
         },
         SheetName = "DateBroken",
         Columns   = new()
         {
示例#3
0
        public void Database_BranchedScenario()
        {
            SampleDatabase.EnsureBuilt();

            // Make a branch of the database in "Database.Branched"
            string          branchedFolder         = Path.Combine(s_RootPath, @"..\Database.Branched");
            IStreamProvider branchedStreamProvider = new LocalFileStreamProvider(branchedFolder);

            branchedStreamProvider.Delete(".");

            IStreamProvider mainStreamProvider = SampleDatabase.XDatabaseContext.StreamProvider;

            XDatabaseContext branchedContext = new XDatabaseContext(SampleDatabase.XDatabaseContext);

            branchedContext.StreamProvider = new MultipleSourceStreamProvider(branchedStreamProvider, mainStreamProvider, MultipleSourceStreamConfiguration.LocalBranch);
            branchedContext.Runner         = new WorkflowRunner(branchedContext);

            // Ask for WebRequest in the main database; verify built
            XForm("build WebRequest", 0);
            Assert.IsTrue(mainStreamProvider.Attributes("Table\\WebRequest").Exists);

            // Ask for WebRequest in the branch. Verify the main one is loaded where it is
            XForm("build WebRequest", 0, branchedContext);
            Assert.IsFalse(branchedStreamProvider.Attributes("Table\\WebRequest").Exists);

            // Ask for WebRequest.Authenticated in the main database; verify built
            XForm("build WebRequest.Authenticated", 0);
            Assert.IsTrue(mainStreamProvider.Attributes("Table\\WebRequest.Authenticated").Exists);
            Assert.IsFalse(branchedStreamProvider.Attributes("Table\\WebRequest.Authenticated").Exists);

            // Make a custom query in the branch. Verify the branched source has a copy with the new query, but it isn't published back
            string webRequestAuthenticatedConfigNew = @"
                read WebRequest

                # Slightly different query
                where [UserName] != ""
                where [UserName] != null";

            branchedStreamProvider.WriteAllText("Config\\WebRequest.Authenticated.xql", webRequestAuthenticatedConfigNew);
            XForm("build WebRequest.Authenticated", 0, branchedContext);
            Assert.IsTrue(branchedStreamProvider.Attributes("Table\\WebRequest.Authenticated").Exists);
            Assert.AreEqual(webRequestAuthenticatedConfigNew, ((BinaryTableReader)branchedContext.Runner.Build("WebRequest.Authenticated", branchedContext)).Query);
            Assert.AreNotEqual(webRequestAuthenticatedConfigNew, ((BinaryTableReader)SampleDatabase.XDatabaseContext.Runner.Build("WebRequest.Authenticated", SampleDatabase.XDatabaseContext)).Query);
        }