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
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
|
2
|
-
require 'bundler/gem_tasks'
|
3
|
-
require 'rubocop/rake_task'
|
4
|
-
require 'rspec/core/rake_task'
|
1
|
+
require "bundler/gem_tasks"
|
5
2
|
|
6
|
-
|
7
|
-
|
3
|
+
begin
|
4
|
+
require 'rspec/core/rake_task'
|
8
5
|
|
9
|
-
|
10
|
-
task default:
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
task default: :spec
|
8
|
+
rescue LoadError
|
9
|
+
# no rspec available
|
10
|
+
end
|
data/docs/Body.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# MockServer::ConnectionOptions
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**close_socket** | **BOOLEAN** | | [optional]
|
7
|
+
**content_length_header_override** | **Integer** | | [optional]
|
8
|
+
**suppress_content_length_header** | **BOOLEAN** | | [optional]
|
9
|
+
**suppress_connection_header** | **BOOLEAN** | | [optional]
|
10
|
+
**keep_alive_override** | **BOOLEAN** | | [optional]
|
11
|
+
|
12
|
+
|
data/docs/ControlApi.md
ADDED
@@ -0,0 +1,269 @@
|
|
1
|
+
# MockServer::ControlApi
|
2
|
+
|
3
|
+
All URIs are relative to *http://localhost:1080*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**bind_put**](ControlApi.md#bind_put) | **PUT** /bind | bind additional listening ports
|
8
|
+
[**clear_put**](ControlApi.md#clear_put) | **PUT** /clear | clears expectations and recorded requests that match the request matcher
|
9
|
+
[**reset_put**](ControlApi.md#reset_put) | **PUT** /reset | clears all expectations and recorded requests
|
10
|
+
[**retrieve_put**](ControlApi.md#retrieve_put) | **PUT** /retrieve | retrieve recorded requests, active expectations, recorded expectations or log messages
|
11
|
+
[**status_put**](ControlApi.md#status_put) | **PUT** /status | return listening ports
|
12
|
+
[**stop_put**](ControlApi.md#stop_put) | **PUT** /stop | stop running process
|
13
|
+
|
14
|
+
|
15
|
+
# **bind_put**
|
16
|
+
> Ports bind_put(ports)
|
17
|
+
|
18
|
+
bind additional listening ports
|
19
|
+
|
20
|
+
only supported on Netty version
|
21
|
+
|
22
|
+
### Example
|
23
|
+
```ruby
|
24
|
+
# load the gem
|
25
|
+
require 'mockserver-client'
|
26
|
+
|
27
|
+
api_instance = MockServer::ControlApi.new
|
28
|
+
ports = MockServer::Ports.new # Ports | list of ports to bind to, where 0 indicates dynamically bind to any available port
|
29
|
+
|
30
|
+
begin
|
31
|
+
#bind additional listening ports
|
32
|
+
result = api_instance.bind_put(ports)
|
33
|
+
p result
|
34
|
+
rescue MockServer::ApiError => e
|
35
|
+
puts "Exception when calling ControlApi->bind_put: #{e}"
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
### Parameters
|
40
|
+
|
41
|
+
Name | Type | Description | Notes
|
42
|
+
------------- | ------------- | ------------- | -------------
|
43
|
+
**ports** | [**Ports**](Ports.md)| list of ports to bind to, where 0 indicates dynamically bind to any available port |
|
44
|
+
|
45
|
+
### Return type
|
46
|
+
|
47
|
+
[**Ports**](Ports.md)
|
48
|
+
|
49
|
+
### Authorization
|
50
|
+
|
51
|
+
No authorization required
|
52
|
+
|
53
|
+
### HTTP request headers
|
54
|
+
|
55
|
+
- **Content-Type**: application/json
|
56
|
+
- **Accept**: application/json
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
# **clear_put**
|
61
|
+
> clear_put(opts)
|
62
|
+
|
63
|
+
clears expectations and recorded requests that match the request matcher
|
64
|
+
|
65
|
+
### Example
|
66
|
+
```ruby
|
67
|
+
# load the gem
|
68
|
+
require 'mockserver-client'
|
69
|
+
|
70
|
+
api_instance = MockServer::ControlApi.new
|
71
|
+
opts = {
|
72
|
+
http_request: MockServer::HttpRequest.new # HttpRequest | request used to match expectations and recored requests to clear
|
73
|
+
}
|
74
|
+
|
75
|
+
begin
|
76
|
+
#clears expectations and recorded requests that match the request matcher
|
77
|
+
api_instance.clear_put(opts)
|
78
|
+
rescue MockServer::ApiError => e
|
79
|
+
puts "Exception when calling ControlApi->clear_put: #{e}"
|
80
|
+
end
|
81
|
+
```
|
82
|
+
|
83
|
+
### Parameters
|
84
|
+
|
85
|
+
Name | Type | Description | Notes
|
86
|
+
------------- | ------------- | ------------- | -------------
|
87
|
+
**http_request** | [**HttpRequest**](HttpRequest.md)| request used to match expectations and recored requests to clear | [optional]
|
88
|
+
|
89
|
+
### Return type
|
90
|
+
|
91
|
+
nil (empty response body)
|
92
|
+
|
93
|
+
### Authorization
|
94
|
+
|
95
|
+
No authorization required
|
96
|
+
|
97
|
+
### HTTP request headers
|
98
|
+
|
99
|
+
- **Content-Type**: application/json
|
100
|
+
- **Accept**: Not defined
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
# **reset_put**
|
105
|
+
> reset_put
|
106
|
+
|
107
|
+
clears all expectations and recorded requests
|
108
|
+
|
109
|
+
### Example
|
110
|
+
```ruby
|
111
|
+
# load the gem
|
112
|
+
require 'mockserver-client'
|
113
|
+
|
114
|
+
api_instance = MockServer::ControlApi.new
|
115
|
+
|
116
|
+
begin
|
117
|
+
#clears all expectations and recorded requests
|
118
|
+
api_instance.reset_put
|
119
|
+
rescue MockServer::ApiError => e
|
120
|
+
puts "Exception when calling ControlApi->reset_put: #{e}"
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
### Parameters
|
125
|
+
This endpoint does not need any parameter.
|
126
|
+
|
127
|
+
### Return type
|
128
|
+
|
129
|
+
nil (empty response body)
|
130
|
+
|
131
|
+
### Authorization
|
132
|
+
|
133
|
+
No authorization required
|
134
|
+
|
135
|
+
### HTTP request headers
|
136
|
+
|
137
|
+
- **Content-Type**: Not defined
|
138
|
+
- **Accept**: Not defined
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
# **retrieve_put**
|
143
|
+
> Object retrieve_put(opts)
|
144
|
+
|
145
|
+
retrieve recorded requests, active expectations, recorded expectations or log messages
|
146
|
+
|
147
|
+
### Example
|
148
|
+
```ruby
|
149
|
+
# load the gem
|
150
|
+
require 'mockserver-client'
|
151
|
+
|
152
|
+
api_instance = MockServer::ControlApi.new
|
153
|
+
opts = {
|
154
|
+
format: 'format_example', # String | changes response format, default if not specificed is \"json\", supported values are \"java\", \"json\"
|
155
|
+
type: 'type_example', # String | specifies the type of object that is retrieve, default if not specified is \"requests\", supported values are \"logs\", \"requests\", \"recorded_expectations\", \"active_expectations\"
|
156
|
+
http_request: MockServer::HttpRequest.new # HttpRequest | request used to match which recorded requests, expectations or log messages to return, an empty body matches all requests, expectations or log messages
|
157
|
+
}
|
158
|
+
|
159
|
+
begin
|
160
|
+
#retrieve recorded requests, active expectations, recorded expectations or log messages
|
161
|
+
result = api_instance.retrieve_put(opts)
|
162
|
+
p result
|
163
|
+
rescue MockServer::ApiError => e
|
164
|
+
puts "Exception when calling ControlApi->retrieve_put: #{e}"
|
165
|
+
end
|
166
|
+
```
|
167
|
+
|
168
|
+
### Parameters
|
169
|
+
|
170
|
+
Name | Type | Description | Notes
|
171
|
+
------------- | ------------- | ------------- | -------------
|
172
|
+
**format** | **String**| changes response format, default if not specificed is \"json\", supported values are \"java\", \"json\" | [optional]
|
173
|
+
**type** | **String**| specifies the type of object that is retrieve, default if not specified is \"requests\", supported values are \"logs\", \"requests\", \"recorded_expectations\", \"active_expectations\" | [optional]
|
174
|
+
**http_request** | [**HttpRequest**](HttpRequest.md)| request used to match which recorded requests, expectations or log messages to return, an empty body matches all requests, expectations or log messages | [optional]
|
175
|
+
|
176
|
+
### Return type
|
177
|
+
|
178
|
+
**Object**
|
179
|
+
|
180
|
+
### Authorization
|
181
|
+
|
182
|
+
No authorization required
|
183
|
+
|
184
|
+
### HTTP request headers
|
185
|
+
|
186
|
+
- **Content-Type**: application/json
|
187
|
+
- **Accept**: application/json, application/java, text/plain
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
# **status_put**
|
192
|
+
> Ports status_put
|
193
|
+
|
194
|
+
return listening ports
|
195
|
+
|
196
|
+
### Example
|
197
|
+
```ruby
|
198
|
+
# load the gem
|
199
|
+
require 'mockserver-client'
|
200
|
+
|
201
|
+
api_instance = MockServer::ControlApi.new
|
202
|
+
|
203
|
+
begin
|
204
|
+
#return listening ports
|
205
|
+
result = api_instance.status_put
|
206
|
+
p result
|
207
|
+
rescue MockServer::ApiError => e
|
208
|
+
puts "Exception when calling ControlApi->status_put: #{e}"
|
209
|
+
end
|
210
|
+
```
|
211
|
+
|
212
|
+
### Parameters
|
213
|
+
This endpoint does not need any parameter.
|
214
|
+
|
215
|
+
### Return type
|
216
|
+
|
217
|
+
[**Ports**](Ports.md)
|
218
|
+
|
219
|
+
### Authorization
|
220
|
+
|
221
|
+
No authorization required
|
222
|
+
|
223
|
+
### HTTP request headers
|
224
|
+
|
225
|
+
- **Content-Type**: Not defined
|
226
|
+
- **Accept**: application/json
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
# **stop_put**
|
231
|
+
> stop_put
|
232
|
+
|
233
|
+
stop running process
|
234
|
+
|
235
|
+
only supported on Netty version
|
236
|
+
|
237
|
+
### Example
|
238
|
+
```ruby
|
239
|
+
# load the gem
|
240
|
+
require 'mockserver-client'
|
241
|
+
|
242
|
+
api_instance = MockServer::ControlApi.new
|
243
|
+
|
244
|
+
begin
|
245
|
+
#stop running process
|
246
|
+
api_instance.stop_put
|
247
|
+
rescue MockServer::ApiError => e
|
248
|
+
puts "Exception when calling ControlApi->stop_put: #{e}"
|
249
|
+
end
|
250
|
+
```
|
251
|
+
|
252
|
+
### Parameters
|
253
|
+
This endpoint does not need any parameter.
|
254
|
+
|
255
|
+
### Return type
|
256
|
+
|
257
|
+
nil (empty response body)
|
258
|
+
|
259
|
+
### Authorization
|
260
|
+
|
261
|
+
No authorization required
|
262
|
+
|
263
|
+
### HTTP request headers
|
264
|
+
|
265
|
+
- **Content-Type**: Not defined
|
266
|
+
- **Accept**: Not defined
|
267
|
+
|
268
|
+
|
269
|
+
|
data/docs/Delay.md
ADDED
data/docs/Expectation.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# MockServer::ExpectationApi
|
2
|
+
|
3
|
+
All URIs are relative to *http://localhost:1080*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**expectation_put**](ExpectationApi.md#expectation_put) | **PUT** /expectation | create expectation
|
8
|
+
|
9
|
+
|
10
|
+
# **expectation_put**
|
11
|
+
> expectation_put(expectations)
|
12
|
+
|
13
|
+
create expectation
|
14
|
+
|
15
|
+
### Example
|
16
|
+
```ruby
|
17
|
+
# load the gem
|
18
|
+
require 'mockserver-client'
|
19
|
+
|
20
|
+
api_instance = MockServer::ExpectationApi.new
|
21
|
+
expectations = nil # Array<Expectations> | expectation to create
|
22
|
+
|
23
|
+
begin
|
24
|
+
#create expectation
|
25
|
+
api_instance.expectation_put(expectations)
|
26
|
+
rescue MockServer::ApiError => e
|
27
|
+
puts "Exception when calling ExpectationApi->expectation_put: #{e}"
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
### Parameters
|
32
|
+
|
33
|
+
Name | Type | Description | Notes
|
34
|
+
------------- | ------------- | ------------- | -------------
|
35
|
+
**expectations** | [**Array<Expectations>**](Array.md)| expectation to create |
|
36
|
+
|
37
|
+
### Return type
|
38
|
+
|
39
|
+
nil (empty response body)
|
40
|
+
|
41
|
+
### Authorization
|
42
|
+
|
43
|
+
No authorization required
|
44
|
+
|
45
|
+
### HTTP request headers
|
46
|
+
|
47
|
+
- **Content-Type**: application/json
|
48
|
+
- **Accept**: Not defined
|
49
|
+
|
50
|
+
|
51
|
+
|
data/docs/HttpError.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# MockServer::HttpError
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**delay** | [**Delay**](Delay.md) | | [optional]
|
7
|
+
**drop_connection** | **BOOLEAN** | | [optional]
|
8
|
+
**response_bytes** | **String** | | [optional]
|
9
|
+
|
10
|
+
|
data/docs/HttpForward.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# MockServer::HttpForward
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**host** | **String** | | [optional]
|
7
|
+
**port** | **Integer** | | [optional]
|
8
|
+
**scheme** | **String** | | [optional]
|
9
|
+
**delay** | [**Delay**](Delay.md) | | [optional]
|
10
|
+
|
11
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# MockServer::HttpOverrideForwardedRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**http_request** | [**HttpRequest**](HttpRequest.md) | | [optional]
|
7
|
+
**delay** | [**Delay**](Delay.md) | | [optional]
|
8
|
+
|
9
|
+
|