Class ForwardChainExpectation


  • public class ForwardChainExpectation
    extends Object
    Author:
    jamesdbloom
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void error​(HttpError httpError)
      Return error when expectation is matched
      void forward​(ExpectationForwardCallback expectationForwardCallback)
      Call method on object locally or remotely (over web socket) to generate request to forward when expectation is matched
      void forward​(HttpClassCallback httpClassCallback)
      Call method on local class in same JVM implementing ExpectationResponseCallback to generate request to forward when expectation is matched
      void forward​(HttpForward httpForward)
      Forward request to the specified host and port when expectation is matched
      void forward​(HttpOverrideForwardedRequest httpOverrideForwardedRequest)
      Override fields, headers, and cookies etc in request being forwarded with specified fields, headers and cookies, etc in the specified request when expectation is matched
      void forward​(HttpTemplate httpTemplate)
      Evaluate Velocity or JavaScript template to generate request to forward when expectation is matched
      void respond​(ExpectationResponseCallback expectationResponseCallback)
      Call method on object locally or remotely (over web socket) to generate response to return when expectation is matched
      void respond​(HttpClassCallback httpClassCallback)
      Call method on local class in same JVM implementing ExpectationResponseCallback to generate response to return when expectation is matched
      void respond​(HttpResponse httpResponse)
      Return response when expectation is matched
      void respond​(HttpTemplate httpTemplate)
      Evaluate Velocity or JavaScript template to generate response to return when expectation is matched
    • Method Detail

      • respond

        public void respond​(HttpResponse httpResponse)
        Return response when expectation is matched
        Parameters:
        httpResponse - response to return
      • respond

        public void respond​(HttpTemplate httpTemplate)
        Evaluate Velocity or JavaScript template to generate response to return when expectation is matched
        Parameters:
        httpTemplate - Velocity or JavaScript template used to generate response
      • respond

        public void respond​(HttpClassCallback httpClassCallback)
        Call method on local class in same JVM implementing ExpectationResponseCallback to generate response to return when expectation is matched

        The callback class must: - implement org.mockserver.mock.action.ExpectationResponseCallback - have a zero argument constructor - be available in the classpath of the MockServer

        Parameters:
        httpClassCallback - class to callback as a fully qualified class name, i.e. "com.foo.MyExpectationResponseCallback"
      • respond

        public void respond​(ExpectationResponseCallback expectationResponseCallback)
        Call method on object locally or remotely (over web socket) to generate response to return when expectation is matched
        Parameters:
        expectationResponseCallback - object to call locally or remotely to generate response
      • forward

        public void forward​(HttpForward httpForward)
        Forward request to the specified host and port when expectation is matched
        Parameters:
        httpForward - host and port to forward to
      • forward

        public void forward​(HttpTemplate httpTemplate)
        Evaluate Velocity or JavaScript template to generate request to forward when expectation is matched
        Parameters:
        httpTemplate - Velocity or JavaScript template used to generate response
      • forward

        public void forward​(HttpClassCallback httpClassCallback)
        Call method on local class in same JVM implementing ExpectationResponseCallback to generate request to forward when expectation is matched

        The callback class must: - implement org.mockserver.mock.action.ExpectationForwardCallback - have a zero argument constructor - be available in the classpath of the MockServer

        Parameters:
        httpClassCallback - class to callback as a fully qualified class name, i.e. "com.foo.MyExpectationResponseCallback"
      • forward

        public void forward​(ExpectationForwardCallback expectationForwardCallback)
        Call method on object locally or remotely (over web socket) to generate request to forward when expectation is matched
        Parameters:
        expectationForwardCallback - object to call locally or remotely to generate request
      • forward

        public void forward​(HttpOverrideForwardedRequest httpOverrideForwardedRequest)
        Override fields, headers, and cookies etc in request being forwarded with specified fields, headers and cookies, etc in the specified request when expectation is matched
        Parameters:
        httpOverrideForwardedRequest - contains request to override request being forwarded
      • error

        public void error​(HttpError httpError)
        Return error when expectation is matched
        Parameters:
        httpError - error to return