public void PtzConfigurationAndNodesConsistencyTest()
        {
            RunTest(() =>
            {
                PTZConfiguration[] configurations = GetConfigurations();
                Assert((configurations != null) && (configurations.Length > 0), Resources.ErrorNoPTZConfig_Text, Resources.StepValidateGetConfigurations_Title);

                PTZNode[] nodes = GetNodes();
                Assert((nodes != null) && (nodes.Length > 0), Resources.ErrorNoPTZNode_Text, Resources.StepValidateGetNodes_Title);

                foreach (PTZConfiguration configuration in configurations)
                {
                    string nodeToken = configuration.NodeToken;

                    int cnt = nodes.Where(N => N.token == nodeToken).Count();

                    Assert(cnt > 0,
                           string.Format("PTZ node with token '{0}' not found", nodeToken),
                           "Check if PTZ Node exists");

                    Assert(cnt == 1,
                           string.Format("More than one PTZ node with token '{0}' found", nodeToken),
                           "Check if PTZ Node with token specified is unique");

                    PTZNode node = nodes.Where(N => N.token == nodeToken).FirstOrDefault();

                    Assert(node.SupportedPTZSpaces != null,
                           "SupportedPTZSpaces not defined",
                           string.Format("Check if SupportedPTZSpaces settings are defined for PTZ node '{0}'", nodeToken));

                    CheckNodeAndConfiguration(configuration, node);
                }
            });
        }
Beispiel #2
0
        protected PTZNode GetPtzNode()
        {
            PTZClient client = PtzClient;
            PTZNode   node   = null;

            RunStep(() => { node = client.GetNode(_ptzNode); }, "Get PTZ Node");
            DoRequestDelay();
            return(node);
        }
 public Model(
     Profile profile, PTZPreset[] presets, PTZStatus status, PTZNode node
     )
 {
     this.profile = profile;
     this.presets = presets;
     this.status  = status;
     this.node    = node;
 }
        void CheckNodeAndConfiguration(PTZConfiguration configuration, PTZNode node)
        {
            bool          ok = true;
            StringBuilder sb = new StringBuilder();

            ok = CheckConfigurationAndSpaces(configuration, node.SupportedPTZSpaces, sb);

            Assert(ok, sb.ToStringTrimNewLine(), "Check that PTZ configuration are correct accordingly to PTZ node settings");
        }
        internal StepType GetNodeTest(out PTZNode target, out SoapException ex, out int Timeout, string NodeToken)
        {
            StepType res = StepType.None;

            Timeout = 0;
            ex      = null;
            target  = null;
            bool   passed     = true;
            string logMessage = "";

            string tmpCommandName   = "GetNode";
            int    tmpCommandNumber = GetNode;

            //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

                //NodeToken
                CommonCompare.StringCompare("RequestParameters/NodeToken", "NodeToken", NodeToken, ref logMessage, ref passed, test);

                #endregion //Analyze request

                //Generate response
                object targetObj;
                res    = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(PTZNode));
                target = (PTZNode)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);
        }
            public static Model Create(
                Profile profile,
                PTZPreset[] presets,
                PTZStatus status,
                PTZNode node
                )
            {
                var _this = new Model();

                _this.profile = profile;
                _this.presets = presets;
                _this.status  = status;
                _this.node    = node;
                return(_this);
            }
        public void NodeTest()
        {
            RunTest(() =>
            {
                PTZNode[] nodes = GetNodes();
                Assert((nodes != null) && (nodes.Length > 0), Resources.ErrorNoPTZNode_Text, Resources.StepValidateGetNodes_Title);

                string token  = !string.IsNullOrEmpty(_ptzNodeToken) ? _ptzNodeToken : nodes[0].token;
                PTZNode node  = GetNode(token);
                string reason = null;
                Assert(
                    (node.token == token) && ValidatePTZNode(node, out reason),
                    node.token != token ? string.Format("PTZ node has invalid token. Expected: {0} - actual: {1}", token, node.token) : reason,
                    Resources.StepValidatePTZNode_Title);
            });
        }
        public void AuxiliaryCommand()
        {
            RunTest(() =>
            {
                PTZConfigurationOptions options;
                Profile profile = GetPTZProfile(_ptzNodeToken, out options);
                Assert((profile != null) && (profile.PTZConfiguration != null), Resources.ErrorNoPTZProfile, Resources.StepValidatePTZProfile);

                PTZNode node = GetNode(profile.PTZConfiguration.NodeToken);

                Assert((node.AuxiliaryCommands != null) && (node.AuxiliaryCommands.Length > 0),
                       string.Format("Node [token={0}] does not contain auxiliary commands", node.token),
                       "Checking auxiliary commands list");

                foreach (string command in node.AuxiliaryCommands)
                {
                    SendAuxiliaryCommnad(profile.token, command);
                }
            });
        }
        public void FixedHomeAttributeUsageTest()
        {
            RunTest(() =>
            {
                //5.	ONVIF Client configures and selects a media profile as described in Annex A.1.
                Profile profile = GetPTZProfile(_ptzNodeToken);
                Assert((profile != null) && (profile.PTZConfiguration != null), Resources.ErrorNoPTZProfile, Resources.StepValidatePTZProfile);

                //3.	ONVIF Client invokes GetNodeRequest message (Node Token) to get PTZ node capabilities.
                //4.	Verify the GetNodeResponse message from the DUT. If GetNodeResponse message
                // does not contains FixedHomePosition attribute skip other steps and go to the next test.

                string nodeToken = profile.PTZConfiguration.NodeToken;
                PTZNode node     = GetNode(nodeToken);

                //6.	ONVIF Client invokes SetHomePositionRequest message (Profile Token) to get
                // PTZ node capabilities.
                //7.	Verify the SetHomePositionResponse message or SOAP 1.2 fault message
                // (Action/CannotOverwriteHome or ActionNotSupported) from the DUT. Verify that
                // SetHomePositionResponse message was relieved if FixedHomePosition = “true”. Verify that
                // SOAP 1.2 fault message (Action/CannotOverwriteHome or ActionNotSupported) was relieved
                // if FixedHomePosition = “false”.

                if (node.FixedHomePositionSpecified)
                {
                    if (node.FixedHomePosition)
                    {
                        SetFixedHomePosition(profile.token);
                    }
                    else
                    {
                        SetHomePosition(profile.token);
                    }
                }
            });
        }