Class RestSupport.RestClient
java.lang.Object
com.atlassian.jira.webtest.webdriver.tests.plugin.auditing.fixtures.RestSupport.RestClient
- Enclosing class:
RestSupport
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAllows you to connect as a named userasAdmin()Allows you to connect admin/adminasFred()com.fasterxml.jackson.databind.JsonNodedeleteJSON(String urlPath) Allows you to DELETE a resource on the URL path without a responsecom.fasterxml.jackson.databind.JsonNodedeleteJSON(String urlPath, com.fasterxml.jackson.databind.JsonNode deleteJSON) Allows you to DELETE a resource on the URL path and return the JSON responsecom.fasterxml.jackson.databind.JsonNodedeleteJSONWithContent(String urlPath) Allows you to DELETE a resource on the URL path and return the error JSON responsecom.fasterxml.jackson.databind.JsonNodedeleteJSONWithError(String urlPath, com.fasterxml.jackson.databind.JsonNode deleteJSON, Integer statusCode) Allows you to DELETE a resource on the URL path and return the JSON responsecom.fasterxml.jackson.databind.JsonNodeAllows you to GET a JSON AST from the resource on the URL path and return the JSON responsegetJSONOrStatusCode(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)com.fasterxml.jackson.databind.JsonNodegetJSONWithError(String urlPath, Integer statusCode) Allows you to GET a JSON AST from the resource on the URL path and return the error JSON responseAllows you to GET a string from the resource on the URL path and return the Stringjakarta.ws.rs.client.WebTargetAllows you to obtain a target for the URL path so you can work on it, for example GETing it or POSTing to itcom.fasterxml.jackson.databind.JsonNodeAllows you to POST JSON to a resource on the URL path and return the JSON responsecom.fasterxml.jackson.databind.JsonNodeAllows you to POST JSON to a resource on the URL path and return the JSON responsecom.fasterxml.jackson.databind.JsonNodepostJSONWithError(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 responsecom.fasterxml.jackson.databind.JsonNodeAllows you to PUT JSON to a resource on the URL path and return the JSON responsecom.fasterxml.jackson.databind.JsonNodeAllows you to PUT JSON to a resource on the URL path and return the JSON responsecom.fasterxml.jackson.databind.JsonNodeputJSONWithError(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 responsejakarta.ws.rs.client.WebTargetDeprecated.
-
Constructor Details
-
RestClient
protected RestClient()
-
-
Method Details
-
as
Allows you to connect as a named user- Parameters:
user- who to connect aspassword- their password- Returns:
- itself
-
asAdmin
Allows you to connect admin/admin -
asFred
-
resource
@Deprecated public jakarta.ws.rs.client.WebTarget resource(String urlPath, Map<String, String> param) Deprecated.usegetTarget(String, Map)insteadLeft for discoverability purpose. UsegetTarget(String, Map)instead.- Parameters:
urlPath- this does NOT include the host name or context pathparam- query params- Returns:
- a http target
-
getTarget
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
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
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
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
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 pathdeleteJSON- the json to send to the DELETE method- Returns:
- a parsed JSON AST response
- Throws:
RuntimeException- is if the JSON cannot be parsed
-
deleteJSON
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
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
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 pathpostJSON- 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 pathpostJSON- the json to post- Returns:
- a parsed JSON AST response
- Throws:
RuntimeException- is if the JSON cannot be parsed
-
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- 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 pathputJSON- 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 pathputJSON- the json to put- Returns:
- a parsed JSON AST response
- Throws:
RuntimeException- is if the JSON cannot be parsed
-
getTarget(String, Map)instead