Beispiel #1
0
        public void ProcessIntake_AsyncIntakeSupplier_SourceNoAlways1()
        {
            //arrange
            _config.AsyncIntake = true;
            _config.SetAsyncIntakeSupplier(new IntakeSupplierProvider(_intakeLines()).AsyncStringSupplier);

            var orchestrator = TestUtilities.GetTestOrchestrator(_config, "_clusteringBlock", _resultsExtractor);

            //act
            _ = orchestrator.ExecuteAsync();
            _resultsExtractor.Completion.Wait();

            //assert
            _resultingClusters.Should().HaveCount(8); // 8 single record clusters
            ValidateResultingRecords(_resultingClusters.SelectMany(c => c.Records).ToList());
        }
        internal DataProcessor(Func <Task <string> > intakeSupplierAsync, Action <string> outputConsumer, Action <int> progressHandler)
        {
            var config = new OrchestratorConfig()
            {
                ReportProgress         = true,
                ProgressInterval       = 10,
                ProgressChangedHandler = (s, e) => { if (e.Phase == Phase.Intake)
                                                     {
                                                         progressHandler(e.RecCnt);
                                                     }
                },
                PhaseFinishedHandler = (s, e) => { if (e.Phase == Phase.Intake)
                                                   {
                                                       progressHandler(e.RecCnt);
                                                   }
                },
                InputDataKind               = KindOfTextData.Delimited,
                InputFields                 = "PlaneDescription,IataCode,IcaoCode",
                AsyncIntake                 = true,
                TransformerType             = TransformerType.Universal,
                UniversalTransformer        = FilterAndReorganizeFields,
                AllowTransformToAlterFields = true,
                OutputDataKind              = KindOfTextData.Flat,
                OutputFields                = "IataCode|4,Hyphen|2,PlaneDescription|70",
                ExcludeExtraneousFields     = true
            };

            config.SetAsyncIntakeSupplier(intakeSupplierAsync);
            config.SetOutputConsumer(outputConsumer);

            Orchestrator = OrchestratorCreator.GetEtlOrchestrator(config);
        }