Beispiel #1
0
        public void TestProcess()
        {
            IList <string>          parameters          = (IList <string>) this.Ctx.GetObject("Parameters");
            OptionsProcessor        optionsProcessor    = (OptionsProcessor)this.Ctx.GetObject("OptionsProcessor");
            ArgumentsProcessor      argumentsProcessor  = (ArgumentsProcessor)this.Ctx.GetObject("ArgumentsProcessor");
            ParametersProcessorImpl parametersProcessor = new ParametersProcessorImpl();

            parametersProcessor.Parameters         = parameters;
            parametersProcessor.OptionsProcessor   = optionsProcessor;
            parametersProcessor.ArgumentsProcessor = argumentsProcessor;

            parametersProcessor.Process();
        }
        public ParametersProcessor NewParametersProcessor(
            IList <string> parameters,
            OptionsProcessor optionsProcessor,
            ArgumentsProcessor argumentsProcessor
            )
        {
            ParametersProcessorImpl processor = new ParametersProcessorImpl();

            processor.Parameters         = parameters;
            processor.OptionsProcessor   = optionsProcessor;
            processor.ArgumentsProcessor = argumentsProcessor;
            return(processor);
        }
Beispiel #3
0
        private static void Main(string[] args)
        {
            //parse commandLine
            var options = new Options();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                Console.WriteLine("Incorect usage of commandline parameters. Please review.");
            }

            //get environment properties passed from command line
            var initialEnvironment = OptionsProcessor.GetEnvironmentFromParameters(options.EnvironmentParameters);

            var manager = new OperationsManager()
            {
                InitialEnvironmentDictionary = initialEnvironment,
                EnvironmentConfigurationFile = options.EnvironmentXml,
                FragmentsConfigurationFile   = options.StepsXml,
                PrintFileLocation            = options.PrintFileLocation,
                RulesBookFile = options.RulesBookXml,
            };

            //get output method
            {
                if (options.PrintInFile)
                {
                    manager.AddProcessingOption(ProcessingOptions.PrintFile);
                }

                if (options.PrintInConsole)
                {
                    manager.AddProcessingOption(ProcessingOptions.PrintConsole);
                }
            }

            try
            {
                manager.Process();
                Console.WriteLine("Success");
            }
            catch (Exception ex)
            {
                Console.WriteLine(string.Format("We have encounter the following issues when provessing: {0} ",
                                                ex.Message));
            }
        }
Beispiel #4
0
        [Test] public void TestNewParametersProcessor()
        {
            IList <string>     parameters         = (IList <string>) this.Ctx.GetObject("Parameters");
            OptionsProcessor   optionsProcessor   = (OptionsProcessor)this.Ctx.GetObject("OptionsProcessor");
            ArgumentsProcessor argumentsProcessor = (ArgumentsProcessor)this.Ctx.GetObject("ArgumentsProcessor");

            ParametersProcessor parametersProcessor = this.ConfigurationFactory.NewParametersProcessor(
                parameters,
                optionsProcessor,
                argumentsProcessor
                );

            Assert.That(parametersProcessor, Is.Not.Null);
            Assert.That(parametersProcessor, Is.InstanceOf(typeof(ParametersProcessorImpl)));
            ParametersProcessorImpl parametersProcessorImpl = (ParametersProcessorImpl)parametersProcessor;

            Assert.That(parametersProcessorImpl.Parameters, Is.EqualTo(parameters));
            Assert.That(parametersProcessorImpl.OptionsProcessor, Is.EqualTo(optionsProcessor));
            Assert.That(parametersProcessorImpl.ArgumentsProcessor, Is.EqualTo(argumentsProcessor));
        }
Beispiel #5
0
        static void TranslateOptions()
        {
            OptionsProcessor processor = new OptionsProcessor();

            // adds BCL to library (if not added yet):
            // TODO:
            // ApplicationContext.AddModule(typeof(PhpIni).Assembly, null);

            using (PhpStream stream = PhpStream.Open(iniFile, "rb", StreamOpenOptions.ReportErrors, StreamContext.Default))
            {
                if (stream == null)
                {
                    throw new ApplicationException(String.Format("Unable to open file '{0}' for reading.", iniFile));
                }

                PhpIniParser.Parse(stream, processor);
            }

            processor.WriteAll(configFile);
        }
Beispiel #6
0
        public void TestNewOptionsProcessor()
        {
            OptionConfiguration optionConfiguration = ConfigurationFactory.NewOptionConfiguration(
                "optionName",
                typeof(string),
                "optionFormat",
                true,
                "usage information"
                );
            IList <OptionConfiguration> optionsConfiguration = new List <OptionConfiguration>();

            optionsConfiguration.Add(optionConfiguration);

            OptionsProcessor processor = this.ConfigurationFactory.NewOptionsProcessor(optionsConfiguration);

            Assert.IsNotNull(processor);
            Assert.IsInstanceOf(typeof(OptionsProcessorImpl), processor);
            OptionsProcessorImpl processorImpl = processor as OptionsProcessorImpl;

            Assert.AreEqual(optionsConfiguration, processorImpl.OptionsConfiguration);
        }
Beispiel #7
0
		static void TranslateOptions()
		{
			OptionsProcessor processor = new OptionsProcessor();

			// adds BCL to library (if not added yet):
			// TODO:
			// ApplicationContext.AddModule(typeof(PhpIni).Assembly, null);

			using (PhpStream stream = PhpStream.Open(iniFile, "rb", StreamOpenOptions.ReportErrors, StreamContext.Default))
			{
				if (stream == null)
					throw new ApplicationException(String.Format("Unable to open file '{0}' for reading.", iniFile));

				PhpIniParser.Parse(stream, processor);
			}

			processor.WriteAll(configFile);
		}