Package com.betfair.testing.utils.cougar.beans

Examples of com.betfair.testing.utils.cougar.beans.HttpResponseBean


     
     
      //Get actual responses
      loopCounter=0;
      for (HttpCallBean httpCallBean: httpCallBeans) {
        HttpResponseBean responseBean = httpCallBean.getResponseObjectsByEnum(CougarMessageProtocolResponseTypeEnum.REST);
        responseBean.setResponseHeaders(null);
        actualResponses.put(identifier + "Response " + loopCounter, responseBean);
        loopCounter++;
      }
     
      //Set the expected response time
      for (String keyString: expectedResponses.keySet()) {
        HttpResponseBean responseBean = expectedResponses.get(keyString);
        Timestamp requestTime = expectedRequestTimes.get(keyString);
        responseBean.setRequestTime(requestTime);
        responseBean.setResponseTime(requestTime);
      }
     
    }
View Full Code Here


    }

    // Get actual responses
    loopCounter = 0;
    for (HttpCallBean httpCallBean : httpCallBeans) {
      HttpResponseBean responseBean = httpCallBean.getResponseObjectsByEnum(CougarMessageProtocolResponseTypeEnum.SOAP);
      responseBean.setResponseHeaders(null);
      actualResponses.put(identifier + "Response " + loopCounter, responseBean);
      loopCounter++;
    }

    // Set the expected response time
    for (String keyString : expectedResponses.keySet()) {
      HttpResponseBean responseBean = expectedResponses
          .get(keyString);
      Timestamp requestTime = expectedRequestTimes.get(keyString);
       
      responseBean.setRequestTime(requestTime);
      responseBean.setResponseTime(requestTime);
    }
  }
View Full Code Here

      callBean.setSOAPMessage(msgEx.getRequest());
     
      httpCallBeans.add(callBean);

      // create expected responses
      HttpResponseBean responseBean = new HttpResponseBean();
     
      //set the message to correspond to the request
     
      responseBean.setResponseObject(msgEx.getResponse());
     
      expectedResponses.put(identifier + "Response " + i,
          responseBean);
    }
View Full Code Here

          break;
        }
        callBean.setAcceptProtocols(acceptProtocols);
       
        //Store expected responses
        HttpResponseBean responseBean = new HttpResponseBean();
        String responseXmlString = "<SimpleResponse><message>headerParam=Foo,queryParam=" + queryParameter + ",dateQueryParam=Mon Jun 01 13:50:00 UTC 2009</message></SimpleResponse>";
        Document responseBaseObject = xHelpers.getXMLObjectFromString(responseXmlString);
        Map<CougarMessageProtocolRequestTypeEnum, Object> builtExpectedResponse = cougarManager.convertResponseToRestTypes(responseBaseObject, callBean);
        switch (responseContentTypeEnum) {
        case XML:
          responseBean.setResponseObject(builtExpectedResponse.get(CougarMessageProtocolRequestTypeEnum.RESTXML));
          break;
        case JSON:
          responseBean.setResponseObject(builtExpectedResponse.get(CougarMessageProtocolRequestTypeEnum.RESTJSON));
          break;
        }
        responseBean.setHttpStatusCode(OK_STATUS_CODE);
        responseBean.setHttpStatusText("OK");
 
        expectedResponses.put(identifier + RESPONSE + i, responseBean);
      }
    }
View Full Code Here

     
     
      //Get actual responses
      loopCounter=0;
      for (HttpCallBean httpCallBean: httpCallBeans) {
        HttpResponseBean responseBean = httpCallBean.getResponseObjectsByEnum(CougarMessageProtocolResponseTypeEnum.REST);
        responseBean.setResponseHeaders(null);
        actualResponses.put(identifier + RESPONSE + loopCounter, responseBean);
        loopCounter++;
      }
     
      //Set the expected response time
      for (String keyString: expectedResponses.keySet()) {
        HttpResponseBean responseBean = expectedResponses.get(keyString);
        Timestamp requestTime = expectedRequestTimes.get(keyString);
        responseBean.setRequestTime(requestTime);
        responseBean.setResponseTime(requestTime);
      }
     
    }
View Full Code Here

        Document requestDocument = xHelpers.getXMLObjectFromString(requestXmlString);
        callBean.setRestPostQueryObjects(requestDocument);
        httpCallBeans.add(callBean);
       
        //Store expected responses
        HttpResponseBean responseBean = new HttpResponseBean();
        String responseXmlString = "<SimpleResponse><message>sum = " + i*2 + "</message></SimpleResponse>";
        Document responseBaseObject = xHelpers.getXMLObjectFromString(responseXmlString);
        Map<CougarMessageProtocolRequestTypeEnum, Object> builtExpectedResponse = cougarManager.convertResponseToRestTypes(responseBaseObject, callBean);
        switch (responseContentTypeEnum) {
        case XML:
          responseBean.setResponseObject(builtExpectedResponse.get(CougarMessageProtocolRequestTypeEnum.RESTXML));
          break;
        case JSON:
          responseBean.setResponseObject(builtExpectedResponse.get(CougarMessageProtocolRequestTypeEnum.RESTJSON));
          break;
        }
        responseBean.setHttpStatusCode(OK_STATUS_CODE);
        responseBean.setHttpStatusText("OK");
 
        expectedResponses.put(identifier + RESPONSE + i, responseBean);
      }
    }
View Full Code Here

     
     
      //Get actual responses
      loopCounter=0;
      for (HttpCallBean httpCallBean: httpCallBeans) {
        HttpResponseBean responseBean = httpCallBean.getResponseObjectsByEnum(CougarMessageProtocolResponseTypeEnum.REST);
        responseBean.setResponseHeaders(null);
        actualResponses.put(identifier + RESPONSE + loopCounter, responseBean);
        loopCounter++;
      }
     
      //Set the expected response time
      for (String keyString: expectedResponses.keySet()) {
        HttpResponseBean responseBean = expectedResponses.get(keyString);
        Timestamp requestTime = expectedRequestTimes.get(keyString);
        responseBean.setRequestTime(requestTime);
        responseBean.setResponseTime(requestTime);
      }
     
    }
View Full Code Here

     
     
      //Get actual responses
      loopCounter=0;
      for (HttpCallBean httpCallBean: httpCallBeans) {
        HttpResponseBean responseBean = httpCallBean.getResponseObjectsByEnum(CougarMessageProtocolResponseTypeEnum.RESTJSONJSON);
        responseBean.setResponseHeaders(null);
        Map<String,Object> responseMap = cougarHelpers.convertBatchedResponseToMap(responseBean);
        actualResponses.put(identifier + "Response " + loopCounter, responseMap);
        loopCounter++;
      }
     
View Full Code Here

      SOAPConnectionFactory connectionFactory = SOAPConnectionFactory
          .newInstance();
      SOAPConnection connection = connectionFactory.createConnection();

      // this can either be a SOAPException or SOAPMessage
      HttpResponseBean responseBean = new HttpResponseBean();
      Object response;

      String host = httpBean.getHost();
      String port = httpBean.getPort();
     
      String endPoint = "http://" + host + ":" + port + "/" + serviceName + "Service/" + version;

      try {
     
        response = connection.call(message, endPoint);

      } catch (SOAPException e) {
        response = e;
      } finally {
        connection.close();
      }

      responseBean.setResponseObject(handleResponse(response, responseBean));
   
      return responseBean;

    } catch (SOAPException | IOException | ParserConfigurationException | TransformerException e) {
      throw new RuntimeException(SOAP_CALL_TEXT + e, e);
View Full Code Here

    setJMXMBeanAttribute(mBeanName, attributeName, value);
  }
 
  private HttpResponseBean buildHttpResponseBean(HttpResponse httpResponse, String response, Date requestTime, Date responseTime) {
     
    HttpResponseBean httpResponseBean = new HttpResponseBean();
   
    Header[] headersArray = httpResponse.getAllHeaders();
    Map<String, String> headersMap = new HashMap<String, String>();
    for (Header header: headersArray) {
      String[] headerAttributes = header.toString().split(": ");
      headersMap.put(headerAttributes[0], headerAttributes[1].replace("\r\n", ""));
    }
    httpResponseBean.setResponseHeaders(headersMap);
   
        httpResponseBean.setHttpStatusCode(httpResponse.getStatusLine().getStatusCode());
        httpResponseBean.setHttpStatusText(httpResponse.getStatusLine().getReasonPhrase());

    httpResponseBean.setRequestTime(new Timestamp(requestTime.getTime()));
    httpResponseBean.setResponseTime(new Timestamp(responseTime.getTime()));

    if ((response != null) && (!response.equalsIgnoreCase(""))) {
      httpResponseBean.setResponseObject(response);
    } else {
      httpResponseBean.setResponseObject(null);
    }

    return httpResponseBean;
  }
View Full Code Here

TOP

Related Classes of com.betfair.testing.utils.cougar.beans.HttpResponseBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.