Class TestOutboundFacade
- java.lang.Object
-
- org.junit.rules.ExternalResource
-
- de.hybris.platform.outboundservices.util.TestOutboundFacade
-
- All Implemented Interfaces:
OutboundServiceFacade,org.junit.rules.TestRule
public class TestOutboundFacade extends org.junit.rules.ExternalResource implements OutboundServiceFacade
-
-
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 voidafter()TestOutboundFacadedoAndRespondWith(org.springframework.http.ResponseEntity.HeadersBuilder builder, java.lang.Runnable act)Specifies to perform an action before return the specified response from thesend(ItemModel, String, String)method.intinvocations()TestOutboundFacaderespondWithBadRequest()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 arespondWith...orthrowExceptionmethod.TestOutboundFacaderespondWithCreated()Specifies to respond with HTTP 201 Created to all requests it receives, unless this spec is overridden then by a subsequent call to arespondWith...orthrowExceptionmethodTestOutboundFacaderespondWithNotFound()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 arespondWith...orthrowExceptionmethod.TestOutboundFacaderespondWithServerError()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 arespondWith...orthrowExceptionmethod.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.TestOutboundFacadethrowException(java.lang.RuntimeException e)Specifies to throw an exception when this facade'ssend(ItemModel, String, String)method is called.
-
-
-
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 arespondWith...orthrowExceptionmethod- 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 arespondWith...orthrowExceptionmethod.- 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 arespondWith...orthrowExceptionmethod.- 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 arespondWith...orthrowExceptionmethod.- Returns:
- facade with the response specification applied.
-
throwException
public TestOutboundFacade throwException(java.lang.RuntimeException e)
Specifies to throw an exception when this facade'ssend(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 thesend(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:OutboundServiceFacadeMethod orchestrates the services to build the payload and to integrate with restful endpoint.- Specified by:
sendin interfaceOutboundServiceFacade- Parameters:
itemModel- the model to be convertedintegrationObjectCode- the name of the integration object to convert this model as payloaddestination- 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:OutboundServiceFacadeMethod orchestrates the services to build the payload and to integrate with restful endpoint.- Specified by:
sendin interfaceOutboundServiceFacade- 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:
afterin classorg.junit.rules.ExternalResource
-
-