daengine 0.5.13 → 0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +5 -0
- data/app/controllers/digital_assets_controller.rb +29 -46
- data/app/helpers/digital_assets_helper.rb +11 -2
- data/app/models/content_service_resource.rb +15 -15
- data/app/models/digital_asset.rb +83 -94
- data/app/models/teamsite_digital_asset_shim.rb +253 -0
- data/app/service/digital_asset_lookup_service.rb +47 -47
- data/bin/process_assets +6 -7
- data/bin/process_availability +7 -8
- data/bin/process_taxonomy +7 -8
- data/config/routes.rb +7 -7
- data/lib/daengine.rb +1 -13
- data/lib/daengine/content_service_processor.rb +24 -24
- data/lib/daengine/digital_asset_processor.rb +4 -0
- data/lib/daengine/teamsite_metadata_parser.rb +3 -2
- data/lib/daengine/version.rb +1 -1
- data/lib/tasks/daengine_tasks.rake +0 -9
- data/spec/acceptance/digital_assets_spec.rb +116 -0
- data/spec/controllers/digital_assets_controller_spec.rb +14 -99
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +8802 -0
- data/spec/factories.rb +8 -32
- data/spec/lib/content_service_processor_spec.rb +30 -30
- data/spec/lib/teamsite_metadata_parser_spec.rb +26 -19
- data/spec/mock_data/bulk-ssc_deploy.xml +900 -900
- data/spec/mock_data/daengine.yml +1 -1
- data/spec/mock_data/digitalAssets/GK-66261382-96be-4a92-839a-73467e89e1b4.txt +289 -289
- data/spec/mock_data/digitalAssets/TEST_FINRA_DOC.doc +0 -0
- data/spec/mock_data/digitalAssets/m_gyt-709d8ae1-31f1-46ea-b448-33f43dd5140f.html +1008 -1008
- data/spec/mock_data/selective_new_package.xml +55 -2
- data/spec/mock_data/taxonomy/taxonomyengine.yml +1 -1
- data/spec/models/digital_asset_spec.rb +23 -28
- data/spec/service/digital_asset_lookup_service_spec.rb +75 -79
- data/spec/spec_helper.rb +18 -1
- metadata +23 -7
- data/lib/daengine/digital_asset_extension_processor.rb +0 -28
- data/spec/lib/digital_asset_extension_processor_spec.rb +0 -32
- data/spec/mock_data/merrill_lynch_extension.json +0 -5
data/spec/mock_data/daengine.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
last_read_time:
|
1
|
+
last_read_time: 2014-01-29 15:53:44 -0700
|
@@ -1,290 +1,290 @@
|
|
1
|
-
1) Daengine::TeamsiteMetadataParser#parse_tuple_file reads xml
|
2
|
-
Failure/Error: expect {
|
3
|
-
count should have been changed by 2, but was changed by -2
|
4
|
-
# ./spec/lib/teamsite_metadata_parser_spec.rb:11:in `(root)'
|
5
|
-
|
6
|
-
2) Daengine::TeamsiteMetadataParser#parse_tuple_file can read a whole bulk dep
|
7
|
-
oy xml file quickly
|
8
|
-
Failure/Error: expect {
|
9
|
-
count should have been changed by 1578, but was changed by -31
|
10
|
-
# ./spec/lib/teamsite_metadata_parser_spec.rb:24:in `(root)'
|
11
|
-
|
12
|
-
3) Daengine::TeamsiteMetadataParser deleting paths deletes paths that are no-l
|
13
|
-
nger in the tuples for a package
|
14
|
-
Failure/Error: DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').do
|
15
|
-
uments.should have(2).items
|
16
|
-
Mongoid::Errors::DocumentNotFound:
|
17
|
-
Document not found for class DigitalAsset with id(s) 163742d3-fbc2-4c99-8
|
18
|
-
96-6eabe7464b8f.
|
19
|
-
# ./spec/lib/teamsite_metadata_parser_spec.rb:37:in `(root)'
|
20
|
-
|
21
|
-
4) Daengine::TeamsiteMetadataParser remove unpublished documents from mongo re
|
22
|
-
oves package records from mongo that are in unpublished state
|
23
|
-
Failure/Error: DigitalAsset.find('11570991-9887-46df-8c47-d0870e6b5008').do
|
24
|
-
uments.should have(1).item
|
25
|
-
Mongoid::Errors::DocumentNotFound:
|
26
|
-
Document not found for class DigitalAsset with id(s) 11570991-9887-46df-8
|
27
|
-
47-d0870e6b5008.
|
28
|
-
# ./spec/lib/teamsite_metadata_parser_spec.rb:51:in `(root)'
|
29
|
-
|
30
|
-
5) DigitalAsset#finders has a finder by fund_id
|
31
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
32
|
-
3'],
|
33
|
-
NoMethodError:
|
34
|
-
undefined method `fund_ids=' for #<DigitalAsset:0xabe269>
|
35
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
36
|
-
|
37
|
-
6) DigitalAsset#finders has a finder by product_id
|
38
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
39
|
-
3'],
|
40
|
-
NoMethodError:
|
41
|
-
undefined method `fund_ids=' for #<DigitalAsset:0x9d618c>
|
42
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
43
|
-
|
44
|
-
7) DigitalAsset#finders has a finder by sami_code
|
45
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
46
|
-
3'],
|
47
|
-
NoMethodError:
|
48
|
-
undefined method `fund_ids=' for #<DigitalAsset:0x11b9f8f>
|
49
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
50
|
-
|
51
|
-
8) DigitalAsset#finders has a finder by the embedded doc path
|
52
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
53
|
-
3'],
|
54
|
-
NoMethodError:
|
55
|
-
undefined method `fund_ids=' for #<DigitalAsset:0x10be713>
|
56
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
57
|
-
|
58
|
-
9) DigitalAsset#finders has a type finder for the documents
|
59
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
60
|
-
3'],
|
61
|
-
NoMethodError:
|
62
|
-
undefined method `fund_ids=' for #<DigitalAsset:0x11e5313>
|
63
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
64
|
-
|
65
|
-
10) DigitalAsset#finders can chain finders together
|
66
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
67
|
-
3'],
|
68
|
-
NoMethodError:
|
69
|
-
undefined method `fund_ids=' for #<DigitalAsset:0x1a667d0>
|
70
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
71
|
-
|
72
|
-
11) DigitalAsset#finders has a finder for stale documents
|
73
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
74
|
-
3'],
|
75
|
-
NoMethodError:
|
76
|
-
undefined method `fund_ids=' for #<DigitalAsset:0x15cbf25>
|
77
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
78
|
-
|
79
|
-
12) DigitalAsset#finders has a method that tells you if the bulk-file processi
|
80
|
-
g is working
|
81
|
-
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
82
|
-
3'],
|
83
|
-
NoMethodError:
|
84
|
-
undefined method `fund_ids=' for #<DigitalAsset:0xee2bd2>
|
85
|
-
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
86
|
-
|
87
|
-
13) DigitalAssetLookupService#document-query supports query by product_id
|
88
|
-
Failure/Error: DigitalAsset.where(query).should have(2).digital_asset
|
89
|
-
expected 2 digital_asset, got 53
|
90
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:29:in `(root)'
|
91
|
-
|
92
|
-
14) DigitalAssetLookupService#document-query supports query by content_type_id
|
93
|
-
|
94
|
-
Failure/Error: DigitalAsset.where(query).should have(1).digital_asset
|
95
|
-
expected 1 digital_asset, got 2
|
96
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:42:in `(root)'
|
97
|
-
|
98
|
-
15) DigitalAssetLookupService#document-query supports query by product_id and
|
99
|
-
ontent_type_id
|
100
|
-
Failure/Error: DigitalAsset.where(query).should have(1).digital_asset
|
101
|
-
expected 1 digital_asset, got 3
|
102
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:49:in `(root)'
|
103
|
-
|
104
|
-
16) DigitalAssetLookupService#document-query supports query by product_id and
|
105
|
-
ontent_type_id and audiences
|
106
|
-
Failure/Error: DigitalAsset.where(query).should have(1).digital_asset
|
107
|
-
expected 1 digital_asset, got 4
|
108
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:56:in `(root)'
|
109
|
-
|
110
|
-
17) DigitalAssetLookupService#document-query supports service query by product
|
111
|
-
type_id
|
112
|
-
Failure/Error: DigitalAssetLookupService.find_documents_by_query(['420']).s
|
113
|
-
ould have(2).digital_asset
|
114
|
-
expected 2 digital_asset, got 60
|
115
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:59:in `(root)'
|
116
|
-
|
117
|
-
18) DigitalAssetLookupService#document-query supports service query by content
|
118
|
-
type_id
|
119
|
-
Failure/Error: DigitalAssetLookupService.find_documents_by_query(nil, ['909
|
120
|
-
]).should have(1).digital_asset
|
121
|
-
expected 1 digital_asset, got 6
|
122
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:68:in `(root)'
|
123
|
-
|
124
|
-
19) DigitalAssetLookupService#document-query supports service query by product
|
125
|
-
type_id and content_type_id
|
126
|
-
Failure/Error: DigitalAssetLookupService.find_documents_by_query(['303','42
|
127
|
-
'], '909').should have(1).digital_asset
|
128
|
-
expected 1 digital_asset, got 7
|
129
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:72:in `(root)'
|
130
|
-
|
131
|
-
20) DigitalAssetLookupService#document-query supports service query by product
|
132
|
-
type_id, content_type_id and audience_ids
|
133
|
-
Failure/Error: DigitalAssetLookupService.find_documents_by_query(['303','42
|
134
|
-
'], '909', ['690']).should have(1).digital_asset
|
135
|
-
expected 1 digital_asset, got 8
|
136
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:75:in `(root)'
|
137
|
-
|
138
|
-
21) DigitalAssetLookupService#document-query supports service query by product
|
139
|
-
type_id and finra
|
140
|
-
Failure/Error: DigitalAssetLookupService.find_documents_by_query('420',nil,
|
141
|
-
il,true).should have(1).digital_asset
|
142
|
-
expected 1 digital_asset, got 9
|
143
|
-
# ./spec/service/digital_asset_lookup_service_spec.rb:78:in `(root)'
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc on disk! Removing from metadata
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
C:\dev\projects\daengine>rspec spec\lib\teamsite_metadata_parser_spec.rb
|
152
|
-
JRuby limited openssl loaded. http://jruby.org/openssl
|
153
|
-
gem install jruby-openssl for full support.
|
154
|
-
[2012-09-04 15:08:55] TeamsiteMetadataParser: Unable to locate file C:/dev/proje
|
155
|
-
cts/daengine/spec/mock_data/digitalAssets/SSC_Developer_Installation_Guide-16374
|
156
|
-
2d3-fbc2-4c99-8396-6eabe7464b8f.doc on disk! Removing from metadata
|
157
|
-
[2012-09-04 15:08:55] TeamsiteMetadataParser: Unable to locate file C:/dev/proje
|
158
|
-
cts/daengine/spec/mock_data/digitalAssets/FormsLit_2012_05_01_DesignSpecs-163742d3-fbc2-4c99-8396-6eabe7464b8f.pdf on disk! Removing from metadata
|
159
|
-
[2012-09-04 15:08:55] TeamsiteMetadataParser: Unable to locate file C:/dev/proje
|
160
|
-
cts/daengine/spec/mock_data/digitalAssets/FormsLit_2012_05_01_DesignSpecs-821c7077-b39a-4efb-9ef4-350220e09d07.pdf on disk! Removing from metadata
|
161
|
-
[2012-09-04 15:08:55] TeamsiteMetadataParser: 0 records added, 0 updated, 2 remo
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
require 'spec_helper'
|
167
|
-
|
168
|
-
describe Daengine::DigitalAssetProcessor do
|
169
|
-
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
170
|
-
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
171
|
-
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data'
|
172
|
-
) }
|
173
|
-
context "process_tuple_directory" do
|
174
|
-
|
175
|
-
it 'check orderable flag' do
|
176
|
-
# process bulk deploy file in the mock dir
|
177
|
-
p " !! da count #{DigitalAsset.count}"
|
178
|
-
FileUtils.touch Dir.glob(Dir.pwd+'/spec/mock_data/bulk-ssc_deploy.xml')
|
179
|
-
#DigitalAsset.count.should == 0
|
180
|
-
File.stub(:exist?) { true }
|
181
|
-
File.stub(:mtime) { Time.now }
|
182
|
-
Daengine::DigitalAssetProcessor.process_tuple_directory
|
183
|
-
result = DigitalAsset.all
|
184
|
-
result.each{ |da| da.update_attribute(:orderable,true)}
|
185
|
-
Daengine::DigitalAssetProcessor.process_tuple_directory
|
186
|
-
DigitalAsset.first.orderable.should be true
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
end
|
191
|
-
|
192
|
-
require 'spec_helper'
|
193
|
-
|
194
|
-
describe Daengine::TeamsiteMetadataParser do
|
195
|
-
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
196
|
-
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
197
|
-
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data/'
|
198
|
-
) }
|
199
|
-
#subject { Daengine::TeamsiteMetadataParser }
|
200
|
-
|
201
|
-
context "#parse_tuple_file" do
|
202
|
-
it 'reads xml' do
|
203
|
-
# subject.logger= Logger.new(STDOUT)
|
204
|
-
p " !! da count #{DigitalAsset.count}"
|
205
|
-
DigitalAsset.delete_all
|
206
|
-
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
207
|
-
expect {
|
208
|
-
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
209
|
-
}.to change(DigitalAsset, :count).by(2)
|
210
|
-
entered = DigitalAsset.first
|
211
|
-
entered.id.should == '163742d3-fbc2-4c99-8396-6eabe7464b8f'
|
212
|
-
entered.documents[0].path.should == '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
213
|
-
entered.summary.should == 'first foo bar...'
|
214
|
-
DigitalAsset.first.documents.count.should eq(2)
|
215
|
-
end
|
216
|
-
|
217
|
-
end
|
218
|
-
|
219
|
-
end
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
require 'spec_helper'
|
227
|
-
|
228
|
-
describe Daengine::TeamsiteMetadataParser do
|
229
|
-
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
230
|
-
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
231
|
-
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data/'
|
232
|
-
) }
|
233
|
-
subject { Daengine::TeamsiteMetadataParser }
|
234
|
-
|
235
|
-
context "#parse_tuple_file" do
|
236
|
-
it 'reads xml' do
|
237
|
-
# subject.logger= Logger.new(STDOUT)
|
238
|
-
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
239
|
-
expect {
|
240
|
-
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
241
|
-
}.to change(DigitalAsset, :count).by(2)
|
242
|
-
entered = DigitalAsset.first
|
243
|
-
entered.id.should == '163742d3-fbc2-4c99-8396-6eabe7464b8f'
|
244
|
-
entered.documents[0].path.should == '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
245
|
-
entered.summary.should == 'first foo bar...'
|
246
|
-
DigitalAsset.first.documents.count.should eq(2)
|
247
|
-
end
|
248
|
-
it 'can read a whole bulk deploy xml file quickly' do
|
249
|
-
# subject.logger= Logger.new(STDOUT)
|
250
|
-
file = File.expand_path('./spec/mock_data/bulk-ssc_deploy.xml')
|
251
|
-
open_file = open(file, 'rb')
|
252
|
-
expect {
|
253
|
-
subject.parse_tuple_file(open_file,'2011-09-04 11:59:47 -0600')
|
254
|
-
}.to change(DigitalAsset.count).by(34)
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
context 'deleting paths' do
|
259
|
-
before do
|
260
|
-
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
261
|
-
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
262
|
-
end
|
263
|
-
it 'deletes paths that are no-longer in the tuples for a package' do
|
264
|
-
file = File.expand_path('./spec/mock_data/selective_path_delete_from_package.xml')
|
265
|
-
DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').documents.should have(2).items
|
266
|
-
expect {
|
267
|
-
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
268
|
-
}.to change(DigitalAsset, :count).by(0)
|
269
|
-
DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').documents.should have(1).item
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
context 'remove unpublished documents from mongo' do
|
274
|
-
before do
|
275
|
-
file = File.expand_path('./spec/mock_data/selective-ssc_2012_05_18_13_48_03_publish.xml')
|
276
|
-
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
277
|
-
end
|
278
|
-
it 'removes package records from mongo that are in unpublished state' do
|
279
|
-
DigitalAsset.find('11570991-9887-46df-8c47-d0870e6b5008').documents.should have(1).item
|
280
|
-
file = File.expand_path('./spec/mock_data/selective-ssc_2012_05_18_13_56_18_unpublish.xml')
|
281
|
-
expect {
|
282
|
-
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
283
|
-
}.to change(DigitalAsset, :count).by(-1)
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
|
-
end
|
288
|
-
|
289
|
-
|
1
|
+
1) Daengine::TeamsiteMetadataParser#parse_tuple_file reads xml
|
2
|
+
Failure/Error: expect {
|
3
|
+
count should have been changed by 2, but was changed by -2
|
4
|
+
# ./spec/lib/teamsite_metadata_parser_spec.rb:11:in `(root)'
|
5
|
+
|
6
|
+
2) Daengine::TeamsiteMetadataParser#parse_tuple_file can read a whole bulk dep
|
7
|
+
oy xml file quickly
|
8
|
+
Failure/Error: expect {
|
9
|
+
count should have been changed by 1578, but was changed by -31
|
10
|
+
# ./spec/lib/teamsite_metadata_parser_spec.rb:24:in `(root)'
|
11
|
+
|
12
|
+
3) Daengine::TeamsiteMetadataParser deleting paths deletes paths that are no-l
|
13
|
+
nger in the tuples for a package
|
14
|
+
Failure/Error: DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').do
|
15
|
+
uments.should have(2).items
|
16
|
+
Mongoid::Errors::DocumentNotFound:
|
17
|
+
Document not found for class DigitalAsset with id(s) 163742d3-fbc2-4c99-8
|
18
|
+
96-6eabe7464b8f.
|
19
|
+
# ./spec/lib/teamsite_metadata_parser_spec.rb:37:in `(root)'
|
20
|
+
|
21
|
+
4) Daengine::TeamsiteMetadataParser remove unpublished documents from mongo re
|
22
|
+
oves package records from mongo that are in unpublished state
|
23
|
+
Failure/Error: DigitalAsset.find('11570991-9887-46df-8c47-d0870e6b5008').do
|
24
|
+
uments.should have(1).item
|
25
|
+
Mongoid::Errors::DocumentNotFound:
|
26
|
+
Document not found for class DigitalAsset with id(s) 11570991-9887-46df-8
|
27
|
+
47-d0870e6b5008.
|
28
|
+
# ./spec/lib/teamsite_metadata_parser_spec.rb:51:in `(root)'
|
29
|
+
|
30
|
+
5) DigitalAsset#finders has a finder by fund_id
|
31
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
32
|
+
3'],
|
33
|
+
NoMethodError:
|
34
|
+
undefined method `fund_ids=' for #<DigitalAsset:0xabe269>
|
35
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
36
|
+
|
37
|
+
6) DigitalAsset#finders has a finder by product_id
|
38
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
39
|
+
3'],
|
40
|
+
NoMethodError:
|
41
|
+
undefined method `fund_ids=' for #<DigitalAsset:0x9d618c>
|
42
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
43
|
+
|
44
|
+
7) DigitalAsset#finders has a finder by sami_code
|
45
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
46
|
+
3'],
|
47
|
+
NoMethodError:
|
48
|
+
undefined method `fund_ids=' for #<DigitalAsset:0x11b9f8f>
|
49
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
50
|
+
|
51
|
+
8) DigitalAsset#finders has a finder by the embedded doc path
|
52
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
53
|
+
3'],
|
54
|
+
NoMethodError:
|
55
|
+
undefined method `fund_ids=' for #<DigitalAsset:0x10be713>
|
56
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
57
|
+
|
58
|
+
9) DigitalAsset#finders has a type finder for the documents
|
59
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
60
|
+
3'],
|
61
|
+
NoMethodError:
|
62
|
+
undefined method `fund_ids=' for #<DigitalAsset:0x11e5313>
|
63
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
64
|
+
|
65
|
+
10) DigitalAsset#finders can chain finders together
|
66
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
67
|
+
3'],
|
68
|
+
NoMethodError:
|
69
|
+
undefined method `fund_ids=' for #<DigitalAsset:0x1a667d0>
|
70
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
71
|
+
|
72
|
+
11) DigitalAsset#finders has a finder for stale documents
|
73
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
74
|
+
3'],
|
75
|
+
NoMethodError:
|
76
|
+
undefined method `fund_ids=' for #<DigitalAsset:0x15cbf25>
|
77
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
78
|
+
|
79
|
+
12) DigitalAsset#finders has a method that tells you if the bulk-file processi
|
80
|
+
g is working
|
81
|
+
Failure/Error: @asset = FactoryGirl.create :digital_asset, :fund_ids => ['3
|
82
|
+
3'],
|
83
|
+
NoMethodError:
|
84
|
+
undefined method `fund_ids=' for #<DigitalAsset:0xee2bd2>
|
85
|
+
# ./spec/models/digital_asset_spec.rb:60:in `(root)'
|
86
|
+
|
87
|
+
13) DigitalAssetLookupService#document-query supports query by product_id
|
88
|
+
Failure/Error: DigitalAsset.where(query).should have(2).digital_asset
|
89
|
+
expected 2 digital_asset, got 53
|
90
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:29:in `(root)'
|
91
|
+
|
92
|
+
14) DigitalAssetLookupService#document-query supports query by content_type_id
|
93
|
+
|
94
|
+
Failure/Error: DigitalAsset.where(query).should have(1).digital_asset
|
95
|
+
expected 1 digital_asset, got 2
|
96
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:42:in `(root)'
|
97
|
+
|
98
|
+
15) DigitalAssetLookupService#document-query supports query by product_id and
|
99
|
+
ontent_type_id
|
100
|
+
Failure/Error: DigitalAsset.where(query).should have(1).digital_asset
|
101
|
+
expected 1 digital_asset, got 3
|
102
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:49:in `(root)'
|
103
|
+
|
104
|
+
16) DigitalAssetLookupService#document-query supports query by product_id and
|
105
|
+
ontent_type_id and audiences
|
106
|
+
Failure/Error: DigitalAsset.where(query).should have(1).digital_asset
|
107
|
+
expected 1 digital_asset, got 4
|
108
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:56:in `(root)'
|
109
|
+
|
110
|
+
17) DigitalAssetLookupService#document-query supports service query by product
|
111
|
+
type_id
|
112
|
+
Failure/Error: DigitalAssetLookupService.find_documents_by_query(['420']).s
|
113
|
+
ould have(2).digital_asset
|
114
|
+
expected 2 digital_asset, got 60
|
115
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:59:in `(root)'
|
116
|
+
|
117
|
+
18) DigitalAssetLookupService#document-query supports service query by content
|
118
|
+
type_id
|
119
|
+
Failure/Error: DigitalAssetLookupService.find_documents_by_query(nil, ['909
|
120
|
+
]).should have(1).digital_asset
|
121
|
+
expected 1 digital_asset, got 6
|
122
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:68:in `(root)'
|
123
|
+
|
124
|
+
19) DigitalAssetLookupService#document-query supports service query by product
|
125
|
+
type_id and content_type_id
|
126
|
+
Failure/Error: DigitalAssetLookupService.find_documents_by_query(['303','42
|
127
|
+
'], '909').should have(1).digital_asset
|
128
|
+
expected 1 digital_asset, got 7
|
129
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:72:in `(root)'
|
130
|
+
|
131
|
+
20) DigitalAssetLookupService#document-query supports service query by product
|
132
|
+
type_id, content_type_id and audience_ids
|
133
|
+
Failure/Error: DigitalAssetLookupService.find_documents_by_query(['303','42
|
134
|
+
'], '909', ['690']).should have(1).digital_asset
|
135
|
+
expected 1 digital_asset, got 8
|
136
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:75:in `(root)'
|
137
|
+
|
138
|
+
21) DigitalAssetLookupService#document-query supports service query by product
|
139
|
+
type_id and finra
|
140
|
+
Failure/Error: DigitalAssetLookupService.find_documents_by_query('420',nil,
|
141
|
+
il,true).should have(1).digital_asset
|
142
|
+
expected 1 digital_asset, got 9
|
143
|
+
# ./spec/service/digital_asset_lookup_service_spec.rb:78:in `(root)'
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc on disk! Removing from metadata
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
C:\dev\projects\daengine>rspec spec\lib\teamsite_metadata_parser_spec.rb
|
152
|
+
JRuby limited openssl loaded. http://jruby.org/openssl
|
153
|
+
gem install jruby-openssl for full support.
|
154
|
+
[2012-09-04 15:08:55] TeamsiteMetadataParser: Unable to locate file C:/dev/proje
|
155
|
+
cts/daengine/spec/mock_data/digitalAssets/SSC_Developer_Installation_Guide-16374
|
156
|
+
2d3-fbc2-4c99-8396-6eabe7464b8f.doc on disk! Removing from metadata
|
157
|
+
[2012-09-04 15:08:55] TeamsiteMetadataParser: Unable to locate file C:/dev/proje
|
158
|
+
cts/daengine/spec/mock_data/digitalAssets/FormsLit_2012_05_01_DesignSpecs-163742d3-fbc2-4c99-8396-6eabe7464b8f.pdf on disk! Removing from metadata
|
159
|
+
[2012-09-04 15:08:55] TeamsiteMetadataParser: Unable to locate file C:/dev/proje
|
160
|
+
cts/daengine/spec/mock_data/digitalAssets/FormsLit_2012_05_01_DesignSpecs-821c7077-b39a-4efb-9ef4-350220e09d07.pdf on disk! Removing from metadata
|
161
|
+
[2012-09-04 15:08:55] TeamsiteMetadataParser: 0 records added, 0 updated, 2 remo
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
require 'spec_helper'
|
167
|
+
|
168
|
+
describe Daengine::DigitalAssetProcessor do
|
169
|
+
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
170
|
+
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
171
|
+
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data'
|
172
|
+
) }
|
173
|
+
context "process_tuple_directory" do
|
174
|
+
|
175
|
+
it 'check orderable flag' do
|
176
|
+
# process bulk deploy file in the mock dir
|
177
|
+
p " !! da count #{DigitalAsset.count}"
|
178
|
+
FileUtils.touch Dir.glob(Dir.pwd+'/spec/mock_data/bulk-ssc_deploy.xml')
|
179
|
+
#DigitalAsset.count.should == 0
|
180
|
+
File.stub(:exist?) { true }
|
181
|
+
File.stub(:mtime) { Time.now }
|
182
|
+
Daengine::DigitalAssetProcessor.process_tuple_directory
|
183
|
+
result = DigitalAsset.all
|
184
|
+
result.each{ |da| da.update_attribute(:orderable,true)}
|
185
|
+
Daengine::DigitalAssetProcessor.process_tuple_directory
|
186
|
+
DigitalAsset.first.orderable.should be true
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
require 'spec_helper'
|
193
|
+
|
194
|
+
describe Daengine::TeamsiteMetadataParser do
|
195
|
+
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
196
|
+
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
197
|
+
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data/'
|
198
|
+
) }
|
199
|
+
#subject { Daengine::TeamsiteMetadataParser }
|
200
|
+
|
201
|
+
context "#parse_tuple_file" do
|
202
|
+
it 'reads xml' do
|
203
|
+
# subject.logger= Logger.new(STDOUT)
|
204
|
+
p " !! da count #{DigitalAsset.count}"
|
205
|
+
DigitalAsset.delete_all
|
206
|
+
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
207
|
+
expect {
|
208
|
+
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
209
|
+
}.to change(DigitalAsset, :count).by(2)
|
210
|
+
entered = DigitalAsset.first
|
211
|
+
entered.id.should == '163742d3-fbc2-4c99-8396-6eabe7464b8f'
|
212
|
+
entered.documents[0].path.should == '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
213
|
+
entered.summary.should == 'first foo bar...'
|
214
|
+
DigitalAsset.first.documents.count.should eq(2)
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
require 'spec_helper'
|
227
|
+
|
228
|
+
describe Daengine::TeamsiteMetadataParser do
|
229
|
+
before { Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
|
230
|
+
:daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
|
231
|
+
:digital_assets_file_directory => Dir.pwd + '/spec/mock_data/'
|
232
|
+
) }
|
233
|
+
subject { Daengine::TeamsiteMetadataParser }
|
234
|
+
|
235
|
+
context "#parse_tuple_file" do
|
236
|
+
it 'reads xml' do
|
237
|
+
# subject.logger= Logger.new(STDOUT)
|
238
|
+
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
239
|
+
expect {
|
240
|
+
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
241
|
+
}.to change(DigitalAsset, :count).by(2)
|
242
|
+
entered = DigitalAsset.first
|
243
|
+
entered.id.should == '163742d3-fbc2-4c99-8396-6eabe7464b8f'
|
244
|
+
entered.documents[0].path.should == '/digitalAssets/SSC_Developer_Installation_Guide-163742d3-fbc2-4c99-8396-6eabe7464b8f.doc'
|
245
|
+
entered.summary.should == 'first foo bar...'
|
246
|
+
DigitalAsset.first.documents.count.should eq(2)
|
247
|
+
end
|
248
|
+
it 'can read a whole bulk deploy xml file quickly' do
|
249
|
+
# subject.logger= Logger.new(STDOUT)
|
250
|
+
file = File.expand_path('./spec/mock_data/bulk-ssc_deploy.xml')
|
251
|
+
open_file = open(file, 'rb')
|
252
|
+
expect {
|
253
|
+
subject.parse_tuple_file(open_file,'2011-09-04 11:59:47 -0600')
|
254
|
+
}.to change(DigitalAsset.count).by(34)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
context 'deleting paths' do
|
259
|
+
before do
|
260
|
+
file = File.expand_path('./spec/mock_data/selective_new_package.xml')
|
261
|
+
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
262
|
+
end
|
263
|
+
it 'deletes paths that are no-longer in the tuples for a package' do
|
264
|
+
file = File.expand_path('./spec/mock_data/selective_path_delete_from_package.xml')
|
265
|
+
DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').documents.should have(2).items
|
266
|
+
expect {
|
267
|
+
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
268
|
+
}.to change(DigitalAsset, :count).by(0)
|
269
|
+
DigitalAsset.find('163742d3-fbc2-4c99-8396-6eabe7464b8f').documents.should have(1).item
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
context 'remove unpublished documents from mongo' do
|
274
|
+
before do
|
275
|
+
file = File.expand_path('./spec/mock_data/selective-ssc_2012_05_18_13_48_03_publish.xml')
|
276
|
+
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
277
|
+
end
|
278
|
+
it 'removes package records from mongo that are in unpublished state' do
|
279
|
+
DigitalAsset.find('11570991-9887-46df-8c47-d0870e6b5008').documents.should have(1).item
|
280
|
+
file = File.expand_path('./spec/mock_data/selective-ssc_2012_05_18_13_56_18_unpublish.xml')
|
281
|
+
expect {
|
282
|
+
subject.parse_tuple_file(open(file),'2011-09-04 11:59:47 -0600')
|
283
|
+
}.to change(DigitalAsset, :count).by(-1)
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
|
290
290
|
ects/daengine/spec/mock_data/digitalAssets/Apache_Tomcat7-User_Guide-11570991-9887-46df-8c47-d0870e6b5008.pdf on disk! Removing from metadata
|