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,28 +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::Model::ReferenceBlueprintField do
|
10
|
-
before(:each) do
|
11
|
-
@model_view = MultiJson.load(File.read('./spec/data/wire_models/model_view.json'))
|
12
|
-
@blueprint = GoodData::Model::FromWire.from_wire(@model_view)
|
13
|
-
@dataset = @blueprint.datasets('dataset.opportunityanalysis')
|
14
|
-
@attribute = @dataset.attributes('attr.opportunityanalysis.month')
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#dataset' do
|
18
|
-
it 'should return labels on dataset' do
|
19
|
-
expect(@dataset.references.first.dataset.id).to eq 'dataset.opp_records'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#reference' do
|
24
|
-
it 'should return reference on dataset' do
|
25
|
-
expect(@dataset.references.first.reference).to eq 'dataset.opp_records'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,36 +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::SchemaBuilder do
|
10
|
-
it "should create a schema" do
|
11
|
-
builder = GoodData::Model::SchemaBuilder.new("a_title")
|
12
|
-
blueprint = builder.to_blueprint
|
13
|
-
expect(blueprint.datasets.first.title).to eq 'A Title'
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should create a schema with some columns" do
|
17
|
-
builder = GoodData::Model::SchemaBuilder.new("payments")
|
18
|
-
builder.add_attribute("id", :title => "My Id")
|
19
|
-
builder.add_fact("amount", :title => "Amount")
|
20
|
-
|
21
|
-
blueprint = builder.to_blueprint
|
22
|
-
expect(blueprint.attributes.count).to eq(1)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should be able to create from block" do
|
26
|
-
builder = GoodData::Model::SchemaBuilder.create("payments") do |d|
|
27
|
-
d.add_attribute('attr.id', :title => 'Id')
|
28
|
-
d.add_label('label.id.name', :title => 'Id Name', reference: 'attr.id')
|
29
|
-
d.add_fact('amount', :title => 'Amount')
|
30
|
-
end
|
31
|
-
|
32
|
-
blueprint = builder.to_blueprint
|
33
|
-
expect(blueprint.attributes.count).to eq(1)
|
34
|
-
expect(blueprint.facts.count).to eq(1)
|
35
|
-
end
|
36
|
-
end
|
@@ -1,196 +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
|
-
include GoodData::Model
|
10
|
-
|
11
|
-
describe GoodData::Model::ProjectBlueprint do
|
12
|
-
before(:each) do
|
13
|
-
@spec = JSON.parse(File.read("./spec/data/blueprints/big_blueprint_not_pruned.json"), :symbolize_names => true)
|
14
|
-
@blueprint = GoodData::Model::ProjectBlueprint.new(@spec)
|
15
|
-
@wire_spec = JSON.parse(File.read("./spec/data/wire_models/model_view.json"), :symbolize_names => true)
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '#to_wire' do
|
19
|
-
it 'should transform small spec to wire' do
|
20
|
-
spec = JSON.parse(File.read("./spec/data/blueprints/test_blueprint.json"), :symbolize_names => true)
|
21
|
-
wire_spec = JSON.parse(File.read("./spec/data/wire_models/test_blueprint.json"), :symbolize_names => true)
|
22
|
-
res = ToWire.to_wire(spec)
|
23
|
-
expect(res).to eq wire_spec
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'it should turn into wire another project' do
|
27
|
-
spec = JSON.parse(File.read("./spec/data/blueprints/test_project_model_spec.json"), :symbolize_names => true)
|
28
|
-
ToWire.to_wire(spec)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should create manifest' do
|
32
|
-
spec = JSON.parse(File.read("./spec/data/blueprints/test_blueprint.json"), :symbolize_names => true)
|
33
|
-
wire_spec = JSON.parse(File.read("./spec/data/wire_models/test_blueprint.json"), :symbolize_names => true)
|
34
|
-
JSON.parse(File.read("./spec/data/manifests/test_blueprint.json"))
|
35
|
-
expect(ToWire.to_wire(spec)).to eq wire_spec
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#anchor_to_wire' do
|
40
|
-
it 'should generate anchor without label.' do
|
41
|
-
dataset = ProjectBlueprint.find_dataset(@spec, 'dataset.stage_history')
|
42
|
-
|
43
|
-
result = ToWire.anchor_to_wire(@spec, dataset)
|
44
|
-
expect(result).to eq(
|
45
|
-
attribute: {
|
46
|
-
identifier: "attr.dataset.stage_history.factsof",
|
47
|
-
title: "Records of stage_history",
|
48
|
-
folder: "stage_history"
|
49
|
-
}
|
50
|
-
)
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should generate anchor with label' do
|
54
|
-
dataset = ProjectBlueprint.find_dataset(@spec, 'dataset.opportunityanalysis')
|
55
|
-
result = ToWire.anchor_to_wire(nil, dataset)
|
56
|
-
expect(result).to eq(
|
57
|
-
attribute: {
|
58
|
-
:identifier => "attr.opportunityanalysis.techoppanalysis",
|
59
|
-
:title => "Tech Opp. Analysis",
|
60
|
-
:folder => "Opportunity Benchmark",
|
61
|
-
:labels => [
|
62
|
-
{
|
63
|
-
:label => {
|
64
|
-
:identifier => "label.opportunityanalysis.techoppanalysis",
|
65
|
-
:title => "Tech Opp. Analysis",
|
66
|
-
:type => "GDC.text",
|
67
|
-
:dataType => "VARCHAR(128)"
|
68
|
-
}
|
69
|
-
}
|
70
|
-
],
|
71
|
-
:defaultLabel => "label.opportunityanalysis.techoppanalysis"
|
72
|
-
}
|
73
|
-
)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '#anchor_to_attribute' do
|
78
|
-
it 'should generate attribute without label' do
|
79
|
-
dataset = ProjectBlueprint.find_dataset(@spec, 'dataset.stage_history')
|
80
|
-
a = DatasetBlueprint.attributes(dataset).find { |attribute| attribute[:id] == 'attr.stage_history.currentstatus' }
|
81
|
-
result = ToWire.attribute_to_wire(dataset, a)
|
82
|
-
expect(result).to eq(
|
83
|
-
:attribute => {
|
84
|
-
:identifier => "attr.stage_history.currentstatus",
|
85
|
-
:title => "Current Stage",
|
86
|
-
:folder => "stage_history",
|
87
|
-
:labels => [
|
88
|
-
{
|
89
|
-
:label => {
|
90
|
-
:identifier => "label.stage_history.currentstatus",
|
91
|
-
:title => "Current Stage",
|
92
|
-
:type => "GDC.text",
|
93
|
-
:dataType => "VARCHAR(128)"
|
94
|
-
}
|
95
|
-
}
|
96
|
-
],
|
97
|
-
:defaultLabel => "label.stage_history.currentstatus"
|
98
|
-
}
|
99
|
-
)
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'should generate attributes with label' do
|
103
|
-
dataset = ProjectBlueprint.find_dataset(@spec, 'dataset.opportunityanalysis')
|
104
|
-
a = DatasetBlueprint.attributes(dataset).find { |attribute| attribute[:id] == 'attr.opportunityanalysis.month' }
|
105
|
-
|
106
|
-
result = ToWire.attribute_to_wire(dataset, a)
|
107
|
-
expect(result).to eq(
|
108
|
-
:attribute => {
|
109
|
-
:identifier => "attr.opportunityanalysis.month",
|
110
|
-
:title => "Month",
|
111
|
-
:folder => "Opportunity Benchmark",
|
112
|
-
:labels => [
|
113
|
-
{
|
114
|
-
:label => {
|
115
|
-
:identifier => "label.opportunityanalysis.month",
|
116
|
-
:title => "Month",
|
117
|
-
:type => "GDC.text",
|
118
|
-
:dataType => "VARCHAR(128)"
|
119
|
-
}
|
120
|
-
},
|
121
|
-
{
|
122
|
-
:label => {
|
123
|
-
:identifier => "label.opportunityanalysis.month.monthsortingnew",
|
124
|
-
:title => "MonthSortingNew",
|
125
|
-
:type => "GDC.text",
|
126
|
-
:dataType => "INT"
|
127
|
-
}
|
128
|
-
}
|
129
|
-
],
|
130
|
-
:defaultLabel => "label.opportunityanalysis.month"
|
131
|
-
}
|
132
|
-
)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe '#fact_to_wire' do
|
137
|
-
it 'should generate anchor' do
|
138
|
-
fact_def = {
|
139
|
-
type: "fact",
|
140
|
-
id: "fact.stage_history.stage_velocity",
|
141
|
-
title: "Stage Velocity",
|
142
|
-
folder: "My Folder",
|
143
|
-
description: "Velocity description",
|
144
|
-
gd_data_type: "DECIMAL(12,2)"
|
145
|
-
}
|
146
|
-
result = ToWire.fact_to_wire(nil, fact_def)
|
147
|
-
expect(result).to eq(
|
148
|
-
fact: {
|
149
|
-
type: "fact",
|
150
|
-
identifier: "fact.stage_history.stage_velocity",
|
151
|
-
title: "Stage Velocity",
|
152
|
-
dataType: "DECIMAL(12,2)",
|
153
|
-
folder: "My Folder",
|
154
|
-
description: "Velocity description"
|
155
|
-
}
|
156
|
-
)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
describe '#references_to_wire' do
|
161
|
-
it 'should produce references' do
|
162
|
-
dataset = ProjectBlueprint.find_dataset(@spec, 'dataset.opp_snapshot')
|
163
|
-
res = ToWire.references_to_wire(@spec, dataset)
|
164
|
-
expect(res).to eq [
|
165
|
-
"dataset.sdrowner",
|
166
|
-
"dataset.leadsourceoriginal",
|
167
|
-
"dataset.account",
|
168
|
-
"dataset.amounttype",
|
169
|
-
"dataset.product",
|
170
|
-
"dataset.sourcingorigin",
|
171
|
-
"dataset.leadsource",
|
172
|
-
"dataset.productline",
|
173
|
-
"dataset.stage",
|
174
|
-
"dataset.opp_owner",
|
175
|
-
"dataset.opportunity",
|
176
|
-
"dataset.bookingtype",
|
177
|
-
"dataset.forecast",
|
178
|
-
"leadcreate",
|
179
|
-
"snapshot",
|
180
|
-
"oppclose",
|
181
|
-
"oppcreated",
|
182
|
-
"stage1plus",
|
183
|
-
"mqldate",
|
184
|
-
"effectivecontractstart",
|
185
|
-
"effectivecontractend"
|
186
|
-
]
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
describe '#date_dimension_to_wire' do
|
191
|
-
it 'should be able to generate date dimension' do
|
192
|
-
res = ToWire.date_dimension_to_wire(@spec, type: "date_dimension", id: "timeline", title: "Timeline")
|
193
|
-
expect(res).to eq(:dateDimension => { :name => "timeline", :title => "Timeline" })
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
describe GoodData::Model::DatasetBlueprint do
|
2
|
-
let(:dataset) do
|
3
|
-
{ columns: [{ type: 'hll' },
|
4
|
-
{ type: 'fact' },
|
5
|
-
{ type: 'date_fact' }] }
|
6
|
-
end
|
7
|
-
subject { GoodData::Model::DatasetBlueprint }
|
8
|
-
describe '.facts' do
|
9
|
-
it 'returns facts of supported types' do
|
10
|
-
result = subject.facts(dataset)
|
11
|
-
expect(result).to eq(dataset[:columns])
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,109 +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/schedule'
|
8
|
-
|
9
|
-
describe GoodData::Execution do
|
10
|
-
before(:each) do
|
11
|
-
@data = {
|
12
|
-
"execution" => {
|
13
|
-
"startTime" => "2015-02-27T15:44:21.759Z",
|
14
|
-
"endTime" => "2015-02-27T15:47:49.383Z",
|
15
|
-
"log" => "/gdc/projects/tk3b994vmdpcb0xjwexc9moen8t5bpiw/dataload/processes/2b031451-b1a2-4039-8e36-0672542a0e60/executions/54f090d5e4b0c9cbdcb0f45b/log",
|
16
|
-
"status" => "OK",
|
17
|
-
"trigger" => "MANUAL",
|
18
|
-
"links" => {
|
19
|
-
"self" => "/gdc/projects/tk3b994vmdpcb0xjwexc9moen8t5bpiw/schedules/54f08d1de4b0c9cbdcb0f323/executions/54f090d5e4b0c9cbdcb0f45b"
|
20
|
-
},
|
21
|
-
"createdTime" => "2015-02-27T15:44:21.361Z"
|
22
|
-
}
|
23
|
-
}
|
24
|
-
@execution = GoodData::Execution.new(@data)
|
25
|
-
end
|
26
|
-
|
27
|
-
describe '#created' do
|
28
|
-
it 'returns created as a Time instance' do
|
29
|
-
expect(@execution.created.class).to eq Time
|
30
|
-
expect(@execution.created.to_s).to eq '2015-02-27 15:44:21 UTC'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#error?' do
|
35
|
-
it 'returns true if executione errored out' do
|
36
|
-
expect(@execution.error?).to be_falsey
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe '#ok?' do
|
41
|
-
it 'returns true if executione finished ok' do
|
42
|
-
expect(@execution.ok?).to be_truthy
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '#finished' do
|
47
|
-
it 'returns time when execution finished' do
|
48
|
-
expect(@execution.finished.class).to eq Time
|
49
|
-
expect(@execution.finished.to_s).to eq '2015-02-27 15:47:49 UTC'
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'returns nil if it is not finished' do
|
53
|
-
@data['execution']['status'] = 'RUNNING'
|
54
|
-
@data['execution']['endTime'] = nil
|
55
|
-
running_execution = GoodData::Execution.new(@data)
|
56
|
-
expect(running_execution.finished).to be_nil
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#schedule_uri' do
|
61
|
-
it 'returns uri of schedule that was executed' do
|
62
|
-
expect(@execution.schedule_uri).to eq '/gdc/projects/tk3b994vmdpcb0xjwexc9moen8t5bpiw/schedules/54f08d1de4b0c9cbdcb0f323'
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#running?' do
|
67
|
-
it 'returns false if executione is already finished' do
|
68
|
-
expect(@execution.running?).to be_falsey
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'returns true if executione is currently finished' do
|
72
|
-
@data['execution']['status'] = 'RUNNING'
|
73
|
-
running_execution = GoodData::Execution.new(@data)
|
74
|
-
expect(running_execution.running?).to be_truthy
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
describe '#started' do
|
79
|
-
it 'returns time when execution started' do
|
80
|
-
expect(@execution.started.class).to eq Time
|
81
|
-
expect(@execution.started.to_s).to eq '2015-02-27 15:44:21 UTC'
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
describe '#status' do
|
86
|
-
it 'returns :ok for finished execution' do
|
87
|
-
expect(@execution.status).to eq :ok
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe '#uri' do
|
92
|
-
it 'returns time when execution started' do
|
93
|
-
expect(@execution.uri).to eq '/gdc/projects/tk3b994vmdpcb0xjwexc9moen8t5bpiw/schedules/54f08d1de4b0c9cbdcb0f323/executions/54f090d5e4b0c9cbdcb0f45b'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
describe '#duration' do
|
98
|
-
it 'returns time it took to run execution' do
|
99
|
-
expect(@execution.duration).to eq 207.624
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'returns nil if it is not finished' do
|
103
|
-
@data['execution']['status'] = 'RUNNING'
|
104
|
-
@data['execution']['endTime'] = nil
|
105
|
-
running_execution = GoodData::Execution.new(@data)
|
106
|
-
expect(running_execution.duration.class).to eq Float
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
@@ -1,321 +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
|
-
include GoodData::Model
|
10
|
-
|
11
|
-
describe GoodData::Model::FromWire do
|
12
|
-
before(:each) do
|
13
|
-
@model_view = MultiJson.load(File.read('./spec/data/wire_models/model_view.json'))
|
14
|
-
@blueprint = FromWire.from_wire(@model_view)
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#parse_label' do
|
18
|
-
it "should be able to parse the attribute" do
|
19
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'][3]
|
20
|
-
a = FromWire.parse_attribute(model['dataset']['attributes'].first['attribute'])
|
21
|
-
expect(a.to_set).to eq Set.new([
|
22
|
-
{
|
23
|
-
type: :attribute,
|
24
|
-
id: "attr.opportunityanalysis.month",
|
25
|
-
title: "Month",
|
26
|
-
folder: "Opportunity Benchmark",
|
27
|
-
description: nil,
|
28
|
-
order_by: "label.opportunityanalysis.month.monthsortingnew - ASC"
|
29
|
-
},
|
30
|
-
{
|
31
|
-
type: :label,
|
32
|
-
id: "label.opportunityanalysis.month",
|
33
|
-
reference: "attr.opportunityanalysis.month",
|
34
|
-
title: "Month",
|
35
|
-
gd_data_type: "VARCHAR(128)",
|
36
|
-
gd_type: "GDC.text",
|
37
|
-
default_label: true
|
38
|
-
},
|
39
|
-
{
|
40
|
-
type: :label,
|
41
|
-
id: "label.opportunityanalysis.month.monthsortingnew",
|
42
|
-
reference: "attr.opportunityanalysis.month",
|
43
|
-
title: "MonthSortingNew",
|
44
|
-
gd_data_type: "INT",
|
45
|
-
gd_type: "GDC.text"
|
46
|
-
}
|
47
|
-
])
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should be able to parse the anchor" do
|
51
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'][3]
|
52
|
-
x = FromWire.parse_attribute(model['dataset']['anchor']['attribute'], :anchor)
|
53
|
-
expect(x.to_set).to eq Set.new([
|
54
|
-
{
|
55
|
-
type: :anchor,
|
56
|
-
id: "attr.opportunityanalysis.techoppanalysis",
|
57
|
-
title: "Tech Opp. Analysis",
|
58
|
-
folder: "Opportunity Benchmark",
|
59
|
-
description: nil
|
60
|
-
},
|
61
|
-
{
|
62
|
-
type: :label,
|
63
|
-
id: "label.opportunityanalysis.techoppanalysis",
|
64
|
-
title: "Tech Opp. Analysis",
|
65
|
-
reference: "attr.opportunityanalysis.techoppanalysis",
|
66
|
-
gd_data_type: "VARCHAR(128)",
|
67
|
-
gd_type: "GDC.text",
|
68
|
-
default_label: true
|
69
|
-
}
|
70
|
-
])
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe '#parse_attributes' do
|
75
|
-
it "should be able to parse the attributes with one label" do
|
76
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'].first
|
77
|
-
x = FromWire.parse_attributes(model)
|
78
|
-
expect(x.to_set).to eq Set.new([
|
79
|
-
{
|
80
|
-
type: :attribute,
|
81
|
-
id: "attr.stage_history.currentstatus",
|
82
|
-
title: "Current Stage",
|
83
|
-
description: nil,
|
84
|
-
folder: nil
|
85
|
-
},
|
86
|
-
{
|
87
|
-
type: :label,
|
88
|
-
id: "label.stage_history.currentstatus",
|
89
|
-
reference: "attr.stage_history.currentstatus",
|
90
|
-
title: "Current Stage",
|
91
|
-
gd_data_type: "VARCHAR(128)",
|
92
|
-
gd_type: "GDC.text",
|
93
|
-
default_label: true
|
94
|
-
}
|
95
|
-
])
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should be able to parse the attributes with several labels" do
|
99
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'][3]
|
100
|
-
x = FromWire.parse_attributes(model)
|
101
|
-
expect(x.to_set).to eq Set.new([
|
102
|
-
{
|
103
|
-
type: :attribute,
|
104
|
-
id: "attr.opportunityanalysis.month",
|
105
|
-
title: "Month",
|
106
|
-
description: nil,
|
107
|
-
folder: "Opportunity Benchmark",
|
108
|
-
order_by: "label.opportunityanalysis.month.monthsortingnew - ASC"
|
109
|
-
},
|
110
|
-
{
|
111
|
-
type: :label,
|
112
|
-
reference: "attr.opportunityanalysis.month",
|
113
|
-
id: "label.opportunityanalysis.month",
|
114
|
-
title: "Month",
|
115
|
-
gd_data_type: "VARCHAR(128)",
|
116
|
-
gd_type: "GDC.text",
|
117
|
-
default_label: true
|
118
|
-
},
|
119
|
-
{
|
120
|
-
type: :label,
|
121
|
-
id: "label.opportunityanalysis.month.monthsortingnew",
|
122
|
-
reference: "attr.opportunityanalysis.month",
|
123
|
-
title: "MonthSortingNew",
|
124
|
-
gd_data_type: "INT",
|
125
|
-
gd_type: "GDC.text"
|
126
|
-
},
|
127
|
-
{
|
128
|
-
type: :attribute,
|
129
|
-
id: "attr.opportunityanalysis.cohorttype",
|
130
|
-
title: "Cohort Type",
|
131
|
-
description: nil,
|
132
|
-
folder: "Opportunity Benchmark"
|
133
|
-
},
|
134
|
-
{
|
135
|
-
type: :label,
|
136
|
-
id: "label.opportunityanalysis.cohorttype",
|
137
|
-
reference: "attr.opportunityanalysis.cohorttype",
|
138
|
-
title: "Cohort Type",
|
139
|
-
gd_data_type: "VARCHAR(128)",
|
140
|
-
gd_type: "GDC.text",
|
141
|
-
default_label: true
|
142
|
-
}
|
143
|
-
])
|
144
|
-
end
|
145
|
-
|
146
|
-
it "should be able to parse the attributes with no labels" do
|
147
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'][7]
|
148
|
-
x = FromWire.parse_attributes(model)
|
149
|
-
expect(x.to_set).to eq Set.new
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
describe '#parse_anchor' do
|
154
|
-
it "should be able to parse the anchor without label" do
|
155
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'].first
|
156
|
-
x = FromWire.parse_anchor(model)
|
157
|
-
expect(x.to_set).to eq Set.new([
|
158
|
-
{
|
159
|
-
type: :anchor,
|
160
|
-
id: "attr.stage_history.factsof",
|
161
|
-
title: "Records of stage_history",
|
162
|
-
description: nil,
|
163
|
-
folder: nil
|
164
|
-
}
|
165
|
-
])
|
166
|
-
end
|
167
|
-
|
168
|
-
it "should be able to parse the anchor out of dataset when there are multiple labels" do
|
169
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'][7]
|
170
|
-
x = FromWire.parse_anchor(model)
|
171
|
-
expect(x.to_set).to eq Set.new([
|
172
|
-
{
|
173
|
-
type: :anchor,
|
174
|
-
id: "attr.opp_records.factsof",
|
175
|
-
title: "Records of opp_records",
|
176
|
-
description: nil,
|
177
|
-
folder: nil
|
178
|
-
},
|
179
|
-
{
|
180
|
-
type: :label,
|
181
|
-
id: "label.opp_records.opp_records_conctn_point",
|
182
|
-
reference: "attr.opp_records.factsof",
|
183
|
-
title: "opp_records_conctn_point",
|
184
|
-
gd_data_type: "VARCHAR(128)",
|
185
|
-
gd_type: "GDC.text",
|
186
|
-
default_label: true
|
187
|
-
},
|
188
|
-
{
|
189
|
-
type: :label,
|
190
|
-
id: "label.opp_records.factsof",
|
191
|
-
reference: "attr.opp_records.factsof",
|
192
|
-
title: "Records of opp_records",
|
193
|
-
gd_data_type: "VARCHAR(128)",
|
194
|
-
gd_type: "GDC.text"
|
195
|
-
}
|
196
|
-
])
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
describe '#parse_facts' do
|
201
|
-
it 'should be able to parse facts from dataset' do
|
202
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'].first
|
203
|
-
facts = GoodData::Model::FromWire.parse_facts(model)
|
204
|
-
expect(facts.to_set).to eq Set.new([
|
205
|
-
{
|
206
|
-
type: :fact,
|
207
|
-
id: "fact.stage_history.stage_velocity",
|
208
|
-
title: "Stage Velocity",
|
209
|
-
description: "Velocity description",
|
210
|
-
gd_data_type: "DECIMAL(12,2)",
|
211
|
-
folder: nil
|
212
|
-
},
|
213
|
-
{
|
214
|
-
type: :fact,
|
215
|
-
id: "fact.stage_history.stage_duration",
|
216
|
-
title: "Stage Duration",
|
217
|
-
gd_data_type: "DECIMAL(12,2)",
|
218
|
-
folder: nil
|
219
|
-
},
|
220
|
-
{
|
221
|
-
type: :date_fact,
|
222
|
-
id: "dt.stage_history.opp_created_date",
|
223
|
-
title: "Opp. Created (Date) for Stage History",
|
224
|
-
gd_data_type: "INT",
|
225
|
-
folder: nil
|
226
|
-
},
|
227
|
-
{
|
228
|
-
type: :date_fact,
|
229
|
-
id: "dt.stage_history.opp_close_date",
|
230
|
-
title: "Opp. Close (Date) for Stage History",
|
231
|
-
gd_data_type: "INT",
|
232
|
-
folder: nil
|
233
|
-
}
|
234
|
-
])
|
235
|
-
end
|
236
|
-
|
237
|
-
it 'supports hll' do
|
238
|
-
model = @model_view['projectModelView']['model']['projectModel']['datasets'].first
|
239
|
-
hll_fact = { "fact" => {
|
240
|
-
"identifier" => "hll_test",
|
241
|
-
"title" => "Test HLL Fact",
|
242
|
-
"dataType" => "HLL",
|
243
|
-
'type' => 'hll'
|
244
|
-
} }
|
245
|
-
model['dataset']['facts'] << hll_fact
|
246
|
-
expected = {
|
247
|
-
type: :hll,
|
248
|
-
id: "hll_test",
|
249
|
-
title: "Test HLL Fact",
|
250
|
-
gd_data_type: "HLL",
|
251
|
-
folder: nil
|
252
|
-
}
|
253
|
-
facts = GoodData::Model::FromWire.parse_facts(model)
|
254
|
-
expect(facts).to include(expected)
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
describe '#parse_dataset' do
|
259
|
-
it 'should be able to parse dataset' do
|
260
|
-
model_view = MultiJson.load(File.read('./spec/data/wire_models/nu_model.json'))
|
261
|
-
dataset = GoodData::Model::FromWire.dataset_from_wire(model_view['projectModelView']['model']['projectModel']['datasets'].first)
|
262
|
-
expect(dataset).to have_key(:type)
|
263
|
-
expect(dataset[:type]).to eq :dataset
|
264
|
-
expect(dataset[:id]).to eq 'dataset.bookingsactual'
|
265
|
-
expect(dataset[:columns].select { |c| c[:type] == :attribute }.count).to eq 15
|
266
|
-
expect(dataset[:columns].select { |c| c[:type] == :fact }.count).to eq 3
|
267
|
-
expect(dataset[:columns].select { |c| c[:type] == :reference }.count).to eq 6
|
268
|
-
expect(dataset[:columns].select { |c| c[:type] == :date }.count).to eq 5
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
describe '#from_wire' do
|
273
|
-
it 'should be able to parse dataset' do
|
274
|
-
model_view = MultiJson.load(File.read('./spec/data/wire_models/nu_model.json'))
|
275
|
-
GoodData::Model::FromWire.from_wire(model_view)
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
it "should parse the model view and return the blueprint" do
|
280
|
-
expect(@blueprint.datasets.count).to eq 28
|
281
|
-
end
|
282
|
-
|
283
|
-
it "should have a datatype if defined" do
|
284
|
-
dataset = @blueprint.datasets.find { |d| d.id == 'dataset.account' }
|
285
|
-
dataset.labels_for_attribute('attr.account.accountemployeecount')
|
286
|
-
|
287
|
-
dataset = @blueprint.find_dataset('dataset.stage_history')
|
288
|
-
col = dataset.find_column_by_id('fact.stage_history.stage_duration')
|
289
|
-
expect(col.gd_data_type).to eq 'DECIMAL(12,2)'
|
290
|
-
end
|
291
|
-
|
292
|
-
it "should have a datatype if defined" do
|
293
|
-
col = @blueprint.find_dataset('dataset.stage_history').labels('label.stage_history.currentstatus')
|
294
|
-
expect(col.gd_type).to eq 'GDC.text'
|
295
|
-
end
|
296
|
-
|
297
|
-
it "should validate a gd_type" do
|
298
|
-
expect(GoodData::Model.check_gd_type("GDC.time")).to eq true
|
299
|
-
expect(GoodData::Model.check_gd_type("gdc.time")).to eq false
|
300
|
-
expect(GoodData::Model.check_gd_type("gdc.time3")).to eq false
|
301
|
-
end
|
302
|
-
|
303
|
-
it "should validate a gd_datatype" do
|
304
|
-
expect(GoodData::Model.check_gd_data_type("INT")).to eq true
|
305
|
-
expect(GoodData::Model.check_gd_data_type("int")).to eq true
|
306
|
-
expect(GoodData::Model.check_gd_data_type("VARCHAR(128)")).to eq true
|
307
|
-
expect(GoodData::Model.check_gd_data_type("varchar(128)")).to eq true
|
308
|
-
expect(GoodData::Model.check_gd_data_type("DECIMAL(10, 5)")).to eq true
|
309
|
-
expect(GoodData::Model.check_gd_data_type("DECIMAL(10,5)")).to eq true
|
310
|
-
expect(GoodData::Model.check_gd_data_type("DECIMAL(10, 5)")).to eq true
|
311
|
-
expect(GoodData::Model.check_gd_data_type("decimal(10, 5)")).to eq true
|
312
|
-
expect(GoodData::Model.check_gd_data_type("decimal(10,5)")).to eq true
|
313
|
-
expect(GoodData::Model.check_gd_data_type("decimal(10, 5)")).to eq true
|
314
|
-
end
|
315
|
-
|
316
|
-
it "should be able to parse description from both attributes and facts" do
|
317
|
-
expect(@blueprint.find_dataset('dataset.opportunity').anchor.description).to eq 'This is opportunity attribute description'
|
318
|
-
expect(@blueprint.find_dataset('dataset.stage_history').facts.find { |f| f.id == 'fact.stage_history.stage_velocity' }.description).to eq 'Velocity description'
|
319
|
-
expect(@blueprint.find_dataset('dataset.opp_owner').attributes.find { |f| f.id == 'attr.opp_owner.region' }.description).to eq 'Owner Region description'
|
320
|
-
end
|
321
|
-
end
|