static void Main(string[] args)
        {
            Log.WriteLine("rpg.parsevariables parser=[jmeter|silkperformer] <...> <out:intermediatefile>", true);
            Log.WriteLine("version " + typeof(Program).Assembly.GetName().Version.ToString());
            //Log.WriteLine("silkperformer: <transactionfilecsv> <transactionfilebrp>");
            //Log.WriteLine("jmeter: <transactionfilejtl> <transactionfilecsv>");

            ParamInterpreter parameters = new ParamInterpreter();

            parameters.Initialize(args);
            parameters.ToConsole();

            VariableController controller = null;

            if (parameters.Value("parser") == "jmeter")
            {
                controller = new JmeterVariableController();
            }

            if (parameters.Value("parser") == "silkperformer")
            {
                controller = new SilkVariableController();
            }

            if (controller == null)
            {
                throw new Exception(string.Format("Not a valid parser [{0}]", parameters.Value("parser")));
            }

            controller.Parse(parameters);

            Log.WriteLine("rpg.parsevariables finished\n", true);
        }
        public virtual void Parse(ParamInterpreter parameters)
        {
            // check input file format (is it what we expect?)
            try
            {
                CheckInputfileFormat(parameters);
            }
            catch (Exception e)
            {
                throw new FormatException("Cannot parse, input file format problem [" + e.Message + "]");
            }

            // perform loadgen specific parse (in derived classes)
            DoParse(parameters);

            // check if parsed data is usable for further processing
            CheckDataViable(parameters);

            // generate aggregated data (faultperc)
            GenerateAggregates(parameters);

            // convert data to confom system locale settings (output formatting is done during merge)
            FormatData();

            // Write intermediate file
            WriteIntermediate(parameters);
        }
        public const string REPORTTRANSACTIONNAMEPATTERN = @"\d\d_"; // TODO naar app config

        public void Parse(ParamInterpreter p)
        {
            // from here: technology specific, handled in overrides in derived classes

            // check input file format (is it what we expect?)
            try
            {
                CheckInputfileFormat(p);
            }
            catch (Exception e)
            {
                throw new FormatException("Cannot parse input file, format problem: " + e.Message);
            }

            // perform loadgen specific parse (in derived classes)
            DoParse(p);

            // convert data to confom system locale settings (output formatting is done during merge)
            FormatData();

            // from here: generic for all technology, handled on parent level

            // perform post-processing on parsed measure data (derived data and trend analysis)
            Postprocess();

            // Write intermediate file
            WriteIntermediate(p);
        }
        public const string DURATIONTIMEFORMAT = @"hh\:mm\:ss";         // time format (testrun duration)

        public void Parse(ParamInterpreter p)
        {
            ReadLinesFromFile(p);

            // rptgendatetime, no data needed
            ParseRptGenDateTime();

            _variables.Add(PRINTABLETIMEKEY, ParsePrintableTime()); // for backward compatibility
            Log.WriteLine(PRINTABLETIMEKEY + "=" + _variables[PRINTABLETIMEKEY]);

            _variables.Add(TESTRUNDATETIMEKEY, _variables[PRINTABLETIMEKEY]); // duplicate PrintableTime to proper variable name
            Log.WriteLine(TESTRUNDATETIMEKEY + "=" + _variables[TESTRUNDATETIMEKEY]);

            _variables.Add(TESTDURATIONKEY, ParseTestDuration(_variables[TESTRUNDATETIMEKEY]));
            Log.WriteLine(TESTDURATIONKEY + "=" + _variables[TESTDURATIONKEY]);

            _variables.Add(MEREGEDUSERSKEY, ParseMergedUsers());
            Log.WriteLine(MEREGEDUSERSKEY + "=" + _variables[MEREGEDUSERSKEY]);

            _variables.Add(LGTYPEKEY, ParseLoadgenType());
            Log.WriteLine(LGTYPEKEY + "=" + _variables[LGTYPEKEY]);

            _variables.Add(FAULTPERCENTAGEKEY, ParseFaultPercentage());
            Log.WriteLine(FAULTPERCENTAGEKEY + "=" + _variables[FAULTPERCENTAGEKEY]);

            WriteIntermediate(p.Value("intermediatefile"));
        }
Exemple #5
0
        // Read raw data and write it to intermediate file
        // this intermediate file content should be formatted as the target template needs thus include commandline separator characters
        // intermediate format should be search-and-replaceable in the target template, one merge tool for all types of intermediate values
        static void Main(string[] args)
        {
            Log.WriteLine("rpg.parsemeasures parser=[jmeter, silkperformer] <parameters (ask)>", true);
            Log.WriteLine("version " + typeof(Program).Assembly.GetName().Version.ToString());

            ParamInterpreter parameters = new ParamInterpreter();

            parameters.Initialize(args);
            parameters.ToConsole();

            MeasureController controller = null;

            if (parameters.Value("parser") == "jmeter")
            {
                controller = new JmeterMeasureController();
            }

            if (parameters.Value("parser") == "silkperformer")
            {
                controller = new SilkMeasureController();
            }

            if (controller == null)
            {
                throw new Exception(string.Format("Not a valid parser [{0}]", parameters.Value("parser")));
            }

            controller.Parse(parameters);

            Log.WriteLine("rpg.parsemeasures finished\n", true);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Log.WriteLine("rpg.compresslglog parser=[jmeter|silkperformer] <...> <out:destinationfile>", true);
            Log.WriteLine("version " + typeof(Program).Assembly.GetName().Version.ToString());

            ParamInterpreter parameters = new ParamInterpreter();

            parameters.Initialize(args);
            parameters.ToConsole();

            CompressController controller = null;

            if (parameters.Value("parser") == "jmeter")
            {
                controller = new JmeterCompressController();
            }

            if (parameters.Value("parser") == "silkperformer")
            {
                controller = new SilkCompressController();
            }

            if (controller == null)
            {
                throw new Exception(string.Format("Not a valid parser [{0}]", parameters.Value("parser")));
            }



            Log.WriteLine("start compression...");
            controller.Compress(parameters);

            Log.WriteLine("rpg.compresslglog finished\n", true);
        }
Exemple #7
0
        // Implemented by derived classes (standard returns false to force override)
        public override void CheckInputfileFormat(ParamInterpreter parameters)
        {
            string filename = parameters.Value(TRSCSVFILETAG);

            Log.WriteLine("checking file format (CSV + keyvalue) of " + filename);

            if (!Utils.IsCSVWithKey(filename, CHAPTERSTARTSTRING))
            {
                throw new FormatException("file is not CSV format or missing crucial keywords: " + filename);
            }
        }
Exemple #8
0
        // Implemented by derived classes (standard returns false to force override)
        public override void CheckInputfileFormat(ParamInterpreter parameters)
        {
            string filename = parameters.Value(TRSJTLFILETAG);

            Log.WriteLine("checking file format (XML + keyvalue) of " + filename);

            if (!Utils.IsXMLWithKey(filename, JTLCHECKSTR))
            {
                throw new FormatException("File is not XML format, or missing crucial key values: " + filename);
            }
        }
Exemple #9
0
        /// <summary>
        /// JMeter measure parser, toplevel executor
        /// </summary>
        /// <param name="p"></param>
        public override void DoParse(ParamInterpreter p)
        {
            // inlezen bruikbare jtl regels
            p.VerifyFileExists(TRSJTLFILETAG);
            jtlTrsLines = ReadMeasureDataText(p.Value(TRSJTLFILETAG));

            // ruwe measure data aggregeren
            ExtractTransactionMeasureData(jtlTrsLines);

            // additionele definities (nodig voor config van grafieken) inlezen -> measuredetails
            ExtractAdditionals(jtlTrsLines);
        }
        /// <summary>
        /// Definitions and measures -> 1 file
        /// </summary>
        /// <param name="filename"></param>
        public void WriteIntermediate(ParamInterpreter p)
        {
            Log.WriteLine("write intermediate data...");

            string fileName = p.Value("intermediatefile");

            Log.WriteLine("measure data to " + fileName);
            _measureDetails.items.WriteToFile(fileName);

            fileName = p.Value("intermediatefilevars");
            Log.WriteLine("measure data vars to " + fileName);
            _variables.WriteToFile(fileName);
        }
        /// <summary>
        /// Do actual parsing for Jmeter transactiondata
        /// </summary>
        /// <param name="parameters"></param>
        public override void DoParse(ParamInterpreter parameters)
        {
            Log.WriteLine("Execute JMeter parser...");

            // 2 input files are mandatory (success=summary with only successfull transactions all=all transactions including faulty
            parameters.VerifyFileExists(SUCCESSTRSCSV);
            parameters.VerifyFileExists(ALLTRSCSV);

            // Read only success (TrsBusyOk) transactions to _transactionDetails key-value pair list
            ReadTransactionDataFromCSV(parameters.Value(SUCCESSTRSCSV));

            // Add failed executions to success transaction data
            EnrichFailed(parameters.Value(ALLTRSCSV));
        }
        /// <summary>
        /// Generate aggregate data (total faults, average of percentiles...)
        /// </summary>
        /// <param name="parameters"></param>
        public void GenerateAggregates(ParamInterpreter parameters)
        {
            int cnt = 0;

            Log.WriteLine("generate aggregated data...");
            // scrape and aggregate data from transaction data
            TransactionValueAggregate transactionAggregate = new TransactionValueAggregate();

            // foreach transactionlines (evaluate only successful transactions, leave faulty ones away from aggregation)
            foreach (string transactionName in _transactionNames)
            {
                // only include in agggregation if transactionname matches 'report transacton name pattern'
                if (IsSummarizeTransaction(transactionName) && _transactionDetails.items.ContainsKey(transactionName))
                {
                    TransactionValue trs = new TransactionValue(_transactionDetails.items[transactionName]);
                    transactionAggregate.AddTransaction(trs);
                    cnt++;
                }
            }

            // give up if no summarizable transactions found (try to prevent weird crashes lateron)
            if (0 == cnt)
            {
                string msg = "no transaction names found that meet naming convention (" + REPORTTRANSACTIONNAMEPATTERN + ")";
                Log.WriteLine("SEVERE: " + msg);
                throw new Exception(msg);
            }

            transactionAggregate.Aggregate();

            // write aggregated transaction line
            _transactionDetails.Add(AGGREGATEDTRSNAME, transactionAggregate.ToString());

            // isolate most important values as variable for history graph -> measure format (later to variable category?)
            _variables.Add(AVGOF90PERCENTILES, Utils.ToMeasureFormatString(transactionAggregate.p90));
            _variables.Add(AVGOFMEDIAN, Utils.ToMeasureFormatString(transactionAggregate.median));
            _variables.Add(AVGOF95PERCENTILES, Utils.ToMeasureFormatString(transactionAggregate.p95));
            _variables.Add(AVGOFAVERAGES, Utils.ToMeasureFormatString(transactionAggregate.avg));
            _variables.Add(TRANSACTIONSFAILED, transactionAggregate.fail);

            // old, can be deleted in time (replaced by transactionssuccess)
            // _variables.Add(TRANSACTIONSTOTAL, transactionAggregate.cnt);
            _variables.Add(TRANSACTIONSTOTAL, AddIntStrings(transactionAggregate.cnt, transactionAggregate.fail));
            _variables.Add(TRANSACTIONSSUCCESS, transactionAggregate.cnt); // is new

            Log.WriteLine(string.Format("{0} of {1} transactions aggregated", cnt, _transactionNames.Length));
        }
        /// <summary>
        /// Check is format of input files is as expected
        /// </summary>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public override void CheckInputfileFormat(ParamInterpreter parameters)
        {
            Log.WriteLine("checking success trs csv...");
            string successFilename = parameters.Value(SUCCESSTRSCSV);

            if (!Utils.IsCSVWithKey(successFilename, "TOTAL"))
            {
                throw new FormatException(successFilename);
            }

            Log.WriteLine("checking all trs csv...");
            string allFilename = parameters.Value(ALLTRSCSV);

            if (!Utils.IsCSVWithKey(allFilename, "TOTAL"))
            {
                throw new FormatException(allFilename);
            }
        }
        // Check is format of input files is as expected
        public override void CheckInputfileFormat(ParamInterpreter parameters)
        {
            Log.WriteLine("checking brp file...");
            string brpFilename = parameters.Value(BRPFILETAG);

            if (!CheckFormatBRPFile(brpFilename))
            {
                throw new FormatException(brpFilename);
            }

            Log.WriteLine("checking csv file...");
            string csvFilename = parameters.Value(CSVFILETAG);

            if (!CheckFormatCSVFile(csvFilename))
            {
                throw new FormatException(csvFilename);
            }
        }
Exemple #15
0
        /// <summary>
        /// Silkperformer parser, toplevel executor
        /// </summary>
        /// <param name="p"></param>
        public override void DoParse(ParamInterpreter p)
        {
            // check if file exists
            p.VerifyFileExists(TRSCSVFILETAG);

            // read data
            csvLines = ReadLinesFromFile(p.Value(TRSCSVFILETAG));

            // extract names of measures
            Log.WriteLine("number of lines: " + csvLines.Length);
            _measureNames = ExtractMeasureNames(csvLines);

            // eerst definities (nodig voor config van grafieken) inlezen -> measuredetails
            ReadDefinitions(csvLines, new string[] { STARTTIMEKEY, INTERVALKEY });

            // dan measures (te plotten punten in de grafieken) inlezen -> measuredetails
            ReadMeasures(csvLines, _measureNames);
        }
Exemple #16
0
        public override void Compress(ParamInterpreter parameters)
        {
            parameters.VerifyFileExists(JTLFILESRC_TAG);

            string sourceLogFile = parameters.Value(JTLFILESRC_TAG);

            outputStream = new StreamWriter(parameters.Value(DESTFILE_TAG));

            // Check input format
            Log.WriteLine("check input format...");
            CheckInputFormat(sourceLogFile);

            // Compress and write to output
            Log.WriteLine("compressing...");
            DoCompress(sourceLogFile);

            double compression = (srcLinesCount / destLinesCount) * 100;

            Log.WriteLine("source=" + srcLinesCount + " compressed=" + destLinesCount + "(compression=" + Math.Round(compression, 0) + "%)");
        }
        // constructor param chain

        public override void DoParse(ParamInterpreter parameters)
        {
            Log.WriteLine("Execute parser...");

            parameters.VerifyFileExists(BRPFILETAG);
            parameters.VerifyFileExists(CSVFILETAG);

            //SilkTransactionController c = new SilkTransactionController();
            // Read measures to in-memory intermediate format
            ReadTransactiondataFromCSV(parameters.Value(CSVFILETAG));

            // verrijken transactiedata met aggregatiedata
            EnrichTransactionDataFromCSV(parameters.Value(CSVFILETAG));
            EnrichTransactionDataFromXML(parameters.Value(BRPFILETAG));

            // controleer of bruikbare info gevonden is (alleen voor transacties is negatieve check fataal)
            if (!ContainsProjectTransactions())
            {
                throw new Exception("No transactiondata found in testresult (tsd or brp)");
            }
        }
        /// <summary>
        /// Write intermediate format to file
        /// </summary>
        /// <param name="parameters"></param>
        public void WriteIntermediate(ParamInterpreter parameters)
        {
            Log.WriteLine("Writing intermediate file...");

            // write transaction data
            string fileName = parameters.Value("intermediatefile");

            Log.WriteLine("transaction data: " + fileName);
            _transactionDetails.WriteToFile(fileName);

            // Extra: file with only headers
            _transactionDetails.WriteToFileFieldDefinitions(fileName, "fieldnames", string.Join(TransactionValue.LISTSEPARATOR.ToString(), TransactionValue.fieldnames));

            // Extra: file with all transactionnames
            _transactionDetails.WriteToFileTranactionnames(fileName);

            // write transaction variables
            string varFileName = parameters.Value("intermediatefilevars");

            Log.WriteLine("transaction variable data: " + varFileName);
            _variables.WriteToFile(varFileName);
        }
Exemple #19
0
        static void Main(string[] args)
        {
            Log.WriteLine("rpg.parsetransactions <in:parser [jmeter|silkperformer]> <parameters (ask)>", true);
            Log.WriteLine("version " + typeof(Program).Assembly.GetName().Version.ToString());

            ParamInterpreter parameters = new ParamInterpreter();

            parameters.Initialize(args);
            parameters.ToConsole();

            parameters.VerifyMandatory("parser");

            TransactionController controller = null;

            // read transaction data
            //ParseTransactionsSilkperformer(parameters);
            if (parameters.Value("parser") == "silkperformer")
            {
                Log.WriteLine("Creating Silkperformer parser...");
                controller = new SilkTransactionController();
            }

            //ParseTransactionsJMeter(parameters);
            if (parameters.Value("parser") == "jmeter")
            {
                Log.WriteLine("Creating JMeter parser...");
                controller = new JmeterTransactionController();
            }

            if (controller == null)
            {
                throw new Exception(string.Format("Not a valid parser [{0}]", parameters.Value("parser")));
            }

            controller.Parse(parameters);

            Log.WriteLine("rpg.parsetransactions finished\n", true);
        }
        //uitimo:
        //%toolspath%\srt.loadintermediate.exe %projcode% %testname% %temppath%\_transactions\(.*)\.(.*)\..*\.csv
        //param1=projectname
        //param2=testname
        //param3=filename regex; group1=category; group2=entity

        //voor nu: %toolspath%\srt.loadintermediate.exe %projcode% %testname% msr perf %temppath%\_transactions.msr.perf.csv

        static void Main(string[] args)
        {
            Log.WriteLine("rpg.loadintermediate <project> <testrun> <category> <entity> <intermediatefile> <database>", true);
            Log.WriteLine("version " + typeof(Program).Assembly.GetName().Version.ToString());

            ParamInterpreter Params = new ParamInterpreter();

            Params.Initialize(args);
            Params.ToConsole();

            Params.VerifyFileExists("intermediatefile");

            Globals.dbconnectstring = Params.Value("database");

            LoadIntermediateController c = new LoadIntermediateController();

            // inlezen intermedate data (verificatie van validiteit)
            c.ReadIntermediate(Params.Value("intermediatefile"));

            // opslaan intermediate in database
            c.StoreIntermediate(Params.Value("project"), Params.Value("testrun"), Params.Value("category"), Params.Value("entity"));

            Log.WriteLine("rpg.loadintermediate finished\n", true);
        }
 public override void ReadLinesFromFile(ParamInterpreter p)
 {
     jtlLines = ReadLinesFromFileJTL(p.Value(TRANSACTIONIFILEJTL));
     csvLines = ReadLinesFromFile(p.Value(TRANSACTIONFILECSV));
 }
 public abstract void ReadLinesFromFile(ParamInterpreter p);
 public override void Compress(ParamInterpreter parameters)
 {
     throw new NotImplementedException();
 }
 public abstract void DoParse(ParamInterpreter p);
 // Implemented by derived classes (standard returns false to force override)
 public abstract void CheckInputfileFormat(ParamInterpreter parameters);
 /// <summary>
 /// Check if pased data is enough to work with, generic check
 /// checks are now implemented in technology parts (aggregate part), but has to move to generic level here (TODO)
 /// </summary>
 /// <param name=""></param>
 public void CheckDataViable(ParamInterpreter parameters)
 {
     //
 }
 public abstract void Compress(ParamInterpreter parameters);
Exemple #28
0
 public override void ReadLinesFromFile(ParamInterpreter p)
 {
     csvLines = ReadLinesFromFile(p.Value(TRANSACTIONFILECSV));
     brpLines = ReadLinesFromFile(p.Value(TRANSACTIONFILEBRPNAME));
 }
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("### rpg.console - this is a console tool for basic teststraat data operations");
                Console.WriteLine(" [enabletestrun|disabletestrun] project=<projectname> testrun=<testrunpattern>");
                Console.WriteLine(" [createproject|deleteproject] project=<project>");
                Console.WriteLine(" listprojects");
                Console.WriteLine(" listtestruns project=<project>");
                Console.WriteLine(" deletetestrun project=<project> testrun=<testrun>");
                Console.WriteLine(" patterns are in all regex format, names are axact and not case sensitive");

                Environment.Exit(0);
            }

            ParamInterpreter _params = new ParamInterpreter();

            _params.Initialize(args, true);

            Globals.dbconnectstring = _params.Value("database");

            ConsoleController c = new ConsoleController();

            // Enable or disable test
            if (_params.Command == "enabletestrun") // core ready
            {
                c.EnableTestrun(_params.Value("project"), _params.Value("testrun"), true);
                return;
            }

            if (_params.Command == "disabletestrun") // core ready
            {
                c.EnableTestrun(_params.Value("project"), _params.Value("testrun"), false);
                return;
            }

            if (_params.Command == "listprojects") // core ready
            {
                c.ListProjectNamesToConsole();
                return;
            }

            if (_params.Command == "listtestruns") // core ready
            {
                c.ListTestrunNamesToConsole(_params.Value("project"));
                return;
            }

            if (_params.Command == "createproject") // core ready
            {
                c.CreateProject(_params.Value("project"));
                return;
            }

            if (_params.Command == "deleteproject")
            {
                c.DeleteProject(_params.Value("project"));
                return;
            }

            if (_params.Command == "deletetestrun")
            {
                c.DeleteTestrun(_params.Value("project"), _params.Value("testrun"));
                return;
            }

            Log.WriteLine(string.Format("Command [{0}] not found", _params.Command));
        }
Exemple #30
0
        /// <summary>
        /// Merge van intermediate format (varnaam=value) csv file met ascii template met ${varnaam} of ${varnaam:index} variabele id's erin opgenomen
        /// let op, vanaf bron gaan we naar system-default systemlocale (.,:), pas bij merge formatteren we naar een geschikt output format(formatPattern)
        /// formatpattern voorbeelden: MM:ss yyyy 0000 0,000
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            Log.WriteLine("rpg.merge [h (help), i (intermediate), v (variable), j (join), t (threshold), +t (with threshold), +d (with diff), +b (with baseline)] <templatefilename:name>", true);
            Log.WriteLine("version " + typeof(Program).Assembly.GetName().Version.ToString());

            ParamInterpreter _params = new ParamInterpreter();

            _params.Initialize(args);
            _params.ToConsole();

            //LicenseManager lic = new LicenseManager();
            //Log.WriteLine(string.Format("License {0} (expiration {1})", lic.IsValid() ? "is valid" : "has expired", lic.ExpirationDateStr));

            if (_params.AskForHelp())
            {
                Log.WriteLine("Merge database- or commandline data with HTML template and generate output HTML");
                Log.WriteLine("merge i project=<project> testrun=<testrun> category=<category> entity=<entity>");
                Log.WriteLine("  merge values from intermediate (i) database values");
                Log.WriteLine("merge v project=<project> name=<name> value=<value>");
                Log.WriteLine("  merge variable (v) from commandline (name/value), alternatieve to <name> <value> for inserting counters: #");
                Log.WriteLine("merge t project=<project>");
                Log.WriteLine("  merge threshold (t) reference data");
                Log.WriteLine("merge it/vt");
                Log.WriteLine("  generate and merge threshold (t) evaluation from database intermediate (i) or variable (v) data");
                Log.WriteLine("merge id");
                Log.WriteLine("  generate and merge diff (d) evaluation (compware values), generate extra _c color code 'highlite'");
                Log.WriteLine("merge ib project=<project> testrun=<testrun> category=<category> entity=<entity> <baseline testrun reference tag>");
                Log.WriteLine("  generate and merge Baseline evaluation, generate extra tags _cb (baseline) _ce (evaluation: percentage diff)");
                Log.WriteLine("merge j/jt project=<project> testrun=<testrun> category=<category> entity=<entity> valueindex=<index> historycount=<count> workload=<workload>");
                Log.WriteLine("  join (j) series[index] values to new series from all testruns matching pattern testrun pattern (regex) with max of count items (0=nomax)");
                Log.WriteLine("  join and add threshold colorcodes (jt)...");
                Log.WriteLine("  template variable patterns:");
                Log.WriteLine("    ${varname:1:0.000} 1 = n th place value in ';' separated value list; 0.000 = number formatpattern [cnt, min, avg, max, p90, fail, cancel, p50, p99, stdev]");
                Log.WriteLine("    $[<td class=${varname_c:#}>${varname:#:0.000}</td>] = multiple replace pattern example");
                Log.WriteLine("general: beginpattern=<realpattern> endpattern=<realpattern> : only effective between begin- and end pattern");
            }

            // mandatory params
            string templateFilename = _params.Value("templatefile");

            // optional params - works only if both parameters are not *
            string beginPattern = _params.Value("beginpattern", "*");
            string endPattern   = _params.Value("endpattern", "*");

            // check initial conditions before proceeding
            _params.VerifyMandatory("project");
            _params.VerifyMandatory("templatefile");
            _params.VerifyFileExists("templatefile");

            Globals.dbconnectstring = _params.Value("database");

            // create controller and initialialize for this project
            MergeController mergeController = new MergeController(_params.Value("project"));

            mergeController.ReadTemplate(templateFilename);

            if (_params.Function == 'i') // merge intermediate data
            {
                // read valueset for current testrun
                mergeController.ReadIntermediateValues(_params.Value("project"), _params.Value("testrun"), _params.Value("category"), _params.Value("entity", "*"));

                // Perform post-processing on data that was parsed and stored
                Log.WriteLine("Data post-processing phase...");

                // enrich intermediate with evaluation items
                if (_params.Switch == 't')
                {
                    mergeController.GenerateThresholdValues(colCodeBelowTh1, colCodeBetweenTh1Th2, colCodeAboveTh2, true);                        // threshold evaluatie -> kleurcodering (it= itermediate+threshold eval category x (trs))
                }
                if (_params.Switch == 'd')
                {
                    mergeController.GenerateDiffValues(colCodeHighlite);                        // diff evaluation -> colorcoding (id = intermediate+diff eval category x (params))
                }
                // baseline column values (or auto choise of baseline if not set)
                if (_params.Switch == 'b')
                {
                    mergeController.GenerateBaselineValues(_params.Value("testrun"), _params.Value("baselinetestrun"), colCodeBetterThanBaseline, colCodeWorseThanBaseline, true);
                }

                Log.WriteLine("Post-processing done, start merge...");

                // apply key prefix if configured
                if (_params.Value("prefix", "EMPTY") != "EMPTY")
                {
                    mergeController.ApplyPrefix(_params.Value("prefix"));
                }

                // merge with template
                mergeController.MergeIntermediate(templateFilename, false, beginPattern, endPattern);
            }
            else if (_params.Function == 'v') // merge variable with external value
            {
                // merge with template
                mergeController.MergeVariable(_params.Value("name"), _params.Value("value"), templateFilename, beginPattern, endPattern);
            }
            else if (_params.Function == 't') // merge thresholds table in top section of report
            {
                // get data from database
                mergeController.ReadIntermediateThreshold(_params.Value("project"));

                // merge with template
                mergeController.MergeIntermediate(templateFilename, true, beginPattern, endPattern);
            }
            else if (_params.Function == 'j') // join values historic overview
            {
                // get data from database (join all indexed values into one intermediate)
                mergeController.JoinIntermediateValues(_params.Value("project"), _params.Value("testrun", ".*"), _params.Value("category"), _params.Value("entity", "*"), _params.ValueInt("valueindex", "0"), _params.ValueInt("historycount", "10"), _params.Value("workload", "*"));

                // evaluate thresholds if needed
                if (_params.Switch == 't')
                {
                    mergeController.GenerateThresholdValues(colCodeBelowTh1, colCodeBetweenTh1Th2, colCodeAboveTh2);
                }

                // merge with template
                mergeController.MergeIntermediate(templateFilename, true, beginPattern, endPattern);
            }
            else
            {
                throw new Exception("No parameters, nothing to do");
            }

            Log.WriteLine("rpg.merge finished\n", true);
        }