Example #1
0
        private static void TestStringEqual(IProcessorFactory factory, object superImportantReference)
        {
            const string FILTER_VALUE = "Hello, World!";
            var          processor    = factory.Create(
                ProcessorType.StringEqual,
                superImportantReference,
                FILTER_VALUE);

            if (!processor.TryProcess(FILTER_VALUE))
            {
                throw new InvalidOperationException("This should have matched.");
            }

            if (processor.TryProcess("Goodbye, Cruel World!"))
            {
                throw new InvalidOperationException("This should not have matched.");
            }

            if (processor.TryProcess(10))
            {
                throw new InvalidOperationException("This should not have matched.");
            }

            if (processor.TryProcess(new object()))
            {
                throw new InvalidOperationException("This should not have matched.");
            }
        }
Example #2
0
 public HomeController(IProcessorFactory factory, PayChannelService payChannelService,
                       PayOrderService payOrderService)
 {
     this.factory            = factory;
     this._payChannelService = payChannelService;
     this._payOrderService   = payOrderService;
 }
Example #3
0
        private static void TestGreaterThan(IProcessorFactory factory, object superImportantReference)
        {
            const int FILTER_VALUE = 10;
            var processor = factory.Create(
                ProcessorType.GreaterThan, 
                superImportantReference, 
                FILTER_VALUE);

            if (processor.TryProcess(FILTER_VALUE - 5))
            {
                throw new InvalidOperationException("This should not have been greater than.");
            }

            if (!processor.TryProcess(FILTER_VALUE + 5))
            {
                throw new InvalidOperationException("This should have been greater than.");
            }

            if (processor.TryProcess("This isn't a number."))
            {
                throw new InvalidOperationException("This should have failed because the input is invalid.");
            }

            if (processor.TryProcess(new object()))
            {
                throw new InvalidOperationException("This should have failed because the input is invalid.");
            }
        }
Example #4
0
        static FacturanetProcessorFactory()
        {
            ProcessorFactoryCollection = new List <IProcessorFactory>();
            IProcessorFactory processorFactory;

            string cfgDriverAssembly = ConfigurationManager.AppSettings["ModuleAssembly"];
            string cfgDriverType     = ConfigurationManager.AppSettings["ModuleType"];

            processorFactory = (IProcessorFactory)(Activator.CreateInstance(
                                                       cfgDriverAssembly,
                                                       cfgDriverType)).Unwrap();
            ProcessorFactoryCollection.Add(processorFactory);

            ////////////////////////////////////////////////////////////
            // TODO: habrĂ­a que hacer que se cargue un array de factories
            ////////////////////////////////////////////////////////////
#if DEBUG
            string cfgDriverAssemblyMock = ConfigurationManager.AppSettings["ModuleAssemblyTest"];
            string cfgDriverTypeMock     = ConfigurationManager.AppSettings["ModuleTypeTest"];
            ProcessorFactoryMock = (IProcessorFactory)(Activator.CreateInstance(
                                                           cfgDriverAssemblyMock,
                                                           cfgDriverTypeMock)).Unwrap();
#endif
            Instance = new FacturanetProcessorFactory();
        }
Example #5
0
        private static void TestLessThan(IProcessorFactory factory, object superImportantReference)
        {
            const int FILTER_VALUE = 10;
            var       processor    = factory.Create(
                ProcessorType.LessThan,
                superImportantReference,
                FILTER_VALUE);

            if (!processor.TryProcess(FILTER_VALUE - 5))
            {
                throw new InvalidOperationException("This should have been less than.");
            }

            if (processor.TryProcess(FILTER_VALUE + 5))
            {
                throw new InvalidOperationException("This should not have been less than.");
            }

            if (processor.TryProcess("This isn't a number."))
            {
                throw new InvalidOperationException("This should have failed because the input is invalid.");
            }

            if (processor.TryProcess(new object()))
            {
                throw new InvalidOperationException("This should have failed because the input is invalid.");
            }
        }
Example #6
0
 public TasksController(
     ILoggerFactory loggerFactory,
     IProcessorFactory processorFactory)
 {
     _logger           = loggerFactory.CreateLogger <TasksController>();
     _processorFactory = processorFactory;
 }
Example #7
0
 protected CompressionSettings()
 {
     _inputQueueFactory = CreateDefaultInputQueueFactory();
     _reader            = CreateDefaultReader();
     _writer            = CreateDefaultWriter();
     _processorFactory  = CreateProcessorFactory();
 }
Example #8
0
        public ProcessorThreadPool(string name, int threadCount, IProcessorFactory processorFactory)
        {
            _name             = name;
            _threadCount      = threadCount;
            _processorFactory = processorFactory;

            _log = Log.For(this);
        }
Example #9
0
 protected PonyTextContext(AbstractTextElement textElement, IProcessorFactory processorFactory)
 {
     this.textElement = textElement;
     ProcessorFactory = processorFactory;
     MacroTable       = new MacroTable();
     ContextProperty  = new PropertyConfiguration();
     Metadata         = new ContextMetadata();
 }
 private void RegisterDefaultContent(IProcessorFactory processorFactory)
 {
     processorFactory.RegisterContentFor <GetUserBlogsProcessor>(MetaWeblogActions.GetUsersBlogs);
     processorFactory.RegisterContentFor <GetCategoriesProcessor>(MetaWeblogActions.GetCategories);
     processorFactory.RegisterContentFor <GetRecentPostsProcessor>(MetaWeblogActions.GetRecentPosts);
     processorFactory.RegisterContentFor <NewPostProcessor>(MetaWeblogActions.NewPost);
     processorFactory.RegisterContentFor <DeletePostProcessor>(MetaWeblogActions.DeletePost);
 }
Example #11
0
        public ProcessorThreadPool(string name, int threadCount, IProcessorFactory processorFactory)
        {
            this.name = name;
            this.threadCount = threadCount;
            this.processorFactory = processorFactory;

            _log = Log.For(this);
        }
        public BootstrapperClass(IProcessorFactory processorFactory, IBootstrapperSettings bootstrapSettings, ILogger logger)
        {
            this.processorFactory  = processorFactory;
            this.bootstrapSettings = bootstrapSettings;
            this.logger            = logger;

            Debug.Assert(this.bootstrapSettings != null, "Bootstrapper settings should not be null");
            Debug.Assert(this.bootstrapSettings.Phase != AnalysisPhase.Unspecified, "Expecting the processing phase to be specified");
        }
 public VkDataFeedsParserProcess(IVkGroupRepository groupRepository, IUnitOfWorkProvider transactionProvider, IProcessorFactory processorFactory, IConfigurationProvider configProvider, IDateTimeHelper dateTimeHelper, IWebUtilities webUtilities, ILog log)
 {
     this.log = log;
     this.processorFactory    = processorFactory;
     this.configProvider      = configProvider;
     this.dateTimeHelper      = dateTimeHelper;
     this.webUtilities        = webUtilities;
     this.groupRepository     = groupRepository;
     this.transactionProvider = transactionProvider;
 }
Example #14
0
 public HomeController(
     IProcessorFactory factory,
     IServiceBus bus,
     MerchantService merchantService
     )
 {
     this.factory          = factory;
     this.bus              = bus;
     this._merchantService = merchantService;
 }
Example #15
0
 public Engine(
     IProcessorFactory processorFactory,
     IJournalsMetaDataService journalsMetaService,
     IHelpProvider helpProvider,
     ILogger logger)
 {
     this.processorFactory    = processorFactory ?? throw new ArgumentNullException(nameof(processorFactory));
     this.journalsMetaService = journalsMetaService ?? throw new ArgumentNullException(nameof(journalsMetaService));
     this.helpProvider        = helpProvider ?? throw new ArgumentNullException(nameof(helpProvider));
     this.logger = logger;
 }
 public MetaWeblogController(
     IRequestMapperFactory requestMapperFactory,
     IResponseMapperFactory responseMapperFactory,
     IHttpResponseMessageMapperFactory httpResponseMessageMapperFactory,
     IProcessorFactory processorFactory)
 {
     this.requestMapperFactory             = requestMapperFactory;
     this.responseMapperFactory            = responseMapperFactory;
     this.httpResponseMessageMapperFactory = httpResponseMessageMapperFactory;
     this.processorFactory = processorFactory;
 }
Example #17
0
        public MessageDispatcher(int numberOfProcessors, IProcessorFactory processorFactory)
        {
            _processors = Enumerable
                          .Range(0, numberOfProcessors)
                          .Select(i => processorFactory.Create(i.ToString(), this))
                          .ToList();

            foreach (var processor in _processors)
            {
                processor.OnDone += Done;
            }
        }
Example #18
0
        /// <summary>
        /// Processor a XML file into the MongoDB.
        /// </summary>
        /// <param name="directoryPath">the directory of all the files to process</param>
        private static void ProcessFiles(string directoryPath)
        {
            foreach (var FileName in Directory.GetFiles(directoryPath))
            {
                IProcessor Processor = IProcessorFactory.GetProcessor(FileName);

                if (Processor != null)
                {
                    Processor.ProcessFile();
                }
            }
        }
Example #19
0
        public ProcessorThreadPool(string name, int threadCount, IProcessorFactory processorFactory)
        {
            Guard.AgainstNull(processorFactory, nameof(processorFactory));

            if (threadCount < 1)
            {
                throw new ThreadCountZeroException();
            }

            _name             = name ?? Guid.NewGuid().ToString();
            _threadCount      = threadCount;
            _processorFactory = processorFactory;

            _log = Log.For(this);
        }
Example #20
0
        static void Main(string[] args)
        {
            //register the container
            Container container = GetRegisteredContainer();

            //simulate the internal state of the program
            _processorFactory = container.GetInstance <ProcessorFactory>();

            //each of this request below simulate independant executing of the program
            RunRequest(RequestType.Internal);
            RunRequest(RequestType.External);

            //just to hold the program
            Console.ReadKey();
        }
        public DirectoryProcessor(string direcoryName, IJournalMeta journalMeta, IProcessorFactory processorFactory)
        {
            if (journalMeta == null)
            {
                throw new ArgumentNullException(nameof(journalMeta));
            }

            if (processorFactory == null)
            {
                throw new ArgumentNullException(nameof(processorFactory));
            }

            this.DirectoryName    = direcoryName;
            this.journalMeta      = journalMeta;
            this.processorFactory = processorFactory;
        }
Example #22
0
 public PersonService(IProcessorFactory processor, IMapper mapper)
 {
     _processor = processor;
     _mapper    = mapper;
 }
Example #23
0
 public StageProcessor(ISubscriberRepository subscriberRepository, IProcessorFactory processorFactory) : base(subscriberRepository)
 {
     _processorFactory = processorFactory;
 }
 public PersonProjection(IProcessorFactory processor, IMapper mapper)
 {
     _processor = processor;
     _mapper    = mapper;
 }
 public BootstrapperClass(IProcessorFactory processorFactory, IBootstrapperSettings bootstrapSettings, ILogger logger)
     : this(processorFactory, bootstrapSettings, logger, assemblyPath => AssemblyName.GetAssemblyName(assemblyPath).Version)
 {
 }
Example #26
0
 public OrderController(ILogger <OrderController> logger, IProcessorFactory processorFactory, IMapper mapper)
 {
     _logger           = logger;
     _processorFactory = processorFactory;
     _mapper           = mapper;
 }
Example #27
0
 public MappingProcessor(IProcessorFactory processorFactory, IPropertyPipelineFactory propertyPipelineFactory)
 {
     _processorFactory        = processorFactory ?? throw new ArgumentNullException(nameof(processorFactory));
     _propertyPipelineFactory = propertyPipelineFactory ?? throw new ArgumentNullException(nameof(propertyPipelineFactory));
 }
Example #28
0
 public CasePlanInstanceProcessor(IProcessorFactory processorFactory, ISubscriberRepository subscriberRepository)
 {
     _processorFactory     = processorFactory;
     _subscriberRepository = subscriberRepository;
 }
 public ReportBuilder(IReportProvider reportProvider, IReportMerger reportMerger, IProcessorFactory processorFactory)
 {
     this.reportProvider = reportProvider;
     this.reportMerger = reportMerger;
     this.processorFactory = processorFactory;
 }
 public PaymentBusinessService(IProcessorFactory processorFactory)
 {
     _processorFactory = processorFactory ?? throw new ArgumentNullException(nameof(processorFactory));
 }
Example #31
0
 public ProcessInstanceProcessor(IProcessorFactory processorFactory)
 {
     _processorFactory = processorFactory;
 }
Example #32
0
 public SimpleTextContext(IProcessorFactory processorFactory)
     : base(new TextElementCollection(), processorFactory)
 {
 }
Example #33
0
        private static void TestStringEqual(IProcessorFactory factory, object superImportantReference)
        {
            const string FILTER_VALUE = "Hello, World!";
            var processor = factory.Create(
                ProcessorType.StringEqual,
                superImportantReference,
                FILTER_VALUE);

            if (!processor.TryProcess(FILTER_VALUE))
            {
                throw new InvalidOperationException("This should have matched.");
            }

            if (processor.TryProcess("Goodbye, Cruel World!"))
            {
                throw new InvalidOperationException("This should not have matched.");
            }

            if (processor.TryProcess(10))
            {
                throw new InvalidOperationException("This should not have matched.");
            }

            if (processor.TryProcess(new object()))
            {
                throw new InvalidOperationException("This should not have matched.");
            }
        }
Example #34
0
 public KafkaConsumer(IProcessorFactory processorFactory, IConfiguration configuration, ILogger <KafkaConsumer> logger)
 {
     _processorFactory = processorFactory;
     _configuration    = configuration;
     _logger           = logger;
 }
 /// <summary>
 /// Create new <see cref="HomeController" /> instance.
 /// </summary>
 /// <param name="processorFactory">factory for create processor class.</param>
 public HomeController(IProcessorFactory processorFactory)
 {
     Processor = processorFactory.CreateProcessor();
 }
 public Calculator(IProcessorFactory processorFactory)
 {
     Processor = processorFactory.CreateProcessor();
 }