Class HTTPSClientUtils

java.lang.Object
org.wso2.am.integration.test.utils.http.HTTPSClientUtils

public class HTTPSClientUtils extends Object
This class is high level implementation for the HTTP client for Secure connection
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    doGet(String url, Map<String,String> headers)
    do HTTP GET operation for the given URL
    static org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    doMutulSSLGet(String path, String url, Map<String,String> headers)
    To do HTTPS GET operation for the given URL with mutual SSL.
    static org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    doPost(String url, Map<String,String> headers, String payload)
    do HTTP POST operation for the given URL
    static org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    doPost(String url, Map<String,String> headers, List<org.apache.http.NameValuePair> urlParameters)
    do HTTP POST operation for the given URL
    static org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    doPost(URL url, String urlParams, Map<String,String> headers)
    do HTTP POST operation for the given URL
    static org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    doPost(URL url, Map<String,String> headers, String json)
    do HTTP POST operation for the given URL with JSON entity
    static org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    doPut(String url, Map<String,String> headers, String payload)
    do HTTP PUT operation for the given URL
    static org.apache.http.impl.client.CloseableHttpClient
    get the HTTP Client
    static String
    getResponseBody(org.apache.http.HttpResponse response)
    read the response body as String

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • HTTPSClientUtils

      public HTTPSClientUtils()
  • Method Details

    • doGet

      public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doGet(String url, Map<String,String> headers) throws IOException
      do HTTP GET operation for the given URL
      Parameters:
      url - request URL
      headers - headers to be send
      Returns:
      org.wso2.carbon.automation.test.utils.http.client.HttpResponse
      Throws:
      IOException - if connection issue occurred
    • doPost

      public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(String url, Map<String,String> headers, List<org.apache.http.NameValuePair> urlParameters) throws IOException
      do HTTP POST operation for the given URL
      Parameters:
      url - request URL
      headers - headers to be send
      urlParameters - parameters to be sent as payload
      Returns:
      org.wso2.carbon.automation.test.utils.http.client.HttpResponse
      Throws:
      IOException - if connection issue occurred
    • doMutulSSLGet

      public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doMutulSSLGet(String path, String url, Map<String,String> headers) throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, UnrecoverableKeyException
      To do HTTPS GET operation for the given URL with mutual SSL.
      Parameters:
      url - request URL
      headers - headers to be send
      Returns:
      org.wso2.carbon.automation.test.utils.http.client.HttpResponse
      Throws:
      IOException - if connection issue occurred
      NoSuchAlgorithmException
      KeyStoreException
      KeyManagementException
      UnrecoverableKeyException
    • doPost

      public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(String url, Map<String,String> headers, String payload) throws IOException
      do HTTP POST operation for the given URL
      Parameters:
      url - request URL
      headers - headers to be sent
      Returns:
      org.wso2.carbon.automation.test.utils.http.client.HttpResponse
      Throws:
      IOException - if connection issue occurred
    • doPut

      public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPut(String url, Map<String,String> headers, String payload) throws IOException
      do HTTP PUT operation for the given URL
      Parameters:
      url - request URL
      headers - headers to be sent
      Returns:
      org.wso2.carbon.automation.test.utils.http.client.HttpResponse
      Throws:
      IOException - if connection issue occurred
    • doPost

      public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(URL url, Map<String,String> headers, String json) throws IOException
      do HTTP POST operation for the given URL with JSON entity
      Parameters:
      url -
      headers -
      json -
      Returns:
      org.wso2.carbon.automation.test.utils.http.client.HttpResponse
      Throws:
      IOException
    • doPost

      public static org.wso2.carbon.automation.test.utils.http.client.HttpResponse doPost(URL url, String urlParams, Map<String,String> headers) throws IOException
      do HTTP POST operation for the given URL
      Parameters:
      url - request URL
      urlParams - parameter string to be sent as payload
      headers - headers to be send
      Returns:
      org.wso2.carbon.automation.test.utils.http.client.HttpResponse
      Throws:
      IOException - if connection issue occurred
    • getHttpsClient

      public static org.apache.http.impl.client.CloseableHttpClient getHttpsClient()
      get the HTTP Client
      Returns:
      CloseableHttpClient
    • getResponseBody

      public static String getResponseBody(org.apache.http.HttpResponse response) throws IOException
      read the response body as String
      Parameters:
      response - http response with type org.apache.http.HttpResponse
      Returns:
      String of the response body
      Throws:
      IOException - throws if any error occurred