Class AbstractWebAction

    • Constructor Detail

      • AbstractWebAction

        protected AbstractWebAction​(AbstractWebAction previousAction,
                                    java.lang.String timerName)
        Creates a new AbstractWebAction object and gives it the passed timer name. This constructor is typically used for an intermediate action in a sequence of actions, i.e. it has a previous action.
        Parameters:
        previousAction - the action that preceded the current action
        timerName - the name of the timer that is associated with this action
      • AbstractWebAction

        protected AbstractWebAction​(java.lang.String timerName)
        Creates a new AbstractWebAction object and gives it the passed timer name. This constructor is typically used for the first action in a sequence of actions, i.e. it has no previous action.
        Parameters:
        timerName - the name of the timer that is associated with this action
    • Method Detail

      • addResponseProcessor

        public void addResponseProcessor​(ResponseProcessor processor)
        Registers the given response processor. Note that the processor is valid during the current action only.
        Parameters:
        processor - the response processor
      • closeWebClient

        public void closeWebClient()
        Closes the underlying web client and releases all resources associated with it. Usually, doing this explicitly is not necessary since the framework takes care of this at the end of the test. However, if you create multiple independent web sessions (by creating multiple AbstractWebAction objects without a previous action) during a test, you might want to release any web session not needed any longer as soon as possible to reduce over-all memory consumption. Note that accessing the web client afterwards will cause an IllegalStateException.
      • getPreviousAction

        public AbstractWebAction getPreviousAction()
        Returns the action that was passed as the previous action to the constructor. Allows access to data collected during the previous action.
        Overrides:
        getPreviousAction in class AbstractAction
        Returns:
        the previous action (may be null)
      • getWebClient

        public WebClient getWebClient()
        Returns the current web client. Makes it possible to perform low-level HTTP operations directly.
        Returns:
        the current web client
        Throws:
        java.lang.IllegalStateException - if the web client has already been closed explicitly
      • run

        public void run()
                 throws java.lang.Throwable
        The run method must restore the state in case we constructed another action in between to prevalidate conditions.
        Overrides:
        run in class AbstractAction
        Throws:
        java.lang.Throwable - if an error occurred while running the action
      • createWebRequestSettings

        protected WebRequest createWebRequestSettings​(java.net.URL url,
                                                      HttpMethod method,
                                                      java.util.List<NameValuePair> requestParameters)
                                               throws java.net.MalformedURLException
        Creates a WebRequest object from the passed URL, request parameters and request method.
        Parameters:
        url - the target URL
        method - the HTTP request method to be used
        requestParameters - the list of custom parameters to add
        Throws:
        java.net.MalformedURLException - if an error occurred