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,49 +0,0 @@
1
- require_relative '../vcr/vcr_setup'
2
- require_relative '../spec_helper'
3
-
4
- module Hawkular::Token::RSpec
5
- HAWKULAR_BASE = 'http://localhost:8080'.freeze
6
- describe 'Tokens', :vcr do
7
- it 'Should be able to list the available tokens' do
8
- creds = { username: 'jdoe', password: 'password' }
9
- options = { tenant: 'hawkular' }
10
- client = Hawkular::Token::Client.new(HAWKULAR_BASE, creds, options)
11
- tokens = client.get_tokens(creds)
12
- expect(tokens).to be_empty
13
- end
14
-
15
- it 'Should be able to create a new token for an actual user' do
16
- creds = { username: 'jdoe', password: 'password' }
17
- options = { tenant: 'hawkular' }
18
- client = Hawkular::Token::Client.new(HAWKULAR_BASE, creds, options)
19
- token = client.create_token(creds)
20
- expect(token['key']).not_to be_nil
21
- expect(token['secret']).not_to be_nil
22
- expect(token['attributes']['name']).to eq('Token created via Hawkular Ruby Client')
23
- end
24
-
25
- it 'Should get a 401 when attempting to create a token with a wrong password' do
26
- creds = { username: 'jdoe', password: 'mywrongpassword' }
27
- options = { tenant: 'hawkular' }
28
- client = Hawkular::Token::Client.new(HAWKULAR_BASE, creds, options)
29
- begin
30
- client.create_token(creds)
31
- fail 'Should have failed with 401'
32
- rescue Hawkular::BaseClient::HawkularException => exception
33
- expect(exception.status_code).to be(401)
34
- end
35
- end
36
-
37
- it 'Should get a 401 when attempting to create a token without a password' do
38
- creds = { username: 'jdoe', password: '' }
39
- options = { tenant: 'hawkular' }
40
- client = Hawkular::Token::Client.new(HAWKULAR_BASE, creds, options)
41
- begin
42
- client.create_token(creds)
43
- fail 'Should have failed with 401'
44
- rescue Hawkular::BaseClient::HawkularException => exception
45
- expect(exception.status_code).to be(401)
46
- end
47
- end
48
- end
49
- end
Binary file
Binary file
data/spec/spec_helper.rb DELETED
@@ -1,336 +0,0 @@
1
- # This needs to go before all requires to be able to record full coverage
2
- require 'coveralls'
3
- Coveralls.wear!
4
-
5
- # Now the application requires.
6
- require 'hawkular/hawkular_client'
7
- require 'hawkular/client_utils'
8
- require 'rspec/core'
9
- require 'rspec/mocks'
10
- require 'socket'
11
- require 'uri'
12
- require 'yaml'
13
- require 'json'
14
-
15
- module Hawkular::Inventory::RSpec
16
- def setup_inventory_client(entrypoint, options = {})
17
- credentials = {
18
- username: options[:username].nil? ? config['user'] : options[:username],
19
- password: options[:password].nil? ? config['password'] : options[:password]
20
- }
21
- @client = Hawkular::Inventory::Client.new(entrypoint, credentials, options)
22
- end
23
-
24
- def mock_inventory_client(for_version = '0.16.1.Final')
25
- allow_any_instance_of(Hawkular::Inventory::Client).to receive(:fetch_version_and_status).and_return(
26
- 'Implementation-Version' => for_version
27
- )
28
- end
29
- end
30
-
31
- module Hawkular::Metrics::RSpec
32
- def setup_client_without_tenant(options = {})
33
- options = options.dup
34
- options[:tenant] = nil
35
- mocked_version = options[:mocked_version]
36
- ::RSpec::Mocks.with_temporary_scope do
37
- mock_metrics_version(mocked_version) unless mocked_version.nil?
38
- @client = Hawkular::Metrics::Client.new(entrypoint(options[:type], 'metrics'),
39
- credentials(options), options)
40
- return @client
41
- end
42
- end
43
-
44
- def setup_client(options = {})
45
- options = options.dup
46
- options[:tenant] ||= 'hawkular'
47
- mocked_version = options[:mocked_version]
48
- ::RSpec::Mocks.with_temporary_scope do
49
- mock_metrics_version(mocked_version) unless mocked_version.nil?
50
- @client = Hawkular::Metrics::Client.new(entrypoint(options[:type], 'metrics'),
51
- credentials(options), options)
52
- end
53
- @client
54
- end
55
-
56
- def setup_v8_client(options = {})
57
- options = options.dup
58
- options[:tenant] ||= 'hawkular'
59
- options[:verify_ssl] ||= OpenSSL::SSL::VERIFY_NONE
60
- ::RSpec::Mocks.with_temporary_scope do
61
- mock_metrics_version '0.8.0'
62
- @client = Hawkular::Metrics::Client.new(entrypoint('v8', 'metrics'),
63
- credentials_v8(options), options)
64
- end
65
- @client
66
- end
67
-
68
- def credentials_v8(options = {})
69
- {
70
- token: options[:token].nil? ? config['token_v8'] : options[:token]
71
- }
72
- end
73
-
74
- def credentials(options = {})
75
- {
76
- username: options[:username].nil? ? config['user'] : options[:username],
77
- password: options[:password].nil? ? config['password'] : options[:password]
78
- }
79
- end
80
-
81
- def mock_metrics_version(version = '0.9.0.Final')
82
- allow_any_instance_of(Hawkular::Metrics::Client).to receive(:fetch_version_and_status).and_return(
83
- 'Implementation-Version' => version
84
- )
85
- end
86
-
87
- # more or less generic method common for all metric types (counters, gauges, availabilities)
88
- def create_metric_using_hash(endpoint, id, tenant_id)
89
- endpoint.create(id: id, dataRetention: 123, tags: { some: 'value' })
90
- metric = endpoint.get(id)
91
-
92
- expect(metric).to be_a(Hawkular::Metrics::MetricDefinition)
93
- expect(metric.id).to eql(id)
94
- expect(metric.data_retention).to eql(123)
95
- expect(metric.tenant_id).to eql(tenant_id)
96
- end
97
-
98
- def create_metric_using_md(endpoint, id, tags = nil)
99
- metric = Hawkular::Metrics::MetricDefinition.new
100
- metric.id = id
101
- metric.data_retention = 90
102
- metric.tags = tags.nil? ? { tag: 'value' } : tags
103
- endpoint.create(metric)
104
-
105
- created = endpoint.get(metric.id)
106
- expect(created).to be_a(Hawkular::Metrics::MetricDefinition)
107
- expect(created.id).to eql(metric.id)
108
- expect(created.data_retention).to eql(metric.data_retention)
109
- end
110
-
111
- def push_data_to_non_existing_metric(endpoint, data, id)
112
- # push one value without timestamp (which means now)
113
- endpoint.push_data(id, data)
114
-
115
- data = endpoint.get_data(id)
116
- expect(data.size).to be 1
117
-
118
- # verify metric was auto-created
119
- counter = endpoint.get(id)
120
- expect(counter).to be_a(Hawkular::Metrics::MetricDefinition)
121
- expect(counter.id).to eql(id)
122
- end
123
-
124
- def update_metric_by_tags(endpoint, id)
125
- endpoint.create(id: id, tags: { myTag: id })
126
- metric = endpoint.get(id)
127
- metric.tags = { newTag: 'newValue' }
128
- endpoint.update_tags(metric)
129
-
130
- metric = endpoint.get(id)
131
- expect(metric.tags).to include('newTag' => 'newValue', 'myTag' => id)
132
-
133
- # query API for a metric with given tag
134
- data = endpoint.query(myTag: id)
135
- expect(data.size).to be 1
136
- end
137
- end
138
-
139
- module Hawkular::Operations::RSpec
140
- SLEEP_SECONDS = 0.1
141
- MAX_ATTEMPTS = 200
142
-
143
- def wait_for(object)
144
- fast = WebSocketVCR.cassette && !WebSocketVCR.cassette.recording?
145
- sleep_interval = SLEEP_SECONDS * (fast ? 1 : 10)
146
- attempt = 0
147
- sleep sleep_interval while object[:data].nil? && (attempt += 1) < MAX_ATTEMPTS
148
- if attempt == MAX_ATTEMPTS
149
- puts 'timeout hit'
150
- {}
151
- else
152
- object[:data]
153
- end
154
- end
155
-
156
- def wait_while
157
- fast = WebSocketVCR.cassette && !WebSocketVCR.cassette.recording?
158
- sleep_interval = SLEEP_SECONDS * (fast ? 1 : 10)
159
- sleep_interval *= 3 if ENV['TRAVIS']
160
- attempt = 0
161
- sleep sleep_interval while yield && (attempt += 1) < MAX_ATTEMPTS
162
- if attempt == MAX_ATTEMPTS
163
- puts 'timeout hit'
164
- else
165
- return
166
- end
167
- end
168
-
169
- def hash_include_all(hash, keys)
170
- keys.all? do |key|
171
- hash.key? key
172
- end
173
- end
174
-
175
- def host_with_scheme(host, use_secure_connection)
176
- "#{use_secure_connection ? 'https' : 'http'}://#{host}"
177
- end
178
- end
179
-
180
- # globally used helper functions
181
- module Helpers
182
- def config
183
- @config ||= YAML.load(
184
- File.read(File.expand_path('endpoint.yml', __dir__))
185
- )
186
- end
187
-
188
- def entrypoint(type, component = nil)
189
- base = config[type.to_s.downcase]
190
- entrypoint = "#{base['is_secure'] ? 'https' : 'http'}://#{base['host']}:#{base['port']}/"
191
- entrypoint << config[component] unless component.nil?
192
- end
193
-
194
- def host(type)
195
- base = config[type.to_s.downcase]
196
- "#{base['host']}:#{base['port']}"
197
- end
198
-
199
- def path_for_installed_agent(wf_server_path)
200
- wf_server_path.to_resource('Local~%2Fsubsystem%3Dhawkular-wildfly-agent')
201
- end
202
-
203
- def in_container(inventory, resource_path)
204
- properties = inventory.get_resource(resource_path, true).properties
205
- properties.key?('In Container') ? (properties['In Container'] == 'true') : false
206
- end
207
-
208
- def immutable(inventory, resource_path)
209
- properties = inventory.get_resource(resource_path, true).properties
210
- properties.key?('Immutable') ? (properties['Immutable'] == 'true') : false
211
- end
212
-
213
- def make_template(base_directory, cassette_name, bindings)
214
- cassette = cassette_name.gsub(/\s+/, '_')
215
- input_file_path = "#{VCR.configuration.cassette_library_dir}/#{base_directory}/tmp/#{cassette}.yml"
216
- return unless File.exist? input_file_path
217
- output_file_path = "#{VCR.configuration.cassette_library_dir}/#{base_directory}/Templates/#{cassette}.yml"
218
-
219
- dirname = File.dirname(output_file_path)
220
- # make sure the directory structure is there
221
- FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
222
-
223
- text = File.read(input_file_path)
224
- bindings.select { |_, v| v.size >= 3 }.each do |k, v|
225
- text.gsub! v.to_s, "<%= #{k} %>"
226
- end
227
-
228
- File.open(output_file_path, 'w') { |file| file.write text }
229
- File.delete(input_file_path)
230
- end
231
-
232
- def record(prefix, bindings, explicit_cassette_name, example: nil)
233
- run = lambda do
234
- unless example.nil?
235
- if example.respond_to?(:run)
236
- example.run
237
- elsif example.respond_to?(:call)
238
- example.call
239
- end
240
- end
241
- yield if block_given?
242
- end
243
- record_cassette(prefix, bindings, explicit_cassette_name, run)
244
- end
245
-
246
- def record_cleanup(prefix)
247
- FileUtils.rm_rf "#{VCR.configuration.cassette_library_dir}/#{prefix}/tmp"
248
- end
249
-
250
- def record_websocket(prefix, bindings, explicit_cassette_name, example = nil)
251
- prefix.gsub!(/\s/, '_')
252
- explicit_cassette_name.gsub!(/\s/, '_')
253
- run = lambda do
254
- unless example.nil?
255
- if example.respond_to?(:run)
256
- example.run
257
- elsif example.respond_to?(:call)
258
- example.call
259
- end
260
- end
261
- yield if block_given?
262
- end
263
-
264
- record_websocket_cassette(prefix, bindings, explicit_cassette_name, run)
265
- end
266
-
267
- private
268
-
269
- def record_cassette(prefix, bindings, explicit_cassette_name, run_lambda)
270
- if ENV['VCR_UPDATE'] == '1' && bindings
271
- VCR.use_cassette(prefix + '/tmp/' + explicit_cassette_name,
272
- decode_compressed_response: true,
273
- record: :all) do
274
- run_lambda.call
275
- end
276
- make_template prefix, explicit_cassette_name, bindings
277
- else
278
- VCR.use_cassette(prefix + '/Templates/' + explicit_cassette_name,
279
- decode_compressed_response: true,
280
- erb: bindings,
281
- record: ENV['VCR_UPDATE'] == '1' ? :all : :none) do
282
- run_lambda.call
283
- end
284
- end
285
- end
286
-
287
- def record_websocket_cassette(prefix, bindings, explicit_cassette_name, run_lambda)
288
- options = {
289
- record: :none,
290
- decode_compressed_response: true
291
- }
292
- options[:erb] = bindings if bindings
293
- if ENV['VCR_UPDATE'] == '1'
294
- options[:record] = :all
295
- options[:reverse_substitution] = true if bindings
296
- end
297
- WebSocketVCR.use_cassette(prefix + '/' + explicit_cassette_name, options) do
298
- run_lambda.call
299
- end
300
- end
301
- end
302
-
303
- RSpec.configure do |config|
304
- config.include Helpers
305
- config.include Hawkular::Inventory::RSpec
306
- config.include Hawkular::Metrics::RSpec
307
- config.include Hawkular::Operations::RSpec
308
- config.include Hawkular::ClientUtils
309
- config.include Hawkular::Inventory
310
-
311
- # skip the tests that have the :skip metadata on them
312
- config.filter_run_excluding :skip
313
-
314
- # Sometimes one wants to check if the real api has
315
- # changed, so turn off VCR and use live connections
316
- # instead of recorded cassettes
317
- if ENV['VCR_OFF'] == '1'
318
- VCR.eject_cassette
319
- VCR.turn_off!(ignore_cassettes: true)
320
- WebSocketVCR.turn_off! # TODO: this does not work as the impl is empty
321
- WebMock.allow_net_connect!
322
- puts 'VCR is turned off!'
323
- end
324
-
325
- module RestClient
326
- class Request
327
- def default_headers
328
- {
329
- accept: '*/*',
330
- accept_encoding: 'identity',
331
- user_agent: 'hawkular-client-ruby'
332
- }
333
- end
334
- end
335
- end
336
- end
@@ -1,256 +0,0 @@
1
- require_relative '../vcr/vcr_setup'
2
- require_relative '../spec_helper'
3
-
4
- describe 'Base Spec' do
5
- it 'should know encode' do
6
- creds = { username: 'jdoe', password: 'password' }
7
-
8
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
9
- val = c.base_64_credentials(creds)
10
-
11
- expect(val).to eql('amRvZTpwYXNzd29yZA==')
12
- end
13
-
14
- it 'should be empty' do
15
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
16
- ret = c.generate_query_params
17
- expect(ret).to eql('')
18
- end
19
-
20
- it 'should have one param' do
21
- params = { name: nil, value: 'hello' }
22
-
23
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
24
- ret = c.generate_query_params params
25
-
26
- expect(ret).to eql('?value=hello')
27
- end
28
-
29
- it 'should have two params' do
30
- params = { name: 'world', value: 'hello' }
31
-
32
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
33
- ret = c.generate_query_params params
34
-
35
- expect(ret).to include('value=hello')
36
- expect(ret).to include('name=world')
37
- expect(ret).to start_with('?')
38
- expect(ret).to include('&')
39
- end
40
-
41
- it 'should flatten arrays' do
42
- params = { value: %w(hello world) }
43
-
44
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
45
- ret = c.generate_query_params params
46
-
47
- expect(ret).to eql('?value=hello,world')
48
- end
49
-
50
- it 'should flatten arrays2' do
51
- params = { value: [] }
52
-
53
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
54
- ret = c.generate_query_params params
55
-
56
- expect(ret).to eq('')
57
- end
58
-
59
- it 'should escape numbers' do
60
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
61
- ret = c.hawk_escape 12_345
62
-
63
- expect(ret).to eq('12345')
64
- end
65
-
66
- it 'should escape alpha' do
67
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
68
- ret = c.hawk_escape 'a12345'
69
-
70
- expect(ret).to eq('a12345')
71
- end
72
-
73
- it 'should escape strange stuff' do
74
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
75
- ret = c.hawk_escape 'a1%2 3|45/'
76
-
77
- expect(ret).to eq('a1%252%203%7c45%2f')
78
- end
79
-
80
- it 'should pass through options to rest_client' do
81
- proxy_uri = 'http://myproxy.com'
82
- c = Hawkular::BaseClient.new('not-needed-for-this-test', {},
83
- { proxy: proxy_uri, timeout: 10 })
84
- rc = c.rest_client('myurl')
85
-
86
- expect(rc.options).to include(proxy: proxy_uri, timeout: 10)
87
- end
88
-
89
- # backward compatibility
90
- it 'should pass :http_proxy_uri to rest_client :proxy' do
91
- proxy_uri = 'http://myproxy.com'
92
- c = Hawkular::BaseClient.new('not-needed-for-this-test', {},
93
- { http_proxy_uri: proxy_uri })
94
- rc = c.rest_client('myurl')
95
-
96
- expect(rc.options[:proxy]).to eq(proxy_uri)
97
- expect(rc.options).to include(proxy: proxy_uri)
98
- expect(rc.options).not_to have_key(:http_proxy_uri)
99
- end
100
-
101
- it 'should merge constructor, hawkular, and call headers' do
102
- c = Hawkular::BaseClient.new('not-needed-for-this-test', {},
103
- { tenant: 'Me', headers: { 'X-Foo' => 'bar' } })
104
- headers = c.http_headers('Referer' => 'them.example.com')
105
-
106
- expect(headers).to include('Hawkular-Tenant': 'Me',
107
- 'Referer' => 'them.example.com',
108
- 'X-Foo' => 'bar')
109
- end
110
-
111
- it 'Should normalize different types of url and suffix combinations with or without slash' do
112
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
113
-
114
- ret = c.normalize_entrypoint_url 'http://localhost:8080', '/hawkular/alerts/'
115
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
116
-
117
- ret = c.normalize_entrypoint_url 'http://localhost:8080', '/hawkular/alerts'
118
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
119
-
120
- ret = c.normalize_entrypoint_url 'http://localhost:8080', 'hawkular/alerts/'
121
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
122
-
123
- ret = c.normalize_entrypoint_url 'http://localhost:8080', 'hawkular/alerts'
124
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
125
-
126
- ret = c.normalize_entrypoint_url 'http://localhost:8080/', '/hawkular/alerts/'
127
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
128
-
129
- ret = c.normalize_entrypoint_url 'http://localhost:8080/', '/hawkular/alerts'
130
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
131
-
132
- ret = c.normalize_entrypoint_url 'http://localhost:8080/', 'hawkular/alerts/'
133
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
134
-
135
- ret = c.normalize_entrypoint_url 'http://localhost:8080/', 'hawkular/alerts'
136
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
137
-
138
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts', '/hawkular/alerts/'
139
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
140
-
141
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts', '/hawkular/alerts'
142
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
143
-
144
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts', 'hawkular/alerts/'
145
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
146
-
147
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts', 'hawkular/alerts'
148
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
149
-
150
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts/', '/hawkular/alerts/'
151
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
152
-
153
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts/', '/hawkular/alerts'
154
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
155
-
156
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts/', 'hawkular/alerts/'
157
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
158
-
159
- ret = c.normalize_entrypoint_url 'http://localhost:8080/hawkular/alerts/', 'hawkular/alerts'
160
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
161
-
162
- ret = c.normalize_entrypoint_url 'http://127.0.0.1/hawkular/alerts/', 'hawkular/alerts'
163
- expect(ret).to eq('http://127.0.0.1/hawkular/alerts')
164
-
165
- ret = c.normalize_entrypoint_url 'https://127.0.0.1/hawkular/alerts/', 'hawkular/alerts'
166
- expect(ret).to eq('https://127.0.0.1/hawkular/alerts')
167
-
168
- ret = c.normalize_entrypoint_url 'https://localhost:8080/', 'hawkular/alerts'
169
- expect(ret).to eq('https://localhost:8080/hawkular/alerts')
170
-
171
- expect { c.normalize_entrypoint_url 'https://localhost:8080/hawkular/alerts', '' }.to raise_error(ArgumentError)
172
-
173
- uri = URI.parse 'https://localhost:8080/'
174
- ret = c.normalize_entrypoint_url uri, 'hawkular/alerts'
175
- expect(ret).to eq('https://localhost:8080/hawkular/alerts')
176
-
177
- uri = URI.parse 'http://localhost:8080/hawkular/alerts/'
178
- ret = c.normalize_entrypoint_url uri, '/hawkular/alerts/'
179
- expect(ret).to eq('http://localhost:8080/hawkular/alerts')
180
- end
181
-
182
- it 'Should change http to ws and https to wss on different types of urls' do
183
- c = Hawkular::BaseClient.new('not-needed-for-this-test')
184
- ret = c.url_with_websocket_scheme 'http://localhost:8080'
185
- expect(ret).to eq('ws://localhost:8080')
186
-
187
- ret = c.url_with_websocket_scheme 'https://localhost:8443'
188
- expect(ret).to eq('wss://localhost:8443')
189
-
190
- ret = c.url_with_websocket_scheme 'http://localhost'
191
- expect(ret).to eq('ws://localhost')
192
-
193
- ret = c.url_with_websocket_scheme 'https://localhost'
194
- expect(ret).to eq('wss://localhost')
195
-
196
- ret = c.url_with_websocket_scheme 'http://localhost:8080/hawkular/inventory/'
197
- expect(ret).to eq('ws://localhost:8080/hawkular/inventory/')
198
-
199
- ret = c.url_with_websocket_scheme 'https://localhost:8443/hawkular/inventory/'
200
- expect(ret).to eq('wss://localhost:8443/hawkular/inventory/')
201
-
202
- ret = c.url_with_websocket_scheme 'http://localhost/hawkular/inventory/'
203
- expect(ret).to eq('ws://localhost/hawkular/inventory/')
204
-
205
- ret = c.url_with_websocket_scheme 'https://localhost/hawkular/inventory/'
206
- expect(ret).to eq('wss://localhost/hawkular/inventory/')
207
-
208
- ret = c.url_with_websocket_scheme 'http://localhost:8080/http'
209
- expect(ret).to eq('ws://localhost:8080/http')
210
-
211
- ret = c.url_with_websocket_scheme 'https://localhost:8443/http/https'
212
- expect(ret).to eq('wss://localhost:8443/http/https')
213
-
214
- ret = c.url_with_websocket_scheme 'ftp://http:8080'
215
- expect(ret).to eq('ftp://http:8080')
216
-
217
- ret = c.url_with_websocket_scheme 'ftp://https'
218
- expect(ret).to eq('ftp://https')
219
-
220
- uri = URI.parse 'http://localhost:8080/hawkular/inventory'
221
- ret = c.url_with_websocket_scheme uri
222
- expect(ret).to eq('ws://localhost:8080/hawkular/inventory')
223
-
224
- uri = URI.parse 'https://localhost:8443/hawkular/inventory'
225
- ret = c.url_with_websocket_scheme uri
226
- expect(ret).to eq('wss://localhost:8443/hawkular/inventory')
227
- end
228
-
229
- it 'Should throw a HawkularConnectionException when host not listening to port' do
230
- begin
231
- WebMock.disable!
232
- VCR.turned_off do
233
- c = Hawkular::BaseClient.new('127.0.0.1:0')
234
- expect do
235
- c.http_get('not-needed-for-this-test')
236
- end.to raise_error(Hawkular::BaseClient::HawkularConnectionException)
237
- end
238
- ensure
239
- WebMock.enable!
240
- end
241
- end
242
-
243
- it 'Should throw a HawkularConnectionException when unknown host' do
244
- begin
245
- WebMock.disable!
246
- VCR.turned_off do
247
- c = Hawkular::BaseClient.new('some-unknown-and-random-host-that-wont-exist')
248
- expect do
249
- c.http_get('not-needed-for-this-test')
250
- end.to raise_error(Hawkular::BaseClient::HawkularConnectionException)
251
- end
252
- ensure
253
- WebMock.enable!
254
- end
255
- end
256
- end