Пример #1
0
  // Method to convert batched JSON response to a map for comparison (as the order of the array of
  // responses cannot be relied upon)
  public Map<String, Object> convertBatchedResponseToMap(HttpResponseBean batchedResponse)
      throws JSONException {

    JSONObject json = (JSONObject) batchedResponse.getResponseObject();
    JSONArray results = null;
    try {
      results = (JSONArray) json.get("response");
    } catch (JSONException je) {
      logger.debug(String.valueOf(json), je);
      throw je;
    }

    Map<String, Object> responseMap = new HashMap<String, Object>();

    for (int i = 0; i < results.length(); i++) {
      String entryString = results.getString(i);
      int idStart = entryString.indexOf(':') + 1;
      int idEnd = entryString.indexOf(',');
      String id = entryString.substring(idStart, idEnd);
      id = id.replace("\"", "");

      responseMap.put("response" + id, entryString);
    }

    responseMap.put("httpStatusCode", batchedResponse.getHttpStatusCode() + "");
    responseMap.put("httpStatusText", batchedResponse.getHttpStatusText());
    responseMap.put("requestTime", batchedResponse.getRequestTime());
    responseMap.put("responseTime", batchedResponse.getResponseTime());

    return responseMap;
  }
    public void makeCalls() {
      // Make the calls
      int loopCounter = 0;
      for (HttpCallBean callBean : httpCallBeans) {
        Date time = new Date();
        expectedRequestTimes.put(
            identifier + RESPONSE + loopCounter, new Timestamp(time.getTime()));
        cougarManager.makeRestCougarHTTPCall(callBean, requestProtocolTypeEnum);
        loopCounter++;
      }

      // 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);
      }
    }
    public void buildCalls(CougarMessageContentTypeEnum responseContentTypeEnum) {

      for (int i = 0; i < numberOfRequests + 1; i++) {
        // Setup call beans
        HttpCallBean callBean = new HttpCallBean();
        callBean.setServiceName("baseline", "cougarBaseline");
        callBean.setVersion("v2");
        callBean.setOperationName("testParameterStylesQA");

        Map<String, String> headerParams = new HashMap<String, String>();
        headerParams.put("headerParam", "Foo");
        callBean.setHeaderParams(headerParams);

        Map<String, String> queryParams = new HashMap<String, String>();
        String queryParameter = "queryParameter-" + identifier + "-" + i;
        queryParams.put("queryParam", queryParameter);
        String dateQueryParameter = "2009-06-01T13:50:00.0Z";
        queryParams.put("dateQueryParam", dateQueryParameter);
        callBean.setQueryParams(queryParams);

        httpCallBeans.add(callBean);

        Map<String, String> acceptProtocols = new HashMap<String, String>();
        switch (responseContentTypeEnum) {
          case JSON:
            acceptProtocols.put("application/json", "");
            break;
          case XML:
            acceptProtocols.put("application/xml", "");
            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);
      }
    }
    public void buildCalls(CougarMessageContentTypeEnum responseContentTypeEnum) {

      for (int i = 0; i < numberOfRequests + 1; i++) {
        // Setup call beans
        HttpCallBean callBean = new HttpCallBean();
        callBean.setServiceName("baseline", "cougarBaseline");
        callBean.setVersion("v2");
        callBean.setOperationName("testComplexMutator", "complex");

        Map<String, String> acceptProtocols = new HashMap<String, String>();
        switch (responseContentTypeEnum) {
          case JSON:
            acceptProtocols.put("application/json", "");
            break;
          case XML:
            acceptProtocols.put("application/xml", "");
            break;
        }
        callBean.setAcceptProtocols(acceptProtocols);

        String requestXmlString = "";
        requestXmlString =
            "<message><name>sum</name><value1> "
                + i
                + "</value1><value2>"
                + i
                + "</value2></message>";
        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);
      }
    }
  @Test(dataProvider = "SchemaValidationEnabled")
  public void doTest(boolean schemaValidationEnabled) throws Exception {
    CougarHelpers helpers = new CougarHelpers();
    try {
      CougarManager cougarManager = CougarManager.getInstance();
      helpers.setSOAPSchemaValidationEnabled(schemaValidationEnabled);
      // Create the SOAP request as an XML Document (with a complex map parameter with complex entry
      // missing mandatory fields)
      XMLHelpers xMLHelpers1 = new XMLHelpers();
      Document createAsDocument1 =
          xMLHelpers1.getXMLObjectFromString(
              "<MapOfComplexOperationRequest><inputMap><entry key=\"aaa\"><ComplexObject/></entry></inputMap></MapOfComplexOperationRequest>");
      // Set up the Http Call Bean to make the request
      CougarManager cougarManager2 = CougarManager.getInstance();
      HttpCallBean getNewHttpCallBean5 = cougarManager2.getNewHttpCallBean("87.248.113.14");
      CougarManager cougarManager5 = cougarManager2;

      getNewHttpCallBean5.setServiceName("Baseline");

      getNewHttpCallBean5.setVersion("v2");
      // Set the created SOAP request as the PostObject
      getNewHttpCallBean5.setPostObjectForRequestType(createAsDocument1, "SOAP");
      // Get current time for getting log entries later

      Timestamp getTimeAsTimeStamp10 = new Timestamp(System.currentTimeMillis());
      // Make the SOAP call to the operation
      cougarManager5.makeSoapCougarHTTPCalls(getNewHttpCallBean5);
      // Create the expected response object as an XML document (fault)
      XMLHelpers xMLHelpers4 = new XMLHelpers();
      Document createAsDocument11 =
          xMLHelpers4.getXMLObjectFromString(
              "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>");
      // Convert the expected response to SOAP for comparison with the actual response
      Map<String, Object> convertResponseToSOAP12 =
          cougarManager5.convertResponseToSOAP(createAsDocument11, getNewHttpCallBean5);
      // Check the response is as expected
      HttpResponseBean response5 =
          getNewHttpCallBean5.getResponseObjectsByEnum(
              com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
      AssertionUtils.multiAssertEquals(
          convertResponseToSOAP12.get("SOAP"), response5.getResponseObject());

      // generalHelpers.pauseTest(2000L);
      // Check the log entries are as expected

      cougarManager5.verifyAccessLogEntriesAfterDate(
          getTimeAsTimeStamp10,
          new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest"));
    } finally {
      helpers.setSOAPSchemaValidationEnabled(true);
    }
  }
Пример #6
0
  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;
  }
Пример #7
0
  public Map<String, String> convertFaultObjectToMap(HttpResponseBean soapResp) {

    DocumentImpl doc = (DocumentImpl) soapResp.getResponseObject();

    String actualFaultCode =
        doc.getElementsByTagName("faultcode").item(0).getFirstChild().getNodeValue();
    String actualFaultString =
        doc.getElementsByTagName("faultstring").item(0).getFirstChild().getNodeValue();
    String actualMessage =
        doc.getElementsByTagName("message").item(0).getFirstChild().getNodeValue();
    Node actualTraceNode = doc.getElementsByTagName("trace").item(0).getFirstChild();
    String actualTrace = "";
    if (actualTraceNode != null) {
      actualTrace = actualTraceNode.getNodeValue();

      actualTrace =
          actualTrace.replace(
              "\r", ""); // Clean string of escaped characters (to avoid errors on Linux CI build)
      actualTrace = actualTrace.trim();
    }

    Map<String, String> responseMap = new HashMap<String, String>();
    responseMap.put("faultCode", actualFaultCode);
    responseMap.put("faultString", actualFaultString);
    responseMap.put("faultMessage", actualMessage);
    responseMap.put("faultTrace", actualTrace);

    return responseMap;
  }
  // ERROR:  'org.xml.sax.SAXParseException; cvc-complex-type.2.4.b: The content of element
  // 'bas:objects' is not complete. One of
  // '{"http://www.betfair.com/servicetypes/v2/Baseline/":ComplexObject}' is expected.'
  @Test
  public void doTest() throws Exception {
    // Create the SOAP request as an XML Document
    XMLHelpers xMLHelpers1 = new XMLHelpers();
    Document createAsDocument1 =
        xMLHelpers1.getXMLObjectFromString(
            "<TestLargePostRequest><largeRequest><size>2</size><objects><ComplexObject><value1>34</value1></ComplexObject></objects><oddOrEven>ODD</oddOrEven></largeRequest></TestLargePostRequest>");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14");
    cougarManager2 = cougarManager2;

    cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

    getNewHttpCallBean2.setServiceName("Baseline");

    getNewHttpCallBean2.setVersion("v2");
    // Set the created SOAP request as the PostObject
    getNewHttpCallBean2.setPostObjectForRequestType(createAsDocument1, "SOAP");
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp8 = new Timestamp(System.currentTimeMillis());
    // Make the SOAP call to the operation
    cougarManager2.makeSoapCougarHTTPCalls(getNewHttpCallBean2);
    // Create the expected response object as an XML document (A message stating if the number of
    // items in the list was correct)
    XMLHelpers xMLHelpers4 = new XMLHelpers();
    Document createAsDocument10 =
        xMLHelpers4.getXMLObjectFromString(
            "<response><message>There were 2 items specified in the list, 1 actually</message></response>");
    // Convert the expected response to SOAP for comparison with actual response
    Map<String, Object> convertResponseToSOAP11 =
        cougarManager2.convertResponseToSOAP(createAsDocument10, getNewHttpCallBean2);
    // Check the response is as expected
    HttpResponseBean response5 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
    AssertionUtils.multiAssertEquals(
        convertResponseToSOAP11.get("SOAP"), response5.getResponseObject());

    // generalHelpers.pauseTest(500L);
    // Check the log entries are as expected

    cougarManager2.verifyRequestLogEntriesAfterDate(
        getTimeAsTimeStamp8, new RequestLogRequirement("2.8", "testLargePost"));
  }
  @Test
  public void doTest() throws Exception {
    // Create the SOAP request as an XML Document (with a dateTimeSet parameter containing a date
    // with a time set to 24:00:00)
    XMLHelpers xMLHelpers1 = new XMLHelpers();
    Document createAsDocument1 =
        xMLHelpers1.getXMLObjectFromString(
            "<DateTimeSetOperationRequest><message><dateTimeSet><Date>2009-06-02T24:00:00.000Z</Date><Date>2009-06-03T24:00:00.000Z</Date></dateTimeSet></message></DateTimeSetOperationRequest>");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean hbean = cougarManager2.getNewHttpCallBean("87.248.113.14");
    CougarManager hinstance = cougarManager2;

    hbean.setServiceName("Baseline");

    hbean.setVersion("v2");
    // Set the created SOAP request as the PostObject
    hbean.setPostObjectForRequestType(createAsDocument1, "SOAP");
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis());
    // Make the SOAP call to the operation
    hinstance.makeSoapCougarHTTPCalls(hbean);
    // Create the expected response object as an XML document (fault)
    XMLHelpers xMLHelpers4 = new XMLHelpers();
    Document createAsDocument9 =
        xMLHelpers4.getXMLObjectFromString(
            "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0044</faultstring><detail/></soapenv:Fault>");
    // Convert the expected response to SOAP for comparison with actual response
    Map<String, Object> convertResponseToSOAP10 =
        hinstance.convertResponseToSOAP(createAsDocument9, hbean);
    // Check the response is as expected
    HttpResponseBean response5 =
        hbean.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
    AssertionUtils.multiAssertEquals(
        convertResponseToSOAP10.get("SOAP"), response5.getResponseObject());

    // generalHelpers.pauseTest(3000L);
    // Check the log entries are as expected

    CougarManager cougarManager8 = CougarManager.getInstance();
    cougarManager8.verifyAccessLogEntriesAfterDate(
        getTimeAsTimeStamp7,
        new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest"));
  }
  @Test
  public void doTest() throws Exception {
    // Create a soap request structure as a Document object
    XMLHelpers xMLHelpers1 = new XMLHelpers();
    Document requestDocument =
        xMLHelpers1.getXMLObjectFromString(
            "<I64SimpleTypeEchoRequest><msg>-9223372036854775809</msg></I64SimpleTypeEchoRequest>");
    // Get an HTTPCallBean
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean HTTPCallBean = cougarManager2.getNewHttpCallBean("87.248.113.14");
    CougarManager CougarManager = cougarManager2;
    // Get LogManager JMX Attribute
    // Set Cougar Fault Controller attributes
    CougarManager.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");
    // Set service name to call
    HTTPCallBean.setServiceName("Baseline");
    // Set service version to call
    HTTPCallBean.setVersion("v2");
    // Set post object and request type
    HTTPCallBean.setPostObjectForRequestType(requestDocument, "SOAP");
    // Get current time

    Timestamp timestamp = new Timestamp(System.currentTimeMillis());
    // Make Cougar SOAP call
    CougarManager.makeSoapCougarHTTPCalls(HTTPCallBean);
    // Create a soap response structure as a Document object
    XMLHelpers xMLHelpers4 = new XMLHelpers();
    Document responseDocument =
        xMLHelpers4.getXMLObjectFromString(
            "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0006</faultstring><detail/></soapenv:Fault>");
    // Convert the Document to SOAP
    Map<String, Object> response5 =
        CougarManager.convertResponseToSOAP(responseDocument, HTTPCallBean);
    Object responseSoap = response5.get("SOAP");
    // Get the actual SOAP response and compare it to the expected response
    HttpResponseBean response6 =
        HTTPCallBean.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
    AssertionUtils.multiAssertEquals(responseSoap, response6.getResponseObject());
    // Pause test
    // generalHelpers.pauseTest(500L);
    // Get access log entries after the time recorded earlier in the test
    CougarManager.verifyAccessLogEntriesAfterDate(
        timestamp, new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest"));
  }
  @Test
  public void doTest() throws Exception {
    // Create the SOAP request as an XML Document (with a missing mandatory parameter)
    XMLHelpers xMLHelpers1 = new XMLHelpers();
    Document createAsDocument1 =
        xMLHelpers1.getXMLObjectFromString(
            "<VoidResponseOperationRequest></VoidResponseOperationRequest>");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14");
    cougarManager2 = cougarManager2;

    cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

    getNewHttpCallBean2.setServiceName("Baseline");

    getNewHttpCallBean2.setVersion("v2");
    // Set the created SOAP request as the PostObject
    getNewHttpCallBean2.setPostObjectForRequestType(createAsDocument1, "SOAP");
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp8 = new Timestamp(System.currentTimeMillis());
    // Make the SOAP call to the operation
    cougarManager2.makeSoapCougarHTTPCalls(getNewHttpCallBean2);
    // Create the expected response object as an XML document (fault)
    XMLHelpers xMLHelpers4 = new XMLHelpers();
    Document createAsDocument10 =
        xMLHelpers4.getXMLObjectFromString(
            "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>");
    // Convert the expected response to SOAP for comparison with actual response
    Map<String, Object> convertResponseToSOAP11 =
        cougarManager2.convertResponseToSOAP(createAsDocument10, getNewHttpCallBean2);
    // Check the responses are as expected (fault)
    HttpResponseBean response5 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
    AssertionUtils.multiAssertEquals(
        convertResponseToSOAP11.get("SOAP"), response5.getResponseObject());
    // Check the log entries are as expected

    CougarManager cougarManager7 = CougarManager.getInstance();
    cougarManager7.verifyAccessLogEntriesAfterDate(
        getTimeAsTimeStamp8,
        new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest"));
  }
  @Test
  public void doTest() throws Exception {
    // Create the SOAP request as an XML Document (with byte parameters)
    XMLHelpers xMLHelpers1 = new XMLHelpers();
    Document createAsDocument1 =
        xMLHelpers1.getXMLObjectFromString(
            "<ByteOperationRequest><headerParam>0</headerParam><queryParam>0</queryParam><message><bodyParameter>AAAA</bodyParameter></message></ByteOperationRequest>");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean hbean = cougarManager2.getNewHttpCallBean("87.248.113.14");
    CougarManager hinstance = cougarManager2;

    hbean.setServiceName("Baseline");

    hbean.setVersion("v2");
    // Set the created SOAP request as the PostObject
    hbean.setPostObjectForRequestType(createAsDocument1, "SOAP");
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis());
    // Make the SOAP call to the operation
    hinstance.makeSoapCougarHTTPCalls(hbean);
    // Create the expected response object as an XML document
    XMLHelpers xMLHelpers4 = new XMLHelpers();
    Document createAsDocument9 =
        xMLHelpers4.getXMLObjectFromString(
            "<response><queryParameter>0</queryParameter><headerParameter>0</headerParameter><bodyParameter>AAAA</bodyParameter></response>");
    // Convert the expected response to SOAP for comparison with actual response
    Map<String, Object> convertResponseToSOAP10 =
        hinstance.convertResponseToSOAP(createAsDocument9, hbean);
    // Check the response is as expected
    HttpResponseBean response5 =
        hbean.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
    AssertionUtils.multiAssertEquals(
        convertResponseToSOAP10.get("SOAP"), response5.getResponseObject());

    // generalHelpers.pauseTest(500L);
    // Check the log entries are as expected

    hinstance.verifyRequestLogEntriesAfterDate(
        getTimeAsTimeStamp7, new RequestLogRequirement("2.8", "byteOperation"));
  }
Пример #13
0
  /*
   * Send a request to a locally running Cougar container via SOAP as per the
   * passed parameters.
   *
   * @param message
   * @param serviceName
   * @param version
   * @param httpBean
   * @return
   */
  public HttpResponseBean makeCougarSOAPCall(
      SOAPMessage message, String serviceName, String version, HttpCallBean httpBean) {
    try {

      // Debugging code
      ByteArrayOutputStream outStream = new ByteArrayOutputStream();
      message.writeTo(outStream);
      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);
    }
  }
Пример #14
0
  /*
   * ???
   *
   * @param response
   * @param responseBean
   * @throws DOMException
   * @throws SOAPException
   */
  private void extractHeaderDataSOAP(SOAPMessage response, HttpResponseBean responseBean)
      throws SOAPException {
    // extract MimeHeaders
    MimeHeaders mime = response.getMimeHeaders();
    Iterator<MimeHeader> iter = mime.getAllHeaders();

    while (iter.hasNext()) {
      MimeHeader mimeH = iter.next();
      responseBean.addEntryToResponseHeaders(mimeH.getName(), mimeH.getValue());
    }

    // extract SOAPHeaders from the envelope and a them to the mimeHeaders
    if (response.getSOAPHeader() != null) {
      javax.xml.soap.SOAPHeader header = response.getSOAPHeader();

      NodeList nodes = header.getChildNodes();

      for (int x = 0; x < nodes.getLength(); x++) {
        // if the header entry contains child nodes - write them with the node names
        if (nodes.item(x).hasChildNodes()) {
          NodeList childnodes = nodes.item(x).getChildNodes();
          StringBuilder buff = new StringBuilder();
          for (int y = 0; y < childnodes.getLength(); y++) {
            if (!"".equals(buff.toString())) {
              buff.append(" ");
            }
            buff.append(childnodes.item(y).getLocalName()).append(":");
            buff.append(childnodes.item(y).getTextContent());
          }
          responseBean.addEntryToResponseHeaders(nodes.item(x).getLocalName(), buff.toString());
        } else {
          responseBean.addEntryToResponseHeaders(
              nodes.item(x).getLocalName(), nodes.item(x).getTextContent());
        }
      }
    }
  }
  @Test
  public void doTest() throws Exception {

    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean("87.248.113.14");
    cougarManager1 = cougarManager1;

    getNewHttpCallBean1.setOperationName("i32MapSimpleTypeEcho", "i32MapEcho");

    getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean1.setVersion("v2");

    Map map2 = new HashMap();
    map2.put("RESTJSON", "           {\"msg\": \n           {\"1\": 11, \n            \"2\": 22}}");
    getNewHttpCallBean1.setPostQueryObjects(map2);

    Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis());

    cougarManager1.makeRestCougarHTTPCall(
        getNewHttpCallBean1,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);

    cougarManager1.makeRestCougarHTTPCall(
        getNewHttpCallBean1,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.JSON);

    XMLHelpers xMLHelpers4 = new XMLHelpers();
    Document createAsDocument10 =
        xMLHelpers4.getXMLObjectFromString(
            "<I32MapSimpleTypeEchoResponse><entry key=\"1\"><Integer>11</Integer></entry><entry key=\"2\"><Integer>22</Integer></entry></I32MapSimpleTypeEchoResponse>");

    JSONHelpers jSONHelpers5 = new JSONHelpers();
    JSONObject createAsJSONObject11 =
        jSONHelpers5.createAsJSONObject(new JSONObject("{\"1\": 11,\"2\": 22}"));

    HttpResponseBean response6 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONXML);
    AssertionUtils.multiAssertEquals(createAsDocument10, response6.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response6.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response6.getHttpStatusText());

    HttpResponseBean response7 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONJSON);
    AssertionUtils.multiAssertEquals(createAsJSONObject11, response7.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response7.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response7.getHttpStatusText());

    // generalHelpers.pauseTest(500L);

    cougarManager1.verifyRequestLogEntriesAfterDate(
        getTimeAsTimeStamp7,
        new RequestLogRequirement("2.8", "i32MapSimpleTypeEcho"),
        new RequestLogRequirement("2.8", "i32MapSimpleTypeEcho"));
  }
  @Test
  public void v3() throws Exception {
    // Set up the Http Call Bean to make the baseline service request
    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean();
    try {
      getNewHttpCallBean1.setOperationName("setHealthStatusInfo");

      getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");

      getNewHttpCallBean1.setVersion("v2");
      // Set the component statuses to be set (Including a FAIL status)
      getNewHttpCallBean1.setRestPostQueryObjects(
          DocumentBuilderFactory.newInstance()
              .newDocumentBuilder()
              .parse(
                  new ByteArrayInputStream(
                      "<message><initialiseHealthStatusObject>true</initialiseHealthStatusObject><serviceStatusDetail>FAIL</serviceStatusDetail><DBConnectionStatusDetail>WARN</DBConnectionStatusDetail><cacheAccessStatusDetail>OK</cacheAccessStatusDetail></message>"
                          .getBytes())));
      // Make the REST call to the set the health statuses
      cougarManager1.makeRestCougarHTTPCall(
          getNewHttpCallBean1,
          com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML,
          com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);
      // Set up the Http Call Bean to make the healthcheck service request
      HttpCallBean getNewHttpCallBean7 = cougarManager1.getNewHttpCallBean();

      getNewHttpCallBean7.setOperationName("getDetailedHealthStatus", "detailed");

      getNewHttpCallBean7.setServiceName("healthcheck");

      getNewHttpCallBean7.setVersion("v3");

      getNewHttpCallBean7.setNameSpaceServiceName("Health");
      // Make the REST call to the get the health statuses from the health service
      cougarManager1.makeRestCougarHTTPCall(
          getNewHttpCallBean7,
          com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML,
          com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);
      // Get the xml response and grab all the HealthDetail entries
      HttpResponseBean response3 =
          getNewHttpCallBean7.getResponseObjectsByEnum(
              com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                  .RESTXMLXML);
      Document xmlResponse = (Document) response3.getResponseObject();
      AssertionUtils.multiAssertEquals((int) 200, response3.getHttpStatusCode());
      AssertionUtils.multiAssertEquals("OK", response3.getHttpStatusText());

      NodeList nodeList = xmlResponse.getElementsByTagName("HealthDetailResponse");
      Node healthDetailResponseNode = nodeList.item(0);
      // Get the HealthDetail entry for the Baseline service version 2.8
      XMLHelpers metaDataService = new XMLHelpers();
      // Get the subComponentList from the HealthDetail entry for Baseline
      Node baselineSubComponentList =
          metaDataService.getSpecifiedChildNode(healthDetailResponseNode, "subComponentList");
      // Get the Cache entry from the subComponentList and check the value of the status field is OK
      Node baselineCacheComponent =
          metaDataService.getNodeContainingSpecifiedChildNodeFromParent(
              baselineSubComponentList, "name", "Cache1");
      String status = metaDataService.getTextContentFromChildNode(baselineCacheComponent, "status");
      AssertionUtils.multiAssertEquals("OK", status);
      // Get the Service entry from the subComponentList and check the value of the status field is
      // FAIL
      Node baselineServiceComponent =
          metaDataService.getNodeContainingSpecifiedChildNodeFromParent(
              baselineSubComponentList, "name", "Service1");
      status = metaDataService.getTextContentFromChildNode(baselineServiceComponent, "status");
      AssertionUtils.multiAssertEquals("FAIL", status);
      // Get the DB entry from the subComponentList and check the value of the status field is WARN
      Node baselineDBComponent =
          metaDataService.getNodeContainingSpecifiedChildNodeFromParent(
              baselineSubComponentList, "name", "DB1");
      status = metaDataService.getTextContentFromChildNode(baselineDBComponent, "status");
      AssertionUtils.multiAssertEquals("WARN", status);
      // Get the health entry from the xml response and check the value is FAIL
      AssertionUtils.multiAssertEquals(
          "FAIL", metaDataService.getTextContentFromChildNode(healthDetailResponseNode, "health"));
    } finally {
      getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean();
      getNewHttpCallBean1.setOperationName("setHealthStatusInfo");

      getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");

      getNewHttpCallBean1.setVersion("v2");
      // Set the component statuses to be set (Including a FAIL status)
      getNewHttpCallBean1.setRestPostQueryObjects(
          DocumentBuilderFactory.newInstance()
              .newDocumentBuilder()
              .parse(
                  new ByteArrayInputStream(
                      "<message><initialiseHealthStatusObject>true</initialiseHealthStatusObject><serviceStatusDetail>OK</serviceStatusDetail><DBConnectionStatusDetail>WARN</DBConnectionStatusDetail><cacheAccessStatusDetail>OK</cacheAccessStatusDetail></message>"
                          .getBytes())));
      // Make the REST call to the set the health statuses
      cougarManager1.makeRestCougarHTTPCall(
          getNewHttpCallBean1,
          com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML,
          com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);
    }
  }
  @Test(dataProvider = "SchemaValidationEnabled")
  public void doTest(boolean schemaValidationEnabled) throws Exception {
    CougarHelpers helpers = new CougarHelpers();
    try {
      CougarManager cougarManager = CougarManager.getInstance();
      helpers.setSOAPSchemaValidationEnabled(schemaValidationEnabled);
      // Create the HttpCallBean
      CougarManager cougarManager1 = CougarManager.getInstance();
      HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean();
      CougarManager cougarManagerBaseline = cougarManager1;
      // Get the cougar logging attribute for getting log entries later
      // Point the created HttpCallBean at the correct service
      httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline");

      httpCallBeanBaseline.setVersion("v2");
      // Create the SOAP request as an XML Document (with a missing mandatory boolean parameter)
      XMLHelpers xMLHelpers2 = new XMLHelpers();
      Document createAsDocument2 =
          xMLHelpers2.getXMLObjectFromString(
              "<BoolOperationRequest><headerParam>true</headerParam><message><bodyParameter>true</bodyParameter></message></BoolOperationRequest>");
      // Set up the Http Call Bean to make the request
      CougarManager cougarManager3 = CougarManager.getInstance();
      HttpCallBean getNewHttpCallBean3 = cougarManager3.getNewHttpCallBean("87.248.113.14");
      cougarManager3 = cougarManager3;

      cougarManager3.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

      getNewHttpCallBean3.setServiceName("Baseline");

      getNewHttpCallBean3.setVersion("v2");
      // Set the created SOAP request as the PostObject
      getNewHttpCallBean3.setPostObjectForRequestType(createAsDocument2, "SOAP");
      // Get current time for getting log entries later

      Timestamp getTimeAsTimeStamp9 = new Timestamp(System.currentTimeMillis());
      // Make the SOAP call to the operation
      cougarManager3.makeSoapCougarHTTPCalls(getNewHttpCallBean3);
      // Create the expected response object as an XML document (fault)
      XMLHelpers xMLHelpers5 = new XMLHelpers();
      Document createAsDocument11 =
          xMLHelpers5.getXMLObjectFromString(
              "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>");

      // Check the response is as expected
      HttpResponseBean response6 =
          getNewHttpCallBean3.getResponseObjectsByEnum(
              com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
      AssertionUtils.multiAssertEquals(createAsDocument11, response6.getResponseObject());

      // generalHelpers.pauseTest(500L);
      // Check the log entries are as expected

      CougarHelpers cougarHelpers10 = new CougarHelpers();
      String JavaVersion = cougarHelpers10.getJavaVersion();

      CougarManager cougarManager11 = CougarManager.getInstance();
      cougarManager11.verifyAccessLogEntriesAfterDate(
          getTimeAsTimeStamp9,
          new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest"));
    } finally {
      helpers.setSOAPSchemaValidationEnabled(true);
    }
  }
  @Test
  public void doTest() throws Exception {
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean("87.248.113.14");
    cougarManager1 = cougarManager1;

    getNewHttpCallBean1.setOperationName("testParameterStylesQA");

    getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean1.setVersion("v2");

    Map map2 = new HashMap();
    map2.put("HeaderParam", "Foo");
    getNewHttpCallBean1.setHeaderParams(map2);
    // Set the query parameter to a string containing encoded :
    Map map3 = new HashMap();
    map3.put("queryParam", "colon%3A");
    map3.put("dateQueryParam", "2009-06-01T13:50:00.0Z");
    getNewHttpCallBean1.setQueryParams(map3);

    CougarHelpers cougarHelpers4 = new CougarHelpers();
    Date convertedDate1 = cougarHelpers4.convertToSystemTimeZone("2009-06-01T13:50:00.0Z");
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp8 = new Timestamp(System.currentTimeMillis());
    // Make the 4 REST calls to the operation
    cougarManager1.makeRestCougarHTTPCalls(getNewHttpCallBean1);
    // Create the expected response as an XML document
    XMLHelpers xMLHelpers6 = new XMLHelpers();
    Document createAsDocument10 =
        xMLHelpers6.createAsDocument(
            DocumentBuilderFactory.newInstance()
                .newDocumentBuilder()
                .parse(
                    new ByteArrayInputStream(
                        ("<SimpleResponse><message>headerParam=Foo,queryParam=colon:,dateQueryParam="
                                + cougarHelpers4.dateInUTC(convertedDate1)
                                + "</message></SimpleResponse>")
                            .getBytes())));
    // Convert the expected response to REST types for comparison with actual responses
    Map<CougarMessageProtocolRequestTypeEnum, Object> convertResponseToRestTypes11 =
        cougarManager1.convertResponseToRestTypes(createAsDocument10, getNewHttpCallBean1);
    // Check the 4 responses are as expected
    HttpResponseBean response7 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLXML);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes11.get(CougarMessageProtocolRequestTypeEnum.RESTXML),
        response7.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response7.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response7.getHttpStatusText());

    HttpResponseBean response8 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONJSON);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes11.get(CougarMessageProtocolRequestTypeEnum.RESTJSON),
        response8.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response8.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response8.getHttpStatusText());

    HttpResponseBean response9 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLJSON);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes11.get(CougarMessageProtocolRequestTypeEnum.RESTJSON),
        response9.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response9.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response9.getHttpStatusText());

    HttpResponseBean response10 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONXML);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes11.get(CougarMessageProtocolRequestTypeEnum.RESTXML),
        response10.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response10.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response10.getHttpStatusText());

    // generalHelpers.pauseTest(500L);
    // Check the log entries are as expected

    cougarManager1.verifyRequestLogEntriesAfterDate(
        getTimeAsTimeStamp8,
        new RequestLogRequirement("2.8", "testParameterStylesQA"),
        new RequestLogRequirement("2.8", "testParameterStylesQA"),
        new RequestLogRequirement("2.8", "testParameterStylesQA"),
        new RequestLogRequirement("2.8", "testParameterStylesQA"));
  }
  @Test(dataProvider = "SchemaValidationEnabled")
  public void doTest(boolean schemaValidationEnabled) throws Exception {
    CougarHelpers helpers = new CougarHelpers();
    try {
      CougarManager cougarManager = CougarManager.getInstance();
      helpers.setJMXMBeanAttributeValue(
          "com.betfair.cougar.transport:type=soapCommandProcessor",
          "SchemaValidationEnabled",
          schemaValidationEnabled);
      // Create the HttpCallBean
      CougarManager cougarManager1 = CougarManager.getInstance();
      HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean();
      CougarManager cougarManagerBaseline = cougarManager1;
      // Get the cougar logging attribute for getting log entries later
      // Point the created HttpCallBean at the correct service
      httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline");

      httpCallBeanBaseline.setVersion("v2");
      // Create the SOAP request as an XML Document (with missing required query parameter)
      XMLHelpers xMLHelpers2 = new XMLHelpers();
      Document createAsDocument2 =
          xMLHelpers2.getXMLObjectFromString(
              "<TestParameterStylesRequest><HeaderParam>Foo</HeaderParam></TestParameterStylesRequest>");
      // Set up the Http Call Bean to make the request
      CougarManager cougarManager3 = CougarManager.getInstance();
      HttpCallBean getNewHttpCallBean3 = cougarManager3.getNewHttpCallBean();
      cougarManager3 = cougarManager3;

      cougarManager3.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

      getNewHttpCallBean3.setServiceName("Baseline");

      getNewHttpCallBean3.setVersion("v2");
      // Set the created SOAP request as the PostObject
      getNewHttpCallBean3.setPostObjectForRequestType(createAsDocument2, "SOAP");
      // Get current time for getting log entries later

      Timestamp getTimeAsTimeStamp9 = new Timestamp(System.currentTimeMillis());
      // Make the SOAP call to the operation
      cougarManager3.makeSoapCougarHTTPCalls(getNewHttpCallBean3);
      // Create the expected response object as an XML document
      XMLHelpers xMLHelpers5 = new XMLHelpers();
      Document createAsDocument11 =
          xMLHelpers5.getXMLObjectFromString(
              "<soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>DSC-0018</faultstring><detail/></soapenv:Fault>");
      // Convert the expected response to SOAP for comparison with the actual response
      Map<String, Object> convertResponseToSOAP12 =
          cougarManager3.convertResponseToSOAP(createAsDocument11, getNewHttpCallBean3);
      // Check the response is as expected
      HttpResponseBean response6 =
          getNewHttpCallBean3.getResponseObjectsByEnum(
              com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.SOAP);
      AssertionUtils.multiAssertEquals(
          convertResponseToSOAP12.get("SOAP"), response6.getResponseObject());
      // Check the log entries are as expected

      CougarHelpers cougarHelpers8 = new CougarHelpers();
      String JavaVersion = cougarHelpers8.getJavaVersion();

      CougarManager cougarManager9 = CougarManager.getInstance();
      cougarManager9.verifyAccessLogEntriesAfterDate(
          getTimeAsTimeStamp9,
          new AccessLogRequirement("87.248.113.14", "/BaselineService/v2", "BadRequest"));
    } finally {
      helpers.setJMXMBeanAttributeValue(
          "com.betfair.cougar.transport:type=soapCommandProcessor",
          "SchemaValidationEnabled",
          true);
    }
  }
  @Test
  public void doTest() throws Exception {
    // Create the HttpCallBean
    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean();
    CougarManager cougarManagerBaseline = cougarManager1;
    // Get the cougar logging attribute for getting log entries later
    // Point the created HttpCallBean at the correct service
    httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline");

    httpCallBeanBaseline.setVersion("v2");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14");
    cougarManager2 = cougarManager2;

    cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

    getNewHttpCallBean2.setOperationName("floatOperation");

    getNewHttpCallBean2.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean2.setVersion("v2");

    Map map3 = new HashMap();
    map3.put("HeaderParam", "5.43");
    getNewHttpCallBean2.setHeaderParams(map3);

    Map map4 = new HashMap();
    map4.put("queryParam", "3455.54");
    getNewHttpCallBean2.setQueryParams(map4);
    // Set the Float body parameter as a non Float
    getNewHttpCallBean2.setRestPostQueryObjects(
        DocumentBuilderFactory.newInstance()
            .newDocumentBuilder()
            .parse(
                new ByteArrayInputStream(
                    "<message><bodyParameter>dfdsfsf</bodyParameter></message>".getBytes())));
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp11 = new Timestamp(System.currentTimeMillis());
    // Make the 4 REST calls to the operation
    cougarManager2.makeRestCougarHTTPCalls(getNewHttpCallBean2);
    // Create the expected response to XML requests as an XML document (XML Fault)
    XMLHelpers xMLHelpers6 = new XMLHelpers();
    Document createAsDocument13 =
        xMLHelpers6.getXMLObjectFromString(
            "<fault><faultcode>Client</faultcode><faultstring>DSC-0044</faultstring><detail/></fault>");
    // Create the expected response to JSON requests as an XML document (JSON Fault)
    XMLHelpers xMLHelpers7 = new XMLHelpers();
    Document createAsDocument14 =
        xMLHelpers7.getXMLObjectFromString(
            "<fault><faultcode>Client</faultcode><faultstring>DSC-0044</faultstring><detail/></fault>");
    // Convert expected response to XML requests to JSON object
    JSONHelpers jSONHelpers8 = new JSONHelpers();
    JSONObject convertXMLDocumentToJSONObjectRemoveRootElement15 =
        jSONHelpers8.convertXMLDocumentToJSONObjectRemoveRootElement(createAsDocument13);
    // Convert expected response to JSON requests to JSON object
    JSONHelpers jSONHelpers9 = new JSONHelpers();
    JSONObject convertXMLDocumentToJSONObjectRemoveRootElement16 =
        jSONHelpers9.convertXMLDocumentToJSONObjectRemoveRootElement(createAsDocument14);
    // Check the 4 responses are as expected (Bad Request)
    HttpResponseBean response10 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLXML);
    AssertionUtils.multiAssertEquals(createAsDocument13, response10.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response10.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response10.getHttpStatusText());

    HttpResponseBean response11 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONJSON);
    AssertionUtils.multiAssertEquals(
        convertXMLDocumentToJSONObjectRemoveRootElement16, response11.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response11.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response11.getHttpStatusText());

    HttpResponseBean response12 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLJSON);
    AssertionUtils.multiAssertEquals(
        convertXMLDocumentToJSONObjectRemoveRootElement15, response12.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response12.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response12.getHttpStatusText());

    HttpResponseBean response13 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONXML);
    AssertionUtils.multiAssertEquals(createAsDocument14, response13.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response13.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response13.getHttpStatusText());
    // Check the log entries are as expected

    CougarManager cougarManager15 = CougarManager.getInstance();
    cougarManager15.verifyAccessLogEntriesAfterDate(
        getTimeAsTimeStamp11,
        new AccessLogRequirement(
            "87.248.113.14", "/cougarBaseline/v2/floatOperation", "BadRequest"),
        new AccessLogRequirement(
            "87.248.113.14", "/cougarBaseline/v2/floatOperation", "BadRequest"),
        new AccessLogRequirement(
            "87.248.113.14", "/cougarBaseline/v2/floatOperation", "BadRequest"),
        new AccessLogRequirement(
            "87.248.113.14", "/cougarBaseline/v2/floatOperation", "BadRequest"));
  }
  @Test
  public void doTest() throws Exception {
    // Create the HttpCallBean
    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean();
    CougarManager cougarManagerBaseline = cougarManager1;
    // Get the cougar logging attribute for getting log entries later
    // Point the created HttpCallBean at the correct service
    httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline");

    httpCallBeanBaseline.setVersion("v2");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14");
    cougarManager2 = cougarManager2;

    cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

    getNewHttpCallBean2.setOperationName("i32Operation");

    getNewHttpCallBean2.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean2.setVersion("v2");
    // Set the Integer header parameter to an out of range Integer
    Map map3 = new HashMap();
    map3.put("HeaderParam", "21474836470");
    getNewHttpCallBean2.setHeaderParams(map3);

    Map map4 = new HashMap();
    map4.put("queryParam", "43523434");
    getNewHttpCallBean2.setQueryParams(map4);

    getNewHttpCallBean2.setRestPostQueryObjects(
        DocumentBuilderFactory.newInstance()
            .newDocumentBuilder()
            .parse(
                new ByteArrayInputStream(
                    "<message><bodyParameter>-50</bodyParameter></message>".getBytes())));
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp11 = new Timestamp(System.currentTimeMillis());
    // Make the 4 REST calls to the operation
    cougarManager2.makeRestCougarHTTPCalls(getNewHttpCallBean2);
    // Create the expected response as an XML document (Fault)
    XMLHelpers xMLHelpers6 = new XMLHelpers();
    Document createAsDocument13 =
        xMLHelpers6.getXMLObjectFromString(
            "<fault><faultcode>Client</faultcode><faultstring>DSC-0009</faultstring><detail/></fault>");
    // Convert the expected response to REST types for comparison with actual responses
    Map<CougarMessageProtocolRequestTypeEnum, Object> convertResponseToRestTypes14 =
        cougarManager2.convertResponseToRestTypes(createAsDocument13, getNewHttpCallBean2);
    // Check the 4 responses are as expected (Bad Request)
    HttpResponseBean response7 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLXML);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes14.get(CougarMessageProtocolRequestTypeEnum.RESTXML),
        response7.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response7.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response7.getHttpStatusText());

    HttpResponseBean response8 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONJSON);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes14.get(CougarMessageProtocolRequestTypeEnum.RESTJSON),
        response8.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response8.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response8.getHttpStatusText());

    HttpResponseBean response9 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLJSON);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes14.get(CougarMessageProtocolRequestTypeEnum.RESTJSON),
        response9.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response9.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response9.getHttpStatusText());

    HttpResponseBean response10 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONXML);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes14.get(CougarMessageProtocolRequestTypeEnum.RESTXML),
        response10.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response10.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response10.getHttpStatusText());
    // Check the log entries are as expected

    CougarManager cougarManager12 = CougarManager.getInstance();
    cougarManager12.verifyAccessLogEntriesAfterDate(
        getTimeAsTimeStamp11,
        new AccessLogRequirement("87.248.113.14", "/cougarBaseline/v2/i32Operation", "BadRequest"),
        new AccessLogRequirement("87.248.113.14", "/cougarBaseline/v2/i32Operation", "BadRequest"),
        new AccessLogRequirement("87.248.113.14", "/cougarBaseline/v2/i32Operation", "BadRequest"),
        new AccessLogRequirement("87.248.113.14", "/cougarBaseline/v2/i32Operation", "BadRequest"));
  }
  @Test
  public void doTest() throws Exception {
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean("87.248.113.14");
    cougarManager1 = cougarManager1;

    getNewHttpCallBean1.setOperationName("complexMapOperation");

    getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean1.setVersion("v2");
    // Instruct cougar to use a delegate to populate the complex response object
    getNewHttpCallBean1.setRestPostQueryObjects(
        DocumentBuilderFactory.newInstance()
            .newDocumentBuilder()
            .parse(
                new ByteArrayInputStream(
                    "<message><complexMap><entry key=\"DELEGATE\"><SomeComplexObject/></entry></complexMap></message>"
                        .getBytes())));
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis());
    // Make the XML call to the operation with XML response type
    cougarManager1.makeRestCougarHTTPCall(
        getNewHttpCallBean1,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);
    // Make the XML call to the operation with JSON response type
    cougarManager1.makeRestCougarHTTPCall(
        getNewHttpCallBean1,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.JSON);
    // Create date object expected to be received in response object

    String date =
        TimingHelpers.convertUTCDateTimeToCougarFormat(
            (int) 1970, (int) 1, (int) 1, (int) 0, (int) 1, (int) 52, (int) 233);
    // Create the expected response as an XML document (using date just created)
    XMLHelpers xMLHelpers4 = new XMLHelpers();
    Document expectedResponseXML =
        xMLHelpers4.createAsDocument(
            DocumentBuilderFactory.newInstance()
                .newDocumentBuilder()
                .parse(
                    new ByteArrayInputStream(
                        ("<ComplexMapOperationResponse><ComplexMapOperationResponseObject><responseMap><entry key=\"object1\"><SomeComplexObject><dateTimeParameter>"
                                + date
                                + "</dateTimeParameter><listParameter><String>item1</String><String>item2</String></listParameter><enumParameter>BAR</enumParameter><stringParameter>delegate1</stringParameter></SomeComplexObject></entry><entry key=\"object2\"><SomeComplexObject><dateTimeParameter>"
                                + date
                                + "</dateTimeParameter><listParameter><String>item1</String><String>item2</String></listParameter><enumParameter>BAR</enumParameter><stringParameter>delegate2</stringParameter></SomeComplexObject></entry><entry key=\"object3\"><SomeComplexObject><dateTimeParameter>"
                                + date
                                + "</dateTimeParameter><listParameter><String>item1</String><String>item2</String></listParameter><enumParameter>BAR</enumParameter><stringParameter>delegate3</stringParameter></SomeComplexObject></entry></responseMap></ComplexMapOperationResponseObject></ComplexMapOperationResponse>")
                            .getBytes())));
    // Create the expected response as an JSON document (using date just created)
    JSONHelpers jSONHelpers5 = new JSONHelpers();
    JSONObject expectedResponseJSON =
        jSONHelpers5.createAsJSONObject(
            new JSONObject(
                "{responseMap:{object1:{dateTimeParameter:\""
                    + date
                    + "\",listParameter:[item1,item2],enumParameter:\"BAR\",stringParameter:\"delegate1\"},object2:{dateTimeParameter:\""
                    + date
                    + "\",listParameter:[item1,item2],enumParameter:\"BAR\",stringParameter:\"delegate2\"},object3:{dateTimeParameter:\""
                    + date
                    + "\",listParameter:[item1,item2],enumParameter:\"BAR\",stringParameter:\"delegate3\"}}}"));
    // Check the XML response is as expected
    HttpResponseBean response6 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLXML);
    AssertionUtils.multiAssertEquals(expectedResponseXML, response6.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response6.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response6.getHttpStatusText());
    // Check the JSON response is as expected
    HttpResponseBean response7 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLJSON);
    AssertionUtils.multiAssertEquals(expectedResponseJSON, response7.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response7.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response7.getHttpStatusText());

    // generalHelpers.pauseTest(500L);
    // Check the log entries are as expected

    cougarManager1.verifyRequestLogEntriesAfterDate(
        getTimeAsTimeStamp7,
        new RequestLogRequirement("2.8", "complexMapOperation"),
        new RequestLogRequirement("2.8", "complexMapOperation"));
  }
  @Test
  public void doTest() throws Exception {

    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean1 = cougarManager1.getNewHttpCallBean("87.248.113.14");
    cougarManager1 = cougarManager1;

    getNewHttpCallBean1.setOperationName("TestSimpleMapGet", "simpleMapGet");

    getNewHttpCallBean1.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean1.setVersion("v2");

    getNewHttpCallBean1.setRestPostQueryObjects(
        DocumentBuilderFactory.newInstance()
            .newDocumentBuilder()
            .parse(
                new ByteArrayInputStream(
                    "<inputMap><entry key=\"bbb\"><String>Value for bbb</String></entry><entry key=\"aaa\"><String>Value for aaa</String></entry><entry key=\"ddd\"></entry><entry key=\"ccc\"><String>Value for ccc</String></entry></inputMap>"
                        .getBytes())));

    Timestamp getTimeAsTimeStamp7 = new Timestamp(System.currentTimeMillis());

    cougarManager1.makeRestCougarHTTPCall(
        getNewHttpCallBean1,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);

    cougarManager1.makeRestCougarHTTPCall(
        getNewHttpCallBean1,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.JSON);

    XMLHelpers xMLHelpers3 = new XMLHelpers();
    Document createAsDocument10 =
        xMLHelpers3.getXMLObjectFromString(
            "<TestSimpleMapGetResponse><entry key=\"aaa\"><String>Value for aaa</String></entry><entry key=\"ddd\"></entry><entry key=\"ccc\"><String>Value for ccc</String></entry><entry key=\"bbb\"><String>Value for bbb</String></entry></TestSimpleMapGetResponse>");

    JSONHelpers jSONHelpers4 = new JSONHelpers();
    JSONObject createAsJSONObject11 =
        jSONHelpers4.createAsJSONObject(
            new JSONObject(
                "{\"aaa\": \"Value for aaa\",\"bbb\": \"Value for bbb\",\"ccc\": \"Value for ccc\",\"ddd\": null}"));

    HttpResponseBean response5 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLXML);
    AssertionUtils.multiAssertEquals(createAsDocument10, response5.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response5.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response5.getHttpStatusText());

    HttpResponseBean response6 =
        getNewHttpCallBean1.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTXMLJSON);
    AssertionUtils.multiAssertEquals(createAsJSONObject11, response6.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 200, response6.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("OK", response6.getHttpStatusText());

    // generalHelpers.pauseTest(500L);

    cougarManager1.verifyRequestLogEntriesAfterDate(
        getTimeAsTimeStamp7,
        new RequestLogRequirement("2.8", "testSimpleMapGet"),
        new RequestLogRequirement("2.8", "testSimpleMapGet"));
  }
  @Test
  public void doTest() throws Exception {
    // Create the HttpCallBean
    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean();
    CougarManager cougarManagerBaseline = cougarManager1;
    // Get the cougar logging attribute for getting log entries later
    // Point the created HttpCallBean at the correct service
    httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline");

    httpCallBeanBaseline.setVersion("v2");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14");
    cougarManager2 = cougarManager2;

    cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

    getNewHttpCallBean2.setOperationName("testComplexMutator", "complex");

    getNewHttpCallBean2.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean2.setVersion("v2");
    // Set the response protocols (with an unsupported protocol ranked highest)
    Map map3 = new HashMap();
    map3.put("application/text", "q=70");
    map3.put("application/image", "q=30");
    getNewHttpCallBean2.setAcceptProtocols(map3);

    getNewHttpCallBean2.setRestPostQueryObjects(
        DocumentBuilderFactory.newInstance()
            .newDocumentBuilder()
            .parse(
                new ByteArrayInputStream(
                    "<message><name>sum</name><value1>7</value1><value2>75</value2></message>"
                        .getBytes())));
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp10 = new Timestamp(System.currentTimeMillis());
    // Make the XML call to the operation
    cougarManager2.makeRestCougarHTTPCall(
        getNewHttpCallBean2,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTXML);
    // Create the expected response as an XML document
    XMLHelpers xMLHelpers5 = new XMLHelpers();
    Document createAsDocument12 =
        xMLHelpers5.getXMLObjectFromString(
            "<fault><faultcode>Client</faultcode><faultstring>DSC-0013</faultstring><detail/></fault>");
    // Convert the expected response to REST types
    Map<CougarMessageProtocolRequestTypeEnum, Object> convertResponseToRestTypes13 =
        cougarManager2.convertResponseToRestTypes(createAsDocument12, getNewHttpCallBean2);
    // Check the response is as expected (fault)
    HttpResponseBean getResponseObjectsByEnum14 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum.REST);
    AssertionUtils.multiAssertEquals(
        convertResponseToRestTypes13.get(CougarMessageProtocolRequestTypeEnum.RESTXML),
        getResponseObjectsByEnum14.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 406, getResponseObjectsByEnum14.getHttpStatusCode());
    AssertionUtils.multiAssertEquals(
        "Not Acceptable", getResponseObjectsByEnum14.getHttpStatusText());

    Map<String, String> map7 = getResponseObjectsByEnum14.getResponseHeaders();
    AssertionUtils.multiAssertEquals("application/xml", map7.get("Content-Type"));
    // Check the log entries are as expected

    cougarManagerBaseline.verifyAccessLogEntriesAfterDate(
        getTimeAsTimeStamp10,
        new AccessLogRequirement(
            "87.248.113.14", "/cougarBaseline/v2/complex", "MediaTypeNotAcceptable"));
  }
  @Test
  public void doTest() throws Exception {
    // Create the HttpCallBean
    CougarManager cougarManager1 = CougarManager.getInstance();
    HttpCallBean httpCallBeanBaseline = cougarManager1.getNewHttpCallBean();
    CougarManager cougarManagerBaseline = cougarManager1;
    // Get the cougar logging attribute for getting log entries later
    // Point the created HttpCallBean at the correct service
    httpCallBeanBaseline.setServiceName("baseline", "cougarBaseline");

    httpCallBeanBaseline.setVersion("v2");
    // Set up the Http Call Bean to make the request
    CougarManager cougarManager2 = CougarManager.getInstance();
    HttpCallBean getNewHttpCallBean2 = cougarManager2.getNewHttpCallBean("87.248.113.14");
    cougarManager2 = cougarManager2;

    cougarManager2.setCougarFaultControllerJMXMBeanAttrbiute("DetailedFaults", "false");

    getNewHttpCallBean2.setOperationName("simpleMapOperation");

    getNewHttpCallBean2.setServiceName("baseline", "cougarBaseline");

    getNewHttpCallBean2.setVersion("v2");
    // Set the body parameter to a map that contains a value with no corresponding key
    Map map3 = new HashMap();
    map3.put(
        "RESTJSON",
        "{\n    \"simpleMap\": {\n        \"bbb\": \"Value for bbb\",\n        \"aaa\": \"Value for aaa\",\n        \"ccc\": \"Value for ccc\",\n        \"value for not passed key\"\n    }\n}");
    getNewHttpCallBean2.setPostQueryObjects(map3);
    // Get current time for getting log entries later

    Timestamp getTimeAsTimeStamp9 = new Timestamp(System.currentTimeMillis());
    // Make REST JSON call to the operation requesting an XML response
    cougarManager2.makeRestCougarHTTPCall(
        getNewHttpCallBean2,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.XML);
    // Make REST JSON call to the operation requesting a JSON response
    cougarManager2.makeRestCougarHTTPCall(
        getNewHttpCallBean2,
        com.betfair.testing.utils.cougar.enums.CougarMessageProtocolRequestTypeEnum.RESTJSON,
        com.betfair.testing.utils.cougar.enums.CougarMessageContentTypeEnum.JSON);
    // Create the expected response as an XML document (Fault)
    XMLHelpers xMLHelpers5 = new XMLHelpers();
    Document createAsDocument12 =
        xMLHelpers5.getXMLObjectFromString(
            "<fault><faultcode>Client</faultcode><faultstring>DSC-0008</faultstring><detail/></fault>");
    // Convert expected response to a JSON object for comparison with JSON actual response
    JSONHelpers jSONHelpers6 = new JSONHelpers();
    JSONObject convertXMLDocumentToJSONObjectRemoveRootElement13 =
        jSONHelpers6.convertXMLDocumentToJSONObjectRemoveRootElement(createAsDocument12);
    // Check the 2 responses are as expected (Bad Request)
    HttpResponseBean response7 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONXML);
    AssertionUtils.multiAssertEquals(createAsDocument12, response7.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response7.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response7.getHttpStatusText());

    HttpResponseBean response8 =
        getNewHttpCallBean2.getResponseObjectsByEnum(
            com.betfair.testing.utils.cougar.enums.CougarMessageProtocolResponseTypeEnum
                .RESTJSONJSON);
    AssertionUtils.multiAssertEquals(
        convertXMLDocumentToJSONObjectRemoveRootElement13, response8.getResponseObject());
    AssertionUtils.multiAssertEquals((int) 400, response8.getHttpStatusCode());
    AssertionUtils.multiAssertEquals("Bad Request", response8.getHttpStatusText());

    // generalHelpers.pauseTest(500L);
    // Check the log entries are as expected

    CougarManager cougarManager11 = CougarManager.getInstance();
    cougarManager11.verifyAccessLogEntriesAfterDate(
        getTimeAsTimeStamp9,
        new AccessLogRequirement(
            "87.248.113.14", "/cougarBaseline/v2/simpleMapOperation", "BadRequest"),
        new AccessLogRequirement(
            "87.248.113.14", "/cougarBaseline/v2/simpleMapOperation", "BadRequest"));
  }