mockserver-client 1.0.8.pre → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -1
- data/Gemfile.lock +79 -0
- data/README.md +89 -229
- data/Rakefile +8 -8
- data/docs/Body.md +7 -0
- data/docs/BodyWithContentType.md +7 -0
- data/docs/ConnectionOptions.md +12 -0
- data/docs/ControlApi.md +269 -0
- data/docs/Delay.md +9 -0
- data/docs/Expectation.md +7 -0
- data/docs/ExpectationApi.md +51 -0
- data/docs/Expectations.md +7 -0
- data/docs/HttpClassCallback.md +8 -0
- data/docs/HttpError.md +10 -0
- data/docs/HttpForward.md +11 -0
- data/docs/HttpObjectCallback.md +8 -0
- data/docs/HttpOverrideForwardedRequest.md +9 -0
- data/docs/HttpRequest.md +15 -0
- data/docs/HttpResponse.md +14 -0
- data/docs/HttpTemplate.md +10 -0
- data/docs/KeyToMultiValue.md +7 -0
- data/docs/KeyToValue.md +7 -0
- data/docs/Ports.md +8 -0
- data/docs/TimeToLive.md +10 -0
- data/docs/Times.md +9 -0
- data/docs/Verification.md +9 -0
- data/docs/VerificationSequence.md +8 -0
- data/docs/VerificationTimes.md +9 -0
- data/docs/VerifyApi.md +94 -0
- data/lib/mockserver-client.rb +62 -15
- data/lib/mockserver-client/api/control_api.rb +316 -0
- data/lib/mockserver-client/api/expectation_api.rb +73 -0
- data/lib/mockserver-client/api/verify_api.rb +127 -0
- data/lib/mockserver-client/api_client.rb +388 -0
- data/lib/mockserver-client/api_error.rb +38 -0
- data/lib/mockserver-client/configuration.rb +202 -0
- data/lib/mockserver-client/models/body.rb +174 -0
- data/lib/mockserver-client/models/body_with_content_type.rb +174 -0
- data/lib/mockserver-client/models/connection_options.rb +219 -0
- data/lib/mockserver-client/models/delay.rb +192 -0
- data/lib/mockserver-client/models/expectation.rb +174 -0
- data/lib/mockserver-client/models/expectations.rb +174 -0
- data/lib/mockserver-client/models/http_class_callback.rb +183 -0
- data/lib/mockserver-client/models/http_error.rb +201 -0
- data/lib/mockserver-client/models/http_forward.rb +244 -0
- data/lib/mockserver-client/models/http_object_callback.rb +183 -0
- data/lib/mockserver-client/models/http_override_forwarded_request.rb +192 -0
- data/lib/mockserver-client/models/http_request.rb +246 -0
- data/lib/mockserver-client/models/http_response.rb +237 -0
- data/lib/mockserver-client/models/http_template.rb +235 -0
- data/lib/mockserver-client/models/key_to_multi_value.rb +174 -0
- data/lib/mockserver-client/models/key_to_value.rb +174 -0
- data/lib/mockserver-client/models/ports.rb +185 -0
- data/lib/mockserver-client/models/time_to_live.rb +235 -0
- data/lib/mockserver-client/models/times.rb +192 -0
- data/lib/mockserver-client/models/verification.rb +192 -0
- data/lib/mockserver-client/models/verification_sequence.rb +185 -0
- data/lib/mockserver-client/models/verification_times.rb +192 -0
- data/lib/mockserver-client/version.rb +15 -0
- data/mockserver-client.gemspec +44 -36
- data/spec/api/control_api_spec.rb +102 -0
- data/spec/api/expectation_api_spec.rb +46 -0
- data/spec/api/verify_api_spec.rb +57 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/body_spec.rb +35 -0
- data/spec/models/body_with_content_type_spec.rb +35 -0
- data/spec/models/connection_options_spec.rb +65 -0
- data/spec/models/delay_spec.rb +47 -0
- data/spec/models/expectation_spec.rb +35 -0
- data/spec/models/expectations_spec.rb +35 -0
- data/spec/models/http_class_callback_spec.rb +41 -0
- data/spec/models/http_error_spec.rb +53 -0
- data/spec/models/http_forward_spec.rb +63 -0
- data/spec/models/http_object_callback_spec.rb +41 -0
- data/spec/models/http_override_forwarded_request_spec.rb +47 -0
- data/spec/models/http_request_spec.rb +83 -0
- data/spec/models/http_response_spec.rb +77 -0
- data/spec/models/http_template_spec.rb +57 -0
- data/spec/models/key_to_multi_value_spec.rb +35 -0
- data/spec/models/key_to_value_spec.rb +35 -0
- data/spec/models/ports_spec.rb +41 -0
- data/spec/models/time_to_live_spec.rb +57 -0
- data/spec/models/times_spec.rb +47 -0
- data/spec/models/verification_sequence_spec.rb +41 -0
- data/spec/models/verification_spec.rb +47 -0
- data/spec/models/verification_times_spec.rb +47 -0
- data/spec/spec_helper.rb +103 -53
- metadata +225 -158
- data/.gitignore +0 -21
- data/.rubocop.yml +0 -7
- data/bin/mockserver +0 -9
- data/lib/cli.rb +0 -146
- data/lib/mockserver/abstract_client.rb +0 -111
- data/lib/mockserver/mock_server_client.rb +0 -46
- data/lib/mockserver/model/array_of.rb +0 -85
- data/lib/mockserver/model/body.rb +0 -56
- data/lib/mockserver/model/cookie.rb +0 -36
- data/lib/mockserver/model/delay.rb +0 -34
- data/lib/mockserver/model/enum.rb +0 -47
- data/lib/mockserver/model/expectation.rb +0 -139
- data/lib/mockserver/model/forward.rb +0 -41
- data/lib/mockserver/model/header.rb +0 -43
- data/lib/mockserver/model/parameter.rb +0 -43
- data/lib/mockserver/model/request.rb +0 -81
- data/lib/mockserver/model/response.rb +0 -45
- data/lib/mockserver/model/times.rb +0 -61
- data/lib/mockserver/proxy_client.rb +0 -9
- data/lib/mockserver/utility_methods.rb +0 -59
- data/lib/mockserver/version.rb +0 -5
- data/pom.xml +0 -118
- data/spec/fixtures/forward_mockserver.json +0 -7
- data/spec/fixtures/incorrect_login_response.json +0 -20
- data/spec/fixtures/post_login_request.json +0 -22
- data/spec/fixtures/register_expectation.json +0 -50
- data/spec/fixtures/retrieved_request.json +0 -22
- data/spec/fixtures/search_request.json +0 -6
- data/spec/fixtures/times_once.json +0 -6
- data/spec/integration/mock_client_integration_spec.rb +0 -82
- data/spec/mockserver/builder_spec.rb +0 -90
- data/spec/mockserver/mock_client_spec.rb +0 -80
- data/spec/mockserver/proxy_client_spec.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78cecf99392693da9d10a7e638e1cc0b6c2ef499
|
4
|
+
data.tar.gz: 405fb05b09c13e62df825c3c9badea9f9be3ec97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83e4ac08844b4dfa0bc2edee4f8fab1b5f8c07826e7b8af644275d4ca71c3a2f573854d064baf996a071d6e9a166bca2eda6ddd1204c7993708ac7f0616bb737
|
7
|
+
data.tar.gz: 7ebefc74dba04037c95fb072c8fd4bd0faa8a7bdf81981205ae11e82993b3b0ac9833c64ef9f254d7ab273bc224e7f58e5ed7212e933caa8c097167c95cb4b4d
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mockserver-client (5.3.0)
|
5
|
+
json (~> 2.1, >= 2.1.0)
|
6
|
+
typhoeus (~> 1.0, >= 1.0.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ZenTest (4.11.1)
|
12
|
+
addressable (2.5.2)
|
13
|
+
public_suffix (>= 2.0.2, < 4.0)
|
14
|
+
autotest (4.4.6)
|
15
|
+
ZenTest (>= 4.4.1)
|
16
|
+
autotest-fsevent (0.2.13)
|
17
|
+
sys-uname
|
18
|
+
autotest-growl (0.2.16)
|
19
|
+
autotest-rails-pure (4.1.2)
|
20
|
+
byebug (10.0.2)
|
21
|
+
coderay (1.1.2)
|
22
|
+
crack (0.4.3)
|
23
|
+
safe_yaml (~> 1.0.0)
|
24
|
+
diff-lcs (1.3)
|
25
|
+
ethon (0.11.0)
|
26
|
+
ffi (>= 1.3.0)
|
27
|
+
ffi (1.9.25)
|
28
|
+
hashdiff (0.3.7)
|
29
|
+
json (2.1.0)
|
30
|
+
method_source (0.9.0)
|
31
|
+
pry (0.11.3)
|
32
|
+
coderay (~> 1.1.0)
|
33
|
+
method_source (~> 0.9.0)
|
34
|
+
pry-byebug (3.6.0)
|
35
|
+
byebug (~> 10.0)
|
36
|
+
pry (~> 0.10)
|
37
|
+
public_suffix (3.0.3)
|
38
|
+
rake (12.0.0)
|
39
|
+
rspec (3.8.0)
|
40
|
+
rspec-core (~> 3.8.0)
|
41
|
+
rspec-expectations (~> 3.8.0)
|
42
|
+
rspec-mocks (~> 3.8.0)
|
43
|
+
rspec-core (3.8.0)
|
44
|
+
rspec-support (~> 3.8.0)
|
45
|
+
rspec-expectations (3.8.1)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.8.0)
|
48
|
+
rspec-mocks (3.8.0)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.8.0)
|
51
|
+
rspec-support (3.8.0)
|
52
|
+
safe_yaml (1.0.4)
|
53
|
+
sys-uname (1.0.3)
|
54
|
+
ffi (>= 1.0.0)
|
55
|
+
typhoeus (1.3.0)
|
56
|
+
ethon (>= 0.9.0)
|
57
|
+
vcr (3.0.3)
|
58
|
+
webmock (1.24.6)
|
59
|
+
addressable (>= 2.3.6)
|
60
|
+
crack (>= 0.3.2)
|
61
|
+
hashdiff
|
62
|
+
|
63
|
+
PLATFORMS
|
64
|
+
ruby
|
65
|
+
|
66
|
+
DEPENDENCIES
|
67
|
+
autotest (~> 4.4, >= 4.4.6)
|
68
|
+
autotest-fsevent (~> 0.2, >= 0.2.12)
|
69
|
+
autotest-growl (~> 0.2, >= 0.2.16)
|
70
|
+
autotest-rails-pure (~> 4.1, >= 4.1.2)
|
71
|
+
mockserver-client!
|
72
|
+
pry-byebug
|
73
|
+
rake (~> 12.0.0)
|
74
|
+
rspec (~> 3.6, >= 3.6.0)
|
75
|
+
vcr (~> 3.0, >= 3.0.1)
|
76
|
+
webmock (~> 1.24, >= 1.24.3)
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
1.16.1
|
data/README.md
CHANGED
@@ -1,260 +1,120 @@
|
|
1
|
-
#
|
1
|
+
# mockserver-client
|
2
2
|
|
3
|
-
|
3
|
+
MockServer - the Ruby gem for the Mock Server API
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
gem 'mockserver-client'
|
11
|
-
```
|
5
|
+
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby and a simple REST API (as shown below).
|
12
6
|
|
13
|
-
|
7
|
+
MockServer Proxy is a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
|
14
8
|
|
15
|
-
|
16
|
-
bundle
|
17
|
-
```
|
9
|
+
Both MockServer and the MockServer Proxy record all received requests so that it is possible to verify exactly what requests have been sent by the system under test.
|
18
10
|
|
19
|
-
|
11
|
+
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
- API version: 5.3.0
|
14
|
+
- Package version: 5.3.0
|
15
|
+
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
24
16
|
|
25
|
-
##
|
17
|
+
## Installation
|
26
18
|
|
27
|
-
|
19
|
+
### Build a gem
|
28
20
|
|
29
|
-
|
30
|
-
include MockServer
|
31
|
-
include MockServer::Model::DSL
|
32
|
-
```
|
21
|
+
To build the Ruby code into a gem:
|
33
22
|
|
34
|
-
|
35
|
-
|
36
|
-
##### Java
|
37
|
-
|
38
|
-
```java
|
39
|
-
new MockServerClient("localhost", 9999)
|
40
|
-
.when(
|
41
|
-
request()
|
42
|
-
.withMethod("POST")
|
43
|
-
.withPath("/login")
|
44
|
-
.withQueryStringParameters(
|
45
|
-
new Parameter("returnUrl", "/account")
|
46
|
-
)
|
47
|
-
.withCookies(
|
48
|
-
new Cookie("sessionId", "2By8LOhBmaW5nZXJwcmludCIlMDAzMW")
|
49
|
-
)
|
50
|
-
.withBody("{username: 'foo', password: 'bar'}"),
|
51
|
-
Times.exactly(1)
|
52
|
-
)
|
53
|
-
.respond(
|
54
|
-
response()
|
55
|
-
.withStatusCode(401)
|
56
|
-
.withHeaders(
|
57
|
-
new Header("Content-Type", "application/json; charset=utf-8"),
|
58
|
-
new Header("Cache-Control", "public, max-age=86400")
|
59
|
-
)
|
60
|
-
.withBody("{ message: 'incorrect username and password combination' }")
|
61
|
-
.withDelay(new Delay(TimeUnit.SECONDS, 1))
|
62
|
-
);
|
23
|
+
```shell
|
24
|
+
gem build mockserver-client.gemspec
|
63
25
|
```
|
64
26
|
|
65
|
-
|
27
|
+
Then either install the gem locally:
|
66
28
|
|
67
|
-
```
|
68
|
-
|
69
|
-
expectation = expectation do |expectation|
|
70
|
-
expectation.request do |request|
|
71
|
-
request.method = 'POST'
|
72
|
-
request.path = '/login'
|
73
|
-
request.query_string_parameters << parameter('returnUrl', '/account')
|
74
|
-
request.cookies = [cookie('sessionId', '2By8LOhBmaW5nZXJwcmludCIlMDAzMW')]
|
75
|
-
request.body = exact("{username: 'foo', password: 'bar'}")
|
76
|
-
end
|
77
|
-
|
78
|
-
expectation.response do |response|
|
79
|
-
response.status_code = 401
|
80
|
-
response.headers << header('Content-Type', 'application/json; charset=utf-8')
|
81
|
-
response.headers << header('Cache-Control', 'public, max-age=86400')
|
82
|
-
response.body = body("{ message: 'incorrect username and password combination' }")
|
83
|
-
response.delay = delay_by(:SECONDS, 1)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
client.register(expectation)
|
29
|
+
```shell
|
30
|
+
gem install ./mockserver-client-5.3.0.gem
|
87
31
|
```
|
32
|
+
(for development, run `gem install --dev ./mockserver-client-5.3.0.gem` to install the development dependencies)
|
88
33
|
|
89
|
-
|
34
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
90
35
|
|
91
|
-
|
36
|
+
Finally add this to the Gemfile:
|
92
37
|
|
93
|
-
|
94
|
-
mockServerClient.clear(
|
95
|
-
request()
|
96
|
-
.withMethod("POST")
|
97
|
-
.withPath("/login")
|
98
|
-
);
|
99
|
-
mockServerClient.reset();
|
100
|
-
```
|
101
|
-
|
102
|
-
##### Ruby
|
103
|
-
|
104
|
-
```ruby
|
105
|
-
client.clear(request('POST', '/login'))
|
106
|
-
client.reset
|
107
|
-
```
|
108
|
-
### Verifying Behavior
|
109
|
-
|
110
|
-
##### Java
|
111
|
-
|
112
|
-
```java
|
113
|
-
new ProxyClient("localhost", 9090).verify(
|
114
|
-
request()
|
115
|
-
.withMethod("POST")
|
116
|
-
.withPath("/login")
|
117
|
-
.withBody(exact("{username: 'foo', password: 'bar'}"))
|
118
|
-
.withCookies(
|
119
|
-
new Cookie("sessionId", ".*")
|
120
|
-
),
|
121
|
-
Times.exactly(1)
|
122
|
-
);
|
123
|
-
```
|
38
|
+
gem 'mockserver-client', '~> 5.3.0'
|
124
39
|
|
125
|
-
|
40
|
+
### Install from Git
|
126
41
|
|
127
|
-
|
128
|
-
# Not providing times here because the default is exactly(1) i.e. the second argument to verify method
|
129
|
-
ProxyClient.new('localhost', 9090).verify(request(:POST, '/login') do |request|
|
130
|
-
request.body = exact("{username: 'foo', password: 'bar'}")
|
131
|
-
request.cookies = [cookie("sessionId", ".*")]
|
132
|
-
end)
|
133
|
-
```
|
42
|
+
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
|
134
43
|
|
44
|
+
gem 'mockserver-client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
|
135
45
|
|
136
|
-
###
|
46
|
+
### Include the Ruby code directly
|
137
47
|
|
138
|
-
|
48
|
+
Include the Ruby code directly using `-I` as follows:
|
139
49
|
|
140
|
-
```
|
141
|
-
|
142
|
-
request()
|
143
|
-
.withMethod("POST")
|
144
|
-
.withPath("/login")
|
145
|
-
);
|
50
|
+
```shell
|
51
|
+
ruby -Ilib script.rb
|
146
52
|
```
|
147
53
|
|
148
|
-
|
54
|
+
## Getting Started
|
149
55
|
|
56
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
150
57
|
```ruby
|
151
|
-
#
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
* **exact**: Create a body of type `STRING`. Example: `exact('{"reason": "unauthorized"}')`.
|
165
|
-
* **regex**: Create a body of type `REGEX`. Example: `regex('username[a-z]{4}')`.
|
166
|
-
* **xpath**: Used to create a body of type `XPATH`. Example: `xpath("/element[key = 'some_key' and value = 'some_value']")`.
|
167
|
-
* **parameterized**; Create a body to type `PARAMETERS`. Example `parameterized(parameter('someValue', 1, 2), parameter('otherValue', 4, 5))`.
|
168
|
-
|
169
|
-
Parameters
|
170
|
-
* **parameter**: Create a generic parameter. Example: `parameter('key', 'value1' , 'value2')`.
|
171
|
-
* **cookie**: Create a cookie (same as `parameter` above but exists as syntactic sugar). Example: `cookie('sessionId', 'sessionid1ldj')`.
|
172
|
-
* **header**: Create a header (same as `parameter` above but exists as syntactic sugar). Example: `header('Content-Type', 'application/json')`.
|
173
|
-
|
174
|
-
Forward
|
175
|
-
* **forward**: Create a forwarding response. If a block is passed, will configure forward response first and then return the configured object. Example: `forward {|f| f.scheme = 'HTTPS' }`.
|
176
|
-
* **http_forward**: Alias for `forward`.
|
177
|
-
|
178
|
-
Response
|
179
|
-
* **response**: Create a response object. If a block is passed, will configure response first and then return the configured response. Example: `response {|r| r.status_code = 201 }`.
|
180
|
-
* **http_response**: Alias for `response`.
|
181
|
-
|
182
|
-
Delay
|
183
|
-
* **delay_by**. Create a delay object in a response. Example : `delay_by(:MICROSECONDS, 20)`.
|
184
|
-
|
185
|
-
Times (used in Expectation)
|
186
|
-
* **times**: Create an 'times' object. If a block is passed, will configure the object first before returning it. Example: `times {|t| t.unlimited = false }`.
|
187
|
-
* **unlimited**: Create an object with unlimited repeats. Example: `unlimited()`. (No parameters).
|
188
|
-
* **once**. Create an object that repeats only once. Example: `once()`. (No parameters).
|
189
|
-
* **exactly**. Create an object that repeats exactly the number of times specified. Example: `exactly(2)`.
|
190
|
-
* **at_least**: Create an object that repeats at least the given number of times. (Use in verify). Example: `at_least(2)`.
|
191
|
-
|
192
|
-
Expectation (use in register)
|
193
|
-
* **expectation**: Create an expectation object. If a block is passed, will configure the object first before returning it. Example: `expectation {|e| e.request {|r| r.path = "index.html} }`.
|
194
|
-
Getter methods for `request`, `response` and `forward` methods will optionally accept a block. If block is passed object is configured before it is returned. The attribute `times` has conventional getter and setter methods.
|
195
|
-
|
196
|
-
## CLI
|
197
|
-
|
198
|
-
This gem comes with a command line interface which allow you to run the Mock Server calls from the command line. When this gem is installed, you will have the `mockserver` executable on your PATH. Type `mockserver --help` and you will get this output:
|
199
|
-
|
200
|
-
```bash
|
201
|
-
mockserver --help
|
202
|
-
|
203
|
-
Commands:
|
204
|
-
mockserver clear # Clears all stored mock request/responses from server.
|
205
|
-
mockserver dump_log # Dumps the matching request to the mock server logs.
|
206
|
-
mockserver help [COMMAND] # Describe available commands or one specific command
|
207
|
-
mockserver register # Register an expectation with the mock server.
|
208
|
-
mockserver reset # Resets the server clearing all data.
|
209
|
-
mockserver retrieve # Retrieve the list of requests that have been made to the mock/proxy server.
|
210
|
-
mockserver verify # Verify that a request has been made the specified number of times to the server.
|
211
|
-
|
212
|
-
Options:
|
213
|
-
-h, --host=HOST # The host for the MockServer client.
|
214
|
-
# Default: localhost
|
215
|
-
-p, --port=N # The port for the MockServer client.
|
216
|
-
# Default: 8080
|
217
|
-
-d, [--data=DATA] # A JSON or YAML file containing the request payload.
|
218
|
-
```
|
219
|
-
|
220
|
-
To get help for an individual command, e.g. `dump_log`, you would do:
|
221
|
-
|
222
|
-
```bash
|
223
|
-
mockserver --help dump_log
|
224
|
-
|
225
|
-
Usage:
|
226
|
-
mockserver dump_log
|
227
|
-
|
228
|
-
Options:
|
229
|
-
-j, [--java], [--no-java] # A switch to turn Java format for logs on/off.
|
230
|
-
-h, --host=HOST # The host for the MockServer client.
|
231
|
-
# Default: localhost
|
232
|
-
-p, --port=N # The port for the MockServer client.
|
233
|
-
# Default: 8080
|
234
|
-
-d, [--data=DATA] # A JSON or YAML file containing the request payload.
|
235
|
-
|
236
|
-
Dumps the matching request to the mock server logs.
|
237
|
-
```
|
238
|
-
|
239
|
-
Here is an example on how you would run the command:
|
240
|
-
|
241
|
-
```bash
|
242
|
-
mockserver dump_log -j true
|
243
|
-
|
244
|
-
Running with parameters:
|
245
|
-
host: localhost
|
246
|
-
port: 8080
|
247
|
-
java: true
|
58
|
+
# Load the gem
|
59
|
+
require 'mockserver-client'
|
60
|
+
|
61
|
+
api_instance = MockServer::ControlApi.new
|
62
|
+
ports = MockServer::Ports.new # Ports | list of ports to bind to, where 0 indicates dynamically bind to any available port
|
63
|
+
|
64
|
+
begin
|
65
|
+
#bind additional listening ports
|
66
|
+
result = api_instance.bind_put(ports)
|
67
|
+
p result
|
68
|
+
rescue MockServer::ApiError => e
|
69
|
+
puts "Exception when calling ControlApi->bind_put: #{e}"
|
70
|
+
end
|
248
71
|
|
249
|
-
[2014-06-21 09:23:32] DEBUG [MockServerClient] Sending dump log request to mockserver
|
250
|
-
[2014-06-21 09:23:32] DEBUG [MockServerClient] URL: /dumpToLog?type=java. Payload: {}
|
251
|
-
[2014-06-21 09:23:32] DEBUG [MockServerClient] Got dump to log response: 202
|
252
72
|
```
|
253
73
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
74
|
+
## Documentation for API Endpoints
|
75
|
+
|
76
|
+
All URIs are relative to *http://localhost:1080*
|
77
|
+
|
78
|
+
Class | Method | HTTP request | Description
|
79
|
+
------------ | ------------- | ------------- | -------------
|
80
|
+
*MockServer::ControlApi* | [**bind_put**](docs/ControlApi.md#bind_put) | **PUT** /bind | bind additional listening ports
|
81
|
+
*MockServer::ControlApi* | [**clear_put**](docs/ControlApi.md#clear_put) | **PUT** /clear | clears expectations and recorded requests that match the request matcher
|
82
|
+
*MockServer::ControlApi* | [**reset_put**](docs/ControlApi.md#reset_put) | **PUT** /reset | clears all expectations and recorded requests
|
83
|
+
*MockServer::ControlApi* | [**retrieve_put**](docs/ControlApi.md#retrieve_put) | **PUT** /retrieve | retrieve recorded requests, active expectations, recorded expectations or log messages
|
84
|
+
*MockServer::ControlApi* | [**status_put**](docs/ControlApi.md#status_put) | **PUT** /status | return listening ports
|
85
|
+
*MockServer::ControlApi* | [**stop_put**](docs/ControlApi.md#stop_put) | **PUT** /stop | stop running process
|
86
|
+
*MockServer::ExpectationApi* | [**expectation_put**](docs/ExpectationApi.md#expectation_put) | **PUT** /expectation | create expectation
|
87
|
+
*MockServer::VerifyApi* | [**verify_put**](docs/VerifyApi.md#verify_put) | **PUT** /verify | verify a request has been received a specific number of times
|
88
|
+
*MockServer::VerifyApi* | [**verify_sequence_put**](docs/VerifyApi.md#verify_sequence_put) | **PUT** /verifySequence | verify a sequence of request has been received in the specific order
|
89
|
+
|
90
|
+
|
91
|
+
## Documentation for Models
|
92
|
+
|
93
|
+
- [MockServer::Body](docs/Body.md)
|
94
|
+
- [MockServer::BodyWithContentType](docs/BodyWithContentType.md)
|
95
|
+
- [MockServer::ConnectionOptions](docs/ConnectionOptions.md)
|
96
|
+
- [MockServer::Delay](docs/Delay.md)
|
97
|
+
- [MockServer::Expectation](docs/Expectation.md)
|
98
|
+
- [MockServer::Expectations](docs/Expectations.md)
|
99
|
+
- [MockServer::HttpClassCallback](docs/HttpClassCallback.md)
|
100
|
+
- [MockServer::HttpError](docs/HttpError.md)
|
101
|
+
- [MockServer::HttpForward](docs/HttpForward.md)
|
102
|
+
- [MockServer::HttpObjectCallback](docs/HttpObjectCallback.md)
|
103
|
+
- [MockServer::HttpOverrideForwardedRequest](docs/HttpOverrideForwardedRequest.md)
|
104
|
+
- [MockServer::HttpRequest](docs/HttpRequest.md)
|
105
|
+
- [MockServer::HttpResponse](docs/HttpResponse.md)
|
106
|
+
- [MockServer::HttpTemplate](docs/HttpTemplate.md)
|
107
|
+
- [MockServer::KeyToMultiValue](docs/KeyToMultiValue.md)
|
108
|
+
- [MockServer::KeyToValue](docs/KeyToValue.md)
|
109
|
+
- [MockServer::Ports](docs/Ports.md)
|
110
|
+
- [MockServer::TimeToLive](docs/TimeToLive.md)
|
111
|
+
- [MockServer::Times](docs/Times.md)
|
112
|
+
- [MockServer::Verification](docs/Verification.md)
|
113
|
+
- [MockServer::VerificationSequence](docs/VerificationSequence.md)
|
114
|
+
- [MockServer::VerificationTimes](docs/VerificationTimes.md)
|
115
|
+
|
116
|
+
|
117
|
+
## Documentation for Authorization
|
118
|
+
|
119
|
+
All endpoints do not require authorization.
|
259
120
|
|
260
|
-
Pull requests are, of course, very welcome! Please read our [contributing to the project](https://github.com/jamesdbloom/mockserver/wiki/Contributing-to-the-project) guide first. Then head over to the [open issues](https://github.com/jamesdbloom/mockserver/issues?state=open) to see what we need help with. Make sure you let us know if you intend to work on something. Also, check out the [milestones](https://github.com/jamesdbloom/mockserver/issues/milestones) to see what is planned for future releases.
|