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,JobControl,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
Nested ClassesModifier and TypeClassDescriptionstatic classprotected static classSets theContent-Typeheader to ""application/json"" if not already set. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.ws.rs.client.WebTargetprotected jakarta.ws.rs.client.Clientclient()Returns the Jersey client to use.protected jakarta.ws.rs.client.WebTargetcreateAnonymousResourceForPath(String restModulePath) protected jakarta.ws.rs.client.WebTargetcreateAnonymousResourceForPath(String restModulePath, String restModuleVersion) protected jakarta.ws.rs.client.WebTargetCreates the resource that corresponds to the root of the TestKit REST API, using the values returned bygetRestModulePath().protected final jakarta.ws.rs.client.WebTargetcreateResourceForPath(String restModulePath) Creates the resource that corresponds to the root of a REST API.protected jakarta.ws.rs.client.WebTargetcreateResourceForPath(String restModulePath, String restModuleVersion) Creates the resource that corresponds to the root of a REST API.protected final Stringget(jakarta.ws.rs.client.WebTarget webResource) Convenience method that simply callsWebResource.get(String.class)on the passed-in WebResource.protected BambooEnvironmentDataprotected StringReturns the REST path used in this plugin'satlassian-plugin.xml(e.g.protected Stringprotected static StringpercentEncode(String queryParam) Percent-encode the % when stuffing it into a query param.ping()protected static <T> Tpost(jakarta.ws.rs.client.Invocation.Builder invocation, jakarta.ws.rs.client.Entity<?> entity, Class<T> clazz) protected jakarta.ws.rs.client.WebTargetresourceRoot(String url) Creates a WebResource with authentication parameters set for the default user.protected jakarta.ws.rs.client.WebTargetvoidtearDown()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 jakarta.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. -
resourceRootWithForcedTokenAuth
-
anonymousResourceRoot
-
createResource
protected jakarta.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 createdWebResourcehas the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/jsonby default (override withWebTarget.request(MediaType...))
To create a WebResource for a different root, use
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 createdWebResourcehas the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/jsonby 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 jakarta.ws.rs.client.WebTarget createResourceForPath(String restModulePath, String restModuleVersion) Creates the resource that corresponds to the root of a REST API. Note that the createdWebResourcehas the following properties:- it logs all GET/POST/etc requests made through it
- it sets the
Content-Type: application/jsonby 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:
-
createAnonymousResourceForPath
-
createAnonymousResourceForPath
-
getRestModulePath
Returns the REST path used in this plugin'satlassian-plugin.xml(e.g.<rest path="...">). The default value is ""backdoor"<T extends BackdoorControl<T>>".- 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(jakarta.ws.rs.client.Invocation.Builder invocation, jakarta.ws.rs.client.Entity<?> entity, Class<T> clazz)
-