vayacondios-server 0.2.11 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -1
- data/.travis.yml +2 -0
- data/Gemfile +15 -9
- data/LICENSE.md +2 -6
- data/Procfile +1 -1
- data/README.md +656 -111
- data/Rakefile +89 -6
- data/bin/vcd +10 -0
- data/bin/vcd-server +8 -0
- data/config/database.yml +6 -0
- data/config/spec.example.yml +18 -0
- data/config/vayacondios.example.yml +15 -0
- data/config/vcd-server.rb +37 -0
- data/examples/configuration.rb +56 -0
- data/examples/event_stream.rb +19 -0
- data/examples/simple.rb +61 -0
- data/features/event.feature +319 -0
- data/features/events.feature +208 -0
- data/features/stash.feature +840 -0
- data/features/stashes.feature +492 -0
- data/features/step_definitions/stash_steps.rb +113 -0
- data/features/stream.feature +30 -0
- data/features/support/em.rb +14 -0
- data/features/support/env.rb +13 -0
- data/lib/vayacondios/configuration.rb +63 -0
- data/lib/vayacondios/server/api.rb +126 -0
- data/lib/vayacondios/server/api_options.rb +56 -0
- data/lib/vayacondios/server/configuration.rb +23 -0
- data/lib/vayacondios/server/driver.rb +71 -0
- data/lib/vayacondios/server/drivers/mongo.rb +126 -0
- data/lib/vayacondios/server/handlers/document_handler.rb +81 -0
- data/lib/vayacondios/server/handlers/event_handler.rb +31 -26
- data/lib/vayacondios/server/handlers/events_handler.rb +31 -0
- data/lib/vayacondios/server/handlers/stash_handler.rb +69 -0
- data/lib/vayacondios/server/handlers/stashes_handler.rb +49 -0
- data/lib/vayacondios/server/handlers/stream_handler.rb +39 -0
- data/lib/vayacondios/server/models/document.rb +87 -0
- data/lib/vayacondios/server/models/event.rb +198 -0
- data/lib/vayacondios/server/models/stash.rb +100 -0
- data/lib/vayacondios/server.rb +35 -0
- data/lib/vayacondios-server.rb +19 -13
- data/lib/vayacondios.rb +22 -0
- data/pom.xml +124 -4
- data/spec/configuration_spec.rb +41 -0
- data/spec/server/api_options_spec.rb +32 -0
- data/spec/server/api_spec.rb +279 -0
- data/spec/server/configuration_spec.rb +27 -0
- data/spec/server/drivers/mongo_spec.rb +107 -0
- data/spec/server/handlers/event_handler_spec.rb +62 -0
- data/spec/server/handlers/events_handler_spec.rb +51 -0
- data/spec/server/handlers/stash_handler_spec.rb +68 -0
- data/spec/server/handlers/stashes_handler_spec.rb +50 -0
- data/spec/server/handlers/stream_handler_spec.rb +5 -0
- data/spec/server/models/document_spec.rb +9 -0
- data/spec/server/models/event_spec.rb +185 -0
- data/spec/server/models/stash_spec.rb +95 -0
- data/spec/spec_helper.rb +23 -3
- data/spec/support/database_helper.rb +42 -0
- data/spec/support/log_helper.rb +19 -0
- data/spec/support/shared_context_for_events.rb +22 -0
- data/spec/support/shared_context_for_stashes.rb +24 -0
- data/spec/support/shared_examples_for_handlers.rb +32 -0
- data/src/main/java/com/infochimps/vayacondios/BaseClient.java +342 -0
- data/src/main/java/com/infochimps/vayacondios/HTTPClient.java +426 -0
- data/src/main/java/com/infochimps/vayacondios/VayacondiosClient.java +487 -65
- data/src/main/java/com/infochimps/vayacondios/test/IntegrationTest.java +3 -0
- data/src/test/java/com/infochimps/vayacondios/BaseClientTest.java +50 -0
- data/src/test/java/com/infochimps/vayacondios/HTTPClientIT.java +267 -0
- data/vayacondios-server.gemspec +9 -9
- metadata +127 -122
- checksums.yaml +0 -15
- data/.rspec +0 -2
- data/.yardopts +0 -10
- data/Guardfile +0 -41
- data/app/http_shim.rb +0 -71
- data/bin/vcd.sh +0 -27
- data/config/http_shim.rb +0 -43
- data/config/vayacondios.example.yaml +0 -7
- data/config/vayacondios.yaml +0 -7
- data/examples/java/ItemSetTest.java +0 -76
- data/lib/tasks/publish.rake +0 -23
- data/lib/tasks/spec.rake +0 -11
- data/lib/tasks/yard.rake +0 -2
- data/lib/vayacondios/client/config.rb +0 -7
- data/lib/vayacondios/client/configliere.rb +0 -38
- data/lib/vayacondios/client/cube_client.rb +0 -39
- data/lib/vayacondios/client/http_client.rb +0 -49
- data/lib/vayacondios/client/itemset.rb +0 -130
- data/lib/vayacondios/client/legacy_switch.rb +0 -43
- data/lib/vayacondios/client/notifier.rb +0 -123
- data/lib/vayacondios/client/zabbix_client.rb +0 -148
- data/lib/vayacondios/legacy_switch.rb +0 -43
- data/lib/vayacondios/server/errors/bad_request.rb +0 -6
- data/lib/vayacondios/server/errors/not_found.rb +0 -6
- data/lib/vayacondios/server/handlers/config_handler.rb +0 -32
- data/lib/vayacondios/server/handlers/itemset_handler.rb +0 -60
- data/lib/vayacondios/server/legacy_switch.rb +0 -43
- data/lib/vayacondios/server/model/config_document.rb +0 -89
- data/lib/vayacondios/server/model/document.rb +0 -25
- data/lib/vayacondios/server/model/event_document.rb +0 -94
- data/lib/vayacondios/server/model/itemset_document.rb +0 -126
- data/lib/vayacondios/server/rack/extract_methods.rb +0 -35
- data/lib/vayacondios/server/rack/jsonize.rb +0 -43
- data/lib/vayacondios/server/rack/params.rb +0 -50
- data/lib/vayacondios/server/rack/path.rb +0 -23
- data/lib/vayacondios/server/rack/path_validation.rb +0 -22
- data/lib/vayacondios/version.rb +0 -3
- data/lib/vayacondios-client.rb +0 -22
- data/scripts/hadoop_monitor/configurable.rb +0 -66
- data/scripts/hadoop_monitor/hadoop_attempt_scraper.rb +0 -45
- data/scripts/hadoop_monitor/hadoop_client.rb +0 -273
- data/scripts/hadoop_monitor/hadoop_monitor.rb +0 -101
- data/scripts/hadoop_monitor/hadoopable.rb +0 -65
- data/scripts/hadoop_monitor/machine_monitor.rb +0 -115
- data/scripts/s3_cataloger/buckets +0 -33
- data/scripts/s3_cataloger/foreach_bucket +0 -88
- data/scripts/s3_cataloger/parse_ls.py +0 -391
- data/spec/client/itemset_legacy_spec.rb +0 -55
- data/spec/client/itemset_spec.rb +0 -60
- data/spec/client/notifier_spec.rb +0 -120
- data/spec/server/config_spec.rb +0 -113
- data/spec/server/event_spec.rb +0 -103
- data/spec/server/itemset_legacy_spec.rb +0 -320
- data/spec/server/itemset_spec.rb +0 -317
- data/spec/server/rack/extract_methods_spec.rb +0 -60
- data/spec/server/rack/path_spec.rb +0 -36
- data/spec/server/rack/path_validation_spec.rb +0 -22
- data/spec/server/server_spec.rb +0 -20
- data/spec/support/mongo_cleaner.rb +0 -32
- data/src/main/java/ItemSetTest.java +0 -76
- data/src/main/java/com/infochimps/util/CurrentClass.java +0 -26
- data/src/main/java/com/infochimps/util/DebugUtil.java +0 -38
- data/src/main/java/com/infochimps/util/HttpHelper.java +0 -181
- data/src/main/java/com/infochimps/vayacondios/ItemSets.java +0 -373
- data/src/main/java/com/infochimps/vayacondios/LinkToVCD.java +0 -18
- data/src/main/java/com/infochimps/vayacondios/MemoryVCDShim.java +0 -84
- data/src/main/java/com/infochimps/vayacondios/Organization.java +0 -62
- data/src/main/java/com/infochimps/vayacondios/PathBuilder.java +0 -13
- data/src/main/java/com/infochimps/vayacondios/StandardVCDLink.java +0 -218
- data/src/main/java/com/infochimps/vayacondios/VCDIntegrationTest.java +0 -108
- data/src/test/java/com/infochimps/vayacondios/TestVayacondiosInMemory.java +0 -78
- data/vayacondios-client.gemspec +0 -25
@@ -0,0 +1,840 @@
|
|
1
|
+
Feature: Stash
|
2
|
+
In order to provide functionality
|
3
|
+
As a user of the Vayacondios Api
|
4
|
+
I want to document how a Stash works
|
5
|
+
|
6
|
+
Scenario: Retrieving a non-Existent Stash
|
7
|
+
Given there are no matching Stashes in the database
|
8
|
+
When the client sends a GET request to "/v3/organization/stash/topic" with no body
|
9
|
+
Then the response status should be 404
|
10
|
+
And the response body should be:
|
11
|
+
"""
|
12
|
+
{
|
13
|
+
"error": "Stash with topic <topic> not found"
|
14
|
+
}
|
15
|
+
"""
|
16
|
+
|
17
|
+
Scenario: Retrieving an Existing Stash
|
18
|
+
Given the following Stash exists in the database:
|
19
|
+
"""
|
20
|
+
{
|
21
|
+
"_id": "topic",
|
22
|
+
"foo": "bar"
|
23
|
+
}
|
24
|
+
"""
|
25
|
+
When the client sends a GET request to "/v3/organization/stash/topic" with no body
|
26
|
+
Then the response status should be 200
|
27
|
+
And the response body should be:
|
28
|
+
"""
|
29
|
+
{
|
30
|
+
"foo": "bar"
|
31
|
+
}
|
32
|
+
"""
|
33
|
+
|
34
|
+
Scenario: Retrieving a non-Existent Stash with an Id
|
35
|
+
Given there are no matching Stashes in the database
|
36
|
+
When the client sends a GET request to "/v3/organization/stash/topic/id" with no body
|
37
|
+
Then the response status should be 404
|
38
|
+
And the response body should be:
|
39
|
+
"""
|
40
|
+
{
|
41
|
+
"error": "Stash with topic <topic> not found"
|
42
|
+
}
|
43
|
+
"""
|
44
|
+
|
45
|
+
Scenario: Retrieving an Existing Stash with an Id
|
46
|
+
Given the following Stash exists in the database:
|
47
|
+
"""
|
48
|
+
{
|
49
|
+
"_id": "topic",
|
50
|
+
"sub": {
|
51
|
+
"foo": "bar"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
"""
|
55
|
+
When the client sends a GET request to "/v3/organization/stash/topic/sub" with no body
|
56
|
+
Then the response status should be 200
|
57
|
+
And the response body should be:
|
58
|
+
"""
|
59
|
+
{
|
60
|
+
"foo":"bar"
|
61
|
+
}
|
62
|
+
"""
|
63
|
+
|
64
|
+
Scenario: Creating an Empty Stash without an Id
|
65
|
+
Given there are no matching Stashes in the database
|
66
|
+
When the client sends a POST request to "/v3/organization/stash/topic" with no body
|
67
|
+
Then the response status should be 200
|
68
|
+
And the response body should be:
|
69
|
+
"""
|
70
|
+
{
|
71
|
+
}
|
72
|
+
"""
|
73
|
+
And the database should have the following Stash:
|
74
|
+
"""
|
75
|
+
{
|
76
|
+
"_id": "topic"
|
77
|
+
}
|
78
|
+
"""
|
79
|
+
|
80
|
+
Scenario: Creating a Stash without an Id
|
81
|
+
Given there are no matching Stashes in the database
|
82
|
+
When the client sends a POST request to "/v3/organization/stash/topic" with the following body:
|
83
|
+
"""
|
84
|
+
{
|
85
|
+
"foo": "bar"
|
86
|
+
}
|
87
|
+
"""
|
88
|
+
Then the response status should be 200
|
89
|
+
And the response body should be:
|
90
|
+
"""
|
91
|
+
{
|
92
|
+
"foo": "bar"
|
93
|
+
}
|
94
|
+
"""
|
95
|
+
And the database should have the following Stash:
|
96
|
+
"""
|
97
|
+
{
|
98
|
+
"_id": "topic",
|
99
|
+
"foo": "bar"
|
100
|
+
}
|
101
|
+
"""
|
102
|
+
|
103
|
+
Scenario: Creating a non-Hash Stash without an Id
|
104
|
+
Given there are no matching Stashes in the database
|
105
|
+
When the client sends a POST request to "/v3/organization/stash/topic" with the following body:
|
106
|
+
"""
|
107
|
+
[
|
108
|
+
"foo",
|
109
|
+
"bar"
|
110
|
+
]
|
111
|
+
"""
|
112
|
+
Then the response status should be 400
|
113
|
+
And the response body should be:
|
114
|
+
"""
|
115
|
+
{
|
116
|
+
"error": "If not including an Id, the document must be a Hash"
|
117
|
+
}
|
118
|
+
"""
|
119
|
+
|
120
|
+
Scenario: Creating a Stash without an Id when one Already Exists
|
121
|
+
Given the following Stash exists in the database:
|
122
|
+
"""
|
123
|
+
{
|
124
|
+
"_id": "topic",
|
125
|
+
"foo": "bar"
|
126
|
+
}
|
127
|
+
"""
|
128
|
+
When the client sends a POST request to "/v3/organization/stash/topic" with the following body:
|
129
|
+
"""
|
130
|
+
{
|
131
|
+
"new": "body"
|
132
|
+
}
|
133
|
+
"""
|
134
|
+
Then the response status should be 200
|
135
|
+
And the response body should be:
|
136
|
+
"""
|
137
|
+
{
|
138
|
+
"new": "body"
|
139
|
+
}
|
140
|
+
"""
|
141
|
+
And the database should have the following Stash:
|
142
|
+
"""
|
143
|
+
{
|
144
|
+
"_id": "topic",
|
145
|
+
"new": "body"
|
146
|
+
}
|
147
|
+
"""
|
148
|
+
|
149
|
+
Scenario: Creating an Empty Stash With an Id
|
150
|
+
Given there are no matching Stashes in the database
|
151
|
+
When the client sends a POST request to "/v3/organization/stash/topic/id" with no body
|
152
|
+
Then the response status should be 200
|
153
|
+
And the response body should be:
|
154
|
+
"""
|
155
|
+
{
|
156
|
+
"id": {}
|
157
|
+
}
|
158
|
+
"""
|
159
|
+
And the database should have the following Stash:
|
160
|
+
"""
|
161
|
+
{
|
162
|
+
"_id": "topic",
|
163
|
+
"id": {}
|
164
|
+
}
|
165
|
+
"""
|
166
|
+
|
167
|
+
Scenario: Creating a Stash With an Id
|
168
|
+
Given there are no matching Stashes in the database
|
169
|
+
When the client sends a POST request to "/v3/organization/stash/topic/id" with the following body:
|
170
|
+
"""
|
171
|
+
{
|
172
|
+
"foo": "bar"
|
173
|
+
}
|
174
|
+
"""
|
175
|
+
Then the response status should be 200
|
176
|
+
And the response body should be:
|
177
|
+
"""
|
178
|
+
{
|
179
|
+
"id": {
|
180
|
+
"foo": "bar"
|
181
|
+
}
|
182
|
+
}
|
183
|
+
"""
|
184
|
+
And the database should have the following Stash:
|
185
|
+
"""
|
186
|
+
{
|
187
|
+
"_id": "topic",
|
188
|
+
"id": {
|
189
|
+
"foo": "bar"
|
190
|
+
}
|
191
|
+
}
|
192
|
+
"""
|
193
|
+
|
194
|
+
Scenario: Creating an Array Stash With an Id
|
195
|
+
Given there are no matching Stashes in the database
|
196
|
+
When the client sends a POST request to "/v3/organization/stash/topic/id" with the following body:
|
197
|
+
"""
|
198
|
+
[
|
199
|
+
"foo",
|
200
|
+
"bar"
|
201
|
+
]
|
202
|
+
"""
|
203
|
+
Then the response status should be 200
|
204
|
+
And the response body should be:
|
205
|
+
"""
|
206
|
+
{
|
207
|
+
"id": [
|
208
|
+
"foo",
|
209
|
+
"bar"
|
210
|
+
]
|
211
|
+
}
|
212
|
+
"""
|
213
|
+
And the database should have the following Stash:
|
214
|
+
"""
|
215
|
+
{
|
216
|
+
"_id": "topic",
|
217
|
+
"id": [
|
218
|
+
"foo",
|
219
|
+
"bar"
|
220
|
+
]
|
221
|
+
}
|
222
|
+
"""
|
223
|
+
|
224
|
+
Scenario: Creating an String Stash With an Id
|
225
|
+
Given there are no matching Stashes in the database
|
226
|
+
When the client sends a POST request to "/v3/organization/stash/topic/id" with the following body:
|
227
|
+
"""
|
228
|
+
"HELLO"
|
229
|
+
"""
|
230
|
+
Then the response status should be 200
|
231
|
+
And the response body should be:
|
232
|
+
"""
|
233
|
+
{
|
234
|
+
"id": "HELLO"
|
235
|
+
}
|
236
|
+
"""
|
237
|
+
And the database should have the following Stash:
|
238
|
+
"""
|
239
|
+
{
|
240
|
+
"_id": "topic",
|
241
|
+
"id": "HELLO"
|
242
|
+
}
|
243
|
+
"""
|
244
|
+
|
245
|
+
Scenario: Creating an nil Stash With an Id
|
246
|
+
Given there are no matching Stashes in the database
|
247
|
+
When the client sends a POST request to "/v3/organization/stash/topic/id" with the following body:
|
248
|
+
"""
|
249
|
+
"null"
|
250
|
+
"""
|
251
|
+
Then the response status should be 200
|
252
|
+
And the response body should be:
|
253
|
+
"""
|
254
|
+
{
|
255
|
+
"id": "null"
|
256
|
+
}
|
257
|
+
"""
|
258
|
+
And the database should have the following Stash:
|
259
|
+
"""
|
260
|
+
{
|
261
|
+
"_id": "topic",
|
262
|
+
"id": "null"
|
263
|
+
}
|
264
|
+
"""
|
265
|
+
|
266
|
+
Scenario: Creating a Stash With an Id when one Already Exists
|
267
|
+
Given the following Stash exists in the database:
|
268
|
+
"""
|
269
|
+
{
|
270
|
+
"_id": "topic",
|
271
|
+
"id": {
|
272
|
+
"foo": "bar"
|
273
|
+
}
|
274
|
+
}
|
275
|
+
"""
|
276
|
+
When the client sends a POST request to "/v3/organization/stash/topic/id" with the following body:
|
277
|
+
"""
|
278
|
+
{
|
279
|
+
"new": "body"
|
280
|
+
}
|
281
|
+
"""
|
282
|
+
Then the response status should be 200
|
283
|
+
And the response body should be:
|
284
|
+
"""
|
285
|
+
{
|
286
|
+
"id": {
|
287
|
+
"new": "body"
|
288
|
+
}
|
289
|
+
}
|
290
|
+
"""
|
291
|
+
And the database should have the following Stash:
|
292
|
+
"""
|
293
|
+
{
|
294
|
+
"_id": "topic",
|
295
|
+
"id": {
|
296
|
+
"new": "body"
|
297
|
+
}
|
298
|
+
}
|
299
|
+
"""
|
300
|
+
|
301
|
+
Scenario: Updating a non-Existent Stash with a Hash
|
302
|
+
Given there are no matching Stashes in the database
|
303
|
+
When the client sends a PUT request to "/v3/organization/stash/topic" with the following body:
|
304
|
+
"""
|
305
|
+
{
|
306
|
+
"foo": "bar"
|
307
|
+
}
|
308
|
+
"""
|
309
|
+
Then the response status should be 405
|
310
|
+
And the response body should be:
|
311
|
+
"""
|
312
|
+
{
|
313
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
314
|
+
}
|
315
|
+
"""
|
316
|
+
# Then the response status should be 200
|
317
|
+
# And the response body should be:
|
318
|
+
# """
|
319
|
+
# {
|
320
|
+
# "foo": "bar"
|
321
|
+
# }
|
322
|
+
# """
|
323
|
+
# And the database should have the following Stash:
|
324
|
+
# """
|
325
|
+
# {
|
326
|
+
# "_id": "topic",
|
327
|
+
# "foo": "bar"
|
328
|
+
# }
|
329
|
+
# """
|
330
|
+
|
331
|
+
Scenario: Updating an Existing Stash with a Hash
|
332
|
+
Given the following Stash exists in the database:
|
333
|
+
"""
|
334
|
+
{
|
335
|
+
"_id": "topic",
|
336
|
+
"foo": "bar"
|
337
|
+
}
|
338
|
+
"""
|
339
|
+
When the client sends a PUT request to "/v3/organization/stash/topic" with the following body:
|
340
|
+
"""
|
341
|
+
{
|
342
|
+
"baz": "qix"
|
343
|
+
}
|
344
|
+
"""
|
345
|
+
Then the response status should be 405
|
346
|
+
And the response body should be:
|
347
|
+
"""
|
348
|
+
{
|
349
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
350
|
+
}
|
351
|
+
"""
|
352
|
+
# Then the response status should be 200
|
353
|
+
# And the response body should be:
|
354
|
+
# """
|
355
|
+
# {
|
356
|
+
# "foo": "bar",
|
357
|
+
# "baz": "qix"
|
358
|
+
# }
|
359
|
+
# """
|
360
|
+
# And the database should have the following Stash:
|
361
|
+
# """
|
362
|
+
# {
|
363
|
+
# "_id": "topic",
|
364
|
+
# "foo": "bar",
|
365
|
+
# "baz": "qix"
|
366
|
+
# }
|
367
|
+
# """
|
368
|
+
|
369
|
+
Scenario: Updating an Stash with a non-Hash
|
370
|
+
Given there are no matching Stashes in the database
|
371
|
+
When the client sends a PUT request to "/v3/organization/stash/topic" with the following body:
|
372
|
+
"""
|
373
|
+
[
|
374
|
+
"foo",
|
375
|
+
"bar"
|
376
|
+
]
|
377
|
+
"""
|
378
|
+
Then the response status should be 405
|
379
|
+
And the response body should be:
|
380
|
+
"""
|
381
|
+
{
|
382
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
383
|
+
}
|
384
|
+
"""
|
385
|
+
# Then the response status should be 400
|
386
|
+
# And the response body should be:
|
387
|
+
# """
|
388
|
+
# {
|
389
|
+
# "error": "If not including an id the document must be a Hash"
|
390
|
+
# }
|
391
|
+
# """
|
392
|
+
# And there are no Stashes in the database
|
393
|
+
|
394
|
+
Scenario: Updating an non-Existent Stash Using an Id with an Empty Hash
|
395
|
+
Given there are no matching Stashes in the database
|
396
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with no body
|
397
|
+
Then the response status should be 405
|
398
|
+
And the response body should be:
|
399
|
+
"""
|
400
|
+
{
|
401
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
402
|
+
}
|
403
|
+
"""
|
404
|
+
# Then the response status should be 200
|
405
|
+
# And the response body should be:
|
406
|
+
# """
|
407
|
+
# {
|
408
|
+
# "id": {}
|
409
|
+
# }
|
410
|
+
# """
|
411
|
+
# And the database should have the following Stash:
|
412
|
+
# """
|
413
|
+
# {
|
414
|
+
# "_id": "topic",
|
415
|
+
# "id": {}
|
416
|
+
# }
|
417
|
+
# """
|
418
|
+
|
419
|
+
Scenario: Updating an Existing Stash Using an Id with an Empty Hash
|
420
|
+
Given the following Stash exists in the database:
|
421
|
+
"""
|
422
|
+
{
|
423
|
+
"_id": "topic",
|
424
|
+
"id": "yolo"
|
425
|
+
}
|
426
|
+
"""
|
427
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with no body
|
428
|
+
Then the response status should be 405
|
429
|
+
And the response body should be:
|
430
|
+
"""
|
431
|
+
{
|
432
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
433
|
+
}
|
434
|
+
"""
|
435
|
+
# Then the response status should be 200
|
436
|
+
# And the response body should be:
|
437
|
+
# """
|
438
|
+
# {
|
439
|
+
# "id": {}
|
440
|
+
# }
|
441
|
+
# """
|
442
|
+
# And the database should have the following Stash:
|
443
|
+
# """
|
444
|
+
# {
|
445
|
+
# "_id": "topic",
|
446
|
+
# "id": {}
|
447
|
+
# }
|
448
|
+
# """
|
449
|
+
|
450
|
+
Scenario: Updating an non-Existent Stash Using an Id with a Hash
|
451
|
+
Given there are no matching Stashes in the database
|
452
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
453
|
+
"""
|
454
|
+
{
|
455
|
+
"foo": "bar"
|
456
|
+
}
|
457
|
+
"""
|
458
|
+
Then the response status should be 405
|
459
|
+
And the response body should be:
|
460
|
+
"""
|
461
|
+
{
|
462
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
463
|
+
}
|
464
|
+
"""
|
465
|
+
# Then the response status should be 200
|
466
|
+
# And the response body should be:
|
467
|
+
# """
|
468
|
+
# {
|
469
|
+
# "id": {
|
470
|
+
# "foo": "bar"
|
471
|
+
# }
|
472
|
+
# }
|
473
|
+
# """
|
474
|
+
# And the database should have the following Stash:
|
475
|
+
# """
|
476
|
+
# {
|
477
|
+
# "_id": "topic",
|
478
|
+
# "id": {
|
479
|
+
# "foo": "bar"
|
480
|
+
# }
|
481
|
+
# }
|
482
|
+
# """
|
483
|
+
|
484
|
+
Scenario: Updating an Existing Stash Using an Id with a Hash
|
485
|
+
Given the following Stash exists in the database:
|
486
|
+
"""
|
487
|
+
{
|
488
|
+
"_id": "topic",
|
489
|
+
"id": "yolo"
|
490
|
+
}
|
491
|
+
"""
|
492
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
493
|
+
"""
|
494
|
+
{
|
495
|
+
"foo": "bar"
|
496
|
+
}
|
497
|
+
"""
|
498
|
+
Then the response status should be 405
|
499
|
+
And the response body should be:
|
500
|
+
"""
|
501
|
+
{
|
502
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
503
|
+
}
|
504
|
+
"""
|
505
|
+
# Then the response status should be 200
|
506
|
+
# And the response body should be:
|
507
|
+
# """
|
508
|
+
# {
|
509
|
+
# "id": {
|
510
|
+
# "foo": "bar"
|
511
|
+
# }
|
512
|
+
# }
|
513
|
+
# """
|
514
|
+
# And the database should have the following Stash:
|
515
|
+
# """
|
516
|
+
# {
|
517
|
+
# "_id": "topic",
|
518
|
+
# "id": {
|
519
|
+
# "foo": "bar"
|
520
|
+
# }
|
521
|
+
# }
|
522
|
+
# """
|
523
|
+
|
524
|
+
Scenario: Updating an non-Existent Stash Using an Id with an Array
|
525
|
+
Given there are no matching Stashes in the database
|
526
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
527
|
+
"""
|
528
|
+
[
|
529
|
+
"foo",
|
530
|
+
"bar"
|
531
|
+
]
|
532
|
+
"""
|
533
|
+
Then the response status should be 405
|
534
|
+
And the response body should be:
|
535
|
+
"""
|
536
|
+
{
|
537
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
538
|
+
}
|
539
|
+
"""
|
540
|
+
# Then the response status should be 200
|
541
|
+
# And the response body should be:
|
542
|
+
# """
|
543
|
+
# {
|
544
|
+
# "id": [
|
545
|
+
# "foo",
|
546
|
+
# "bar"
|
547
|
+
# ]
|
548
|
+
# }
|
549
|
+
# """
|
550
|
+
# And the database should have the following Stash:
|
551
|
+
# """
|
552
|
+
# {
|
553
|
+
# "_id": "topic",
|
554
|
+
# "id": [
|
555
|
+
# "foo",
|
556
|
+
# "bar"
|
557
|
+
# ]
|
558
|
+
# }
|
559
|
+
# """
|
560
|
+
|
561
|
+
Scenario: Updating an Existing Stash Using an Id with an Array
|
562
|
+
Given the following Stash exists in the database:
|
563
|
+
"""
|
564
|
+
{
|
565
|
+
"_id": "topic",
|
566
|
+
"id": "yolo",
|
567
|
+
"foo": "bar"
|
568
|
+
}
|
569
|
+
"""
|
570
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
571
|
+
"""
|
572
|
+
[
|
573
|
+
"foo",
|
574
|
+
"bar"
|
575
|
+
]
|
576
|
+
"""
|
577
|
+
Then the response status should be 405
|
578
|
+
And the response body should be:
|
579
|
+
"""
|
580
|
+
{
|
581
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
582
|
+
}
|
583
|
+
"""
|
584
|
+
# Then the response status should be 200
|
585
|
+
# And the response body should be:
|
586
|
+
# """
|
587
|
+
# {
|
588
|
+
# "id": [
|
589
|
+
# "foo",
|
590
|
+
# "bar"
|
591
|
+
# ],
|
592
|
+
# "foo": "bar"
|
593
|
+
# }
|
594
|
+
# """
|
595
|
+
# And the database should have the following Stash:
|
596
|
+
# """
|
597
|
+
# {
|
598
|
+
# "_id": "topic",
|
599
|
+
# "id": [
|
600
|
+
# "foo",
|
601
|
+
# "bar"
|
602
|
+
# ],
|
603
|
+
# "foo": "bar"
|
604
|
+
# }
|
605
|
+
# """
|
606
|
+
|
607
|
+
Scenario: Updating an non-Existent Stash Using an Id with a String
|
608
|
+
Given there are no matching Stashes in the database
|
609
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
610
|
+
"""
|
611
|
+
"HELLO"
|
612
|
+
"""
|
613
|
+
Then the response status should be 405
|
614
|
+
And the response body should be:
|
615
|
+
"""
|
616
|
+
{
|
617
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
618
|
+
}
|
619
|
+
"""
|
620
|
+
# Then the response status should be 200
|
621
|
+
# And the response body should be:
|
622
|
+
# """
|
623
|
+
# {
|
624
|
+
# "id": "HELLO"
|
625
|
+
# }
|
626
|
+
# """
|
627
|
+
# And the database should have the following Stash:
|
628
|
+
# """
|
629
|
+
# {
|
630
|
+
# "_id": "topic",
|
631
|
+
# "id": "HELLO"
|
632
|
+
# }
|
633
|
+
# """
|
634
|
+
|
635
|
+
Scenario: Updating an Existing Stash Using an Id with a String
|
636
|
+
Given the following Stash exists in the database:
|
637
|
+
"""
|
638
|
+
{
|
639
|
+
"_id": "topic",
|
640
|
+
"id": "yolo"
|
641
|
+
}
|
642
|
+
"""
|
643
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
644
|
+
"""
|
645
|
+
"HELLO"
|
646
|
+
"""
|
647
|
+
Then the response status should be 405
|
648
|
+
And the response body should be:
|
649
|
+
"""
|
650
|
+
{
|
651
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
652
|
+
}
|
653
|
+
"""
|
654
|
+
# Then the response status should be 200
|
655
|
+
# And the response body should be:
|
656
|
+
# """
|
657
|
+
# {
|
658
|
+
# "id": "HELLO"
|
659
|
+
# }
|
660
|
+
# """
|
661
|
+
# And the database should have the following Stash:
|
662
|
+
# """
|
663
|
+
# {
|
664
|
+
# "_id": "topic",
|
665
|
+
# "id": "HELLO"
|
666
|
+
# }
|
667
|
+
# """
|
668
|
+
|
669
|
+
Scenario: Updating an non-Existent Stash Using an Id with a nil
|
670
|
+
Given there are no matching Stashes in the database
|
671
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
672
|
+
"""
|
673
|
+
"null"
|
674
|
+
"""
|
675
|
+
Then the response status should be 405
|
676
|
+
And the response body should be:
|
677
|
+
"""
|
678
|
+
{
|
679
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
680
|
+
}
|
681
|
+
"""
|
682
|
+
# Then the response status should be 200
|
683
|
+
# And the response body should be:
|
684
|
+
# """
|
685
|
+
# {
|
686
|
+
# "id": "null"
|
687
|
+
# }
|
688
|
+
# """
|
689
|
+
# And the database should have the following Stash:
|
690
|
+
# """
|
691
|
+
# {
|
692
|
+
# "_id": "topic",
|
693
|
+
# "id": "null"
|
694
|
+
# }
|
695
|
+
# """
|
696
|
+
|
697
|
+
Scenario: Updating an Existing Stash Using an Id with a nil
|
698
|
+
Given the following Stash exists in the database:
|
699
|
+
"""
|
700
|
+
{
|
701
|
+
"_id": "topic",
|
702
|
+
"id": "yolo"
|
703
|
+
}
|
704
|
+
"""
|
705
|
+
When the client sends a PUT request to "/v3/organization/stash/topic/id" with the following body:
|
706
|
+
"""
|
707
|
+
"null"
|
708
|
+
"""
|
709
|
+
Then the response status should be 405
|
710
|
+
And the response body should be:
|
711
|
+
"""
|
712
|
+
{
|
713
|
+
"error":"Operation update not allowed for Vayacondios::Server::StashHandler. Valid operations are [\"create\", \"retrieve\", \"delete\"]"
|
714
|
+
}
|
715
|
+
"""
|
716
|
+
# Then the response status should be 200
|
717
|
+
# And the response body should be:
|
718
|
+
# """
|
719
|
+
# {
|
720
|
+
# "id": "null"
|
721
|
+
# }
|
722
|
+
# """
|
723
|
+
# And the database should have the following Stash:
|
724
|
+
# """
|
725
|
+
# {
|
726
|
+
# "_id": "topic",
|
727
|
+
# "id": "null"
|
728
|
+
# }
|
729
|
+
# """
|
730
|
+
|
731
|
+
Scenario: Deleting a non-Existent Stash
|
732
|
+
Given there are no matching Stashes in the database
|
733
|
+
When the client sends a DELETE request to "/v3/organization/stash/topic" with no body
|
734
|
+
Then the response status should be 200
|
735
|
+
And the response body should be:
|
736
|
+
"""
|
737
|
+
{
|
738
|
+
"ok": true
|
739
|
+
}
|
740
|
+
"""
|
741
|
+
|
742
|
+
Scenario: Deleting an Existing Stash without an Id
|
743
|
+
Given the following Stash exists in the database:
|
744
|
+
"""
|
745
|
+
{
|
746
|
+
"_id": "topic",
|
747
|
+
"foo": "bar"
|
748
|
+
}
|
749
|
+
"""
|
750
|
+
When the client sends a DELETE request to "/v3/organization/stash/topic" with no body
|
751
|
+
Then the response status should be 200
|
752
|
+
And the response body should be:
|
753
|
+
"""
|
754
|
+
{
|
755
|
+
"ok": true
|
756
|
+
}
|
757
|
+
"""
|
758
|
+
And there are no Stashes in the database
|
759
|
+
|
760
|
+
Scenario: Deleting a non-Existent Stash with an Id
|
761
|
+
Given there are no matching Stashes in the database
|
762
|
+
When the client sends a DELETE request to "/v3/organization/stash/topic/id" with no body
|
763
|
+
Then the response status should be 501
|
764
|
+
And the response body should be:
|
765
|
+
"""
|
766
|
+
{
|
767
|
+
"error": "Deleting an Id from a Stash is not supported"
|
768
|
+
}
|
769
|
+
"""
|
770
|
+
|
771
|
+
# Then the response status should be 200
|
772
|
+
# And the response body should be:
|
773
|
+
# """
|
774
|
+
# {
|
775
|
+
# "ok": true
|
776
|
+
# }
|
777
|
+
# """
|
778
|
+
|
779
|
+
Scenario: Deleting a Existent Stash with a non-Existent Id
|
780
|
+
Given the following Stash exists in the database:
|
781
|
+
"""
|
782
|
+
{
|
783
|
+
"_id": "topic",
|
784
|
+
"foo": "bar"
|
785
|
+
}
|
786
|
+
"""
|
787
|
+
When the client sends a DELETE request to "/v3/organization/stash/topic/id" with no body
|
788
|
+
Then the response status should be 501
|
789
|
+
And the response body should be:
|
790
|
+
"""
|
791
|
+
{
|
792
|
+
"error": "Deleting an Id from a Stash is not supported"
|
793
|
+
}
|
794
|
+
"""
|
795
|
+
# Then the response status should be 200
|
796
|
+
# And the response body should be:
|
797
|
+
# """
|
798
|
+
# {
|
799
|
+
# "ok": true
|
800
|
+
# }
|
801
|
+
# """
|
802
|
+
# And the database should have the following Stash:
|
803
|
+
# """
|
804
|
+
# {
|
805
|
+
# "_id": "topic",
|
806
|
+
# "foo": "bar"
|
807
|
+
# }
|
808
|
+
# """
|
809
|
+
|
810
|
+
Scenario: Deleting a Existent Stash with an Existent Id
|
811
|
+
Given the following Stash exists in the database:
|
812
|
+
"""
|
813
|
+
{
|
814
|
+
"_id": "topic",
|
815
|
+
"id": "data",
|
816
|
+
"foo": "bar"
|
817
|
+
}
|
818
|
+
"""
|
819
|
+
When the client sends a DELETE request to "/v3/organization/stash/topic/id" with no body
|
820
|
+
Then the response status should be 501
|
821
|
+
And the response body should be:
|
822
|
+
"""
|
823
|
+
{
|
824
|
+
"error": "Deleting an Id from a Stash is not supported"
|
825
|
+
}
|
826
|
+
"""
|
827
|
+
# Then the response status should be 200
|
828
|
+
# And the response body should be:
|
829
|
+
# """
|
830
|
+
# {
|
831
|
+
# "ok": true
|
832
|
+
# }
|
833
|
+
# """
|
834
|
+
# And the database should have the following Stash:
|
835
|
+
# """
|
836
|
+
# {
|
837
|
+
# "_id": "topic",
|
838
|
+
# "foo": "bar"
|
839
|
+
# }
|
840
|
+
# """
|