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, EnvironmentsControl, EventsControl, GlobalPermissionControl, GroupControl, IndexControl, LogControl, LogSettingsControl, PermissionsControl, PlansControl, PluginSettingsControl, PreferencesControl, ProjectsControl, QueueControl, QuickFiltersControl, RepositoryControl, RestAssert, RollbackControl, SchedulerControl, SecretControl, ServerCapabilitiesControl, ServerControl, SharedCredentialsControl, StatsControl, SystemControl, TestsControl, TroubleshootingControl, UserControl

public class BackdoorControl<T extends BackdoorControl<T>> extends Object
Copied from jira-testkit-client
  • Field Details

  • Constructor Details

  • Method Details

    • getRootPath

      protected String getRootPath()
    • ping

      public PingResponse 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

      protected javax.ws.rs.client.WebTarget resourceRoot(String url)
      Creates a WebResource with authentication parameters set for the default user.
    • anonymousResourceRoot

      protected javax.ws.rs.client.WebTarget anonymousResourceRoot(String url)
    • 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 by getRestModulePath(). Note that the created WebResource has the following properties:
      • it logs all GET/POST/etc requests made through it
      • it sets the Content-Type: application/json by default (override with WebTarget.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

      protected final javax.ws.rs.client.WebTarget createResourceForPath(String restModulePath)
      Creates the resource that corresponds to the root of a REST API. Note that the created WebResource has the following properties:
      • it logs all GET/POST/etc requests made through it
      • it sets the Content-Type: application/json by default (override with WebTarget.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 created WebResource has the following properties:
      • it logs all GET/POST/etc requests made through it
      • it sets the Content-Type: application/json by default (override with WebTarget.request(MediaType...))
      Parameters:
      restModulePath - a String containing the REST path
      restModuleVersion - a String containing the REST module version
      Returns:
      a WebResource for the API root at the specified path
      See Also:
    • getRestModulePath

      protected String getRestModulePath()
      Returns the REST path used in this plugin's atlassian-plugin.xml (e.g. &lt;rest path="..."&gt;). The default value is ""backdoor"".
      Returns:
      the REST path used in this plugin's atlassian-plugin.xml (e.g. &lt;rest path="..."&gt;).
    • get

      protected final String get(javax.ws.rs.client.WebTarget webResource)
      Convenience method that simply calls 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.

      Parameters:
      webResource - the WebResource to perform the GET on
    • percentEncode

      protected static String percentEncode(String queryParam)
      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

      protected BambooEnvironmentData getEnvironmentData()
    • post

      protected static <T> T post(javax.ws.rs.client.Invocation.Builder invocation, javax.ws.rs.client.Entity<?> entity, Class<T> clazz)