hawkular-client 2.9.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.rdoc +27 -0
  3. data/README.rdoc +14 -14
  4. data/lib/hawkular/alerts/alerts_api.rb +43 -7
  5. data/lib/hawkular/client_utils.rb +0 -3
  6. data/lib/hawkular/hawkular_client.rb +1 -1
  7. data/lib/hawkular/inventory/entities.rb +55 -19
  8. data/lib/hawkular/inventory/inventory_api.rb +313 -412
  9. data/lib/hawkular/metrics/metric_api.rb +5 -2
  10. data/lib/hawkular/operations/operations_api.rb +0 -8
  11. data/lib/hawkular/tokens/tokens_api.rb +0 -3
  12. data/lib/hawkular/version.rb +1 -1
  13. metadata +3 -647
  14. data/.coveralls.yml +0 -1
  15. data/.gitignore +0 -56
  16. data/.rubocop.yml +0 -32
  17. data/.travis.yml +0 -20
  18. data/.travis/start_hawkular_services.sh +0 -21
  19. data/.travis/wait_for_services.rb +0 -39
  20. data/.yardopts +0 -1
  21. data/Gemfile +0 -2
  22. data/Rakefile +0 -20
  23. data/api_breaking_changes.rdoc +0 -84
  24. data/docker-compose.yml +0 -17
  25. data/hawkularclient.gemspec +0 -43
  26. data/spec/README.rdoc +0 -62
  27. data/spec/integration/alert-resources/alerts-test-data.json +0 -40
  28. data/spec/integration/alert-resources/events-test-data.json +0 -78
  29. data/spec/integration/alert-resources/triggers-test-data.json +0 -66
  30. data/spec/integration/alerts_spec.rb +0 -774
  31. data/spec/integration/env_config_spec.rb +0 -39
  32. data/spec/integration/hawkular_client_spec.rb +0 -304
  33. data/spec/integration/hello-world-definitions.json +0 -45
  34. data/spec/integration/inventory_spec.rb +0 -680
  35. data/spec/integration/logger_spec.rb +0 -36
  36. data/spec/integration/metric_spec.rb +0 -953
  37. data/spec/integration/operations_spec.rb +0 -591
  38. data/spec/integration/tokens_spec.rb +0 -49
  39. data/spec/resources/driver.jar +0 -0
  40. data/spec/resources/sample.war +0 -0
  41. data/spec/spec_helper.rb +0 -336
  42. data/spec/unit/base_spec.rb +0 -256
  43. data/spec/unit/canonical_path_spec.rb +0 -102
  44. data/spec/unit/client_spec.rb +0 -55
  45. data/spec/unit/deprecations_spec.rb +0 -19
  46. data/spec/vcr/vcr_setup.rb +0 -16
  47. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_acknowledge_an_alert.yml +0 -205
  48. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_add_tags_to_existing_alert.yml +0 -210
  49. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_fetch_single_alert.yml +0 -108
  50. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts.yml +0 -59
  51. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_trigger.yml +0 -58
  52. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_alerts_for_unknown_trigger.yml +0 -50
  53. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_list_open_alerts.yml +0 -59
  54. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_remove_tags_from_existing_alert.yml +0 -257
  55. data/spec/vcr_cassettes/Alert/Alerts/Templates/Should_resolve_an_alert.yml +0 -207
  56. data/spec/vcr_cassettes/Alert/Alerts/Templates/setup.yml +0 -255
  57. data/spec/vcr_cassettes/Alert/Alerts/Templates/setup_cleanup.yml +0 -302
  58. data/spec/vcr_cassettes/Alert/EndToEnd/Templates/Should_create_and_fire_a_trigger.yml +0 -527
  59. data/spec/vcr_cassettes/Alert/Events/Templates/Should_create_an_event.yml +0 -101
  60. data/spec/vcr_cassettes/Alert/Events/Templates/Should_delete_an_event.yml +0 -148
  61. data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events.yml +0 -91
  62. data/spec/vcr_cassettes/Alert/Events/Templates/Should_list_events_using_criteria.yml +0 -60
  63. data/spec/vcr_cassettes/Alert/Events/Templates/Should_not_list_events_using_criteria.yml +0 -50
  64. data/spec/vcr_cassettes/Alert/Events/Templates/setup.yml +0 -615
  65. data/spec/vcr_cassettes/Alert/Events/Templates/setup_cleanup.yml +0 -567
  66. data/spec/vcr_cassettes/Alert/Groups/Templates/Should_operate_a_complex_group_trigger.yml +0 -1882
  67. data/spec/vcr_cassettes/Alert/Templates/Should_return_the_version.yml +0 -42
  68. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers.yml +0 -55
  69. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_ID.yml +0 -56
  70. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tag.yml +0 -56
  71. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_List_Triggers_for_Tags.yml +0 -56
  72. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_bulk_load_triggers.yml +0 -243
  73. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_a_basic_trigger_with_action.yml +0 -386
  74. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_a_firing_ALL_ANY_trigger.yml +0 -483
  75. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_create_an_action.yml +0 -146
  76. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_Trigger_with_conditions.yml +0 -144
  77. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_a_single_metric_Trigger.yml +0 -50
  78. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_get_the_action_definitions.yml +0 -228
  79. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_plugin.yml +0 -50
  80. data/spec/vcr_cassettes/Alert/Triggers/Templates/Should_not_create_an_action_for_unknown_properties.yml +0 -100
  81. data/spec/vcr_cassettes/Alert/Triggers/Templates/setup.yml +0 -52
  82. data/spec/vcr_cassettes/Alert/Triggers/Templates/setup_cleanup.yml +0 -285
  83. data/spec/vcr_cassettes/HawkularClient/Should_err_on_bad_credentials.yml +0 -42
  84. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_create_and_delete_feed.yml +0 -317
  85. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_WildFlys.yml +0 -103
  86. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_both_list_types_with_bad_feed.yml +0 -103
  87. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_same_types_when_param_is_given.yml +0 -325
  88. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_feeds.yml +0 -117
  89. data/spec/vcr_cassettes/HawkularClient/and_Inventory_client/Should_list_the_same_resource_types.yml +0 -111
  90. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_create_and_retrieve_tags_for_Availability.yml +0 -155
  91. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_create_and_return_Availability_using_Hash_parameter.yml +0 -155
  92. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_return_the_version.yml +0 -89
  93. data/spec/vcr_cassettes/HawkularClient/and_Metrics_client/Should_both_work_the_same_way_when_pushing_metric_data_to_non-existing_counter.yml +0 -114
  94. data/spec/vcr_cassettes/HawkularClient/and_Operations_client/Should_both_work_the_same_way.yml +0 -158
  95. data/spec/vcr_cassettes/HawkularClient/and_Operations_client/Should_work_initializing_with_URI.yml +0 -48
  96. data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_both_work_the_same_way.json +0 -44
  97. data/spec/vcr_cassettes/HawkularClient/and_Operations_client_Should_work_initializing_with_URI.json +0 -9
  98. data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI.yml +0 -169
  99. data/spec/vcr_cassettes/HawkularClient/and_URIs_as_input/Should_work_with_URI_on_metrics_client.yml +0 -42
  100. data/spec/vcr_cassettes/Inventory/NonSecure/Connection/Templates/Should_err_on_bad_credentials.yml +0 -44
  101. data/spec/vcr_cassettes/Inventory/NonSecure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +0 -101
  102. data/spec/vcr_cassettes/Inventory/NonSecure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +0 -101
  103. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +0 -47
  104. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +0 -207
  105. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/create_url.yml +0 -52
  106. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +0 -411
  107. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Helpers/get_feeds.yml +0 -62
  108. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +0 -133
  109. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_feed.yml +0 -59
  110. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_feed_again.yml +0 -181
  111. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +0 -664
  112. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resource.yml +0 -360
  113. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +0 -846
  114. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +0 -169
  115. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +0 -166
  116. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +0 -420
  117. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
  118. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_have_a_consistent_behaviour_when_creating_an_already_existing_resource.yml +0 -714
  119. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +0 -73
  120. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_URLs.yml +0 -90
  121. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_WildFlys.yml +0 -70
  122. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +0 -138
  123. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +0 -59
  124. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +0 -333
  125. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +0 -180
  126. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_feeds.yml +0 -62
  127. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +0 -943
  128. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +0 -361
  129. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +0 -94
  130. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +0 -294
  131. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +0 -871
  132. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +0 -740
  133. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +0 -1117
  134. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +0 -393
  135. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +0 -84
  136. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +0 -55
  137. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_list_types_with_feed.yml +0 -166
  138. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +0 -59
  139. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +0 -66
  140. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +0 -71
  141. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_data_from_get_entity.yml +0 -230
  142. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_return_the_version.yml +0 -50
  143. data/spec/vcr_cassettes/Inventory/Secure/Connection/Templates/Should_err_on_bad_credentials.yml +0 -44
  144. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +0 -101
  145. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +0 -101
  146. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +0 -47
  147. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +0 -207
  148. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/create_url.yml +0 -52
  149. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +0 -411
  150. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/get_feeds.yml +0 -62
  151. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +0 -133
  152. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed.yml +0 -59
  153. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed_again.yml +0 -181
  154. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +0 -664
  155. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource.yml +0 -360
  156. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +0 -846
  157. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +0 -169
  158. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +0 -166
  159. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +0 -420
  160. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
  161. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +0 -73
  162. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_URLs.yml +0 -90
  163. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys.yml +0 -70
  164. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +0 -138
  165. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +0 -59
  166. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +0 -333
  167. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +0 -180
  168. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_feeds.yml +0 -62
  169. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +0 -943
  170. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +0 -361
  171. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +0 -90
  172. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +0 -294
  173. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +0 -871
  174. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +0 -740
  175. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +0 -1117
  176. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +0 -393
  177. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +0 -84
  178. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +0 -55
  179. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_feed.yml +0 -166
  180. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +0 -59
  181. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +0 -66
  182. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +0 -71
  183. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_the_version.yml +0 -50
  184. data/spec/vcr_cassettes/Inventory/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml +0 -114
  185. data/spec/vcr_cassettes/Inventory/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +0 -132
  186. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +0 -51
  187. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +0 -92
  188. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +0 -101
  189. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +0 -101
  190. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +0 -101
  191. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +0 -50
  192. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +0 -146
  193. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +0 -146
  194. data/spec/vcr_cassettes/Metrics/NonSecure/ID_with_special_characters/Templates/setup_client.yml +0 -44
  195. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -83
  196. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -83
  197. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -120
  198. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -200
  199. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -83
  200. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -83
  201. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -200
  202. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -237
  203. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -120
  204. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -83
  205. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -83
  206. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -237
  207. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -120
  208. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_return_periods.yml +0 -81
  209. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -200
  210. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -270
  211. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -237
  212. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Simple/Should_be_Cool.yml +0 -82
  213. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Status/Should_return_the_version.yml +0 -42
  214. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_8_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -83
  215. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metric_tags_for_metrics_definitions.yml +0 -434
  216. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/All_Tags_for_metrics/Should_fetch_all_metrics_with_some_tags.yml +0 -1251
  217. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
  218. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
  219. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -138
  220. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -144
  221. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
  222. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Availability_metrics/setup_client.yml +0 -44
  223. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
  224. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
  225. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
  226. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
  227. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
  228. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
  229. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Counter_metrics/setup_client.yml +0 -44
  230. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
  231. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
  232. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
  233. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
  234. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
  235. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -196
  236. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +0 -197
  237. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
  238. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/setup_client.yml +0 -44
  239. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_rate_stats_for_mixed_metric.yml +0 -328
  240. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +0 -363
  241. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -414
  242. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
  243. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
  244. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/setup_client.yml +0 -44
  245. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/No_Tenant/Should_fail.yml +0 -89
  246. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Simple/Should_be_Cool.yml +0 -48
  247. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Status/Should_return_the_version.yml +0 -85
  248. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_create_string_definition_using_Hash.yml +0 -99
  249. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_create_string_definition_using_MetricDefinition.yml +0 -99
  250. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_push_metric_data_to_existing_string.yml +0 -281
  251. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/Should_push_metric_data_to_non-existing_string.yml +0 -144
  252. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/String_metrics/setup_client.yml +0 -44
  253. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tags_Metrics/setup_client.yml +0 -44
  254. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -103
  255. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/setup_client.yml +0 -44
  256. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/setup_client.yml +0 -44
  257. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +0 -51
  258. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +0 -92
  259. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +0 -101
  260. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +0 -101
  261. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +0 -101
  262. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +0 -50
  263. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +0 -146
  264. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +0 -146
  265. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -99
  266. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +0 -99
  267. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +0 -97
  268. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -144
  269. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -240
  270. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +0 -99
  271. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -99
  272. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -240
  273. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +0 -328
  274. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -281
  275. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -144
  276. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +0 -99
  277. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -99
  278. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -281
  279. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -144
  280. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +0 -97
  281. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -50
  282. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +0 -51
  283. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -240
  284. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +0 -364
  285. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +0 -373
  286. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -314
  287. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -285
  288. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/No_Tenant/Should_fail.yml +0 -50
  289. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Simple/Should_be_Cool.yml +0 -48
  290. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Status/Should_return_the_version.yml +0 -44
  291. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -99
  292. data/spec/vcr_cassettes/New_API_Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -230
  293. data/spec/vcr_cassettes/New_API_Mixed_metrics/Should_send_mixed_metric_request.yml +0 -300
  294. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/agent_properties.yml +0 -124
  295. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_feed.yml +0 -61
  296. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_tenant.yml +0 -55
  297. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -23
  298. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_XA_datasource_should_be_doable.json +0 -23
  299. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_deployment_should_be_doable.json +0 -23
  300. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_non-XA_datasource_should_be_doable.json +0 -23
  301. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -23
  302. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -23
  303. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -23
  304. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -32
  305. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -23
  306. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -23
  307. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -23
  308. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Update_collection_intervals_should_be_performed_and_eventually_respond_with_success.json +0 -23
  309. data/spec/vcr_cassettes/Operation/NonSecure/Operation/should_not_be_possible_to_perform_on_closed_client.json +0 -12
  310. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
  311. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
  312. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_no_host.json +0 -3
  313. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established.json +0 -9
  314. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
  315. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback.json +0 -18
  316. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +0 -13
  317. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_feed.yml +0 -61
  318. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_tenant.yml +0 -55
  319. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -23
  320. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_datasource_should_be_doable.json +0 -23
  321. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_deployment_should_be_doable.json +0 -23
  322. data/spec/vcr_cassettes/Operation/Secure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -23
  323. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -23
  324. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -23
  325. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -32
  326. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -23
  327. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -23
  328. data/spec/vcr_cassettes/Operation/Secure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -23
  329. data/spec/vcr_cassettes/Operation/Secure/Operation/should_not_be_possible_to_perform_on_closed_client.json +0 -12
  330. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
  331. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
  332. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_no_host.json +0 -3
  333. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established.json +0 -9
  334. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
  335. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback.json +0 -18
  336. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +0 -13
  337. data/spec/vcr_cassettes/Tokens/Should_be_able_to_create_a_new_token_for_an_actual_user.yml +0 -57
  338. data/spec/vcr_cassettes/Tokens/Should_be_able_to_list_the_available_tokens.yml +0 -49
  339. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_with_a_wrong_password.yml +0 -56
  340. data/spec/vcr_cassettes/Tokens/Should_get_a_401_when_attempting_to_create_a_token_without_a_password.yml +0 -55
@@ -1,39 +0,0 @@
1
- require_relative '../spec_helper'
2
-
3
- require 'hawkular/env_config'
4
-
5
- describe Hawkular::EnvConfig do
6
- subject(:config) { Hawkular::EnvConfig }
7
- describe '.log_response?' do
8
- it 'is true if defined' do
9
- swap_env('HAWKULARCLIENT_LOG_RESPONSE', 'true') do
10
- expect(config.log_response?).to be_truthy
11
- end
12
- end
13
-
14
- it 'is false if null' do
15
- swap_env('HAWKULARCLIENT_LOG_RESPONSE', nil) do
16
- expect(config.log_response?).to be_falsey
17
- end
18
- end
19
- end
20
-
21
- describe '.rest_timeout' do
22
- it 'returns the value for the environment' do
23
- swap_env('HAWKULARCLIENT_REST_TIMEOUT', '20') do
24
- expect(config.rest_timeout).to eq '20'
25
- end
26
- end
27
- end
28
-
29
- private
30
-
31
- def swap_env(name, value)
32
- old_value = ENV[name]
33
- ENV[name] = value
34
-
35
- yield
36
- ensure
37
- ENV[name] = old_value
38
- end
39
- end
@@ -1,304 +0,0 @@
1
- require_relative '../vcr/vcr_setup'
2
- require_relative '../spec_helper'
3
-
4
- require 'securerandom'
5
-
6
- # examples that tests the main client which delegates all the calls to Hawkular component clients
7
- module Hawkular::Client::RSpec
8
- HOST = 'http://localhost:8080'
9
-
10
- describe 'HawkularClient' do
11
- before(:all) do
12
- @creds = {
13
- username: 'jdoe',
14
- password: 'password'
15
- }
16
- ::RSpec::Mocks.with_temporary_scope do
17
- mock_inventory_client '0.17.2.Final'
18
- mock_metrics_version
19
- @hawkular_client = Hawkular::Client.new(entrypoint: HOST, credentials: @creds, options: { tenant: 'hawkular' })
20
- @hawkular_client.inventory
21
- @hawkular_client.metrics
22
- end
23
- @state = {
24
- hostname: 'localhost.localdomain',
25
- feed: nil
26
- }
27
- end
28
-
29
- it 'Should err on bad credentials' do
30
- VCR.use_cassette('HawkularClient/Should err on bad credentials') do
31
- @creds = {
32
- username: '-XX-X-jdoe-X',
33
- password: 'password'
34
- }
35
- expect do
36
- Hawkular::Client.new(entrypoint: HOST, credentials: @creds).inventory_list_feeds
37
- end.to raise_error(Hawkular::BaseClient::HawkularException, 'Unauthorized')
38
- end
39
- end
40
-
41
- it 'Should fail when calling method with unknown prefix' do
42
- expect { @hawkular_client.ynventori_list_feeds }.to raise_error(RuntimeError)
43
- expect { @hawkular_client.list_feeds }.to raise_error(RuntimeError)
44
- end
45
-
46
- it 'Should fail when calling unknown method with known client prefix' do
47
- expect { @hawkular_client.inventory_lyst_feeds }.to raise_error(NoMethodError)
48
- expect { @hawkular_client.metrics_lyst_feeds }.to raise_error(NoMethodError)
49
- expect { @hawkular_client.alerts_lyst_feeds }.to raise_error(NoMethodError)
50
- expect { @hawkular_client.tokens_lyst_feeds }.to raise_error(NoMethodError)
51
- end
52
-
53
- context 'and URIs as input', vcr: { decode_compressed_response: true } do
54
- it 'Should work with URI' do
55
- uri = URI.parse HOST
56
- opts = { tenant: 'hawkular' }
57
- ::RSpec::Mocks.with_temporary_scope do
58
- mock_metrics_version
59
- the_client = Hawkular::Client.new(entrypoint: uri, credentials: @creds, options: opts)
60
- expect { the_client.inventory.list_feeds }.to_not raise_error
61
- end
62
- end
63
-
64
- it 'Should work with URI on metrics client' do
65
- uri = URI.parse HOST
66
- opts = { tenant: 'hawkular' }
67
- ::RSpec::Mocks.with_temporary_scope do
68
- mock_metrics_version
69
- the_client = Hawkular::Metrics::Client.new(uri, @creds, opts)
70
- expect { the_client.http_get '/status' }.to_not raise_error
71
- end
72
- end
73
-
74
- it 'Should work with https URI on metrics client' do
75
- uri = URI.parse 'https://localhost:8080'
76
- opts = { tenant: 'hawkular' }
77
- ::RSpec::Mocks.with_temporary_scope do
78
- mock_metrics_version
79
- the_client = Hawkular::Metrics::Client.new(uri, @creds, opts)
80
- expect !the_client.nil?
81
- end
82
- end
83
- end
84
-
85
- context 'and Inventory client', vcr: { decode_compressed_response: true } do
86
- before(:all) do
87
- ::RSpec::Mocks.with_temporary_scope do
88
- mock_inventory_client '0.17.2.Final'
89
- @client = Hawkular::Inventory::Client.create(entrypoint: HOST,
90
- credentials: @creds,
91
- options: { tenant: 'hawkular' })
92
- end
93
- end
94
-
95
- it 'Should list the same feeds' do
96
- feeds1 = @client.list_feeds
97
- feeds2 = @hawkular_client.inventory_list_feeds
98
-
99
- expect(feeds1).to match_array(feeds2)
100
- @state[:feed] = feeds1[0] unless feeds1[0].nil?
101
- end
102
-
103
- it 'Should list the same resource types' do
104
- types1 = @client.list_resource_types
105
- types2 = @hawkular_client.inventory_list_resource_types
106
-
107
- expect(types1).to match_array(types2)
108
- end
109
-
110
- it 'Should list same types when param is given' do
111
- types1 = @client.list_resource_types(@state[:feed])
112
- types2 = @hawkular_client.inventory_list_resource_types(@state[:feed])
113
-
114
- expect(types1).to match_array(types2)
115
- end
116
-
117
- it 'Should both list types with bad feed' do
118
- type = 'does not exist'
119
- types1 = @client.list_resource_types(type)
120
- types2 = @hawkular_client.inventory_list_resource_types(type)
121
-
122
- expect(types1).to match_array(types2)
123
- end
124
-
125
- it 'Should both list WildFlys' do
126
- path = Hawkular::Inventory::CanonicalPath.new(feed_id: @state[:feed],
127
- resource_type_id: hawk_escape_id('WildFly Server'))
128
- resources1 = @client.list_resources_for_type(path.to_s)
129
- resources2 = @hawkular_client.inventory_list_resources_for_type(path)
130
-
131
- expect(resources1).to match_array(resources2)
132
- end
133
-
134
- it 'Should both create and delete feed' do
135
- feed_id1 = 'feed_1123sdn'
136
- feed_id2 = 'feed_1124sdn'
137
- @client.create_feed feed_id1
138
- @hawkular_client.inventory_create_feed feed_id2
139
-
140
- feed_list = @client.list_feeds
141
- expect(feed_list).to include(feed_id1)
142
- expect(feed_list).to include(feed_id2)
143
-
144
- @client.delete_feed feed_id2
145
- @hawkular_client.inventory.delete_feed feed_id1
146
-
147
- feed_list = @hawkular_client.inventory_list_feeds
148
- expect(feed_list).not_to include(feed_id1)
149
- expect(feed_list).not_to include(feed_id2)
150
- end
151
- end
152
-
153
- context 'and Metrics client' do
154
- include Hawkular::Metrics::RSpec
155
-
156
- before(:all) do
157
- ::RSpec::Mocks.with_temporary_scope do
158
- mock_metrics_version
159
- @client = Hawkular::Metrics::Client.new(HOST, @creds)
160
- end
161
- end
162
-
163
- it 'Should both work the same way when pushing metric data to non-existing counter' do
164
- id = SecureRandom.uuid
165
-
166
- VCR.use_cassette('HawkularClient/and_Metrics_client/Should both work the same way when' \
167
- ' pushing metric data to non-existing counter',
168
- erb: { id: id }, record: :none, decode_compressed_response: true
169
- ) do
170
- @client.counters.push_data(id, value: 4)
171
-
172
- data = @hawkular_client.metrics.counters.get_data(id)
173
- expect(data.size).to be 1
174
- counter = @hawkular_client.metrics.counters.get(id)
175
- expect(counter.id).to eql(id)
176
- end
177
- end
178
-
179
- it 'Should both create and return Availability using Hash parameter' do
180
- id1 = SecureRandom.uuid
181
- id2 = SecureRandom.uuid
182
- VCR.use_cassette(
183
- 'HawkularClient/and_Metrics_client/Should both create and return Availability using Hash parameter',
184
- erb: { id1: id1, id2: id2 }, record: :none, decode_compressed_response: true
185
- ) do
186
- @client.avail.create(id: id1, dataRetention: 123, tags: { some: 'value' })
187
- metric = @hawkular_client.metrics.avail.get(id1)
188
- expect(metric.id).to eql(id1)
189
- expect(metric.data_retention).to eql(123)
190
-
191
- @hawkular_client.metrics.avail.create(id: id2, dataRetention: 321, tags: { some: 'value' })
192
- metric = @client.avail.get(id2)
193
- expect(metric.id).to eql(id2)
194
- expect(metric.data_retention).to eql(321)
195
- end
196
- end
197
-
198
- it 'Should both update tags for Availability' do
199
- id1 = SecureRandom.uuid
200
- id2 = SecureRandom.uuid
201
-
202
- VCR.use_cassette('HawkularClient/and_Metrics_client/Should both create and retrieve tags for Availability',
203
- erb: { id1: id1, id2: id2 }, record: :none, decode_compressed_response: true
204
- ) do
205
- @client.avail.create(id: id1, tags: { myTag: id1 })
206
- metric = @hawkular_client.metrics.avail.get(id1)
207
- expect(metric.id).to eql(id1)
208
-
209
- @hawkular_client.metrics.avail.create(id: id2, tags: { myTag: id2 })
210
- metric = @client.avail.get(id2)
211
- expect(metric.id).to eql(id2)
212
- end
213
- end
214
-
215
- it 'Should both return the version' do
216
- VCR.use_cassette('HawkularClient/and_Metrics_client/Should both return the version') do
217
- data1 = @client.fetch_version_and_status
218
- data2 = @hawkular_client.metrics.fetch_version_and_status
219
- expect(data1).to eql(data2)
220
- end
221
- end
222
- end
223
-
224
- context 'and Operations client', vcr: { decode_compressed_response: true } do
225
- include Hawkular::Operations::RSpec
226
-
227
- WebSocketVCR.configure do |c|
228
- c.hook_uris = ['localhost:8080']
229
- end
230
-
231
- let(:example) do |e|
232
- e
233
- end
234
-
235
- it 'Should both work the same way', :websocket do
236
- tenant_id = @hawkular_client.inventory_get_tenant
237
- tenant_id2 = @hawkular_client.inventory.get_tenant
238
- expect(tenant_id).to eql(tenant_id2)
239
-
240
- feed_id = @hawkular_client.inventory.list_feeds.first
241
- wf_server_resource_id = 'Local~~'
242
- alerts_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-alerts-actions-email.war'
243
-
244
- WebSocketVCR.record(example, self) do
245
- path = Hawkular::Inventory::CanonicalPath.new(tenant_id: tenant_id,
246
- feed_id: feed_id,
247
- resource_ids: [wf_server_resource_id, alerts_war_resource_id])
248
-
249
- redeploy = {
250
- operationName: 'Redeploy',
251
- resourcePath: path.to_s
252
- }
253
-
254
- actual_data = {}
255
- client = Hawkular::Operations::Client.new(entrypoint: HOST, credentials: @creds)
256
- client.invoke_generic_operation(redeploy) do |on|
257
- on.success do |data|
258
- actual_data[:data] = data
259
- end
260
- on.failure do |error|
261
- actual_data[:data] = {}
262
- puts 'error callback was called, reason: ' + error.to_s
263
- end
264
- end
265
-
266
- actual_data = wait_for actual_data
267
- expect(actual_data['status']).to eq('OK')
268
-
269
- # now do the same on the main client
270
- actual_data = {}
271
- @hawkular_client.operations_invoke_generic_operation(redeploy) do |on|
272
- on.success do |data|
273
- actual_data[:data] = data
274
- end
275
- on.failure do |error|
276
- actual_data[:data] = {}
277
- puts 'error callback was called, reason: ' + error.to_s
278
- end
279
- end
280
-
281
- actual_data = wait_for actual_data
282
- expect(actual_data['status']).to eq('OK')
283
- end
284
- end
285
-
286
- it 'Should work initializing with URI' do
287
- uri = URI.parse HOST
288
- opts = { tenant: 'hawkular' }
289
- WebSocketVCR.record(example, self) do
290
- ::RSpec::Mocks.with_temporary_scope do
291
- mock_metrics_version
292
- the_client = Hawkular::Client.new(entrypoint: uri, credentials: @creds, options: opts)
293
- expect { the_client.operations }.to_not raise_error
294
- end
295
- end
296
- end
297
-
298
- xit 'Should both reuse the websocket connection', :websocket do
299
- WebSocketVCR.record(example, self) do
300
- end
301
- end
302
- end
303
- end
304
- end
@@ -1,45 +0,0 @@
1
- {
2
- "triggers":[
3
- {
4
- "trigger":{
5
- "id": "hello-world-trigger",
6
- "name": "Hello World Trigger",
7
- "description": "A mandatory Hello World Trigger",
8
- "severity": "HIGH",
9
- "enabled": true,
10
- "actions":[
11
- {
12
- "actionPlugin": "email",
13
- "actionId": "notify-to-admins"
14
- }
15
- ]
16
- },
17
- "conditions":[
18
- {
19
- "triggerMode": "FIRING",
20
- "type": "threshold",
21
- "dataId": "data-x",
22
- "operator": "LT",
23
- "threshold": 5
24
- },
25
- {
26
- "triggerMode": "FIRING",
27
- "type": "threshold",
28
- "dataId": "data-y",
29
- "operator": "GT",
30
- "threshold": 5
31
- }
32
- ]
33
- }
34
- ],
35
- "actions":[
36
- {
37
- "actionPlugin": "email",
38
- "actionId": "notify-to-admins",
39
- "properties": {
40
- "to": "admins@hawkular.org",
41
- "cc": "developers@hawkular.org"
42
- }
43
- }
44
- ]
45
- }
@@ -1,680 +0,0 @@
1
- require_relative '../vcr/vcr_setup'
2
- require_relative '../spec_helper'
3
-
4
- require 'securerandom'
5
-
6
- module Hawkular::Inventory::RSpec
7
- DEFAULT_VERSION = '0.17.2.Final'
8
- VERSION = ENV['INVENTORY_VERSION'] || DEFAULT_VERSION
9
-
10
- SKIP_SECURE_CONTEXT = ENV['SKIP_SECURE_CONTEXT'] || '1'
11
-
12
- URL_RESOURCE = 'http://bsd.de'
13
-
14
- NON_SECURE_CONTEXT = :NonSecure
15
- SECURE_CONTEXT = :Secure
16
-
17
- [NON_SECURE_CONTEXT, SECURE_CONTEXT].each do |security_context|
18
- next if security_context == SECURE_CONTEXT && SKIP_SECURE_CONTEXT == '1'
19
-
20
- context "#{security_context}" do
21
- include Hawkular::Inventory
22
-
23
- alias_method :helper_entrypoint, :entrypoint
24
-
25
- let(:entrypoint) do
26
- helper_entrypoint(security_context, 'inventory')
27
- end
28
-
29
- describe 'Inventory Tenants' do
30
- let(:cassette_name) do |example|
31
- description = example.description
32
- description
33
- end
34
-
35
- around(:each) do |example|
36
- record("Inventory/#{security_context}/Tenants", credentials, cassette_name, example: example)
37
- end
38
-
39
- it 'Should Get Tenant For Explicit Credentials' do
40
- # get the client for given endpoint for given credentials
41
- creds = credentials
42
- mock_inventory_client(VERSION) unless ENV['VCR_UPDATE'] == '1' || ENV['VCR_OFF'] == '1'
43
- options = { tenant: 'hawkular' }
44
- client = setup_inventory_client entrypoint, options
45
- tenant = client.get_tenant(creds)
46
- expect(tenant).to eq('hawkular')
47
- end
48
-
49
- it 'Should Get Tenant For Implicit Credentials' do
50
- creds = credentials
51
- mock_inventory_client(VERSION) unless ENV['VCR_UPDATE'] == '1' || ENV['VCR_OFF'] == '1'
52
- options = { tenant: 'hawkular' }
53
- client = setup_inventory_client entrypoint, options
54
- tenant = client.get_tenant(creds)
55
- expect(tenant).to eq('hawkular')
56
- end
57
- end
58
-
59
- describe 'Inventory Connection' do
60
- let(:cassette_name) do |example|
61
- description = example.description
62
- description
63
- end
64
-
65
- around(:each) do |example|
66
- record("Inventory/#{security_context}/Connection", credentials, cassette_name, example: example)
67
- end
68
-
69
- it 'Should err on bad credentials' do
70
- @creds = credentials
71
- @creds[:username] << @creds[:password]
72
- VCR.eject_cassette
73
- record("Inventory/#{security_context}/Connection", @creds, cassette_name) do
74
- expect do
75
- Hawkular::Inventory::Client.create(entrypoint: entrypoint, credentials: @creds)
76
- end.to raise_error(Hawkular::BaseClient::HawkularException, 'Unauthorized')
77
- end
78
- end
79
- end
80
-
81
- describe 'Inventory' do
82
- created_feeds = Set.new
83
-
84
- before(:all) do
85
- @creds = credentials
86
-
87
- @state = {
88
- super_secret_username: @creds[:username],
89
- super_secret_password: @creds[:password]
90
- }
91
-
92
- client_options = { tenant: 'hawkular' }
93
-
94
- if ENV['VCR_UPDATE'] == '1'
95
- VCR.turn_off!(ignore_cassettes: true)
96
- WebMock.allow_net_connect!
97
- @client = setup_inventory_client helper_entrypoint(security_context, 'inventory'), client_options
98
- WebMock.disable_net_connect!
99
- VCR.turn_on!
100
- else
101
- ::RSpec::Mocks.with_temporary_scope do
102
- mock_inventory_client(VERSION) unless ENV['VCR_UPDATE'] == '1'
103
- @client = setup_inventory_client helper_entrypoint(security_context, 'inventory'), client_options
104
- end
105
- end
106
-
107
- x, y, = @client.version
108
- record("Inventory/#{security_context}/inventory_#{x}_#{y}", @state.clone, 'Helpers/get_feeds') do
109
- feeds = @client.list_feeds
110
- @state[:feed_uuid] = feeds[0]
111
- end
112
-
113
- record("Inventory/#{security_context}/inventory_#{x}_#{y}", @state.clone, 'Helpers/wait_for_wildfly') do
114
- wait_while do
115
- @client.list_resources_for_feed(@state[:feed_uuid]).length < 2
116
- end
117
- end if ENV['RUN_ON_LIVE_SERVER'] == '1'
118
-
119
- # create 1 URL resource and its metrics
120
- record("Inventory/#{security_context}/inventory_#{x}_#{y}", @state.clone, 'Helpers/create_url') do
121
- headers = {}
122
- headers[:'Hawkular-Tenant'] = client_options[:tenant]
123
- rest_client = RestClient::Resource.new(helper_entrypoint(security_context, 'urls'),
124
- user: credentials[:username],
125
- password: credentials[:password],
126
- headers: headers)
127
- url_json = {
128
- url: URL_RESOURCE
129
- }.to_json
130
-
131
- begin
132
- rest_client.post(url_json, content_type: 'application/json')
133
- rescue
134
- puts 'failed to create the url, it might be already there'
135
- # no big deal, the url is probably already there
136
- end
137
- end
138
-
139
- sleep 2 if ENV['VCR_UPDATE'] == '1' || ENV['VCR_OFF'] == '1'
140
- end
141
-
142
- before(:each) do
143
- inventory_create_feed_method = @client.method(:create_feed)
144
- allow(@client).to receive(:create_feed) do |feed|
145
- created_feeds << feed
146
- inventory_create_feed_method.call(feed)
147
- end
148
- end
149
-
150
- after(:all) do
151
- require 'fileutils'
152
- x, y, = @client.version
153
- FileUtils.rm_rf "#{VCR.configuration.cassette_library_dir}"\
154
- "/Inventory/#{security_context}/inventory#{x}_#{y}/tmp"
155
-
156
- if ENV['VCR_UPDATE'] == '1' || ENV['VCR_OFF'] == '1'
157
- VCR.turn_off!(ignore_cassettes: true)
158
- WebMock.allow_net_connect!
159
- created_feeds.each do |feed|
160
- begin
161
- @client.delete_feed feed
162
- # rubocop:disable HandleExceptions
163
- rescue
164
- # rubocop:enable HandleExceptions
165
- end
166
- end
167
- WebMock.disable_net_connect!
168
- VCR.turn_on!
169
- end
170
- end
171
-
172
- let(:cassette_name) do |example|
173
- description = example.description
174
- description
175
- end
176
-
177
- let(:feed_id) do
178
- @state[:feed_uuid]
179
- end
180
-
181
- let(:wildfly_type) do
182
- Hawkular::Inventory::CanonicalPath.new(feed_id: feed_id, resource_type_id: hawk_escape_id('WildFly Server'))
183
- end
184
-
185
- around(:each) do |example|
186
- major, minor, = @client.version
187
- record("Inventory/#{security_context}/inventory_#{major}_#{minor}", @state, cassette_name, example: example)
188
- end
189
-
190
- it 'Should list feeds' do
191
- feeds = @client.list_feeds
192
-
193
- expect(feeds.size).to be > 0
194
- end
195
-
196
- it 'Should list resources for feed' do
197
- resources = @client.list_resources_for_feed feed_id
198
-
199
- expect(resources.size).to be(2)
200
- end
201
-
202
- it 'Should list all the resource types' do
203
- types = @client.list_resource_types
204
- # new API returns only the feedless types here, while the old one returned all the types
205
- expect(types.size).to be > 0
206
- end
207
-
208
- it 'Should list types with feed' do
209
- types = @client.list_resource_types(feed_id)
210
-
211
- expect(types.size).to be >= 18
212
- end
213
-
214
- it 'Should list types with bad feed' do
215
- type = 'does not exist'
216
- types = @client.list_resource_types(type)
217
- expect(type).to eq('does not exist')
218
-
219
- expect(types.size).to be(0)
220
- end
221
-
222
- it 'Should list WildFlys' do
223
- resources = @client.list_resources_for_type(wildfly_type.to_s)
224
-
225
- expect(resources.size).to be(1)
226
- end
227
-
228
- it 'Should list WildFlys with props' do
229
- resources = @client.list_resources_for_type(wildfly_type.to_s, fetch_properties: true)
230
-
231
- expect(resources.size).to be(1)
232
- wf = resources.first
233
- expect(wf.properties['Hostname']).not_to be_empty
234
- end
235
-
236
- it 'Should List datasources with no props' do
237
- type_path = Hawkular::Inventory::CanonicalPath.new(
238
- feed_id: feed_id,
239
- resource_type_id: hawk_escape_id('Datasource'))
240
- resources = @client.list_resources_for_type(type_path.to_s, fetch_properties: true)
241
-
242
- expect(resources.size).to be > 0
243
- end
244
-
245
- it 'Should list URLs' do
246
- type_path = Hawkular::Inventory::CanonicalPath.new(resource_type_id: hawk_escape_id('URL'))
247
- resources = @client.list_resources_for_type(type_path.to_s)
248
- expect(resources.size).to be > 0
249
- resource = resources[0]
250
- expect(resource.instance_of? Hawkular::Inventory::Resource).to be_truthy
251
- # depends how pinger is fast
252
- expect(2..6).to cover(resource.properties.size)
253
- expect(resource.properties['url']).to eq(URL_RESOURCE)
254
- end
255
-
256
- it 'Should list metrics for WildFlys' do
257
- resources = @client.list_resources_for_type(wildfly_type.to_s)
258
- wild_fly = resources[0]
259
-
260
- metrics = @client.list_metrics_for_resource(wild_fly.path)
261
-
262
- expect(metrics.size).to be(14)
263
- end
264
-
265
- it 'Should list children of WildFly' do
266
- resources = @client.list_resources_for_type(wildfly_type.to_s)
267
- wild_fly = resources[0]
268
-
269
- children = @client.list_child_resources(wild_fly.path)
270
-
271
- expect(children.size).to be > 10
272
- end
273
-
274
- it 'Should list children of nested resource' do
275
- wildfly_res_id = hawk_escape_id 'Local~~'
276
- datasource_res_id = hawk_escape_id 'Local~/subsystem=datasources/data-source=ExampleDS'
277
- resource_path = Hawkular::Inventory::CanonicalPath.new(
278
- feed_id: feed_id,
279
- resource_ids: [wildfly_res_id, datasource_res_id])
280
- datasource = @client.get_resource(resource_path.to_s)
281
-
282
- expect(datasource.name).to eq('Datasource [ExampleDS]')
283
- children = @client.list_child_resources(datasource.path)
284
-
285
- expect(children.size).to be(0)
286
- end
287
-
288
- it 'Should list recursive children of WildFly' do
289
- resources = @client.list_resources_for_type(wildfly_type.to_s)
290
- wild_fly = resources[0]
291
-
292
- children = @client.list_child_resources(wild_fly.path, recursive: true)
293
-
294
- expect(children.size).to be > 40
295
- end
296
-
297
- it 'Should list relationships of WildFly' do
298
- resources = @client.list_resources_for_type(wildfly_type.to_s)
299
- wild_fly = resources[0]
300
-
301
- rels = @client.list_relationships(wild_fly.path)
302
-
303
- expect(rels.size).to be > 40
304
- expect(rels[0].to_h['source']).not_to be_empty
305
- end
306
-
307
- it 'Should list heap metrics for WildFlys' do
308
- resources = @client.list_resources_for_type(wildfly_type.to_s)
309
- wild_fly = resources[0]
310
-
311
- metrics = @client.list_metrics_for_resource(wild_fly.path, type: 'GAUGE', match: 'Metrics~Heap')
312
- expect(metrics.size).to be(3)
313
-
314
- metrics = @client.list_metrics_for_resource(wild_fly.path, match: 'Metrics~Heap')
315
- expect(metrics.size).to be(3)
316
-
317
- metrics = @client.list_metrics_for_resource(wild_fly.path, type: 'GAUGE')
318
- expect(metrics.size).to be(8)
319
- end
320
-
321
- it 'Should list metrics of given metric type' do
322
- type_path = Hawkular::Inventory::CanonicalPath.new(
323
- feed_id: feed_id,
324
- metric_type_id: hawk_escape_id('Platform_File Store_Total Space'))
325
- metrics = @client.list_metrics_for_metric_type(type_path)
326
-
327
- expect(metrics.size).to be >= 2
328
- end
329
-
330
- it 'Should list metrics of given resource type' do
331
- metrics = @client.list_metrics_for_resource_type(wildfly_type.to_s)
332
-
333
- expect(metrics.size).to be(14)
334
- end
335
-
336
- it 'Should have the same requested metric type id' do
337
- metric_type_id = 'Server Availability~Server Availability'
338
- type_path = Hawkular::Inventory::CanonicalPath.new(
339
- feed_id: feed_id,
340
- metric_type_id: hawk_escape_id(metric_type_id))
341
- metrics = @client.list_metrics_for_metric_type(type_path)
342
-
343
- expect(metrics.size).to be > 0
344
- expect(metrics).to all(have_attributes(type_id: metric_type_id))
345
- end
346
-
347
- it 'Should return config data of given resource' do
348
- resource_path = Hawkular::Inventory::CanonicalPath.new(
349
- feed_id: feed_id,
350
- resource_ids: [hawk_escape_id('Local~~')])
351
- config = @client.get_config_data_for_resource(resource_path)
352
-
353
- expect(config['value']['Server State']).to eq('running')
354
- # expect(config['value']['Product Name']).to eq('Hawkular')
355
- end
356
-
357
- it 'Should return config data of given nested resource' do
358
- wildfly_res_id = hawk_escape_id 'Local~~'
359
- datasource_res_id = hawk_escape_id 'Local~/subsystem=datasources/data-source=ExampleDS'
360
- resource_path = Hawkular::Inventory::CanonicalPath.new(
361
- feed_id: feed_id,
362
- resource_ids: [wildfly_res_id, datasource_res_id])
363
-
364
- config = @client.get_config_data_for_resource(resource_path)
365
-
366
- expect(config['value']['Username']).to eq('sa')
367
- expect(config['value']['Driver Name']).to eq('h2')
368
- end
369
-
370
- it 'Should get resource with its configurations' do
371
- wildfly_res_id = hawk_escape_id 'Local~~'
372
- datasource_res_id = hawk_escape_id 'Local~/subsystem=datasources/data-source=ExampleDS'
373
- resource_path = Hawkular::Inventory::CanonicalPath.new(
374
- feed_id: feed_id,
375
- resource_ids: [wildfly_res_id, datasource_res_id])
376
-
377
- resource = @client.get_resource resource_path, true
378
-
379
- expect(resource.properties['Username']).to eq('sa')
380
- expect(resource.properties['Driver Name']).to eq('h2')
381
- end
382
-
383
- it 'Should list operation definitions of given resource type' do
384
- operation_definitions = @client.list_operation_definitions(wildfly_type.to_s)
385
-
386
- expect(operation_definitions).not_to be_empty
387
- expect(operation_definitions).to include('JDR')
388
- expect(operation_definitions).to include('Reload')
389
- expect(operation_definitions).to include('Shutdown')
390
- expect(operation_definitions).to include('Deploy')
391
- shutdown_def = operation_definitions.fetch 'Shutdown'
392
- expect(shutdown_def.params).to include('timeout')
393
- expect(shutdown_def.params).to include('restart')
394
- restart_param = shutdown_def.params.fetch 'restart'
395
- expect(restart_param['type']).to eq('bool')
396
- resume_def = operation_definitions.fetch 'Resume'
397
- expect(resume_def.params).to be {}
398
- end
399
-
400
- it 'Should list operation definitions of given resource' do
401
- resources = @client.list_resources_for_type(wildfly_type.to_s)
402
- wild_fly = resources[0]
403
- operation_definitions = @client.list_operation_definitions_for_resource(wild_fly.path.to_s)
404
-
405
- expect(operation_definitions).not_to be_empty
406
- expect(operation_definitions).to include('JDR')
407
- end
408
-
409
- it 'Should create a feed' do
410
- new_feed_id = 'feed_1123sdncisud6237ui23hjbdscuzsad'
411
- ret = @client.create_feed new_feed_id
412
- expect(ret).to_not be_nil
413
- expect(ret['id']).to eq(new_feed_id)
414
- end
415
-
416
- it 'Should create and delete feed' do
417
- new_feed_id = 'feed_1123sdn'
418
- ret = @client.create_feed new_feed_id
419
- expect(ret).to_not be_nil
420
- expect(ret['id']).to eq(new_feed_id)
421
-
422
- @client.delete_feed new_feed_id
423
-
424
- feed_list = @client.list_feeds
425
- expect(feed_list).not_to include(new_feed_id)
426
- end
427
-
428
- it 'Should create a feed again' do
429
- new_feed_id = 'feed_1123sdncisud6237ui2378789vvgX'
430
- @client.create_feed new_feed_id
431
- @client.create_feed new_feed_id
432
- end
433
-
434
- it 'Should create a resourcetype' do
435
- new_feed_id = 'feed_may_exist'
436
- @client.create_feed new_feed_id
437
-
438
- ret = @client.create_resource_type new_feed_id, 'rt-123', 'ResourceType'
439
- expect(ret.id).to eq('rt-123')
440
- expect(ret.name).to eq('ResourceType')
441
- expect(ret.path).to include('/rt;rt-123')
442
- expect(ret.path).to include('/f;feed_may_exist')
443
- end
444
-
445
- it 'Should create a resource' do
446
- new_feed_id = 'feed_may_exist'
447
- @client.create_feed new_feed_id
448
- ret = @client.create_resource_type new_feed_id, 'rt-123', 'ResourceType'
449
- type_path = ret.path
450
-
451
- @client.create_resource type_path, 'r123', 'My Resource', 'version' => 1.0
452
-
453
- resource_path = Hawkular::Inventory::CanonicalPath.new(feed_id: new_feed_id, resource_ids: ['r123'])
454
-
455
- r = @client.get_resource(resource_path, false)
456
- expect(r.id).to eq('r123')
457
- expect(r.properties).not_to be_empty
458
- end
459
-
460
- it 'Should create a resource with metric' do
461
- new_feed_id = 'feed_may_exist'
462
- @client.create_feed new_feed_id
463
- ret = @client.create_resource_type new_feed_id, 'rt-123', 'ResourceType'
464
- type_path = ret.path
465
-
466
- @client.create_resource type_path, 'r124', 'My Resource', 'version' => 1.0
467
- resource_path = Hawkular::Inventory::CanonicalPath.new(feed_id: new_feed_id, resource_ids: ['r124'])
468
-
469
- r = @client.get_resource(resource_path, false)
470
- expect(r.id).to eq('r124')
471
- expect(r.properties).not_to be_empty
472
-
473
- mt = @client.create_metric_type new_feed_id, 'mt-124'
474
- expect(mt).not_to be_nil
475
- expect(mt.id).to eq('mt-124')
476
-
477
- m = @client.create_metric_for_resource mt.path, r.path, 'm-124'
478
- expect(m).not_to be_nil
479
- expect(m.id).to eq('m-124')
480
- expect(m.name).to eq('m-124')
481
-
482
- m = @client.create_metric_for_resource mt.path, r.path, 'm-124-1', 'Metric1'
483
- expect(m).not_to be_nil
484
- expect(m.id).to eq('m-124-1')
485
- expect(m.name).to eq('Metric1')
486
- end
487
-
488
- it 'Should create a nested resource and metric on it' do
489
- new_feed_id = "#{security_context}_feed_may_exist"
490
- @client.create_feed new_feed_id
491
- ret = @client.create_resource_type new_feed_id, 'rt-123-1', 'ResourceType'
492
- type_path = ret.path
493
-
494
- parent = @client.create_resource type_path, 'r124-a', 'Res-a'
495
- nested_resource = @client.create_resource_under_resource type_path, parent.path, 'r124-b', 'Res-a'
496
- expect(nested_resource.path).to include('r;r124-a/r;r124-b')
497
-
498
- mt = @client.create_metric_type new_feed_id, 'mt-124-a'
499
- expect(mt).not_to be_nil
500
- expect(mt.id).to eq('mt-124-a')
501
-
502
- m_name = 'MetricUnderNestedResource'
503
- m = @client.create_metric_for_resource mt.path, nested_resource.path, 'm-124-a', m_name
504
- expect(m.id).to eq('m-124-a')
505
- expect(m.name).to eq(m_name)
506
-
507
- metrics = @client.list_metrics_for_resource nested_resource.path
508
- expect(metrics.size).to eq(1)
509
- expect(metrics[0].id).to eq(m.id)
510
- end
511
-
512
- it 'Should create and get a resource' do
513
- new_feed_id = "#{security_context}_feed_may_exist"
514
- @client.create_feed new_feed_id
515
- ret = @client.create_resource_type new_feed_id, 'rt-123', 'ResourceType'
516
- type_path = ret.path
517
-
518
- r1 = @client.create_resource type_path, 'r125', 'My Resource', 'version' => 1.0
519
-
520
- r2 = @client.get_resource(r1.path, true)
521
- expect(r2.id).to eq('r125')
522
- expect(r1.id).to eq(r2.id)
523
- expect(r2.properties).not_to be_empty
524
- end
525
-
526
- it 'Should have a consistent behaviour when creating an already existing resource' do
527
- new_feed_id = "#{security_context}_feed_may_exist"
528
- @client.create_feed new_feed_id
529
- ret = @client.create_resource_type new_feed_id, 'rt-123', 'ResourceType'
530
- type_path = ret.path
531
-
532
- r1 = @client.create_resource type_path, 'r999', 'My Resource', 'version' => 1.0
533
- r2 = @client.create_resource type_path, 'r999', 'My Resource', 'version' => 1.0
534
-
535
- r3 = @client.create_resource_under_resource type_path, r1.path, 'r1000', 'My Resource', 'version' => 1.0
536
- r4 = @client.create_resource_under_resource type_path, r1.path, 'r1000', 'My Resource', 'version' => 1.0
537
-
538
- expect(r1).to eq(r2)
539
- expect(r3).to eq(r4)
540
- end
541
-
542
- it 'Should return data from get_entity' do
543
- new_feed_id = 'feed_may_exist'
544
- @client.create_feed new_feed_id
545
- ret = @client.create_resource_type new_feed_id, 'dummy-resource-type', 'ResourceType'
546
- type_path = ret.path
547
- entity = @client.get_entity(type_path)
548
-
549
- expect(entity['path']).to eq(type_path)
550
- expect(entity['name']).to eq('ResourceType')
551
- expect(entity['id']).to eq('dummy-resource-type')
552
- end
553
-
554
- it 'Should not find an unknown resource' do
555
- new_feed_id = 'feed_may_exist'
556
- path = Hawkular::Inventory::CanonicalPath.new(
557
- feed_id: new_feed_id,
558
- resource_ids: [hawk_escape_id('*bla does not exist*')])
559
- expect { @client.get_resource(path) }
560
- .to raise_error(Hawkular::BaseClient::HawkularException, /No Resource found/)
561
- end
562
-
563
- it 'Should reject unknown metric type' do
564
- new_feed_id = 'feed_may_exist'
565
-
566
- expect { @client.create_metric_type new_feed_id, 'abc', 'FOOBaR' }.to raise_error(RuntimeError,
567
- /Unknown type FOOBAR/)
568
- end
569
-
570
- let(:example) do |e|
571
- e
572
- end
573
-
574
- it 'Client should listen on various inventory events' do
575
- WebSocketVCR.configure do |c|
576
- c.hook_uris = [host(security_context)]
577
- end
578
- uuid_prefix = SecureRandom.uuid
579
- x, y, = @client.version
580
- record_websocket("Inventory/#{security_context}/inventory_#{x}_#{y}",
581
- { uuid_prefix: uuid_prefix },
582
- 'Client_should_listen_on_various_inventory_events') do
583
- id_1 = uuid_prefix + '-r126'
584
- id_2 = uuid_prefix + '-r127'
585
- id_3 = uuid_prefix + '-r128'
586
-
587
- new_resource_events = {}
588
- resources_closable = @client.events do |resource|
589
- new_resource_events[resource.id] = resource
590
- end
591
-
592
- deleted_feed_events = {}
593
- feed_deleted_closable = @client.events('feed', 'deleted') do |feed|
594
- deleted_feed_events[feed.id] = feed
595
- end
596
-
597
- new_resource_types_events = {}
598
- # another breaking change in the new inventory api
599
- interest = 'resourceType'
600
- resource_type_closable = @client.events(interest) do |resource_type|
601
- new_resource_types_events[resource_type.id] = resource_type
602
- end
603
-
604
- registered_feed_events = {}
605
- feeds_closable = @client.events('feed', 'created') do |feed|
606
- registered_feed_events[feed.id] = feed
607
- end
608
-
609
- new_feed_id = uuid_prefix + '-feed'
610
- resource_type_id = uuid_prefix + '-rt-123'
611
- resource_type_name = 'ResourceType'
612
-
613
- record("Inventory/#{security_context}/inventory_#{x}_#{y}",
614
- { uuid_prefix: uuid_prefix }.merge(credentials),
615
- 'Helpers/generate_some_events_for_websocket') do
616
- @client.create_feed new_feed_id
617
- ret = @client.create_resource_type new_feed_id, resource_type_id, resource_type_name
618
- type_path = ret.path
619
-
620
- # create 3 resources
621
- @client.create_resource type_path, id_1, 'My Resource 1', 'version' => 1.0
622
- @client.create_resource type_path, id_2, 'My Resource 2', 'version' => 1.1
623
- # Wait for id_1 and id_2 before stop listening.
624
- wait_while do
625
- !hash_include_all(new_resource_events, [id_1, id_2])
626
- end
627
- resources_closable.close
628
- @client.create_resource type_path, id_3, 'My Resource 3', 'version' => 1.2
629
-
630
- @client.delete_feed new_feed_id
631
- end
632
-
633
- # wait for the data
634
- wait_while do
635
- [
636
- !hash_include_all(new_resource_events, [id_1, id_2]),
637
- !registered_feed_events.key?(new_feed_id),
638
- !deleted_feed_events.key?(new_feed_id),
639
- !new_resource_types_events.key?(resource_type_id)
640
- ].any?
641
- end
642
- [feed_deleted_closable, resource_type_closable, feeds_closable].each(&:close)
643
- expect(new_resource_events[id_1]).not_to be_nil
644
- expect(new_resource_events[id_1].properties['version']).to eq(1.0)
645
- expect(new_resource_events[id_2]).not_to be_nil
646
- expect(new_resource_events[id_2].properties['version']).to eq(1.1)
647
- # resource with id_3 should not be among events, because we stopped listening before creating the 3rd one
648
- expect(new_resource_events[id_3]).to be_nil
649
-
650
- expect(registered_feed_events[new_feed_id]).not_to be_nil
651
- expect(registered_feed_events[new_feed_id].id).to eq(new_feed_id)
652
-
653
- expect(deleted_feed_events[new_feed_id]).not_to be_nil
654
- expect(deleted_feed_events[new_feed_id].id).to eq(new_feed_id)
655
-
656
- expect(new_resource_types_events[resource_type_id]).not_to be_nil
657
- expect(new_resource_types_events[resource_type_id].id).to eq(resource_type_id)
658
- expect(new_resource_types_events[resource_type_id].name).to eq(resource_type_name)
659
- end
660
- end
661
-
662
- it 'Should return the version' do
663
- data = @client.fetch_version_and_status
664
- expect(data).not_to be_nil
665
- end
666
- end
667
- end
668
- end
669
-
670
- describe 'Inventory' do
671
- it 'Should list feeds when using SSL without certificate, disabling the verify' do
672
- tori_url = 'https://hawkular.torii.gva.redhat.com/hawkular/inventory'
673
- record 'Inventory', credentials, 'Should list feeds when using SSL without certificate' do
674
- client = setup_inventory_client tori_url, tenant: 'hawkular', verify_ssl: OpenSSL::SSL::VERIFY_NONE
675
- feeds = client.list_feeds
676
- expect(feeds.size).to be(1)
677
- end
678
- end
679
- end unless ENV['SKIP_SSL_WITHOUT_CERTIFICATE_TEST'] == '1'
680
- end