private void NodesTV_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            try
            {
                TreeNode selectedNode = NodesTV.SelectedNode;

                if (selectedNode == null)
                {
                    return;
                }

                ServerTestCase testcase = selectedNode.Tag as ServerTestCase;

                if (testcase == null)
                {
                    return;
                }

                if (testcase.Enabled != selectedNode.Checked)
                {
                    testcase.Enabled = selectedNode.Checked;
                    CheckChildren(selectedNode, selectedNode.Checked);
                }
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
        /// <summary>
        /// Runs the test.
        /// </summary>
        public override bool Run(ServerTestCase testcase, int iteration)
        {
            Iteration = iteration;

            // need fetch nodes used for the test if not already available.
            if (AvailableNodes.Count == 0)
            {
                if (!GetNodesInHierarchy())
                {
                    return(false);
                }
            }

            // do secondary test.
            switch (testcase.Name)
            {
            case "MultiHop":
            {
                return(DoMultiHopTest(3));
            }

            default:
            {
                return(DoMultiHopTest(0));
            }
            }
        }
Exemple #3
0
 /// <summary>
 /// Constructs the object.
 /// </summary>
 public ReportProgressEventArgs(
     ConfiguredEndpoint endpoint,
     ServerTestCase testcase,
     int testCount,
     int failedTestCount,
     int endpointCount,
     int totalEndpointCount,
     int iterationCount,
     int totalIterationCount,
     double currentProgress,
     double finalProgress,
     bool breakpoint)
 {
     m_endpoint            = endpoint;
     m_testcase            = testcase;
     m_testCount           = testCount;
     m_failedTestCount     = failedTestCount;
     m_endpointCount       = endpointCount;
     m_totalEndpointCount  = totalEndpointCount;
     m_iterationCount      = iterationCount;
     m_totalIterationCount = totalIterationCount;
     m_currentProgress     = currentProgress;
     m_finalProgress       = finalProgress;
     m_breakpoint          = breakpoint;
     m_stop = false;
 }
Exemple #4
0
        /// <summary>
        ///  Loads the configuration from a file on disk.
        /// </summary>
        public static ServerTestConfiguration Load(string filePath, ServerTestConfiguration masterConfiguration)
        {
            XmlTextReader reader = new XmlTextReader(filePath);

            try
            {
                DataContractSerializer  serializer    = new DataContractSerializer(typeof(ServerTestConfiguration));
                ServerTestConfiguration configuration = serializer.ReadObject(reader) as ServerTestConfiguration;
                configuration.m_filePath = filePath;

                if (configuration.Iterations <= 0)
                {
                    configuration.Iterations = 1;
                }

                if (masterConfiguration != null)
                {
                    ListOfServerTestCase replacements = new ListOfServerTestCase();

                    for (int ii = 0; ii < masterConfiguration.TestCases.Count; ii++)
                    {
                        ServerTestCase template = masterConfiguration.TestCases[ii];

                        // create replacement that is disabled by default.
                        ServerTestCase replacement = new ServerTestCase();

                        replacement.Name       = template.Name;
                        replacement.Parent     = template.Parent;
                        replacement.Enabled    = false;
                        replacement.Breakpoint = false;

                        replacements.Add(replacement);

                        // load settings from saved test case.
                        for (int jj = 0; jj < configuration.TestCases.Count; jj++)
                        {
                            ServerTestCase actual = configuration.TestCases[jj];

                            if (actual.Name == template.Name && actual.Parent == template.Parent)
                            {
                                replacement.Enabled    = actual.Enabled;
                                replacement.Breakpoint = actual.Breakpoint;
                                break;
                            }
                        }
                    }

                    // replace the test cases.
                    configuration.TestCases = replacements;
                }

                return(configuration);
            }
            finally
            {
                reader.Close();
            }
        }
Exemple #5
0
 /// <summary>
 /// Constructs the object.
 /// </summary>
 public ReportResultEventArgs(
     ServerTestCase testcase,
     string format,
     params object[] args)
 {
     m_testcase = testcase;
     m_format   = format;
     m_args     = args;
     m_stop     = false;
 }
Exemple #6
0
        /// <summary>
        /// Runs the test for all of the browse roots.
        /// </summary>
        public override bool Run(ServerTestCase testcase, int iteration)
        {
            try
            {
                LockServer();

                Iteration = iteration;

                if (ReadOnlyTests)
                {
                    Log("WARNING: TestCase {0} skipped because client could not acquire a lock on the Server.", testcase.Name);
                    return(true);
                }

                // need fetch nodes used for the test if not already available.
                if (AvailableNodes.Count == 0)
                {
                    if (!GetNodesInHierarchy())
                    {
                        return(false);
                    }
                }

                // get the writeable variables.
                if (WriteableVariables.Count == 0)
                {
                    if (!GetWriteableVariablesInHierarchy())
                    {
                        Log("WARNING: No writeable variables found.");
                        Log(g_WriteableVariableHelpText);
                        return(true);
                    }
                }

                // do secondary test.
                switch (testcase.Name)
                {
                case "TypeMismatch":
                {
                    return(DoWriteBadTypeTest());
                }

                default:
                {
                    return(DoWriteTest());
                }
                }
            }
            finally
            {
                UnlockServer();
            }
        }
        /// <see cref="BaseTreeCtrl.EnableMenuItems" />
        protected override void EnableMenuItems(TreeNode clickedNode)
        {
            if (clickedNode != null)
            {
                ServerTestCase testCase = clickedNode.Tag as ServerTestCase;

                if (testCase != null)
                {
                    BreakpointMI.Enabled = true;
                    BreakpointMI.Checked = testCase.Breakpoint;
                }
            }
        }
        /// <summary>
        /// Recursively toggles the check state for the nodes.
        /// </summary>
        private void SetCheckState(TreeNode parent, bool isChecked)
        {
            parent.Checked = isChecked;

            ServerTestCase testCase = parent.Tag as ServerTestCase;

            if (testCase != null)
            {
                testCase.Enabled = isChecked;
            }

            foreach (TreeNode child in parent.Nodes)
            {
                SetCheckState(child, isChecked);
            }
        }
Exemple #9
0
        /// <summary>
        /// Runs the test for all of the browse roots.
        /// </summary>
        public override bool Run(ServerTestCase testcase, int iteration)
        {
            Iteration = iteration;

            // do secondary test.
            switch (testcase.Name)
            {
            case "KeepAlive": {
                return(DoKeepAliveTest());
            }

            default:
            case "Reconnect": {
                return(DoReconnectTest());
            }
            }
        }
Exemple #10
0
        /// <summary>
        /// Recursively changes the check state for child nodes.
        /// </summary>
        private void CheckChildren(TreeNode parent, bool check)
        {
            foreach (TreeNode child in parent.Nodes)
            {
                ServerTestCase testcase = child.Tag as ServerTestCase;

                if (testcase == null)
                {
                    continue;
                }

                child.Checked    = check;
                testcase.Enabled = check;

                CheckChildren(child, check);
            }
        }
Exemple #11
0
        private void BreakpointMI_CheckedChanged(object sender, EventArgs e)
        {
            try {
                if (NodesTV.SelectedNode != null)
                {
                    ServerTestCase testCase = NodesTV.SelectedNode.Tag as ServerTestCase;

                    if (testCase != null)
                    {
                        testCase.Breakpoint = BreakpointMI.Checked;
                        UpdateNode(NodesTV.SelectedNode, testCase, testCase.Name, null);
                    }
                }
            } catch (Exception exception) {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
Exemple #12
0
        /// <see cref="BaseTreeCtrl.UpdateNode" />
        protected override void UpdateNode(TreeNode treeNode, object item, string text, string icon)
        {
            base.UpdateNode(treeNode, item, text, icon);

            ServerTestCase testCase = item as ServerTestCase;

            if (testCase != null)
            {
                treeNode.Checked = testCase.Enabled;
            }

            if (testCase.Breakpoint)
            {
                treeNode.ImageKey = treeNode.SelectedImageKey = GuiUtils.Icons.Method;
            }
            else
            {
                treeNode.ImageKey = treeNode.SelectedImageKey = GuiUtils.Icons.Property;
            }
        }
Exemple #13
0
 /// <summary>
 /// Runs the test case.
 /// </summary>
 public virtual bool Run(ServerTestCase testcase, int iteration)
 {
     return(true);
 }
Exemple #14
0
        /// <summary>
        /// Runs the test for all of the browse roots.
        /// </summary>
        public override bool Run(ServerTestCase testcase, int iteration)
        {
            Iteration = iteration;

            // need fetch nodes used for the test if not already available.
            bool fetched = false;

            if (AvailableNodes.Count == 0)
            {
                fetched = true;

                if (!GetNodesInHierarchy())
                {
                    return(false);
                }
            }

            // do secondary test.
            switch (testcase.Name)
            {
            case "IndexRanges": {
                if (fetched)
                {
                    if (!DoReadTest())
                    {
                        return(false);
                    }
                }

                return(DoReadIndexRangeTest());
            }

            case "DataEncodings": {
                if (fetched)
                {
                    if (!DoReadTest())
                    {
                        return(false);
                    }
                }

                return(DoReadDataEncodingTest());
            }

            case "ReadWrite": {
                try {
                    LockServer();

                    if (ReadOnlyTests)
                    {
                        Log("WARNING: TestCase {0} skipped because client could not acquire a lock on the Server.",
                            testcase.Name);
                        return(true);
                    }

                    if (fetched)
                    {
                        if (!DoReadTest())
                        {
                            return(false);
                        }
                    }

                    return(DoReadWriteTest());
                } finally {
                    UnlockServer();
                }
            }

            default: {
                return(DoReadTest());
            }
            }
        }