Ejemplo n.º 1
0
        /**
         * Failed	TC00136_ASPNETMonitoredThickClienttoASPNETserviceMonitored	FGSMS.NETTestSuite	Assert.Fail failed.
         * VerifyLastMessagePayloadsTwoAgentsOneTransaction, more total transactions returned that expected 1 vs 2
         * VerifyLastMessagePayloadsTwoAgentsOneTransaction, more actual transactions returned that expected 1 vs 2
         */
        public static string VerifyLastMessagePayloadsTwoAgentsOneTransaction(string url_internal)
        {
            dataAccessService das = GetDASProxyAdmin();
            GetRecentMessageLogsRequestMsg req = new GetRecentMessageLogsRequestMsg();

            req.classification  = new SecurityWrapper();
            req.offset          = 0;
            req.offsetSpecified = true;
            req.records         = 2;
            req.URL             = url_internal;
            GetMessageLogsResponseMsg res = das.GetRecentMessageLogs(req);

            string ret = "";

            if (res == null || res == null || res.logs == null || res.logs.Length == 0)
            {
                ret += ("VerifyLastMessagePayloadsTwoAgentsOneTransaction, no results found");
            }
            //  if (res.GetMessageLogsResult.TotalRecords != 2)
            //      ret += "VerifyLastMessagePayloadsTwoAgentsOneTransaction, more/less total transactions returned that expected " + res.GetMessageLogsResult.TotalRecords + " vs " + 2;
            if (res.logs.Length > 2)
            {
                ret += "VerifyLastMessagePayloadsTwoAgentsOneTransaction, more transactional log verification results were returned than expected" + res.logs.Length;
            }
            if (res.logs.Length < 2)
            {
                ret += "VerifyLastMessagePayloadsTwoAgentsOneTransaction, less actual transactions returned that expected " + res.logs.Length + " vs " + 2;
            }


            //get the details
            GetMessageTransactionLogDetailsResponseMsg t1 = new GetMessageTransactionLogDetailsResponseMsg();
            GetMessageTransactionLogDetailsResponseMsg t2 = new GetMessageTransactionLogDetailsResponseMsg();
            GetMessageTransactionLogDetailsMsg         r  = new GetMessageTransactionLogDetailsMsg();

            r.classification = new SecurityWrapper();
            if (res.logs.Length > 0)
            {
                r.transactionID = res.logs[0].transactionId;

                t1 = das.GetMessageTransactionLogDetails(r);
            }
            if (res.logs.Length > 1)
            {
                r.transactionID = res.logs[1].transactionId;
                t2 = das.GetMessageTransactionLogDetails(r);
            }

            das.Dispose();

            string agentsdata = "";

            // if (!String.IsNullOrEmpty(ret))
            if (t1 != null)
            {
                agentsdata = t1.agentType + ":" + t1.transactionId;
            }
            if (t2 != null)
            {
                agentsdata = t2.agentType + ":" + t2.transactionId;
            }
            if (!String.IsNullOrEmpty(ret))
            {
                return(ret + agentsdata);
            }
            //verify transaction thread id matches

            if (String.IsNullOrEmpty(t1.relatedTransactionID))
            {
                ret = "the transaction " + t1.transactionId + " did not have a related transaction id, this means that an http header was not propagated,  either by either recording agent, agent " + t1.agentType + " " + t1.agentMemo;
            }

            if (String.IsNullOrEmpty(t2.relatedTransactionID))
            {
                ret = "the transaction " + t2.transactionId + " did not have a related transaction id, this means that an http header was not propagated  either by either recording agent, agent " + t2.agentType + " " + t2.agentMemo;
            }
            if (!String.IsNullOrEmpty(ret))
            {
                return(ret);//prevent npe
            }
            if (!t1.transactionthreadId.Equals(t2.transactionthreadId, StringComparison.CurrentCultureIgnoreCase))
            {
                ret += "VerifyLastMessagePayloadsTwoAgentsOneTransaction, the transaction thread id's do not match" + t1.transactionthreadId + " vs " + t2.transactionthreadId;
            }
            if (!t1.relatedTransactionID.Equals(t2.transactionId, StringComparison.CurrentCultureIgnoreCase))
            {
                ret += "VerifyLastMessagePayloadsTwoAgentsOneTransaction, the transaction related message id's does not match. this probably means an http wasn't propagated t1 " + t1.relatedTransactionID + " vs t2 " + t2.transactionId;
            }
            if (!t2.relatedTransactionID.Equals(t1.transactionId, StringComparison.CurrentCultureIgnoreCase))
            {
                ret += "VerifyLastMessagePayloadsTwoAgentsOneTransaction, the transaction related message id's does not match. this probably means an http wasn't propagated t1 " + t2.relatedTransactionID + " vs t2 " + t1.transactionId;
            }

            return(ret);
        }