public abstract class MockCommand extends Object
{ "command" : "name of the command", "payload" : { } }
The response for the command will be delivered at its most basic level will be a JSON object consisting of the following fields:{ "status" : "ok", "payload" : { } }
For "non-successful" commands the object may be:{ "status" : "fail", "error" : "error description" }
To implement a new command you should subclass the MockCommand class and add implement the execute method. You must add the name of the command to the Command enum, and register the class in MockCommandDispatcher.| Modifier and Type | Class and Description |
|---|---|
static class |
MockCommand.Command |
| Constructor and Description |
|---|
MockCommand() |
| Modifier and Type | Method and Description |
|---|---|
abstract CommandStatus |
execute(CouchbaseMock mock,
MockCommand.Command command,
com.google.gson.JsonObject payload)
Execute the command
|
protected CommandStatus |
getResponse()
Get the response to send to the client.
|
@NotNull protected CommandStatus getResponse()
@NotNull public abstract CommandStatus execute(@NotNull CouchbaseMock mock, @NotNull MockCommand.Command command, @NotNull com.google.gson.JsonObject payload)
mock - the couchbase mock object to operate oncommand - the actual command being executed (in case a handler
implements multiple commandspayload - the payload containing arguments to the commandCopyright © 2017. All rights reserved.