internal StepType GetEventSearchResultsTest(out FindEventResultList target, out SoapException ex, out int Timeout, string SearchToken, int MinResults, bool MinResultsSpecified, int MaxResults, bool MaxResultsSpecified, string WaitTime) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "GetEventSearchResults"; int tmpCommandNumber = GetEventSearchResults; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[CommandCount[tmpCommandNumber]]; #region Analyze request //SearchToken CommonCompare.StringCompare("RequestParameters/SearchToken", "SearchToken", SearchToken, ref logMessage, ref passed, test); //MinResults if (CommonCompare.Exist2("RequestParameters/MinResults", "MinResults", MinResultsSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/MinResults", "MinResults", MinResults, ref logMessage, ref passed, test); } //MaxResults if (CommonCompare.Exist2("RequestParameters/MaxResults", "MaxResults", MaxResultsSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/MaxResults", "MaxResults", MaxResults, ref logMessage, ref passed, test); } //WaitTime CommonCompare.StringCompare("RequestParameters/WaitTime", "WaitTime", WaitTime, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(FindEventResultList)); target = (FindEventResultList)targetObj; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
//*************************************************************************************** #region DoorControl internal StepType AccessDoorTest(out SoapException ex, out int Timeout, string Token, bool UseExtendedTime, bool UseExtendedTimeSpecified, string AccessTime, string OpenTooLongTime, string PreAlarmTime, AccessDoorExtension Extension) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; string tmpCommandName = "AccessDoor"; int tmpCommandNumber = AccessDoor; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[m_commandCount[tmpCommandNumber]]; #region Analyze request //Token CommonCompare.StringCompare("RequestParameters/Token", "Token", Token, ref logMessage, ref passed, test); //UseExtendedTime if (CommonCompare.Exist2("RequestParameters/UseExtendedTime", "UseExtendedTime", UseExtendedTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.StringCompare("RequestParameters/UseExtendedTime", "UseExtendedTime", UseExtendedTime.ToString(), ref logMessage, ref passed, test); } //AccessTime CommonCompare.StringCompare("RequestParameters/AccessTime", "AccessTime", AccessTime, ref logMessage, ref passed, test); //OpenTooLongTime CommonCompare.StringCompare("RequestParameters/OpenTooLongTime", "OpenTooLongTime", OpenTooLongTime, ref logMessage, ref passed, test); //PreAlarmTime CommonCompare.StringCompare("RequestParameters/PreAlarmTime", "PreAlarmTime", PreAlarmTime, ref logMessage, ref passed, test); //Extension //TODO #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType GetStatusTest(out ImagingStatus20 target, out SoapException ex, out int Timeout, string VideoSourceToken) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("Imaging20.GetStatus"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[GetStatus]]; #region Serialization Temp //Imaging10.ImagingStatus dsr = new Imaging10.ImagingStatus(); //dsr.FocusStatus = new Imaging10.FocusStatus(); //dsr.FocusStatus.Position = 12; //dsr.FocusStatus.MoveStatus = Imaging10.MoveStatus.IDLE; //dsr.FocusStatus.Error = "Test"; //XmlSerializer serializer = new XmlSerializer(typeof(Imaging10.ImagingStatus)); ////XmlReader sr = XmlReader.Create(new StringReader(test.SelectNodes("ResponseParameters")[0].InnerXml)); //TextWriter textWriter = new StreamWriter("c:\\2.txt"); //serializer.Serialize(textWriter, dsr); #endregion //Serialization Temp #region Analyze request //VideoSourceToken CommonCompare.StringCompare("RequestParameters/VideoSourceToken", "VideoSourceToken", VideoSourceToken, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(ImagingStatus20)); target = (ImagingStatus20)targetObj; //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, GetStatus); } else { res = StepType.None; Timeout = 0; target = null; ex = null; res = StepType.None; } return(res); }
//*************************************************************************************** #region Events internal StepType FindEventsTest(out string target, out SoapException ex, out int Timeout, DateTime StartPoint, DateTime EndPoint, bool EndPointSpecified, SearchScope Scope, EventFilter SearchFilter, bool IncludeStartState, int MaxMatches, bool MaxMatchesSpecified, string KeepAliveTime) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "FindEvents"; int tmpCommandNumber = FindEvents; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[CommandCount[tmpCommandNumber]]; #region Analyze request //KeepAliveTime CommonCompare.StringCompare("RequestParameters/KeepAliveTime", "KeepAliveTime", KeepAliveTime, ref logMessage, ref passed, test); //IncludedRecordings CommonCompare.StringCompare("RequestParameters/IncludedRecordings", "IncludedRecordings", Scope.IncludedRecordings[0], ref logMessage, ref passed, test); //StartPoint CommonCompare.StringCompare("RequestParameters/StartPoint", "StartPoint", XmlConvert.ToString(StartPoint, XmlDateTimeSerializationMode.Utc), ref logMessage, ref passed, test); //EndPoint CommonCompare.StringCompare("RequestParameters/EndPoint", "EndPoint", XmlConvert.ToString(EndPoint, XmlDateTimeSerializationMode.Utc), ref logMessage, ref passed, test); //IncludeStartState CommonCompare.StringCompare("RequestParameters/IncludeStartState", "IncludeStartState", IncludeStartState.ToString(), ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(string)); target = (string)targetObj; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
//*************************************************************************************** #region Recordings internal StepType FindRecordingsTest(out string target, out SoapException ex, out int Timeout, SearchScope Scope, int MaxMatches, bool MaxMatchesSpecified, string KeepAliveTime) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "FindRecordings"; int tmpCommandNumber = FindRecordings; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[CommandCount[tmpCommandNumber]]; #region Analyze request //KeepAliveTime CommonCompare.StringCompare("RequestParameters/KeepAliveTime", "KeepAliveTime", KeepAliveTime, ref logMessage, ref passed, test); //MaxMatches if (CommonCompare.Exist2("RequestParameters/MaxMatches", "MaxMatches", MaxMatchesSpecified, ref logMessage, ref passed, test)) { CommonCompare.IntCompare("RequestParameters/MaxMatches", "MaxMatches", MaxMatches, ref logMessage, ref passed, test); } //RecordingInformationFilter CommonCompare.StringCompare("RequestParameters/RecordingInformationFilter", "RecordingInformationFilter", Scope.RecordingInformationFilter, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(string)); target = (string)targetObj; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType SetRelayOutputStateTest(out SoapException ex, out int Timeout, string RelayOutputToken, RelayLogicalState LogicalState) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand("DeviceIO10.SetRelayOutputState"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SetRelayOutputState]]; #region Analize request //RelayOutputToken if (CommonCompare.IgnoreCheck("RequestParameters/RelayOutputToken", test)) { logMessage = logMessage + " RelayOutputToken = " + RelayOutputToken + "; "; } else { CommonCompare.StringCompare("RequestParameters/RelayOutputToken", "RelayOutputToken", RelayOutputToken, ref logMessage, ref passed, test); } //LogicalState CommonCompare.StringCompare("RequestParameters/LogicalState", "LogicalState", LogicalState.ToString(), ref logMessage, ref passed, test); #endregion //Analize request //Generate response res = TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); string typeRes = test.SelectNodes("Response")[0].InnerText; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SetRelayOutputState); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType GetConfigurationOptionsTest(out PTZConfigurationOptions target, out SoapException ex, out int Timeout, string ConfigurationToken) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "GetConfigurationOptions"; int tmpCommandNumber = GetConfigurationOptions; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); //TEMP: for backward compatibility if (m_testList.Count == 0) { m_testList = m_TestCommon.GetStepsForCommand(tmpCommandName); } if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[m_commandCount[tmpCommandNumber]]; #region Analyze request //ConfigurationToken CommonCompare.StringCompare("RequestParameters/ConfigurationToken", "ConfigurationToken", ConfigurationToken, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(PTZConfigurationOptions)); target = (PTZConfigurationOptions)targetObj; //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType SetPresetTest(out SoapException ex, out int Timeout, string ProfileToken, string PresetName, ref string PresetToken) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(string.Format("{0}.{1}", ServiceName, "SetPreset")); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SetPreset]]; #region Analyze request //ProfileToken CommonCompare.StringCompare("RequestParameters/ProfileToken", "ProfileToken", ProfileToken, ref logMessage, ref passed, test); //PresetName CommonCompare.StringCompare("RequestParameters/PresetName", "PresetName", PresetName, ref logMessage, ref passed, test); //PresetToken CommonCompare.StringCompare("RequestParameters/PresetToken", "PresetToken", PresetToken, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(string)); PresetToken = (string)targetObj; //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SetPreset); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType SendAuxiliaryCommandTest(out string target, out SoapException ex, out int Timeout, string ProfileToken, string AuxiliaryData) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("SendAuxiliaryCommand"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SendAuxiliaryCommand]]; #region Analyze request //ProfileToken CommonCompare.StringCompare("RequestParameters/ProfileToken", "ProfileToken", ProfileToken, ref logMessage, ref passed, test); //AuxiliaryData CommonCompare.StringCompare("RequestParameters/AuxiliaryData", "AuxiliaryData", AuxiliaryData, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(string)); target = (string)targetObj; //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SendAuxiliaryCommand); } else { res = StepType.None; Timeout = 0; target = null; ex = null; res = StepType.None; } return(res); }
internal StepType StopTest(out SoapException ex, out int Timeout, string ProfileToken, bool PanTilt, bool PanTiltSpecified, bool Zoom, bool ZoomSpecified) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(string.Format("{0}.{1}", ServiceName, "Stop")); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[Stop]]; #region Analyze request //ProfileToken CommonCompare.StringCompare("RequestParameters/ProfileToken", "ProfileToken", ProfileToken, ref logMessage, ref passed, test); //PanTilt //TestCommon.NotReqBoolCompare("RequestParameters/PanTilt", "PanTilt", PanTilt, PanTiltSpecified, ref logMessage, ref passed, test); //Zoom //TestCommon.NotReqBoolCompare("RequestParameters/Zoom", "Zoom", Zoom, ZoomSpecified, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, Stop); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType ContinuousMoveTest(out SoapException ex, out int Timeout, string ProfileToken, PTZSpeed Velocity, string verTimeout) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(string.Format("{0}.{1}", ServiceName, "ContinuousMove")); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[ContinuousMove]]; #region Analyze request //ProfileToken CommonCompare.StringCompare("RequestParameters/ProfileToken", "ProfileToken", ProfileToken, ref logMessage, ref passed, test); //Velocity CommonCompare.PTZSpeedCompare("RequestParameters/Velocity", "Velocity", Velocity, ref logMessage, ref passed, test); //verTimeout CommonCompare.StringCompare("RequestParameters/Timeout", "Timeout", verTimeout, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, ContinuousMove); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType GetRecordingInformationTest(out RecordingInformation target, out SoapException ex, out int Timeout, string RecordingToken) { StepType res = StepType.None; Timeout = 0; ex = null; target = null; bool passed = true; string logMessage = ""; string tmpCommandName = "GetRecordingInformation"; int tmpCommandNumber = GetRecordingInformation; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[CommandCount[tmpCommandNumber]]; #region Analyze request //RecordingToken CommonCompare.StringCompare("RequestParameters/RecordingToken", "RecordingToken", RecordingToken, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(RecordingInformation)); target = (RecordingInformation)targetObj; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType StopTest(out SoapException ex, out int Timeout, string VideoSourceToken) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("Imaging20.Stop"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[Stop]]; #region Analyze request //VideoSourceToken CommonCompare.StringCompare("RequestParameters/VideoSourceToken", "VideoSourceToken", VideoSourceToken, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, Stop); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType DoubleLockDoorTest(out SoapException ex, out int Timeout, string Token) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; string tmpCommandName = "DoubleLockDoor"; int tmpCommandNumber = DoubleLockDoor; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[m_commandCount[tmpCommandNumber]]; #region Analyze request //Token CommonCompare.StringCompare("RequestParameters/Token", "Token", Token, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType EndSearchTest(out DateTime target, out SoapException ex, out int Timeout, string SearchToken) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; string tmpCommandName = "EndSearch"; int tmpCommandNumber = EndSearch; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[CommandCount[tmpCommandNumber]]; #region Analyze request //SearchToken CommonCompare.StringCompare("RequestParameters/SearchToken", "SearchToken", SearchToken, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response int useTimeOut = 0; object targetObj; res = TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //target = (DateTime)targetObj; target = DateTime.UtcNow; switch (useTimeOut) { case 1: { System.Threading.Thread.Sleep(1000); break; } case 2: { System.Threading.Thread.Sleep(10000); break; } } //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
internal StepType MoveTest(out SoapException ex, out int Timeout, string VideoSourceToken, FocusMove Focus) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("Imaging20.Move"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[Move]]; #region Analyze request //VideoSourceToken CommonCompare.StringCompare("RequestParameters/VideoSourceToken", "VideoSourceToken", VideoSourceToken, ref logMessage, ref passed, test); //Focus if (Focus != null) { //Absolute if (Focus.Absolute != null) { CommonCompare.Exist("RequestParameters/Focus/Absolute", "Focus.Absolute", Focus.Absolute, ref logMessage, ref passed, test); if (passed) { //Position CommonCompare.FloatCompare("RequestParameters/Focus/Absolute/Position", "Focus.Absolute.Position", Focus.Absolute.Position, ref logMessage, ref passed, test); //Speed if (Focus.Absolute.SpeedSpecified) { CommonCompare.Exist2("RequestParameters/Focus/Absolute/Speed", "Focus.Absolute.Speed", Focus.Absolute.SpeedSpecified, ref logMessage, ref passed, test); if (passed) { CommonCompare.FloatCompare("RequestParameters/Focus/Absolute/Speed", "Focus.Absolute.Speed", Focus.Absolute.Speed, ref logMessage, ref passed, test); } } else { CommonCompare.Exist2("RequestParameters/Focus/Absolute/Speed", "Focus.Absolute.Speed", Focus.Absolute.SpeedSpecified, ref logMessage, ref passed, test); } } } else { CommonCompare.Exist("RequestParameters/Focus/Absolute", "Focus.Absolute", Focus.Absolute, ref logMessage, ref passed, test); } //Relative if (Focus.Relative != null) { CommonCompare.Exist("RequestParameters/Focus/Relative", "Focus.Relative", Focus.Relative, ref logMessage, ref passed, test); if (passed) { //Distance CommonCompare.FloatCompare("RequestParameters/Focus/Relative/Distance", "Focus.Relative.Distance", Focus.Relative.Distance, ref logMessage, ref passed, test); //Speed if (Focus.Relative.SpeedSpecified) { CommonCompare.Exist2("RequestParameters/Focus/Relative/Speed", "Focus.Relative.Speed", Focus.Relative.SpeedSpecified, ref logMessage, ref passed, test); if (passed) { CommonCompare.FloatCompare("RequestParameters/Focus/Relative/Speed", "Focus.Relative.Speed", Focus.Relative.Speed, ref logMessage, ref passed, test); } } else { CommonCompare.Exist2("RequestParameters/Focus/Relative/Speed", "Focus.Relative.Speed", Focus.Relative.SpeedSpecified, ref logMessage, ref passed, test); } } } else { CommonCompare.Exist("RequestParameters/Focus/Relative", "Focus.Relative", Focus.Relative, ref logMessage, ref passed, test); } //Continuous if (Focus.Continuous != null) { CommonCompare.Exist("RequestParameters/Focus/Continuous", "Focus.Continuous", Focus.Continuous, ref logMessage, ref passed, test); if (passed) { //Speed CommonCompare.FloatCompare("RequestParameters/Focus/Continuous/Speed", "Focus.Continuous.Speed", Focus.Continuous.Speed, ref logMessage, ref passed, test); } } else { CommonCompare.Exist("RequestParameters/Focus/Continuous", "Focus.Continuous", Focus.Continuous, ref logMessage, ref passed, test); } } else { passed = false; logMessage = logMessage + "No required tag Focus."; } #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, Move); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType SetImagingSettingsTest(out SoapException ex, out int Timeout, string VideoSourceToken, ImagingSettings20 ImagingSettings, bool ForcePersistence, bool ForcePersistenceSpecified) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("Imaging20.SetImagingSettings"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SetImagingSettings]]; #region Analyze request //VideoSourceToken CommonCompare.StringCompare("RequestParameters/VideoSourceToken", "VideoSourceToken", VideoSourceToken, ref logMessage, ref passed, test); //ImagingSettings if (CommonCompare.Exist("RequestParameters/ImagingSettings", "ImagingSettings", ImagingSettings, ref logMessage, ref passed, test)) { //BacklightCompensation if (CommonCompare.Exist("RequestParameters/ImagingSettings/BacklightCompensation", "BacklightCompensation", ImagingSettings.BacklightCompensation, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/BacklightCompensation/Mode", "Mode", ImagingSettings.BacklightCompensation.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.BacklightCompensation.Mode == BacklightCompensationMode.ON) { //Level CommonCompare.FloatCompare("RequestParameters/ImagingSettings/BacklightCompensation/Level", "Level", ImagingSettings.BacklightCompensation.Level, ref logMessage, ref passed, test); } } //Brightness if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Brightness", "Brightness", ImagingSettings.BrightnessSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Brightness", "Brightness", ImagingSettings.Brightness, ref logMessage, ref passed, test); } //ColorSaturation if (CommonCompare.Exist2("RequestParameters/ImagingSettings/ColorSaturation", "ColorSaturation", ImagingSettings.ColorSaturationSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/ColorSaturation", "ColorSaturation", ImagingSettings.ColorSaturation, ref logMessage, ref passed, test); } //Contrast if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Contrast", "Contrast", ImagingSettings.ContrastSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Contrast", "Contrast", ImagingSettings.Contrast, ref logMessage, ref passed, test); } //Exposure if (CommonCompare.Exist("RequestParameters/ImagingSettings/Exposure", "Exposure", ImagingSettings.Exposure, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/Exposure/Mode", "Mode", ImagingSettings.Exposure.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.Exposure.Mode == ExposureMode.AUTO) { //Priority if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/Priority", "Priority", ImagingSettings.Exposure.PrioritySpecified, ref logMessage, ref passed, test)) { CommonCompare.StringCompare("RequestParameters/ImagingSettings/Exposure/Priority", "Priority", ImagingSettings.Exposure.Priority.ToString(), ref logMessage, ref passed, test); } //MinExposureTime if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MinExposureTime", "MinExposureTime", ImagingSettings.Exposure.MinExposureTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MinExposureTime", "MinExposureTime", ImagingSettings.Exposure.MinExposureTime, ref logMessage, ref passed, test); } //MaxExposureTime if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MaxExposureTime", "MaxExposureTime", ImagingSettings.Exposure.MaxExposureTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MaxExposureTime", "MaxExposureTime", ImagingSettings.Exposure.MaxExposureTime, ref logMessage, ref passed, test); } //MinGain if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MinGain", "MinGain", ImagingSettings.Exposure.MinGainSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MinGain", "MinGain", ImagingSettings.Exposure.MinGain, ref logMessage, ref passed, test); } //MaxGain if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MaxGain", "MaxGain", ImagingSettings.Exposure.MaxGainSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MaxGain", "MaxGain", ImagingSettings.Exposure.MaxGain, ref logMessage, ref passed, test); } //MinIris if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MinIris", "MinIris", ImagingSettings.Exposure.MinIrisSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MinIris", "MinIris", ImagingSettings.Exposure.MinIris, ref logMessage, ref passed, test); } //MaxIris if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/MaxIris", "MaxIris", ImagingSettings.Exposure.MaxIrisSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/MaxIris", "MaxIris", ImagingSettings.Exposure.MaxIris, ref logMessage, ref passed, test); } } else if (ImagingSettings.Exposure.Mode == ExposureMode.MANUAL) { //ExposureTime if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/ExposureTime", "ExposureTime", ImagingSettings.Exposure.ExposureTimeSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/ExposureTime", "ExposureTime", ImagingSettings.Exposure.ExposureTime, ref logMessage, ref passed, test); } //Gain if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/Gain", "Gain", ImagingSettings.Exposure.GainSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/Gain", "Gain", ImagingSettings.Exposure.Gain, ref logMessage, ref passed, test); } //Iris if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Exposure/Iris", "Iris", ImagingSettings.Exposure.IrisSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Exposure/Iris", "Iris", ImagingSettings.Exposure.Iris, ref logMessage, ref passed, test); } } } //Focus if (CommonCompare.Exist("RequestParameters/ImagingSettings/Focus", "Focus", ImagingSettings.Focus, ref logMessage, ref passed, test)) { //AutoFocusMode CommonCompare.StringCompare("RequestParameters/ImagingSettings/Focus/AutoFocusMode", "AutoFocusMode", ImagingSettings.Focus.AutoFocusMode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.Focus.AutoFocusMode == AutoFocusMode.MANUAL) { //DefaultSpeed CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Focus/DefaultSpeed", "DefaultSpeed", ImagingSettings.Focus.DefaultSpeed, ref logMessage, ref passed, test); } else if (ImagingSettings.Focus.AutoFocusMode == AutoFocusMode.AUTO) { //NearLimit CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Focus/NearLimit", "NearLimit", ImagingSettings.Focus.NearLimit, ref logMessage, ref passed, test); //FarLimit CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Focus/FarLimit", "FarLimit", ImagingSettings.Focus.FarLimit, ref logMessage, ref passed, test); } } //IrCutFilter if (CommonCompare.Exist2("RequestParameters/ImagingSettings/IrCutFilter", "IrCutFilter", ImagingSettings.IrCutFilterSpecified, ref logMessage, ref passed, test)) { CommonCompare.StringCompare("RequestParameters/ImagingSettings/IrCutFilter", "IrCutFilter", ImagingSettings.IrCutFilter.ToString(), ref logMessage, ref passed, test); } //Sharpness if (CommonCompare.Exist2("RequestParameters/ImagingSettings/Sharpness", "Sharpness", ImagingSettings.SharpnessSpecified, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare("RequestParameters/ImagingSettings/Sharpness", "Sharpness", ImagingSettings.Sharpness, ref logMessage, ref passed, test); } //WideDynamicRange if (CommonCompare.Exist("RequestParameters/ImagingSettings/WideDynamicRange", "WideDynamicRange", ImagingSettings.WideDynamicRange, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/WideDynamicRange/Mode", "Mode", ImagingSettings.WideDynamicRange.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.WideDynamicRange.Mode == WideDynamicMode.ON) { //Level CommonCompare.FloatCompare("RequestParameters/ImagingSettings/WideDynamicRange/Level", "Level", ImagingSettings.WideDynamicRange.Level, ref logMessage, ref passed, test); } } //WhiteBalance if (CommonCompare.Exist("RequestParameters/ImagingSettings/WhiteBalance", "WhiteBalance", ImagingSettings.WhiteBalance, ref logMessage, ref passed, test)) { //Mode CommonCompare.StringCompare("RequestParameters/ImagingSettings/WhiteBalance/Mode", "Mode", ImagingSettings.WhiteBalance.Mode.ToString(), ref logMessage, ref passed, test); if (ImagingSettings.WhiteBalance.Mode == WhiteBalanceMode.MANUAL) { //CrGain CommonCompare.FloatCompare("RequestParameters/ImagingSettings/WhiteBalance/CrGain", "CrGain", ImagingSettings.WhiteBalance.CrGain, ref logMessage, ref passed, test); //CbGain CommonCompare.FloatCompare("RequestParameters/ImagingSettings/WhiteBalance/CbGain", "CbGain", ImagingSettings.WhiteBalance.CbGain, ref logMessage, ref passed, test); } } } //ForcePersistence CommonCompare.Exist2("RequestParameters/ForcePersistence", "ForcePersistence", ForcePersistenceSpecified, ref logMessage, ref passed, test); if (passed) { CommonCompare.StringCompare("RequestParameters/ForcePersistence", "ForcePersistence", ForcePersistence.ToString(), ref logMessage, ref passed, test); } #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SetImagingSettings); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType SetConfigurationTest(out SoapException ex, out int Timeout, PTZConfiguration PTZConfiguration, bool ForcePersistence) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; string tmpCommandName = "SetConfiguration"; int tmpCommandNumber = SetConfiguration; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand(ServiceName + "." + tmpCommandName); //TEMP: for backward compatibility if (m_testList.Count == 0) { m_testList = m_TestCommon.GetStepsForCommand(tmpCommandName); } if (m_testList.Count != 0) { //Get current step XmlNode test = m_testList[m_commandCount[tmpCommandNumber]]; #region Analyze request //ForcePersistence CommonCompare.StringCompare("RequestParameters/ForcePersistence", "ForcePersistence", ForcePersistence.ToString(), ref logMessage, ref passed, test); //PTZConfiguration if (PTZConfiguration != null) { //token CommonCompare.StringCompare("RequestParameters/PTZConfiguration/@token", "token", PTZConfiguration.token, ref logMessage, ref passed, test); //Name CommonCompare.StringCompare("RequestParameters/PTZConfiguration/Name", "Name", PTZConfiguration.Name, ref logMessage, ref passed, test); //NodeToken CommonCompare.StringCompare("RequestParameters/PTZConfiguration/NodeToken", "NodeToken", PTZConfiguration.NodeToken, ref logMessage, ref passed, test); //DefaultAbsolutePantTiltPositionSpace CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultAbsolutePantTiltPositionSpace", "DefaultAbsolutePantTiltPositionSpace", PTZConfiguration.DefaultAbsolutePantTiltPositionSpace, ref logMessage, ref passed, test); //DefaultAbsoluteZoomPositionSpace CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultAbsoluteZoomPositionSpace", "DefaultAbsoluteZoomPositionSpace", PTZConfiguration.DefaultAbsoluteZoomPositionSpace, ref logMessage, ref passed, test); //DefaultRelativePanTiltTranslationSpace CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultRelativePanTiltTranslationSpace", "DefaultRelativePanTiltTranslationSpace", PTZConfiguration.DefaultRelativePanTiltTranslationSpace, ref logMessage, ref passed, test); //DefaultRelativeZoomTranslationSpace CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultRelativeZoomTranslationSpace", "DefaultRelativeZoomTranslationSpace", PTZConfiguration.DefaultRelativeZoomTranslationSpace, ref logMessage, ref passed, test); //DefaultContinuousPanTiltVelocitySpace CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultContinuousPanTiltVelocitySpace", "DefaultContinuousPanTiltVelocitySpace", PTZConfiguration.DefaultContinuousPanTiltVelocitySpace, ref logMessage, ref passed, test); //DefaultContinuousZoomVelocitySpace CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultContinuousZoomVelocitySpace", "DefaultContinuousZoomVelocitySpace", PTZConfiguration.DefaultContinuousZoomVelocitySpace, ref logMessage, ref passed, test); //DefaultPTZTimeout CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultPTZTimeout", "DefaultPTZTimeout", PTZConfiguration.DefaultPTZTimeout, ref logMessage, ref passed, test); //PanTiltLimits if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits", "PanTiltLimits", (object)(PTZConfiguration.PanTiltLimits), ref logMessage, ref passed, test)) { //PTZConfiguration.PanTiltLimits.Range if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits/Range", "PanTiltLimits.Range", (object)(PTZConfiguration.PanTiltLimits.Range), ref logMessage, ref passed, test)) { //PTZConfiguration.PanTiltLimits.Range.URI CommonCompare.StringCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/URI", "PanTiltLimits.Range.URI", PTZConfiguration.PanTiltLimits.Range.URI, ref logMessage, ref passed, test); //PTZConfiguration.PanTiltLimits.Range.XRange if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits/Range/XRange", "PanTiltLimits.Range.XRange", (object)(PTZConfiguration.PanTiltLimits.Range.XRange), ref logMessage, ref passed, test)) { //PTZConfiguration.PanTiltLimits.Range.XRange.Min CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/XRange/Min", "PanTiltLimits.Range.XRange.Min", PTZConfiguration.PanTiltLimits.Range.XRange.Min, ref logMessage, ref passed, test); //PTZConfiguration.PanTiltLimits.Range.XRange.Max CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/XRange/Max", "PanTiltLimits.Range.XRange.Max", PTZConfiguration.PanTiltLimits.Range.XRange.Max, ref logMessage, ref passed, test); } //PTZConfiguration.PanTiltLimits.Range.YRange if (CommonCompare.Exist("RequestParameters/PTZConfiguration/PanTiltLimits/Range/YRange", "PanTiltLimits.Range.YRange", (object)(PTZConfiguration.PanTiltLimits.Range.YRange), ref logMessage, ref passed, test)) { //PTZConfiguration.PanTiltLimits.Range.YRange.Min CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/YRange/Min", "PanTiltLimits.Range.YRange.Min", PTZConfiguration.PanTiltLimits.Range.YRange.Min, ref logMessage, ref passed, test); //PTZConfiguration.PanTiltLimits.Range.YRange.Max CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/PanTiltLimits/Range/YRange/Max", "PanTiltLimits.Range.YRange.Max", PTZConfiguration.PanTiltLimits.Range.YRange.Max, ref logMessage, ref passed, test); } } } //ZoomLimits if (CommonCompare.Exist("RequestParameters/PTZConfiguration/ZoomLimits", "ZoomLimits", (object)(PTZConfiguration.ZoomLimits), ref logMessage, ref passed, test)) { //PTZConfiguration.ZoomLimits.Range.URI CommonCompare.StringCompare("RequestParameters/PTZConfiguration/ZoomLimits/Range/URI", "ZoomLimits.Range.URI", PTZConfiguration.ZoomLimits.Range.URI, ref logMessage, ref passed, test); //PTZConfiguration.ZoomLimits.Range.XRange if (CommonCompare.Exist("RequestParameters/PTZConfiguration/ZoomLimits/Range/XRange", "ZoomLimits.Range.XRange", (object)(PTZConfiguration.ZoomLimits.Range.XRange), ref logMessage, ref passed, test)) { //PTZConfiguration.ZoomLimits.Range.XRange.Min CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/ZoomLimits/Range/XRange/Min", "ZoomLimits.Range.XRange.Min", PTZConfiguration.ZoomLimits.Range.XRange.Min, ref logMessage, ref passed, test); //PTZConfiguration.ZoomLimits.Range.XRange.Max CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/ZoomLimits/Range/XRange/Max", "ZoomLimits.Range.XRange.Max", PTZConfiguration.ZoomLimits.Range.XRange.Max, ref logMessage, ref passed, test); } } //DefaultPTZSpeed if (CommonCompare.Exist("RequestParameters/PTZConfiguration/DefaultPTZSpeed", "DefaultPTZSpeed", (object)(PTZConfiguration.DefaultPTZSpeed), ref logMessage, ref passed, test)) { //DefaultPTZSpeed.PanTilt if (CommonCompare.Exist("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt", "DefaultPTZSpeed.PanTilt", (object)(PTZConfiguration.DefaultPTZSpeed.PanTilt), ref logMessage, ref passed, test)) { //DefaultPTZSpeed.PanTilt.space CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt/space", "DefaultPTZSpeed.PanTilt.space", PTZConfiguration.DefaultPTZSpeed.PanTilt.space, ref logMessage, ref passed, test); //DefaultPTZSpeed.PanTilt.x CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt/x", "DefaultPTZSpeed.PanTilt.x", PTZConfiguration.DefaultPTZSpeed.PanTilt.x, ref logMessage, ref passed, test); //DefaultPTZSpeed.PanTilt.y CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/PanTilt/y", "DefaultPTZSpeed.PanTilt.y", PTZConfiguration.DefaultPTZSpeed.PanTilt.y, ref logMessage, ref passed, test); } //DefaultPTZSpeed.Zoom if (CommonCompare.Exist("RequestParameters/PTZConfiguration/DefaultPTZSpeed/Zoom", "DefaultPTZSpeed.PanTilt", (object)(PTZConfiguration.DefaultPTZSpeed.PanTilt), ref logMessage, ref passed, test)) { //DefaultPTZSpeed.Zoom.space CommonCompare.StringCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/Zoom/space", "DefaultPTZSpeed.Zoom.space", PTZConfiguration.DefaultPTZSpeed.Zoom.space, ref logMessage, ref passed, test); //DefaultPTZSpeed.Zoom.x CommonCompare.FloatCompare("RequestParameters/PTZConfiguration/DefaultPTZSpeed/Zoom/x", "DefaultPTZSpeed.Zoom.x", PTZConfiguration.DefaultPTZSpeed.Zoom.x, ref logMessage, ref passed, test); } } } else { passed = false; logMessage = logMessage + "No PTZConfiguration. "; } #endregion //Analyze request //Generate response res = m_TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, tmpCommandNumber); } else { throw new SoapException("NO " + ServiceName + "." + tmpCommandName + " COMMAND IN SCRIPT", SoapException.ServerFaultCode); } return(res); }
void ValidateParameters(Common.ParametersValidation validationRequest, ref string logMessage, ref bool passed, XmlNode test) { foreach (Common.ValidationRule rule in validationRequest.ValidationRules) { string parameterPath = string.Format("RequestParameters/{0}", rule.ParameterPath); switch (rule.Type) { case ParameterType.String: CommonCompare.StringCompare(parameterPath, rule.ParameterName, (string)rule.Value, ref logMessage, ref passed, test); break; case ParameterType.Int: CommonCompare.IntCompare(parameterPath, rule.ParameterName, (int)rule.Value, ref logMessage, ref passed, test); break; case ParameterType.OptionalInt: int?value = (int?)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, value.HasValue, ref logMessage, ref passed, test)) { CommonCompare.IntCompare(parameterPath, rule.ParameterName, value.Value, ref logMessage, ref passed, test); } break; case ParameterType.OptionalBool: if (rule.ValueSpecified) { CommonCompare.StringCompare(parameterPath, rule.ParameterName, ((bool)rule.Value).ToString(), ref logMessage, ref passed, test); } else { CommonCompare.Exist2(parameterPath, rule.ParameterName, rule.ValueSpecified, ref logMessage, ref passed, test); } break; case ParameterType.OptionalString: { string stringValue = (string)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, stringValue != null, ref logMessage, ref passed, test)) { CommonCompare.StringCompare(parameterPath, rule.ParameterName, (string)rule.Value, ref logMessage, ref passed, test); } } break; case ParameterType.OptionalElement: { CommonCompare.Exist2(parameterPath, rule.ParameterName, rule.Value != null, ref logMessage, ref passed, test); } break; case ParameterType.OptionalElementBoolFlag: { CommonCompare.Exist2(parameterPath, rule.ParameterName, (bool)rule.Value, ref logMessage, ref passed, test); } break; case ParameterType.StringArray: { CommonCompare.StringArrayCompare(parameterPath, rule.ParameterName, (string[])rule.Value, ref logMessage, ref passed, test); } break; case ParameterType.Log: { if (rule.Value.GetType().ToString() == "System.Byte[]") { logMessage = logMessage + rule.ParameterName + " = [Check it manually!]"; } else { logMessage = logMessage + rule.ParameterName + " = " + rule.Value.ToString(); } } break; case ParameterType.OptionalQName: { XmlQualifiedName QNameValue = (XmlQualifiedName)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, QNameValue != null, ref logMessage, ref passed, test)) { CommonCompare.StringCompare(parameterPath + "/Namespace", rule.ParameterName + "/Namespace", QNameValue.Namespace, ref logMessage, ref passed, test); CommonCompare.StringCompare(parameterPath + "/Name", rule.ParameterName + "/Name", QNameValue.Name, ref logMessage, ref passed, test); } } break; case ParameterType.X509Cert: { Org.BouncyCastle.X509.X509Certificate cert = (new Org.BouncyCastle.X509.X509CertificateParser()).ReadCertificate((byte[])rule.Value); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + ": " + "\r\n" + cert.ToString(); logMessage = logMessage + "\r\n"; //TextWriter textWriter = new StringWriter(); //Org.BouncyCastle.Utilities.IO.Pem.PemWriter pemWriter = new Org.BouncyCastle.Utilities.IO.Pem.PemWriter(textWriter); //pemWriter.WriteObject(cert.CertificateStructure.SubjectPublicKeyInfo.PublicKeyData); //pemWriter.Writer.Flush(); //string privateKey = textWriter.ToString(); logMessage = logMessage + rule.ParameterName + "(PubK): " + "\r\n" + cert.CertificateStructure.SubjectPublicKeyInfo.PublicKeyData.ToString(); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + "(SignatureAlgorithm): " + "\r\n" + cert.CertificateStructure.SignatureAlgorithm.ObjectID.ToString(); logMessage = logMessage + "\r\n"; } break; case ParameterType.PKCS10: { Org.BouncyCastle.Pkcs.Pkcs10CertificationRequest pkcs10 = new Org.BouncyCastle.Pkcs.Pkcs10CertificationRequest((byte[])rule.Value); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + ": " + "\r\n" + pkcs10.ToString(); logMessage = logMessage + "\r\n"; } break; case ParameterType.PKCS12WithoutPassphrase: { Org.BouncyCastle.Pkcs.Pkcs12Store pkcs12Store = new Org.BouncyCastle.Pkcs.Pkcs12Store(); pkcs12Store.Load(new MemoryStream((byte[])rule.Value), ("").ToArray()); logMessage = logMessage + rule.ParameterName + ": " + "\r\n"; foreach (string alias in pkcs12Store.Aliases) { logMessage = logMessage + "\r\n"; logMessage = logMessage + "Alias = " + alias + "\r\n"; logMessage = logMessage + "Certificate = " + pkcs12Store.GetCertificate(alias).Certificate.ToString(); } logMessage = logMessage + "\r\n"; } break; case ParameterType.CRL: { Org.BouncyCastle.X509.X509Crl crl = (new Org.BouncyCastle.X509.X509CrlParser()).ReadCrl((byte[])rule.Value); logMessage = logMessage + "\r\n"; logMessage = logMessage + rule.ParameterName + ": " + "\r\n" + crl.ToString(); logMessage = logMessage + "\r\n"; } break; case ParameterType.Float: { CommonCompare.FloatCompare(parameterPath, rule.ParameterName, (float)rule.Value, ref logMessage, ref passed, test); } break; case ParameterType.OptionalFloat: float?fvalue = (float?)rule.Value; if (CommonCompare.Exist2(parameterPath, rule.ParameterName, fvalue.HasValue, ref logMessage, ref passed, test)) { CommonCompare.FloatCompare(parameterPath, rule.ParameterName, (float)rule.Value, ref logMessage, ref passed, test); } break; } } }
internal StepType SetRelayOutputSettingsTest(out SoapException ex, out int Timeout, RelayOutput RelayOutput) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = TestCommon.GetStepsForCommand("DeviceIO10.SetRelayOutputSettings"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SetRelayOutputSettings]]; #region Analize request //RelayOutput CommonCompare.Exist("RequestParameters/RelayOutputToken", "RelayOutput", RelayOutput, ref logMessage, ref passed, test); if (passed) { //RelayOutputToken if (CommonCompare.IgnoreCheck("RequestParameters/RelayOutputToken", test)) { logMessage = logMessage + " RelayOutputToken = " + RelayOutput.token + "; "; } else { CommonCompare.StringCompare("RequestParameters/RelayOutputToken", "RelayOutputToken", RelayOutput.token, ref logMessage, ref passed, test); } //Properties if (RelayOutput.Properties != null) { //Mode CommonCompare.StringCompare("RequestParameters/Properties/Mode", "Properties.Mode", RelayOutput.Properties.Mode.ToString(), ref logMessage, ref passed, test); //DelayTime CommonCompare.StringCompare("RequestParameters/Properties/DelayTime", "Properties.DelayTime", RelayOutput.Properties.DelayTime, ref logMessage, ref passed, test); //IdleState CommonCompare.StringCompare("RequestParameters/Properties/IdleState", "Properties.IdleState", RelayOutput.Properties.IdleState.ToString(), ref logMessage, ref passed, test); } else { passed = false; logMessage = logMessage + "No required tag Properties."; } } #endregion //Analize request //Generate response res = TestCommon.GenerateResponseStepTypeVoid(test, out ex, out Timeout); string typeRes = test.SelectNodes("Response")[0].InnerText; //Log message TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SetRelayOutputSettings); } else { res = StepType.None; Timeout = 0; ex = null; res = StepType.None; } return(res); }
internal StepType CreatePullPointSubscriptionTest(out EndpointReferenceType target, out System.DateTime CurrentTime, out System.DateTime?TerminationTime, out SoapException ex, out int timeOut, FilterType Filter, string InitialTerminationTime, CreatePullPointSubscriptionSubscriptionPolicy SubscriptionPolicy, XmlElement[] Any) { StepType res = StepType.None; target = new EndpointReferenceType(); timeOut = 0; ex = null; bool passed = true; string logMessage = ""; CurrentTime = System.DateTime.UtcNow; TerminationTime = CurrentTime.AddSeconds(10); //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("CreatePullPointSubscription"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[CreatePullPointSubscription]]; #region Analyze request //InitialTerminationTime CommonCompare.StringCompare("RequestParameters/InitialTerminationTime", "InitialTerminationTime", InitialTerminationTime, ref logMessage, ref passed, test); //Filter if (Filter != null) { if (test.SelectSingleNode("RequestParameters/Filter") != null) { if (test.SelectSingleNode("RequestParameters/Filter[@nocomp=\"true\"]") == null) { string XMLString = ""; foreach (XmlElement i in Filter.Any) { XMLString = XMLString + i.OuterXml; } CommonCompare.StringCompare("RequestParameters/Filter", "Filter", XMLString, ref logMessage, ref passed, test); } } else { passed = false; logMessage = logMessage + "Unexpected Filter."; } } else { if (test.SelectSingleNode("RequestParameters/Filter") != null) { passed = false; logMessage = logMessage + "No Filter."; } } #endregion //Analyze request //Generate response int useRealAddress = 0; object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoidSpecial(test, out targetObj, out ex, out timeOut, typeof(EndpointReferenceType), out useRealAddress); target = (EndpointReferenceType)targetObj; //Get real path to service if (useRealAddress != 0) { if (target.Address != null) { switch (useRealAddress) { case 1: target.Address.Value = m_TestCommon.SubscriptionManagerServiceUri; break; case 2: target.Address.Value = m_TestCommon.PullpointSubscriptionServiceUri; break; case 3: target.Address.Value = m_TestCommon.PullpointSubscriptionService2Uri; break; } } } #region Serialization Temp //Events.EndpointReferenceType dsr = new Events.EndpointReferenceType(); //dsr.Address = new Events.AttributedURIType(); //dsr.Address.Value = "http://192.168.10.203/onvif/event"; //dsr.Metadata = new Events.MetadataType(); //dsr.ReferenceParameters = new Events.ReferenceParametersType(); //XmlSerializer serializer1 = new XmlSerializer(typeof(Events.EndpointReferenceType)); //TextWriter textWriter = new StreamWriter("c:\\2.txt"); //serializer1.Serialize(textWriter, dsr); #endregion //Serialization Temp if (res == StepType.Normal) { //CurrentTime string CurrentTimeType = test.SelectSingleNode("ResponseParametersAdditional/CurrentTime/@type").InnerText; switch (CurrentTimeType) { case "now": { CurrentTime = System.DateTime.UtcNow; break; } case "value": { CurrentTime = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); break; } case "nowDiff": { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); CurrentTime = System.DateTime.UtcNow.AddSeconds(timeDiff); break; } } //TerminationTime if (test.SelectNodes("ResponseParametersAdditional/TerminationTime[@nil=\"true\"]").Count != 0) { TerminationTime = null; } else { if (test.SelectNodes("ResponseParametersAdditional/TerminationTime[@differance=\"true\"]").Count != 0) { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); TerminationTime = CurrentTime.AddSeconds(timeDiff); } else { TerminationTime = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); } } } //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, CreatePullPointSubscription); } else { timeOut = 0; target = null; ex = null; res = StepType.None; } return(res); }
internal StepType SMSRenewTest(out RenewResponse target, out SoapException ex, out int timeOut, Renew Renew1) { StepType res = StepType.None; target = new RenewResponse(); timeOut = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("SMSRenew"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[SMSRenew]]; #region Analyze request //TerminationTime if (test.SelectNodes("RequestParameters/TerminationTime[@type=\"now+diff\"]").Count == 0) { CommonCompare.StringCompare("RequestParameters/TerminationTime", "TerminationTime", Renew1.TerminationTime, ref logMessage, ref passed, test); } else { CommonCompare.CompareRealTime("RequestParameters/TerminationTime", "TerminationTime", Renew1.TerminationTime, ref logMessage, ref passed, test); } #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out timeOut, typeof(RenewResponse)); target = (RenewResponse)targetObj; #region Serialization Temp //Events.EndpointReferenceType dsr = new Events.EndpointReferenceType(); //dsr.Address = new Events.AttributedURIType(); //dsr.Address.Value = "http://192.168.10.203/onvif/event"; //dsr.Metadata = new Events.MetadataType(); //dsr.ReferenceParameters = new Events.ReferenceParametersType(); //XmlSerializer serializer1 = new XmlSerializer(typeof(Events.EndpointReferenceType)); //TextWriter textWriter = new StreamWriter("c:\\2.txt"); //serializer1.Serialize(textWriter, dsr); #endregion //Serialization Temp if (res == StepType.Normal) { //CurrentTime string CurrentTimeType = test.SelectSingleNode("ResponseParametersAdditional/CurrentTime/@type").InnerText; switch (CurrentTimeType) { case "now": { target.CurrentTime = System.DateTime.UtcNow; break; } case "value": { target.CurrentTime = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); break; } case "nowDiff": { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); target.CurrentTime = System.DateTime.UtcNow.AddSeconds(timeDiff); break; } case "none": { target.CurrentTimeSpecified = false; break; } } //TerminationTime if (test.SelectNodes("ResponseParametersAdditional/TerminationTime[@type=\"fromrequest\"]").Count != 0) { target.TerminationTime = Convert.ToDateTime(Renew1.TerminationTime); } else { if (test.SelectNodes("ResponseParametersAdditional/TerminationTime[@differance=\"true\"]").Count != 0) { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); target.TerminationTime = target.CurrentTime.AddSeconds(timeDiff); } else { target.TerminationTime = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); } } } m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, SMSRenew); } else { timeOut = 0; target = null; ex = null; res = StepType.None; } return(res); }
internal StepType PMSPullMessagesTest(out System.DateTime target, out NotificationMessageHolderType[] NotificationMessage, out System.DateTime TerminationTime, out SoapException ex, out int timeOut, out bool timeOutSpec, string Timeout, int MessageLimit, XmlElement[] Any) { StepType res = StepType.None; target = new System.DateTime(); timeOut = 0; timeOutSpec = false; ex = null; bool passed = true; string logMessage = ""; NotificationMessage = new NotificationMessageHolderType[1]; TerminationTime = new System.DateTime(); //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("PMSPullMessages"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[PMSPullMessages]]; #region Analyze request //Timeout CommonCompare.StringCompare("RequestParameters/Timeout", "Timeout", Timeout, ref logMessage, ref passed, test); //MessageLimit CommonCompare.IntCompare("RequestParameters/MessageLimit", "MessageLimit", MessageLimit, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response //TopicNamespaceLocation object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoidTimeout(test, out targetObj, out ex, out timeOut, out timeOutSpec, typeof(NotificationMessageHolderType[])); NotificationMessage = (NotificationMessageHolderType[])targetObj; #region Serialization Temp //bool dsr = false; //XmlSerializer serializer1 = new XmlSerializer(typeof(bool)); //TextWriter textWriter = new StreamWriter("c:\\2.txt"); //serializer1.Serialize(textWriter, dsr); #endregion //Serialization Temp if (res == StepType.Normal) { //CurrentTime string CurrentTimeType = test.SelectSingleNode("ResponseParametersAdditional/CurrentTime/@type").InnerText; switch (CurrentTimeType) { case "now": { target = System.DateTime.UtcNow; break; } case "value": { target = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); break; } case "nowDiff": { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/CurrentTime").InnerText); target = System.DateTime.UtcNow.AddSeconds(timeDiff); break; } } //TerminationTime if (test.SelectNodes("ResponseParametersAdditional/TerminationTime[@differance=\"true\"]").Count != 0) { int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); TerminationTime = target.AddSeconds(timeDiff); } else { TerminationTime = Convert.ToDateTime(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); } //For tns1:Monitoring/OperatingTime/LastClockSynchronization event if (test.SelectNodes("ResponseParametersAdditional/LastClockSynchronization[@differance=\"true\"]").Count != 0) { XmlNameTable xmlNameTable = NotificationMessage[0].Message.OwnerDocument.NameTable; XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlNameTable); xmlNamespaceManager.AddNamespace("tt", "http://www.onvif.org/ver10/schema"); NotificationMessage[0].Message.SelectSingleNode("tt:Data/tt:SimpleItem[@Name=\"Status\"]/@Value", xmlNamespaceManager); //int timeDiff = Convert.ToInt32(test.SelectSingleNode("ResponseParametersAdditional/TerminationTime").InnerText); //TerminationTime = target.AddSeconds(timeDiff); } } //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, PMSPullMessages); } else { timeOut = 0; target = new System.DateTime(); ex = null; res = StepType.None; } return(res); }