gooddata 1.1.0-java → 1.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/.document +0 -0
  3. data/.flayignore +2 -0
  4. data/.travis.yml +24 -7
  5. data/.yardopts +0 -0
  6. data/CHANGELOG.md +144 -0
  7. data/CLI.md +0 -0
  8. data/Dockerfile.jruby +7 -2
  9. data/Dockerfile.ruby +1 -1
  10. data/Gemfile +0 -0
  11. data/Guardfile +0 -0
  12. data/Rakefile +23 -9
  13. data/TODO.md +0 -0
  14. data/bin/gitflow-init.sh +8 -0
  15. data/ci.rake +3 -3
  16. data/data/2008.crt +39 -0
  17. data/data/new_ca.cer +22 -0
  18. data/dependency_decisions.yml +0 -0
  19. data/docker-compose.lcm.yml +31 -0
  20. data/docker-compose.yml +4 -2
  21. data/gooddata.gemspec +3 -3
  22. data/lcm.rake +288 -0
  23. data/lib/gooddata.rb +1 -0
  24. data/lib/gooddata/bricks/base_downloader.rb +1 -1
  25. data/lib/gooddata/bricks/brick.rb +0 -1
  26. data/lib/gooddata/bricks/middleware/aws_middleware.rb +1 -1
  27. data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
  28. data/lib/gooddata/bricks/pipeline.rb +67 -0
  29. data/lib/gooddata/bricks/provisioning_brick.rb +18 -0
  30. data/lib/gooddata/bricks/release_brick.rb +18 -0
  31. data/lib/gooddata/bricks/rollout_brick.rb +14 -0
  32. data/lib/gooddata/bricks/user_filters_brick.rb +13 -0
  33. data/lib/gooddata/bricks/users_brick.rb +13 -0
  34. data/lib/gooddata/core/logging.rb +1 -1
  35. data/lib/gooddata/exceptions/maql_execution.rb +1 -1
  36. data/lib/gooddata/extensions/string.rb +0 -0
  37. data/lib/gooddata/lcm/actions/associate_clients.rb +34 -8
  38. data/lib/gooddata/lcm/actions/collect_data_product.rb +8 -1
  39. data/lib/gooddata/lcm/actions/collect_segment_clients.rb +13 -23
  40. data/lib/gooddata/lcm/actions/collect_segments.rb +10 -0
  41. data/lib/gooddata/lcm/actions/synchronize_clients.rb +3 -1
  42. data/lib/gooddata/lcm/actions/synchronize_ldm.rb +61 -34
  43. data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +6 -4
  44. data/lib/gooddata/lcm/actions/update_release_table.rb +4 -12
  45. data/lib/gooddata/lcm/dsl/params_dsl.rb +0 -4
  46. data/lib/gooddata/lcm/dsl/type_dsl.rb +0 -4
  47. data/lib/gooddata/lcm/helpers/check_helper.rb +1 -1
  48. data/lib/gooddata/lcm/lcm2.rb +0 -2
  49. data/lib/gooddata/lcm/types/special/enum.rb +6 -0
  50. data/lib/gooddata/lcm/types/special/enum/synchronize_ldm.rb +20 -0
  51. data/lib/gooddata/lcm/types/special/types.rb +1 -1
  52. data/lib/gooddata/mixins/is_folder.rb +0 -0
  53. data/lib/gooddata/mixins/to_json.rb +0 -0
  54. data/lib/gooddata/mixins/uri_getter.rb +0 -0
  55. data/lib/gooddata/models/project_creator.rb +38 -30
  56. data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -0
  57. data/lib/gooddata/rest/README.md +0 -0
  58. data/lib/gooddata/version.rb +1 -1
  59. data/lib/templates/bricks/brick.rb.erb +0 -0
  60. data/lib/templates/bricks/main.rb.erb +0 -0
  61. data/lib/templates/project/Goodfile.erb +0 -0
  62. data/lib/templates/project/data/commits.csv +0 -0
  63. data/lib/templates/project/data/devs.csv +0 -0
  64. data/lib/templates/project/data/repos.csv +0 -0
  65. data/lib/templates/project/model/model.rb.erb +0 -0
  66. metadata +23 -452
  67. data/lib/gooddata/lcm/actions/ensure_data_product.rb +0 -63
  68. data/spec/.rubocop.yml +0 -16
  69. data/spec/bricks/bricks_spec.rb +0 -110
  70. data/spec/bricks/default-config.json +0 -8
  71. data/spec/data/.gooddata +0 -4
  72. data/spec/data/blueprints/additional_dataset_module.json +0 -32
  73. data/spec/data/blueprints/attribute_sort_order_blueprint.json +0 -72
  74. data/spec/data/blueprints/big_blueprint_not_pruned.json +0 -2079
  75. data/spec/data/blueprints/invalid_blueprint.json +0 -103
  76. data/spec/data/blueprints/m_n_model.json +0 -104
  77. data/spec/data/blueprints/model_module.json +0 -25
  78. data/spec/data/blueprints/test_blueprint.json +0 -39
  79. data/spec/data/blueprints/test_project_model_spec.json +0 -106
  80. data/spec/data/cc/data/source/commits.csv +0 -4
  81. data/spec/data/cc/data/source/devs.csv +0 -4
  82. data/spec/data/cc/data/source/repos.csv +0 -3
  83. data/spec/data/cc/devel.prm +0 -0
  84. data/spec/data/cc/graph/graph.grf +0 -11
  85. data/spec/data/cc/workspace.prm +0 -19
  86. data/spec/data/column_based_permissions.csv +0 -7
  87. data/spec/data/column_based_permissions2.csv +0 -6
  88. data/spec/data/dynamic_schedule_params_table.csv +0 -7
  89. data/spec/data/gd_gse_data_blueprint.json +0 -1371
  90. data/spec/data/gd_gse_data_manifest.json +0 -1424
  91. data/spec/data/gd_gse_data_model.json +0 -1772
  92. data/spec/data/gooddata_version_process/gooddata_version.rb +0 -9
  93. data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
  94. data/spec/data/hello_world_process/hello_world.rb +0 -9
  95. data/spec/data/hello_world_process/hello_world.zip +0 -0
  96. data/spec/data/integration_model.json +0 -252
  97. data/spec/data/integration_policies.csv +0 -9134
  98. data/spec/data/line_based_permissions.csv +0 -3
  99. data/spec/data/manifests/test_blueprint.json +0 -32
  100. data/spec/data/manifests/test_project.json +0 -107
  101. data/spec/data/reports/left_attr_report.json +0 -108
  102. data/spec/data/reports/metric_only_one_line.json +0 -83
  103. data/spec/data/reports/report_1.json +0 -197
  104. data/spec/data/reports/top_attr_report.json +0 -108
  105. data/spec/data/ruby_params_process/ruby_params.rb +0 -9
  106. data/spec/data/ruby_process/deep_files/deep_stuff.txt +0 -1
  107. data/spec/data/ruby_process/process.rb +0 -8
  108. data/spec/data/ruby_process/stuff.txt +0 -1
  109. data/spec/data/superfluous_titles_view.json +0 -81
  110. data/spec/data/test-ci-data.csv +0 -2
  111. data/spec/data/user_filters.csv +0 -2
  112. data/spec/data/users.csv +0 -12
  113. data/spec/data/wire_models/attribute_sort_by_model.json +0 -73
  114. data/spec/data/wire_models/model_view.json +0 -1775
  115. data/spec/data/wire_models/nu_model.json +0 -3046
  116. data/spec/data/wire_models/test_blueprint.json +0 -66
  117. data/spec/data/wire_test_project.json +0 -150
  118. data/spec/data/workspace_table.csv +0 -3
  119. data/spec/environment/default.rb +0 -43
  120. data/spec/environment/development.rb +0 -32
  121. data/spec/environment/environment.rb +0 -38
  122. data/spec/environment/production.rb +0 -27
  123. data/spec/environment/staging.rb +0 -32
  124. data/spec/environment/testing.rb +0 -32
  125. data/spec/helpers/appstore_project_helper.rb +0 -221
  126. data/spec/helpers/blueprint_helper.rb +0 -27
  127. data/spec/helpers/cli_helper.rb +0 -38
  128. data/spec/helpers/connection_helper.rb +0 -43
  129. data/spec/helpers/constants.rb +0 -32
  130. data/spec/helpers/crypto_helper.rb +0 -19
  131. data/spec/helpers/csv_helper.rb +0 -20
  132. data/spec/helpers/process_helper.rb +0 -35
  133. data/spec/helpers/project_helper.rb +0 -74
  134. data/spec/helpers/schedule_helper.rb +0 -33
  135. data/spec/helpers/spec_helper.rb +0 -17
  136. data/spec/integration/ads_output_stage_spec.rb +0 -45
  137. data/spec/integration/blueprint_updates_spec.rb +0 -107
  138. data/spec/integration/blueprint_with_ca_spec.rb +0 -56
  139. data/spec/integration/blueprint_with_grain_spec.rb +0 -74
  140. data/spec/integration/channel_configuration_spec.rb +0 -67
  141. data/spec/integration/clients_spec.rb +0 -164
  142. data/spec/integration/command_datawarehouse_spec.rb +0 -45
  143. data/spec/integration/command_projects_spec.rb +0 -32
  144. data/spec/integration/commands/command_projects_spec.rb +0 -22
  145. data/spec/integration/connection_spec.rb +0 -37
  146. data/spec/integration/core/connection_spec.rb +0 -56
  147. data/spec/integration/core/logging_spec.rb +0 -132
  148. data/spec/integration/core/project_spec.rb +0 -54
  149. data/spec/integration/create_from_template_spec.rb +0 -29
  150. data/spec/integration/create_project_spec.rb +0 -27
  151. data/spec/integration/date_dim_switch_spec.rb +0 -154
  152. data/spec/integration/deprecated_load_spec.rb +0 -60
  153. data/spec/integration/full_process_schedule_spec.rb +0 -367
  154. data/spec/integration/full_project_spec.rb +0 -592
  155. data/spec/integration/helpers_spec.rb +0 -16
  156. data/spec/integration/lcm_spec.rb +0 -54
  157. data/spec/integration/mandatory_user_filter_spec.rb +0 -53
  158. data/spec/integration/mixins/id_to_uri_spec.rb +0 -56
  159. data/spec/integration/models/data_product_spec.rb +0 -71
  160. data/spec/integration/models/domain_spec.rb +0 -162
  161. data/spec/integration/models/invitation_spec.rb +0 -17
  162. data/spec/integration/models/label_spec.rb +0 -49
  163. data/spec/integration/models/membership_spec.rb +0 -127
  164. data/spec/integration/models/metadata/report_spec.rb +0 -54
  165. data/spec/integration/models/metric_spec.rb +0 -24
  166. data/spec/integration/models/params_spec.rb +0 -118
  167. data/spec/integration/models/process_spec.rb +0 -35
  168. data/spec/integration/models/profile_spec.rb +0 -210
  169. data/spec/integration/models/project_role_spec.rb +0 -94
  170. data/spec/integration/models/project_spec.rb +0 -225
  171. data/spec/integration/models/schedule_spec.rb +0 -477
  172. data/spec/integration/models/unit_project_spec.rb +0 -130
  173. data/spec/integration/over_to_user_filters_spec.rb +0 -98
  174. data/spec/integration/partial_md_export_import_spec.rb +0 -41
  175. data/spec/integration/project_spec.rb +0 -381
  176. data/spec/integration/rest_spec.rb +0 -214
  177. data/spec/integration/schedule_spec.rb +0 -611
  178. data/spec/integration/segments_spec.rb +0 -100
  179. data/spec/integration/subscription_spec.rb +0 -88
  180. data/spec/integration/urn_date_dim_spec.rb +0 -53
  181. data/spec/integration/user_filters_spec.rb +0 -310
  182. data/spec/integration/user_group_spec.rb +0 -147
  183. data/spec/integration/variables_spec.rb +0 -189
  184. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/can_assign_a_custom_logger.yml +0 -2287
  185. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/client_logs_when_given_custom_message.yml +0 -2287
  186. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/has_the_request_id_logged_when_I_passed_it.yml +0 -2287
  187. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_off/Disables_logging.yml +0 -2287
  188. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_on/Enables_logging.yml +0 -2287
  189. data/spec/integration/vcr_cassettes/GoodData_-_project/_project/Returns_project_assigned.yml +0 -354
  190. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_nil.yml +0 -299
  191. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_directly.yml +0 -354
  192. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_ID.yml +0 -354
  193. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_URL.yml +0 -354
  194. data/spec/integration/vcr_cassettes/GoodData_-_project/_with_project/Uses_project_specified.yml +0 -354
  195. data/spec/integration/vcr_cassettes/GoodData_Metric/all.yml +0 -2065
  196. data/spec/integration/vcr_cassettes/GoodData_Metric/should_be_able_to_update_folders.yml +0 -119
  197. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/all.yml +0 -9812
  198. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_get_json_containing_correct_id.yml +0 -174
  199. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_return_nil_for_unknown_id.yml +0 -58
  200. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_throw_BadRequest_for_-1.yml +0 -63
  201. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_connect/Connects_using_username_and_password.yml +0 -299
  202. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_disconnect/Connects_using_username_and_password.yml +0 -299
  203. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_generate_request_id/Generates_a_non-empty_string.yml +0 -2287
  204. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_/Should_list_user_groups_as_Array.yml +0 -56
  205. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_add_members/Should_add_member.yml +0 -315
  206. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_members/Should_return_members_as_array.yml +0 -54
  207. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_remove_members/Should_remove_existing_members.yml +0 -258
  208. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_save/updates_existing_group.yml +0 -159
  209. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_set_members/Should_set_new_members.yml +0 -158
  210. data/spec/integration/vcr_cassettes/GoodData_UserGroup/all.yml +0 -809
  211. data/spec/logging_in_logging_out_spec.rb +0 -91
  212. data/spec/spec_helper.rb +0 -110
  213. data/spec/unit/actions/associate_clients_spec.rb +0 -48
  214. data/spec/unit/actions/collect_client_projects_spec.rb +0 -47
  215. data/spec/unit/actions/collect_clients_spec.rb +0 -65
  216. data/spec/unit/actions/collect_data_product_spec.rb +0 -58
  217. data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +0 -56
  218. data/spec/unit/actions/collect_meta_spec.rb +0 -88
  219. data/spec/unit/actions/collect_segment_clients_spec.rb +0 -82
  220. data/spec/unit/actions/collect_tagged_objects_spec.rb +0 -126
  221. data/spec/unit/actions/collect_users_brick_users_spec.rb +0 -36
  222. data/spec/unit/actions/create_segment_masters_spec.rb +0 -65
  223. data/spec/unit/actions/ensure_data_product_spec.rb +0 -39
  224. data/spec/unit/actions/ensure_technical_users_domain_spec.rb +0 -53
  225. data/spec/unit/actions/ensure_technical_users_project_spec.rb +0 -76
  226. data/spec/unit/actions/execute_schedules_spec.rb +0 -94
  227. data/spec/unit/actions/provision_clients_spec.rb +0 -46
  228. data/spec/unit/actions/purge_clients_spec.rb +0 -47
  229. data/spec/unit/actions/rename_existing_client_projects_spec.rb +0 -54
  230. data/spec/unit/actions/segments_filter_spec.rb +0 -46
  231. data/spec/unit/actions/shared_examples_for_user_actions.rb +0 -43
  232. data/spec/unit/actions/synchronize_cas_spec.rb +0 -58
  233. data/spec/unit/actions/synchronize_clients_spec.rb +0 -71
  234. data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +0 -206
  235. data/spec/unit/actions/synchronize_ldm_spec.rb +0 -70
  236. data/spec/unit/actions/synchronize_user_filters_spec.rb +0 -208
  237. data/spec/unit/actions/synchronize_user_groups_spec.rb +0 -49
  238. data/spec/unit/actions/synchronize_users_spec.rb +0 -180
  239. data/spec/unit/bricks/bricks_spec.rb +0 -34
  240. data/spec/unit/bricks/middleware/aws_middelware_spec.rb +0 -98
  241. data/spec/unit/bricks/middleware/bench_middleware_spec.rb +0 -15
  242. data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +0 -15
  243. data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +0 -15
  244. data/spec/unit/bricks/middleware/logger_middleware_spec.rb +0 -30
  245. data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +0 -15
  246. data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +0 -15
  247. data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +0 -15
  248. data/spec/unit/cli/cli_spec.rb +0 -17
  249. data/spec/unit/cli/commands/cmd_auth_spec.rb +0 -17
  250. data/spec/unit/core/nil_logger_spec.rb +0 -13
  251. data/spec/unit/extensions/hash_spec.rb +0 -22
  252. data/spec/unit/godzilla/goodzilla_spec.rb +0 -74
  253. data/spec/unit/helpers/check_helper_production_spec.rb +0 -34
  254. data/spec/unit/helpers/check_helper_spec.rb +0 -134
  255. data/spec/unit/helpers/csv_helper_spec.rb +0 -22
  256. data/spec/unit/helpers/data_helper_spec.rb +0 -67
  257. data/spec/unit/helpers/global_helpers_spec.rb +0 -264
  258. data/spec/unit/helpers_spec.rb +0 -254
  259. data/spec/unit/lcm/lcm2_spec.rb +0 -100
  260. data/spec/unit/lcm/user_bricks_helper_spec.rb +0 -58
  261. data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +0 -20
  262. data/spec/unit/models/blueprint/attributes_spec.rb +0 -28
  263. data/spec/unit/models/blueprint/dataset_spec.rb +0 -120
  264. data/spec/unit/models/blueprint/label_blueprint_field_spec.rb +0 -43
  265. data/spec/unit/models/blueprint/project_blueprint_spec.rb +0 -642
  266. data/spec/unit/models/blueprint/reference_spec.rb +0 -28
  267. data/spec/unit/models/blueprint/schema_builder_spec.rb +0 -36
  268. data/spec/unit/models/blueprint/to_wire_spec.rb +0 -196
  269. data/spec/unit/models/dataset_blueprint.rb +0 -14
  270. data/spec/unit/models/execution_spec.rb +0 -109
  271. data/spec/unit/models/from_wire_spec.rb +0 -321
  272. data/spec/unit/models/metadata_spec.rb +0 -140
  273. data/spec/unit/models/metric_spec.rb +0 -129
  274. data/spec/unit/models/model_spec.rb +0 -87
  275. data/spec/unit/models/project_creator_spec.rb +0 -90
  276. data/spec/unit/models/project_spec.rb +0 -94
  277. data/spec/unit/models/report_result_data_spec.rb +0 -194
  278. data/spec/unit/models/to_manifest_spec.rb +0 -165
  279. data/spec/unit/models/user_filters/user_filter_builder_spec.rb +0 -149
  280. data/spec/unit/models/user_filters_spec.rb +0 -95
  281. data/spec/unit/models/variable_spec.rb +0 -280
  282. data/spec/unit/rest/phmap_spec.rb +0 -117
  283. data/spec/unit/rest/polling_spec.rb +0 -101
  284. data/spec/unit/rest/resource_spec.rb +0 -10
  285. data/spec/vcr_configurer.rb +0 -63
@@ -1,100 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
- # This source code is licensed under the BSD-style license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- require 'gooddata/models/segment'
8
- require 'securerandom'
9
-
10
- describe GoodData::Segment do
11
- before(:all) do
12
- @client = ConnectionHelper.create_default_connection
13
- @domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
14
- end
15
-
16
- before(:each) do
17
- @uuid = SecureRandom.uuid
18
- @master_project = @client.create_project(title: "Test MASTER project for #{@uuid}", auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
19
- @segment_name = "segment-#{@uuid}"
20
- @segment = @domain.create_segment(segment_id: @segment_name, master_project: @master_project)
21
- end
22
-
23
- after(:each) do
24
- @master_project.delete if @master_project
25
- @segment && @segment.delete(force: true)
26
- end
27
-
28
- after(:all) do
29
- @client.disconnect
30
- end
31
-
32
- describe '#[]' do
33
- it 'Returns all segments when :all passed' do
34
- res = @domain.segments
35
- expect(res).to be_an_instance_of(Array)
36
- end
37
-
38
- it 'Returns specific segment when segment ID passed' do
39
- s = @domain.segments(@segment_name)
40
- expect(@segment.uri).to eq s.uri
41
- expect(s).to be_an_instance_of(GoodData::Segment)
42
- expect(@segment).to be_an_instance_of(GoodData::Segment)
43
- end
44
- end
45
-
46
- describe '#delete' do
47
- it 'Deletes particular segment' do
48
- old_count = @domain.segments.count
49
- s = @domain.segments(@segment_name)
50
- s.delete
51
- expect(@domain.segments.length).to eq(old_count - 1)
52
- # prevent delete attempt in the after hook
53
- @segment = nil
54
- end
55
- end
56
-
57
- describe '#save' do
58
- after do
59
- @different_master.delete if @different_master
60
- @different_data_product.delete if @different_data_product
61
- end
62
-
63
- it 'can update a segment master project' do
64
- @different_master = @client.create_project(title: 'Test project', auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
65
- @segment.master_project = @different_master
66
- @segment.save
67
- @segment = @domain.segments(@segment_name)
68
- expect(@segment.master_project_uri).not_to eq @master_project.uri
69
- expect(@segment.master_project_uri).to eq @different_master.uri
70
- end
71
-
72
- it 'cannot update a segment id' do
73
- @segment.segment_id = 'different_id'
74
- expect do
75
- @segment.save
76
- end.to raise_error RestClient::BadRequest
77
- end
78
- end
79
-
80
- describe '#create_client' do
81
- after do
82
- @client_project && @client_project.delete
83
- @segment_client && @segment_client.delete
84
- end
85
-
86
- it 'can create a new client in a segment' do
87
- @client_project = @client.create_project(title: 'client_1 project', auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
88
- @segment_client = @segment.create_client(id: 'tenant_1', project: @client_project)
89
- expect(@segment_client).to be_an_instance_of(GoodData::Client)
90
- expect(@segment.clients.count).to eq 1
91
- end
92
- end
93
-
94
- describe '#provision_client_projects' do
95
- it 'returns an enumerable result' do
96
- result = @segment.provision_client_projects
97
- expect(result).to be_an_instance_of(Enumerator)
98
- end
99
- end
100
- end
@@ -1,88 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
- # This source code is licensed under the BSD-style license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- require 'gooddata'
8
-
9
- describe GoodData::Subscription, :constraint => 'slow' do
10
- before(:all) do
11
- @client = ConnectionHelper.create_default_connection
12
- @channel = GoodData::ChannelConfiguration.create(client: @client)
13
- subscriptions = GoodData::Subscription.all(project: ProjectHelper::PROJECT_ID, client: @client)
14
- subscriptions.each(&:delete)
15
- end
16
-
17
- after(:all) do
18
- @channel && @channel.delete
19
- @client && @client.disconnect
20
- end
21
-
22
- it 'should be able to create a subscription' do
23
- begin
24
- subscription = GoodData::Subscription.create(
25
- client: @client,
26
- project: ProjectHelper::PROJECT_ID,
27
- channels: @channel,
28
- message: 'hello world',
29
- process: ProcessHelper::PROCESS_ID,
30
- project_events: GoodData::Subscription::PROCESS_SUCCESS_EVENT
31
- )
32
- expect(subscription.title).to eq ConnectionHelper::DEFAULT_USERNAME
33
- expect(subscription.channels).to eq [@channel.uri]
34
- expect(subscription.message).to eq 'hello world'
35
- expect(subscription.process).to eq ProcessHelper::PROCESS_ID
36
- expect(subscription.project_events).to eq [GoodData::Subscription::PROCESS_SUCCESS_EVENT]
37
- ensure
38
- subscription && subscription.delete
39
- end
40
- end
41
-
42
- it 'should be able to edit a subscription' do
43
- begin
44
- subscription = GoodData::Subscription.create(
45
- client: @client,
46
- project: ProjectHelper::PROJECT_ID,
47
- channels: @channel,
48
- process: ProcessHelper::PROCESS_ID,
49
- project_events: GoodData::Subscription::PROCESS_SUCCESS_EVENT
50
- )
51
- expect(subscription.title).to eq ConnectionHelper::DEFAULT_USERNAME
52
-
53
- subscription.title = 'My title'
54
- subscription.save
55
-
56
- expect(GoodData::Subscription[subscription.subscription_id, project: ProjectHelper::PROJECT_ID, client: @client].title).to eq 'My title'
57
- ensure
58
- subscription && subscription.delete
59
- end
60
- end
61
-
62
- it 'should be able to list all subscriptions' do
63
- begin
64
- expect(GoodData::Subscription.all(project: ProjectHelper::PROJECT_ID, client: @client)).to eq []
65
- subscription = GoodData::Subscription.create(
66
- client: @client,
67
- project: ProjectHelper::PROJECT_ID,
68
- channels: @channel,
69
- process: ProcessHelper::PROCESS_ID,
70
- project_events: GoodData::Subscription::PROCESS_SUCCESS_EVENT
71
- )
72
- expect(GoodData::Subscription.all(project: ProjectHelper::PROJECT_ID, client: @client)).to eq [subscription]
73
- ensure
74
- subscription && subscription.delete
75
- end
76
- end
77
-
78
- it 'should be able to delete a subscription' do
79
- subscription = GoodData::Subscription.create(
80
- client: @client,
81
- project: ProjectHelper::PROJECT_ID,
82
- channels: @channel,
83
- process: ProcessHelper::PROCESS_ID,
84
- project_events: GoodData::Subscription::PROCESS_SUCCESS_EVENT
85
- )
86
- subscription.delete
87
- end
88
- end
@@ -1,53 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
- # This source code is licensed under the BSD-style license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- require 'gooddata'
8
-
9
- describe "Blueprint now support urn in date dimension", :constraint => 'slow' do
10
- before(:all) do
11
- @client = ConnectionHelper.create_default_connection
12
-
13
- @blueprint = GoodData::Model::ProjectBlueprint.build("My project from blueprint") do |p|
14
- p.add_date_dimension('created_on', urn: 'urn:pe:date')
15
- end
16
- end
17
-
18
- after(:all) do
19
- @client && @client.disconnect
20
- end
21
-
22
- context 'project creates from blueprint contains urn in date dimension' do
23
- before(:all) do
24
- @project = @client.create_project_from_blueprint(@blueprint, token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
25
- end
26
-
27
- after(:all) do
28
- @project && @project.delete
29
- end
30
-
31
- it 'should have urn in date dimension' do
32
- expect(@project.datasets.find(&:date_dimension?).content['urn']).to eq 'urn:pe:date'
33
- end
34
-
35
- it 'blueprint contains urn in date dimension' do
36
- expect(@project.blueprint.date_dimensions.first.urn).to eq 'urn:pe:date'
37
- end
38
- end
39
-
40
- context 'merging blueprint' do
41
- before do
42
- @new_bp = GoodData::Model::ProjectBlueprint.build("update") do |p|
43
- p.add_date_dimension('created_on', urn: 'urn:stonegate:date')
44
- end
45
-
46
- @blueprint = @blueprint.merge(@new_bp)
47
- end
48
-
49
- it 'update urn' do
50
- expect(@blueprint.date_dimensions.first.urn).to eq 'urn:stonegate:date'
51
- end
52
- end
53
- end
@@ -1,310 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
- # This source code is licensed under the BSD-style license found in the
5
- # LICENSE file in the root directory of this source tree.
6
-
7
- require 'gooddata'
8
-
9
- describe "User filters implementation", :constraint => 'slow' do
10
- before(:all) do
11
- @spec = JSON.parse(File.read("./spec/data/blueprints/test_project_model_spec.json"), :symbolize_names => true)
12
- @client = ConnectionHelper.create_default_connection
13
- blueprint = GoodData::Model::ProjectBlueprint.new(@spec)
14
- @project = @client.create_project_from_blueprint(blueprint, :token => ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
15
- @domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
16
-
17
- @label = GoodData::Attribute.find_first_by_title('Dev', client: @client, project: @project).label_by_name('email')
18
-
19
- commits_data = [
20
- %w(lines_changed committed_on dev_id repo_id),
21
- [1, "01/01/2014", 1, 1],
22
- [3, "01/02/2014", 2, 2],
23
- [5, "05/02/2014", 3, 1],
24
- [6, "05/02/2014", 1, 2]
25
- ]
26
- @project.upload(commits_data, blueprint, 'dataset.commits')
27
-
28
- devs_data = [
29
- %w(dev_id email),
30
- [1, "tomas@gooddata.com"],
31
- [2, "petr@gooddata.com"],
32
- [3, "jirka@gooddata.com"]
33
- ]
34
- @project.upload(devs_data, blueprint, 'dataset.devs')
35
-
36
- repos_data = [
37
- %w(repo_id repo_name),
38
- [1, "goodot"],
39
- [2, "bam"],
40
- [3, "infra"]
41
- ]
42
- @project.upload(repos_data, blueprint, 'dataset.repos')
43
- end
44
-
45
- after(:all) do
46
- @project.delete if @project
47
- end
48
-
49
- after(:each) do
50
- @project.data_permissions.pmap(&:delete)
51
- end
52
-
53
- it "should create a mandatory user filter" do
54
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, 'tomas@gooddata.com', 'jirka@gooddata.com']]
55
-
56
- metric = @project.create_metric("SELECT SUM(#\"Lines Changed\")", :title => 'x')
57
- # [jirka@gooddata.com | petr@gooddata.com | tomas@gooddata.com]
58
- # [5.0 | 3.0 | 1.0 ]
59
-
60
- expect(metric.execute).to eq(15)
61
- @project.add_data_permissions(filters)
62
- expect(metric.execute).to eq(12)
63
- r = @project.compute_report(left: [metric], top: [@label.attribute])
64
- expect(r.include_column?(['tomas@gooddata.com', 7])).to be_truthy
65
- expect(r.include_column?(['jirka@gooddata.com', 5])).to be_truthy
66
- expect(r.include_column?(['petr@gooddata.com', 3])).to be_falsy
67
-
68
- # should not re-create the same MUF for the same user
69
- result = @project.add_data_permissions(filters, dry_run: true)
70
- expect(result[:created].count).to eq 0
71
- expect(result[:deleted].count).to eq 0
72
- end
73
-
74
- it "should return errors when asked to set a user not in project. Some filters are set up though." do
75
- filters = [
76
- ['nonexistent_user@gooddata.com', @label.uri, "tomas@gooddata.com"],
77
- [ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]
78
- ]
79
- expect { @project.add_data_permissions(filters) }.to raise_exception(/Creating MUFs resulted in errors/)
80
- expect(@project.data_permissions.count).to eq 2
81
- end
82
-
83
- it "should pass and set users that are in the projects" do
84
- filters = [
85
- [ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]
86
- ]
87
- @project.add_data_permissions(filters)
88
- expect(@project.data_permissions.count).to eq 1
89
- end
90
-
91
- it "should pass and set only users that are in the projects if asked" do
92
- filters = [
93
- ['nonexistent_user@gooddata.com', @label.uri, 'tomas@gooddata.com'],
94
- [ConnectionHelper::DEFAULT_USERNAME, @label.uri, 'tomas@gooddata.com']
95
- ]
96
- # note that filters will be set up even for nonexistent users but they will not be assigned
97
- expect { @project.add_data_permissions(filters, users_must_exist: false) }.to raise_exception(/Creating MUFs resulted in errors/)
98
- expect(@project.data_permissions.select(&:related_uri).count).to eq 1
99
- expect(@project.data_permissions.select(&:related_uri).first.pretty_expression).to eq "[Dev] IN ([tomas@gooddata.com])"
100
- end
101
-
102
- it "should fail when asked to set a value not in the project" do
103
- filters = [
104
- [ConnectionHelper::DEFAULT_USERNAME, @label.uri, '%^&*( nonexistent value', 'tomas@gooddata.com']
105
- ]
106
- expect do
107
- @project.add_data_permissions(filters)
108
- end.to raise_error
109
- begin
110
- @project.add_data_permissions(filters)
111
- rescue GoodData::FilterMaqlizationError => e
112
- expect(e.errors.count).to eq 1
113
- end
114
- expect(@project.data_permissions.count).to eq 0
115
- end
116
-
117
- it 'should fail but return all values if specified' do
118
- domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
119
- u = domain.users.find { |user| user.login != ConnectionHelper::DEFAULT_USERNAME }
120
- filters = [
121
- [ConnectionHelper::DEFAULT_USERNAME, @label.uri, '%^&*( nonexistent value', 'tomas@gooddata.com'],
122
- [u.login, @label.uri, '%^&*( other nonexistent value', 'jirka@gooddata.com']
123
- ]
124
- expect do
125
- @project.add_data_permissions(filters, fail_early: false)
126
- end.to raise_error
127
- begin
128
- @project.add_data_permissions(filters, fail_early: false)
129
- rescue GoodData::FilterMaqlizationError => e
130
- expect(e.errors.count).to eq 2
131
- end
132
- expect(@project.data_permissions.count).to eq 0
133
- end
134
-
135
- it 'should drop the filter when none of filter values is found' do
136
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, '%^&*( nonexistent value']]
137
- @project.add_data_permissions(filters, ignore_missing_values: true)
138
- expect(@project.data_permissions.count).to eq 0
139
- end
140
-
141
- it "should add a filter with nonexistent values when asked" do
142
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, '%^&*( nonexistent value', 'jirka@gooddata.com']]
143
- @project.add_data_permissions(filters, ignore_missing_values: true)
144
-
145
- expect(@project.data_permissions.pmap(&:pretty_expression)).to eq ["[Dev] IN ([jirka@gooddata.com])"]
146
- expect(@project.data_permissions.count).to eq 1
147
- end
148
-
149
- it "should be able to add mandatory filter to a user not in the project if domain is provided" do
150
- domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
151
- u = domain.users.find { |user| user.login != ConnectionHelper::DEFAULT_USERNAME }
152
-
153
- filters = [[u.login, @label.uri, "tomas@gooddata.com"]]
154
- @project.add_data_permissions(filters)
155
- filters = @project.data_permissions
156
- expect(filters.first.related.login).to eq u.login
157
- expect(filters.select(&:related_uri).count).to eq 1
158
- expect(filters.first.pretty_expression).to eq "[Dev] IN ([tomas@gooddata.com])"
159
- end
160
-
161
- it "should be able to print data permissions in a human readable form" do
162
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]]
163
- @project.add_data_permissions(filters)
164
- perms = @project.data_permissions
165
- pretty = perms.pmap { |f| [f.related.login, f.pretty_expression] }
166
- expect(perms.first.related).to eq @client.user
167
- expect(pretty).to eq [[ConnectionHelper::DEFAULT_USERNAME, "[Dev] IN ([tomas@gooddata.com])"]]
168
- end
169
-
170
- it 'works with filters from .get_filters' do
171
- filters = GoodData::UserFilterBuilder.get_filters(
172
- File.expand_path('../../data/user_filters.csv', __FILE__),
173
- :type => :filter,
174
- :labels => [{ :label => @label, :column => 'filter' }]
175
- )
176
- @project.add_data_permissions(filters)
177
- permissions = @project.data_permissions
178
- pretty = permissions.first.pretty_expression
179
- expect(pretty).to eq('[Dev] IN ([tomas@gooddata.com])')
180
- end
181
-
182
- it "sets up mandatory users based on the state given as an end state by default." do
183
- # first let's prepare some user filters
184
- user_with_already_set_up_filter = @project.get_user(ConnectionHelper::DEFAULT_USERNAME)
185
-
186
- filters = [
187
- [user_with_already_set_up_filter.login, @label.uri, "tomas@gooddata.com"]
188
- ]
189
- @project.add_data_permissions(filters)
190
- expect(@project.data_permissions.map { |f| [f.related.login, f.pretty_expression] })
191
- .to eq [[ConnectionHelper::DEFAULT_USERNAME, "[Dev] IN ([tomas@gooddata.com])"]]
192
-
193
- # Now let's add user filter to a different user. If we do not explicitely state that
194
- # user_with_already_set_up_filter should keep his filter it will be removed
195
- another_user = @domain.users.find { |u| u.login != ConnectionHelper::DEFAULT_USERNAME }
196
- @project.add_user(another_user, 'Admin', domain: @domain)
197
- new_filters = [
198
- [another_user.login, @label.uri, "tomas@gooddata.com"]
199
- ]
200
- @project.add_data_permissions(new_filters, users_brick_input: [{ 'login' => ConnectionHelper::DEFAULT_USERNAME }])
201
- expect(@project.data_permissions.map { |f| [f.related.login, f.pretty_expression] })
202
- .to eq [[another_user.login, "[Dev] IN ([tomas@gooddata.com])"]]
203
- end
204
-
205
- it "should set up false if all values are nonexistent" do
206
- metric = GoodData::Fact.find_first_by_title('Lines Changed', client: @client, project: @project).create_metric
207
-
208
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "NONEXISTENT1", "NONEXISTENT2", "NONEXISTENT3"]]
209
- @project.add_data_permissions(filters, ignore_missing_values: true)
210
- expect(metric.execute).to eq 15
211
- @project.add_data_permissions(filters, ignore_missing_values: true, restrict_if_missing_all_values: true)
212
- expect(metric.execute).to eq nil
213
- end
214
-
215
- it "you can switch the updates. Whatever is not mentioned will not be touched" do
216
- # first let's prepare some user filters
217
- user_with_already_set_up_filter = @project.get_user(ConnectionHelper::DEFAULT_USERNAME)
218
-
219
- filters = [
220
- [user_with_already_set_up_filter.login, @label.uri, "tomas@gooddata.com"]
221
- ]
222
- @project.add_data_permissions(filters)
223
- expect(@project.data_permissions.map { |f| [f.related.login, f.pretty_expression] })
224
- .to eq [[ConnectionHelper::DEFAULT_USERNAME, "[Dev] IN ([tomas@gooddata.com])"]]
225
-
226
- # Now let's add user filter to a different user. If we do not explicitely state that
227
- # user_with_already_set_up_filter should keep his filter it will be removed
228
- another_user = @domain.users.find { |u| u.login != ConnectionHelper::DEFAULT_USERNAME }
229
- @project.add_user(another_user, 'Admin', domain: @domain)
230
- new_filters = [
231
- [another_user.login, @label.uri, "tomas@gooddata.com"]
232
- ]
233
- @project.add_data_permissions(new_filters, do_not_touch_filters_that_are_not_mentioned: true)
234
- expect(@project.data_permissions.map { |f| [f.related.login, f.pretty_expression] })
235
- .to include([ConnectionHelper::DEFAULT_USERNAME, "[Dev] IN ([tomas@gooddata.com])"], [another_user.login, "[Dev] IN ([tomas@gooddata.com])"])
236
- end
237
-
238
- it "should be able to update the filter value", broken: true do
239
- pending 'FIXME: We cannot swap filters yet'
240
-
241
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com", "jirka@gooddata.com"]]
242
- @project.add_data_permissions(filters)
243
- perm = @project.data_permissions.first
244
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]]
245
- @project.add_data_permissions(filters)
246
- expect(perm.reload!.pretty_expression).to eq '[Dev] IN ([tomas@gooddata.com, jirka@gooddata.com])'
247
- end
248
-
249
- it 'should not create any superfluous filters if things go well' do
250
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]]
251
- @project.add_data_permissions(filters)
252
-
253
- filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]]
254
- results = @project.add_data_permissions(filters)
255
- expect(results[:results].all? { |r| r[:status] == :successful }).to be_truthy
256
- expect(results[:results].select { |r| r[:type] == :create }.count).to eq 0
257
- expect(@project.data_permissions.count).to eq 1
258
- end
259
-
260
- it "should create a mandatory user filter with double filters" do
261
- repo_label = @project.labels('some_attr_label_id')
262
- metric = @project.create_metric("SELECT SUM(#\"Lines Changed\")")
263
-
264
- # we want to compute stuff on different user than we are setting it on
265
- u = @domain.users.find { |user| user.login != ConnectionHelper::DEFAULT_USERNAME }
266
- password = 'si@gFG593fo'
267
- u.json['accountSetting']['password'] = password
268
- @domain.update_user(u)
269
- @project.add_user(u, 'admin')
270
-
271
- computation_client = GoodData.connect(u.login, password, verify_ssl: false)
272
- computation_project = computation_client.projects(@project.pid)
273
-
274
- # verify we are set up
275
- r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
276
- expect(r.column(4)).to eq ["tomas@gooddata.com", 6, 1]
277
-
278
- # lets restrict tomas to goodot only
279
- filters = [[u.login, @label.uri, 'tomas@gooddata.com'],
280
- [u.login, repo_label.uri, 'goodot']]
281
- @project.add_data_permissions(filters, users_brick_input: [{ 'login' => u.login }])
282
- expect(@project.data_permissions.pmap { |f| [f.related.login, f.pretty_expression] }).to eq [
283
- [u.login, "[Dev] IN ([tomas@gooddata.com])"],
284
- [u.login, "[Repository Name] IN ([goodot])"]
285
- ]
286
-
287
- r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
288
- expect(r.column(2)).to eq ["tomas@gooddata.com", 1]
289
-
290
- # Now lets change repo to bam
291
- filters = [[u.login, @label.uri, 'tomas@gooddata.com'],
292
- [u.login, repo_label.uri, 'bam']]
293
- @project.add_data_permissions(filters, users_brick_input: [{ 'login' => u.login }])
294
-
295
- expect(@project.data_permissions.pmap { |f| [f.related.login, f.pretty_expression] }).to eq [
296
- [u.login, "[Dev] IN ([tomas@gooddata.com])"],
297
- [u.login, "[Repository Name] IN ([bam])"]
298
- ]
299
-
300
- r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
301
- expect(r.column(2)).to eq ["tomas@gooddata.com", 6]
302
-
303
- # let's remove the repo restriction
304
- filters = [[u.login, @label.uri, 'tomas@gooddata.com']]
305
- @project.add_data_permissions(filters, users_brick_input: [{ 'login' => u.login }])
306
-
307
- r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
308
- expect(r.column(2)).to eq ["tomas@gooddata.com", 6, 1]
309
- end
310
- end