Exemple #1
0
        /// <summary>
        /// Validates the DES Keys
        /// </summary>
        //  Revision History
        //  MM/DD/YY Who Version ID Number Description
        //  -------- --- ------- -- ------ -------------------------------------------
        //  09/17/09 RCG 2.30.00           Created
        //  09/19/14 jrf 4.00.63 WR 534158 Modified way test details are set.
        private void ValidateDESKeys()
        {
            string Details = "";
            string Reason  = "";
            bool   Skipped = File.Exists(m_strProgramFile) == false ||
                             EDLFile.IsEDLFile(m_strProgramFile) == false;
            ProcedureResultCodes ValidationResult = ProcedureResultCodes.COMPLETED;

            if (IsAborted == false)
            {
                foreach (CENTRON_AMI.DESKeys KeyType in Enum.GetValues(typeof(CENTRON_AMI.DESKeys)))
                {
                    if (Skipped == false)
                    {
                        ValidationResult = m_AmiDevice.ValidateDESKeys(m_strProgramFile, KeyType);
                        Details          = GetSecurityValidationDetails(ValidationResult);

                        if (ProcedureResultCodes.INVALID_PARAM == ValidationResult)
                        {
                            Details += ", " + TestResources.KeyNotConsistentWithProgram;
                        }
                    }
                    else
                    {
                        Reason  = TestResources.ReasonProgramFileNeededToValidate;
                        Details = TestResources.NoProgram;
                    }

                    AddTestDetail(KeyType.ToDescription(), GetResultString(Skipped, ProcedureResultCodes.COMPLETED == ValidationResult),
                                  Details, Reason);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Checks the Load Profile running flag and verifies that it should be running.
        /// </summary>
        //  Revision History
        //  MM/DD/YY Who Version ID Number Description
        //  -------- --- ------- -- ------ -------------------------------------------
        //  09/17/09 RCG 2.30.00           Created
        //  09/19/14 jrf 4.00.63 WR 534158 Modified way test details are set.
        private void CheckLPRunning()
        {
            string MeterValue    = ConvertYesOrNo(m_AmiDevice.LoadProfileStatus.IsRunning);
            string ExpectedValue = "";
            string Result        = "";
            string Reason        = "";
            string Details       = "";
            bool   Skipped       = true;

            Details = MeterValue;

            if (File.Exists(m_strProgramFile) && EDLFile.IsEDLFile(m_strProgramFile))
            {
                try
                {
                    EDLFile ProgramFile = new EDLFile(m_strProgramFile);

                    ExpectedValue = ConvertYesOrNo(ProgramFile.LPQuantityList.Count > 0);
                    Skipped       = false;

                    if (MeterValue.Equals(ExpectedValue))
                    {
                        Details += ", " + TestResources.ProgramMatch;
                    }
                    else
                    {
                        Details += ", " + TestResources.ProgramMismatch;
                    }
                }
                catch (Exception)
                {
                    // This file must not be a program file.
                    Reason   = TestResources.ReasonInvalidProgramFile;
                    Details += ", " + TestResources.InvalidProgram;
                }
            }
            else
            {
                Reason   = TestResources.ReasonNoProgramFile;
                Details += ", " + TestResources.NoProgram;
            }

            Result = GetResultString(Skipped, MeterValue.Equals(ExpectedValue));

            AddTestDetail(TestResources.LoadProfileRunning, Result, Details, Reason);
        }
        }//end CentronIIEDLFileCollection

        /// <summary>
        /// Method is used to refresh the collection of EDL files
        /// </summary>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  01/21/08 AF  10.0    N/A     Created
        //  01/29/08 MAH 10.0            Added try catch block so that if (or when) we encounter a file
        //                                          that appears to be an EDL file but cannot be opened, the
        //                                          file will not be added to the list rather than throwing an exception
        //                                          and invalidating the list of EDL files
        public void Refresh()
        {
            CentronIIEDLFile objEDLFile;
            DirectoryInfo    objDir;

            //clear the collection
            InnerList.Clear();

            //Create a directory info object based on the directory
            objDir = new DirectoryInfo(m_strDirectory);

            //Go through the list of edl files in the directory
            foreach (FileInfo objFile in objDir.GetFiles())
            {
                if (EDLFile.IsEDLFile(objFile.FullName))
                {
                    try
                    {
                        //Create a new EDLFile from the File info object
                        objEDLFile = new CentronIIEDLFile(objFile.FullName);

                        //Add the EDL File to the collection
                        InnerList.Add(objEDLFile);
                    }
                    catch
                    {
                        // Do nothing - for some reason we thought we found a valid EDL file but were unable
                        // to actually read the file.  The net result is that, since the file cannot be read, it
                        // will not appear in the list of valid EDL files
                    }
                }
            }

            //Sort list
            IComparer myComparer = new CentronIIEDLFileComparer();

            InnerList.Sort(myComparer);
        }//end Refresh
Exemple #4
0
        /// <summary>
        /// Runs the test.
        /// </summary>
        //  Revision History
        //  MM/DD/YY Who Version ID Number Description
        //  -------- --- ------- -- ------ -------------------------------------------
        //  09/17/09 RCG 2.30.00           Created
        //  09/19/14 jrf 4.00.63 WR 534158 Using new method to set test result string and
        //                                 modified way test details are set.
        //  10/02/14 jrf 4.00.66 WR 431248 Making sure if logon is called and exception occurs then a logoff is
        //                                 attempted so other tests may continue if possible.
        public override Test RunTest()
        {
            PSEMResponse Response = PSEMResponse.Ok;
            List <ProgramValidationItem> InvalidItems = new List <ProgramValidationItem>();

            m_TestResults = new Test();

            m_TestResults.Name = TestName;
            m_bTestPassed      = true;

            // Check to see if the program is valid
            if (File.Exists(m_strProgramFile) && EDLFile.IsEDLFile(m_strProgramFile))
            {
                try
                {
                    // Validate the program
                    Response = LogonToDevice();

                    if (Response == PSEMResponse.Ok && IsAborted == false)
                    {
                        InvalidItems = m_AmiDevice.ValidateProgram(m_strProgramFile);

                        if (InvalidItems.Count > 0)
                        {
                            m_bTestPassed = false;

                            if (InvalidItems.Count == 1)
                            {
                                m_TestResults.Reason = TestResources.ReasonOneInvalidItemFound;
                            }
                            else
                            {
                                m_TestResults.Reason = InvalidItems.Count.ToString(CultureInfo.CurrentCulture)
                                                       + TestResources.ReasonInvalidItemsFound;
                            }
                        }
                        else
                        {
                            AddTestDetail(TestResources.ProgramValidationErrors, TestResources.OK, TestResources.NonePresent);
                        }
                    }
                    else
                    {
                        m_bTestPassed        = false;
                        m_TestResults.Reason = TestResources.ReasonLogonFailed;
                    }
                }
                catch (Exception e)
                {
                    throw (e);
                }
                finally
                {
                    if (m_AmiDevice != null)
                    {
                        m_AmiDevice.Logoff();
                    }
                }

                // Display the invalid items
                foreach (ProgramValidationItem CurrentItem in InvalidItems)
                {
                    string strMeterValue     = "";
                    string strProgramValue   = "";
                    string Details           = "";
                    string AdditionalDetails = "";

                    if (CurrentItem.MeterValue != null)
                    {
                        strMeterValue = CurrentItem.MeterValue;
                    }

                    if (CurrentItem.ProgramValue != null)
                    {
                        strProgramValue = CurrentItem.ProgramValue;
                    }

                    Details           = TestResources.Meter + ":  " + strMeterValue;
                    AdditionalDetails = TestResources.Program + ":  " + strProgramValue;

                    AddTestDetail(CurrentItem.Name, TestResources.Error, Details, "", AdditionalDetails);
                }
            }
            else
            {
                m_bTestSkipped       = true;
                m_TestResults.Reason = TestResources.ReasonNoProgramFile;
            }

            // Set the final result.
            m_TestResults.Result = GetTestResultString(m_bTestSkipped, m_bTestPassed);

            return(m_TestResults);
        }