Update README.md

This commit is contained in:
Piotr Jagielski 2015-03-31 20:49:47 +02:00
parent b3c4ae2fab
commit 3763628379

View file

@ -14,7 +14,7 @@ java -jar mockserver-<VERSION>-jar-with-dependencies.jar [PORT]
## Create mock on server via client ## Create mock on server via client
``` ```java
RemoteMockServer remoteMockServer = new RemoteMockServer('localhost', <PORT>) RemoteMockServer remoteMockServer = new RemoteMockServer('localhost', <PORT>)
remoteMockServer.addMock(new AddMockRequestData( remoteMockServer.addMock(new AddMockRequestData(
name: '...', name: '...',
@ -32,7 +32,7 @@ remoteMockServer.addMock(new AddMockRequestData(
or via sending POST request to localhost:<PORT>/serverControl or via sending POST request to localhost:<PORT>/serverControl
``` ```xml
<addMock> <addMock>
<name>...</name> <name>...</name>
<path>...</path> <path>...</path>
@ -69,26 +69,26 @@ In closures input parameter (called req) contains properties:
Response if success: Response if success:
``` ```xml
<mockAdded/> <mockAdded/>
``` ```
Response with error message if failure: Response with error message if failure:
``` ```xml
<exceptionOccured>...</exceptionOccured> <exceptionOccured>...</exceptionOccured>
``` ```
## Mock could be peeked to get get report of its invocations. ## Mock could be peeked to get get report of its invocations.
Via client: Via client:
``` ```java
List<MockEvent> mockEvents = remoteMockServer.peekMock('...') List<MockEvent> mockEvents = remoteMockServer.peekMock('...')
``` ```
Via sending POST request to localhost:<PORT>/serverControl Via sending POST request to localhost:<PORT>/serverControl
``` ```xml
<peekMock> <peekMock>
<name>...</name> <name>...</name>
</peekMock> </peekMock>
@ -96,7 +96,7 @@ Via sending POST request to localhost:<PORT>/serverControl
Response if success: Response if success:
``` ```xml
<mockPeeked> <mockPeeked>
<mockEvent> <mockEvent>
<request> <request>
@ -129,20 +129,20 @@ Response if success:
Response with error message if failure: Response with error message if failure:
``` ```xml
<exceptionOccured>...</exceptionOccured> <exceptionOccured>...</exceptionOccured>
``` ```
## When mock was used it could be unregistered by name. It also returns report of mock invocations. ## When mock was used it could be unregistered by name. It also returns report of mock invocations.
Via client: Via client:
``` ```java
List<MockEvent> mockEvents = remoteMockServer.removeMock('...') List<MockEvent> mockEvents = remoteMockServer.removeMock('...')
``` ```
Via sending POST request to localhost:<PORT>/serverControl Via sending POST request to localhost:<PORT>/serverControl
``` ```xml
<removeMock> <removeMock>
<name>...</name> <name>...</name>
</removeMock> </removeMock>
@ -150,7 +150,7 @@ Via sending POST request to localhost:<PORT>/serverControl
Response if success: Response if success:
``` ```xml
<mockRemoved> <mockRemoved>
<mockEvent> <mockEvent>
<request> <request>
@ -183,7 +183,7 @@ Response if success:
Response with error message if failure: Response with error message if failure:
``` ```xml
<exceptionOccured>...</exceptionOccured> <exceptionOccured>...</exceptionOccured>
``` ```
@ -191,7 +191,7 @@ Response with error message if failure:
## List of current registered mocks could be retrieved: ## List of current registered mocks could be retrieved:
Via client: Via client:
``` ```java
List<RegisteredMock> mocks = remoteMockServer.listMocks() List<RegisteredMock> mocks = remoteMockServer.listMocks()
``` ```
@ -199,7 +199,7 @@ or via sending GET request to localhost:<PORT>/serverControl
Response: Response:
``` ```xml
<mocks> <mocks>
<mock> <mock>
<name>...</name> <name>...</name>