gooddata 0.6.0 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.rubocop.yml +23 -0
- data/.travis.yml +9 -4
- data/CLI.md +439 -0
- data/Gemfile +0 -1
- data/README.md +2 -2
- data/Rakefile +60 -8
- data/doc/templates/default/module/setup.rb +1 -1
- data/examples.rb +2 -0
- data/gooddata +2 -0
- data/gooddata.gemspec +12 -8
- data/lib/gooddata.rb +0 -2
- data/lib/gooddata/bricks/base_downloader.rb +52 -47
- data/lib/gooddata/bricks/brick.rb +20 -31
- data/lib/gooddata/bricks/bricks.rb +1 -1
- data/lib/gooddata/bricks/middleware/base_middleware.rb +9 -7
- data/lib/gooddata/bricks/middleware/bench_middleware.rb +12 -10
- data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +28 -28
- data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +20 -16
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +21 -19
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +10 -8
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +36 -34
- data/lib/gooddata/bricks/middleware/stdout_middleware.rb +11 -9
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +14 -12
- data/lib/gooddata/bricks/pipeline.rb +28 -0
- data/lib/gooddata/bricks/utils.rb +10 -8
- data/lib/gooddata/cli/cli.rb +1 -6
- data/lib/gooddata/cli/commands/auth_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/console_cmd.rb +7 -5
- data/lib/gooddata/cli/commands/domain_cmd.rb +45 -0
- data/lib/gooddata/cli/commands/process_cmd.rb +42 -5
- data/lib/gooddata/cli/commands/project_cmd.rb +96 -36
- data/lib/gooddata/cli/commands/projects_cmd.rb +21 -0
- data/lib/gooddata/cli/commands/role_cmd.rb +28 -0
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +5 -5
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/{profile_cmd.rb → user_cmd.rb} +7 -9
- data/lib/gooddata/cli/shared.rb +3 -2
- data/lib/gooddata/client.rb +16 -304
- data/lib/gooddata/commands/api.rb +13 -5
- data/lib/gooddata/commands/auth.rb +47 -40
- data/lib/gooddata/commands/base.rb +4 -2
- data/lib/gooddata/commands/commands.rb +1 -1
- data/lib/gooddata/commands/datasets.rb +20 -7
- data/lib/gooddata/commands/domain.rb +23 -0
- data/lib/gooddata/commands/process.rb +23 -117
- data/lib/gooddata/commands/project.rb +147 -0
- data/lib/gooddata/commands/projects.rb +8 -102
- data/lib/gooddata/commands/role.rb +26 -0
- data/lib/gooddata/commands/runners.rb +41 -38
- data/lib/gooddata/commands/scaffold.rb +46 -43
- data/lib/gooddata/commands/user.rb +33 -0
- data/lib/gooddata/connection.rb +43 -353
- data/lib/gooddata/core/connection.rb +389 -0
- data/lib/gooddata/core/core.rb +5 -4
- data/lib/gooddata/core/logging.rb +48 -0
- data/lib/gooddata/core/nil_logger.rb +13 -0
- data/lib/gooddata/core/project.rb +70 -0
- data/lib/gooddata/core/rest.rb +120 -0
- data/lib/gooddata/core/threaded.rb +14 -0
- data/lib/gooddata/core/user.rb +19 -0
- data/lib/gooddata/data/data.rb +2 -1
- data/lib/gooddata/data/guesser.rb +16 -12
- data/lib/gooddata/exceptions/command_failed.rb +1 -1
- data/lib/gooddata/exceptions/exceptions.rb +2 -1
- data/lib/gooddata/exceptions/no_project_error.rb +11 -0
- data/lib/gooddata/exceptions/project_not_found.rb +1 -1
- data/lib/gooddata/extensions/big_decimal.rb +6 -2
- data/lib/gooddata/extract.rb +10 -8
- data/lib/gooddata/goodzilla/goodzilla.rb +61 -59
- data/lib/gooddata/helpers.rb +15 -9
- data/lib/gooddata/models/account_settings.rb +124 -0
- data/lib/gooddata/models/attributes/anchor.rb +37 -0
- data/lib/gooddata/models/attributes/attributes.rb +8 -0
- data/lib/gooddata/models/attributes/date_attribute.rb +25 -0
- data/lib/gooddata/models/attributes/time_attribute.rb +24 -0
- data/lib/gooddata/models/columns/attribute.rb +71 -0
- data/lib/gooddata/models/columns/columns.rb +8 -0
- data/lib/gooddata/models/columns/date_column.rb +63 -0
- data/lib/gooddata/models/columns/fact_model.rb +54 -0
- data/lib/gooddata/models/columns/label.rb +55 -0
- data/lib/gooddata/models/columns/reference.rb +57 -0
- data/lib/gooddata/models/dashboard_builder.rb +26 -0
- data/lib/gooddata/models/data_result.rb +10 -9
- data/lib/gooddata/models/domain.rb +131 -0
- data/lib/gooddata/models/empty_result.rb +5 -8
- data/lib/gooddata/models/facts/facts.rb +8 -0
- data/lib/gooddata/models/facts/time_fact.rb +20 -0
- data/lib/gooddata/models/folders/attribute_folder.rb +20 -0
- data/lib/gooddata/models/folders/fact_folder.rb +20 -0
- data/lib/gooddata/models/folders/folders.rb +8 -0
- data/lib/gooddata/models/invitation.rb +78 -0
- data/lib/gooddata/models/links.rb +6 -6
- data/lib/gooddata/models/md_object.rb +25 -0
- data/lib/gooddata/models/metadata.rb +160 -62
- data/lib/gooddata/models/metadata/attribute.rb +81 -0
- data/lib/gooddata/models/metadata/column.rb +61 -0
- data/lib/gooddata/models/{dashboard.rb → metadata/dashboard.rb} +12 -7
- data/lib/gooddata/models/{data_set.rb → metadata/data_set.rb} +5 -4
- data/lib/gooddata/models/metadata/date_dimension.rb +26 -0
- data/lib/gooddata/models/metadata/display_form.rb +61 -0
- data/lib/gooddata/models/metadata/fact.rb +36 -0
- data/lib/gooddata/models/metadata/folder.rb +24 -0
- data/lib/gooddata/models/metadata/metadata.rb +8 -0
- data/lib/gooddata/models/metadata/metric.rb +197 -0
- data/lib/gooddata/models/metadata/report.rb +115 -0
- data/lib/gooddata/models/{report_definition.rb → metadata/report_definition.rb} +16 -10
- data/lib/gooddata/models/metadata/schema.rb +227 -0
- data/lib/gooddata/models/model.rb +38 -1339
- data/lib/gooddata/models/models.rb +5 -2
- data/lib/gooddata/models/module_constants.rb +29 -0
- data/lib/gooddata/models/process.rb +142 -13
- data/lib/gooddata/models/profile.rb +4 -6
- data/lib/gooddata/models/project.rb +406 -136
- data/lib/gooddata/models/project_blueprint.rb +221 -0
- data/lib/gooddata/models/project_builder.rb +136 -0
- data/lib/gooddata/models/project_creator.rb +138 -0
- data/lib/gooddata/models/project_metadata.rb +11 -10
- data/lib/gooddata/models/project_role.rb +92 -0
- data/lib/gooddata/models/references/date_reference.rb +44 -0
- data/lib/gooddata/models/references/references.rb +8 -0
- data/lib/gooddata/models/references/time_reference.rb +13 -0
- data/lib/gooddata/models/report_data_result.rb +11 -11
- data/lib/gooddata/models/schedule.rb +284 -0
- data/lib/gooddata/models/schema_blueprint.rb +158 -0
- data/lib/gooddata/models/schema_builder.rb +81 -0
- data/lib/gooddata/models/tab_builder.rb +23 -0
- data/lib/gooddata/models/user.rb +165 -0
- data/lib/gooddata/version.rb +1 -1
- data/lib/templates/project/data/devs.csv +1 -1
- data/lib/templates/project/data/repos.csv +1 -1
- data/lib/templates/project/model/model.rb.erb +7 -11
- data/spec/bricks/bricks_spec.rb +2 -0
- data/spec/data/test-ci-data.csv +2 -0
- data/spec/data/test_project_model_spec.json +7 -27
- data/spec/helpers/blueprint_helper.rb +2 -0
- data/spec/helpers/cli_helper.rb +2 -0
- data/spec/helpers/connection_helper.rb +14 -1
- data/spec/helpers/project_helper.rb +16 -0
- data/spec/helpers/schema_helper.rb +16 -0
- data/spec/integration/command_projects_spec.rb +7 -7
- data/spec/integration/create_from_template_spec.rb +2 -2
- data/spec/integration/full_project_spec.rb +160 -7
- data/spec/integration/partial_md_export_import_spec.rb +3 -3
- data/spec/logging_in_logging_out_spec.rb +2 -1
- data/spec/spec_helper.rb +26 -4
- data/spec/unit/bricks/bricks_spec.rb +15 -7
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +2 -0
- data/spec/unit/cli/cli_spec.rb +2 -0
- data/spec/unit/cli/commands/cmd_api_spec.rb +23 -15
- data/spec/unit/cli/commands/cmd_auth_spec.rb +8 -4
- data/spec/unit/cli/commands/cmd_domain_spec.rb +82 -0
- data/spec/unit/cli/commands/cmd_process_spec.rb +29 -13
- data/spec/unit/cli/commands/cmd_project_spec.rb +51 -30
- data/spec/unit/cli/commands/cmd_role_spec.rb +44 -0
- data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +8 -4
- data/spec/unit/cli/commands/cmd_scaffold_spec.rb +48 -11
- data/spec/unit/cli/commands/cmd_user_spec.rb +29 -0
- data/spec/unit/commands/command_api_spec.rb +1 -1
- data/spec/unit/commands/command_auth_spec.rb +100 -18
- data/spec/unit/commands/command_dataset_spec.rb +4 -0
- data/spec/unit/commands/command_process_spec.rb +9 -4
- data/spec/unit/commands/command_projects_spec.rb +10 -6
- data/spec/unit/commands/command_scaffold_spec.rb +5 -1
- data/spec/unit/commands/command_user_spec.rb +22 -0
- data/spec/unit/core/connection_spec.rb +35 -6
- data/spec/unit/core/logging_spec.rb +65 -0
- data/spec/unit/core/nil_logger_spec.rb +9 -0
- data/spec/unit/core/project_spec.rb +51 -0
- data/spec/unit/core/rest_spec.rb +33 -0
- data/spec/unit/data/guesser_spec.rb +5 -0
- data/spec/unit/godzilla/goodzilla_spec.rb +2 -0
- data/spec/unit/models/account_settings_spec.rb +28 -0
- data/spec/unit/models/anchor_spec.rb +32 -0
- data/spec/unit/models/attribute_column_spec.rb +7 -0
- data/spec/unit/models/domain_spec.rb +45 -0
- data/spec/unit/models/invitation_spec.rb +13 -0
- data/spec/unit/models/md_object_spec.rb +47 -0
- data/spec/unit/models/metric.rb +92 -0
- data/spec/unit/{model → models}/model_spec.rb +9 -7
- data/spec/unit/models/project_blueprint_spec.rb +202 -0
- data/spec/unit/models/project_creator.rb +73 -0
- data/spec/unit/models/project_role_spec.rb +90 -0
- data/spec/unit/models/project_spec.rb +143 -0
- data/spec/unit/models/schedule_spec.rb +491 -0
- data/spec/unit/{model → models}/schema_builder_spec.rb +2 -0
- data/spec/unit/{model → models}/tools_spec.rb +13 -7
- data/spec/unit/models/user_spec.rb +16 -0
- data/test/test_upload.rb +2 -0
- metadata +189 -86
- data/lib/gooddata/commands/profile.rb +0 -11
- data/lib/gooddata/models/attribute.rb +0 -29
- data/lib/gooddata/models/display_form.rb +0 -9
- data/lib/gooddata/models/fact.rb +0 -19
- data/lib/gooddata/models/metric.rb +0 -99
- data/lib/gooddata/models/report.rb +0 -89
- data/spec/data/blueprint_valid.json +0 -37
- data/spec/unit/cli/commands/cmd_profile_spec.rb +0 -16
- data/spec/unit/commands/command_profile_spec.rb +0 -18
- data/spec/unit/core/core_spec.rb +0 -7
- data/spec/unit/model/blueprint_spec.rb +0 -132
- data/spec/unit/model/project_blueprint_spec.rb +0 -44
@@ -0,0 +1,491 @@
|
|
1
|
+
require 'gooddata/models/schedule'
|
2
|
+
|
3
|
+
describe GoodData::Schedule do
|
4
|
+
TEST_CRON = '0 15 27 7 *'
|
5
|
+
|
6
|
+
TEST_DATA = {
|
7
|
+
:timezone => 'UTC',
|
8
|
+
:cron => '2 2 2 2 *'
|
9
|
+
}
|
10
|
+
|
11
|
+
TEST_PROCESS_ID = 'f12975d2-5958-4248-9c3d-4c8f2e1f067d'
|
12
|
+
|
13
|
+
SCHEDULE_ID = '53642303e4b0ae3190e464a8'
|
14
|
+
SCHEDULE_URL = '/gdc/projects/tk6192gsnav58crp6o1ahsmtuniq8khb/schedules/53642303e4b0ae3190e464a8'
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
ConnectionHelper.create_default_connection
|
18
|
+
|
19
|
+
GoodData.project = ProjectHelper::PROJECT_ID
|
20
|
+
|
21
|
+
@project = GoodData.project
|
22
|
+
@project_executable = "#{@project.title}/graph/graph.grf"
|
23
|
+
end
|
24
|
+
|
25
|
+
after(:each) do
|
26
|
+
GoodData.disconnect
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#[]' do
|
30
|
+
it 'Returns all schedules when :all passed' do
|
31
|
+
res = GoodData::Schedule[:all]
|
32
|
+
res.should_not be_nil
|
33
|
+
res.should be_a_kind_of(Array)
|
34
|
+
res.each do |schedule|
|
35
|
+
schedule.should be_a_kind_of(GoodData::Schedule)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'Returns specific schedule when schedule ID passed' do
|
40
|
+
res = GoodData::Schedule[SCHEDULE_ID]
|
41
|
+
res.should_not be_nil
|
42
|
+
res.should be_a_kind_of(GoodData::Schedule)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'Returns specific schedule when schedule URL passed' do
|
46
|
+
res = GoodData::Schedule[SCHEDULE_URL]
|
47
|
+
res.should_not be_nil
|
48
|
+
res.should be_a_kind_of(GoodData::Schedule)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#all' do
|
53
|
+
it 'Returns all schedules' do
|
54
|
+
res = GoodData::Schedule.all
|
55
|
+
res.should_not be_nil
|
56
|
+
res.should be_a_kind_of(Array)
|
57
|
+
res.each do |schedule|
|
58
|
+
schedule.should be_a_kind_of(GoodData::Schedule)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#create' do
|
64
|
+
it 'Creates new schedule if mandatory params passed' do
|
65
|
+
sched = nil
|
66
|
+
expect {
|
67
|
+
sched = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
68
|
+
}.not_to raise_error
|
69
|
+
|
70
|
+
sched.should_not be_nil
|
71
|
+
sched.delete
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'Throws exception when no process ID specified' do
|
75
|
+
expect {
|
76
|
+
sched = GoodData::Schedule.create(nil, TEST_CRON, @project_executable, TEST_DATA)
|
77
|
+
}.to raise_error 'Process ID has to be provided'
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'Throws exception when no executable specified' do
|
81
|
+
expect {
|
82
|
+
sched = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, nil, TEST_DATA)
|
83
|
+
}.to raise_error 'Executable has to be provided'
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'Throws exception when no cron is specified' do
|
87
|
+
data = TEST_DATA.deep_dup
|
88
|
+
data[:cron] = nil
|
89
|
+
expect {
|
90
|
+
sched = GoodData::Schedule.create(TEST_PROCESS_ID, nil, @project_executable, data)
|
91
|
+
}.to raise_error 'Cron schedule has to be provided'
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'Throws exception when no timezone specified' do
|
95
|
+
data = TEST_DATA.deep_dup
|
96
|
+
data[:timezone] = nil
|
97
|
+
expect {
|
98
|
+
sched = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, data)
|
99
|
+
}.to raise_error 'A timezone has to be provided'
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'Throws exception when no timezone specified' do
|
103
|
+
data = TEST_DATA.deep_dup
|
104
|
+
data[:type] = nil
|
105
|
+
expect {
|
106
|
+
sched = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, data)
|
107
|
+
}.to raise_error 'Schedule type has to be provided'
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe '#cron' do
|
112
|
+
before(:each) do
|
113
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
114
|
+
end
|
115
|
+
|
116
|
+
after(:each) do
|
117
|
+
@schedule.delete
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'Should return cron as string' do
|
121
|
+
res = @schedule.cron
|
122
|
+
res.should_not be_nil
|
123
|
+
res.should_not be_empty
|
124
|
+
res.should be_a_kind_of(String)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
describe '#cron=' do
|
129
|
+
before(:each) do
|
130
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
131
|
+
end
|
132
|
+
|
133
|
+
after(:each) do
|
134
|
+
@schedule.delete
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'Assigns the cron and marks the object dirty' do
|
138
|
+
test_cron = '2 2 2 2 *'
|
139
|
+
|
140
|
+
@schedule.cron = test_cron
|
141
|
+
expect(@schedule.cron).to eq(test_cron)
|
142
|
+
expect(@schedule.dirty).to eq(true)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe '#delete' do
|
147
|
+
it 'Should delete schedule' do
|
148
|
+
pending 'Setup test environment first'
|
149
|
+
|
150
|
+
sched = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
151
|
+
proc = GoodData::Process[TEST_PROCESS_ID]
|
152
|
+
|
153
|
+
# Delete created schedule
|
154
|
+
sched.delete
|
155
|
+
|
156
|
+
proc.schedules.each do |tmp_sched|
|
157
|
+
tmp_sched.uri.should_not equal(sched.uri)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe '#executable' do
|
163
|
+
before(:each) do
|
164
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
165
|
+
end
|
166
|
+
|
167
|
+
after(:each) do
|
168
|
+
@schedule.delete
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'Should return executable as string' do
|
172
|
+
res = @schedule.executable
|
173
|
+
res.should_not be_nil
|
174
|
+
res.should_not be_empty
|
175
|
+
res.should be_a_kind_of(String)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe '#executable=' do
|
180
|
+
before(:each) do
|
181
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
182
|
+
end
|
183
|
+
|
184
|
+
after(:each) do
|
185
|
+
@schedule.delete
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'Assigns the executable and marks the object dirty' do
|
189
|
+
test_executable = 'this/is/test.gr'
|
190
|
+
|
191
|
+
@schedule.executable = test_executable
|
192
|
+
expect(@schedule.executable).to eq(test_executable)
|
193
|
+
expect(@schedule.dirty).to eq(true)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe '#execute' do
|
198
|
+
it 'Executes schedule on process' do
|
199
|
+
pending 'Setup environment for this test'
|
200
|
+
|
201
|
+
# Create one a schedule
|
202
|
+
sched = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
203
|
+
|
204
|
+
execution_time = Time.new
|
205
|
+
execution_request = sched.execute
|
206
|
+
|
207
|
+
# Call execute
|
208
|
+
executed = false
|
209
|
+
start_time = Time.new
|
210
|
+
while (Time.new - start_time < 30)
|
211
|
+
# Check if the last execution time
|
212
|
+
sched.executions.each do |execution|
|
213
|
+
next if execution['execution'].nil? || execution['execution']['startTime'].nil?
|
214
|
+
parsed_time = Time.parse(execution['execution']['startTime'])
|
215
|
+
executed_schedule = execution_request['execution']['links']['self'] == execution['execution']['links']['self']
|
216
|
+
if (execution_time <= parsed_time && executed_schedule)
|
217
|
+
executed = true
|
218
|
+
break
|
219
|
+
end
|
220
|
+
end
|
221
|
+
break if executed
|
222
|
+
sleep 1
|
223
|
+
end
|
224
|
+
|
225
|
+
expect(executed).to be(true)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
describe '#execution_url' do
|
230
|
+
before(:each) do
|
231
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
232
|
+
end
|
233
|
+
|
234
|
+
after(:each) do
|
235
|
+
@schedule.delete
|
236
|
+
end
|
237
|
+
|
238
|
+
it 'Should return execution URL as string' do
|
239
|
+
res = @schedule.execution_url
|
240
|
+
res.should_not be_nil
|
241
|
+
res.should_not be_empty
|
242
|
+
res.should be_a_kind_of(String)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
describe '#type' do
|
247
|
+
before(:each) do
|
248
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
249
|
+
end
|
250
|
+
|
251
|
+
after(:each) do
|
252
|
+
@schedule.delete
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'Should return execution type as string' do
|
256
|
+
res = @schedule.type
|
257
|
+
res.should_not be_nil
|
258
|
+
res.should be_a_kind_of(String)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe '#hidden_params' do
|
263
|
+
before(:each) do
|
264
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
265
|
+
end
|
266
|
+
|
267
|
+
after(:each) do
|
268
|
+
@schedule.delete
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'Should return execution hidden_params as hash' do
|
272
|
+
res = @schedule.hidden_params
|
273
|
+
res.should_not be_nil
|
274
|
+
res.should be_a_kind_of(Hash)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
describe '#hidden_params=' do
|
279
|
+
before(:each) do
|
280
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
281
|
+
end
|
282
|
+
|
283
|
+
after(:each) do
|
284
|
+
@schedule.delete
|
285
|
+
end
|
286
|
+
|
287
|
+
it 'Assigns the hidden params and marks the object dirty' do
|
288
|
+
@old_params = @schedule.hidden_params
|
289
|
+
|
290
|
+
test_params = {
|
291
|
+
'PROCESS_ID' => '1-2-3-4'
|
292
|
+
}
|
293
|
+
|
294
|
+
@schedule.hidden_params = test_params
|
295
|
+
expect(@schedule.hidden_params).to eq(@old_params.merge(test_params))
|
296
|
+
expect(@schedule.dirty).to eq(true)
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
describe '#params' do
|
301
|
+
before(:each) do
|
302
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
303
|
+
end
|
304
|
+
|
305
|
+
after(:each) do
|
306
|
+
@schedule.delete
|
307
|
+
end
|
308
|
+
|
309
|
+
it 'Should return execution params as hash' do
|
310
|
+
res = @schedule.params
|
311
|
+
res.should_not be_nil
|
312
|
+
res.should_not be_empty
|
313
|
+
res.should be_a_kind_of(Hash)
|
314
|
+
end
|
315
|
+
end
|
316
|
+
|
317
|
+
describe '#params=' do
|
318
|
+
before(:each) do
|
319
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
320
|
+
end
|
321
|
+
|
322
|
+
after(:each) do
|
323
|
+
@schedule.delete
|
324
|
+
end
|
325
|
+
|
326
|
+
it 'Assigns the params and marks the object dirty' do
|
327
|
+
@old_params = @schedule.params
|
328
|
+
|
329
|
+
test_params = {
|
330
|
+
'PROCESS_ID' => '1-2-3-4'
|
331
|
+
}
|
332
|
+
|
333
|
+
@schedule.params = test_params
|
334
|
+
expect(@schedule.params).to eq(@old_params.merge(test_params))
|
335
|
+
expect(@schedule.dirty).to eq(true)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
describe '#process_id' do
|
340
|
+
before(:each) do
|
341
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
342
|
+
end
|
343
|
+
|
344
|
+
after(:each) do
|
345
|
+
@schedule.delete
|
346
|
+
end
|
347
|
+
|
348
|
+
it 'Should return process id as string' do
|
349
|
+
res = @schedule.process_id
|
350
|
+
res.should_not be_nil
|
351
|
+
res.should_not be_empty
|
352
|
+
res.should be_a_kind_of(String)
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
356
|
+
describe '#process_id=' do
|
357
|
+
before(:each) do
|
358
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
359
|
+
end
|
360
|
+
|
361
|
+
after(:each) do
|
362
|
+
@schedule.delete
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'Assigns the process_id and marks the object dirty' do
|
366
|
+
test_process_id = '1-2-3-4'
|
367
|
+
|
368
|
+
@schedule.process_id = test_process_id
|
369
|
+
expect(@schedule.process_id).to eq(test_process_id)
|
370
|
+
expect(@schedule.dirty).to eq(true)
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
describe '#save' do
|
375
|
+
before(:each) do
|
376
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
377
|
+
end
|
378
|
+
|
379
|
+
after(:each) do
|
380
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
381
|
+
end
|
382
|
+
|
383
|
+
it 'Should save a schedule' do
|
384
|
+
saved = false
|
385
|
+
url = "/gdc/projects/#{ProjectHelper::PROJECT_ID}/schedules"
|
386
|
+
req = GoodData.get url
|
387
|
+
schedules = req['schedules']['items']
|
388
|
+
schedules.each do |schedule|
|
389
|
+
schedule_self = schedule['schedule']['links']['self']
|
390
|
+
if schedule_self == @schedule.uri
|
391
|
+
saved = true
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
395
|
+
@schedule.timezone = 'UTC'
|
396
|
+
|
397
|
+
@schedule.save
|
398
|
+
|
399
|
+
expect(saved).to be(true)
|
400
|
+
|
401
|
+
end
|
402
|
+
|
403
|
+
end
|
404
|
+
|
405
|
+
describe '#state' do
|
406
|
+
before(:each) do
|
407
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
408
|
+
end
|
409
|
+
|
410
|
+
after(:each) do
|
411
|
+
@schedule.delete
|
412
|
+
end
|
413
|
+
|
414
|
+
it 'Should return execution state as string' do
|
415
|
+
res = @schedule.state
|
416
|
+
res.should_not be_nil
|
417
|
+
res.should_not be_empty
|
418
|
+
res.should be_a_kind_of(String)
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
describe '#type' do
|
423
|
+
before(:each) do
|
424
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
425
|
+
end
|
426
|
+
|
427
|
+
after(:each) do
|
428
|
+
@schedule.delete
|
429
|
+
end
|
430
|
+
|
431
|
+
it 'Should return execution type as string' do
|
432
|
+
res = @schedule.type
|
433
|
+
res.should_not be_nil
|
434
|
+
res.should_not be_empty
|
435
|
+
res.should be_a_kind_of(String)
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
describe '#type=' do
|
440
|
+
before(:each) do
|
441
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
442
|
+
end
|
443
|
+
|
444
|
+
after(:each) do
|
445
|
+
@schedule.delete
|
446
|
+
end
|
447
|
+
|
448
|
+
it 'Assigns the type the object dirty' do
|
449
|
+
test_type = 'TEST'
|
450
|
+
|
451
|
+
@schedule.type = test_type
|
452
|
+
expect(@schedule.type).to eq(test_type)
|
453
|
+
expect(@schedule.dirty).to eq(true)
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
describe '#timezone' do
|
458
|
+
before(:each) do
|
459
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
460
|
+
end
|
461
|
+
|
462
|
+
after(:each) do
|
463
|
+
@schedule.delete
|
464
|
+
end
|
465
|
+
|
466
|
+
it 'Should return timezone as string' do
|
467
|
+
res = @schedule.timezone
|
468
|
+
res.should_not be_nil
|
469
|
+
res.should_not be_empty
|
470
|
+
res.should be_a_kind_of(String)
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
describe '#timezone=' do
|
475
|
+
before(:each) do
|
476
|
+
@schedule = GoodData::Schedule.create(TEST_PROCESS_ID, TEST_CRON, @project_executable, TEST_DATA)
|
477
|
+
end
|
478
|
+
|
479
|
+
after(:each) do
|
480
|
+
@schedule.delete
|
481
|
+
end
|
482
|
+
|
483
|
+
it 'Assigns the timezone and marks the object dirty' do
|
484
|
+
test_timezone = 'PST'
|
485
|
+
|
486
|
+
@schedule.timezone = test_timezone
|
487
|
+
expect(@schedule.timezone).to eq(test_timezone)
|
488
|
+
expect(@schedule.dirty).to eq(true)
|
489
|
+
end
|
490
|
+
end
|
491
|
+
end
|