Esempio n. 1
0
 protected void AttachAddressing(ServiceEndpoint endpoint,
                                 Proxies.Event.EndpointReferenceType endpointReference)
 {
     if (endpointReference.ReferenceParameters != null && endpointReference.ReferenceParameters.Any != null)
     {
         EndpointReferenceBehaviour behaviour = new EndpointReferenceBehaviour(endpointReference);
         endpoint.Behaviors.Add(behaviour);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Creates PullPointSubscription client using address passed.
        /// </summary>
        /// <param name="endpointReference">Service address.</param>
        /// <returns></returns>
        protected PullPointSubscriptionClient CreatePullPointSubscriptionClient(Proxies.Event.EndpointReferenceType endpointReference)
        {
            Binding binding = CreateEventServiceBinding(endpointReference.Address.Value);

            _pullPointSubscriptionClient = new PullPointSubscriptionClient(binding, new EndpointAddress(endpointReference.Address.Value));

            AddSecurityBehaviour(_pullPointSubscriptionClient.Endpoint);
            AttachAddressing(_pullPointSubscriptionClient.Endpoint, endpointReference);

            SetupTimeout(_pullPointSubscriptionClient.InnerChannel);

            return(_pullPointSubscriptionClient);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates SubscriptionManager client using address passed.
        /// </summary>
        /// <param name="endpointReference">Service address.</param>
        /// <returns></returns>
        protected SubscriptionManagerClient CreateSubscriptionManagerClient(Proxies.Event.EndpointReferenceType endpointReference)
        {
            Binding binding = CreateEventServiceBinding(endpointReference.Address.Value);

            _subscriptionManagerClient = new SubscriptionManagerClient(binding, new EndpointAddress(endpointReference.Address.Value));

            System.Net.ServicePointManager.Expect100Continue = false;

            AddSecurityBehaviour(_subscriptionManagerClient.Endpoint);
            AttachAddressing(_subscriptionManagerClient.Endpoint, endpointReference);

            SetupTimeout(_subscriptionManagerClient.InnerChannel);

            return(_subscriptionManagerClient);
        }
        /// <summary>
        /// "Standard" subscription for 9.3.4 - 9.3.7 tests.
        /// </summary>
        /// <returns></returns>
        EndpointReferenceType CreateStandardSubscription(FilterType filter,
                                                         ref int terminationTimeSeconds)
        {
            string terminationTimeString = string.Format("PT{0}S", terminationTimeSeconds);

            XmlElement[] any = null;
            DateTime     currentTime;
            DateTime?    terminationTime;

            Proxies.Event.EndpointReferenceType endpointReference =
                CreatePullPointSubscriptionSafe(filter, terminationTimeString, null, ref any, out currentTime, out terminationTime, ref terminationTimeSeconds);

            if (endpointReference == null)
            {
                LogTestEvent("Subscription has not been created");
                return(null);
            }

            Assert(terminationTime.HasValue, "TerminationTime is not specified",
                   "Check that TerminationTime is specified");

            Assert(currentTime.AddSeconds(terminationTimeSeconds) <= terminationTime.Value,
                   "TerminationTime < CurrentTime + InitialTerminationTime",
                   "Validate times");

            Assert(endpointReference != null, "The DUT did not return SubscriptionReference",
                   "Check if the DUT returned SubscriptionReference");

            Assert(endpointReference.Address != null && endpointReference.Address.Value != null,
                   "SubscriptionReference does not contain address",
                   "Check if SubscriptionReference contains address");

            Assert(endpointReference.Address.Value.IsValidUrl(), "URL passed in SubscriptionReference is not valid",
                   "Check that URL specified is valid");


            CreateSubscriptionManagerClient(endpointReference);

            return(endpointReference);
        }
Esempio n. 5
0
        public void CreatePullPointSubscriptionTest()
        {
            bool subscribed = false;
            EndpointReferenceType eventAddress = null;
            int actualTerminationTime          = 10;

            RunTest <object>(
                () =>
            {
                return(null);
            },
                () =>
            {
                EnsureEventPortTypeClientCreated();

                XmlElement[] any = null;
                DateTime currentTime;
                DateTime?terminationTime;
                //
                // For this test it's stated explicitly that neither Topic Expression nor Message Content
                // filter is specified.
                //
                Proxies.Event.EndpointReferenceType endpointReference =
                    CreatePullPointSubscriptionSafe(null,
                                                    "PT10S",
                                                    null,
                                                    ref any,
                                                    out currentTime,
                                                    out terminationTime,
                                                    ref actualTerminationTime);

                if (endpointReference == null)
                {
                    return;
                }

                subscribed = true;

                Assert(endpointReference != null, "The DUT did not return SubscriptionReference",
                       "Check if the DUT returned SubscriptionReference");

                Assert(endpointReference.Address != null && endpointReference.Address.Value != null, "SubscriptionReference does not contain address",
                       "Check if SubscriptionReference contains address");

                Assert(endpointReference.Address.Value.IsValidUrl(), "URL passed in SubscriptionReference is not valid",
                       "Check that URL specified is valid");

                eventAddress = endpointReference;

                Assert(terminationTime.HasValue, "TerminationTime is not specified",
                       "Check that TerminationTime is specified");

                Assert(currentTime.AddSeconds(actualTerminationTime) <= terminationTime.Value,
                       "TerminationTime < CurrentTime + InitialTerminationTime",
                       "Validate times");
            },
                (o) =>
            {
                if (subscribed)
                {
                    if (eventAddress != null)
                    {
                        CreateSubscriptionManagerClient(eventAddress);
                    }
                    ReleaseSubscriptionManager(actualTerminationTime * 1000);
                }
            });
        }