gooddata 1.1.0-java → 1.2.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +0 -0
- data/.flayignore +2 -0
- data/.travis.yml +24 -7
- data/.yardopts +0 -0
- data/CHANGELOG.md +144 -0
- 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 +23 -452
- 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,214 +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 'tempfile'
|
8
|
-
|
9
|
-
require 'gooddata/core/rest'
|
10
|
-
|
11
|
-
describe GoodData do
|
12
|
-
before(:each) do
|
13
|
-
@client = ConnectionHelper.create_default_connection
|
14
|
-
# @project = ProjectHelper.get_default_project(:client => @client)
|
15
|
-
@project = @client.create_project(title: 'Project for schedule testing', auth_token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
|
16
|
-
end
|
17
|
-
|
18
|
-
after(:each) do
|
19
|
-
@project && @project.delete
|
20
|
-
@client.disconnect
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#project_webdav_path' do
|
24
|
-
it 'Returns path' do
|
25
|
-
@client.project_webdav_path(:project => @project)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_webdav_upload(params)
|
30
|
-
GoodData.with_project(@project, :client => @client) do
|
31
|
-
# use current timestamp as a directory name on webdav
|
32
|
-
dir = params[:no_dir] ? nil : Time.now.to_i.to_s
|
33
|
-
dir = "#{dir}/#{dir}" if params[:nested_dir]
|
34
|
-
dir = "#{dir}/" if params[:slash_in_dir]
|
35
|
-
|
36
|
-
# local file path
|
37
|
-
path = 'spec/data/test-ci-data.csv'
|
38
|
-
|
39
|
-
if params[:special_chars]
|
40
|
-
source_file = Tempfile.new('abc-16:55:29+ha#he.csv')
|
41
|
-
FileUtils.cp(path, source_file)
|
42
|
-
path = source_file.path
|
43
|
-
end
|
44
|
-
|
45
|
-
path = File.expand_path(path) if params[:absolute_path]
|
46
|
-
|
47
|
-
# upload it there
|
48
|
-
upload_method = GoodData.method(params[:upload_method])
|
49
|
-
upload_method.call(path, directory: dir)
|
50
|
-
|
51
|
-
# download it from there
|
52
|
-
temp_file = Tempfile.new('foo.csv')
|
53
|
-
expect(temp_file.size).to be == 0
|
54
|
-
|
55
|
-
download_method = GoodData.method(params[:download_method])
|
56
|
-
|
57
|
-
file_basename = File.basename(path)
|
58
|
-
file_basename = "NOTTHERE_#{file_basename}" if params[:unknown_file]
|
59
|
-
|
60
|
-
download_block = proc do
|
61
|
-
if params[:path_in_file]
|
62
|
-
# pass the dir directly in the first param
|
63
|
-
# e.g. GoodData.download_from_project_webdav('1234/test-ci-data.csv', '/tmp/myfile.csv')
|
64
|
-
download_method.call(File.join(dir, file_basename).to_s, temp_file)
|
65
|
-
else
|
66
|
-
# pass the dir in the :directory option
|
67
|
-
# e.g. GoodData.download_from_project_webdav('test-ci-data.csv', '/tmp/myfile.csv', :directory => '1234')
|
68
|
-
download_method.call(file_basename, temp_file, directory: dir)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# if it's unknown it should raise an error, otherwise it should download the right stuff
|
73
|
-
if params[:unknown_file]
|
74
|
-
expect do
|
75
|
-
download_block.call
|
76
|
-
end.to raise_error(ArgumentError)
|
77
|
-
else
|
78
|
-
download_block.call
|
79
|
-
|
80
|
-
expect(temp_file.size).to be > 0
|
81
|
-
|
82
|
-
# expect the contents of the original file and the downloaded file are the same
|
83
|
-
expect(IO.read(temp_file)).to be == IO.read(path)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe '#download_from_project_webdav' do
|
89
|
-
it "Works with directory directly in the 'file' param for project" do
|
90
|
-
test_webdav_upload(
|
91
|
-
upload_method: 'upload_to_project_webdav',
|
92
|
-
download_method: 'download_from_project_webdav',
|
93
|
-
path_in_file: true
|
94
|
-
)
|
95
|
-
end
|
96
|
-
it "Works with directory directly in the 'file' param for user" do
|
97
|
-
test_webdav_upload(
|
98
|
-
upload_method: 'upload_to_user_webdav',
|
99
|
-
download_method: 'download_from_user_webdav',
|
100
|
-
path_in_file: true
|
101
|
-
)
|
102
|
-
end
|
103
|
-
it "Works with directories with slash at the end for project" do
|
104
|
-
test_webdav_upload(
|
105
|
-
upload_method: 'upload_to_project_webdav',
|
106
|
-
download_method: 'download_from_project_webdav',
|
107
|
-
slash_in_dir: true
|
108
|
-
)
|
109
|
-
end
|
110
|
-
it "Works with directories with slash at the end for user" do
|
111
|
-
test_webdav_upload(
|
112
|
-
upload_method: 'upload_to_user_webdav',
|
113
|
-
download_method: 'download_from_user_webdav',
|
114
|
-
slash_in_dir: true
|
115
|
-
)
|
116
|
-
end
|
117
|
-
it "Fails for non-existing file for project" do
|
118
|
-
test_webdav_upload(
|
119
|
-
upload_method: 'upload_to_project_webdav',
|
120
|
-
download_method: 'download_from_project_webdav',
|
121
|
-
unknown_file: true
|
122
|
-
)
|
123
|
-
end
|
124
|
-
it "Fails for non-existing file for user" do
|
125
|
-
test_webdav_upload(
|
126
|
-
upload_method: 'upload_to_user_webdav',
|
127
|
-
download_method: 'download_from_user_webdav',
|
128
|
-
unknown_file: true
|
129
|
-
)
|
130
|
-
end
|
131
|
-
it 'Works with nested directories for project' do
|
132
|
-
test_webdav_upload(
|
133
|
-
upload_method: 'upload_to_project_webdav',
|
134
|
-
download_method: 'download_from_project_webdav',
|
135
|
-
nested_dir: true
|
136
|
-
)
|
137
|
-
end
|
138
|
-
it 'Works with nested directories for user' do
|
139
|
-
test_webdav_upload(
|
140
|
-
upload_method: 'upload_to_user_webdav',
|
141
|
-
download_method: 'download_from_user_webdav',
|
142
|
-
nested_dir: true
|
143
|
-
)
|
144
|
-
end
|
145
|
-
it 'Works with no directory for user' do
|
146
|
-
test_webdav_upload(
|
147
|
-
upload_method: 'upload_to_user_webdav',
|
148
|
-
download_method: 'download_from_user_webdav',
|
149
|
-
no_dir: true
|
150
|
-
)
|
151
|
-
end
|
152
|
-
it 'Works with no directory for project' do
|
153
|
-
test_webdav_upload(
|
154
|
-
upload_method: 'upload_to_project_webdav',
|
155
|
-
download_method: 'download_from_project_webdav',
|
156
|
-
no_dir: true
|
157
|
-
)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
describe '#upload_to_project_webdav' do
|
161
|
-
it 'Uploads file with relative path to a dir' do
|
162
|
-
test_webdav_upload(
|
163
|
-
upload_method: 'upload_to_project_webdav',
|
164
|
-
download_method: 'download_from_project_webdav'
|
165
|
-
)
|
166
|
-
end
|
167
|
-
|
168
|
-
it 'Uploads file with absolute path to a dir' do
|
169
|
-
test_webdav_upload(
|
170
|
-
absolute_path: true,
|
171
|
-
upload_method: 'upload_to_project_webdav',
|
172
|
-
download_method: 'download_from_project_webdav'
|
173
|
-
)
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'Uploads file with special chars in filename' do
|
177
|
-
test_webdav_upload(
|
178
|
-
special_chars: true,
|
179
|
-
upload_method: 'upload_to_project_webdav',
|
180
|
-
download_method: 'download_from_project_webdav'
|
181
|
-
)
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
describe '#upload_to_user_webdav' do
|
186
|
-
it 'Uploads file with relative path to a dir' do
|
187
|
-
test_webdav_upload(
|
188
|
-
upload_method: 'upload_to_user_webdav',
|
189
|
-
download_method: 'download_from_user_webdav'
|
190
|
-
)
|
191
|
-
end
|
192
|
-
|
193
|
-
it 'Uploads file with absolute path to a dir' do
|
194
|
-
test_webdav_upload(
|
195
|
-
absolute_path: true,
|
196
|
-
upload_method: 'upload_to_user_webdav',
|
197
|
-
download_method: 'download_from_user_webdav'
|
198
|
-
)
|
199
|
-
end
|
200
|
-
it 'Uploads file with special chars in filename' do
|
201
|
-
test_webdav_upload(
|
202
|
-
special_chars: true,
|
203
|
-
upload_method: 'upload_to_user_webdav',
|
204
|
-
download_method: 'download_from_user_webdav'
|
205
|
-
)
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
describe '#user_webdav_path' do
|
210
|
-
it 'Gets the path' do
|
211
|
-
expect(@client.user_webdav_path).to eq GoodData::Environment::ConnectionHelper::STAGING_URI
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
@@ -1,611 +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
|
-
require 'gooddata/helpers/global_helpers'
|
9
|
-
|
10
|
-
describe GoodData::Schedule do
|
11
|
-
SCHEDULE_ID = ScheduleHelper::SCHEDULE_ID
|
12
|
-
SCHEDULE_URL = "/gdc/projects/#{ProjectHelper::PROJECT_ID}/schedules/#{SCHEDULE_ID}"
|
13
|
-
|
14
|
-
before(:each) do
|
15
|
-
@client = ConnectionHelper.create_default_connection
|
16
|
-
|
17
|
-
@project = ProjectHelper.get_default_project(:client => @client)
|
18
|
-
@test_cron = '0 15 27 7 *'
|
19
|
-
@test_data = {
|
20
|
-
:timezone => 'UTC',
|
21
|
-
:cron => '2 2 2 2 *',
|
22
|
-
:client => @client,
|
23
|
-
:project => @project,
|
24
|
-
:params => {
|
25
|
-
'a' => 'b',
|
26
|
-
'b' => 'c'
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
@test_data_with_optional_param = {
|
31
|
-
:timezone => 'UTC',
|
32
|
-
:cron => '2 2 2 2 *',
|
33
|
-
:reschedule => 15,
|
34
|
-
:client => @client,
|
35
|
-
:project => @project
|
36
|
-
}
|
37
|
-
end
|
38
|
-
|
39
|
-
after(:each) do
|
40
|
-
@client.disconnect
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '#[]' do
|
44
|
-
it 'Returns all schedules when :all passed' do
|
45
|
-
res = @project.schedules
|
46
|
-
res.should_not be_nil
|
47
|
-
res.should be_a_kind_of(Array)
|
48
|
-
res.each do |schedule|
|
49
|
-
schedule.should be_a_kind_of(GoodData::Schedule)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'Returns specific schedule when schedule ID passed' do
|
54
|
-
res = @project.schedules(SCHEDULE_ID)
|
55
|
-
res.should_not be_nil
|
56
|
-
res.should be_a_kind_of(GoodData::Schedule)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'Returns specific schedule when schedule URL passed' do
|
60
|
-
res = @project.schedules(SCHEDULE_ID)
|
61
|
-
res.should_not be_nil
|
62
|
-
res.should be_a_kind_of(GoodData::Schedule)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#all' do
|
67
|
-
it 'Returns all schedules' do
|
68
|
-
res = @project.schedules
|
69
|
-
res.should_not be_nil
|
70
|
-
res.should be_a_kind_of(Array)
|
71
|
-
res.each do |schedule|
|
72
|
-
schedule.should be_a_kind_of(GoodData::Schedule)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '#create' do
|
78
|
-
it 'Creates new schedule if mandatory params passed' do
|
79
|
-
begin
|
80
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
81
|
-
expect(schedule).to be_truthy
|
82
|
-
ensure
|
83
|
-
schedule && schedule.delete
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'Creates new schedule if mandatory params passed and optional params are present' do
|
88
|
-
begin
|
89
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
90
|
-
expect(schedule).to be_truthy
|
91
|
-
ensure
|
92
|
-
schedule && schedule.delete
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'Throws exception when no process ID specified' do
|
97
|
-
schedule = nil
|
98
|
-
begin
|
99
|
-
expect do
|
100
|
-
schedule = @project.create_schedule(nil, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
101
|
-
end.to raise_error 'Process ID has to be provided'
|
102
|
-
ensure
|
103
|
-
schedule && schedule.delete
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'Throws exception when no executable specified' do
|
108
|
-
schedule = nil
|
109
|
-
begin
|
110
|
-
expect do
|
111
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, nil, @test_data)
|
112
|
-
end.to raise_error 'Executable has to be provided'
|
113
|
-
ensure
|
114
|
-
schedule && schedule.delete
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
it 'Works when no cron or schedule is specified' do
|
119
|
-
data = GoodData::Helpers.deep_dup(@test_data)
|
120
|
-
data[:cron] = nil
|
121
|
-
schedule = nil
|
122
|
-
begin
|
123
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, nil, ProcessHelper::DEPLOY_NAME, data)
|
124
|
-
ensure
|
125
|
-
schedule && schedule.delete
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
it 'Throws exception when no timezone specified' do
|
130
|
-
data = GoodData::Helpers.deep_dup(@test_data)
|
131
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, data)
|
132
|
-
schedule.timezone = nil
|
133
|
-
begin
|
134
|
-
expect do
|
135
|
-
schedule.save
|
136
|
-
end.to raise_error 'A timezone has to be provided'
|
137
|
-
ensure
|
138
|
-
schedule && schedule.delete
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'Throws exception when no schedule type is specified' do
|
143
|
-
schedule = nil
|
144
|
-
data = GoodData::Helpers.deep_dup(@test_data)
|
145
|
-
begin
|
146
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, data)
|
147
|
-
schedule.type = nil
|
148
|
-
expect do
|
149
|
-
schedule.save
|
150
|
-
end.to raise_error 'Schedule type has to be provided'
|
151
|
-
ensure
|
152
|
-
schedule && schedule.delete
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '#cron' do
|
158
|
-
it 'Should return cron as string' do
|
159
|
-
begin
|
160
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
161
|
-
res = schedule.cron
|
162
|
-
res.should_not be_nil
|
163
|
-
res.should_not be_empty
|
164
|
-
res.should be_a_kind_of(String)
|
165
|
-
expect(schedule.time_based?).to be_truthy
|
166
|
-
ensure
|
167
|
-
schedule && schedule.delete
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
describe '#cron=' do
|
173
|
-
it 'Assigns the cron and marks the object dirty' do
|
174
|
-
test_cron = '2 2 2 2 *'
|
175
|
-
|
176
|
-
begin
|
177
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
178
|
-
schedule.cron = test_cron
|
179
|
-
expect(schedule.cron).to eq(test_cron)
|
180
|
-
expect(schedule.dirty).to eq(true)
|
181
|
-
ensure
|
182
|
-
schedule && schedule.delete
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
describe '#executable' do
|
188
|
-
it 'Should return executable as string' do
|
189
|
-
begin
|
190
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
191
|
-
res = schedule.executable
|
192
|
-
res.should_not be_nil
|
193
|
-
res.should_not be_empty
|
194
|
-
res.should be_a_kind_of(String)
|
195
|
-
ensure
|
196
|
-
schedule && schedule.delete
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
describe '#executable=' do
|
202
|
-
it 'Assigns the executable and marks the object dirty' do
|
203
|
-
test_executable = 'this/is/test.grf'
|
204
|
-
|
205
|
-
begin
|
206
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
207
|
-
schedule.executable = test_executable
|
208
|
-
expect(schedule.executable).to eq(test_executable)
|
209
|
-
expect(schedule.dirty).to eq(true)
|
210
|
-
ensure
|
211
|
-
schedule && schedule.delete
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
describe '#execute' do
|
217
|
-
it 'Waits for execution result by default' do
|
218
|
-
begin
|
219
|
-
process = @project.deploy_process(
|
220
|
-
'./spec/data/gooddata_version_process/gooddata_version.zip',
|
221
|
-
type: 'RUBY',
|
222
|
-
name: 'Test ETL zipped file GoodData Process'
|
223
|
-
)
|
224
|
-
schedule = process.create_schedule('0 15 27 7 *', process.executables.first)
|
225
|
-
res = schedule.execute
|
226
|
-
expect(res).to be_an_instance_of(GoodData::Execution)
|
227
|
-
expect([:ok, :error].include?(res.status)).to be_truthy
|
228
|
-
ensure
|
229
|
-
schedule && schedule.delete
|
230
|
-
process && process.delete
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
it 'can be overridden to do not wait for execution result' do
|
235
|
-
begin
|
236
|
-
process = @project.deploy_process('./spec/data/gooddata_version_process/gooddata_version.zip',
|
237
|
-
type: 'RUBY',
|
238
|
-
name: 'Test ETL zipped file GoodData Process')
|
239
|
-
schedule = process.create_schedule('0 15 27 7 *', process.executables.first)
|
240
|
-
res = schedule.execute(:wait => false)
|
241
|
-
expect(res).to be_an_instance_of(GoodData::Execution)
|
242
|
-
expect([:scheduled, :running].include?(res.status)).to be_truthy
|
243
|
-
ensure
|
244
|
-
schedule && schedule.delete
|
245
|
-
process && process.delete
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
describe '#execution_url' do
|
251
|
-
it 'Should return execution URL as string' do
|
252
|
-
begin
|
253
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
254
|
-
res = schedule.execution_url
|
255
|
-
res.should_not be_nil
|
256
|
-
res.should_not be_empty
|
257
|
-
res.should be_a_kind_of(String)
|
258
|
-
ensure
|
259
|
-
schedule && schedule.delete
|
260
|
-
end
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
describe '#type' do
|
265
|
-
it 'Should return execution type as string' do
|
266
|
-
begin
|
267
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
268
|
-
res = schedule.type
|
269
|
-
res.should_not be_nil
|
270
|
-
res.should be_a_kind_of(String)
|
271
|
-
ensure
|
272
|
-
schedule && schedule.delete
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
describe '#hidden_params' do
|
278
|
-
it 'Should return execution hidden_params as hash' do
|
279
|
-
begin
|
280
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
281
|
-
res = schedule.hidden_params
|
282
|
-
res.should_not be_nil
|
283
|
-
res.should be_a_kind_of(Hash)
|
284
|
-
ensure
|
285
|
-
schedule && schedule.delete
|
286
|
-
end
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
describe '#hidden_params=' do
|
291
|
-
it 'Assigns the hidden params and marks the object dirty' do
|
292
|
-
begin
|
293
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
294
|
-
old_params = schedule.hidden_params
|
295
|
-
|
296
|
-
test_params = {
|
297
|
-
'PROCESS_ID' => '1-2-3-4'
|
298
|
-
}
|
299
|
-
|
300
|
-
schedule.hidden_params = test_params
|
301
|
-
expect(schedule.hidden_params).to eq(old_params.merge(test_params))
|
302
|
-
expect(schedule.dirty).to eq(true)
|
303
|
-
ensure
|
304
|
-
schedule && schedule.delete
|
305
|
-
end
|
306
|
-
end
|
307
|
-
end
|
308
|
-
|
309
|
-
describe '#set_hidden_parameter' do
|
310
|
-
it 'Assigns the hidden parameter and marks the object dirty' do
|
311
|
-
begin
|
312
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
313
|
-
old_params = schedule.hidden_params
|
314
|
-
|
315
|
-
test_parameter = { 'test_parameter' => 'just_testing' }
|
316
|
-
schedule.set_hidden_parameter(test_parameter.keys.first, test_parameter.values.first)
|
317
|
-
expect(schedule.hidden_params).to eq(old_params.merge(test_parameter))
|
318
|
-
expect(schedule.dirty).to eq(true)
|
319
|
-
ensure
|
320
|
-
schedule && schedule.delete
|
321
|
-
end
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
describe '#set_parameter' do
|
326
|
-
it 'Assigns the hidden parameter and marks the object dirty' do
|
327
|
-
begin
|
328
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
329
|
-
old_params = schedule.params
|
330
|
-
|
331
|
-
test_parameter = { 'test_parameter' => 'just_testing' }
|
332
|
-
schedule.set_parameter(test_parameter.keys.first, test_parameter.values.first)
|
333
|
-
expect(schedule.params).to eq(old_params.merge(test_parameter))
|
334
|
-
expect(schedule.dirty).to eq(true)
|
335
|
-
ensure
|
336
|
-
schedule && schedule.delete
|
337
|
-
end
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
describe '#params' do
|
342
|
-
it 'Should return execution params as hash' do
|
343
|
-
begin
|
344
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
345
|
-
res = schedule.params
|
346
|
-
res.should_not be_nil
|
347
|
-
res.should_not be_empty
|
348
|
-
res.should be_a_kind_of(Hash)
|
349
|
-
ensure
|
350
|
-
schedule && schedule.delete
|
351
|
-
end
|
352
|
-
end
|
353
|
-
end
|
354
|
-
|
355
|
-
describe '#params=' do
|
356
|
-
it 'Assigns the params and marks the object dirty' do
|
357
|
-
begin
|
358
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
359
|
-
|
360
|
-
test_params = {
|
361
|
-
'some_new_param' => '1-2-3-4'
|
362
|
-
}
|
363
|
-
|
364
|
-
schedule.params = test_params
|
365
|
-
expect(schedule.params.keys).to eq(%w(PROCESS_ID EXECUTABLE some_new_param))
|
366
|
-
expect(schedule.params['some_new_param']).to eq '1-2-3-4'
|
367
|
-
expect(schedule.dirty).to eq(true)
|
368
|
-
schedule.save
|
369
|
-
ensure
|
370
|
-
schedule && schedule.delete
|
371
|
-
end
|
372
|
-
end
|
373
|
-
end
|
374
|
-
|
375
|
-
describe '#process_id' do
|
376
|
-
it 'Should return process id as string' do
|
377
|
-
begin
|
378
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
379
|
-
res = schedule.process_id
|
380
|
-
res.should_not be_nil
|
381
|
-
res.should_not be_empty
|
382
|
-
res.should be_a_kind_of(String)
|
383
|
-
ensure
|
384
|
-
schedule && schedule.delete
|
385
|
-
end
|
386
|
-
end
|
387
|
-
end
|
388
|
-
|
389
|
-
describe '#process_id=' do
|
390
|
-
it 'Assigns the process_id and marks the object dirty' do
|
391
|
-
test_process_id = '1-2-3-4'
|
392
|
-
|
393
|
-
begin
|
394
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
395
|
-
schedule.process_id = test_process_id
|
396
|
-
expect(schedule.process_id).to eq(test_process_id)
|
397
|
-
expect(schedule.dirty).to eq(true)
|
398
|
-
ensure
|
399
|
-
schedule && schedule.delete
|
400
|
-
end
|
401
|
-
end
|
402
|
-
end
|
403
|
-
|
404
|
-
describe '#save' do
|
405
|
-
it 'Should save a schedule' do
|
406
|
-
begin
|
407
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
408
|
-
expect(@project.schedules(schedule.uri)).to eq schedule
|
409
|
-
expect(@project.schedules).to include(schedule)
|
410
|
-
ensure
|
411
|
-
schedule && schedule.delete
|
412
|
-
end
|
413
|
-
end
|
414
|
-
end
|
415
|
-
|
416
|
-
describe '#state' do
|
417
|
-
it 'Should return execution state as string' do
|
418
|
-
begin
|
419
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
420
|
-
res = schedule.state
|
421
|
-
res.should_not be_nil
|
422
|
-
res.should_not be_empty
|
423
|
-
res.should be_a_kind_of(String)
|
424
|
-
ensure
|
425
|
-
schedule && schedule.delete
|
426
|
-
end
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
describe '#type' do
|
431
|
-
it 'Should return execution type as string' do
|
432
|
-
begin
|
433
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
434
|
-
res = schedule.type
|
435
|
-
res.should_not be_nil
|
436
|
-
res.should_not be_empty
|
437
|
-
res.should be_a_kind_of(String)
|
438
|
-
ensure
|
439
|
-
schedule && schedule.delete
|
440
|
-
end
|
441
|
-
end
|
442
|
-
end
|
443
|
-
|
444
|
-
describe '#type=' do
|
445
|
-
it 'Assigns the type the object dirty' do
|
446
|
-
test_type = 'TEST'
|
447
|
-
|
448
|
-
begin
|
449
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
450
|
-
schedule.type = test_type
|
451
|
-
expect(schedule.type).to eq(test_type)
|
452
|
-
expect(schedule.dirty).to eq(true)
|
453
|
-
ensure
|
454
|
-
schedule && schedule.delete
|
455
|
-
end
|
456
|
-
end
|
457
|
-
end
|
458
|
-
|
459
|
-
describe '#timezone' do
|
460
|
-
it 'Should return timezone as string' do
|
461
|
-
begin
|
462
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
463
|
-
res = schedule.timezone
|
464
|
-
res.should_not be_nil
|
465
|
-
res.should_not be_empty
|
466
|
-
res.should be_a_kind_of(String)
|
467
|
-
ensure
|
468
|
-
schedule && schedule.delete
|
469
|
-
end
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
473
|
-
describe '#timezone=' do
|
474
|
-
it 'Assigns the timezone and marks the object dirty' do
|
475
|
-
test_timezone = 'PST'
|
476
|
-
|
477
|
-
begin
|
478
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data)
|
479
|
-
schedule.timezone = test_timezone
|
480
|
-
expect(schedule.timezone).to eq(test_timezone)
|
481
|
-
expect(schedule.dirty).to eq(true)
|
482
|
-
ensure
|
483
|
-
schedule && schedule.delete
|
484
|
-
end
|
485
|
-
end
|
486
|
-
end
|
487
|
-
|
488
|
-
describe '#reschedule' do
|
489
|
-
it 'Should return reschedule as integer' do
|
490
|
-
begin
|
491
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
492
|
-
res = schedule.reschedule
|
493
|
-
res.should_not be_nil
|
494
|
-
res.should be_a_kind_of(Integer)
|
495
|
-
ensure
|
496
|
-
schedule && schedule.delete
|
497
|
-
end
|
498
|
-
end
|
499
|
-
end
|
500
|
-
|
501
|
-
describe '#reschedule=' do
|
502
|
-
it 'Assigns the reschedule and marks the object dirty' do
|
503
|
-
test_reschedule = 45
|
504
|
-
|
505
|
-
begin
|
506
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
507
|
-
schedule.reschedule = test_reschedule
|
508
|
-
expect(schedule.reschedule).to eq(test_reschedule)
|
509
|
-
expect(schedule.dirty).to eq(true)
|
510
|
-
ensure
|
511
|
-
schedule && schedule.delete
|
512
|
-
end
|
513
|
-
end
|
514
|
-
end
|
515
|
-
|
516
|
-
describe '#executions' do
|
517
|
-
it 'Returns executions' do
|
518
|
-
begin
|
519
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
520
|
-
expect(schedule.executions.to_a).to be_empty
|
521
|
-
schedule.execute
|
522
|
-
ensure
|
523
|
-
schedule && schedule.delete
|
524
|
-
end
|
525
|
-
end
|
526
|
-
end
|
527
|
-
|
528
|
-
describe '#name' do
|
529
|
-
it 'should be able to get name of the schedule.' do
|
530
|
-
begin
|
531
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
532
|
-
expect(schedule.name).to eq ProcessHelper::DEPLOY_NAME
|
533
|
-
ensure
|
534
|
-
schedule && schedule.delete
|
535
|
-
end
|
536
|
-
end
|
537
|
-
|
538
|
-
it 'should be able to return your name if specified during creation.' do
|
539
|
-
begin
|
540
|
-
schedule = @project.create_schedule(ProcessHelper::PROCESS_ID, @test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param.merge(name: 'My schedule name'))
|
541
|
-
expect(schedule.name).to eq 'My schedule name'
|
542
|
-
ensure
|
543
|
-
schedule && schedule.delete
|
544
|
-
end
|
545
|
-
end
|
546
|
-
end
|
547
|
-
|
548
|
-
describe '#trigger_id=' do
|
549
|
-
it 'should be able to set trigger_id of the schedule.' do
|
550
|
-
begin
|
551
|
-
process = @project.processes(ProcessHelper::PROCESS_ID)
|
552
|
-
schedule = process.create_schedule(@test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
553
|
-
expect(schedule.dirty).to be_falsey
|
554
|
-
schedule.trigger_id = 'some_other_id'
|
555
|
-
expect(schedule.dirty).to be_truthy
|
556
|
-
ensure
|
557
|
-
schedule && schedule.delete
|
558
|
-
end
|
559
|
-
end
|
560
|
-
end
|
561
|
-
|
562
|
-
describe '#trigger_id=' do
|
563
|
-
it 'should be able to set trigger_id of the schedule.' do
|
564
|
-
begin
|
565
|
-
process = @project.processes(ProcessHelper::PROCESS_ID)
|
566
|
-
schedule = process.create_schedule(@test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
567
|
-
expect(schedule.dirty).to be_falsey
|
568
|
-
schedule.trigger_id = 'some_other_id'
|
569
|
-
expect(schedule.dirty).to be_truthy
|
570
|
-
ensure
|
571
|
-
schedule && schedule.delete
|
572
|
-
end
|
573
|
-
end
|
574
|
-
end
|
575
|
-
|
576
|
-
describe '#name=' do
|
577
|
-
it 'should be able to set name of the schedule.' do
|
578
|
-
begin
|
579
|
-
process = @project.processes(ProcessHelper::PROCESS_ID)
|
580
|
-
schedule = process.create_schedule(@test_cron, ProcessHelper::DEPLOY_NAME, @test_data_with_optional_param)
|
581
|
-
expect(schedule.name).to eq ProcessHelper::DEPLOY_NAME
|
582
|
-
schedule.name = 'MY NAME'
|
583
|
-
schedule.save
|
584
|
-
schedule2 = process.schedules.find { |s| s.obj_id == schedule.obj_id }
|
585
|
-
expect(schedule2.name).to eq 'MY NAME'
|
586
|
-
ensure
|
587
|
-
schedule && schedule.delete
|
588
|
-
end
|
589
|
-
end
|
590
|
-
end
|
591
|
-
|
592
|
-
describe '#disable' do
|
593
|
-
it 'should preserve the hidden parmeters.' do
|
594
|
-
begin
|
595
|
-
process = @project.processes(ProcessHelper::PROCESS_ID)
|
596
|
-
schedule = process.create_schedule(
|
597
|
-
@test_cron,
|
598
|
-
ProcessHelper::DEPLOY_NAME,
|
599
|
-
@test_data_with_optional_param.merge(hidden_params: { "a" => { "b" => "c" } })
|
600
|
-
)
|
601
|
-
|
602
|
-
schedule.save
|
603
|
-
expect(schedule.hidden_params).to eq(GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY => nil)
|
604
|
-
schedule2 = process.schedules.find { |s| s.uri == schedule.uri }
|
605
|
-
expect(schedule2.to_update_payload['schedule']['hiddenParams']).to eq(GoodData::Helpers::ENCODED_HIDDEN_PARAMS_KEY => nil)
|
606
|
-
ensure
|
607
|
-
schedule && schedule.delete
|
608
|
-
end
|
609
|
-
end
|
610
|
-
end
|
611
|
-
end
|