public class BackdoorControl<T extends BackdoorControl<T>> extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BackdoorControl.AddXsrfNoCheckTokenFilter |
protected static class |
BackdoorControl.JsonMediaTypeFilter
Sets the
Content-Type header to "" if not already set. |
Modifier and Type | Field and Description |
---|---|
static String |
ADMIN_REST_PATH |
static String |
API_REST_PATH |
static String |
DEFAULT_REST_PATH
The default REST path for the TestKit resources.
|
protected String |
rootPath
Base URL.
|
Constructor and Description |
---|
BackdoorControl(BambooEnvironmentData environmentData) |
Modifier and Type | Method and Description |
---|---|
protected com.sun.jersey.api.client.Client |
client()
Returns the Jersey client to use.
|
protected com.sun.jersey.api.client.WebResource |
createResource()
Creates the resource that corresponds to the root of the TestKit REST API, using the values returned by
getRestModulePath() . |
protected com.sun.jersey.api.client.WebResource |
createResourceForPath(String restModulePath)
Creates the resource that corresponds to the root of a REST API.
|
protected String |
get(com.sun.jersey.api.client.WebResource webResource)
Convenience method that simply calls
WebResource.get(String.class) on the passed-in WebResource. |
protected BambooEnvironmentData |
getEnvironmentData() |
protected String |
getRestModulePath()
Returns the REST path used in this plugin's
atlassian-plugin.xml (e.g. |
protected static String |
percentEncode(String queryParam)
Percent-encode the % when stuffing it into a query param.
|
PingResponse |
ping() |
protected static <T> T |
post(com.sun.jersey.api.client.UniformInterface entity,
Class<T> clazz) |
protected com.sun.jersey.api.client.WebResource |
resourceRoot(String url)
Creates a WebResource with authentication parameters set for the default user.
|
void |
tearDown()
Cleanup resources
|
public static final String DEFAULT_REST_PATH
public static final String API_REST_PATH
public static final String ADMIN_REST_PATH
protected final String rootPath
public BackdoorControl(@NotNull BambooEnvironmentData environmentData)
public PingResponse ping()
public void tearDown()
protected com.sun.jersey.api.client.Client client()
protected com.sun.jersey.api.client.WebResource resourceRoot(String url)
protected com.sun.jersey.api.client.WebResource createResource()
getRestModulePath()
. Note that the created WebResource
has the following properties: Content-Type: application/json
by
default (override with WebResource.type(javax.ws.rs.core.MediaType)
)createResourceForPath(java.lang.String)
createResource()
,
getRestModulePath()
protected final com.sun.jersey.api.client.WebResource createResourceForPath(String restModulePath)
WebResource
has
the following properties: Content-Type: application/json
by default (override with WebResource.type(javax.ws.rs.core.MediaType)
)restModulePath
- a String containing the REST pathgetRestModulePath()
protected String getRestModulePath()
atlassian-plugin.xml
(e.g. <rest path="...">
).
The default value is ""backdoor"".atlassian-plugin.xml
(e.g. <rest path="...">
).protected final String get(com.sun.jersey.api.client.WebResource webResource)
WebResource.get(String.class)
on the passed-in WebResource.
This method is often used for mutative operations which should really be using a POST instead, but doing a GET is much more convenient since you can do it right from your browser when testing a backdoor and this is only testing code so it's OK.
webResource
- the WebResource to perform the GET onprotected static String percentEncode(String queryParam)
queryParam
- the query param valueprotected BambooEnvironmentData getEnvironmentData()
protected static <T> T post(com.sun.jersey.api.client.UniformInterface entity, Class<T> clazz)
Copyright © 2021 Atlassian Software Systems Pty Ltd. All rights reserved.