hawkular-client 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.rdoc +5 -2
  3. data/lib/hawkular/hawkular_client.rb +1 -1
  4. data/lib/hawkular/inventory/inventory_api.rb +2 -1
  5. data/lib/hawkular/metrics/metric_api.rb +4 -1
  6. data/lib/hawkular/operations/operations_api.rb +7 -4
  7. data/lib/hawkular/version.rb +1 -1
  8. data/spec/integration/inventory_spec.rb +516 -466
  9. data/spec/integration/metric_spec.rb +612 -561
  10. data/spec/integration/operations_spec.rb +425 -504
  11. data/spec/spec_helper.rb +73 -19
  12. data/spec/vcr_cassettes/Inventory/{Connection → NonSecure/Connection/Templates}/Should_err_on_bad_credentials.yml +6 -4
  13. data/spec/vcr_cassettes/Inventory/{Tenants → NonSecure/Tenants/Templates}/Should_Get_Tenant_For_Explicit_Credentials.yml +13 -9
  14. data/spec/vcr_cassettes/Inventory/{Tenants → NonSecure/Tenants/Templates}/Should_Get_Tenant_For_Implicit_Credentials.yml +13 -9
  15. data/spec/vcr_cassettes/Inventory/{inventory_0_17/Templates → NonSecure/inventory_0_17}/Client_should_listen_on_various_inventory_events.json +5 -5
  16. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Client_should_listen_on_various_inventory_events.yml +21 -13
  17. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17/Templates}/Helpers/create_url.yml +12 -10
  18. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Helpers/generate_some_events_for_websocket.yml +51 -37
  19. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17/Templates}/Helpers/get_feeds.yml +11 -9
  20. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_List_datasources_with_no_props.yml +11 -7
  21. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_feed.yml +6 -4
  22. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_feed_again.yml +16 -10
  23. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +664 -0
  24. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_resource.yml +31 -19
  25. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_resource_with_metric.yml +77 -49
  26. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_a_resourcetype.yml +16 -10
  27. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_create_and_delete_feed.yml +19 -13
  28. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +420 -0
  29. data/spec/vcr_cassettes/Inventory/NonSecure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +132 -0
  30. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_have_the_same_requested_metric_type_id.yml +8 -8
  31. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_URLs.yml +29 -7
  32. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_WildFlys.yml +10 -8
  33. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_WildFlys_with_props.yml +24 -17
  34. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_all_the_resource_types.yml +6 -4
  35. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_children_of_WildFly.yml +31 -13
  36. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_children_of_nested_resource.yml +16 -10
  37. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_feeds.yml +9 -7
  38. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_heap_metrics_for_WildFlys.yml +196 -188
  39. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_metrics_for_WildFlys.yml +72 -68
  40. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_metrics_of_given_metric_type.yml +12 -44
  41. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_metrics_of_given_resource_type.yml +63 -61
  42. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_operation_definitions_of_given_resource.yml +220 -156
  43. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_operation_definitions_of_given_resource_type.yml +200 -140
  44. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_recursive_children_of_WildFly.yml +30 -12
  45. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_relationships_of_WildFly.yml +129 -113
  46. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_resources_for_feed.yml +12 -10
  47. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_types_with_bad_feed.yml +6 -4
  48. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_list_types_with_feed.yml +7 -5
  49. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_not_find_an_unknown_resource.yml +6 -4
  50. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_return_config_data_of_given_nested_resource.yml +6 -4
  51. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_return_config_data_of_given_resource.yml +15 -10
  52. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → NonSecure/inventory_0_17}/Templates/Should_return_the_version.yml +8 -6
  53. data/spec/vcr_cassettes/Inventory/Secure/Connection/Templates/Should_err_on_bad_credentials.yml +44 -0
  54. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Explicit_Credentials.yml +101 -0
  55. data/spec/vcr_cassettes/Inventory/Secure/Tenants/Templates/Should_Get_Tenant_For_Implicit_Credentials.yml +101 -0
  56. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Client_should_listen_on_various_inventory_events.json +47 -0
  57. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Client_should_listen_on_various_inventory_events.yml +207 -0
  58. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/create_url.yml +52 -0
  59. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Helpers/generate_some_events_for_websocket.yml +411 -0
  60. data/spec/vcr_cassettes/Inventory/{inventory_0_17/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml → Secure/inventory_0_17/Templates/Helpers/get_feeds.yml} +13 -11
  61. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_List_datasources_with_no_props.yml +133 -0
  62. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed.yml +59 -0
  63. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_feed_again.yml +181 -0
  64. data/spec/vcr_cassettes/Inventory/{inventory_0_17 → Secure/inventory_0_17}/Templates/Should_create_a_nested_resource_and_metric_on_it.yml +108 -150
  65. data/spec/vcr_cassettes/Inventory/{inventory_0_17/Templates/Should_create_and_get_a_resource.yml → Secure/inventory_0_17/Templates/Should_create_a_resource.yml} +45 -87
  66. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resource_with_metric.yml +846 -0
  67. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_a_resourcetype.yml +169 -0
  68. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_delete_feed.yml +166 -0
  69. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_create_and_get_a_resource.yml +420 -0
  70. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_get_resource_with_its_configurations.yml +132 -0
  71. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_have_the_same_requested_metric_type_id.yml +73 -0
  72. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_URLs.yml +90 -0
  73. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys.yml +70 -0
  74. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_WildFlys_with_props.yml +138 -0
  75. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_all_the_resource_types.yml +59 -0
  76. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_WildFly.yml +333 -0
  77. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_children_of_nested_resource.yml +180 -0
  78. data/spec/vcr_cassettes/{Operation/Helpers/get_feed.yml → Inventory/Secure/inventory_0_17/Templates/Should_list_feeds.yml} +13 -11
  79. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_heap_metrics_for_WildFlys.yml +943 -0
  80. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_for_WildFlys.yml +361 -0
  81. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_metric_type.yml +90 -0
  82. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_metrics_of_given_resource_type.yml +294 -0
  83. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource.yml +871 -0
  84. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_operation_definitions_of_given_resource_type.yml +740 -0
  85. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_recursive_children_of_WildFly.yml +1117 -0
  86. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_relationships_of_WildFly.yml +393 -0
  87. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_resources_for_feed.yml +84 -0
  88. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_bad_feed.yml +55 -0
  89. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_list_types_with_feed.yml +166 -0
  90. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_not_find_an_unknown_resource.yml +59 -0
  91. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_nested_resource.yml +66 -0
  92. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_config_data_of_given_resource.yml +71 -0
  93. data/spec/vcr_cassettes/Inventory/Secure/inventory_0_17/Templates/Should_return_the_version.yml +50 -0
  94. data/spec/vcr_cassettes/Inventory/Templates/Should_list_feeds_when_using_SSL_without_certificate.yml +114 -0
  95. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Get_metric_definition_by_id.yml +10 -8
  96. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Retrieve_metric_rate_points.yml +18 -14
  97. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_create_Availability_definition.yml +18 -14
  98. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_create_Counter_definition.yml +18 -14
  99. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_create_gauge_definition.yml +18 -14
  100. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_push_metric_data_to_existing_gauge.yml +9 -7
  101. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_update_tags_for_Availability_definition.yml +28 -22
  102. data/spec/vcr_cassettes/{Metric_ID_with_special_characters → Metrics/NonSecure/ID_with_special_characters/Templates}/Should_update_tags_for_gauge_definition.yml +28 -22
  103. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +12 -8
  104. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +14 -10
  105. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_group_contiguous_values.yml +10 -6
  106. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +19 -13
  107. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +31 -21
  108. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +14 -10
  109. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +12 -8
  110. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +28 -18
  111. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +38 -24
  112. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +32 -20
  113. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +19 -13
  114. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +14 -10
  115. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +12 -8
  116. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +32 -20
  117. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +19 -13
  118. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_return_periods.yml +10 -6
  119. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +31 -21
  120. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +48 -52
  121. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +39 -25
  122. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +36 -24
  123. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/No_Tenant/Should_fail.yml +6 -4
  124. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Simple/Should_be_Cool.yml +2 -2
  125. data/spec/vcr_cassettes/Metrics/{metrics_0_16_0 → NonSecure/metrics_0_16_0}/Templates/Status/Should_return_the_version.yml +5 -3
  126. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  127. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +0 -0
  128. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +3 -3
  129. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +0 -0
  130. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +0 -0
  131. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +3 -3
  132. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +0 -0
  133. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +0 -0
  134. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +0 -0
  135. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +0 -0
  136. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +3 -3
  137. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +0 -0
  138. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +0 -0
  139. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +0 -0
  140. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_return_periods.yml +0 -0
  141. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +0 -0
  142. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +0 -0
  143. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +0 -0
  144. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Simple/Should_be_Cool.yml +0 -0
  145. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Status/Should_return_the_version.yml +0 -0
  146. data/spec/vcr_cassettes/Metrics/{metrics_0_8_0 → NonSecure/metrics_0_8_0}/Templates/Tenants/Should_create_and_return_tenant.yml +0 -0
  147. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +19 -15
  148. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +21 -17
  149. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_group_contiguous_values.yml +17 -13
  150. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +29 -23
  151. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +47 -37
  152. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +21 -17
  153. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +19 -15
  154. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +44 -34
  155. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +60 -46
  156. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +51 -39
  157. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +29 -23
  158. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +21 -17
  159. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +19 -15
  160. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +51 -39
  161. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +29 -23
  162. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_return_periods.yml +17 -13
  163. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +50 -0
  164. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +12 -10
  165. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +47 -37
  166. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Mixed_metrics/Should_fetch_rate_stats_for_mixed_metric.yml +328 -0
  167. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +32 -32
  168. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +70 -74
  169. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +61 -47
  170. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +55 -43
  171. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/No_Tenant/Should_fail.yml +9 -7
  172. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Simple/Should_be_Cool.yml +3 -3
  173. data/spec/vcr_cassettes/Metrics/{metrics_services → NonSecure/metrics_services}/Templates/Status/Should_return_the_version.yml +10 -8
  174. data/spec/vcr_cassettes/Metrics/NonSecure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  175. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Get_metric_definition_by_id.yml +51 -0
  176. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Retrieve_metric_rate_points.yml +92 -0
  177. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Availability_definition.yml +101 -0
  178. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_Counter_definition.yml +101 -0
  179. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_create_gauge_definition.yml +101 -0
  180. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_push_metric_data_to_existing_gauge.yml +50 -0
  181. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_Availability_definition.yml +146 -0
  182. data/spec/vcr_cassettes/Metrics/Secure/ID_with_special_characters/Templates/Should_update_tags_for_gauge_definition.yml +146 -0
  183. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +99 -0
  184. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +99 -0
  185. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_group_contiguous_values.yml +97 -0
  186. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +144 -0
  187. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +240 -0
  188. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +99 -0
  189. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +99 -0
  190. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +240 -0
  191. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +328 -0
  192. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +281 -0
  193. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +144 -0
  194. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +99 -0
  195. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +99 -0
  196. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +281 -0
  197. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +144 -0
  198. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_return_periods.yml +97 -0
  199. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +240 -0
  200. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +326 -0
  201. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +314 -0
  202. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +285 -0
  203. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/No_Tenant/Should_fail.yml +50 -0
  204. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Simple/Should_be_Cool.yml +48 -0
  205. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Status/Should_return_the_version.yml +44 -0
  206. data/spec/vcr_cassettes/Metrics/Secure/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  207. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_Availability_definition_using_MetricDefinition_parameter.yml +99 -0
  208. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_create_and_return_Availability_using_Hash_parameter.yml +99 -0
  209. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_group_contiguous_values.yml +97 -0
  210. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_push_metric_data_to_non-existing_Availability.yml +144 -0
  211. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Availability_metrics/Should_update_tags_for_Availability_definition.yml +240 -0
  212. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_and_return_counter_using_Hash_parameter.yml +99 -0
  213. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_create_counter_definition_using_MetricDefinition_parameter.yml +99 -0
  214. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_as_bucketed_results.yml +240 -0
  215. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_get_metrics_with_limit_and_order.yml +328 -0
  216. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_existing_counter.yml +281 -0
  217. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Counter_metrics/Should_push_metric_data_to_non-existing_counter.yml +144 -0
  218. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_Hash.yml +99 -0
  219. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_create_gauge_definition_using_MetricDefinition.yml +99 -0
  220. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_existing_gauge.yml +281 -0
  221. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_push_metric_data_to_non-existing_gauge.yml +144 -0
  222. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_periods.yml +97 -0
  223. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +50 -0
  224. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory_def.yml +51 -0
  225. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Gauge_metrics/Should_update_tags_for_gauge_definition.yml +240 -0
  226. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_fetch_stats_for_mixed_metric.yml +364 -0
  227. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_requests_raw_data_for_multiple_metrics.yml +326 -0
  228. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request.yml +314 -0
  229. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Mixed_metrics/Should_send_mixed_metric_request_of_a_single_type.yml +285 -0
  230. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/No_Tenant/Should_fail.yml +50 -0
  231. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Simple/Should_be_Cool.yml +48 -0
  232. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Status/Should_return_the_version.yml +44 -0
  233. data/spec/vcr_cassettes/Metrics/Secure/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +99 -0
  234. data/spec/vcr_cassettes/Operation/NonSecure/Helpers/Templates/get_feed.yml +61 -0
  235. data/spec/vcr_cassettes/Operation/{Helpers → NonSecure/Helpers/Templates}/get_tenant.yml +8 -5
  236. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_JDBC_driver_should_add_the_driver.json +23 -0
  237. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Add_datasource_should_be_doable.json +23 -0
  238. data/spec/vcr_cassettes/Operation/{Operation → NonSecure/Operation}/Add_deployment_should_be_doable.json +4 -7
  239. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +23 -0
  240. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +23 -0
  241. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +23 -0
  242. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +32 -0
  243. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +23 -0
  244. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +23 -0
  245. data/spec/vcr_cassettes/Operation/NonSecure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +23 -0
  246. data/spec/vcr_cassettes/Operation/{Operation → NonSecure/Operation}/should_not_be_possible_to_perform_on_closed_client.json +1 -1
  247. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +9 -0
  248. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +9 -0
  249. data/spec/vcr_cassettes/Operation/{Websocket_connection → NonSecure/Websocket_connection}/should_bail_with_no_host.json +0 -0
  250. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established.json +9 -0
  251. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_be_established_via_entrypoint.json +9 -0
  252. data/spec/vcr_cassettes/Operation/NonSecure/Websocket_connection/should_run_into_error_callback.json +18 -0
  253. data/spec/vcr_cassettes/Operation/{Websocket_connection → NonSecure/Websocket_connection}/should_run_into_error_callback_because_bad_hash_parameters.json +1 -1
  254. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_feed.yml +61 -0
  255. data/spec/vcr_cassettes/Operation/Secure/Helpers/Templates/get_tenant.yml +55 -0
  256. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_JDBC_driver_should_add_the_driver.json +23 -0
  257. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_datasource_should_be_doable.json +23 -0
  258. data/spec/vcr_cassettes/Operation/Secure/Operation/Add_deployment_should_be_doable.json +23 -0
  259. data/spec/vcr_cassettes/Operation/Secure/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +23 -0
  260. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +23 -0
  261. data/spec/vcr_cassettes/Operation/Secure/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +23 -0
  262. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_can_be_run_multiple_times_in_parallel.json +32 -0
  263. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +23 -0
  264. data/spec/vcr_cassettes/Operation/Secure/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +23 -0
  265. data/spec/vcr_cassettes/Operation/Secure/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +23 -0
  266. data/spec/vcr_cassettes/Operation/Secure/Operation/should_not_be_possible_to_perform_on_closed_client.json +12 -0
  267. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +9 -0
  268. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +9 -0
  269. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_bail_with_no_host.json +3 -0
  270. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established.json +9 -0
  271. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_be_established_via_entrypoint.json +9 -0
  272. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback.json +18 -0
  273. data/spec/vcr_cassettes/Operation/Secure/Websocket_connection/should_run_into_error_callback_because_bad_hash_parameters.json +13 -0
  274. metadata +526 -282
  275. data/spec/vcr_cassettes/Metrics/metrics_0_16_0/Templates/Tenants/Should_create_and_return_tenant.yml +0 -95
  276. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Gauge_metrics/Should_return_platform_memory.yml +0 -48
  277. data/spec/vcr_cassettes/Metrics/metrics_services/Templates/Tenants/Should_create_and_return_tenant.yml +0 -95
  278. data/spec/vcr_cassettes/Operation/Operation/Add_JDBC_driver_should_add_the_driver.json +0 -26
  279. data/spec/vcr_cassettes/Operation/Operation/Add_datasource_should_be_doable.json +0 -26
  280. data/spec/vcr_cassettes/Operation/Operation/Disable_should_be_performed_and_eventually_respond_with_success.json +0 -26
  281. data/spec/vcr_cassettes/Operation/Operation/Remove_JDBC_driver_should_be_performed_and_eventually_respond_with_success.json +0 -26
  282. data/spec/vcr_cassettes/Operation/Operation/Remove_datasource_should_be_performed_and_eventually_respond_with_success.json +0 -26
  283. data/spec/vcr_cassettes/Operation/Operation/Restart_can_be_run_multiple_times_in_parallel.json +0 -40
  284. data/spec/vcr_cassettes/Operation/Operation/Restart_should_be_performed_and_eventually_respond_with_success.json +0 -26
  285. data/spec/vcr_cassettes/Operation/Operation/Restart_should_not_be_performed_if_resource_path_is_wrong.json +0 -26
  286. data/spec/vcr_cassettes/Operation/Operation/Undeploy_deployment_should_be_performed_and_eventually_respond_with_success.json +0 -26
  287. data/spec/vcr_cassettes/Operation/Websocket_connection/should_bail_with_hash_property_error_because_no_callback_at_all.json +0 -9
  288. data/spec/vcr_cassettes/Operation/Websocket_connection/should_bail_with_hash_property_error_because_no_error-callback_.json +0 -9
  289. data/spec/vcr_cassettes/Operation/Websocket_connection/should_be_established.json +0 -9
  290. data/spec/vcr_cassettes/Operation/Websocket_connection/should_be_established_via_entrypoint.json +0 -9
  291. data/spec/vcr_cassettes/Operation/Websocket_connection/should_run_into_error_callback.json +0 -13
@@ -5,573 +5,494 @@ require 'securerandom'
5
5
  include Hawkular::Inventory
6
6
  include Hawkular::Operations
7
7
 
8
+ SKIP_SECURE_CONTEXT = ENV['SKIP_SECURE_CONTEXT'] || '1'
9
+
8
10
  # examples for operations, it uses the websocket communication
9
11
  module Hawkular::Operations::RSpec
10
- HOST = 'localhost:8080'
11
- describe 'Operation/Websocket connection', vcr: { decode_compressed_response: true } do
12
- let(:example) do |e|
13
- e
12
+ NON_SECURE_CONTEXT = :NonSecure
13
+ SECURE_CONTEXT = :Secure
14
+ [NON_SECURE_CONTEXT, SECURE_CONTEXT].each do |security_context|
15
+ next if security_context == SECURE_CONTEXT && SKIP_SECURE_CONTEXT == '1'
16
+ if security_context == NON_SECURE_CONTEXT && ENV['SKIP_NON_SECURE_CONTEXT'] == '1'
17
+ puts 'skipping non secure context'
18
+ next
14
19
  end
15
20
 
16
- it 'should be established' do
17
- WebSocketVCR.configure do |c|
18
- c.hook_uris = [HOST]
19
- end
21
+ context "#{security_context}" do
22
+ alias_method :helper_host, :host
20
23
 
21
- WebSocketVCR.record(example, self) do
22
- client = OperationsClient.new(host: HOST,
23
- wait_time: WebSocketVCR.live? ? 1.5 : 2,
24
- credentials: {
25
- username: 'jdoe',
26
- password: 'password'
27
- },
28
- options: {
29
- tenant: 'hawkular'
30
- })
31
- ws = client.ws
32
- expect(ws).not_to be nil
33
- expect(ws.open?).to be true
24
+ let(:host) do
25
+ helper_host(security_context)
34
26
  end
35
- end
36
27
 
37
- it 'should be established via entrypoint' do
38
- WebSocketVCR.configure do |c|
39
- c.hook_uris = ['127.0.0.1:8080']
28
+ let(:options) do
29
+ {
30
+ host: host,
31
+ wait_time: WebSocketVCR.live? ? 1.5 : 2,
32
+ use_secure_connection: security_context == SECURE_CONTEXT,
33
+ credentials: credentials,
34
+ options: {
35
+ tenant: 'hawkular'
36
+ }
37
+ }
40
38
  end
41
39
 
42
- WebSocketVCR.record(example, self) do
43
- ep = URI::HTTP.build(host: '127.0.0.1', port: 8080).to_s
44
-
45
- client = OperationsClient.new(entrypoint: ep,
46
- wait_time: WebSocketVCR.live? ? 1.5 : 0,
47
- credentials: {
48
- username: 'jdoe',
49
- password: 'password'
50
- },
51
- options: {
52
- tenant: 'hawkular'
53
- })
54
- ws = client.ws
55
- expect(ws).not_to be nil
56
- expect(ws.open?).to be true
40
+ let(:example) do |e|
41
+ e
57
42
  end
58
- end
59
43
 
60
- it 'should run into error callback' do
61
- WebSocketVCR.configure do |c|
62
- c.hook_uris = [HOST]
44
+ let(:cassette_name) do |example|
45
+ description = example.description
46
+ description
63
47
  end
64
48
 
65
- WebSocketVCR.record(example, self) do
66
- client = OperationsClient.new(host: HOST,
67
- wait_time: WebSocketVCR.live? ? 1.5 : 2,
68
- credentials: {
69
- username: 'jdoe',
70
- password: 'password'
71
- },
72
- options: {
73
- tenant: 'hawkular'
74
- })
75
-
76
- noop = { operationName: 'noop', resourcePath: '/bla' }
77
-
78
- client.invoke_generic_operation(noop) do |on|
79
- on.success do |_data|
80
- fail 'This should have failed'
81
- end
82
- on.failure do |error|
83
- puts 'error callback was correctly called, reason: ' + error.to_s
84
- end
85
- end
49
+ let(:client) do
50
+ OperationsClient.new(options)
86
51
  end
87
- end
88
52
 
89
- it 'should run into error callback because bad hash parameters' do
90
- WebSocketVCR.configure do |c|
91
- c.hook_uris = [HOST]
53
+ before(:all) do
54
+ WebSocketVCR.configure do |c|
55
+ c.hook_uris = [helper_host(security_context)]
56
+ end
92
57
  end
93
58
 
94
- WebSocketVCR.record(example, self) do
95
- client = OperationsClient.new(host: HOST,
96
- wait_time: WebSocketVCR.live? ? 1.5 : 2,
97
- credentials: {
98
- username: 'jdoe',
99
- password: 'password'
100
- },
101
- options: {
102
- tenant: 'hawkular'
103
- })
104
-
105
- noop = { operationName: 'noop' }
106
-
107
- client.invoke_generic_operation(noop) do |on|
108
- on.success do |_data|
109
- fail 'This should have failed'
110
- end
111
- on.failure do |_error|
112
- end
59
+ describe 'Operation/Websocket connection' do
60
+ around(:each) do |example|
61
+ record_websocket("Operation/#{security_context}/Websocket_connection",
62
+ nil,
63
+ cassette_name,
64
+ example)
113
65
  end
114
- end
115
- end
116
66
 
117
- it 'should bail with hash property error because no callback at all' do
118
- WebSocketVCR.configure do |c|
119
- c.hook_uris = [HOST]
120
- end
67
+ it 'should be established' do
68
+ ws = client.ws
69
+ expect(ws).not_to be nil
70
+ expect(ws.open?).to be true
71
+ end
121
72
 
122
- WebSocketVCR.record(example, self) do
123
- client = OperationsClient.new(host: HOST,
124
- wait_time: WebSocketVCR.live? ? 1.5 : 2,
125
- credentials: {
126
- username: 'jdoe',
127
- password: 'password'
128
- },
129
- options: {
130
- tenant: 'hawkular'
131
- })
132
-
133
- noop = { operationName: 'noop' }
134
- expect { client.invoke_generic_operation(noop) }.to raise_error(ArgumentError,
135
- 'You need to specify error callback')
136
- end
137
- end
73
+ it 'should be established via entrypoint' do
74
+ ep = host_with_scheme(host, security_context == SECURE_CONTEXT)
138
75
 
139
- it 'should bail with hash property error because no error-callback ' do
140
- WebSocketVCR.configure do |c|
141
- c.hook_uris = [HOST]
142
- end
76
+ client = OperationsClient.new(options.merge entrypoint: ep, host: nil)
77
+ ws = client.ws
78
+ expect(ws).not_to be nil
79
+ expect(ws.open?).to be true
80
+ end
143
81
 
144
- WebSocketVCR.record(example, self) do
145
- client = OperationsClient.new(host: HOST,
146
- wait_time: WebSocketVCR.live? ? 1.5 : 2,
147
- credentials: {
148
- username: 'jdoe',
149
- password: 'password'
150
- },
151
- options: {
152
- tenant: 'hawkular'
153
- })
154
-
155
- noop = { operationName: 'noop' }
156
- expect do
82
+ it 'should run into error callback' do
83
+ noop = { operationName: 'noop', resourcePath: '/bla' }
84
+ operation_outcome = {}
157
85
  client.invoke_generic_operation(noop) do |on|
158
86
  on.success do |_data|
159
- fail 'This should have failed'
87
+ operation_outcome[:data] = 'should run into error'
88
+ end
89
+ on.failure do |_error|
90
+ operation_outcome[:data] = 'fail'
160
91
  end
161
92
  end
162
- end.to raise_error(ArgumentError, 'You need to specify error callback')
163
- end
164
- end
165
- it 'should bail with no host' do
166
- WebSocketVCR.configure do |c|
167
- c.hook_uris = [HOST]
168
- end
169
-
170
- WebSocketVCR.record(example, self) do
171
- begin
172
- OperationsClient.new(
173
- wait_time: WebSocketVCR.live? ? 1.5 : 2,
174
- credentials: {
175
- username: 'jdoe',
176
- password: 'password'
177
- },
178
- options: {
179
- tenant: 'hawkular'
180
- })
181
- rescue
182
- puts 'We got an exception and this is good'
183
- else
184
- fail 'Should have failed as no host was given'
93
+ expect(wait_for(operation_outcome)).to eq 'fail'
185
94
  end
186
- end
187
- end
188
- end
189
95
 
190
- describe 'Operation/Operation', :websocket, vcr: { decode_compressed_response: true } do
191
- before(:all) do
192
- VCR.use_cassette('Operation/Helpers/get_tenant', decode_compressed_response: true) do
193
- @creds = { username: 'jdoe', password: 'password' }
194
- ::RSpec::Mocks.with_temporary_scope do
195
- mock_inventory_client
196
- options = { tenant: 'hawkular' }
197
- @inventory_client = InventoryClient.create(entrypoint: HOST, credentials: @creds, options: options)
198
- end
199
- inventory_client = @inventory_client
200
- remove_instance_variable(:@inventory_client)
201
- @tenant_id = inventory_client.get_tenant
202
- VCR.use_cassette('Operation/Helpers/get_feed', decode_compressed_response: true) do
203
- @feed_id = inventory_client.list_feeds[0]
96
+ it 'should run into error callback because bad hash parameters' do
97
+ noop = { operationName: 'noop' }
98
+ operation_outcome = {}
99
+ client.invoke_generic_operation(noop) do |on|
100
+ on.success do |_data|
101
+ operation_outcome[:data] = 'should run into error'
102
+ end
103
+ on.failure do |error|
104
+ operation_outcome[:data] = error
105
+ end
106
+ end
107
+ expect(wait_for(operation_outcome)).to eq 'Hash property resourcePath must be specified'
204
108
  end
205
- @random_uuid = 'random'
206
- end
207
- end
208
109
 
209
- before(:each) do |ex|
210
- unless ex.metadata[:skip_open]
211
- @client = OperationsClient.new(entrypoint: 'http://localhost:8080',
212
- credentials: @creds,
213
- wait_time: WebSocketVCR.live? ? 1.5 : 0)
214
- @ws = @client.ws
215
- end
216
- end
217
-
218
- around(:each) do |ex|
219
- if ex.metadata[:websocket]
220
- WebSocketVCR.configure do |c|
221
- c.hook_uris = [HOST]
222
- end
223
- WebSocketVCR.record(ex, self) do
224
- ex.run
110
+ it 'should bail with hash property error because no callback at all' do
111
+ noop = { operationName: 'noop' }
112
+ expect { client.invoke_generic_operation(noop) }.to raise_error(ArgumentError,
113
+ 'You need to specify error callback')
225
114
  end
226
- else
227
- ex.run
228
- end
229
- end
230
-
231
- after(:each) do |ex|
232
- unless ex.metadata[:skip_close]
233
- @client.close_connection!
234
- @client = nil
235
- @ws = nil
236
- end
237
- end
238
115
 
239
- it 'Add JDBC driver should add the driver' do
240
- wf_server_resource_id = 'Local~~'
241
- driver_name = 'CreatedByRubyDriver' + @random_uuid
242
- driver_bits = IO.binread("#{File.dirname(__FILE__)}/../resources/driver.jar")
243
- wf_path = CanonicalPath.new(tenant_id: @tenant_id,
244
- feed_id: @feed_id,
245
- resource_ids: [wf_server_resource_id]).to_s
246
-
247
- actual_data = {}
248
- @client.add_jdbc_driver(resource_path: wf_path,
249
- driver_jar_name: 'driver.jar',
250
- driver_name: driver_name,
251
- module_name: 'foo.bar.' + @random_uuid, # jboss module
252
- driver_class: 'com.mysql.jdbc.Driver',
253
- binary_content: driver_bits) do |on|
254
- on.success do |data|
255
- actual_data[:data] = data
256
- end
257
- on.failure do |error|
258
- actual_data[:data] = {}
259
- puts 'error callback was called, reason: ' + error.to_s
116
+ it 'should bail with hash property error because no error-callback ' do
117
+ noop = { operationName: 'noop' }
118
+ expect do
119
+ client.invoke_generic_operation(noop) do |on|
120
+ on.success do |_data|
121
+ fail 'This should have failed'
122
+ end
123
+ end
124
+ end.to raise_error(ArgumentError, 'You need to specify error callback')
260
125
  end
261
- end
262
- actual_data = wait_for actual_data
263
- expect(actual_data['status']).to eq('OK')
264
- expect(actual_data['message']).to start_with('Added JDBC Driver')
265
- expect(actual_data['driverName']).to eq(driver_name)
266
- end
267
126
 
268
- it 'Restart should be performed and eventually respond with success' do
269
- wf_server_resource_id = 'Local~~'
270
- alerts_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-alerts-actions-email.war'
271
- path = CanonicalPath.new(tenant_id: @tenant_id,
272
- feed_id: @feed_id,
273
- resource_ids: [wf_server_resource_id, alerts_war_resource_id])
274
-
275
- restart = {
276
- resource_path: path.to_s,
277
- deployment_name: 'hawkular-alerts-actions-email.war'
278
- }
279
-
280
- actual_data = {}
281
- @client.restart_deployment(restart) do |on|
282
- on.success do |data|
283
- actual_data[:data] = data
284
- end
285
- on.failure do |error|
286
- actual_data[:data] = {}
287
- puts 'error callback was called, reason: ' + error.to_s
127
+ it 'should bail with no host' do
128
+ expect do
129
+ OperationsClient.new(options.merge host: nil)
130
+ end.to raise_error(StandardError, 'no parameter ":host" or ":entrypoint" given')
288
131
  end
289
132
  end
290
133
 
291
- # expectations don't work from callbacks so waiting for the results via blocking helper `wait_for`
292
- actual_data = wait_for actual_data
293
- expect(actual_data['status']).to eq('OK')
294
- expect(actual_data['resourcePath']).to eq(path.up.to_s)
295
- expect(actual_data['message']).to start_with('Performed [Restart Deployment] on')
296
- end
297
-
298
- it 'Restart should not be performed if resource path is wrong' do
299
- wf_server_resource_id = 'Unknown~~'
300
- wrong_war_resource_id = 'Unknown~%2Fdeployment%3Dnon-existent.war'
301
- path = CanonicalPath.new(tenant_id: @tenant_id,
302
- feed_id: @feed_id,
303
- resource_ids: [wf_server_resource_id, wrong_war_resource_id])
304
-
305
- restart = {
306
- resource_path: path.to_s,
307
- deployment_name: 'non-existent.war'
308
- }
309
- actual_data = {}
310
- @client.restart_deployment(restart) do |on|
311
- on.success do |_|
312
- actual_data[:data] = { error: 'the operation should have failed' }
313
- end
314
- on.failure do |error|
315
- actual_data[:data] = { error: error }
134
+ describe 'Operation/Operation' do
135
+ before(:all) do
136
+ @random_uuid = SecureRandom.uuid
137
+ @not_so_random_uuid = 'not_so_random_uuid'
316
138
  end
317
- end
318
- actual_data = wait_for actual_data
319
- expect(actual_data[:error]).to start_with('Cannot restart application: unknown resource')
320
- end
321
139
 
322
- it 'Disable should be performed and eventually respond with success' do
323
- wf_server_resource_id = 'Local~~'
324
- alerts_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-alerts-actions-email.war'
325
- path = CanonicalPath.new(tenant_id: @tenant_id,
326
- feed_id: @feed_id,
327
- resource_ids: [wf_server_resource_id, alerts_war_resource_id])
328
-
329
- disable = {
330
- resource_path: path.to_s,
331
- deployment_name: 'hawkular-alerts-actions-email.war'
332
- }
333
- actual_data = {}
334
- @client.disable_deployment(disable) do |on|
335
- on.success do |data|
336
- actual_data[:data] = data
337
- end
338
- on.failure do |error|
339
- actual_data[:data] = {}
340
- puts 'error callback was called, reason: ' + error.to_s
140
+ around(:each) do |example|
141
+ record("Operation/#{security_context}/Helpers", nil, 'get_tenant') do
142
+ ::RSpec::Mocks.with_temporary_scope do
143
+ mock_inventory_client
144
+ @inventory_client = InventoryClient.create(
145
+ options.merge entrypoint: host_with_scheme(host, security_context == SECURE_CONTEXT))
146
+ end
147
+ inventory_client = @inventory_client
148
+ remove_instance_variable(:@inventory_client)
149
+ @tenant_id = inventory_client.get_tenant
150
+ record("Operation/#{security_context}/Helpers", { tenant_id: @tenant_id }, 'get_feed') do
151
+ @feed_id = inventory_client.list_feeds[0]
152
+ end
153
+ end
154
+ @bindings = { random_uuid: @random_uuid, tenant_id: @tenant_id, feed_id: @feed_id }
155
+ record_websocket("Operation/#{security_context}/Operation",
156
+ @bindings,
157
+ cassette_name,
158
+ example)
341
159
  end
342
- end
343
- actual_data = wait_for actual_data
344
- expect(actual_data['status']).to eq('OK')
345
- expect(actual_data['message']).to start_with('Performed [Undeploy] on')
346
- end
347
160
 
348
- it 'Add datasource should be doable' do
349
- wf_server_resource_id = 'Local~~'
350
- wf_path = CanonicalPath.new(tenant_id: @tenant_id,
351
- feed_id: @feed_id,
352
- resource_ids: [wf_server_resource_id]).to_s
353
- payload = {
354
- # compulsory fields
355
- resourcePath: wf_path,
356
- xaDatasource: false,
357
- datasourceName: 'CreatedByRubyDS' + @random_uuid,
358
- jndiName: 'java:jboss/datasources/CreatedByRubyDS' + @random_uuid,
359
- driverName: 'h2',
360
- # this is probably a bug (driver class should be already defined in driver)
361
- driverClass: 'org.h2.Driver',
362
- connectionUrl: 'dbc:h2:mem:ruby;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE',
363
-
364
- # optional
365
- datasourceProperties: {
366
- someKey: 'someValue'
367
- },
368
- userName: 'sa',
369
- password: 'sa',
370
- securityDomain: 'other'
371
- # xaDataSourceClass: 'clazz' for xa DS
372
- }
373
-
374
- actual_data = {}
375
- @client.add_datasource(payload) do |on|
376
- on.success do |data|
377
- actual_data[:data] = data
378
- end
379
- on.failure do |error|
380
- actual_data[:data] = { 'status' => 'ERROR' }
381
- puts 'error callback was called, reason: ' + error.to_s
161
+ it 'Add JDBC driver should add the driver' do
162
+ wf_server_resource_id = 'Local~~'
163
+ driver_name = 'CreatedByRubyDriver' + @not_so_random_uuid
164
+ driver_bits = IO.binread("#{File.dirname(__FILE__)}/../resources/driver.jar")
165
+ wf_path = CanonicalPath.new(tenant_id: @tenant_id,
166
+ feed_id: @feed_id,
167
+ resource_ids: [wf_server_resource_id]).to_s
168
+
169
+ actual_data = {}
170
+
171
+ client.add_jdbc_driver(resource_path: wf_path,
172
+ driver_jar_name: 'driver.jar',
173
+ driver_name: driver_name,
174
+ module_name: 'foo.bar' + @not_so_random_uuid, # jboss module
175
+ driver_class: 'com.mysql.jdbc.Driver',
176
+ binary_content: driver_bits) do |on|
177
+ on.success do |data|
178
+ actual_data[:data] = data
179
+ end
180
+ on.failure do |error|
181
+ actual_data[:data] = {}
182
+ puts 'error callback was called, reason: ' + error.to_s
183
+ end
184
+ end
185
+ actual_data = wait_for actual_data
186
+ expect(actual_data['status']).to eq('OK')
187
+ expect(actual_data['message']).to start_with('Added JDBC Driver')
188
+ expect(actual_data['driverName']).to eq(driver_name)
382
189
  end
383
- end
384
- actual_data = wait_for actual_data
385
- expect(actual_data['status']).to eq('OK')
386
- expect(actual_data['message']).to start_with('Added Datasource')
387
- expect(actual_data['xaDatasource']).to be_falsey
388
- expect(actual_data['datasourceName']).to eq(payload[:datasourceName])
389
- expect(actual_data['resourcePath']).to eq(payload[:resourcePath])
390
- end
391
190
 
392
- it 'should not be possible to perform on closed client', skip_open: true, skip_close: true do
393
- @client.close_connection! unless @client.nil?
191
+ it 'Restart should be performed and eventually respond with success' do
192
+ wf_server_resource_id = 'Local~~'
193
+ alerts_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-alerts-actions-email.war'
194
+ path = CanonicalPath.new(tenant_id: @tenant_id,
195
+ feed_id: @feed_id,
196
+ resource_ids: [wf_server_resource_id, alerts_war_resource_id])
197
+
198
+ restart = {
199
+ resource_path: path.to_s,
200
+ deployment_name: 'hawkular-alerts-actions-email.war'
201
+ }
202
+
203
+ actual_data = {}
204
+ client.restart_deployment(restart) do |on|
205
+ on.success do |data|
206
+ actual_data[:data] = data
207
+ end
208
+ on.failure do |error|
209
+ actual_data[:data] = {}
210
+ puts 'error callback was called, reason: ' + error.to_s
211
+ end
212
+ end
394
213
 
395
- # open the connection
396
- operations_client = OperationsClient.new(entrypoint: 'http://localhost:8080', credentials: @creds)
214
+ # expectations don't work from callbacks so waiting for the results via blocking helper `wait_for`
215
+ actual_data = wait_for actual_data
216
+ expect(actual_data['status']).to eq('OK')
217
+ expect(actual_data['resourcePath']).to eq(path.up.to_s)
218
+ expect(actual_data['message']).to start_with('Performed [Restart Deployment] on')
219
+ end
397
220
 
398
- restart = {
399
- resource_path: '/t;t1/f;whatever/r;something',
400
- deployment_name: 'something.war'
401
- }
221
+ it 'Restart should not be performed if resource path is wrong' do
222
+ wf_server_resource_id = 'Unknown~~'
223
+ wrong_war_resource_id = 'Unknown~%2Fdeployment%3Dnon-existent.war'
224
+ path = CanonicalPath.new(tenant_id: @tenant_id,
225
+ feed_id: @feed_id,
226
+ resource_ids: [wf_server_resource_id, wrong_war_resource_id])
227
+
228
+ restart = {
229
+ resource_path: path.to_s,
230
+ deployment_name: 'non-existent.war'
231
+ }
232
+ actual_data = {}
233
+ client.restart_deployment(restart) do |on|
234
+ on.success do |_|
235
+ actual_data[:data] = { error: 'the operation should have failed' }
236
+ end
237
+ on.failure do |error|
238
+ actual_data[:data] = { error: error }
239
+ end
240
+ end
241
+ actual_data = wait_for actual_data
242
+ expect(actual_data[:error]).to start_with('Could not perform [Restart Deployment] on a [Application] given')
243
+ end
402
244
 
403
- # close the connection
404
- operations_client.close_connection!
405
- expect do
406
- operations_client.restart_deployment(restart)
407
- end.to raise_error(RuntimeError, /Handshake with server has not been done./)
408
- end
245
+ it 'Disable should be performed and eventually respond with success' do
246
+ wf_server_resource_id = 'Local~~'
247
+ alerts_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-alerts-actions-email.war'
248
+ path = CanonicalPath.new(tenant_id: @tenant_id,
249
+ feed_id: @feed_id,
250
+ resource_ids: [wf_server_resource_id, alerts_war_resource_id])
251
+
252
+ disable = {
253
+ resource_path: path.to_s,
254
+ deployment_name: 'hawkular-alerts-actions-email.war'
255
+ }
256
+ actual_data = {}
257
+ client.disable_deployment(disable) do |on|
258
+ on.success do |data|
259
+ actual_data[:data] = data
260
+ end
261
+ on.failure do |error|
262
+ actual_data[:data] = {}
263
+ puts 'error callback was called, reason: ' + error.to_s
264
+ end
265
+ end
266
+ actual_data = wait_for actual_data
267
+ expect(actual_data['status']).to eq('OK')
268
+ expect(actual_data['message']).to start_with('Performed [Disable Deployment] on')
269
+ end
409
270
 
410
- it 'Restart can be run multiple times in parallel' do
411
- wf_server_resource_id = 'Local~~'
412
- alerts_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-alerts-actions-email.war'
413
- console_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-console.war'
414
- path1 = CanonicalPath.new(tenant_id: @tenant_id,
415
- feed_id: @feed_id,
416
- resource_ids: [wf_server_resource_id, alerts_war_resource_id])
417
- path2 = CanonicalPath.new(tenant_id: @tenant_id,
418
- feed_id: @feed_id,
419
- resource_ids: [wf_server_resource_id, console_war_resource_id])
420
-
421
- restart1 = {
422
- resource_path: path1.to_s,
423
- deployment_name: 'hawkular-alerts-actions-email.war'
424
- }
425
-
426
- restart2 = {
427
- resource_path: path2.to_s,
428
- deployment_name: 'hawkular-console.war'
429
- }
430
-
431
- # run the first operation w/o registering the callback
432
- @client.restart_deployment(restart1)
433
-
434
- actual_data = {}
435
- # run the 2nd operation with 2 callback blocks (the happy path and the less happy path)
436
- @client.restart_deployment(restart2) do |on|
437
- on.success do |data|
438
- actual_data[:data] = data
271
+ it 'Add datasource should be doable' do
272
+ wf_server_resource_id = 'Local~~'
273
+ wf_path = CanonicalPath.new(tenant_id: @tenant_id,
274
+ feed_id: @feed_id,
275
+ resource_ids: [wf_server_resource_id]).to_s
276
+ payload = {
277
+ # compulsory fields
278
+ resourcePath: wf_path,
279
+ xaDatasource: false,
280
+ datasourceName: 'CreatedByRubyDS' + @random_uuid,
281
+ jndiName: 'java:jboss/datasources/CreatedByRubyDS' + @random_uuid,
282
+ driverName: 'h2',
283
+ # this is probably a bug (driver class should be already defined in driver)
284
+ driverClass: 'org.h2.Driver',
285
+ connectionUrl: 'dbc:h2:mem:ruby;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE',
286
+
287
+ # optional
288
+ datasourceProperties: {
289
+ someKey: 'someValue'
290
+ },
291
+ userName: 'sa',
292
+ password: 'sa',
293
+ securityDomain: 'other'
294
+ # xaDataSourceClass: 'clazz' for xa DS
295
+ }
296
+
297
+ actual_data = {}
298
+ client.add_datasource(payload) do |on|
299
+ on.success do |data|
300
+ actual_data[:data] = data
301
+ end
302
+ on.failure do |error|
303
+ actual_data[:data] = { 'status' => 'ERROR' }
304
+ puts 'error callback was called, reason: ' + error.to_s
305
+ end
306
+ end
307
+ actual_data = wait_for actual_data
308
+ expect(actual_data['status']).to eq('OK')
309
+ expect(actual_data['message']).to start_with('Added Datasource')
310
+ expect(actual_data['xaDatasource']).to be_falsey
311
+ expect(actual_data['datasourceName']).to eq(payload[:datasourceName])
312
+ expect(actual_data['resourcePath']).to eq(payload[:resourcePath])
439
313
  end
440
- on.failure do |error|
441
- actual_data[:data] = {}
442
- puts 'error callback was called, reason: ' + error.to_s
314
+
315
+ it 'should not be possible to perform on closed client' do
316
+ restart = {
317
+ resource_path: '/t;t1/f;whatever/r;something',
318
+ deployment_name: 'something.war'
319
+ }
320
+
321
+ # close the connection
322
+ client.close_connection!
323
+ expect do
324
+ client.restart_deployment(restart)
325
+ end.to raise_error(RuntimeError, /Handshake with server has not been done./)
443
326
  end
444
- end
445
327
 
446
- actual_data = wait_for actual_data
447
- expect(actual_data['status']).to eq('OK')
448
- expect(actual_data['resourcePath']).to eq(path2.up.to_s)
449
- expect(actual_data['message']).to start_with('Performed [Restart Deployment] on')
450
- end
328
+ it 'Restart can be run multiple times in parallel' do
329
+ wf_server_resource_id = 'Local~~'
330
+ alerts_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-alerts-actions-email.war'
331
+ console_war_resource_id = 'Local~%2Fdeployment%3Dhawkular-wildfly-agent-download.war'
332
+ path1 = CanonicalPath.new(tenant_id: @tenant_id,
333
+ feed_id: @feed_id,
334
+ resource_ids: [wf_server_resource_id, alerts_war_resource_id])
335
+ path2 = CanonicalPath.new(tenant_id: @tenant_id,
336
+ feed_id: @feed_id,
337
+ resource_ids: [wf_server_resource_id, console_war_resource_id])
338
+
339
+ restart1 = {
340
+ resource_path: path1.to_s,
341
+ deployment_name: 'hawkular-alerts-actions-email.war'
342
+ }
343
+
344
+ restart2 = {
345
+ resource_path: path2.to_s,
346
+ deployment_name: 'hawkular-wildfly-agent-download.war'
347
+ }
348
+
349
+ # run the first operation w/o registering the callback
350
+ client.restart_deployment(restart1)
351
+
352
+ actual_data = {}
353
+ # run the 2nd operation with 2 callback blocks (the happy path and the less happy path)
354
+ client.restart_deployment(restart2) do |on|
355
+ on.success do |data|
356
+ actual_data[:data] = data
357
+ end
358
+ on.failure do |error|
359
+ actual_data[:data] = {}
360
+ puts 'error callback was called, reason: ' + error.to_s
361
+ end
362
+ end
451
363
 
452
- it 'Add deployment should be doable' do
453
- wf_server_resource_id = 'Local~~'
454
- app_name = 'sample.war'
455
- war_file = IO.binread("#{File.dirname(__FILE__)}/../resources/#{app_name}")
456
- wf_path = CanonicalPath.new(tenant_id: @tenant_id,
457
- feed_id: @feed_id,
458
- resource_ids: [wf_server_resource_id]).to_s
459
-
460
- actual_data = {}
461
- @client.add_deployment(resource_path: wf_path,
462
- destination_file_name: app_name,
463
- binary_content: war_file) do |on|
464
- on.success do |data|
465
- actual_data[:data] = data
364
+ actual_data = wait_for actual_data
365
+ expect(actual_data['status']).to eq('OK')
366
+ expect(actual_data['resourcePath']).to eq(path2.up.to_s)
367
+ expect(actual_data['message']).to start_with('Performed [Restart Deployment] on')
466
368
  end
467
- on.failure do |error|
468
- actual_data[:data] = {}
469
- puts 'error callback was called, reason: ' + error.to_s
470
- end
471
- end
472
- actual_data = wait_for actual_data
473
- expect(actual_data['status']).to eq('OK')
474
- expect(actual_data['message']).to start_with('Performed [Deploy] on')
475
- expect(actual_data['destinationFileName']).to eq(app_name)
476
- expect(actual_data['resourcePath']).to eq(wf_path)
477
- end
478
369
 
479
- it 'Undeploy deployment should be performed and eventually respond with success' do
480
- wf_server_resource_id = 'Local~~'
481
- sample_app_resource_id = 'Local~%2Fdeployment=sample.war'
482
- path = CanonicalPath.new(tenant_id: @tenant_id,
483
- feed_id: @feed_id,
484
- resource_ids: [wf_server_resource_id, sample_app_resource_id])
485
- undeploy = {
486
- resource_path: path.to_s,
487
- deployment_name: 'sample.war'
488
- }
489
- actual_data = {}
490
- @client.undeploy(undeploy) do |on|
491
- on.success do |data|
492
- actual_data[:data] = data
493
- end
494
- on.failure do |error|
495
- actual_data[:data] = { 'status' => 'ERROR' }
496
- puts 'error callback was called, reason: ' + error.to_s
370
+ it 'Add deployment should be doable' do
371
+ wf_server_resource_id = 'Local~~'
372
+ app_name = 'sample.war'
373
+ war_file = IO.binread("#{File.dirname(__FILE__)}/../resources/#{app_name}")
374
+ wf_path = CanonicalPath.new(tenant_id: @tenant_id,
375
+ feed_id: @feed_id,
376
+ resource_ids: [wf_server_resource_id]).to_s
377
+
378
+ actual_data = {}
379
+ client.add_deployment(resource_path: wf_path,
380
+ destination_file_name: app_name,
381
+ binary_content: war_file) do |on|
382
+ on.success do |data|
383
+ actual_data[:data] = data
384
+ end
385
+ on.failure do |error|
386
+ actual_data[:data] = {}
387
+ puts 'error callback was called, reason: ' + error.to_s
388
+ end
389
+ end
390
+ actual_data = wait_for actual_data
391
+ expect(actual_data['status']).to eq('OK')
392
+ expect(actual_data['message']).to start_with('Performed [Deploy] on')
393
+ expect(actual_data['destinationFileName']).to eq(app_name)
394
+ expect(actual_data['resourcePath']).to eq(wf_path)
497
395
  end
498
- end
499
- actual_data = wait_for actual_data
500
- expect(actual_data['status']).to eq('OK')
501
- expect(actual_data['message']).to start_with('Performed [Undeploy] on')
502
- end
503
396
 
504
- it 'Remove datasource should be performed and eventually respond with success' do
505
- wf_server_resource_id = 'Local~~'
506
- datasource_resource_id = 'Local~%2Fsubsystem%3Ddatasources%2Fdata-source%3DCreatedByRubyDS' + @random_uuid
507
- path = CanonicalPath.new(tenant_id: @tenant_id,
508
- feed_id: @feed_id,
509
- resource_ids: [wf_server_resource_id, datasource_resource_id])
510
-
511
- operation = {
512
- resourcePath: path.to_s
513
- }
514
-
515
- actual_data = {}
516
- @client.invoke_specific_operation(operation, 'RemoveDatasource') do |on|
517
- on.success do |data|
518
- actual_data[:data] = data
519
- end
520
- on.failure do |error|
521
- actual_data[:data] = {}
522
- puts 'error callback was called, reason: ' + error.to_s
397
+ it 'Undeploy deployment should be performed and eventually respond with success' do
398
+ wf_server_resource_id = 'Local~~'
399
+ sample_app_resource_id = 'Local~%2Fdeployment=sample.war'
400
+ path = CanonicalPath.new(tenant_id: @tenant_id,
401
+ feed_id: @feed_id,
402
+ resource_ids: [wf_server_resource_id, sample_app_resource_id])
403
+ undeploy = {
404
+ resource_path: path.to_s,
405
+ deployment_name: 'sample.war'
406
+ }
407
+ actual_data = {}
408
+ client.undeploy(undeploy) do |on|
409
+ on.success do |data|
410
+ actual_data[:data] = data
411
+ end
412
+ on.failure do |error|
413
+ actual_data[:data] = { 'status' => 'ERROR' }
414
+ puts 'error callback was called, reason: ' + error.to_s
415
+ end
416
+ end
417
+ actual_data = wait_for actual_data
418
+ expect(actual_data['status']).to eq('OK')
419
+ expect(actual_data['message']).to start_with('Performed [Undeploy] on')
523
420
  end
524
- end
525
- actual_data = wait_for actual_data
526
- expect(actual_data['status']).to eq('OK')
527
- expect(actual_data['message']).to start_with('Performed [Remove] on')
528
- expect(actual_data['serverRefreshIndicator']).to eq('RELOAD-REQUIRED')
529
- end
530
421
 
531
- it 'Remove JDBC driver should be performed and eventually respond with success' do
532
- wf_server_resource_id = 'Local~~'
533
- driver_resource_id = 'Local~%2Fsubsystem%3Ddatasources%2Fjdbc-driver%3DCreatedByRubyDriver' + @random_uuid
534
- path = CanonicalPath.new(tenant_id: @tenant_id,
535
- feed_id: @feed_id,
536
- resource_ids: [wf_server_resource_id, driver_resource_id]).to_s
537
-
538
- actual_data = {}
539
- @client.invoke_specific_operation({ resourcePath: path }, 'RemoveJdbcDriver') do |on|
540
- on.success do |data|
541
- actual_data[:data] = data
422
+ it 'Remove datasource should be performed and eventually respond with success' do
423
+ wf_server_resource_id = 'Local~~'
424
+ datasource_resource_id = 'Local~%2Fsubsystem%3Ddatasources%2Fdata-source%3DCreatedByRubyDS' + @random_uuid
425
+ path = CanonicalPath.new(tenant_id: @tenant_id,
426
+ feed_id: @feed_id,
427
+ resource_ids: [wf_server_resource_id, datasource_resource_id])
428
+
429
+ operation = {
430
+ resourcePath: path.to_s
431
+ }
432
+
433
+ actual_data = {}
434
+ client.invoke_specific_operation(operation, 'RemoveDatasource') do |on|
435
+ on.success do |data|
436
+ actual_data[:data] = data
437
+ end
438
+ on.failure do |error|
439
+ actual_data[:data] = {}
440
+ puts 'error callback was called, reason: ' + error.to_s
441
+ end
442
+ end
443
+ actual_data = wait_for actual_data
444
+ expect(actual_data['status']).to eq('OK')
445
+ expect(actual_data['message']).to start_with('Performed [Remove] on')
446
+ expect(actual_data['serverRefreshIndicator']).to eq('RELOAD-REQUIRED')
542
447
  end
543
- on.failure do |error|
544
- actual_data[:data] = {}
545
- puts 'error callback was called, reason: ' + error.to_s
448
+
449
+ it 'Remove JDBC driver should be performed and eventually respond with success' do
450
+ wf_server_resource_id = 'Local~~'
451
+ driver_resource_id = 'Local~%2Fsubsystem%3Ddatasources%2Fjdbc-driver%3DCreatedByRubyDriver'
452
+ driver_resource_id << @not_so_random_uuid
453
+ path = CanonicalPath.new(tenant_id: @tenant_id,
454
+ feed_id: @feed_id,
455
+ resource_ids: [wf_server_resource_id, driver_resource_id]).to_s
456
+
457
+ actual_data = {}
458
+ client.invoke_specific_operation({ resourcePath: path }, 'RemoveJdbcDriver') do |on|
459
+ on.success do |data|
460
+ actual_data[:data] = data
461
+ end
462
+ on.failure do |error|
463
+ actual_data[:data] = {}
464
+ puts 'error callback was called, reason: ' + error.to_s
465
+ end
466
+ end
467
+ actual_data = wait_for actual_data
468
+ expect(actual_data['status']).to eq('OK')
469
+ expect(actual_data['resourcePath']).to eq(path)
470
+ expect(actual_data['message']).to start_with('Performed [Remove] on a [JDBC Driver]')
546
471
  end
547
- end
548
- actual_data = wait_for actual_data
549
- expect(actual_data['status']).to eq('OK')
550
- expect(actual_data['resourcePath']).to eq(path)
551
- expect(actual_data['message']).to start_with('Performed [Remove] on a [JDBC Driver]')
552
- end
553
472
 
554
- xit 'Export JDR should retrieve the zip file with the report' do
555
- wf_server_resource_id = 'Local~~'
556
- path = CanonicalPath.new(tenant_id: @tenant_id,
557
- feed_id: @feed_id,
558
- resource_ids: [wf_server_resource_id]).to_s
473
+ xit 'Export JDR should retrieve the zip file with the report' do
474
+ wf_server_resource_id = 'Local~~'
475
+ path = CanonicalPath.new(tenant_id: @tenant_id,
476
+ feed_id: @feed_id,
477
+ resource_ids: [wf_server_resource_id]).to_s
559
478
 
560
- actual_data = {}
561
- @client.export_jdr(path) do |on|
562
- on.success do |data|
563
- actual_data[:data] = data
564
- end
565
- on.failure do |error|
566
- actual_data[:data] = {}
567
- puts 'error callback was called, reason: ' + error.to_s
479
+ actual_data = {}
480
+ client.export_jdr(path) do |on|
481
+ on.success do |data|
482
+ actual_data[:data] = data
483
+ end
484
+ on.failure do |error|
485
+ actual_data[:data] = {}
486
+ puts 'error callback was called, reason: ' + error.to_s
487
+ end
488
+ end
489
+ actual_data = wait_for actual_data
490
+ expect(actual_data['status']).to eq('OK')
491
+ expect(actual_data['resourcePath']).to eq(path)
492
+ expect(actual_data['message']).to start_with('Performed [Export JDR] on')
493
+ expect(actual_data['fileName']).to start_with('jdr_')
568
494
  end
569
495
  end
570
- actual_data = wait_for actual_data
571
- expect(actual_data['status']).to eq('OK')
572
- expect(actual_data['resourcePath']).to eq(path)
573
- expect(actual_data['message']).to start_with('Performed [Export JDR] on')
574
- expect(actual_data['fileName']).to start_with('jdr_')
575
496
  end
576
497
  end
577
498
  end