Ejemplo n.º 1
0
        protected override void ExecuteRun(object runnable, OverrideSenderIDataLoadEventListener listener)
        {
            var dataLoadInfo = StartAudit();

            var globalCommand  = runnable as ExtractGlobalsCommand;
            var datasetCommand = runnable as ExtractDatasetCommand;

            var logging = new ToLoggingDatabaseDataLoadEventListener(_logManager, dataLoadInfo);
            var fork    =
                datasetCommand != null ?
                new ForkDataLoadEventListener(logging, listener, new ElevateStateListener(datasetCommand)):
                new ForkDataLoadEventListener(logging, listener);

            if (globalCommand != null)
            {
                var useCase = new ExtractionPipelineUseCase(_activator, _project, _globalsCommand, _pipeline, dataLoadInfo)
                {
                    Token = Token
                };
                useCase.Execute(fork);
            }

            if (datasetCommand != null)
            {
                var executeUseCase = new ExtractionPipelineUseCase(_activator, _project, datasetCommand, _pipeline, dataLoadInfo)
                {
                    Token = Token
                };
                executeUseCase.Execute(fork);
            }

            logging.FinalizeTableLoadInfos();
            dataLoadInfo.CloseAndMarkComplete();
        }
        protected void Execute(out ExtractionPipelineUseCase pipelineUseCase, out IExecuteDatasetExtractionDestination results)
        {
            DataLoadInfo d = new DataLoadInfo("Internal", _testDatabaseName, "IgnoreMe", "", true, new DiscoveredServer(UnitTestLoggingConnectionString));

            Pipeline pipeline = null;

            //because extractable columns is likely to include chi column, it will be removed from the collection (for a substitution identifier)
            var before = _extractableColumns.ToArray();

            try
            {
                pipeline        = SetupPipeline();
                pipelineUseCase = new ExtractionPipelineUseCase(_request.Configuration.Project, _request, pipeline, d);

                pipelineUseCase.Execute(new ThrowImmediatelyDataLoadEventListener());

                Assert.IsNotEmpty(pipelineUseCase.Source.Request.QueryBuilder.SQL);

                Assert.IsTrue(pipelineUseCase.ExtractCommand.State == ExtractCommandState.Completed);
            }
            finally
            {
                if (pipeline != null)
                {
                    pipeline.DeleteInDatabase();
                }
            }

            results             = pipelineUseCase.Destination;
            _extractableColumns = new List <IColumn>(before);
        }
Ejemplo n.º 3
0
        protected void Execute(out ExtractionPipelineUseCase pipelineUseCase, out IExecuteDatasetExtractionDestination results)
        {
            DataLoadInfo d = new DataLoadInfo("Internal", _testDatabaseName, "IgnoreMe", "", true, new DiscoveredServer(UnitTestLoggingConnectionString));

            Pipeline pipeline = null;

            try
            {
                pipeline        = SetupPipeline();
                pipelineUseCase = new ExtractionPipelineUseCase(_request.Configuration.Project, _request, pipeline, d);

                pipelineUseCase.Execute(new ThrowImmediatelyDataLoadEventListener());

                Assert.IsNotEmpty(pipelineUseCase.Source.Request.QueryBuilder.SQL);

                Assert.IsTrue(pipelineUseCase.ExtractCommand.State == ExtractCommandState.Completed);
            }
            finally
            {
                if (pipeline != null)
                {
                    pipeline.DeleteInDatabase();
                }
            }

            results = pipelineUseCase.Destination;
        }