lucid_works 0.7.18 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/.rvmrc +2 -3
  2. data/Gemfile +2 -8
  3. data/Gemfile.lock +45 -53
  4. data/README.rdoc +2 -6
  5. data/Rakefile +1 -1
  6. data/config/locales/en.yml +221 -239
  7. data/lib/lucid_works/activity.rb +8 -5
  8. data/lib/lucid_works/base.rb +27 -16
  9. data/lib/lucid_works/cache.rb +13 -0
  10. data/lib/lucid_works/cluster.rb +84 -0
  11. data/lib/lucid_works/collection/settings.rb +15 -6
  12. data/lib/lucid_works/collection.rb +62 -92
  13. data/lib/lucid_works/datasource/history.rb +2 -1
  14. data/lib/lucid_works/datasource/mapping.rb +12 -0
  15. data/lib/lucid_works/datasource/schedule.rb +5 -2
  16. data/lib/lucid_works/datasource/status.rb +3 -2
  17. data/lib/lucid_works/datasource.rb +31 -48
  18. data/lib/lucid_works/datasource_property.rb +2 -1
  19. data/lib/lucid_works/datasource_type.rb +14 -0
  20. data/lib/lucid_works/dynamicfield.rb +12 -0
  21. data/lib/lucid_works/elevation.rb +93 -0
  22. data/lib/lucid_works/exceptions.rb +0 -4
  23. data/lib/lucid_works/field.rb +31 -111
  24. data/lib/lucid_works/field_commons.rb +133 -0
  25. data/lib/lucid_works/gem_version.rb +1 -1
  26. data/lib/lucid_works/inflections.rb +3 -0
  27. data/lib/lucid_works/patch_time.rb +4 -0
  28. data/lib/lucid_works/request_handler.rb +16 -0
  29. data/lib/lucid_works/role.rb +23 -8
  30. data/lib/lucid_works/schema/attribute.rb +1 -1
  31. data/lib/lucid_works/schema/boolean_attribute.rb +1 -1
  32. data/lib/lucid_works/schema/integer_attribute.rb +3 -4
  33. data/lib/lucid_works/server/crawlers_status.rb +15 -0
  34. data/lib/lucid_works/server.rb +35 -14
  35. data/lib/lucid_works/simple_naming.rb +1 -7
  36. data/lib/lucid_works/synonym.rb +1 -1
  37. data/lib/lucid_works/version.rb +1 -0
  38. data/lib/lucid_works.rb +8 -1
  39. data/lucid_works.gemspec +8 -9
  40. data/spec/fixtures/zookeeper/clusterstate.json +30 -0
  41. data/spec/fixtures/zookeeper/clusterstate_broken_shard.json +29 -0
  42. data/spec/fixtures/zookeeper/live_nodes.json +28 -0
  43. data/spec/fixtures/zookeeper/live_nodes_no_children.json +26 -0
  44. data/spec/fixtures/zookeeper/live_nodes_one_child.json +36 -0
  45. data/spec/lib/lucid_works/base_spec.rb +33 -24
  46. data/spec/lib/lucid_works/cache_spec.rb +44 -0
  47. data/spec/lib/lucid_works/cluster_spec.rb +109 -0
  48. data/spec/lib/lucid_works/collection/activity_spec.rb +29 -0
  49. data/spec/lib/lucid_works/collection/prime_activities_spec.rb +1 -1
  50. data/spec/lib/lucid_works/collection/settings_spec.rb +31 -0
  51. data/spec/lib/lucid_works/collection_spec.rb +166 -107
  52. data/spec/lib/lucid_works/datasource/schedule_spec.rb +75 -46
  53. data/spec/lib/lucid_works/datasource/status_spec.rb +5 -5
  54. data/spec/lib/lucid_works/datasource_property_spec.rb +41 -0
  55. data/spec/lib/lucid_works/datasource_spec.rb +40 -12
  56. data/spec/lib/lucid_works/datasource_type_spec.rb +31 -0
  57. data/spec/lib/lucid_works/dynamicfield_spec.rb +214 -0
  58. data/spec/lib/lucid_works/elevation_spec.rb +175 -0
  59. data/spec/lib/lucid_works/field_spec.rb +52 -21
  60. data/spec/lib/lucid_works/fieldtype_spec.rb +0 -1
  61. data/spec/lib/lucid_works/request_handler_spec.rb +11 -0
  62. data/spec/lib/lucid_works/role_spec.rb +77 -0
  63. data/spec/lib/lucid_works/server/crawlers_status_spec.rb +21 -0
  64. data/spec/lib/lucid_works/server_spec.rb +123 -22
  65. data/spec/lib/lucid_works/{collection/synonym_spec.rb → synonym_spec.rb} +23 -22
  66. data/spec/lib/lucid_works/version_spec.rb +6 -0
  67. metadata +132 -64
  68. data/spec/lib/lucid_works/collection/acl_config_spec.rb +0 -212
metadata CHANGED
@@ -1,104 +1,131 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid_works
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.18
5
- prerelease:
4
+ prerelease:
5
+ version: 0.9.4
6
6
  platform: ruby
7
7
  authors:
8
- - Sam Pierson
9
- autorequire:
8
+ - Lucid Imagination
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-19 00:00:00.000000000Z
12
+ date: 2013-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2153358420 !ruby/object:Gem::Requirement
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: !binary |-
21
+ NA==
17
22
  none: false
23
+ requirement: !ruby/object:Gem::Requirement
18
24
  requirements:
19
- - - ! '>='
25
+ - - ">="
20
26
  - !ruby/object:Gem::Version
21
- version: '3'
22
- type: :runtime
27
+ version: !binary |-
28
+ NA==
29
+ none: false
23
30
  prerelease: false
24
- version_requirements: *2153358420
31
+ type: :runtime
25
32
  - !ruby/object:Gem::Dependency
26
33
  name: activemodel
27
- requirement: &2153357920 !ruby/object:Gem::Requirement
34
+ version_requirements: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: !binary |-
39
+ NA==
28
40
  none: false
41
+ requirement: !ruby/object:Gem::Requirement
29
42
  requirements:
30
- - - ! '>='
43
+ - - ">="
31
44
  - !ruby/object:Gem::Version
32
- version: '3'
33
- type: :runtime
45
+ version: !binary |-
46
+ NA==
47
+ none: false
34
48
  prerelease: false
35
- version_requirements: *2153357920
49
+ type: :runtime
36
50
  - !ruby/object:Gem::Dependency
37
51
  name: rest-client
38
- requirement: &2153357460 !ruby/object:Gem::Requirement
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '='
55
+ - !ruby/object:Gem::Version
56
+ version: 1.6.7
39
57
  none: false
58
+ requirement: !ruby/object:Gem::Requirement
40
59
  requirements:
41
- - - ! '>='
60
+ - - '='
42
61
  - !ruby/object:Gem::Version
43
- version: 1.6.1
44
- type: :runtime
62
+ version: 1.6.7
63
+ none: false
45
64
  prerelease: false
46
- version_requirements: *2153357460
65
+ type: :runtime
47
66
  - !ruby/object:Gem::Dependency
48
67
  name: json
49
- requirement: &2153357080 !ruby/object:Gem::Requirement
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: !binary |-
73
+ MA==
50
74
  none: false
75
+ requirement: !ruby/object:Gem::Requirement
51
76
  requirements:
52
- - - ! '>='
77
+ - - ">="
53
78
  - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
79
+ version: !binary |-
80
+ MA==
81
+ none: false
56
82
  prerelease: false
57
- version_requirements: *2153357080
83
+ type: :runtime
58
84
  - !ruby/object:Gem::Dependency
59
85
  name: rsolr
60
- requirement: &2153356620 !ruby/object:Gem::Requirement
61
- none: false
86
+ version_requirements: !ruby/object:Gem::Requirement
62
87
  requirements:
63
- - - ! '>='
88
+ - - '='
64
89
  - !ruby/object:Gem::Version
65
- version: '0'
66
- type: :runtime
67
- prerelease: false
68
- version_requirements: *2153356620
69
- - !ruby/object:Gem::Dependency
70
- name: rsolr-ext
71
- requirement: &2153373340 !ruby/object:Gem::Requirement
90
+ version: 1.0.9
72
91
  none: false
92
+ requirement: !ruby/object:Gem::Requirement
73
93
  requirements:
74
- - - ! '>='
94
+ - - '='
75
95
  - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :runtime
96
+ version: 1.0.9
97
+ none: false
78
98
  prerelease: false
79
- version_requirements: *2153373340
99
+ type: :runtime
80
100
  - !ruby/object:Gem::Dependency
81
101
  name: nokogiri
82
- requirement: &2153372920 !ruby/object:Gem::Requirement
102
+ version_requirements: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: !binary |-
107
+ MA==
83
108
  none: false
109
+ requirement: !ruby/object:Gem::Requirement
84
110
  requirements:
85
- - - ! '>='
111
+ - - ">="
86
112
  - !ruby/object:Gem::Version
87
- version: '0'
88
- type: :runtime
113
+ version: !binary |-
114
+ MA==
115
+ none: false
89
116
  prerelease: false
90
- version_requirements: *2153372920
117
+ type: :runtime
91
118
  description: Ruby wrapper for the LucidWorks REST API
92
119
  email:
93
- - sam.pierson@lucidimagination.com
120
+ - support@lucidimagination.com
94
121
  executables: []
95
122
  extensions: []
96
123
  extra_rdoc_files: []
97
124
  files:
98
- - .autotest
99
- - .gitignore
100
- - .rspec
101
- - .rvmrc
125
+ - ".autotest"
126
+ - ".gitignore"
127
+ - ".rspec"
128
+ - ".rvmrc"
102
129
  - Gemfile
103
130
  - Gemfile.lock
104
131
  - LICENSE
@@ -115,6 +142,8 @@ files:
115
142
  - lib/lucid_works/associations/has_one.rb
116
143
  - lib/lucid_works/associations/proxy.rb
117
144
  - lib/lucid_works/base.rb
145
+ - lib/lucid_works/cache.rb
146
+ - lib/lucid_works/cluster.rb
118
147
  - lib/lucid_works/collection.rb
119
148
  - lib/lucid_works/collection/click.rb
120
149
  - lib/lucid_works/collection/index.rb
@@ -126,14 +155,19 @@ files:
126
155
  - lib/lucid_works/datasource/history.rb
127
156
  - lib/lucid_works/datasource/index.rb
128
157
  - lib/lucid_works/datasource/job.rb
158
+ - lib/lucid_works/datasource/mapping.rb
129
159
  - lib/lucid_works/datasource/schedule.rb
130
160
  - lib/lucid_works/datasource/status.rb
131
161
  - lib/lucid_works/datasource_property.rb
132
162
  - lib/lucid_works/datasource_type.rb
163
+ - lib/lucid_works/dynamicfield.rb
164
+ - lib/lucid_works/elevation.rb
133
165
  - lib/lucid_works/exceptions.rb
134
166
  - lib/lucid_works/field.rb
167
+ - lib/lucid_works/field_commons.rb
135
168
  - lib/lucid_works/fieldtype.rb
136
169
  - lib/lucid_works/gem_version.rb
170
+ - lib/lucid_works/inflections.rb
137
171
  - lib/lucid_works/jdbcdriver.rb
138
172
  - lib/lucid_works/logs.rb
139
173
  - lib/lucid_works/logs/index.rb
@@ -142,6 +176,7 @@ files:
142
176
  - lib/lucid_works/logs/query/summary.rb
143
177
  - lib/lucid_works/patch_restclient.rb
144
178
  - lib/lucid_works/patch_time.rb
179
+ - lib/lucid_works/request_handler.rb
145
180
  - lib/lucid_works/role.rb
146
181
  - lib/lucid_works/schema.rb
147
182
  - lib/lucid_works/schema/attribute.rb
@@ -152,6 +187,7 @@ files:
152
187
  - lib/lucid_works/schema/list_attribute.rb
153
188
  - lib/lucid_works/schema/string_attribute.rb
154
189
  - lib/lucid_works/server.rb
190
+ - lib/lucid_works/server/crawlers_status.rb
155
191
  - lib/lucid_works/simple_naming.rb
156
192
  - lib/lucid_works/synonym.rb
157
193
  - lib/lucid_works/utils.rb
@@ -164,55 +200,72 @@ files:
164
200
  - spec/fixtures/fake_file_ds_to_get_status_of/.gitkeep
165
201
  - spec/fixtures/fake_file_ds_to_mess_with_job_of/.gitkeep
166
202
  - spec/fixtures/fake_file_ds_to_test_progress/.gitkeep
203
+ - spec/fixtures/zookeeper/clusterstate.json
204
+ - spec/fixtures/zookeeper/clusterstate_broken_shard.json
205
+ - spec/fixtures/zookeeper/live_nodes.json
206
+ - spec/fixtures/zookeeper/live_nodes_no_children.json
207
+ - spec/fixtures/zookeeper/live_nodes_one_child.json
167
208
  - spec/lib/lucid_works/associations/has_many_spec.rb
168
209
  - spec/lib/lucid_works/associations/has_one_spec.rb
169
210
  - spec/lib/lucid_works/associations_spec.rb
170
211
  - spec/lib/lucid_works/base_spec.rb
171
- - spec/lib/lucid_works/collection/acl_config_spec.rb
212
+ - spec/lib/lucid_works/cache_spec.rb
213
+ - spec/lib/lucid_works/cluster_spec.rb
172
214
  - spec/lib/lucid_works/collection/activity/history_spec.rb
173
215
  - spec/lib/lucid_works/collection/activity/status_spec.rb
174
216
  - spec/lib/lucid_works/collection/activity_spec.rb
175
217
  - spec/lib/lucid_works/collection/prime_activities_spec.rb
176
- - spec/lib/lucid_works/collection/synonym_spec.rb
218
+ - spec/lib/lucid_works/collection/settings_spec.rb
177
219
  - spec/lib/lucid_works/collection_spec.rb
178
220
  - spec/lib/lucid_works/datasource/history_spec.rb
179
221
  - spec/lib/lucid_works/datasource/schedule_spec.rb
180
222
  - spec/lib/lucid_works/datasource/status_spec.rb
223
+ - spec/lib/lucid_works/datasource_property_spec.rb
181
224
  - spec/lib/lucid_works/datasource_spec.rb
225
+ - spec/lib/lucid_works/datasource_type_spec.rb
226
+ - spec/lib/lucid_works/dynamicfield_spec.rb
227
+ - spec/lib/lucid_works/elevation_spec.rb
182
228
  - spec/lib/lucid_works/field_spec.rb
183
229
  - spec/lib/lucid_works/fieldtype_spec.rb
184
230
  - spec/lib/lucid_works/patch_time_spec.rb
231
+ - spec/lib/lucid_works/request_handler_spec.rb
232
+ - spec/lib/lucid_works/role_spec.rb
185
233
  - spec/lib/lucid_works/schema/attribute_spec.rb
186
234
  - spec/lib/lucid_works/schema_spec.rb
235
+ - spec/lib/lucid_works/server/crawlers_status_spec.rb
187
236
  - spec/lib/lucid_works/server_spec.rb
237
+ - spec/lib/lucid_works/synonym_spec.rb
188
238
  - spec/lib/lucid_works/utils_spec.rb
239
+ - spec/lib/lucid_works/version_spec.rb
189
240
  - spec/spec_helper.rb
190
241
  - spec/support/active_model_lint.rb
191
242
  - spec/support/lucid_works.rb
192
- homepage: ''
243
+ homepage: http://github.com/lucidimagination/lucidworks-ruby
193
244
  licenses: []
194
- post_install_message:
245
+ post_install_message:
195
246
  rdoc_options: []
196
247
  require_paths:
197
248
  - lib
198
249
  required_ruby_version: !ruby/object:Gem::Requirement
199
- none: false
200
250
  requirements:
201
- - - ! '>='
251
+ - - ">="
202
252
  - !ruby/object:Gem::Version
203
- version: '0'
204
- required_rubygems_version: !ruby/object:Gem::Requirement
253
+ version: !binary |-
254
+ MA==
205
255
  none: false
256
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
257
  requirements:
207
- - - ! '>='
258
+ - - ">="
208
259
  - !ruby/object:Gem::Version
209
- version: '0'
260
+ version: !binary |-
261
+ MA==
262
+ none: false
210
263
  requirements: []
211
264
  rubyforge_project: lucid_works
212
- rubygems_version: 1.8.6
213
- signing_key:
265
+ rubygems_version: 1.8.24
266
+ signing_key:
214
267
  specification_version: 3
215
- summary: Ruby wrapper for the LucidWorks REST API
268
+ summary: LucidWorks REST API client
216
269
  test_files:
217
270
  - spec/fixtures/fake_file_ds_to_be_deleted/.gitkeep
218
271
  - spec/fixtures/fake_file_ds_to_be_updated/.gitkeep
@@ -221,28 +274,43 @@ test_files:
221
274
  - spec/fixtures/fake_file_ds_to_get_status_of/.gitkeep
222
275
  - spec/fixtures/fake_file_ds_to_mess_with_job_of/.gitkeep
223
276
  - spec/fixtures/fake_file_ds_to_test_progress/.gitkeep
277
+ - spec/fixtures/zookeeper/clusterstate.json
278
+ - spec/fixtures/zookeeper/clusterstate_broken_shard.json
279
+ - spec/fixtures/zookeeper/live_nodes.json
280
+ - spec/fixtures/zookeeper/live_nodes_no_children.json
281
+ - spec/fixtures/zookeeper/live_nodes_one_child.json
224
282
  - spec/lib/lucid_works/associations/has_many_spec.rb
225
283
  - spec/lib/lucid_works/associations/has_one_spec.rb
226
284
  - spec/lib/lucid_works/associations_spec.rb
227
285
  - spec/lib/lucid_works/base_spec.rb
228
- - spec/lib/lucid_works/collection/acl_config_spec.rb
286
+ - spec/lib/lucid_works/cache_spec.rb
287
+ - spec/lib/lucid_works/cluster_spec.rb
229
288
  - spec/lib/lucid_works/collection/activity/history_spec.rb
230
289
  - spec/lib/lucid_works/collection/activity/status_spec.rb
231
290
  - spec/lib/lucid_works/collection/activity_spec.rb
232
291
  - spec/lib/lucid_works/collection/prime_activities_spec.rb
233
- - spec/lib/lucid_works/collection/synonym_spec.rb
292
+ - spec/lib/lucid_works/collection/settings_spec.rb
234
293
  - spec/lib/lucid_works/collection_spec.rb
235
294
  - spec/lib/lucid_works/datasource/history_spec.rb
236
295
  - spec/lib/lucid_works/datasource/schedule_spec.rb
237
296
  - spec/lib/lucid_works/datasource/status_spec.rb
297
+ - spec/lib/lucid_works/datasource_property_spec.rb
238
298
  - spec/lib/lucid_works/datasource_spec.rb
299
+ - spec/lib/lucid_works/datasource_type_spec.rb
300
+ - spec/lib/lucid_works/dynamicfield_spec.rb
301
+ - spec/lib/lucid_works/elevation_spec.rb
239
302
  - spec/lib/lucid_works/field_spec.rb
240
303
  - spec/lib/lucid_works/fieldtype_spec.rb
241
304
  - spec/lib/lucid_works/patch_time_spec.rb
305
+ - spec/lib/lucid_works/request_handler_spec.rb
306
+ - spec/lib/lucid_works/role_spec.rb
242
307
  - spec/lib/lucid_works/schema/attribute_spec.rb
243
308
  - spec/lib/lucid_works/schema_spec.rb
309
+ - spec/lib/lucid_works/server/crawlers_status_spec.rb
244
310
  - spec/lib/lucid_works/server_spec.rb
311
+ - spec/lib/lucid_works/synonym_spec.rb
245
312
  - spec/lib/lucid_works/utils_spec.rb
313
+ - spec/lib/lucid_works/version_spec.rb
246
314
  - spec/spec_helper.rb
247
315
  - spec/support/active_model_lint.rb
248
316
  - spec/support/lucid_works.rb
@@ -1,212 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "LucidWorks::Collection ACL configuration utility methods" do
4
- before :all do
5
- @server = connect_to_live_server
6
- @server.reset_collections!
7
- end
8
-
9
- describe "ACL filtering configuration" do
10
- MAGIC_ACL_ONLY_FILTER_SETTING = {'should.clause' => '*:* -data_source_type:smb'}
11
- before :all do
12
- @collection = @server.create_collection(:name => 'collection_for_acl_config_testing', :parent => @server)
13
- @initial_components = [
14
- "filterbyrole",
15
- "query",
16
- "mlt",
17
- "stats",
18
- "feedback",
19
- "highlight",
20
- "facet",
21
- "spellcheck",
22
- "debug"
23
- ]
24
- end
25
-
26
- describe '#assert_components_include_ad_xor_role' do
27
- before do
28
- @collection_for_xor = @server.collection('collection_for_acl_config_testing')
29
- end
30
- it "should not raise an exception for a new collection" do
31
- lambda {@collection_for_xor.assert_components_include_ad_xor_role}.should_not raise_error
32
- end
33
- it "should raise an exception if both are present" do;
34
- @collection_for_xor.stub(:components).and_return(@initial_components + [LucidWorks::Collection::AD_FILTERING])
35
- lambda {@collection_for_xor.assert_components_include_ad_xor_role}.should raise_error
36
- end
37
- it "should raise an exception if neither are present" do
38
- @collection_for_xor.stub(:components).and_return(@initial_components[1..-1])
39
- lambda {@collection_for_xor.assert_components_include_ad_xor_role}.should raise_error
40
- end
41
- end
42
-
43
- describe "#filtering_enabled?" do
44
- before do
45
- @collection_for_enabled = @server.collection('collection_for_acl_config_testing')
46
- end
47
-
48
- it "should be false on a new collection" do
49
- @collection_for_enabled.filtering_enabled?.should be_false
50
- end
51
-
52
- it "should be true if AD_FILTERING is in the list" do
53
- @collection_for_enabled.stub(:components).and_return(@initial_components[1..-1]+[LucidWorks::Collection::AD_FILTERING])
54
- @collection_for_enabled.filtering_enabled?.should be_true
55
- end
56
- end
57
-
58
- describe "LucidWorks::Collection#components" do
59
- it "should return a list of installed components" do
60
- @collection.components.should be_a(Array)
61
- @collection.components.sort.should == @initial_components.sort
62
- end
63
- end
64
-
65
- describe '#filtering_settings' do
66
- before do
67
- @collection_for_settings = @server.collection('collection_for_acl_config_testing')
68
- end
69
- it "should return an empty hash for a new collection" do
70
- @collection_for_settings.filtering_settings.should == {}
71
- end
72
- end
73
-
74
- describe '#compute_component_set' do
75
- before do
76
- @collection_for_component_set = @server.collection('collection_for_acl_config_testing')
77
- end
78
-
79
- it "should put ACL_FILTERING at the front if enabling" do
80
- initial_components = @initial_components.clone
81
- enabled = 'true'
82
- @collection_for_component_set.stub(:components).and_return(initial_components)
83
- initial_components.first.should_not == LucidWorks::Collection::AD_FILTERING
84
- @collection_for_component_set.compute_component_set(enabled).first.should == LucidWorks::Collection::AD_FILTERING
85
- end
86
-
87
- it "should remove ROLE_FILTERING if enabling" do
88
- initial_components = @initial_components.clone
89
- enabled = 'true'
90
- @collection_for_component_set.stub(:components).and_return(initial_components)
91
- initial_components.include?(LucidWorks::Collection::ROLE_FILTERING).should be_true
92
- @collection_for_component_set.compute_component_set(enabled).include?(LucidWorks::Collection::ROLE_FILTERING).should be_false
93
- end
94
-
95
- it "should put ROLE_FILTERING at the front if disabling" do
96
- initial_components = @initial_components.clone
97
- initial_components.delete(LucidWorks::Collection::ROLE_FILTERING)
98
- initial_components.unshift(LucidWorks::Collection::AD_FILTERING)
99
- enabled = 'false'
100
- @collection_for_component_set.stub(:components).and_return(initial_components)
101
- initial_components.first.should == LucidWorks::Collection::AD_FILTERING
102
- @collection_for_component_set.compute_component_set(enabled).first.should == LucidWorks::Collection::ROLE_FILTERING
103
- end
104
-
105
- it "should remove ACL_FILTERING if disabling" do
106
- initial_components = @initial_components.clone
107
- enabled = 'false'
108
- initial_components.delete(LucidWorks::Collection::ROLE_FILTERING)
109
- initial_components.unshift(LucidWorks::Collection::AD_FILTERING)
110
- @collection_for_component_set.stub(:components).and_return(initial_components)
111
- initial_components.include?(LucidWorks::Collection::AD_FILTERING).should be_true
112
- @collection_for_component_set.compute_component_set(enabled).include?(LucidWorks::Collection::AD_FILTERING).should be_false
113
- end
114
- end
115
-
116
- describe '#configure_filtering' do
117
- before :all do
118
- @collection_for_configure = @server.collection('collection_for_acl_config_testing')
119
- @settings = {
120
- "java.naming.provider.url"=>"ldap://184.72.197.18/",
121
- "java.naming.security.principal"=>"wma@corp.lucid.com",
122
- "java.naming.security.credentials"=>"secret",
123
- }
124
- end
125
-
126
- it "should merge in the static settings and store all of the settings" do
127
- final_settings = {
128
- "provider.class"=>"com.lucid.security.ad.ADACLTagProvider",
129
- "filterer.class"=>"com.lucid.security.WindowsACLQueryFilterer",
130
- "provider.config"=>
131
- {
132
- "java.naming.provider.url"=>"ldap://184.72.197.18/",
133
- "java.naming.security.principal"=>"wma@corp.lucid.com"
134
- },
135
- "filterer.config"=>{}
136
- }
137
-
138
- @collection_for_configure.filtering_settings.should be_blank
139
- @collection_for_configure.configure_filtering(:config => @settings, :enabled => 'true', :acl_only => true)
140
- @collection_for_configure.filtering_settings.should == final_settings
141
- end
142
-
143
- it "should work again after the settings have been saved once and a PUT is now required" do
144
- @collection_for_configure.filtering_settings.should_not be_blank
145
- lambda {
146
- @collection_for_configure.configure_filtering(:config => @settings, :enabled => 'true')
147
- }.should_not raise_error
148
- end
149
-
150
- it "should add ldap:// to url if protocol not specified" do
151
- settings = @settings.clone
152
- settings['java.naming.provider.url'] = 'foo.com'
153
- @collection_for_configure.configure_filtering(:config => settings, :enabled => 'true')
154
- @collection_for_configure.filtering_settings['provider.config']['java.naming.provider.url'].should == 'ldap://foo.com'
155
- end
156
-
157
- it "should not add ldap:// to url if blank" do
158
- settings = @settings.clone
159
- settings['java.naming.provider.url'] = ''
160
- lambda {
161
- @collection_for_configure.configure_filtering(:config => settings, :enabled => 'true')
162
- }.should raise_error {|e| e.messages.keys.first.should =~ /url\.no_url/} # because url is required
163
- end
164
-
165
- it "should add the filterer.config parameter if acl_only is false" do
166
- settings = @settings.clone
167
-
168
- @collection_for_configure.configure_filtering(:config => settings, :enabled => 'true', :acl_only => false)
169
- @collection_for_configure.filtering_settings['filterer.config'].should == MAGIC_ACL_ONLY_FILTER_SETTING
170
- end
171
-
172
- it "should remove the filterer.config parameter if acl_only is true" do
173
- settings = @settings.clone
174
- filterer_config = {}
175
-
176
- @collection_for_configure.configure_filtering(:config => settings, :enabled => 'true', :acl_only => true)
177
- @collection_for_configure.filtering_settings['filterer.config'].should == filterer_config
178
- end
179
- end
180
-
181
- describe '#acl_only?' do
182
- before :all do
183
- @collection_for_acl_only = @server.create_collection(:name => 'collection_for_acl_only_testing', :parent => @server)
184
- @settings = {
185
- "java.naming.provider.url"=>"ldap://184.72.197.18/",
186
- "java.naming.security.principal"=>"wma@corp.lucid.com",
187
- "java.naming.security.credentials"=>"secret",
188
- }
189
- end
190
-
191
- it "should default to false for a new collection" do
192
- @collection_for_acl_only_default = @server.create_collection(:name => 'collection_for_acl_only_default_testing', :parent => @server)
193
- @collection_for_acl_only.acl_only?.should be_false
194
- end
195
-
196
- it "should return true if the if configured with acl_only => true" do
197
- settings = @settings.clone
198
-
199
- @collection_for_acl_only.configure_filtering(:config => settings, :enabled => 'true', :acl_only => true)
200
- @collection_for_acl_only.acl_only?.should be_true
201
- end
202
-
203
- it "should return false if configured with acl_only => false" do
204
- settings = @settings.clone
205
-
206
- @collection_for_acl_only.configure_filtering(:config => settings, :enabled => 'true', :acl_only => false)
207
- @collection_for_acl_only.acl_only?.should be_false
208
- end
209
-
210
- end
211
- end
212
- end