hawkular-client 0.2.0 → 0.2.1

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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +2 -1
  4. data/.rubocop.yml +19 -6
  5. data/CHANGES.rdoc +13 -3
  6. data/README.rdoc +9 -3
  7. data/hawkularclient.gemspec +8 -4
  8. data/lib/alerts/alerts_api.rb +202 -32
  9. data/lib/hawkular.rb +35 -67
  10. data/lib/hawkular_all.rb +2 -0
  11. data/lib/inventory/inventory_api.rb +459 -130
  12. data/lib/metrics/metric_api.rb +14 -9
  13. data/lib/operations/operations_api.rb +247 -0
  14. data/lib/tokens/tokens_api.rb +33 -0
  15. data/lib/version.rb +1 -1
  16. data/spec/integration/alerts_spec.rb +272 -20
  17. data/spec/integration/hello-world-definitions.json +46 -0
  18. data/spec/integration/inventory_spec.rb +253 -89
  19. data/spec/integration/metric_spec.rb +36 -0
  20. data/spec/integration/operations_spec.rb +420 -0
  21. data/spec/integration/tokens_spec.rb +45 -0
  22. data/spec/resources/driver.jar +0 -0
  23. data/spec/resources/sample.war +0 -0
  24. data/spec/spec_helper.rb +30 -6
  25. data/spec/unit/base_spec.rb +22 -1
  26. data/spec/unit/canonical_path_spec.rb +92 -0
  27. data/spec/vcr/vcr_setup.rb +3 -4
  28. data/spec/vcr_cassettes/Alert/EndToEnd/Should_create_and_fire_a_trigger.yml +1187 -0
  29. data/spec/vcr_cassettes/Alert/Events/Should_list_events.yml +101 -0
  30. data/spec/vcr_cassettes/Alert/Events/Should_list_events_using_criteria.yml +79 -0
  31. data/spec/vcr_cassettes/Alert/Events/Should_not_list_events_using_criteria.yml +49 -0
  32. data/spec/vcr_cassettes/Alert/Triggers/Should_bulk_load_triggers.yml +225 -0
  33. data/spec/vcr_cassettes/Alert/Triggers/Should_create_a_basic_trigger_with_action.yml +355 -0
  34. data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action.yml +134 -0
  35. data/spec/vcr_cassettes/Alert/Triggers/Should_create_an_action_for_webhooks.yml +220 -0
  36. data/spec/vcr_cassettes/Alert/Triggers/Should_get_the_action_definitions.yml +218 -0
  37. data/spec/vcr_cassettes/Alert/Triggers/Should_not_create_an_action_for_unknown_plugin.yml +46 -0
  38. data/spec/vcr_cassettes/Alert/Triggers/Should_not_create_an_action_for_unknown_properties.yml +134 -0
  39. data/spec/vcr_cassettes/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +270 -0
  40. data/spec/vcr_cassettes/Inventory/Client_should_listen_on_various_inventory_events.json +47 -0
  41. data/spec/vcr_cassettes/Inventory/Client_should_listen_on_various_inventory_events.yml +191 -0
  42. data/spec/vcr_cassettes/Inventory/Helpers/generate_some_events_for_websocket.yml +507 -0
  43. data/spec/vcr_cassettes/Inventory/Should_List_datasources_with_no_props.yml +74 -69
  44. data/spec/vcr_cassettes/Inventory/{Should_list_types_without_feed.yml → Should_create_a_feed.yml} +29 -32
  45. data/spec/vcr_cassettes/Inventory/Should_create_a_feed_again.yml +211 -0
  46. data/spec/vcr_cassettes/Inventory/Should_create_a_resource_.yml +355 -0
  47. data/spec/vcr_cassettes/Inventory/Should_create_a_resource_with_metric.yml +786 -0
  48. data/spec/vcr_cassettes/Inventory/Should_create_a_resourcetype.yml +205 -0
  49. data/spec/vcr_cassettes/Inventory/Should_create_and_delete_feed.yml +201 -0
  50. data/spec/vcr_cassettes/Inventory/Should_create_and_get_a_resource.yml +419 -0
  51. data/spec/vcr_cassettes/Inventory/Should_list_URLs.yml +39 -27
  52. data/spec/vcr_cassettes/Inventory/Should_list_WildFlys.yml +37 -29
  53. data/spec/vcr_cassettes/Inventory/Should_list_WildFlys_with_props.yml +53 -45
  54. data/spec/vcr_cassettes/Inventory/Should_list_all_the_resource_types.yml +177 -0
  55. data/spec/vcr_cassettes/Inventory/Should_list_children_of_WildFly.yml +230 -56
  56. data/spec/vcr_cassettes/Inventory/Should_list_feeds.yml +27 -24
  57. data/spec/vcr_cassettes/Inventory/Should_list_heap_metrics_for_WildFlys.yml +586 -119
  58. data/spec/vcr_cassettes/Inventory/Should_list_metrics_for_WildFlys.yml +220 -59
  59. data/spec/vcr_cassettes/Inventory/Should_list_metrics_of_given_metric_type.yml +613 -0
  60. data/spec/vcr_cassettes/Inventory/Should_list_metrics_of_given_resource_type.yml +333 -0
  61. data/spec/vcr_cassettes/Inventory/Should_list_recursive_children_of_WildFly.yml +2064 -0
  62. data/spec/vcr_cassettes/Inventory/Should_list_relationships_of_WildFly.yml +460 -0
  63. data/spec/vcr_cassettes/Inventory/Should_list_types_with_bad_feed.yml +26 -25
  64. data/spec/vcr_cassettes/Inventory/Should_list_types_with_feed.yml +102 -36
  65. data/spec/vcr_cassettes/Inventory/Should_not_find_an_unknown_resource.yml +54 -0
  66. data/spec/vcr_cassettes/Inventory/Tenants/Should_Get_Tenant_For_Explicit_Credentials.yml +50 -0
  67. data/spec/vcr_cassettes/Inventory/Tenants/Should_Get_Tenant_For_Implicit_Credentials.yml +50 -0
  68. data/spec/vcr_cassettes/Operation/Helpers/get_tenant.yml +50 -0
  69. data/spec/vcr_cassettes/Operation/Operation/Add_JDBC_driver_should_add_the_driver.json +26 -0
  70. data/spec/vcr_cassettes/Operation/Operation/Add_datasource_should_be_doable.json +26 -0
  71. data/spec/vcr_cassettes/Operation/Operation/Add_deployment_should_be_doable.json +26 -0
  72. data/spec/vcr_cassettes/Operation/Operation/Redeploy_can_be_run_multiple_times_in_parallel.json +40 -0
  73. data/spec/vcr_cassettes/Operation/Operation/Redeploy_should_be_performed_and_eventually_respond_with_success.json +26 -0
  74. data/spec/vcr_cassettes/Operation/Operation/Redeploy_should_not_be_performed_if_resource_path_is_wrong.json +26 -0
  75. data/spec/vcr_cassettes/Operation/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +26 -0
  76. data/spec/vcr_cassettes/Operation/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +26 -0
  77. data/spec/vcr_cassettes/Operation/Operation/Remove_deployment_should_be_performed_and_eventually_respond_with_success.json +26 -0
  78. data/spec/vcr_cassettes/Operation/Operation/Undeploy_should_be_performed_and_eventually_respond_with_success.json +26 -0
  79. data/spec/vcr_cassettes/Operation/Operation/should_not_be_possible_to_perform_on_closed_client.json +12 -0
  80. data/spec/vcr_cassettes/Operation/Websocket_connection/should_be_established.json +9 -0
  81. data/spec/vcr_cassettes/Tokens/Should_be_able_to_create_a_new_token_for_an_actual_user.yml +57 -0
  82. data/spec/vcr_cassettes/Tokens/Should_be_able_to_list_the_available_tokens.yml +49 -0
  83. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_with_a_wrong_password.yml +56 -0
  84. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_without_a_password.yml +55 -0
  85. metadata +175 -11
  86. data/lib/metrics/version.rb +0 -7
@@ -0,0 +1,134 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/plugins/email
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ User-Agent:
17
+ - Ruby
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Expires:
24
+ - '0'
25
+ Cache-Control:
26
+ - no-cache, no-store, must-revalidate
27
+ X-Powered-By:
28
+ - Undertow/1
29
+ Server:
30
+ - WildFly/10
31
+ Pragma:
32
+ - no-cache
33
+ Date:
34
+ - Mon, 14 Mar 2016 10:54:55 GMT
35
+ Connection:
36
+ - keep-alive
37
+ Content-Type:
38
+ - application/json
39
+ Content-Length:
40
+ - '87'
41
+ body:
42
+ encoding: ASCII-8BIT
43
+ string: '["cc","from","from-name","template.hawkular.url","template.html","template.plain","to"]'
44
+ http_version:
45
+ recorded_at: Mon, 14 Mar 2016 10:54:55 GMT
46
+ - request:
47
+ method: post
48
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/actions
49
+ body:
50
+ encoding: UTF-8
51
+ string: '{"actionId":"my-id3","actionPlugin":"email","properties":{"foo":"bar"}}'
52
+ headers:
53
+ Accept:
54
+ - application/json
55
+ Accept-Encoding:
56
+ - gzip, deflate
57
+ Content-Type:
58
+ - application/json
59
+ Content-Length:
60
+ - '71'
61
+ User-Agent:
62
+ - Ruby
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Expires:
69
+ - '0'
70
+ Cache-Control:
71
+ - no-cache, no-store, must-revalidate
72
+ X-Powered-By:
73
+ - Undertow/1
74
+ Server:
75
+ - WildFly/10
76
+ Pragma:
77
+ - no-cache
78
+ Date:
79
+ - Mon, 14 Mar 2016 10:54:55 GMT
80
+ Connection:
81
+ - keep-alive
82
+ Content-Type:
83
+ - application/json
84
+ Content-Length:
85
+ - '121'
86
+ body:
87
+ encoding: ASCII-8BIT
88
+ string: '{"tenantId":"28026b36-8fe4-4332-84c8-524e173a68bf","actionPlugin":"email","actionId":"my-id3","properties":{"foo":"bar"}}'
89
+ http_version:
90
+ recorded_at: Mon, 14 Mar 2016 10:54:55 GMT
91
+ - request:
92
+ method: delete
93
+ uri: http://jdoe:password@localhost:8080/hawkular/alerts/actions/email/my-id3
94
+ body:
95
+ encoding: US-ASCII
96
+ string: ''
97
+ headers:
98
+ Accept:
99
+ - application/json
100
+ Accept-Encoding:
101
+ - gzip, deflate
102
+ Content-Type:
103
+ - application/json
104
+ User-Agent:
105
+ - Ruby
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: OK
110
+ headers:
111
+ Expires:
112
+ - '0'
113
+ Cache-Control:
114
+ - no-cache, no-store, must-revalidate
115
+ X-Powered-By:
116
+ - Undertow/1
117
+ Server:
118
+ - WildFly/10
119
+ Pragma:
120
+ - no-cache
121
+ Date:
122
+ - Mon, 14 Mar 2016 10:54:55 GMT
123
+ Connection:
124
+ - keep-alive
125
+ Content-Type:
126
+ - application/json
127
+ Content-Length:
128
+ - '0'
129
+ body:
130
+ encoding: UTF-8
131
+ string: ''
132
+ http_version:
133
+ recorded_at: Mon, 14 Mar 2016 10:54:55 GMT
134
+ recorded_with: VCR 3.0.0
@@ -0,0 +1,270 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://jdoe:password@localhost:8080/hawkular/metrics/counters
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"id":"33c6a285-495a-4442-a818-974b03408a6f"}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '45'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Connection:
26
+ - keep-alive
27
+ X-Powered-By:
28
+ - Undertow/1
29
+ Server:
30
+ - WildFly/10
31
+ Location:
32
+ - http://localhost:8080/hawkular/metrics/counters/33c6a285-495a-4442-a818-974b03408a6f
33
+ Content-Length:
34
+ - '0'
35
+ Date:
36
+ - Tue, 22 Mar 2016 17:11:09 GMT
37
+ body:
38
+ encoding: UTF-8
39
+ string: ''
40
+ http_version:
41
+ recorded_at: Tue, 22 Mar 2016 17:11:09 GMT
42
+ - request:
43
+ method: post
44
+ uri: http://jdoe:password@localhost:8080/hawkular/metrics/counters/33c6a285-495a-4442-a818-974b03408a6f/data
45
+ body:
46
+ encoding: UTF-8
47
+ string: '[{"value":1,"timestamp":1458666669233},{"value":2,"timestamp":1458666669243},{"value":3,"timestamp":1458666669253}]'
48
+ headers:
49
+ Accept:
50
+ - application/json
51
+ Accept-Encoding:
52
+ - gzip, deflate
53
+ Content-Type:
54
+ - application/json
55
+ Content-Length:
56
+ - '115'
57
+ User-Agent:
58
+ - Ruby
59
+ response:
60
+ status:
61
+ code: 200
62
+ message: OK
63
+ headers:
64
+ Connection:
65
+ - keep-alive
66
+ X-Powered-By:
67
+ - Undertow/1
68
+ Server:
69
+ - WildFly/10
70
+ Content-Length:
71
+ - '0'
72
+ Date:
73
+ - Tue, 22 Mar 2016 17:11:09 GMT
74
+ body:
75
+ encoding: UTF-8
76
+ string: ''
77
+ http_version:
78
+ recorded_at: Tue, 22 Mar 2016 17:11:09 GMT
79
+ - request:
80
+ method: get
81
+ uri: http://jdoe:password@localhost:8080/hawkular/metrics/counters/33c6a285-495a-4442-a818-974b03408a6f/data/
82
+ body:
83
+ encoding: US-ASCII
84
+ string: ''
85
+ headers:
86
+ Accept:
87
+ - application/json
88
+ Accept-Encoding:
89
+ - gzip, deflate
90
+ Content-Type:
91
+ - application/json
92
+ User-Agent:
93
+ - Ruby
94
+ response:
95
+ status:
96
+ code: 200
97
+ message: OK
98
+ headers:
99
+ Content-Encoding:
100
+ - gzip
101
+ Connection:
102
+ - keep-alive
103
+ X-Powered-By:
104
+ - Undertow/1
105
+ Server:
106
+ - WildFly/10
107
+ Content-Type:
108
+ - application/json
109
+ Content-Length:
110
+ - '71'
111
+ Date:
112
+ - Tue, 22 Mar 2016 17:11:09 GMT
113
+ body:
114
+ encoding: ASCII-8BIT
115
+ string: !binary |-
116
+ H4sIAAAAAAAAAIuuVirJzE0tLknMLVCyMjQxtTADAUsjU2MdpbLEnNJUJSvj
117
+ Wh1cqkwQqoxwqzJGqDKsjQUASv4SJXMAAAA=
118
+ http_version:
119
+ recorded_at: Tue, 22 Mar 2016 17:11:09 GMT
120
+ - request:
121
+ method: post
122
+ uri: http://jdoe:password@localhost:8080/hawkular/metrics/counters/33c6a285-495a-4442-a818-974b03408a6f/data
123
+ body:
124
+ encoding: UTF-8
125
+ string: '[{"value":4,"timestamp":1458666669360}]'
126
+ headers:
127
+ Accept:
128
+ - application/json
129
+ Accept-Encoding:
130
+ - gzip, deflate
131
+ Content-Type:
132
+ - application/json
133
+ Content-Length:
134
+ - '39'
135
+ User-Agent:
136
+ - Ruby
137
+ response:
138
+ status:
139
+ code: 200
140
+ message: OK
141
+ headers:
142
+ Connection:
143
+ - keep-alive
144
+ X-Powered-By:
145
+ - Undertow/1
146
+ Server:
147
+ - WildFly/10
148
+ Content-Length:
149
+ - '0'
150
+ Date:
151
+ - Tue, 22 Mar 2016 17:11:09 GMT
152
+ body:
153
+ encoding: UTF-8
154
+ string: ''
155
+ http_version:
156
+ recorded_at: Tue, 22 Mar 2016 17:11:09 GMT
157
+ - request:
158
+ method: get
159
+ uri: http://jdoe:password@localhost:8080/hawkular/metrics/counters/33c6a285-495a-4442-a818-974b03408a6f/data/
160
+ body:
161
+ encoding: US-ASCII
162
+ string: ''
163
+ headers:
164
+ Accept:
165
+ - application/json
166
+ Accept-Encoding:
167
+ - gzip, deflate
168
+ Content-Type:
169
+ - application/json
170
+ User-Agent:
171
+ - Ruby
172
+ response:
173
+ status:
174
+ code: 200
175
+ message: OK
176
+ headers:
177
+ Content-Encoding:
178
+ - gzip
179
+ Connection:
180
+ - keep-alive
181
+ X-Powered-By:
182
+ - Undertow/1
183
+ Server:
184
+ - WildFly/10
185
+ Content-Type:
186
+ - application/json
187
+ Content-Length:
188
+ - '79'
189
+ Date:
190
+ - Tue, 22 Mar 2016 17:11:09 GMT
191
+ body:
192
+ encoding: ASCII-8BIT
193
+ string: !binary |-
194
+ H4sIAAAAAAAAAIuuVirJzE0tLknMLVCyMjQxtTADAUtjMwMdpbLEnNJUJSuT
195
+ Wh0cqoxMjeGqjHGrMkGoMsKtyhihyrA2FgCWa63dmQAAAA==
196
+ http_version:
197
+ recorded_at: Tue, 22 Mar 2016 17:11:09 GMT
198
+ - request:
199
+ method: get
200
+ uri: http://jdoe:password@localhost:8080/hawkular/metrics/counters/33c6a285-495a-4442-a818-974b03408a6f/data/?limit=1
201
+ body:
202
+ encoding: US-ASCII
203
+ string: ''
204
+ headers:
205
+ Accept:
206
+ - application/json
207
+ Accept-Encoding:
208
+ - gzip, deflate
209
+ Content-Type:
210
+ - application/json
211
+ User-Agent:
212
+ - Ruby
213
+ response:
214
+ status:
215
+ code: 200
216
+ message: OK
217
+ headers:
218
+ Content-Encoding:
219
+ - gzip
220
+ Connection:
221
+ - keep-alive
222
+ X-Powered-By:
223
+ - Undertow/1
224
+ Server:
225
+ - WildFly/10
226
+ Content-Type:
227
+ - application/json
228
+ Content-Length:
229
+ - '56'
230
+ Date:
231
+ - Tue, 22 Mar 2016 17:11:09 GMT
232
+ body:
233
+ encoding: ASCII-8BIT
234
+ string: !binary |-
235
+ H4sIAAAAAAAAAIuuVirJzE0tLknMLVCyMjQxtTADAUtjMwMdpbLEnNJUJSuT
236
+ 2lgAsUFY2CcAAAA=
237
+ http_version:
238
+ recorded_at: Tue, 22 Mar 2016 17:11:09 GMT
239
+ - request:
240
+ method: get
241
+ uri: http://jdoe:password@localhost:8080/hawkular/metrics/counters/33c6a285-495a-4442-a818-974b03408a6f/data/?end=1458652269263&start=1458637869263
242
+ body:
243
+ encoding: US-ASCII
244
+ string: ''
245
+ headers:
246
+ Accept:
247
+ - application/json
248
+ Accept-Encoding:
249
+ - gzip, deflate
250
+ Content-Type:
251
+ - application/json
252
+ User-Agent:
253
+ - Ruby
254
+ response:
255
+ status:
256
+ code: 204
257
+ message: No Content
258
+ headers:
259
+ X-Powered-By:
260
+ - Undertow/1
261
+ Server:
262
+ - WildFly/10
263
+ Date:
264
+ - Tue, 22 Mar 2016 17:11:09 GMT
265
+ body:
266
+ encoding: UTF-8
267
+ string: ''
268
+ http_version:
269
+ recorded_at: Tue, 22 Mar 2016 17:11:09 GMT
270
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,47 @@
1
+ [
2
+ [
3
+ {
4
+ "operation": "read",
5
+ "type": "text",
6
+ "data": "{\n \"path\" : \"/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;random-feed/r;random-r126\",\n \"type\" : {\n \"path\" : \"/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;random-feed/rt;random-rt-123\",\n \"name\" : \"ResourceType\",\n \"id\" : \"random-rt-123\"\n },\n \"properties\" : {\n \"version\" : 1.0\n },\n \"name\" : \"My Resource 1\",\n \"id\" : \"random-r126\"\n}"
7
+ },
8
+ {
9
+ "operation": "read",
10
+ "type": "text",
11
+ "data": "{\n \"path\" : \"/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;random-feed/r;random-r127\",\n \"type\" : {\n \"path\" : \"/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;random-feed/rt;random-rt-123\",\n \"name\" : \"ResourceType\",\n \"id\" : \"random-rt-123\"\n },\n \"properties\" : {\n \"version\" : 1.1\n },\n \"name\" : \"My Resource 2\",\n \"id\" : \"random-r127\"\n}"
12
+ },
13
+ {
14
+ "operation": "close"
15
+ }
16
+ ],
17
+ [
18
+ {
19
+ "operation": "read",
20
+ "type": "text",
21
+ "data": "{\n \"path\" : \"/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;random-feed\",\n \"id\" : \"random-feed\"\n}"
22
+ },
23
+ {
24
+ "operation": "close"
25
+ }
26
+ ],
27
+ [
28
+ {
29
+ "operation": "read",
30
+ "type": "text",
31
+ "data": "{\n \"path\" : \"/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;random-feed/rt;random-rt-123\",\n \"name\" : \"ResourceType\",\n \"id\" : \"random-rt-123\"\n}"
32
+ },
33
+ {
34
+ "operation": "close"
35
+ }
36
+ ],
37
+ [
38
+ {
39
+ "operation": "read",
40
+ "type": "text",
41
+ "data": "{\n \"path\" : \"/t;28026b36-8fe4-4332-84c8-524e173a68bf/f;random-feed\",\n \"id\" : \"random-feed\"\n}"
42
+ },
43
+ {
44
+ "operation": "close"
45
+ }
46
+ ]
47
+ ]