Package io.fabric8.mockwebserver.crud
Class CrudDispatcher
- java.lang.Object
-
- io.fabric8.mockwebserver.http.Dispatcher
-
- io.fabric8.mockwebserver.crud.CrudDispatcher
-
public class CrudDispatcher extends Dispatcher
-
-
Field Summary
Fields Modifier and Type Field Description protected AttributeExtractorattributeExtractorprotected Contextcontextprotected Map<AttributeSet,String>mapprotected ResponseComposerresponseComposer
-
Constructor Summary
Constructors Constructor Description CrudDispatcher(Context context, AttributeExtractor attributeExtractor, ResponseComposer responseComposer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MockResponsedispatch(RecordedRequest request)Returns a response to satisfyrequest.AttributeExtractorgetAttributeExtractor()Map<AttributeSet,String>getMap()ResponseComposergetResponseComposer()MockResponsehandleCreate(RecordedRequest request)MockResponsehandleCreate(String path, String body)Adds the specified object to the in-memory db.MockResponsehandleDelete(String path)Performs a delete for the corresponding object from the in-memory db.MockResponsehandleGet(String path)Performs a get for the corresponding object from the in-memory db.MockResponsehandlePatch(RecordedRequest request)MockResponsehandlePatch(String path, String body)Patches the specified object to the in-memory db.MockResponsehandleUpdate(RecordedRequest request)MockResponsehandleUpdate(String path, String body)Updates the specified object to the in-memory db.-
Methods inherited from class io.fabric8.mockwebserver.http.Dispatcher
shutdown
-
-
-
-
Field Detail
-
map
protected final Map<AttributeSet,String> map
-
context
protected final Context context
-
attributeExtractor
protected final AttributeExtractor attributeExtractor
-
responseComposer
protected final ResponseComposer responseComposer
-
-
Constructor Detail
-
CrudDispatcher
public CrudDispatcher(Context context, AttributeExtractor attributeExtractor, ResponseComposer responseComposer)
-
-
Method Detail
-
dispatch
public MockResponse dispatch(RecordedRequest request)
Description copied from class:DispatcherReturns a response to satisfyrequest. This method may block (for instance, to wait on a CountdownLatch).- Specified by:
dispatchin classDispatcher
-
handleCreate
public MockResponse handleCreate(RecordedRequest request)
-
handleCreate
public MockResponse handleCreate(String path, String body)
Adds the specified object to the in-memory db.- Parameters:
path- for the request.body- Request body as String (UTF-8).- Returns:
- a MockResponse to be dispatched.
-
handlePatch
public MockResponse handlePatch(RecordedRequest request)
-
handlePatch
public MockResponse handlePatch(String path, String body)
Patches the specified object to the in-memory db.- Parameters:
path- for the request.body- Request body as String (UTF-8).- Returns:
- a MockResponse to be dispatched.
-
handleUpdate
public MockResponse handleUpdate(RecordedRequest request)
-
handleUpdate
public MockResponse handleUpdate(String path, String body)
Updates the specified object to the in-memory db.- Parameters:
path- for the request.body- Request body as String (UTF-8).- Returns:
- a MockResponse to be dispatched.
-
handleGet
public MockResponse handleGet(String path)
Performs a get for the corresponding object from the in-memory db.- Parameters:
path- for the request.- Returns:
- a MockResponse to be dispatched.
-
handleDelete
public MockResponse handleDelete(String path)
Performs a delete for the corresponding object from the in-memory db.- Parameters:
path- for the request.- Returns:
- a MockResponse to be dispatched.
-
getMap
public Map<AttributeSet,String> getMap()
-
getAttributeExtractor
public AttributeExtractor getAttributeExtractor()
-
getResponseComposer
public ResponseComposer getResponseComposer()
-
-