예제 #1
0
        void CompareCapabilities(ReceiverServiceCapabilities serviceCapabilities, ReceiverServiceCapabilities capabilities)
        {
            BeginStep("Compare Capabilities");

            StringBuilder dump  = new StringBuilder();
            bool          equal = true;

            equal &= CheckField(serviceCapabilities, capabilities, C => C.RTP_Multicast,
                                C => C.RTP_MulticastSpecified, "RTP_Multicast", "GetServices", "GetServiceCapabilities", dump);
            equal &= CheckField(serviceCapabilities, capabilities, C => C.RTP_TCP,
                                C => C.RTP_TCPSpecified, "RTP_TCP", "GetServices", "GetServiceCapabilities", dump);
            equal &= CheckField(serviceCapabilities, capabilities, C => C.RTP_RTSP_TCP,
                                C => C.RTP_RTSP_TCPSpecified, "RTP_RTSP_TCP", "GetServices", "GetServiceCapabilities", dump);
            equal &= CheckField(serviceCapabilities, capabilities, C => C.MaximumRTSPURILength,
                                C => C.MaximumRTSPURILengthSpecified, "MaximumRTSPURILength", "GetServices", "GetServiceCapabilities", dump);

            if (serviceCapabilities.SupportedReceivers != capabilities.SupportedReceivers)
            {
                equal &= false;
                dump.Append(string.Format("   Supported recievers values don't match{0}", Environment.NewLine));
            }

            if (!equal)
            {
                LogStepEvent(dump.ToStringTrimNewLine());
                throw new AssertException("Settings don't match");
            }

            StepPassed();
        }
        public void SearchServiceCapabilitiesTest()
        {
            RunTest(() =>
            {
                // Initialize client
                ReceiverServiceCapabilities capabilities = GetServiceCapabilities();

                BeginStep("Validate Service Capabilities");

                bool ok            = true;
                StringBuilder dump = new StringBuilder("Capabilities are incorrect" + Environment.NewLine);
                if (capabilities.SupportedReceivers <= 1)
                {
                    dump.Append(string.Format("   SupportedReceivers is incorrect ({0}){1}", capabilities.SupportedReceivers, Environment.NewLine));
                    ok = false;
                }
                if (capabilities.MaximumRTSPURILengthSpecified && capabilities.MaximumRTSPURILength <= 128)
                {
                    dump.Append(string.Format("   MaximumRTSPURILength is incorrect ({0}){1}", capabilities.MaximumRTSPURILength, Environment.NewLine));
                    ok = false;
                }

                if (!ok)
                {
                    throw new AssertException(dump.ToStringTrimNewLine());
                }

                StepPassed();
            });
        }
예제 #3
0
        public static ReceiverServiceCapabilities GetReceiverServiceCapabilities(BaseOnvifTest test, ReceiverPortClient client)
        {
            ReceiverServiceCapabilities capabilities = null;

            RunStep(test, () => { capabilities = client.GetServiceCapabilities(); }, "Get Receiver Service Capabilities");
            DoRequestDelay(test);
            return(capabilities);
        }
예제 #4
0
        protected ReceiverServiceCapabilities GetServiceCapabilities()
        {
            ReceiverServiceCapabilities capabilities = null;

            RunStep(() => { capabilities = Client.GetServiceCapabilities(); }, "Get Service Capabilities");
            DoRequestDelay();
            return(capabilities);
        }
        public void DeleteReceiverTest()
        {
            Receiver receiver            = null;
            ReceiverConfiguration config = null;
            bool isReceiverDeleted       = false;
            bool isReceiverCreated       = false;

            RunTest(() =>
            {
                ReceiverServiceCapabilities capabilities = GetServiceCapabilities();

                Assert(capabilities != null, "No capabilities returned", "Check that capabilities were returned");

                var receivers = GetReceivers();

                Assert(receivers != null, "No receivers returned", "Check that receivers list is not empty");

                int count = capabilities.SupportedReceivers - receivers.Length;

                if (count > 0)
                {
                    config            = GetReceiverConfiguration();
                    receiver          = CreateReceiver(config);
                    isReceiverCreated = true;
                    CheckReceiverConfiguration(receiver, config);
                }
                else
                {
                    receiver = receivers[0];
                }

                var token = receiver.Token;

                DeleteReceiver(token);
                isReceiverDeleted = true;

                receivers = GetReceivers();

                receiver = null;
                if (receivers != null)
                {
                    receiver = receivers.FirstOrDefault(r => r.Token == token);
                }

                Assert(receiver == null, "Receiver list contains receiver deleted", "Check that receiver list doesn't contain receiver deleted");

                this.InvalidTokenTestBody <object>((s, T) => Client.GetReceiver(s), null,
                                                   RunStep, "Try to get Receiver deleted", token, OnvifFaults.NotFound);
            }, () =>
            {
                if (!isReceiverDeleted && isReceiverCreated && receiver != null)
                {
                    DeleteReceiver(receiver.Token);
                }
            });
        }
예제 #6
0
        private Receiver[] GetReceiversCountToCreate(out int count)
        {
            ReceiverServiceCapabilities capabilities = GetServiceCapabilities();

            Assert(capabilities != null, "No capabilities returned", "Check that capabilities were returned");

            var receivers = GetReceivers();

            Assert(receivers != null, "No receivers returned", "Check that receivers list is not empty");

            count = capabilities.SupportedReceivers - receivers.Length;

            return(receivers);
        }
        public void SearchServicesAndRecieverServiceCapabilitiesTest()
        {
            RunTest(() =>
            {
                Service[] services = GetServices(true);

                Service recieverService = services.FindService(Definitions.Onvif.OnvifService.RECEIVER);



                Assert(recieverService != null, "No Reciever service information returned", "Check that the DUT returned Reciever service information");

                Assert((recieverService.Capabilities != null), "No Capabilities information included",
                       "Check that Capabilities element is included in Services element");

                ReceiverServiceCapabilities serviceCapabilities = ParseReceiverCapabilities(recieverService.Capabilities);

                ReceiverServiceCapabilities capabilities = GetServiceCapabilities();

                CompareCapabilities(serviceCapabilities, capabilities);
            });
        }