gooddata 1.0.0 → 1.0.1
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/.editorconfig +0 -0
- data/.flayignore +1 -0
- data/.rubocop.yml +2 -0
- data/.yardopts +0 -0
- data/CHANGELOG.md +9 -0
- data/CLI.md +0 -0
- data/Gemfile +0 -0
- data/Guardfile +0 -0
- data/LICENSE +0 -0
- data/LICENSE.rb +0 -0
- data/TODO.md +0 -0
- data/dependency_decisions.yml +0 -0
- data/gooddata.gemspec +1 -0
- data/lib/gooddata/app/app.rb +0 -0
- data/lib/gooddata/bricks/brick.rb +0 -0
- data/lib/gooddata/bricks/bricks.rb +0 -0
- data/lib/gooddata/bricks/middleware/base_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/bench_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/decode_params_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/fs_download_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/stdout_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +0 -0
- data/lib/gooddata/bricks/middleware/undot_params_middleware.rb +0 -0
- data/lib/gooddata/bricks/pipeline.rb +0 -0
- data/lib/gooddata/bricks/utils.rb +0 -0
- data/lib/gooddata/cli/cli.rb +0 -0
- data/lib/gooddata/cli/commands/auth_cmd.rb +0 -0
- data/lib/gooddata/cli/commands/domain_cmd.rb +0 -0
- data/lib/gooddata/cli/commands/project_cmd.rb +0 -0
- data/lib/gooddata/cli/hooks.rb +0 -0
- data/lib/gooddata/cli/shared.rb +0 -0
- data/lib/gooddata/cli/terminal.rb +0 -0
- data/lib/gooddata/commands/api.rb +0 -0
- data/lib/gooddata/commands/auth.rb +0 -0
- data/lib/gooddata/commands/base.rb +0 -0
- data/lib/gooddata/commands/commands.rb +0 -0
- data/lib/gooddata/commands/datasets.rb +0 -0
- data/lib/gooddata/commands/datawarehouse.rb +0 -0
- data/lib/gooddata/commands/domain.rb +0 -0
- data/lib/gooddata/commands/process.rb +0 -0
- data/lib/gooddata/commands/project.rb +0 -0
- data/lib/gooddata/commands/projects.rb +0 -0
- data/lib/gooddata/commands/role.rb +0 -0
- data/lib/gooddata/commands/runners.rb +0 -0
- data/lib/gooddata/commands/scaffold.rb +0 -0
- data/lib/gooddata/commands/user.rb +0 -0
- data/lib/gooddata/connection.rb +0 -0
- data/lib/gooddata/core/core.rb +0 -0
- data/lib/gooddata/core/logging.rb +0 -0
- data/lib/gooddata/core/nil_logger.rb +0 -0
- data/lib/gooddata/core/project.rb +0 -0
- data/lib/gooddata/core/rest.rb +0 -0
- data/lib/gooddata/core/user.rb +0 -0
- data/lib/gooddata/data/data.rb +0 -0
- data/lib/gooddata/data/guesser.rb +0 -0
- data/lib/gooddata/exceptions/attr_element_not_found.rb +0 -0
- data/lib/gooddata/exceptions/command_failed.rb +0 -0
- data/lib/gooddata/exceptions/exceptions.rb +0 -0
- data/lib/gooddata/exceptions/execution_limit_exceeded.rb +0 -0
- data/lib/gooddata/exceptions/export_clone.rb +0 -0
- data/lib/gooddata/exceptions/filter_maqlization.rb +0 -0
- data/lib/gooddata/exceptions/import_clone.rb +0 -0
- data/lib/gooddata/exceptions/malformed_user.rb +0 -0
- data/lib/gooddata/exceptions/maql_execution.rb +0 -0
- data/lib/gooddata/exceptions/object_migration.rb +0 -0
- data/lib/gooddata/exceptions/project_not_found.rb +0 -0
- data/lib/gooddata/exceptions/segment_not_empty.rb +0 -0
- data/lib/gooddata/exceptions/uncomputable_report.rb +0 -0
- data/lib/gooddata/exceptions/user_in_different_domain.rb +0 -0
- data/lib/gooddata/exceptions/validation_error.rb +0 -0
- data/lib/gooddata/extensions/big_decimal.rb +0 -0
- data/lib/gooddata/extensions/class.rb +0 -0
- data/lib/gooddata/extensions/extensions.rb +0 -0
- data/lib/gooddata/extensions/false.rb +0 -0
- data/lib/gooddata/extensions/hash.rb +0 -0
- data/lib/gooddata/extensions/integer.rb +0 -0
- data/lib/gooddata/extensions/nil.rb +0 -0
- data/lib/gooddata/extensions/numeric.rb +0 -0
- data/lib/gooddata/extensions/object.rb +0 -0
- data/lib/gooddata/extensions/string.rb +0 -0
- data/lib/gooddata/extensions/symbol.rb +0 -0
- data/lib/gooddata/extensions/true.rb +0 -0
- data/lib/gooddata/extract.rb +0 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +0 -0
- data/lib/gooddata/helpers/auth_helpers.rb +0 -0
- data/lib/gooddata/helpers/csv_helper.rb +0 -0
- data/lib/gooddata/helpers/erb_helper.rb +0 -0
- data/lib/gooddata/helpers/global_helpers.rb +0 -0
- data/lib/gooddata/helpers/helpers.rb +0 -0
- data/lib/gooddata/lcm/actions/actions.rb +0 -0
- data/lib/gooddata/lcm/actions/base_action.rb +0 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +8 -6
- data/lib/gooddata/lcm/data/create_lcm_release.sql.erb +0 -0
- data/lib/gooddata/lcm/data/insert_into_lcm_release.sql.erb +0 -0
- data/lib/gooddata/lcm/data/select_from_lcm_release.sql.erb +0 -0
- data/lib/gooddata/lcm/data/update_lcm_release.sql.erb +0 -0
- data/lib/gooddata/lcm/dsl/dsl.rb +0 -0
- data/lib/gooddata/lcm/dsl/params_dsl.rb +0 -0
- data/lib/gooddata/lcm/helpers/helpers.rb +0 -0
- data/lib/gooddata/lcm/lcm2.rb +4 -6
- data/lib/gooddata/lcm/types/base_type.rb +0 -0
- data/lib/gooddata/lcm/types/class/ads_client.rb +0 -0
- data/lib/gooddata/lcm/types/class/class.rb +0 -0
- data/lib/gooddata/lcm/types/class/gd_client.rb +0 -0
- data/lib/gooddata/lcm/types/class/types.rb +0 -0
- data/lib/gooddata/lcm/types/complex/complex.rb +0 -0
- data/lib/gooddata/lcm/types/complex/release_query.rb +0 -0
- data/lib/gooddata/lcm/types/complex/tokens.rb +0 -0
- data/lib/gooddata/lcm/types/complex/types.rb +0 -0
- data/lib/gooddata/lcm/types/param.rb +0 -0
- data/lib/gooddata/lcm/types/scalar/bool.rb +0 -0
- data/lib/gooddata/lcm/types/scalar/hash.rb +0 -0
- data/lib/gooddata/lcm/types/scalar/integer.rb +0 -0
- data/lib/gooddata/lcm/types/scalar/object.rb +0 -0
- data/lib/gooddata/lcm/types/scalar/string.rb +0 -0
- data/lib/gooddata/lcm/types/scalar/types.rb +0 -0
- data/lib/gooddata/lcm/types/special/types.rb +0 -0
- data/lib/gooddata/lcm/types/types.rb +0 -0
- data/lib/gooddata/mixins/author.rb +0 -0
- data/lib/gooddata/mixins/content_getter.rb +0 -0
- data/lib/gooddata/mixins/content_property_reader.rb +0 -0
- data/lib/gooddata/mixins/content_property_writer.rb +0 -0
- data/lib/gooddata/mixins/contributor.rb +0 -0
- data/lib/gooddata/mixins/data_getter.rb +0 -0
- data/lib/gooddata/mixins/data_property_reader.rb +0 -0
- data/lib/gooddata/mixins/data_property_writer.rb +0 -0
- data/lib/gooddata/mixins/inspector.rb +0 -0
- data/lib/gooddata/mixins/is_attribute.rb +0 -0
- data/lib/gooddata/mixins/is_dimension.rb +0 -0
- data/lib/gooddata/mixins/is_fact.rb +0 -0
- data/lib/gooddata/mixins/is_folder.rb +0 -0
- data/lib/gooddata/mixins/is_label.rb +0 -0
- data/lib/gooddata/mixins/links.rb +0 -0
- data/lib/gooddata/mixins/md_grantees.rb +0 -0
- data/lib/gooddata/mixins/md_lock.rb +0 -0
- data/lib/gooddata/mixins/md_object_id.rb +0 -0
- data/lib/gooddata/mixins/md_relations.rb +0 -0
- data/lib/gooddata/mixins/meta_getter.rb +0 -0
- data/lib/gooddata/mixins/meta_property_reader.rb +0 -0
- data/lib/gooddata/mixins/meta_property_writer.rb +0 -0
- data/lib/gooddata/mixins/mixins.rb +0 -0
- data/lib/gooddata/mixins/not_attribute.rb +0 -0
- data/lib/gooddata/mixins/not_exportable.rb +0 -0
- data/lib/gooddata/mixins/not_fact.rb +0 -0
- data/lib/gooddata/mixins/not_group.rb +0 -0
- data/lib/gooddata/mixins/not_label.rb +0 -0
- data/lib/gooddata/mixins/not_metric.rb +0 -0
- data/lib/gooddata/mixins/obj_id.rb +0 -0
- data/lib/gooddata/mixins/rest_getters.rb +0 -0
- data/lib/gooddata/mixins/rest_resource.rb +0 -0
- data/lib/gooddata/mixins/root_key_getter.rb +0 -0
- data/lib/gooddata/mixins/root_key_setter.rb +0 -0
- data/lib/gooddata/mixins/timestamps.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/ads_output_stage.rb +0 -0
- data/lib/gooddata/models/automated_data_distribution.rb +0 -0
- data/lib/gooddata/models/blueprint/anchor_field.rb +0 -0
- data/lib/gooddata/models/blueprint/attribute_field.rb +0 -0
- data/lib/gooddata/models/blueprint/blueprint.rb +0 -0
- data/lib/gooddata/models/blueprint/blueprint_field.rb +0 -0
- data/lib/gooddata/models/blueprint/dashboard_builder.rb +0 -0
- data/lib/gooddata/models/blueprint/dataset_blueprint.rb +0 -0
- data/lib/gooddata/models/blueprint/fact_field.rb +0 -0
- data/lib/gooddata/models/blueprint/label_field.rb +0 -0
- data/lib/gooddata/models/blueprint/reference_field.rb +0 -0
- data/lib/gooddata/models/blueprint/schema_blueprint.rb +0 -0
- data/lib/gooddata/models/blueprint/schema_builder.rb +0 -0
- data/lib/gooddata/models/blueprint/to_manifest.rb +0 -0
- data/lib/gooddata/models/channel_configuration.rb +0 -0
- data/lib/gooddata/models/client_synchronization_result.rb +0 -0
- data/lib/gooddata/models/client_synchronization_result_details.rb +0 -0
- data/lib/gooddata/models/datawarehouse.rb +0 -0
- data/lib/gooddata/models/execution.rb +0 -0
- data/lib/gooddata/models/execution_detail.rb +0 -0
- data/lib/gooddata/models/invitation.rb +0 -0
- data/lib/gooddata/models/links.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/dashboard_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/filter_apply_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/filter_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/geo_chart_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/headline_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/iframe_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/report_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard/text_item.rb +0 -0
- data/lib/gooddata/models/metadata/dashboard_tab.rb +0 -0
- data/lib/gooddata/models/metadata/label.rb +43 -23
- data/lib/gooddata/models/metadata/metadata.rb +0 -0
- data/lib/gooddata/models/metadata/scheduled_mail/dashboard_attachment.rb +0 -0
- data/lib/gooddata/models/metadata/scheduled_mail/report_attachment.rb +0 -0
- data/lib/gooddata/models/models.rb +0 -0
- data/lib/gooddata/models/module_constants.rb +0 -0
- data/lib/gooddata/models/notification_rule.rb +0 -0
- data/lib/gooddata/models/project_log_formatter.rb +0 -0
- data/lib/gooddata/models/project_metadata.rb +0 -0
- data/lib/gooddata/models/tab_builder.rb +0 -0
- data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +0 -0
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +2 -1
- data/lib/gooddata/models/user_filters/user_filters.rb +0 -0
- data/lib/gooddata/rest/README.md +0 -0
- data/lib/gooddata/rest/connection.rb +2 -70
- data/lib/gooddata/rest/object.rb +0 -0
- data/lib/gooddata/rest/phmap.rb +81 -0
- data/lib/gooddata/rest/resource.rb +0 -0
- data/lib/gooddata/rest/rest.rb +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
- data/spec/.rubocop.yml +0 -0
- data/spec/bricks/bricks_spec.rb +0 -0
- data/spec/bricks/default-config.json +0 -0
- data/spec/data/.gooddata +0 -0
- data/spec/data/blueprints/additional_dataset_module.json +0 -0
- data/spec/data/blueprints/attribute_sort_order_blueprint.json +0 -0
- data/spec/data/blueprints/big_blueprint_not_pruned.json +0 -0
- data/spec/data/blueprints/m_n_model.json +0 -0
- data/spec/data/blueprints/model_module.json +0 -0
- data/spec/data/cc/data/source/commits.csv +0 -0
- data/spec/data/cc/data/source/devs.csv +0 -0
- data/spec/data/cc/data/source/repos.csv +0 -0
- data/spec/data/cc/devel.prm +0 -0
- data/spec/data/cc/graph/graph.grf +0 -0
- data/spec/data/cc/workspace.prm +0 -0
- data/spec/data/column_based_permissions.csv +0 -0
- data/spec/data/column_based_permissions2.csv +0 -0
- data/spec/data/gd_gse_data_blueprint.json +0 -0
- data/spec/data/gd_gse_data_manifest.json +0 -0
- data/spec/data/gd_gse_data_model.json +0 -0
- data/spec/data/gooddata_version_process/gooddata_version.rb +0 -0
- data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
- data/spec/data/hello_world_process/hello_world.rb +0 -0
- data/spec/data/hello_world_process/hello_world.zip +0 -0
- data/spec/data/integration_model.json +252 -0
- data/spec/data/integration_policies.csv +9134 -0
- data/spec/data/line_based_permissions.csv +0 -0
- data/spec/data/manifests/test_blueprint.json +0 -0
- data/spec/data/manifests/test_project.json +0 -0
- data/spec/data/reports/left_attr_report.json +0 -0
- data/spec/data/reports/metric_only_one_line.json +0 -0
- data/spec/data/reports/report_1.json +0 -0
- data/spec/data/reports/top_attr_report.json +0 -0
- data/spec/data/ruby_params_process/ruby_params.rb +0 -0
- data/spec/data/ruby_process/deep_files/deep_stuff.txt +0 -0
- data/spec/data/ruby_process/process.rb +0 -0
- data/spec/data/ruby_process/stuff.txt +0 -0
- data/spec/data/superfluous_titles_view.json +0 -0
- data/spec/data/test-ci-data.csv +0 -0
- data/spec/data/users.csv +0 -0
- data/spec/data/wire_models/attribute_sort_by_model.json +0 -0
- data/spec/data/wire_models/model_view.json +0 -0
- data/spec/data/wire_models/nu_model.json +0 -0
- data/spec/data/wire_test_project.json +0 -0
- data/spec/environment/default.rb +0 -0
- data/spec/environment/environment.rb +0 -0
- data/spec/environment/production.rb +0 -0
- data/spec/helpers/appstore_project_helper.rb +221 -0
- data/spec/helpers/blueprint_helper.rb +0 -0
- data/spec/helpers/cli_helper.rb +0 -0
- data/spec/helpers/connection_helper.rb +0 -0
- data/spec/helpers/constants.rb +32 -0
- data/spec/helpers/crypto_helper.rb +0 -0
- data/spec/helpers/csv_helper.rb +0 -0
- data/spec/helpers/spec_helper.rb +0 -0
- data/spec/integration/blueprint_updates_spec.rb +0 -0
- data/spec/integration/blueprint_with_grain_spec.rb +0 -0
- data/spec/integration/channel_configuration_spec.rb +0 -0
- data/spec/integration/command_projects_spec.rb +0 -0
- data/spec/integration/create_project_spec.rb +0 -0
- data/spec/integration/date_dim_switch_spec.rb +6 -2
- data/spec/integration/deprecated_load_spec.rb +0 -0
- data/spec/integration/models/label_spec.rb +40 -0
- data/spec/integration/over_to_user_filters_spec.rb +0 -0
- data/spec/integration/partial_md_export_import_spec.rb +0 -0
- data/spec/integration/rest_spec.rb +0 -0
- data/spec/integration/schedule_spec.rb +0 -0
- data/spec/integration/user_group_spec.rb +0 -0
- data/spec/logging_in_logging_out_spec.rb +0 -0
- data/spec/unit/actions/synchronize_clients_spec.rb +71 -0
- data/spec/unit/bricks/bricks_spec.rb +0 -0
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +0 -0
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +0 -0
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +0 -0
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +0 -0
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +0 -0
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +0 -0
- data/spec/unit/cli/cli_spec.rb +0 -0
- data/spec/unit/cli/commands/cmd_auth_spec.rb +0 -0
- data/spec/unit/core/nil_logger_spec.rb +0 -0
- data/spec/unit/extensions/hash_spec.rb +0 -0
- data/spec/unit/godzilla/goodzilla_spec.rb +0 -0
- data/spec/unit/helpers/csv_helper_spec.rb +0 -0
- data/spec/unit/lcm/lcm2_spec.rb +36 -0
- data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +0 -0
- data/spec/unit/models/blueprint/attributes_spec.rb +0 -0
- data/spec/unit/models/blueprint/dataset_spec.rb +0 -0
- data/spec/unit/models/blueprint/{labels_spec.rb → label_blueprint_field_spec.rb} +7 -7
- data/spec/unit/models/blueprint/reference_spec.rb +0 -0
- data/spec/unit/models/blueprint/schema_builder_spec.rb +0 -0
- data/spec/unit/models/blueprint/to_wire_spec.rb +0 -0
- data/spec/unit/models/execution_spec.rb +0 -0
- data/spec/unit/models/from_wire_spec.rb +0 -0
- data/spec/unit/models/metric_spec.rb +0 -0
- data/spec/unit/models/model_spec.rb +0 -0
- data/spec/unit/models/report_result_data_spec.rb +0 -0
- data/spec/unit/models/user_filters/user_filter_builder_spec.rb +5 -4
- data/spec/unit/models/user_filters_spec.rb +0 -0
- data/spec/unit/models/variable_spec.rb +0 -0
- data/spec/unit/rest/resource_spec.rb +0 -0
- metadata +20 -5
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/data/test-ci-data.csv
CHANGED
File without changes
|
data/spec/data/users.csv
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/environment/default.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,221 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2018 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
|
+
|
8
|
+
# this is a duplicate of the appstore project helper - we should delete it when we merge repositories
|
9
|
+
|
10
|
+
require 'gooddata'
|
11
|
+
require 'json'
|
12
|
+
require_relative 'constants'
|
13
|
+
|
14
|
+
module GoodData
|
15
|
+
module Helpers
|
16
|
+
# Creates a testing project and loads it with data
|
17
|
+
class AppstoreProjectHelper
|
18
|
+
attr_reader :project, :client
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def create(opts = { client: GoodData.connection })
|
22
|
+
new_project = opts[:client].create_project(opts)
|
23
|
+
AppstoreProjectHelper.new(new_project, opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
def suffix
|
27
|
+
hostname = Socket.gethostname
|
28
|
+
timestamp = DateTime.now.strftime('%Y%m%d%H%M%S')
|
29
|
+
suffix = "#{hostname}_#{timestamp}"
|
30
|
+
segment_name_forbidden_chars = /[^a-zA-Z0-9_\\-]+/
|
31
|
+
suffix.scan(segment_name_forbidden_chars).each do |forbidden_characters|
|
32
|
+
suffix.gsub!(forbidden_characters, '_')
|
33
|
+
end
|
34
|
+
suffix
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(project, opts = { client: GoodData.connection })
|
39
|
+
@client = opts[:client]
|
40
|
+
@project = project if project.instance_of? GoodData::Project
|
41
|
+
@project = client.projects(project) if project.instance_of? String
|
42
|
+
GoodData.logger.info "Project ID: #{@project.obj_id}"
|
43
|
+
raise 'ProjectHelper::initialize the parameter "project" '\
|
44
|
+
'must be GoodData::Project or String.' unless @project
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_ldm
|
48
|
+
json = File.read('./spec/data/integration_model.json')
|
49
|
+
blueprint = GoodData::Model::ProjectBlueprint.from_json(json)
|
50
|
+
project.update_from_blueprint(blueprint)
|
51
|
+
end
|
52
|
+
|
53
|
+
def load_data
|
54
|
+
GoodData.with_project @project.pid do |project|
|
55
|
+
GoodData::Model.upload_data(
|
56
|
+
'./spec/data/integration_policies.csv',
|
57
|
+
project.blueprint,
|
58
|
+
DATASET_IDENTIFIER
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def add_user_group
|
64
|
+
@project.add_user_group(:name => USER_GROUP_NAME, :description => 'My Test Description')
|
65
|
+
end
|
66
|
+
|
67
|
+
def associate_output_stage(ads, opts = {})
|
68
|
+
@project.create_output_stage(
|
69
|
+
ads,
|
70
|
+
project: @project,
|
71
|
+
client: client,
|
72
|
+
client_id: opts[:client_id],
|
73
|
+
output_stage_prefix: opts[:output_stage_prefix]
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
def deploy_processes(ads)
|
78
|
+
GoodData.with_project @project.pid do |project|
|
79
|
+
cc_process = project.deploy_process(
|
80
|
+
CC_PROCESS_ARCHIVE,
|
81
|
+
name: CC_PROCESS_NAME
|
82
|
+
)
|
83
|
+
cc_schedule = cc_process.create_schedule(
|
84
|
+
CC_SCHEDULE_CRON,
|
85
|
+
CC_GRAPH,
|
86
|
+
params: CC_PARAMS,
|
87
|
+
hidden_params: CC_SECURE_PARAMS,
|
88
|
+
state: 'DISABLED'
|
89
|
+
)
|
90
|
+
ruby_process = project.deploy_process(
|
91
|
+
RUBY_HELLO_WORLD_PROCESS_PATH,
|
92
|
+
name: RUBY_HELLO_WORLD_PROCESS_NAME
|
93
|
+
)
|
94
|
+
ruby_schedule = ruby_process.create_schedule(
|
95
|
+
cc_schedule,
|
96
|
+
'main.rb',
|
97
|
+
params: RUBY_PARAMS,
|
98
|
+
hidden_params: RUBY_SECURE_PARAMS,
|
99
|
+
state: 'DISABLED'
|
100
|
+
)
|
101
|
+
|
102
|
+
associate_output_stage ads
|
103
|
+
add_process = project.add.process
|
104
|
+
add_process.create_schedule(
|
105
|
+
ruby_schedule,
|
106
|
+
'',
|
107
|
+
dataload_datasets: [ DATASET_IDENTIFIER ],
|
108
|
+
de_synchronize_all: true,
|
109
|
+
state: 'DISABLED'
|
110
|
+
)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def create_metrics
|
115
|
+
GoodData.with_project @project.pid do |project|
|
116
|
+
metrics = JSON.parse(File.read(METRICS_FILE)).to_hash
|
117
|
+
metrics.each do |title, maql|
|
118
|
+
metric = project.add_measure maql, title: title
|
119
|
+
metric.identifier = "metric.#{title.to_s.downcase.gsub(/\s/, '.')}"
|
120
|
+
metric.add_tag('metric') if metric.identifier == PRODUCTION_TAGGED_METRIC
|
121
|
+
metric.save
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def create_computed_attributes
|
127
|
+
update = GoodData::Model::ProjectBlueprint.build('update') do |project_builder|
|
128
|
+
project_builder.add_computed_attribute(
|
129
|
+
COMPUTED_ATTRIBUTE_ID,
|
130
|
+
title: 'My computed attribute',
|
131
|
+
metric: 'metric.customers.count',
|
132
|
+
attribute: 'attr.csv_policies.state',
|
133
|
+
buckets: [{ label: 'Small', highest_value: 1000 }, { label: 'Medium', highest_value: 2000 }, { label: 'Large' }]
|
134
|
+
)
|
135
|
+
end
|
136
|
+
new_blueprint = project.blueprint.merge(update)
|
137
|
+
unless new_blueprint.valid?
|
138
|
+
pp new_blueprint.validate
|
139
|
+
raise 'Cannot create computed attribute'
|
140
|
+
end
|
141
|
+
project.update_from_blueprint(new_blueprint)
|
142
|
+
|
143
|
+
project.attributes(COMPUTED_ATTRIBUTE_ID).drill_down(project.attributes('attr.csv_policies.customer'))
|
144
|
+
end
|
145
|
+
|
146
|
+
def create_reports
|
147
|
+
GoodData.with_project @project.pid do |p|
|
148
|
+
reports = JSON.parse(File.read(REPORTS_FILE)).to_hash['reports']
|
149
|
+
reports.each do |r|
|
150
|
+
report = p.add_report(
|
151
|
+
title: r['title'],
|
152
|
+
left: r['left'].map { |o| GoodData::MdObject[o] },
|
153
|
+
top: r['top'].map { |o| GoodData::MdObject[o] }
|
154
|
+
)
|
155
|
+
report_name = r['title'].to_s.downcase.gsub(/\s/, '.')
|
156
|
+
report.identifier = "report.#{report_name}"
|
157
|
+
report.save
|
158
|
+
end
|
159
|
+
|
160
|
+
ca_report_title = 'Report contains CA'
|
161
|
+
report = p.add_report(title: ca_report_title, left: GoodData::MdObject[COMPUTED_ATTRIBUTE_ID])
|
162
|
+
report_name = ca_report_title.downcase.gsub(/\s/, '.')
|
163
|
+
report.identifier = "report.#{report_name}"
|
164
|
+
report.save
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def create_dashboards
|
169
|
+
GoodData.with_project @project.pid do
|
170
|
+
dashboards = JSON.parse(File.read(DASHBOARDS_FILE)).to_hash['dashboards']
|
171
|
+
dashboards.each do |d|
|
172
|
+
dashboard = GoodData::Dashboard.create(
|
173
|
+
{ title: d['title'] },
|
174
|
+
client: client, project: @project
|
175
|
+
)
|
176
|
+
d['tabs'].each do |t|
|
177
|
+
tab = dashboard.add_tab(title: t['title'])
|
178
|
+
t['items'].each do |i|
|
179
|
+
tab.add_report_item(report: GoodData::Report[i['identifier']],
|
180
|
+
position_x: i['position']['x'],
|
181
|
+
position_y: i['position']['y'],
|
182
|
+
size_x: i['size']['width'],
|
183
|
+
size_y: i['size']['height'])
|
184
|
+
end
|
185
|
+
|
186
|
+
tab.add_report_item(report: GoodData::Report['report.report.contains.ca'],
|
187
|
+
position_x: 0,
|
188
|
+
position_y: 0,
|
189
|
+
size_x: 640,
|
190
|
+
size_y:100)
|
191
|
+
end
|
192
|
+
dashboard_name = d['title'].to_s.downcase.gsub(/\s/, '.')
|
193
|
+
dashboard.identifier = "dashboard.#{dashboard_name}"
|
194
|
+
dashboard.add_tag('dashboard')
|
195
|
+
dashboard.save
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def create_tag_for_fact_n_dataset
|
201
|
+
dataset = @project.datasets(DATASET_IDENTIFIER)
|
202
|
+
dataset.add_tag('dataset')
|
203
|
+
dataset.save
|
204
|
+
|
205
|
+
fact = @project.facts(FACT_IDENTIFIER)
|
206
|
+
fact.add_tag('fact')
|
207
|
+
fact.save
|
208
|
+
end
|
209
|
+
|
210
|
+
def ensure_user(login, domain)
|
211
|
+
user = domain.users(login)
|
212
|
+
unless user
|
213
|
+
user = domain.add_user(login: login)
|
214
|
+
end
|
215
|
+
@project.add_user(user, 'Viewer', domain: domain)
|
216
|
+
user
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
File without changes
|
data/spec/helpers/cli_helper.rb
CHANGED
File without changes
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module GoodData
|
2
|
+
module Helpers
|
3
|
+
BLUEPRINT_FILE = './spec/integration/data/model.json'
|
4
|
+
METRICS_FILE = './spec/integration/data/metrics.json'
|
5
|
+
REPORTS_FILE = './spec/integration/data/reports.json'
|
6
|
+
DASHBOARDS_FILE = './spec/integration/data/dashboards.json'
|
7
|
+
|
8
|
+
DATASET_IDENTIFIER = 'dataset.csv_policies'
|
9
|
+
FACT_IDENTIFIER = 'fact.csv_policies.customer_lifetime_value'
|
10
|
+
DATA_FILE = './spec/integration/data/policies.csv'
|
11
|
+
|
12
|
+
CC_PROCESS_ARCHIVE = './spec/integration/data/cc_process.zip'
|
13
|
+
CC_PROCESS_NAME = 'Simple CloudConnect Process'
|
14
|
+
CC_SCHEDULE_CRON = '0 15 10 3 *'
|
15
|
+
CC_GRAPH = 'graph/test.grf'
|
16
|
+
CC_PARAMS = { param_1: 'a', param_2: 'b' }
|
17
|
+
CC_SECURE_PARAMS = { secure_param_1: 'secretive_foo', secure_param_2: 'secretive_bar' }
|
18
|
+
|
19
|
+
RUBY_HELLO_WORLD_PROCESS_PATH = '${PUBLIC_APPSTORE}:branch/master:/apps/hello_world_brick'
|
20
|
+
RUBY_HELLO_WORLD_PROCESS_NAME = 'Simple Ruby Process'
|
21
|
+
RUBY_PARAMS = { param_1: 'a', param_2: 'b' }
|
22
|
+
RUBY_SECURE_PARAMS = { secure_param_1: 'secretive_baz', secure_param_2: 'secretive_qux' }
|
23
|
+
|
24
|
+
PRODUCTION_TAGGED_METRIC = 'metric.total.claim.amount'
|
25
|
+
|
26
|
+
CUSTOM_CLIENT_ID_COLUMN = 'custom_client_id_column'
|
27
|
+
|
28
|
+
COMPUTED_ATTRIBUTE_ID = 'attr.comp.my_computed_attr'
|
29
|
+
|
30
|
+
USER_GROUP_NAME = 'My Test Group'
|
31
|
+
end
|
32
|
+
end
|
File without changes
|
data/spec/helpers/csv_helper.rb
CHANGED
File without changes
|
data/spec/helpers/spec_helper.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -110,6 +110,10 @@ describe "Swapping a date dimension and exchanging all attributes/elements", :co
|
|
110
110
|
expect(as.pmapcat { |a| a.usedby('metric') }).to be_empty
|
111
111
|
expect(as.pmapcat { |a| a.usedby('dashboard') }).to be_empty
|
112
112
|
|
113
|
+
year_obj_id = @project.attributes
|
114
|
+
.find { |a| a.identifier == 'created_on_2.year' }
|
115
|
+
.obj_id
|
116
|
+
|
113
117
|
# replace values
|
114
118
|
mapping = GoodData::Helpers.prepare_mapping(suggest_mapping('created_on', 'created_on_2', @project), project: @project)
|
115
119
|
@project.replace_from_mapping(mapping)
|
@@ -135,10 +139,10 @@ describe "Swapping a date dimension and exchanging all attributes/elements", :co
|
|
135
139
|
expect(@report.definition.attributes.map(&:identifier)).to eq ["created_on_2.quarter"]
|
136
140
|
|
137
141
|
ids = GoodData::SmallGoodZilla.get_uris(@report.definition.filters.first).map { |x| x.split('/')[-2..-1].join('/') }
|
138
|
-
expect(ids).to eq ["obj
|
142
|
+
expect(ids).to eq ["obj/#{year_obj_id}", "#{year_obj_id}/elements?id=2015", "#{year_obj_id}/elements?id=2016"]
|
139
143
|
|
140
144
|
ids = GoodData::SmallGoodZilla.get_uris(@variable.values.first.expression).map { |v| v.split('/')[-2..-1].join('/') }
|
141
|
-
expect(ids).to eq ["obj
|
145
|
+
expect(ids).to eq ["obj/#{year_obj_id}", "#{year_obj_id}/elements?id=2015", "#{year_obj_id}/elements?id=2016"]
|
142
146
|
|
143
147
|
# Swap the dims
|
144
148
|
bp = @project.blueprint
|
File without changes
|
@@ -0,0 +1,40 @@
|
|
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::Label do
|
10
|
+
before(:all) do
|
11
|
+
@rest_client = ConnectionHelper.create_default_connection
|
12
|
+
@suffix = AppstoreProjectHelper.suffix
|
13
|
+
@opts = {
|
14
|
+
client: @rest_client,
|
15
|
+
title: "Project for label spec #{@suffix}",
|
16
|
+
auth_token: ConnectionHelper::GD_PROJECT_TOKEN,
|
17
|
+
environment: 'TESTING',
|
18
|
+
prod_organization: 'staging-lcm-prod'
|
19
|
+
}
|
20
|
+
project_helper = AppstoreProjectHelper.create(@opts)
|
21
|
+
project_helper.create_ldm
|
22
|
+
project_helper.load_data
|
23
|
+
@project = project_helper.project
|
24
|
+
@label = @project.attributes('label.csv_policies.customer')
|
25
|
+
end
|
26
|
+
after(:all) do
|
27
|
+
@project.delete unless @project.deleted?
|
28
|
+
end
|
29
|
+
# this is a substring of another value in the set, AA10041
|
30
|
+
let(:expected_id) { 'AA1004' }
|
31
|
+
|
32
|
+
describe '#get_valid_elements' do
|
33
|
+
it 'returns an exact match' do
|
34
|
+
eles = @label.get_valid_elements filter: expected_id
|
35
|
+
eles['validElements']['items'].each do |ele|
|
36
|
+
expect(ele['element']['title']).to eq expected_id
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2018 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
|
+
describe GoodData::LCM2::SynchronizeClients do
|
8
|
+
subject { GoodData::LCM2::SynchronizeClients }
|
9
|
+
let(:failure_details) { '/link/to/details' }
|
10
|
+
let(:failed_count) { 42 }
|
11
|
+
let(:sync_failed_response_body) do
|
12
|
+
{
|
13
|
+
"synchronizationResult" => {
|
14
|
+
"successfulClients" => {
|
15
|
+
"count" => 0
|
16
|
+
},
|
17
|
+
"failedClients" => {
|
18
|
+
"count" => failed_count
|
19
|
+
},
|
20
|
+
"links" => {
|
21
|
+
"details" => failure_details
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:sync_failed_response) { double(RestClient::Response) }
|
28
|
+
let(:gdc_gd_client) { double(GoodData::Rest::Client) }
|
29
|
+
let(:logger) { double(Logger) }
|
30
|
+
let(:organization_name) { 'big-boss-group' }
|
31
|
+
let(:organization) { double(GoodData::Domain) }
|
32
|
+
let(:segment) { double(GoodData::Segment) }
|
33
|
+
let(:ads_client) { double(GoodData::DataWarehouse) }
|
34
|
+
let(:params) do
|
35
|
+
params = {
|
36
|
+
gdc_gd_client: gdc_gd_client,
|
37
|
+
development_client: gdc_gd_client,
|
38
|
+
organization: organization_name,
|
39
|
+
segments: [segment],
|
40
|
+
release_table_name: 'LCM_RELEASE',
|
41
|
+
ads_client: ads_client,
|
42
|
+
gdc_logger: logger
|
43
|
+
}
|
44
|
+
GoodData::LCM2.convert_to_smart_hash(params)
|
45
|
+
end
|
46
|
+
|
47
|
+
before do
|
48
|
+
allow(gdc_gd_client).to receive(:domain).with(organization_name)
|
49
|
+
.and_return(organization)
|
50
|
+
allow(organization).to receive(:segments).and_return([segment])
|
51
|
+
allow(segment).to receive(:segment_id).and_return('id_of_my_segment')
|
52
|
+
allow(gdc_gd_client).to receive(:projects)
|
53
|
+
allow(ads_client).to receive(:execute_select).and_return([{}])
|
54
|
+
allow(segment).to receive(:master_project=)
|
55
|
+
allow(segment).to receive(:save)
|
56
|
+
allow(sync_failed_response)
|
57
|
+
.to receive(:json).and_return(sync_failed_response_body)
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'when synchronizing client fails' do
|
61
|
+
before do
|
62
|
+
allow(segment)
|
63
|
+
.to receive(:synchronize_clients).and_return(sync_failed_response)
|
64
|
+
end
|
65
|
+
it 'fails with a clear error message' do
|
66
|
+
expected_error_message = "#{failed_count} clients failed to " \
|
67
|
+
"synchronize. Details: #{failure_details}"
|
68
|
+
expect { subject.call(params) }.to raise_error(expected_error_message)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|