java.lang.Object
com.atlassian.jira.webtest.webdriver.tests.plugin.auditing.fixtures.RestSupport.RestClient
Enclosing class:
RestSupport

protected class RestSupport.RestClient extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    as(String user, String password)
    Allows you to connect as a named user
    Allows you to connect admin/admin
     
    com.fasterxml.jackson.databind.JsonNode
    deleteJSON(String urlPath)
    Allows you to DELETE a resource on the URL path without a response
    com.fasterxml.jackson.databind.JsonNode
    deleteJSON(String urlPath, com.fasterxml.jackson.databind.JsonNode deleteJSON)
    Allows you to DELETE a resource on the URL path and return the JSON response
    com.fasterxml.jackson.databind.JsonNode
    Allows you to DELETE a resource on the URL path and return the error JSON response
    com.fasterxml.jackson.databind.JsonNode
    deleteJSONWithError(String urlPath, com.fasterxml.jackson.databind.JsonNode deleteJSON, Integer statusCode)
    Allows you to DELETE a resource on the URL path and return the JSON response
    com.fasterxml.jackson.databind.JsonNode
    getJSON(String urlPath, Map<String,String> param)
    Allows you to GET a JSON AST from the resource on the URL path and return the JSON response
    Allows you to GET a JSON AST from the resource on the URL path and return the JSON response If the HTTP response code isn't 200, returns a pair of (HTTP_code, None)
    com.fasterxml.jackson.databind.JsonNode
    getJSONWithError(String urlPath, Integer statusCode)
    Allows you to GET a JSON AST from the resource on the URL path and return the error JSON response
    getString(String urlPath)
    Allows you to GET a string from the resource on the URL path and return the String
    jakarta.ws.rs.client.WebTarget
    getTarget(String urlPath, Map<String,String> param)
    Allows you to obtain a target for the URL path so you can work on it, for example GETing it or POSTing to it
    com.fasterxml.jackson.databind.JsonNode
    postJSON(String urlPath)
    Allows you to POST JSON to a resource on the URL path and return the JSON response
    com.fasterxml.jackson.databind.JsonNode
    postJSON(String urlPath, com.fasterxml.jackson.databind.JsonNode postJSON)
    Allows you to POST JSON to a resource on the URL path and return the JSON response
    com.fasterxml.jackson.databind.JsonNode
    postJSONWithError(String urlPath, com.fasterxml.jackson.databind.JsonNode postJSON, Integer statusCode)
    Allows you to POST JSON to a resource on the URL path and return the error JSON response
    com.fasterxml.jackson.databind.JsonNode
    putJSON(String urlPath)
    Allows you to PUT JSON to a resource on the URL path and return the JSON response
    com.fasterxml.jackson.databind.JsonNode
    putJSON(String urlPath, com.fasterxml.jackson.databind.JsonNode putJSON)
    Allows you to PUT JSON to a resource on the URL path and return the JSON response
    com.fasterxml.jackson.databind.JsonNode
    putJSONWithError(String urlPath, com.fasterxml.jackson.databind.JsonNode putJSON, Integer statusCode)
    Allows you to PUT JSON to a resource on the URL path and return the error JSON response
    jakarta.ws.rs.client.WebTarget
    resource(String urlPath, Map<String,String> param)
    Deprecated.

    Methods inherited from class java.lang.Object

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

    • RestClient

      protected RestClient()
  • Method Details

    • as

      public RestSupport.RestClient as(String user, String password)
      Allows you to connect as a named user
      Parameters:
      user - who to connect as
      password - their password
      Returns:
      itself
    • asAdmin

      public RestSupport.RestClient asAdmin()
      Allows you to connect admin/admin
    • asFred

      public RestSupport.RestClient asFred()
    • resource

      @Deprecated public jakarta.ws.rs.client.WebTarget resource(String urlPath, Map<String,String> param)
      Deprecated.
      Left for discoverability purpose. Use getTarget(String, Map) instead.
      Parameters:
      urlPath - this does NOT include the host name or context path
      param - query params
      Returns:
      a http target
    • getTarget

      public jakarta.ws.rs.client.WebTarget getTarget(String urlPath, Map<String,String> param)
      Allows you to obtain a target for the URL path so you can work on it, for example GETing it or POSTing to it
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a http resource
    • getJSON

      public com.fasterxml.jackson.databind.JsonNode getJSON(String urlPath, Map<String,String> param)
      Allows you to GET a JSON AST from the resource on the URL path and return the JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a parsed JSON Ast
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • getJSONOrStatusCode

      public RestSupport.JsonOrStatusCode getJSONOrStatusCode(String urlPath)
      Allows you to GET a JSON AST from the resource on the URL path and return the JSON response If the HTTP response code isn't 200, returns a pair of (HTTP_code, None)
    • getString

      public String getString(String urlPath)
      Allows you to GET a string from the resource on the URL path and return the String
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a parsed JSON Ast
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • getJSONWithError

      public com.fasterxml.jackson.databind.JsonNode getJSONWithError(String urlPath, Integer statusCode)
      Allows you to GET a JSON AST from the resource on the URL path and return the error JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a parsed JSON Ast
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • deleteJSON

      public com.fasterxml.jackson.databind.JsonNode deleteJSON(String urlPath, com.fasterxml.jackson.databind.JsonNode deleteJSON)
      Allows you to DELETE a resource on the URL path and return the JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      deleteJSON - the json to send to the DELETE method
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • deleteJSON

      public com.fasterxml.jackson.databind.JsonNode deleteJSON(String urlPath)
      Allows you to DELETE a resource on the URL path without a response
      Parameters:
      urlPath - this does NOT include the host name or context path
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • deleteJSONWithContent

      public com.fasterxml.jackson.databind.JsonNode deleteJSONWithContent(String urlPath)
      Allows you to DELETE a resource on the URL path and return the error JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • deleteJSONWithError

      public com.fasterxml.jackson.databind.JsonNode deleteJSONWithError(String urlPath, com.fasterxml.jackson.databind.JsonNode deleteJSON, Integer statusCode)
      Allows you to DELETE a resource on the URL path and return the JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • postJSON

      public com.fasterxml.jackson.databind.JsonNode postJSON(String urlPath)
      Allows you to POST JSON to a resource on the URL path and return the JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • postJSON

      public com.fasterxml.jackson.databind.JsonNode postJSON(String urlPath, com.fasterxml.jackson.databind.JsonNode postJSON)
      Allows you to POST JSON to a resource on the URL path and return the JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      postJSON - the json to post
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • postJSONWithError

      public com.fasterxml.jackson.databind.JsonNode postJSONWithError(String urlPath, com.fasterxml.jackson.databind.JsonNode postJSON, Integer statusCode)
      Allows you to POST JSON to a resource on the URL path and return the error JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      postJSON - the json to post
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • putJSON

      public com.fasterxml.jackson.databind.JsonNode putJSON(String urlPath)
      Allows you to PUT JSON to a resource on the URL path and return the JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • putJSON

      public com.fasterxml.jackson.databind.JsonNode putJSON(String urlPath, com.fasterxml.jackson.databind.JsonNode putJSON)
      Allows you to PUT JSON to a resource on the URL path and return the JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      putJSON - the json to put
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed
    • putJSONWithError

      public com.fasterxml.jackson.databind.JsonNode putJSONWithError(String urlPath, com.fasterxml.jackson.databind.JsonNode putJSON, Integer statusCode)
      Allows you to PUT JSON to a resource on the URL path and return the error JSON response
      Parameters:
      urlPath - this does NOT include the host name or context path
      putJSON - the json to put
      Returns:
      a parsed JSON AST response
      Throws:
      RuntimeException - is if the JSON cannot be parsed