gooddata 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +0 -0
- data/.flayignore +2 -0
- data/.travis.yml +24 -7
- data/.yardopts +0 -0
- data/CHANGELOG.md +125 -1
- data/CLI.md +0 -0
- data/Dockerfile.jruby +7 -2
- data/Dockerfile.ruby +1 -1
- data/Gemfile +0 -0
- data/Guardfile +0 -0
- data/Rakefile +23 -9
- data/TODO.md +0 -0
- data/bin/gitflow-init.sh +8 -0
- data/ci.rake +3 -3
- data/data/2008.crt +39 -0
- data/data/new_ca.cer +22 -0
- data/dependency_decisions.yml +0 -0
- data/docker-compose.lcm.yml +31 -0
- data/docker-compose.yml +4 -2
- data/gooddata.gemspec +3 -3
- data/lcm.rake +288 -0
- data/lib/gooddata.rb +1 -0
- data/lib/gooddata/bricks/base_downloader.rb +1 -1
- data/lib/gooddata/bricks/brick.rb +0 -1
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +1 -1
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
- data/lib/gooddata/bricks/pipeline.rb +67 -0
- data/lib/gooddata/bricks/provisioning_brick.rb +18 -0
- data/lib/gooddata/bricks/release_brick.rb +18 -0
- data/lib/gooddata/bricks/rollout_brick.rb +14 -0
- data/lib/gooddata/bricks/user_filters_brick.rb +13 -0
- data/lib/gooddata/bricks/users_brick.rb +13 -0
- data/lib/gooddata/core/logging.rb +1 -1
- data/lib/gooddata/exceptions/maql_execution.rb +1 -1
- data/lib/gooddata/extensions/string.rb +0 -0
- data/lib/gooddata/lcm/actions/associate_clients.rb +34 -8
- data/lib/gooddata/lcm/actions/collect_data_product.rb +8 -1
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +13 -23
- data/lib/gooddata/lcm/actions/collect_segments.rb +10 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +3 -1
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +61 -34
- data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +6 -4
- data/lib/gooddata/lcm/actions/update_release_table.rb +4 -12
- data/lib/gooddata/lcm/dsl/params_dsl.rb +0 -4
- data/lib/gooddata/lcm/dsl/type_dsl.rb +0 -4
- data/lib/gooddata/lcm/helpers/check_helper.rb +1 -1
- data/lib/gooddata/lcm/lcm2.rb +0 -2
- data/lib/gooddata/lcm/types/special/enum.rb +6 -0
- data/lib/gooddata/lcm/types/special/enum/synchronize_ldm.rb +20 -0
- data/lib/gooddata/lcm/types/special/types.rb +1 -1
- data/lib/gooddata/mixins/is_folder.rb +0 -0
- data/lib/gooddata/mixins/to_json.rb +0 -0
- data/lib/gooddata/mixins/uri_getter.rb +0 -0
- data/lib/gooddata/models/project_creator.rb +38 -30
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -0
- data/lib/gooddata/rest/README.md +0 -0
- data/lib/gooddata/version.rb +1 -1
- data/lib/templates/bricks/brick.rb.erb +0 -0
- data/lib/templates/bricks/main.rb.erb +0 -0
- data/lib/templates/project/Goodfile.erb +0 -0
- data/lib/templates/project/data/commits.csv +0 -0
- data/lib/templates/project/data/devs.csv +0 -0
- data/lib/templates/project/data/repos.csv +0 -0
- data/lib/templates/project/model/model.rb.erb +0 -0
- metadata +21 -451
- data/lib/gooddata/lcm/actions/ensure_data_product.rb +0 -63
- data/spec/.rubocop.yml +0 -16
- data/spec/bricks/bricks_spec.rb +0 -110
- data/spec/bricks/default-config.json +0 -8
- data/spec/data/.gooddata +0 -4
- data/spec/data/blueprints/additional_dataset_module.json +0 -32
- data/spec/data/blueprints/attribute_sort_order_blueprint.json +0 -72
- data/spec/data/blueprints/big_blueprint_not_pruned.json +0 -2079
- data/spec/data/blueprints/invalid_blueprint.json +0 -103
- data/spec/data/blueprints/m_n_model.json +0 -104
- data/spec/data/blueprints/model_module.json +0 -25
- data/spec/data/blueprints/test_blueprint.json +0 -39
- data/spec/data/blueprints/test_project_model_spec.json +0 -106
- data/spec/data/cc/data/source/commits.csv +0 -4
- data/spec/data/cc/data/source/devs.csv +0 -4
- data/spec/data/cc/data/source/repos.csv +0 -3
- data/spec/data/cc/devel.prm +0 -0
- data/spec/data/cc/graph/graph.grf +0 -11
- data/spec/data/cc/workspace.prm +0 -19
- data/spec/data/column_based_permissions.csv +0 -7
- data/spec/data/column_based_permissions2.csv +0 -6
- data/spec/data/dynamic_schedule_params_table.csv +0 -7
- data/spec/data/gd_gse_data_blueprint.json +0 -1371
- data/spec/data/gd_gse_data_manifest.json +0 -1424
- data/spec/data/gd_gse_data_model.json +0 -1772
- data/spec/data/gooddata_version_process/gooddata_version.rb +0 -9
- data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
- data/spec/data/hello_world_process/hello_world.rb +0 -9
- data/spec/data/hello_world_process/hello_world.zip +0 -0
- data/spec/data/integration_model.json +0 -252
- data/spec/data/integration_policies.csv +0 -9134
- data/spec/data/line_based_permissions.csv +0 -3
- data/spec/data/manifests/test_blueprint.json +0 -32
- data/spec/data/manifests/test_project.json +0 -107
- data/spec/data/reports/left_attr_report.json +0 -108
- data/spec/data/reports/metric_only_one_line.json +0 -83
- data/spec/data/reports/report_1.json +0 -197
- data/spec/data/reports/top_attr_report.json +0 -108
- data/spec/data/ruby_params_process/ruby_params.rb +0 -9
- data/spec/data/ruby_process/deep_files/deep_stuff.txt +0 -1
- data/spec/data/ruby_process/process.rb +0 -8
- data/spec/data/ruby_process/stuff.txt +0 -1
- data/spec/data/superfluous_titles_view.json +0 -81
- data/spec/data/test-ci-data.csv +0 -2
- data/spec/data/user_filters.csv +0 -2
- data/spec/data/users.csv +0 -12
- data/spec/data/wire_models/attribute_sort_by_model.json +0 -73
- data/spec/data/wire_models/model_view.json +0 -1775
- data/spec/data/wire_models/nu_model.json +0 -3046
- data/spec/data/wire_models/test_blueprint.json +0 -66
- data/spec/data/wire_test_project.json +0 -150
- data/spec/data/workspace_table.csv +0 -3
- data/spec/environment/default.rb +0 -43
- data/spec/environment/development.rb +0 -32
- data/spec/environment/environment.rb +0 -38
- data/spec/environment/production.rb +0 -27
- data/spec/environment/staging.rb +0 -32
- data/spec/environment/testing.rb +0 -32
- data/spec/helpers/appstore_project_helper.rb +0 -221
- data/spec/helpers/blueprint_helper.rb +0 -27
- data/spec/helpers/cli_helper.rb +0 -38
- data/spec/helpers/connection_helper.rb +0 -43
- data/spec/helpers/constants.rb +0 -32
- data/spec/helpers/crypto_helper.rb +0 -19
- data/spec/helpers/csv_helper.rb +0 -20
- data/spec/helpers/process_helper.rb +0 -35
- data/spec/helpers/project_helper.rb +0 -74
- data/spec/helpers/schedule_helper.rb +0 -33
- data/spec/helpers/spec_helper.rb +0 -17
- data/spec/integration/ads_output_stage_spec.rb +0 -45
- data/spec/integration/blueprint_updates_spec.rb +0 -107
- data/spec/integration/blueprint_with_ca_spec.rb +0 -56
- data/spec/integration/blueprint_with_grain_spec.rb +0 -74
- data/spec/integration/channel_configuration_spec.rb +0 -67
- data/spec/integration/clients_spec.rb +0 -164
- data/spec/integration/command_datawarehouse_spec.rb +0 -45
- data/spec/integration/command_projects_spec.rb +0 -32
- data/spec/integration/commands/command_projects_spec.rb +0 -22
- data/spec/integration/connection_spec.rb +0 -37
- data/spec/integration/core/connection_spec.rb +0 -56
- data/spec/integration/core/logging_spec.rb +0 -132
- data/spec/integration/core/project_spec.rb +0 -54
- data/spec/integration/create_from_template_spec.rb +0 -29
- data/spec/integration/create_project_spec.rb +0 -27
- data/spec/integration/date_dim_switch_spec.rb +0 -154
- data/spec/integration/deprecated_load_spec.rb +0 -60
- data/spec/integration/full_process_schedule_spec.rb +0 -367
- data/spec/integration/full_project_spec.rb +0 -592
- data/spec/integration/helpers_spec.rb +0 -16
- data/spec/integration/lcm_spec.rb +0 -54
- data/spec/integration/mandatory_user_filter_spec.rb +0 -53
- data/spec/integration/mixins/id_to_uri_spec.rb +0 -56
- data/spec/integration/models/data_product_spec.rb +0 -71
- data/spec/integration/models/domain_spec.rb +0 -162
- data/spec/integration/models/invitation_spec.rb +0 -17
- data/spec/integration/models/label_spec.rb +0 -49
- data/spec/integration/models/membership_spec.rb +0 -127
- data/spec/integration/models/metadata/report_spec.rb +0 -54
- data/spec/integration/models/metric_spec.rb +0 -24
- data/spec/integration/models/params_spec.rb +0 -118
- data/spec/integration/models/process_spec.rb +0 -35
- data/spec/integration/models/profile_spec.rb +0 -210
- data/spec/integration/models/project_role_spec.rb +0 -94
- data/spec/integration/models/project_spec.rb +0 -225
- data/spec/integration/models/schedule_spec.rb +0 -477
- data/spec/integration/models/unit_project_spec.rb +0 -130
- data/spec/integration/over_to_user_filters_spec.rb +0 -98
- data/spec/integration/partial_md_export_import_spec.rb +0 -41
- data/spec/integration/project_spec.rb +0 -381
- data/spec/integration/rest_spec.rb +0 -214
- data/spec/integration/schedule_spec.rb +0 -611
- data/spec/integration/segments_spec.rb +0 -100
- data/spec/integration/subscription_spec.rb +0 -88
- data/spec/integration/urn_date_dim_spec.rb +0 -53
- data/spec/integration/user_filters_spec.rb +0 -310
- data/spec/integration/user_group_spec.rb +0 -147
- data/spec/integration/variables_spec.rb +0 -189
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/can_assign_a_custom_logger.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/client_logs_when_given_custom_message.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/has_the_request_id_logged_when_I_passed_it.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_off/Disables_logging.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_on/Enables_logging.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project/Returns_project_assigned.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_nil.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_directly.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_ID.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_URL.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_with_project/Uses_project_specified.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_Metric/all.yml +0 -2065
- data/spec/integration/vcr_cassettes/GoodData_Metric/should_be_able_to_update_folders.yml +0 -119
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/all.yml +0 -9812
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_get_json_containing_correct_id.yml +0 -174
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_return_nil_for_unknown_id.yml +0 -58
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_throw_BadRequest_for_-1.yml +0 -63
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_connect/Connects_using_username_and_password.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_disconnect/Connects_using_username_and_password.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_generate_request_id/Generates_a_non-empty_string.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_/Should_list_user_groups_as_Array.yml +0 -56
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_add_members/Should_add_member.yml +0 -315
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_members/Should_return_members_as_array.yml +0 -54
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_remove_members/Should_remove_existing_members.yml +0 -258
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_save/updates_existing_group.yml +0 -159
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_set_members/Should_set_new_members.yml +0 -158
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/all.yml +0 -809
- data/spec/logging_in_logging_out_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -110
- data/spec/unit/actions/associate_clients_spec.rb +0 -48
- data/spec/unit/actions/collect_client_projects_spec.rb +0 -47
- data/spec/unit/actions/collect_clients_spec.rb +0 -65
- data/spec/unit/actions/collect_data_product_spec.rb +0 -58
- data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +0 -56
- data/spec/unit/actions/collect_meta_spec.rb +0 -88
- data/spec/unit/actions/collect_segment_clients_spec.rb +0 -82
- data/spec/unit/actions/collect_tagged_objects_spec.rb +0 -126
- data/spec/unit/actions/collect_users_brick_users_spec.rb +0 -36
- data/spec/unit/actions/create_segment_masters_spec.rb +0 -65
- data/spec/unit/actions/ensure_data_product_spec.rb +0 -39
- data/spec/unit/actions/ensure_technical_users_domain_spec.rb +0 -53
- data/spec/unit/actions/ensure_technical_users_project_spec.rb +0 -76
- data/spec/unit/actions/execute_schedules_spec.rb +0 -94
- data/spec/unit/actions/provision_clients_spec.rb +0 -46
- data/spec/unit/actions/purge_clients_spec.rb +0 -47
- data/spec/unit/actions/rename_existing_client_projects_spec.rb +0 -54
- data/spec/unit/actions/segments_filter_spec.rb +0 -46
- data/spec/unit/actions/shared_examples_for_user_actions.rb +0 -43
- data/spec/unit/actions/synchronize_cas_spec.rb +0 -58
- data/spec/unit/actions/synchronize_clients_spec.rb +0 -71
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +0 -206
- data/spec/unit/actions/synchronize_ldm_spec.rb +0 -70
- data/spec/unit/actions/synchronize_user_filters_spec.rb +0 -208
- data/spec/unit/actions/synchronize_user_groups_spec.rb +0 -49
- data/spec/unit/actions/synchronize_users_spec.rb +0 -180
- data/spec/unit/bricks/bricks_spec.rb +0 -34
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +0 -98
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +0 -30
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +0 -15
- data/spec/unit/cli/cli_spec.rb +0 -17
- data/spec/unit/cli/commands/cmd_auth_spec.rb +0 -17
- data/spec/unit/core/nil_logger_spec.rb +0 -13
- data/spec/unit/extensions/hash_spec.rb +0 -22
- data/spec/unit/godzilla/goodzilla_spec.rb +0 -74
- data/spec/unit/helpers/check_helper_production_spec.rb +0 -34
- data/spec/unit/helpers/check_helper_spec.rb +0 -134
- data/spec/unit/helpers/csv_helper_spec.rb +0 -22
- data/spec/unit/helpers/data_helper_spec.rb +0 -67
- data/spec/unit/helpers/global_helpers_spec.rb +0 -264
- data/spec/unit/helpers_spec.rb +0 -254
- data/spec/unit/lcm/lcm2_spec.rb +0 -100
- data/spec/unit/lcm/user_bricks_helper_spec.rb +0 -58
- data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +0 -20
- data/spec/unit/models/blueprint/attributes_spec.rb +0 -28
- data/spec/unit/models/blueprint/dataset_spec.rb +0 -120
- data/spec/unit/models/blueprint/label_blueprint_field_spec.rb +0 -43
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +0 -642
- data/spec/unit/models/blueprint/reference_spec.rb +0 -28
- data/spec/unit/models/blueprint/schema_builder_spec.rb +0 -36
- data/spec/unit/models/blueprint/to_wire_spec.rb +0 -196
- data/spec/unit/models/dataset_blueprint.rb +0 -14
- data/spec/unit/models/execution_spec.rb +0 -109
- data/spec/unit/models/from_wire_spec.rb +0 -321
- data/spec/unit/models/metadata_spec.rb +0 -140
- data/spec/unit/models/metric_spec.rb +0 -129
- data/spec/unit/models/model_spec.rb +0 -87
- data/spec/unit/models/project_creator_spec.rb +0 -90
- data/spec/unit/models/project_spec.rb +0 -94
- data/spec/unit/models/report_result_data_spec.rb +0 -194
- data/spec/unit/models/to_manifest_spec.rb +0 -165
- data/spec/unit/models/user_filters/user_filter_builder_spec.rb +0 -149
- data/spec/unit/models/user_filters_spec.rb +0 -95
- data/spec/unit/models/variable_spec.rb +0 -280
- data/spec/unit/rest/phmap_spec.rb +0 -117
- data/spec/unit/rest/polling_spec.rb +0 -101
- data/spec/unit/rest/resource_spec.rb +0 -10
- data/spec/vcr_configurer.rb +0 -63
@@ -1,140 +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
|
-
RAW_DATA = {
|
10
|
-
'metric' => {
|
11
|
-
'content' => {
|
12
|
-
'format' => '#,##0',
|
13
|
-
'expression' => 'SELECT SUM([/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/700])'
|
14
|
-
},
|
15
|
-
'meta' => {
|
16
|
-
'author' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
17
|
-
'uri' => '/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/70',
|
18
|
-
'tags' => 'a a b cg r t',
|
19
|
-
'created' => '2014-04-30 22:47:57',
|
20
|
-
'identifier' => 'afo7bx1VakCz',
|
21
|
-
'deprecated' => '0',
|
22
|
-
'summary' => '',
|
23
|
-
'title' => 'sum of Lines changed',
|
24
|
-
'category' => 'metric',
|
25
|
-
'updated' => '2014-05-05 20:00:42',
|
26
|
-
'contributor' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248'
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
describe GoodData::MdObject do
|
32
|
-
before(:each) do
|
33
|
-
@instance = GoodData::MdObject.new(GoodData::Helpers.deep_dup(RAW_DATA))
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '#identifier=' do
|
37
|
-
it 'Allows setting a new identifier' do
|
38
|
-
identifier = @instance.identifier
|
39
|
-
@instance.identifier = 'new_id'
|
40
|
-
new_identifier = @instance.identifier
|
41
|
-
|
42
|
-
expect(new_identifier).to_not eq identifier
|
43
|
-
expect(new_identifier).to eq 'new_id'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe '#tag_list' do
|
48
|
-
it 'returns tags as list' do
|
49
|
-
expect(@instance.tag_set).to eq %w(a b cg r t).to_set
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe '#add_tag' do
|
54
|
-
it 'adds tag' do
|
55
|
-
expect(@instance.add_tag('xx').tag_set).to eq %w(a b cg r t xx).to_set
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe '#remove_tag' do
|
60
|
-
it 'returns tags as list' do
|
61
|
-
expect(@instance.remove_tag('t').tag_set).to eq %w(a b cg r).to_set
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe '#deprecated' do
|
66
|
-
it 'returns true/false' do
|
67
|
-
expect(@instance.deprecated).to be_falsey
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe '#deprecated=' do
|
72
|
-
it 'sets deprecated flag' do
|
73
|
-
expect(@instance.deprecated).to be_falsey
|
74
|
-
@instance.deprecated = true
|
75
|
-
expect(@instance.deprecated).to be_truthy
|
76
|
-
@instance.deprecated = false
|
77
|
-
expect(@instance.deprecated).to be_falsey
|
78
|
-
@instance.deprecated = 0
|
79
|
-
expect(@instance.deprecated).to be_falsey
|
80
|
-
@instance.deprecated = 1
|
81
|
-
expect(@instance.deprecated).to be_truthy
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe '#unlisted' do
|
86
|
-
it 'returns true/false' do
|
87
|
-
expect(@instance.unlisted).to be_falsey
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '#unlisted?' do
|
92
|
-
it 'returns true/false' do
|
93
|
-
expect(@instance.unlisted?).to be_falsey
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe '#unlisted=' do
|
98
|
-
it 'sets unlisted flag' do
|
99
|
-
expect(@instance.unlisted).to be_falsey
|
100
|
-
@instance.unlisted = true
|
101
|
-
expect(@instance.unlisted?).to be_truthy
|
102
|
-
@instance.unlisted = false
|
103
|
-
expect(@instance.unlisted?).to be_falsey
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe '#find_by_tag' do
|
108
|
-
let(:tagged_metadata) { double('tagged_metadata') }
|
109
|
-
|
110
|
-
before do
|
111
|
-
allow(GoodData).to receive(:get_client_and_project)
|
112
|
-
allow(tagged_metadata).to receive(:tag_set).and_return(['tag1'])
|
113
|
-
allow(GoodData::MdObject).to receive(:[]).and_return([tagged_metadata])
|
114
|
-
end
|
115
|
-
|
116
|
-
context 'when the specified tag is present' do
|
117
|
-
it 'finds metadata by a single tag' do
|
118
|
-
result = GoodData::MdObject.find_by_tag('tag1')
|
119
|
-
expect(result).to eq [tagged_metadata]
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'finds metadata by a comma-separated list of tags' do
|
123
|
-
result = GoodData::MdObject.find_by_tag('tag1, tag2')
|
124
|
-
expect(result).to eq [tagged_metadata]
|
125
|
-
end
|
126
|
-
|
127
|
-
it 'finds metadata by a an array of tags' do
|
128
|
-
result = GoodData::MdObject.find_by_tag(%w(tag1 tag2))
|
129
|
-
expect(result).to eq [tagged_metadata]
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
context 'when the specified tag is not present' do
|
134
|
-
it 'returns an empty array' do
|
135
|
-
result = GoodData::MdObject.find_by_tag('unknown_tag')
|
136
|
-
expect(result).to be_empty
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
@@ -1,129 +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/metadata/metric'
|
8
|
-
|
9
|
-
describe GoodData::Metric do
|
10
|
-
RAW_DATA2 = {
|
11
|
-
'metric' => {
|
12
|
-
'content' => {
|
13
|
-
'format' => '#,##0',
|
14
|
-
'expression' => 'SELECT SUM([/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/700])'
|
15
|
-
},
|
16
|
-
'meta' => {
|
17
|
-
'author' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
18
|
-
'uri' => '/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/70',
|
19
|
-
'tags' => 'a b cg r t',
|
20
|
-
'created' => '2014-04-30 22:47:57',
|
21
|
-
'identifier' => 'afo7bx1VakCz',
|
22
|
-
'deprecated' => '0',
|
23
|
-
'summary' => '',
|
24
|
-
'locked' => 0,
|
25
|
-
'title' => 'sum of Lines changed',
|
26
|
-
'category' => 'metric',
|
27
|
-
'updated' => '2014-05-05 20:00:42',
|
28
|
-
'contributor' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248'
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
RAW_DATA3 = {
|
34
|
-
'metric' => {
|
35
|
-
'content' => {
|
36
|
-
'format' => '#,##0',
|
37
|
-
'expression' => 'SELECT SUM([/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/710])'
|
38
|
-
},
|
39
|
-
'meta' => {
|
40
|
-
'author' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
41
|
-
'uri' => '/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/71',
|
42
|
-
'tags' => 'a b cg r t',
|
43
|
-
'created' => '2014-04-30 22:47:57',
|
44
|
-
'identifier' => 'afo7bx1VakCz',
|
45
|
-
'deprecated' => '0',
|
46
|
-
'summary' => '',
|
47
|
-
'locked' => 1,
|
48
|
-
'title' => 'sum of Lines changed',
|
49
|
-
'category' => 'metric',
|
50
|
-
'updated' => '2014-05-05 20:00:42',
|
51
|
-
'contributor' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248'
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
USED_METRIC = GoodData::Metric.new(RAW_DATA2)
|
57
|
-
UNUSED_METRIC = GoodData::Metric.new(RAW_DATA3)
|
58
|
-
|
59
|
-
RAW_DATA = {
|
60
|
-
'metric' => {
|
61
|
-
'content' => {
|
62
|
-
'format' => '#,##0',
|
63
|
-
'expression' => "SELECT SUM([#{USED_METRIC.uri}])"
|
64
|
-
},
|
65
|
-
'meta' => {
|
66
|
-
'author' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
67
|
-
'uri' => '/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/252',
|
68
|
-
'tags' => 'a b cg r t',
|
69
|
-
'created' => '2014-04-30 22:47:57',
|
70
|
-
'identifier' => 'afo7bx1VakCz',
|
71
|
-
'deprecated' => '0',
|
72
|
-
'summary' => '',
|
73
|
-
'locked' => 0,
|
74
|
-
'title' => 'sum of Lines changed',
|
75
|
-
'category' => 'metric',
|
76
|
-
'updated' => '2014-05-05 20:00:42',
|
77
|
-
'contributor' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248'
|
78
|
-
}
|
79
|
-
}
|
80
|
-
}
|
81
|
-
|
82
|
-
before(:each) do
|
83
|
-
@instance = GoodData::Metric.new(RAW_DATA)
|
84
|
-
end
|
85
|
-
|
86
|
-
describe '#contain?' do
|
87
|
-
it 'should say it contains a depending metric if it does' do
|
88
|
-
expect(@instance.contain?(USED_METRIC)).to eq true
|
89
|
-
end
|
90
|
-
|
91
|
-
it 'should say it contains a depending object which is given as a string if it does' do
|
92
|
-
expect(@instance.contain?(USED_METRIC)).to eq true
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should be able to return an expression of the metric' do
|
96
|
-
expect(@instance.expression).to eq "SELECT SUM([#{USED_METRIC.uri}])"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe "#locked?" do
|
101
|
-
it "should be able to say if an object is locked" do
|
102
|
-
expect(@instance.locked?).to eq false
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "#unlocked?" do
|
107
|
-
it "should be able to say if an object is unlocked" do
|
108
|
-
expect(@instance.unlocked?).to eq true
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe "#lock" do
|
113
|
-
it "should be able to lock an object" do
|
114
|
-
expect(@instance.locked?).to eq false
|
115
|
-
@instance.lock
|
116
|
-
expect(@instance.locked?).to eq true
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe "#lock" do
|
121
|
-
it "should be able to unlock an object" do
|
122
|
-
@instance.lock
|
123
|
-
expect(@instance.locked?).to eq true
|
124
|
-
@instance.unlock
|
125
|
-
expect(@instance.locked?).to eq false
|
126
|
-
expect(@instance.unlocked?).to eq true
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
@@ -1,87 +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/model'
|
8
|
-
|
9
|
-
describe GoodData::Model do
|
10
|
-
before(:each) do
|
11
|
-
@base_blueprint = GoodData::Model::ProjectBlueprint.from_json("./spec/data/blueprints/test_project_model_spec.json")
|
12
|
-
@additional_blueprint = GoodData::Model::ProjectBlueprint.from_json("./spec/data/blueprints/model_module.json")
|
13
|
-
|
14
|
-
@blueprint_with_duplicate = GoodData::Model::ProjectBlueprint.new(
|
15
|
-
title: "x",
|
16
|
-
datasets: [{
|
17
|
-
id: "dataset.commits",
|
18
|
-
type: :dataset,
|
19
|
-
columns: [
|
20
|
-
{
|
21
|
-
type: "fact",
|
22
|
-
id: "fact.lines_changed",
|
23
|
-
gd_data_type: 'INT',
|
24
|
-
description: "Fact description"
|
25
|
-
}
|
26
|
-
]
|
27
|
-
}]
|
28
|
-
)
|
29
|
-
|
30
|
-
@conflicting_blueprint = GoodData::Model::ProjectBlueprint.new(
|
31
|
-
title: 'x',
|
32
|
-
datasets: [{
|
33
|
-
type: :dataset,
|
34
|
-
id: 'dataset.commits',
|
35
|
-
columns: [
|
36
|
-
{
|
37
|
-
type: 'fact',
|
38
|
-
id: 'fact.commits.lines_changed'
|
39
|
-
}
|
40
|
-
]
|
41
|
-
}]
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should be possible to merge Schema blueprints" do
|
46
|
-
first_dataset = @base_blueprint.find_dataset("dataset.devs").to_hash
|
47
|
-
additional_blueprint = @additional_blueprint.find_dataset("dataset.devs").to_hash
|
48
|
-
stuff = GoodData::Model.merge_dataset_columns(first_dataset, additional_blueprint)
|
49
|
-
expect(GoodData::Model::ProjectBlueprint.new(stuff)).to be_valid
|
50
|
-
|
51
|
-
expect(stuff[:columns].include?(:type => :attribute, :id => "attr.region")).to be_truthy
|
52
|
-
expect(stuff[:columns].include?(:type => :anchor, :id => "attr.devs.dev_id", title: 'Dev', :folder => "Anchor folder")).to be_truthy
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should pass when merging 2 columns with the same name if both columns are identical" do
|
56
|
-
first_dataset = @base_blueprint.find_dataset("dataset.commits").to_hash
|
57
|
-
additional_blueprint = @blueprint_with_duplicate.find_dataset("dataset.commits").to_hash
|
58
|
-
stuff = GoodData::Model.merge_dataset_columns(first_dataset, additional_blueprint)
|
59
|
-
|
60
|
-
expect(GoodData::Model::ProjectBlueprint.new(stuff)).to be_valid
|
61
|
-
|
62
|
-
expect(stuff[:columns].count).to eq 6
|
63
|
-
expect(stuff[:columns].include?(type: :fact, id: "fact.lines_changed", gd_data_type: 'INT', description: "Fact description")).to be_truthy
|
64
|
-
expect(stuff[:columns].group_by { |col| col[:id] }["fact.lines_changed"].count).to eq 1
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should fail when merging" do
|
68
|
-
first_dataset = @base_blueprint.find_dataset("dataset.commits").to_hash
|
69
|
-
additional_blueprint = @conflicting_blueprint.find_dataset("dataset.commits").to_hash
|
70
|
-
expect { GoodData::Model.merge_dataset_columns(first_dataset, additional_blueprint) }.to raise_error
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should be possible to merge directly whole bleuprints. Blueprint is changed in place when merge! is used" do
|
74
|
-
@base_blueprint.merge!(@additional_blueprint)
|
75
|
-
@base_blueprint.find_dataset("dataset.repos").attributes.include?(type: "attribute", id: "some_attr_id", :title => "Repository Name")
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '.check_gd_data_type' do
|
79
|
-
let(:hll_types) { %w(HLL hll hLl) }
|
80
|
-
it 'supports HLL type' do
|
81
|
-
hll_types.each do |type|
|
82
|
-
actual = subject.check_gd_data_type(type)
|
83
|
-
expect(actual).to be(true)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,90 +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/project_creator'
|
8
|
-
|
9
|
-
describe GoodData::Model::ProjectCreator do
|
10
|
-
before(:each) do
|
11
|
-
# Priority is
|
12
|
-
#
|
13
|
-
# [cascadeDrops, preserveData],
|
14
|
-
# [false, true],
|
15
|
-
# [false, false],
|
16
|
-
# [true, true],
|
17
|
-
# [true, false]
|
18
|
-
#
|
19
|
-
# The data is ordered in descending priority
|
20
|
-
@chunk_a = {
|
21
|
-
'updateScript' => {
|
22
|
-
'cascadeDrops' => false,
|
23
|
-
'preserveData' => true,
|
24
|
-
'maqlDdlChunks' => 'a'
|
25
|
-
}
|
26
|
-
}
|
27
|
-
|
28
|
-
@chunk_b = {
|
29
|
-
'updateScript' => {
|
30
|
-
'cascadeDrops' => false,
|
31
|
-
'preserveData' => false,
|
32
|
-
'maqlDdlChunks' => 'b'
|
33
|
-
}
|
34
|
-
}
|
35
|
-
@chunk_c = {
|
36
|
-
'updateScript' => {
|
37
|
-
'cascadeDrops' => true,
|
38
|
-
'preserveData' => true,
|
39
|
-
'maqlDdlChunks' => 'c'
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
@chunk_d = {
|
44
|
-
'updateScript' => {
|
45
|
-
'cascadeDrops' => true,
|
46
|
-
'preserveData' => false,
|
47
|
-
'maqlDdlChunks' => 'd'
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
@data = [@chunk_a, @chunk_b, @chunk_c, @chunk_d]
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'should pick correct update chunk based on priority' do
|
55
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data)
|
56
|
-
expect(chunk).to eq [@chunk_a]
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'should pick correct update chunk based on your preference if it is possible to satisfy it' do
|
60
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false })
|
61
|
-
expect(chunk).to eq [@chunk_d]
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should pick correct update chunks based on your preference if it is possible to satisfy it and the preference is ambiguous' do
|
65
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true })
|
66
|
-
expect(chunk).to eq [@chunk_c, @chunk_d]
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'should not pick a chunk if it is not possible to satisfy it based on your preference' do
|
70
|
-
expect do
|
71
|
-
GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false, unmeetable_condition: true })
|
72
|
-
end.to raise_error
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'should pick correct update chunks based on new parameter "allow_cascade_drops" in your preference' do
|
76
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { allow_cascade_drops: false })
|
77
|
-
expect(chunk).to eq [@chunk_a]
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'should pick correct update chunks based on new parameter "keep_data" in your preference' do
|
81
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { keep_data: false })
|
82
|
-
expect(chunk).to eq [@chunk_a, @chunk_b]
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'should raise error when mixing new parameters with the old ones in your preference' do
|
86
|
-
expect do
|
87
|
-
GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { allow_cascade_drops: true, cascade_drops: false })
|
88
|
-
end.to raise_error('Please do not mix old parameters (:cascade_drops, :preserve_data) with the new ones (:allow_cascade_drops, :keep_data).')
|
89
|
-
end
|
90
|
-
end
|
@@ -1,94 +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
|
-
shared_examples 'a blueprint provider' do
|
8
|
-
it 'requests model view with includeCA=true' do
|
9
|
-
expect(client).to receive(:get).with(
|
10
|
-
'/gdc/projects/foo/model/view',
|
11
|
-
hash_including(params: hash_including(includeCA: true))
|
12
|
-
)
|
13
|
-
subject.blueprint(include_ca: true)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe GoodData::Project do
|
18
|
-
subject { GoodData::Project }
|
19
|
-
let(:from_project) { double('from_project') }
|
20
|
-
let(:to_project) { double('to_project') }
|
21
|
-
let(:process) { double('process') }
|
22
|
-
let(:add) { double('add') }
|
23
|
-
let(:output_stage) { double('output_stage') }
|
24
|
-
let(:client) { double('client') }
|
25
|
-
let(:connection) { double('connection') }
|
26
|
-
let(:server) { double('server') }
|
27
|
-
|
28
|
-
before do
|
29
|
-
allow(from_project).to receive(:processes).and_return([process])
|
30
|
-
allow(to_project).to receive(:processes).and_return([])
|
31
|
-
allow(process).to receive(:type).and_return(:dataload)
|
32
|
-
allow(to_project).to receive(:add).and_return(add)
|
33
|
-
allow(to_project).to receive(:client).and_return(client)
|
34
|
-
allow(client).to receive(:connection).and_return(connection)
|
35
|
-
allow(connection).to receive(:server).and_return(server)
|
36
|
-
allow(from_project).to receive(:add).and_return(add)
|
37
|
-
allow(from_project).to receive(:client).and_return(client)
|
38
|
-
allow(add).to receive(:output_stage).and_return(output_stage)
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '.transfer_output_stage' do
|
42
|
-
context 'when source and target domains are different' do
|
43
|
-
before do
|
44
|
-
allow(server).to receive(:url).and_return('foo', 'bar')
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'raises an error' do
|
48
|
-
expect { subject.transfer_output_stage(from_project, to_project, {}) }
|
49
|
-
.to raise_error(/Cannot transfer output stage from foo to bar/)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
describe '#blueprint' do
|
55
|
-
let(:project_data) do
|
56
|
-
{
|
57
|
-
'project' => {
|
58
|
-
'links' => { 'self' => '/gdc/foo' },
|
59
|
-
'meta' => { 'title' => 'My Project' }
|
60
|
-
}
|
61
|
-
}
|
62
|
-
end
|
63
|
-
let(:diff_result) do
|
64
|
-
{ 'asyncTask' => { 'link' => { 'poll' => 'poll_me' } } }
|
65
|
-
end
|
66
|
-
let(:blueprint) { double(GoodData::Model::ProjectBlueprint) }
|
67
|
-
subject { GoodData::Project.new(project_data) }
|
68
|
-
before do
|
69
|
-
allow(client).to receive(:get).and_return(diff_result)
|
70
|
-
allow(client).to receive(:poll_on_code)
|
71
|
-
allow(GoodData::Model::FromWire).to receive(:from_wire) .and_return(blueprint)
|
72
|
-
allow(blueprint).to receive(:title=)
|
73
|
-
subject.client = client
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'when include_ca option is true' do
|
77
|
-
it_behaves_like 'a blueprint provider'
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'when include_ca option is not specified' do
|
81
|
-
it_behaves_like 'a blueprint provider'
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'when include_ca option is false' do
|
85
|
-
it 'requests model view with includeCA=false' do
|
86
|
-
expect(client).to receive(:get).with(
|
87
|
-
'/gdc/projects/foo/model/view',
|
88
|
-
hash_including(params: hash_including(includeCA: false))
|
89
|
-
)
|
90
|
-
subject.blueprint(include_ca: false)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|