private void AddConfiguration_Click(object sender, EventArgs e)
        {
            Benchmark.TestGroup     testGroup     = (Benchmark.TestGroup)BenchmarkObject;
            Benchmark.Configuration configuration = new Benchmark.Configuration(testGroup);
            configuration.Name   = Helpers.GetNewName(testGroup.Configurations.Select(c => c.Name), "new configuration", NumeralStyle.Guess);
            configuration.Number = Helpers.GetNewName(testGroup.Configurations.Select(c => c.Number), null, NumeralStyle.AlphabeticUpper);
            testGroup.Configurations.Add(configuration);

            TreeNode newNode = BenchmarkTreeView.GetTreeNode(configuration);

            if (newNode != null)
            {
                BenchmarkTreeView.TreeView.SelectedNode = newNode;
                newNode.BeginEdit();
            }
        }
        public override void BindChildren()
        {
            this.Nodes.Clear();

            Benchmark.Configuration configuration = (Benchmark.Configuration)BenchmarkObject;

            initScriptNode                  = new ScriptTreeNode(configuration.InitScript, BenchmarkTreeView);
            initScriptNode.Text             = "Init script";
            initScriptNode.ImageKey         = "InitScript";
            initScriptNode.SelectedImageKey = "InitScript";
            this.Nodes.Add(initScriptNode);

            cleanUpScriptNode                  = new ScriptTreeNode(configuration.CleanUpScript, BenchmarkTreeView);
            cleanUpScriptNode.Text             = "Clean-up script";
            cleanUpScriptNode.ImageKey         = "CleanUpScript";
            cleanUpScriptNode.SelectedImageKey = "CleanUpScript";
            this.Nodes.Add(cleanUpScriptNode);

            ChildrenBound = true;
        }
Example #3
0
 public virtual void OnAfterConfigurationCleanUpScript(Benchmark.Configuration configuration)
 {
 }
Example #4
0
 public virtual void OnAfterConfigurationInitScript(Benchmark.Configuration configuration)
 {
 }
Example #5
0
 public virtual void OnBeforeConfigurationInitScript(Benchmark.Configuration configuration)
 {
 }
 private void Remove_Click(object sender, EventArgs e)
 {
     Benchmark.Configuration configuration = (Benchmark.Configuration)BenchmarkObject;
     configuration.TestGroup.Configurations.Remove(configuration);
 }
 public ConfigurationTreeNode(Benchmark.Configuration configuration, BenchmarkTreeView benchmarkTreeView)
     : base(configuration, benchmarkTreeView)
 {
 }
Example #8
0
        private void PreparePlanEquivalenceTest(Benchmark.PlanEquivalenceTest planEquivalenceTest,
                                                Benchmark.Test test, Benchmark.TestGroup testGroup, Benchmark.Configuration configuration, DbProviders.DbProvider db,
                                                Benchmark.Template template = null)
        {
            Benchmark.PlanEquivalenceTestResult planEquivalenceTestResult = new Benchmark.PlanEquivalenceTestResult(testRun);
            planEquivalenceTestResult.TestId          = test.Id;
            planEquivalenceTestResult.TestNumber      = test.Number;
            planEquivalenceTestResult.TestName        = test.Name;
            planEquivalenceTestResult.TestGroupId     = testGroup.Id;
            planEquivalenceTestResult.ConfigurationId = configuration.Id;

            if (template != null)
            {
                planEquivalenceTestResult.TemplateNumber = template.Number;
            }

            foreach (Benchmark.QueryVariant variant in planEquivalenceTest.Variants)
            {
                if (IgnoreVariant(variant))
                {
                    continue;
                }

                Benchmark.QueryVariantResult queryVariantResult = new Benchmark.QueryVariantResult(planEquivalenceTestResult);
                Benchmark.Statement          statement          = variant.GetStatement(db.Name);

                // Skip not supported variants.
                if (statement is Benchmark.SpecificStatement specificStatement)
                {
                    if (specificStatement.NotSupported)
                    {
                        continue;
                    }
                }

                foreach (Benchmark.SelectedAnnotation selectedAnnotation in variant.SelectedAnnotations)
                {
                    Benchmark.SelectedAnnotationResult selectedAnnotationResult = new Benchmark.SelectedAnnotationResult(queryVariantResult);
                    selectedAnnotationResult.AnnotationId = selectedAnnotation.AnnotationId;
                    queryVariantResult.SelectedAnnotationResults.Add(selectedAnnotationResult);
                }

                string commandText = statement.CommandText;
                if (template != null)
                {
                    // Parametrized template substitution.
                    foreach (Benchmark.Parameter parameter in planEquivalenceTest.Parameters)
                    {
                        Benchmark.ParameterValue parameterValue =
                            planEquivalenceTest.ParameterValues.Where(pv => pv.ParameterId == parameter.Id && pv.TemplateId == template.Id).FirstOrDefault();
                        if (parameterValue != null)
                        {
                            string paramStr = Controls.Helpers.GetParamStr(parameter.Name);
                            commandText = commandText.Replace(paramStr, parameterValue.Value);
                        }
                    }
                }

                queryVariantResult.Query              = commandText;
                queryVariantResult.QueryVariantId     = variant.Id;
                queryVariantResult.QueryVariantNumber = variant.Number;
                queryVariantResult.QueryVariantName   = variant.Name;

                if (template != null)
                {
                    queryVariantResult.ExpectedResultSize = template.ExpectedResultSize;
                }
                else
                {
                    queryVariantResult.ExpectedResultSize = planEquivalenceTest.ExpectedResultSize;
                }

                // Token analysis.
                try
                {
                    Classes.SqlScanner scanner = new Classes.SqlScanner(commandText);
                    scanner.Scan();
                    queryVariantResult.TokenCount = scanner.Tokens.Length;
                }
                catch
                {
                    queryVariantResult.TokenCount = -1;
                }

                planEquivalenceTestResult.QueryVariantResults.Add(queryVariantResult);
            }

            foreach (Benchmark.SelectedAnnotation selectedAnnotation in planEquivalenceTest.SelectedAnnotations)
            {
                Benchmark.SelectedAnnotationResult selectedAnnotationResult = new Benchmark.SelectedAnnotationResult(planEquivalenceTestResult);
                selectedAnnotationResult.AnnotationId = selectedAnnotation.AnnotationId;
                planEquivalenceTestResult.SelectedAnnotationResults.Add(selectedAnnotationResult);
            }
            if (template != null)
            {
                foreach (Benchmark.SelectedAnnotation selectedAnnotation in template.SelectedAnnotations)
                {
                    Benchmark.SelectedAnnotationResult selectedAnnotationResult = new Benchmark.SelectedAnnotationResult(planEquivalenceTestResult);
                    selectedAnnotationResult.AnnotationId         = selectedAnnotation.AnnotationId;
                    selectedAnnotationResult.IsTemplateAnnotation = true;
                    planEquivalenceTestResult.SelectedAnnotationResults.Add(selectedAnnotationResult);
                }
            }

            if (planEquivalenceTestResult.QueryVariantResults.Count > 0)
            {
                testRun.TestResults.Add(planEquivalenceTestResult);
            }
        }