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
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.outboundservices.util.OutboundInvocationTracker
OutboundInvocationTracker.EntityResponse<R>, OutboundInvocationTracker.ExceptionResponse -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.http.ResponseEntity<Map>Creates an instance of the response to be used by default.doAndRespondWith(org.springframework.http.ResponseEntity.HeadersBuilder builder, Runnable act) Specifies to perform an action before return the specified response from thesend(ItemModel, String, String)method.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.Specifies to respond with HTTP 201 Created to all requests it receives, unless this spec is overridden then by a subsequent call to arespondWith...orthrowExceptionmethodSpecifies 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.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<Map>>Method orchestrates the services to build the payload and to integrate with restful endpoint.rx.Observable<org.springframework.http.ResponseEntity<Map>>send(SyncParameters parameters) Method orchestrates the services to build the payload and to integrate with restful endpoint.Specifies to throw an exception when the send method is called.Methods inherited from class de.hybris.platform.outboundservices.util.OutboundInvocationTracker
after, getAllInvocations, internalSend, invocations, itemsFromInvocationsTo, itemsFromInvocationsTo, keysFromInvocationsTo, performRunnableAndRespondWith, performRunnableAndRespondWith, respondWith, respondWith, respondWithMethods inherited from class org.junit.rules.ExternalResource
apply, beforeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.hybris.platform.outboundservices.facade.OutboundServiceFacade
sendBatch
-
Constructor Details
-
TestOutboundFacade
public TestOutboundFacade()
-
-
Method Details
-
createDefaultResponse
Description copied from class:OutboundInvocationTrackerCreates an instance of the response to be used by default.- Specified by:
createDefaultResponsein classOutboundInvocationTracker<TestOutboundFacade>- Returns:
- a response that should be returned from the send invocations when explicit response was not specified.
-
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
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
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
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
Description copied from class:OutboundInvocationTrackerSpecifies to throw an exception when the send method is called.- Overrides:
throwExceptionin classOutboundInvocationTracker<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 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<Map>> send(ItemModel itemModel, String integrationObjectCode, 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
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.
-