Exemplo n.º 1
0
        /// <summary>
        /// Creates invalid MessageContent filter (unexisting item specified for ItemFilter).
        /// </summary>
        /// <returns></returns>
        protected FilterInfo GetInvalidMessageContentFilter(out bool topicSetEmpty)
        {
            FilterInfo filter;

            TestTool.Proxies.Event.TopicSetType topicSet = GetTopicSet();

            topicSetEmpty = (topicSet == null || topicSet.Any == null || topicSet.Any.Length == 0);

            if (topicSetEmpty)
            {
                Assert(true, "TopicSet is empty", "Check that TopicSet is not empty");
                return(null);
            }

            // enumerate topics in topic set
            foreach (XmlElement element in topicSet.Any)
            {
                XmlNamespaceManager manager = new XmlNamespaceManager(element.OwnerDocument.NameTable);
                manager.AddNamespace(OnvifMessage.ONVIFPREFIX, OnvifMessage.ONVIF);

                filter = GetInvalidMessageContentFilter(element, manager);

                // if filter created - OK
                if (filter != null)
                {
                    return(filter);
                }
            }

            // return NULL if cannot create filter
            return(null);
        }
Exemplo n.º 2
0
        public List <EventsTopicInfo> GetTopics()
        {
            TestTool.Proxies.Event.TopicSetType topicSet = GetTopicSet();

            if (topicSet == null || topicSet.Any == null || topicSet.Any.Length == 0)
            {
                return(null);
            }

            List <XmlElement> topics = new List <XmlElement>();

            foreach (XmlElement element in topicSet.Any)
            {
                FindTopics(element, topics);
            }

            List <EventsTopicInfo> topicInfos = new List <EventsTopicInfo>();

            foreach (XmlElement nextTopicElement in topics)
            {
                TopicInfo       info          = TopicInfo.ConstructTopicInfo(nextTopicElement);
                EventsTopicInfo nextTopicInfo = info.GetPlainInfo();
                topicInfos.Add(nextTopicInfo);
            }

            return(topicInfos);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets invalid topic.
        /// </summary>
        /// <returns>String which does not match any of topics supported.</returns>
        protected string GetInvalidTopic()
        {
            TestTool.Proxies.Event.TopicSetType topicSet = GetTopicSet();

            Assert((topicSet != null), "The DUT did not return any TopicSet", "Check if TopicSet returned");

            Assert((topicSet.Any != null), "TopicSet is empty", "Check that TopicSet is not empty");

            // get all topics and create a string which does not match any of them
            List <string> topics = new List <string>();

            foreach (XmlElement element in topicSet.Any)
            {
                FindTopics(element, topics);
            }

            return(topics.GetNonMatchingString());
        }