Class TestOutboundFacade

    • Constructor Summary

      Constructors 
      Constructor Description
      TestOutboundFacade()
      Instantiates this facade, which by default, if nothing else is specified will respond with the CREATED status and an empty body.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void after()  
      TestOutboundFacade doAndRespondWith​(org.springframework.http.ResponseEntity.HeadersBuilder builder, java.lang.Runnable act)
      Specifies to perform an action before return the specified response from the send(ItemModel, String, String) method.
      int invocations()  
      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.
      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
      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.
      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.
      rx.Observable<org.springframework.http.ResponseEntity<java.util.Map>> send​(ItemModel itemModel, java.lang.String integrationObjectCode, java.lang.String destination)
      Method orchestrates the services to build the payload and to integrate with restful endpoint.
      rx.Observable<org.springframework.http.ResponseEntity<java.util.Map>> send​(SyncParameters parameters)
      Method orchestrates the services to build the payload and to integrate with restful endpoint.
      TestOutboundFacade throwException​(java.lang.RuntimeException e)
      Specifies to throw an exception when this facade's send(ItemModel, String, String) method is called.
      • Methods inherited from class org.junit.rules.ExternalResource

        apply, before
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestOutboundFacade

        public TestOutboundFacade()
        Instantiates this facade, which by default, if nothing else is specified will respond with the CREATED status and an empty body.
    • Method Detail

      • 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​(java.lang.RuntimeException e)
        Specifies to throw an exception when this facade's send(ItemModel, String, String) method is called.
        Parameters:
        e - an exception to throw
        Returns:
        facade with the behavior applied
      • doAndRespondWith

        public TestOutboundFacade doAndRespondWith​(org.springframework.http.ResponseEntity.HeadersBuilder builder,
                                                   java.lang.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<java.util.Map>> send​(ItemModel itemModel,
                                                                                          java.lang.String integrationObjectCode,
                                                                                          java.lang.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<java.util.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.
      • invocations

        public int invocations()
      • after

        protected void after()
        Overrides:
        after in class org.junit.rules.ExternalResource