Class BackdoorControl<T extends BackdoorControl<T>>

    • Constructor Detail

    • Method Detail

      • tearDown

        public void tearDown()
        Cleanup resources
      • client

        protected com.sun.jersey.api.client.Client client()
        Returns the Jersey client to use.
        Returns:
        a Client
      • resourceRoot

        protected com.sun.jersey.api.client.WebResource resourceRoot​(String url)
        Creates a WebResource with authentication parameters set for the default user.
      • createResource

        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(). 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 WebResource.type(javax.ws.rs.core.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:
        createResource(), getRestModulePath()
      • createResourceForPath

        protected final com.sun.jersey.api.client.WebResource 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 WebResource.type(javax.ws.rs.core.MediaType))
        Parameters:
        restModulePath - a String containing the REST path
        Returns:
        a WebResource for the the API root at the specified path
        See Also:
        getRestModulePath()
      • 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​(com.sun.jersey.api.client.WebResource 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
      • post

        protected static <T> T post​(com.sun.jersey.api.client.UniformInterface entity,
                                    Class<T> clazz)