Exemplo n.º 1
0
        public void InstanceMethodWay()
        {
            var runner = new StreamProcessRunner <SimpleConfigStreamType>(SimpleJob.Job1);
            var config = new SimpleConfigStreamType {
                Divider = 10
            };
            var task = runner.ExecuteAsync(config);

            task.Wait();
            CollectionAssert.AreEquivalent(new[] { $"{100 / 10} times hello world!" }, config.Messages.ToArray());
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var runner = new StreamProcessRunner <ComplexQuickstartJob, MyConfig>();

            runner.GetDefinitionStructure().OpenEstimatedExecutionPlanVisNetwork();
            StreamProcessDefinition <TraceEvent> traceStreamProcessDefinition = new StreamProcessDefinition <TraceEvent>(traceStream => traceStream.ToAction("logs to console", Console.WriteLine));
            var testFilesDirectory = @"C:\Users\sroyer\Source\Repos\Etl.Net\src\Samples\TestFiles";
            // var testFilesDirectory = @"C:\Users\paill\source\repos\Etl.Net\src\Samples\TestFiles";
            var task = runner.ExecuteAsync(new MyConfig
            {
                InputFolderPath             = Path.Combine(testFilesDirectory, @"."),
                InputFilesSearchPattern     = "testin.*.csv",
                TypeFilePath                = Path.Combine(testFilesDirectory, @"ref - Copy.csv"),
                DestinationFilePath         = Path.Combine(testFilesDirectory, @"outfile.csv"),
                CategoryDestinationFilePath = Path.Combine(testFilesDirectory, @"categoryStats.csv")
            }, traceStreamProcessDefinition);

            task.Result.OpenActualExecutionPlanD3Sankey();

            Console.WriteLine("Done");
            Console.WriteLine("Press a key...");
            Console.ReadKey();
        }
Exemplo n.º 3
0
        public void InstanceMethodWay()
        {
            var runner = new StreamProcessRunner <SimpleConfigStreamType>(SimpleJob.Job1);
            var config = new SimpleConfigStreamType {
                Divider = 0
            };
            var task = runner.ExecuteAsync(config);

            try
            {
                task.Wait();
                Assert.Fail("the execution should not be successfull");
            }
            catch (AggregateException ex)
            {
                JobExecutionException jobExecutionException = ex.InnerException as JobExecutionException;
                if (jobExecutionException == null)
                {
                    throw;
                }
                Assert.IsInstanceOfType(jobExecutionException.InnerException, typeof(DivideByZeroException));
                Assert.IsInstanceOfType((jobExecutionException.TraceEvent?.Content as UnhandledExceptionStreamTraceContent)?.Exception, typeof(DivideByZeroException));
            }
        }