Пример #1
0
        void TC00138_dowork(bool request, bool response)
        {
            Thread.Sleep(10000);
            MessageProcessor mp = MessageProcessor.Instance;
            //Configuration config = CommonUtils.GetMappedConfig();
            string urlmod = MessageProcessor.ModifyURL(ConfigurationManager.AppSettings["HelloWorldESMWCFviaASPNET"],
            //   config.AppSettings.Settings["HelloWorldESMWCFviaASPNET"].Value,
            true);
            try
            {
                //CommonUtils.BounceIIS();
                CommonUtils.RemoveService(urlmod);
                Thread.Sleep(5000);
                CommonUtils.SetPolicy(urlmod, request, response);
                HelloWorldESMWCFviaASPNET.Service1 svc = new HelloWorldESMWCFviaASPNET.Service1();

                MessageProcessor.PurgeOutboundQueue();
                MessageProcessor.PurgePolicyCache();
                callback c = new callback();
                MessageProcessor.RegisterCallbacks(c);

                svc.Url = ConfigurationManager.AppSettings["HelloWorldESMWCFviaASPNET"];
                //config.AppSettings.Settings["HelloWorldESMWCFviaASPNET"].Value;
                string s = svc.WorkingGetData(5, true);
                DateTime timeout = DateTime.Now.AddMinutes(2);

                Console.Out.WriteLine("message sent queue size" + MessageProcessor.GetQueueSize());
                while (DateTime.Now < timeout && !c.done)

                    Thread.Sleep(1000);
                Thread.Sleep(4000);
                svc.Dispose();

                MessageProcessor.UnRegisterCallbacks(c);
            }
            catch (Exception ex)
            {
                string _err = "";
                while (ex != null)
                {
                    _err += ex.Message + " " + ex.StackTrace;
                    ex = ex.InnerException;
                }
                CommonUtils.RemoveService(urlmod);
                Assert.Fail(_err);
            }
            TransactionalWebServicePolicy tp = MessageProcessor.GetPolicyIfAvailable(urlmod, true);
            Assert.IsNotNull(tp);
            Assert.IsTrue(String.IsNullOrEmpty(MessageProcessor.LastErrorMessage));
            string s2 = CommonUtils.VerifyLastMessagePayloadsTwoAgentsOneTransaction(urlmod);
            CommonUtils.RemoveService(urlmod);
            if (!String.IsNullOrEmpty(s2))
                Assert.Fail(s2);
        }
Пример #2
0
        void TC00138_dowork(bool request, bool response)
        {
            Thread.Sleep(10000);
            MessageProcessor mp = MessageProcessor.Instance;
            //Configuration config = CommonUtils.GetMappedConfig();
            string urlmod = MessageProcessor.ModifyURL(ConfigurationManager.AppSettings["HelloWorldESMWCFviaASPNET"],
                                                       //   config.AppSettings.Settings["HelloWorldESMWCFviaASPNET"].Value,
                                                       true);

            try
            {
                //CommonUtils.BounceIIS();
                CommonUtils.RemoveService(urlmod);
                Thread.Sleep(5000);
                CommonUtils.SetPolicy(urlmod, request, response);
                HelloWorldESMWCFviaASPNET.Service1 svc = new HelloWorldESMWCFviaASPNET.Service1();


                MessageProcessor.PurgeOutboundQueue();
                MessageProcessor.PurgePolicyCache();
                callback c = new callback();
                MessageProcessor.RegisterCallbacks(c);

                svc.Url = ConfigurationManager.AppSettings["HelloWorldESMWCFviaASPNET"];
                //config.AppSettings.Settings["HelloWorldESMWCFviaASPNET"].Value;
                string   s       = svc.WorkingGetData(5, true);
                DateTime timeout = DateTime.Now.AddMinutes(2);

                Console.Out.WriteLine("message sent queue size" + MessageProcessor.GetQueueSize());
                while (DateTime.Now < timeout && !c.done)
                {
                    Thread.Sleep(1000);
                }
                Thread.Sleep(4000);
                svc.Dispose();

                MessageProcessor.UnRegisterCallbacks(c);
            }
            catch (Exception ex)
            {
                string _err = "";
                while (ex != null)
                {
                    _err += ex.Message + " " + ex.StackTrace;
                    ex    = ex.InnerException;
                }
                CommonUtils.RemoveService(urlmod);
                Assert.Fail(_err);
            }
            TransactionalWebServicePolicy tp = MessageProcessor.GetPolicyIfAvailable(urlmod, true);

            Assert.IsNotNull(tp);
            Assert.IsTrue(String.IsNullOrEmpty(MessageProcessor.LastErrorMessage));
            string s2 = CommonUtils.VerifyLastMessagePayloadsTwoAgentsOneTransaction(urlmod);

            CommonUtils.RemoveService(urlmod);
            if (!String.IsNullOrEmpty(s2))
            {
                Assert.Fail(s2);
            }
        }