예제 #1
0
        /// <summary>
        /// Parse WSE XTestStep to get data.
        /// </summary>
        /// <param name="xTestStep">WSE XTestStep</param>
        /// <param name="payloadParser">XML or Json Payload Parser.
        /// The request payload is extracted from XTestStep.
        /// The response paylod is extracted from Module.
        /// </param>
        public void Parse(XTestStep xTestStep, IPayloadParser payloadParser)
        {
            try {
                var methodParser = new MethodParser();
                Method = methodParser.Parse(xTestStep);

                var addressParser = new AddressParser();
                AddressParserResult addressParserResult = addressParser.Parse(xTestStep);
                Endpoint    = addressParserResult.Endpoint;
                Resource    = addressParserResult.Resource;
                QueryParams = addressParserResult.QueryParams;

                var headerParser = new HeaderParser();
                Headers         = headerParser.Parse(xTestStep, AddOnConstants.TestStepRequestHeadersTql);
                Headers         = CommonUtilities.ModifyContentTypeToEmpty(Headers);
                ResponseHeaders = headerParser.Parse(xTestStep, AddOnConstants.TestStepResponseHeadersTql);

                var statusCodeParser = new StatusCodeParser();
                ResponseStatus = statusCodeParser.ParseResponseStatus(xTestStep);

                RequestPayload = payloadParser.Parse(xTestStep,
                                                     "=>SUBPARTS:XTestStepValue[Name==\"Request\"]->SUBPARTS:XTestStepValue");
                ResponsePayload = payloadParser.Parse(xTestStep.Module, AddOnConstants.ResponsePayloadTql);
                HashCode        = GetHashCode(xTestStep);
            }
            catch (Exception e) {
                FileLogger.Instance.Error(e);
            }
        }
예제 #2
0
        /// <summary>
        /// Parses WSE XModule to get data.
        /// </summary>
        /// <param name="wseModule">WSE XModule</param>
        public void Parse(XModule wseModule)
        {
            try {
                var methodParser = new MethodParser();
                Method = methodParser.Parse(wseModule);

                var addressParser = new AddressParser();
                AddressParserResult addressParserResult = addressParser.Parse(wseModule);
                Endpoint    = addressParserResult.Endpoint;
                Resource    = addressParserResult.Resource;
                QueryParams = addressParserResult.QueryParams;

                var headerParser = new HeaderParser();
                Headers         = headerParser.Parse(wseModule, AddOnConstants.RequestHeadersTql);
                Headers         = CommonUtilities.ModifyContentTypeToEmpty(Headers);
                ResponseHeaders = headerParser.Parse(wseModule, AddOnConstants.ResponseHeadersTql);

                var payloadParser = new XmlPayloadParser();
                RequestPayload  = payloadParser.Parse(wseModule, AddOnConstants.RequestPayloadTql);
                ResponsePayload = payloadParser.Parse(wseModule, AddOnConstants.ResponsePayloadTql);

                var statusCodeParser = new StatusCodeParser();
                ResponseStatus = statusCodeParser.ParseResponseStatus(wseModule);

                HashCode = GetHashCode(wseModule);
            }
            catch (Exception e) {
                FileLogger.Instance.Error(e);
            }
        }