Class TestOutboundFacade

java.lang.Object
org.junit.rules.ExternalResource
de.hybris.platform.outboundservices.util.OutboundInvocationTracker<TestOutboundFacade>
de.hybris.platform.outboundservices.util.TestOutboundFacade
All Implemented Interfaces:
OutboundServiceFacade, org.junit.rules.TestRule

public class TestOutboundFacade extends OutboundInvocationTracker<TestOutboundFacade> implements OutboundServiceFacade
  • Constructor Details

    • TestOutboundFacade

      public TestOutboundFacade()
  • Method Details

    • createDefaultResponse

      protected org.springframework.http.ResponseEntity<Map> createDefaultResponse()
      Description copied from class: OutboundInvocationTracker
      Creates an instance of the response to be used by default.
      Specified by:
      createDefaultResponse in class OutboundInvocationTracker<TestOutboundFacade>
      Returns:
      a response that should be returned from the send invocations when explicit response was not specified.
    • respondWithCreated

      public TestOutboundFacade respondWithCreated()
      Specifies to respond with HTTP 201 Created to all requests it receives, unless this spec is overridden then by a subsequent call to a respondWith... or throwException method
      Returns:
      test facade instance stubbed for CREATED response.
    • respondWithNotFound

      public TestOutboundFacade respondWithNotFound()
      Specifies to respond with HTTP 404 Not Found to all requests it receives, unless this spec is not overridden then by a subsequent call to a respondWith... or throwException method.
      Returns:
      facade with the response specification applied.
    • respondWithBadRequest

      public TestOutboundFacade respondWithBadRequest()
      Specifies to respond with HTTP 400 Bad Request to all requests it receives, unless this spec is not overridden then by a subsequent call to a respondWith... or throwException method.
      Returns:
      facade with the response specification applied.
    • respondWithServerError

      public TestOutboundFacade respondWithServerError()
      Specifies to respond with HTTP 500 Internal Server Error to all requests it receives, unless this spec is not overridden then by a subsequent call to a respondWith... or throwException method.
      Returns:
      facade with the response specification applied.
    • throwException

      public TestOutboundFacade throwException(RuntimeException e)
      Description copied from class: OutboundInvocationTracker
      Specifies to throw an exception when the send method is called.
      Overrides:
      throwException in class OutboundInvocationTracker<TestOutboundFacade>
      Parameters:
      e - an exception to throw
      Returns:
      tracker with the behavior applied
    • doAndRespondWith

      public TestOutboundFacade doAndRespondWith(org.springframework.http.ResponseEntity.HeadersBuilder builder, Runnable act)
      Specifies to perform an action before return the specified response from the send(ItemModel, String, String) method.
      Parameters:
      builder - a builder for the response to return.
      act - an action to perform before the response is returned. This allows to inject time-sensitive behavior to the test to call certain code when a desired item is being processed instead of relying on guessing the right time to execute that code in parallel.
      Returns:
      a facade with the response specified.
    • send

      public rx.Observable<org.springframework.http.ResponseEntity<Map>> send(ItemModel itemModel, String integrationObjectCode, String destination)
      Description copied from interface: OutboundServiceFacade
      Method orchestrates the services to build the payload and to integrate with restful endpoint.
      Specified by:
      send in interface OutboundServiceFacade
      Parameters:
      itemModel - the model to be converted
      integrationObjectCode - the name of the integration object to convert this model as payload
      destination - endpoint destination information
      Returns:
      rx.Observable which allows the caller to subscribe the callback method
    • send

      public rx.Observable<org.springframework.http.ResponseEntity<Map>> send(SyncParameters parameters)
      Description copied from interface: OutboundServiceFacade
      Method orchestrates the services to build the payload and to integrate with restful endpoint.
      Specified by:
      send in interface OutboundServiceFacade
      Parameters:
      parameters - a parameter object holding data about the item synchronization request
      Returns:
      rx.Observable which allows the caller to subscribe the callback method that provides result of the item sending.