public void Test()
        {
            IDataSource <Message>  dataSource = new DataSource();
            IDataSink <Message>    dataSink   = new DataSink();
            PipelineBase <Message> pipeline   = new Pipeline(dataSource, dataSink);

            pipeline.Process();
            Assert.AreEqual <string>(Environment.MachineName + "AB",
                                     pipeline.Message.Data);
        }
Пример #2
0
        public void Test()
        {
            IDataSource <Message>  dataSource = new DataSource();
            IDataSink <Message>    dataSink   = new DataSink();
            PipelineBase <Message> pipeline   = new Pipeline(dataSource, dataSink);

            pipeline.Add(new AppendAFilter());
            ActiveFilter activeFilter = new ActiveFilter();

            pipeline.Add(activeFilter);
            pipeline.Add(new AppendBFilter());

            /// 由主动性Filter发起的调用
            activeFilter.Action();
            Assert.AreEqual <string>(Environment.MachineName + "AB",
                                     pipeline.Message.Data);
        }
Пример #3
0
        /// <summary>
        /// Construct a IDataSource object based on a provider and sink type.
        /// </summary>
        public static IDataSource GetDataSource(DataSourceProvider provider, DataSink dataSink)
        {
            IDataSource returnSource = null;

            switch (provider)
            {
            case DataSourceProvider.AzureBlob:
                returnSource = new AzureBlobSource();
                break;

            case DataSourceProvider.LabeledAzureBlob:
                returnSource = new LabeledAzureBlobSource();
                break;

            case DataSourceProvider.LocalDisk:
                returnSource = new LocalDiskSource();
                break;

            case DataSourceProvider.LabelledLocalDisk:
                returnSource = new LabelledLocalDiskSource();
                break;

            default:
                throw new System.Exception("Invalid provider");
            }

            switch (dataSink)
            {
            case DataSink.Catalog:
                returnSource.Sink = new CatalogSink(returnSource.Name);
                break;

            case DataSink.None:
                break;

            default:
                throw new System.Exception("Invalid Sink");
            }

            return(returnSource);
        }