Beispiel #1
0
        /// <summary>
        /// Reads an verifies all of the nodes.
        /// </summary>
        private bool DoWriteBadTypeTest()
        {
            // follow tree from each starting node.
            bool success = true;

            // collection writeable variables that don't change during the test.
            List <TestVariable> variables = new List <TestVariable>();

            for (int ii = 0; ii < WriteableVariables.Count; ii++)
            {
                TestVariable test = new TestVariable();

                test.Variable = WriteableVariables[ii];
                test.DataType = TypeInfo.GetBuiltInType(WriteableVariables[ii].DataType, Session.TypeTree);
                test.Values   = new List <DataValue>();

                variables.Add(test);
            }

            Log("Starting WriteBadTypeTest for {0} Nodes", variables.Count);

            double increment = MaxProgress / variables.Count;
            double position  = 0;

            WriteValueCollection nodesToWrite = new WriteValueCollection();

            int nodes      = 0;
            int operations = 0;

            foreach (TestVariable variable in variables)
            {
                nodes++;

                AddWriteBadValues(variable, nodesToWrite);

                // process batch.
                if (nodesToWrite.Count > 100)
                {
                    operations += nodesToWrite.Count;

                    if (!WriteBadValues(nodesToWrite))
                    {
                        success = false;
                        break;
                    }

                    if (nodes > variables.Count / 5)
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                        nodes      = 0;
                        operations = 0;
                    }

                    nodesToWrite.Clear();
                }

                position += increment;
                ReportProgress(position);
            }

            // process final batch.
            if (success)
            {
                if (nodesToWrite.Count > 0)
                {
                    operations += nodesToWrite.Count;

                    if (!WriteBadValues(nodesToWrite))
                    {
                        success = false;
                    }
                    else
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                    }

                    nodesToWrite.Clear();
                }
            }

            return(success);
        }
Beispiel #2
0
        /// <summary>
        /// Reads an verifies all of the nodes.
        /// </summary>
        private bool DoWriteBadTypeTest()
        {
            // follow tree from each starting node.
            bool success = true;

            // collection writeable variables that don't change during the test.
            List<TestVariable> variables = new List<TestVariable>();

            for (int ii = 0; ii < WriteableVariables.Count; ii++)
            {
                TestVariable test = new TestVariable();

                test.Variable = WriteableVariables[ii];
                test.DataType = TypeInfo.GetBuiltInType(WriteableVariables[ii].DataType, Session.TypeTree);
                test.Values = new List<DataValue>();

                variables.Add(test);
            }

            Log("Starting WriteBadTypeTest for {0} Nodes", variables.Count);
            
            double increment = MaxProgress/variables.Count;
            double position  = 0;

            WriteValueCollection nodesToWrite = new WriteValueCollection();
            
            int nodes = 0;
            int operations = 0;

            foreach (TestVariable variable in variables)
            {               
                nodes++;

                AddWriteBadValues(variable, nodesToWrite);

                // process batch.
                if (nodesToWrite.Count > 100)
                {
                    operations += nodesToWrite.Count;

                    if (!WriteBadValues(nodesToWrite))
                    {
                        success = false;
                        break;
                    }

                    if (nodes > variables.Count/5)
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                        nodes = 0;
                        operations = 0;
                    }

                    nodesToWrite.Clear();
                }

                position += increment;
                ReportProgress(position);
            }   
         
            // process final batch.
            if (success)
            {
                if (nodesToWrite.Count > 0)
                {
                    operations += nodesToWrite.Count;

                    if (!WriteBadValues(nodesToWrite))
                    {
                        success = false;
                    }
                    else
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                    }

                    nodesToWrite.Clear();
                }
            }

            return success;
        }
Beispiel #3
0
        /// <summary>
        /// Reads an verifies all of the nodes.
        /// </summary>
        private bool DoReadWriteTest()
        {
            // follow tree from each starting node.
            bool success = true;

            double increment = MaxProgress / AvailableNodes.Count;
            double position  = 0;

            Log("Starting ReadWriteTest for {0} Nodes", AvailableNodes.Values.Count);

            WriteValueCollection nodesToWrite = new WriteValueCollection();

            int nodes      = 0;
            int operations = 0;

            uint[] attributeIds = Attributes.GetIdentifiers();

            foreach (Node node in AvailableNodes.Values)
            {
                nodes++;

                AddWriteValues(node, nodesToWrite, attributeIds);

                // process batch.
                if (nodesToWrite.Count > BlockSize)
                {
                    operations += nodesToWrite.Count;

                    if (!Write(nodesToWrite))
                    {
                        success = false;
                        break;
                    }

                    if (nodes > AvailableNodes.Count / 5)
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                        nodes      = 0;
                        operations = 0;
                    }

                    nodesToWrite.Clear();
                }

                position += increment;
                ReportProgress(position);
            }

            // process final batch.
            if (success)
            {
                if (nodesToWrite.Count > 0)
                {
                    operations += nodesToWrite.Count;

                    if (!Write(nodesToWrite))
                    {
                        success = false;
                    }
                    else
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                    }
                }
            }

            return(success);
        }
Beispiel #4
0
        /// <summary>
        /// Reads an verifies all of the nodes.
        /// </summary>
        private bool DoReadWriteTest()
        {
            // follow tree from each starting node.
            bool success = true;
                     
            double increment = MaxProgress/AvailableNodes.Count;
            double position  = 0;
            
            Log("Starting ReadWriteTest for {0} Nodes", AvailableNodes.Values.Count);
            
            WriteValueCollection nodesToWrite = new WriteValueCollection();
            
            int nodes = 0;
            int operations = 0;
            
            uint[] attributeIds = Attributes.GetIdentifiers();

            foreach (Node node in AvailableNodes.Values)
            {               
                nodes++;

                AddWriteValues(node, nodesToWrite, attributeIds);

                // process batch.
                if (nodesToWrite.Count > BlockSize)
                {
                    operations += nodesToWrite.Count;

                    if (!Write(nodesToWrite))
                    {
                        success = false;
                        break;
                    }

                    if (nodes > AvailableNodes.Count/5)
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                        nodes = 0;
                        operations = 0;
                    }

                    nodesToWrite.Clear();
                }

                position += increment;
                ReportProgress(position);
            }   
         
            // process final batch.
            if (success)
            {
                if (nodesToWrite.Count > 0)
                {
                    operations += nodesToWrite.Count;

                    if (!Write(nodesToWrite))
                    {
                        success = false;
                    }
                    else
                    {
                        Log("Wrote {0} attribute values for {1} nodes.", operations, nodes);
                    }
                }
            }

            return success;
        }