gooddata 0.6.43 → 0.6.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -4
- data/lib/gooddata/commands/datasets.rb +2 -2
- data/lib/gooddata/core/logging.rb +1 -1
- data/lib/gooddata/exceptions/maql_execution.rb +16 -0
- data/lib/gooddata/extensions/string.rb +3 -3
- data/lib/gooddata/helpers/global_helpers.rb +3 -3
- data/lib/gooddata/helpers/global_helpers_params.rb +1 -1
- data/lib/gooddata/lcm/lcm.rb +7 -9
- data/lib/gooddata/models/blueprint/blueprint_field.rb +2 -2
- data/lib/gooddata/models/blueprint/dataset_blueprint.rb +1 -1
- data/lib/gooddata/models/domain.rb +1 -1
- data/lib/gooddata/models/membership.rb +2 -2
- data/lib/gooddata/models/metadata.rb +1 -1
- data/lib/gooddata/models/metadata/dashboard.rb +1 -1
- data/lib/gooddata/models/metadata/folder.rb +10 -10
- data/lib/gooddata/models/process.rb +3 -5
- data/lib/gooddata/models/profile.rb +4 -4
- data/lib/gooddata/models/project.rb +17 -7
- data/lib/gooddata/models/project_creator.rb +30 -42
- data/lib/gooddata/models/report_data_result.rb +3 -3
- data/lib/gooddata/rest/client.rb +1 -1
- data/lib/gooddata/rest/connection.rb +85 -132
- data/lib/gooddata/version.rb +1 -1
- data/spec/environment/develop.rb +4 -4
- data/spec/integration/blueprint_updates_spec.rb +1 -1
- data/spec/integration/full_project_spec.rb +10 -7
- data/spec/integration/schedule_spec.rb +0 -2
- data/spec/logging_in_logging_out_spec.rb +2 -2
- data/spec/unit/models/project_creator_spec.rb +46 -98
- metadata +3 -2
@@ -49,7 +49,7 @@ describe 'Create project using GoodData client', :constraint => 'slow' do
|
|
49
49
|
reference: 'attr.commits.factsof',
|
50
50
|
name: 'anchor_label')
|
51
51
|
end
|
52
|
-
@project.update_from_blueprint(bp,
|
52
|
+
@project.update_from_blueprint(bp, maql_replacements: { "PRESERVE DATA" => ""})
|
53
53
|
data = [
|
54
54
|
['label.commits.factsof.id', 'fact.commits.lines_changed', 'committed_on', 'dataset.devs', 'dataset.repos'],
|
55
55
|
['111', 1, '01/01/2011', '1', '1'],
|
@@ -31,7 +31,7 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
31
31
|
|
32
32
|
it "should do nothing if the project is updated with the same blueprint" do
|
33
33
|
results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
|
34
|
-
expect(results).to
|
34
|
+
expect(results).to eq []
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should try to rename a dataset back' do
|
@@ -40,20 +40,19 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
40
40
|
dataset.save
|
41
41
|
|
42
42
|
# Now the update of project using the original blueprint should offer update of the title. Nothing else.
|
43
|
-
results = GoodData::Model::ProjectCreator.migrate_datasets(@blueprint, project: @project, client: @client, dry_run: true)
|
44
43
|
results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
|
45
|
-
expect(results['updateScript']['
|
44
|
+
expect(results.first['updateScript']['maqlDdlChunks']).to eq ["ALTER DATASET {dataset.repos} VISUAL(TITLE \"Repositories\", DESCRIPTION \"\");\n"]
|
46
45
|
|
47
46
|
# Update using a freshly gained blueprint should offer no changes.
|
48
47
|
new_blueprint = @project.blueprint
|
49
48
|
results = GoodData::Model::ProjectCreator.migrate_datasets(new_blueprint, project: @project, client: @client, dry_run: true)
|
50
|
-
expect(results).to
|
49
|
+
expect(results).to eq []
|
51
50
|
|
52
51
|
# When we change the model using the original blueprint. Basically change the title back.
|
53
52
|
results = @project.update_from_blueprint(@spec)
|
54
53
|
# It should offer no changes using the original blueprint
|
55
54
|
results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
|
56
|
-
expect(results).to
|
55
|
+
expect(results).to eq []
|
57
56
|
end
|
58
57
|
|
59
58
|
it "should contain datasets" do
|
@@ -470,12 +469,16 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
470
469
|
|
471
470
|
it "should be able to give you values for" do
|
472
471
|
attribute = @project.attributes('attr.devs.dev_id')
|
473
|
-
|
472
|
+
values = attribute.labels.find { |l| l.identifier == 'label.devs.dev_id.email'}.values.to_a
|
473
|
+
id = values.find { |v| v[:value] == 'tomas@gooddata.com' }[:uri][-1].to_i
|
474
|
+
expect(attribute.values_for(id)).to eq ['tomas@gooddata.com', '1']
|
474
475
|
end
|
475
476
|
|
476
477
|
it "should be able to find specific element and give you the primary label value" do
|
477
478
|
attribute = @project.attributes('attr.devs.dev_id')
|
478
|
-
|
479
|
+
values = attribute.labels.find { |l| l.identifier == 'label.devs.dev_id.email'}.values.to_a
|
480
|
+
uri = values.find { |v| v[:value] == 'tomas@gooddata.com' }[:uri]
|
481
|
+
expect(@project.find_attribute_element_value(uri)).to eq 'tomas@gooddata.com'
|
479
482
|
end
|
480
483
|
|
481
484
|
it "should be able to give you label by name" do
|
@@ -13,9 +13,7 @@ describe GoodData::Schedule do
|
|
13
13
|
|
14
14
|
before(:all) do
|
15
15
|
@client = ConnectionHelper.create_default_connection
|
16
|
-
|
17
16
|
@project = ProjectHelper.get_default_project(:client => @client)
|
18
|
-
|
19
17
|
# ScheduleHelper.remove_old_schedules(@project)
|
20
18
|
# ProcessHelper.remove_old_processes(@project)
|
21
19
|
end
|
@@ -86,8 +86,8 @@ describe GoodData::Rest::Connection, :constraint => 'slow' do
|
|
86
86
|
it "should be able to regenerate TT" do
|
87
87
|
regular_client = ConnectionHelper::create_default_connection
|
88
88
|
projects = regular_client.projects
|
89
|
-
regular_client.connection.
|
89
|
+
regular_client.connection.headers.delete(:x_gdc_authtt)
|
90
90
|
regular_client.get('/gdc/md')
|
91
|
-
expect(regular_client.connection.
|
91
|
+
expect(regular_client.connection.headers).to have_key :x_gdc_authtt
|
92
92
|
end
|
93
93
|
end
|
@@ -8,7 +8,7 @@ require 'gooddata/models/project_creator'
|
|
8
8
|
|
9
9
|
describe GoodData::Model::ProjectCreator do
|
10
10
|
|
11
|
-
|
11
|
+
before(:each) do
|
12
12
|
# Priority is
|
13
13
|
#
|
14
14
|
# [cascadeDrops, preserveData],
|
@@ -16,112 +16,60 @@ describe GoodData::Model::ProjectCreator do
|
|
16
16
|
# [false, false],
|
17
17
|
# [true, true],
|
18
18
|
# [true, false]
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
'maqlDdlChunks' => "b"
|
29
|
-
}}
|
30
|
-
]
|
31
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data)
|
32
|
-
chunk.should == {
|
33
|
-
'updateScript' => {
|
34
|
-
'cascadeDrops' => false,
|
35
|
-
'preserveData' => true,
|
36
|
-
'maqlDdlChunks' => "a"
|
37
|
-
}}
|
19
|
+
#
|
20
|
+
# The data is ordered in descending priority
|
21
|
+
@chunk_a = {
|
22
|
+
'updateScript' => {
|
23
|
+
'cascadeDrops' => false,
|
24
|
+
'preserveData' => true,
|
25
|
+
'maqlDdlChunks' => 'a'
|
26
|
+
}
|
27
|
+
}
|
38
28
|
|
29
|
+
@chunk_b = {
|
30
|
+
'updateScript' => {
|
31
|
+
'cascadeDrops' => false,
|
32
|
+
'preserveData' => false,
|
33
|
+
'maqlDdlChunks' => 'b'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
@chunk_c = {
|
37
|
+
'updateScript' => {
|
38
|
+
'cascadeDrops' => true,
|
39
|
+
'preserveData' => true,
|
40
|
+
'maqlDdlChunks' => 'c'
|
41
|
+
}
|
42
|
+
}
|
39
43
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
'cascadeDrops' => true,
|
48
|
-
'preserveData' => false,
|
49
|
-
'maqlDdlChunks' => "b"
|
50
|
-
}}
|
51
|
-
]
|
52
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data)
|
53
|
-
chunk.should == {
|
54
|
-
'updateScript' => {
|
55
|
-
'cascadeDrops' => true,
|
56
|
-
'preserveData' => true,
|
57
|
-
'maqlDdlChunks' => "a"
|
58
|
-
}}
|
44
|
+
@chunk_d = {
|
45
|
+
'updateScript' => {
|
46
|
+
'cascadeDrops' => true,
|
47
|
+
'preserveData' => false,
|
48
|
+
'maqlDdlChunks' => 'd'
|
49
|
+
}
|
50
|
+
}
|
59
51
|
|
52
|
+
@data = [@chunk_a, @chunk_b, @chunk_c, @chunk_d]
|
60
53
|
|
61
|
-
data = [
|
62
|
-
{ 'updateScript' => {
|
63
|
-
'cascadeDrops' => true,
|
64
|
-
'preserveData' => false,
|
65
|
-
'maqlDdlChunks' => "a"
|
66
|
-
}},
|
67
|
-
{ 'updateScript' => {
|
68
|
-
'cascadeDrops' => true,
|
69
|
-
'preserveData' => true,
|
70
|
-
'maqlDdlChunks' => "b"
|
71
|
-
}}
|
72
|
-
]
|
73
|
-
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data)
|
74
|
-
chunk.should == {
|
75
|
-
'updateScript' => {
|
76
|
-
'cascadeDrops' => true,
|
77
|
-
'preserveData' => true,
|
78
|
-
'maqlDdlChunks' => "b"
|
79
|
-
}}
|
80
54
|
end
|
81
55
|
|
82
|
-
it 'should pick correct update chunk based on
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
'preserveData' => false,
|
87
|
-
'maqlDdlChunks' => "a"
|
88
|
-
}},
|
89
|
-
{ 'updateScript' => {
|
90
|
-
'cascadeDrops' => true,
|
91
|
-
'preserveData' => true,
|
92
|
-
'maqlDdlChunks' => "b"
|
93
|
-
}}
|
94
|
-
]
|
56
|
+
it 'should pick correct update chunk based on priority' do
|
57
|
+
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data)
|
58
|
+
expect(chunk).to eq [@chunk_a]
|
59
|
+
end
|
95
60
|
|
96
|
-
|
97
|
-
chunk.
|
98
|
-
|
99
|
-
'cascadeDrops' => true,
|
100
|
-
'preserveData' => false,
|
101
|
-
'maqlDdlChunks' => "a"
|
102
|
-
}}
|
61
|
+
it 'should pick correct update chunk based on your preference if it is possible to satisfy it' do
|
62
|
+
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false})
|
63
|
+
expect(chunk).to eq [@chunk_d]
|
103
64
|
end
|
104
65
|
|
105
|
-
it 'should pick correct update
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
'preserveData' => true,
|
110
|
-
'maqlDdlChunks' => "a"
|
111
|
-
}},
|
112
|
-
{ 'updateScript' => {
|
113
|
-
'cascadeDrops' => false,
|
114
|
-
'preserveData' => true,
|
115
|
-
'maqlDdlChunks' => "b"
|
116
|
-
}}
|
117
|
-
]
|
66
|
+
it 'should pick correct update chunks based on your preference if it is possible to satisfy it and the preference is ambiguous' do
|
67
|
+
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true })
|
68
|
+
expect(chunk).to eq [@chunk_c, @chunk_d]
|
69
|
+
end
|
118
70
|
|
119
|
-
|
120
|
-
chunk.
|
121
|
-
|
122
|
-
'cascadeDrops' => false,
|
123
|
-
'preserveData' => true,
|
124
|
-
'maqlDdlChunks' => "b"
|
125
|
-
}}
|
71
|
+
it 'should not pick a chunk if it is not possible to satisfy it based on your preference' do
|
72
|
+
chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false, unmeetable_condition: true})
|
73
|
+
expect(chunk).to eq []
|
126
74
|
end
|
127
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gooddata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kolesnikov
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-10-
|
14
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -685,6 +685,7 @@ files:
|
|
685
685
|
- lib/gooddata/exceptions/execution_limit_exceeded.rb
|
686
686
|
- lib/gooddata/exceptions/filter_maqlization.rb
|
687
687
|
- lib/gooddata/exceptions/malformed_user.rb
|
688
|
+
- lib/gooddata/exceptions/maql_execution.rb
|
688
689
|
- lib/gooddata/exceptions/no_project_error.rb
|
689
690
|
- lib/gooddata/exceptions/object_migration.rb
|
690
691
|
- lib/gooddata/exceptions/project_not_found.rb
|