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 GetRecordingSearchResultsTest(out FindRecordingResultList 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 = "GetRecordingSearchResults"; int tmpCommandNumber = GetRecordingSearchResults; //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 int useTimeOut = 0; object targetObj; res = TestCommon.GenerateResponseStepTypeNotVoidSpecial(test, out targetObj, out ex, out Timeout, typeof(FindRecordingResultList), out useTimeOut); target = (FindRecordingResultList)targetObj; 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); }