Пример #1
0
        /// <summary>
        /// Read baseline data from database and return previous if baselineTestrunName does not exist
        /// </summary>
        /// <param name="currentTestrunName"></param>
        /// <param name="baselineTestrunName"></param>
        /// <returns></returns>
        private Intermediate ReadBaselineData(string currentTestrunName, string baselineTestrunName)
        {
            string       baselineTestrunNameUsed = baselineTestrunName.Trim();
            Intermediate baselineReferenceValues = new Intermediate();
            bool         baselineFound;
            string       baselineReason = "specified";

            // lees baseline data
            Log.WriteLine("read baseline reference data...");
            baselineFound = (baselineReferenceValues.ReadFromDatabaseValues(this.project, baselineTestrunNameUsed, this.category, this.entity) > 0);

            // als baseline onbekend/niet gevuld: zoek naar geschikt alternatief
            if ((!baselineFound) || (baselineTestrunNameUsed.Length == 0))
            {
                Log.WriteLine(string.Format("baseline testrun [{0}] not found, search for suitable baseline...", baselineTestrunNameUsed));
                // dit is merge fase, huidige/nieuwe run zit al in de database, dus moeten we de vorige hebben
                DataAccess da = new DataAccess(this.project);

                string currentWorkload = da.GetValue(currentTestrunName, "workload");
                Log.WriteLine(string.Format("get testruns with same workload [{0}]...", currentWorkload));
                string[] testruns = da.GetTestrunNamesWithValue(this.project, ".*", "workload", currentWorkload);

                try
                {
                    // meest zuiver: neem de run vóór currentTestrun (vorige)
                    baselineTestrunNameUsed = testruns[Array.IndexOf(testruns, currentTestrunName) - 1];
                    baselineReason          = "not specified, using previous";
                    Log.WriteLine(string.Format("automatic baselining: run before current run selected [{0}]", baselineTestrunNameUsed));
                }
                catch
                {
                    baselineTestrunNameUsed = currentTestrunName;
                    baselineReason          = "not specified, using current";
                    Log.WriteLine("WARNING: no suitable baseline run found, use current run for comparison (no baselining)");
                }

                // 2e poging (fallback scenario)
                if (baselineReferenceValues.ReadFromDatabaseValues(this.project, baselineTestrunNameUsed, this.category, this.entity) == 0)
                {
                    throw new Exception(string.Format("No baseline data found ({0}/{1}/{2})", this.project, this.category, this.entity));
                }
            }

            // add baseline variables
            Log.WriteLine(string.Format("get variables from baseline [{0}]...", baselineTestrunNameUsed));
            if (intermediate.ReadFromDatabaseValues(this.project, baselineTestrunNameUsed, Category.Variable, "*", BASELINEKEYPREFIX) == 0)
            {
                Log.WriteLine("WARNING: no variable data found for baseline");
            }

            // add chosen baseline reference to intermediate (to be merged lateron) with reason
            AddInternalToIntermediate(BASELINEREFVARNAME, baselineTestrunNameUsed);
            AddInternalToIntermediate(BASELINEREASONVARNAME, baselineReason);

            return(baselineReferenceValues);
        }
Пример #2
0
        /// <summary>
        /// Read intermediate data from VALUE table
        /// </summary>
        /// <param name="p_project"></param>
        /// <param name="p_testrun"></param>
        /// <param name="p_category"></param>
        /// <param name="p_entity"></param>
        public void ReadIntermediateValues(string p_project, string p_testrun, string p_category, string p_entity)
        {
            Log.WriteLine("read intermediate...");
            Log.WriteLine(string.Format("project/testrun={0}/{1}", project, testrun));

            // set intermediate reference values
            this.project  = p_project;
            this.testrun  = p_testrun;
            this.category = p_category;
            this.entity   = p_entity;

            // read intermediate from VALUE table (common intermediate source)
            int cnt = intermediate.ReadFromDatabaseValues(this.project, this.testrun, this.category, this.entity);

            Log.WriteLine(cnt + " lines/variables");
        }
Пример #3
0
        /// <summary>
        /// Get content from the intermediate file and join with the rest of the values
        /// </summary>
        /// <param name="project"></param>
        /// <param name="testrun"></param>
        /// <param name="category"></param>
        /// <param name="entity"></param>
        /// <param name="valueIndex"></param>
        internal void JoinIntermediateFromDatabase(string project, string testrun, string category, string entity, int valueIndex)
        {
            Log.WriteLine(string.Format("joining intermediate {0}/{1}/{2}/{3}/{4}", project, testrun, category, entity, valueIndex));

            // read testrun intermediate from database
            Intermediate srcIntermediate = new Intermediate();
            int          cnt             = srcIntermediate.ReadFromDatabaseValues(project, testrun, category, entity);

            Log.WriteLine(string.Format("num of values read for entity [{0}/{1}]: {2}", category, entity, cnt));

            // filter only one indexed value per key
            Intermediate indexedIntermediate = srcIntermediate.GetIndexedValues(valueIndex);

            // add filtered list to result/target intermediate
            this.intermediate.Expand(indexedIntermediate, testrun);
        }