Class BackdoorControl<T extends BackdoorControl<T>>
java.lang.Object
com.atlassian.bamboo.testutils.backdoor.BackdoorControl<T>
- Direct Known Subclasses:
AdministrationControl
,AgentsControl
,AnalyticsControl
,ApplicationLinksControl
,ArtifactsControl
,AuthenticationAnalyticsControl
,BuildResultsControl
,CacheControl
,CapabilitiesControl
,CaptchaControl
,DarkFeatureControl
,DatabaseControl
,DeploymentsControl
,ElasticCapabilityControl
,EnvironmentsControl
,EventsControl
,GlobalPermissionControl
,GroupControl
,IndexControl
,LogControl
,LogSettingsControl
,PermissionsControl
,PlansControl
,PluginSettingsControl
,PreferencesControl
,ProjectsControl
,PropertyControl
,QueueControl
,QuickFiltersControl
,RepositoryControl
,RestAssert
,RollbackControl
,SchedulerControl
,SecretControl
,ServerCapabilitiesControl
,ServerControl
,SharedCredentialsControl
,StatsControl
,SystemControl
,TestsControl
,TroubleshootingControl
,UserControl
Copied from jira-testkit-client
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
protected static class
Sets theContent-Type
header to ""application/json"" if not already set. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected javax.ws.rs.client.WebTarget
protected javax.ws.rs.client.Client
client()
Returns the Jersey client to use.protected javax.ws.rs.client.WebTarget
Creates the resource that corresponds to the root of the TestKit REST API, using the values returned bygetRestModulePath()
.protected final javax.ws.rs.client.WebTarget
createResourceForPath
(String restModulePath) Creates the resource that corresponds to the root of a REST API.protected javax.ws.rs.client.WebTarget
createResourceForPath
(String restModulePath, String restModuleVersion) Creates the resource that corresponds to the root of a REST API.protected final String
get
(javax.ws.rs.client.WebTarget webResource) Convenience method that simply callsWebResource.get(String.class)
on the passed-in WebResource.protected BambooEnvironmentData
protected String
Returns the REST path used in this plugin'satlassian-plugin.xml
(e.g.protected String
protected static String
percentEncode
(String queryParam) Percent-encode the % when stuffing it into a query param.ping()
protected static <T> T
post
(javax.ws.rs.client.Invocation.Builder invocation, javax.ws.rs.client.Entity<?> entity, Class<T> clazz) protected javax.ws.rs.client.WebTarget
resourceRoot
(String url) Creates a WebResource with authentication parameters set for the default user.void
tearDown()
Cleanup resources
-
Field Details
-
XSRF_TOKEN_HEADER
- See Also:
-
XSRF_NO_CHECK
- See Also:
-
DEFAULT_REST_PATH
The default REST path for the TestKit resources.- See Also:
-
API_REST_PATH
- See Also:
-
ADMIN_REST_PATH
- See Also:
-
-
Constructor Details
-
BackdoorControl
-
-
Method Details
-
getRootPath
-
ping
-
tearDown
public void tearDown()Cleanup resources -
client
protected javax.ws.rs.client.Client client()Returns the Jersey client to use.- Returns:
- a Client
-
resourceRoot
Creates a WebResource with authentication parameters set for the default user. -
anonymousResourceRoot
-
createResource
protected javax.ws.rs.client.WebTarget createResource()Creates the resource that corresponds to the root of the TestKit REST API, using the values returned bygetRestModulePath()
. Note that the createdWebResource
has the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/json
by default (override withWebTarget.request(MediaType...)
)
createResourceForPath(java.lang.String)
- Returns:
- a WebResource for the TestKit REST API root
- See Also:
-
createResourceForPath
Creates the resource that corresponds to the root of a REST API. Note that the createdWebResource
has the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/json
by default (override withWebTarget.request(MediaType...)
)
- Parameters:
restModulePath
- a String containing the REST path- Returns:
- a WebResource for the the API root at the specified path
- See Also:
-
createResourceForPath
protected javax.ws.rs.client.WebTarget createResourceForPath(String restModulePath, String restModuleVersion) Creates the resource that corresponds to the root of a REST API. Note that the createdWebResource
has the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/json
by default (override withWebTarget.request(MediaType...)
)
- Parameters:
restModulePath
- a String containing the REST pathrestModuleVersion
- a String containing the REST module version- Returns:
- a WebResource for the API root at the specified path
- See Also:
-
getRestModulePath
Returns the REST path used in this plugin'satlassian-plugin.xml
(e.g.<rest path="...">
). The default value is ""backdoor"".- Returns:
- the REST path used in this plugin's
atlassian-plugin.xml
(e.g.<rest path="...">
).
-
get
Convenience method that simply callsWebResource.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.
- Parameters:
webResource
- the WebResource to perform the GET on
-
percentEncode
Percent-encode the % when stuffing it into a query param. Otherwise it may not get escaped properly, as per this EAC blog.- Parameters:
queryParam
- the query param value- Returns:
- a String with % replaced by %25
-
getEnvironmentData
-
post
protected static <T> T post(javax.ws.rs.client.Invocation.Builder invocation, javax.ws.rs.client.Entity<?> entity, Class<T> clazz)
-