Example #1
0
        public SomeComplexReturnObject getDataViaChain(SomeComplexRequestObject request)
        {
            IFGSMSNetService        anotherendpoint = WCFtTests.getproxyWithMonitor(TC00134.urlSecondHop);
            SomeComplexReturnObject r = anotherendpoint.getData(request);

            ((IClientChannel)anotherendpoint).Close();
            ((IClientChannel)anotherendpoint).Dispose();
            r.stderr += " hi via chaining!!";
            return(r);
        }
Example #2
0
        public SomeComplexReturnObject getData(SomeComplexRequestObject request)
        {
            SomeComplexReturnObject r = new SomeComplexReturnObject();

            r.duration     = request.duration;
            r.responsecode = request.responsecode;
            r.stderr       = "hi via NOT chaining " + request.stderr;
            r.stdout       = request.stdout;
            return(r);
        }
Example #3
0
        void dowork_TC00134_ALL_SELF_HOSTED(bool recordrequest, bool recordresponse)
        {
            CommonUtils.RemoveService(urlFirstHop);
            CommonUtils.RemoveService(urlSecondHop);
            CommonUtils.SetPolicy(urlFirstHop, recordrequest, recordresponse);
            CommonUtils.SetPolicy(urlSecondHop, recordrequest, recordresponse);

            try
            {
                MessageProcessor mp = MessageProcessor.Instance;
                MessageProcessor.PurgePolicyCache();
                MessageProcessor.PurgeOutboundQueue();
                Assert.IsTrue(MessageProcessor.GetPolicyCacheSize() == 0);
                Assert.IsTrue(MessageProcessor.GetQueueSize() == 0);
                ServiceHost host = new ServiceHost(typeof(FGSMSNetServiceImpl));
                host.Description.Behaviors.Remove(typeof(org.miloss.fgsms.agent.wcf.AgentWCFServiceBehavior));
                host.Description.Behaviors.Add(new org.miloss.fgsms.agent.wcf.AgentWCFServiceBehavior());
                host.Open();

                ServiceHost host2 = new ServiceHost(typeof(FGSMSNetServiceImpl2));
                host.Description.Behaviors.Remove(typeof(org.miloss.fgsms.agent.wcf.AgentWCFServiceBehavior));
                host2.Description.Behaviors.Add(new org.miloss.fgsms.agent.wcf.AgentWCFServiceBehavior());
                host2.Open();



                IFGSMSNetService         svc = WCFtTests.getproxyWithMonitor(urlFirstHop);
                SomeComplexRequestObject req = new SomeComplexRequestObject();
                req.stdout = "hi";

                SomeComplexReturnObject ret = svc.getDataViaChain(req);

                Thread.Sleep(10000);
                DateTime timeout = DateTime.Now.AddMinutes(2);
                Console.Out.WriteLine("message sent queue size" + MessageProcessor.GetQueueSize());
                while (MessageProcessor.GetQueueSize() > 0 && DateTime.Now < timeout)
                {
                    Thread.Sleep(1000);
                }
                ((IClientChannel)svc).Close();
                ((IClientChannel)svc).Dispose();
                host.Close();
                host2.Close();
            }
            catch (Exception ex)
            {
                string _err = "";
                while (ex != null)
                {
                    _err += ex.Message + " " + ex.StackTrace;
                    ex    = ex.InnerException;
                }
                CommonUtils.RemoveService(urlFirstHop);
                CommonUtils.RemoveService(urlSecondHop);
                Assert.Fail(_err);
            }

            Thread.Sleep(10000);
            string err = "";

            if (MessageProcessor.GetPolicyCacheSize() == 0)
            {
                err += "policy cache is empty, it should have at least one item in it";
            }
            if (!String.IsNullOrEmpty(MessageProcessor.LastErrorMessage))
            {
                err += "agent error " + MessageProcessor.LastErrorMessage;
            }

            TransactionalWebServicePolicy tp = MessageProcessor.GetPolicyIfAvailable(urlFirstHop, true);

            if (tp == null)
            {
                err += "the policy for the service was not cached, which means something went wrong" + urlFirstHop;
            }
            tp = MessageProcessor.GetPolicyIfAvailable(urlSecondHop, true);
            if (tp == null)
            {
                err += "the policy for the service was not cached, which means something went wrong" + urlSecondHop;
            }
            // err += CommonUtils.VerifyLastMessagePayloads(urlFirstHop, recordrequest, recordresponse, 2);
            //err += CommonUtils.VerifyLastMessagePayloadsTwoAgentsOneTransaction(urlFirstHop);
            err += CommonUtils.VerifyServiceChainingEvents(urlFirstHop, urlSecondHop, recordrequest, recordresponse);
            CommonUtils.RemoveService(urlFirstHop);
            CommonUtils.RemoveService(urlSecondHop);
            if (!String.IsNullOrEmpty(err))
            {
                Assert.Fail(err);
            }
        }