solrj_wrapper 0.0.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7989bdc10a4e4a7a95890a667b9f9b86518a917
4
+ data.tar.gz: 3954aed416588570e50fdc057d6a5c612138902a
5
+ SHA512:
6
+ metadata.gz: 670af841e8fbf23f4299cb976ca769b4d21f7bc39d8990b78ce00272857c66d6c38cf4497777ca988ed3f783f54f6e33c32d041edf8006da5dfc98e62a22f0bd
7
+ data.tar.gz: 2d6f5d5021adbb3106eae923927f6afba7d3f53486601d3f9c21e62cb8365cb0ec99946280bf143f049a537103a132f8c28258efe3453b8fbdcb6dca1830a603
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore CHANGED
@@ -5,7 +5,9 @@ doc
5
5
  .yardoc
6
6
  *.lock
7
7
  solrmarc.log*
8
+ solrmarc-sw
8
9
  pkg
10
+ tmp
9
11
 
10
12
  ## vim
11
13
  *.swp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ solrj_wrapper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ jruby-1.7.9
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - jruby-19mode # JRuby in 1.9 mode
4
+ - jruby-head
5
+ script:
6
+ rake rspec_wrapped SETTINGS='ci'
7
+ cache:
8
+ directories:
9
+ - solrmarc-sw
10
+ notifications:
11
+ email:
12
+ - ndushay@stanford.edu
13
+ - laneymcg@stanford.edu
data/.yardopts ADDED
@@ -0,0 +1,3 @@
1
+ --title 'SolrjWrapper Documentation'
2
+ lib/**/*.rb -
3
+ README.rdoc LICENSE
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # See solrj_wrapper.gemspec for this gem's dependencies
4
4
  gemspec
data/README.rdoc CHANGED
@@ -1,5 +1,8 @@
1
1
  = SolrjWrapper
2
2
 
3
+ {<img src="https://travis-ci.org/sul-dlss/solrj_wrapper.svg" alt="Build Status" />}[https://travis-ci.org/sul-dlss/solrj_wrapper] {<img src="https://coveralls.io/repos/sul-dlss/solrj_wrapper/badge.png?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/sul-dlss/solrj_wrapper?branch=master] {<img src="https://gemnasium.com/sul-dlss/solrj_wrapper.png" alt="Dependency Status" />}[https://gemnasium.com/sul-dlss/solrj_wrapper] {<img src="https://badge.fury.io/rb/solrj_wrapper.svg" alt="Gem Version" />}[http://badge.fury.io/rb/solrj_wrapper]
4
+
5
+
3
6
  Ruby wrapper for interacting with Solrj objects, such as org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer.
4
7
 
5
8
  == Installation
@@ -24,7 +27,7 @@ Here are some examples of use cribbed from the specs:
24
27
 
25
28
  sjw = SolrjWrapper.new(solrj_jar_dir, solr_url, solrj_queue_size, solrj_num_threads)
26
29
  sjw.get_query_result_docs(q).should be_an_instance_of(Java::OrgApacheSolrCommon::SolrDocumentList)
27
- sjw.streaming_update_server.should be_an_instance_of(Java::OrgApacheSolrClientSolrjImpl::StreamingUpdateSolrServer)
30
+ sjw.query_server.should be_an_instance_of(Java::OrgApacheSolrClientSolrjImpl::HttpSolrServer)
28
31
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
29
32
  sjw.add_vals_to_fld(sid, "single", ["val"])
30
33
 
data/Rakefile CHANGED
@@ -15,8 +15,4 @@ end
15
15
 
16
16
  Dir.glob('lib/tasks/*.rake').each { |r| import r }
17
17
 
18
- namespace :sj_wrap do
19
- task :default => :ci
20
- task :rspec => :rspec_plain
21
- task :spec => :rspec_plain
22
- end
18
+ task :default => :rspec_wrapped
data/config/jetty.yml ADDED
@@ -0,0 +1,5 @@
1
+ default:
2
+ jetty_port: 8984
3
+ java_opts:
4
+ - "-XX:MaxPermSize=128m"
5
+ - "-Xmx1256m"
@@ -8,16 +8,16 @@ prod:
8
8
 
9
9
  # settings for local development
10
10
  dev:
11
- solr_url: http://127.0.0.1:8985/solr/dev
12
- solrj_jar_dir: solrmarc/dist/lib
11
+ solr_url: your_dev_solr_url
12
+ solrj_jar_dir: your_solrj_jar_dir
13
13
  solrj_queue_size: 20
14
14
  solrj_num_threads: 1
15
15
  log_level: info
16
16
 
17
17
  # settings for continuous integration
18
18
  ci:
19
- solr_url: http://127.0.0.1:8985/solr/test
20
- solrj_jar_dir: solrmarc/dist/lib
19
+ solr_url: http://localhost:8984/solr
20
+ solrj_jar_dir: solrmarc-sw/dist/lib
21
21
  solrj_queue_size: 20
22
22
  solrj_num_threads: 1
23
23
  log_level: info
@@ -1,3 +1,3 @@
1
1
  class SolrjWrapper
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/solrj_wrapper.rb CHANGED
@@ -22,9 +22,8 @@ class SolrjWrapper
22
22
  @logger = Logger.new(log_file)
23
23
  @logger.level = log_level
24
24
  load_solrj(solrj_jar_dir)
25
- @query_server = org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.new(solr_url)
26
- @streaming_update_server = org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer.new(solr_url, queue_size, num_threads)
27
- useJavabin!
25
+ @query_server = org.apache.solr.client.solrj.impl.HttpSolrServer.new(solr_url)
26
+ @streaming_update_server = @query_server
28
27
  end
29
28
 
30
29
  # send the query to Solr and get the SolrDocumentList from the response
data/lib/tasks/ci.rake CHANGED
@@ -1,9 +1,44 @@
1
- namespace :sj_wrap do
1
+ require 'jettywrapper'
2
2
 
3
- desc "run continuous integration suite (tests, coverage, docs)"
4
- task :ci do
5
- Rake::Task["sj_wrap:rspec_wrapped"].invoke
6
- Rake::Task["sj_wrap:doc"].invoke
3
+ desc "run continuous integration suite (tests, coverage, docs)"
4
+ task :ci do
5
+ Rake::Task["sj_wrap:rspec_wrapped"].invoke
6
+ Rake::Task["sj_wrap:doc"].invoke
7
+ end
8
+
9
+ desc 'clone solrmarc-sw from sul-dlss github'
10
+ task :clone_solrmarc do
11
+ `git clone https://github.com/sul-dlss/solrmarc-sw.git` unless File.directory? 'solrmarc-sw'
12
+ end
13
+
14
+ desc "set up Solr for testing in jetty"
15
+ task :setup_jetty => :clone_solrmarc do
16
+ Dir.chdir('solrmarc-sw') do
17
+ `git pull`
18
+ `ant ext_setup`
7
19
  end
20
+ end
21
+ task :setup_test_solr => :setup_jetty
22
+
23
+ desc "start jetty for running tests"
24
+ task :run_jetty do
25
+ `rm -rf solrmarc-sw/test/jetty/solr/data/index`
26
+ jetty_dir = File.expand_path(File.dirname(__FILE__) + '../../../solrmarc-sw/test/jetty')
27
+ jetty_params = Jettywrapper.load_config.merge({:jetty_home => jetty_dir,
28
+ :solr_home => jetty_dir + '/solr',
29
+ :java_opts => "-Dsolr.data.dir=" + jetty_dir + "/solr/data",
30
+ :startup_wait => 45,
31
+ :jetty_port => 8984
32
+ })
33
+ error = Jettywrapper.start(jetty_params)
34
+ end
35
+ task :jetty_start => :run_jetty
36
+ task :start_jetty => :run_jetty
8
37
 
38
+ desc "stop jetty used for testing"
39
+ task :stop_jetty do
40
+ jetty_params = Jettywrapper.load_config.merge({:jetty_home => File.expand_path(File.dirname(__FILE__) + '../../../solrmarc-sw/test/jetty'),:startup_wait => 10})
41
+ error = Jettywrapper.stop(jetty_params)
9
42
  end
43
+
44
+ task :jetty_stop => :stop_jetty
data/lib/tasks/doc.rake CHANGED
@@ -1,23 +1,19 @@
1
1
  require 'yard'
2
2
  require 'yard/rake/yardoc_task'
3
3
 
4
- namespace :sj_wrap do
5
-
6
- # Use yard to build docs
7
- begin
8
- project_root = File.expand_path(File.dirname(__FILE__) + "/../..")
9
- doc_dest_dir = File.join(project_root, 'doc')
4
+ # Use yard to build docs
5
+ begin
6
+ project_root = File.expand_path(File.dirname(__FILE__) + "/../..")
7
+ doc_dest_dir = File.join(project_root, 'doc')
10
8
 
11
- YARD::Rake::YardocTask.new(:doc) do |yt|
12
- yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
13
- [ File.join(project_root, 'README.rdoc') ]
14
- yt.options = ['--output-dir', doc_dest_dir, '--readme', 'README.rdoc', '--title', 'SolrJ_Wrapper Documentation']
15
- end
16
- rescue LoadError
17
- desc "Generate YARD Documentation"
18
- task :doc do
19
- abort "Please install the YARD gem to generate rdoc."
20
- end
21
- end
22
-
23
- end
9
+ YARD::Rake::YardocTask.new(:doc) do |yt|
10
+ yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
11
+ [ File.join(project_root, 'README.rdoc') ]
12
+ yt.options = ['--output-dir', doc_dest_dir, '--readme', 'README.rdoc', '--title', 'SolrJ_Wrapper Documentation']
13
+ end
14
+ rescue LoadError
15
+ desc "Generate YARD Documentation"
16
+ task :doc do
17
+ abort "Please install the YARD gem to generate rdoc."
18
+ end
19
+ end
data/lib/tasks/spec.rake CHANGED
@@ -1,26 +1,22 @@
1
1
  require 'rspec/core/rake_task'
2
2
 
3
- namespace :sj_wrap do
4
-
5
- desc "Run all specs, with jetty instance running"
6
- task :rspec_wrapped => ['sj_wrap:solrmarc:ant_dist_site', 'sj_wrap:jetty:config'] do
7
- test_jetty_dir = File.expand_path(File.dirname(__FILE__) + '../../../solrmarc/test/jetty')
8
- require 'jettywrapper'
9
- jetty_params = Jettywrapper.load_config.merge({
10
- :jetty_home => test_jetty_dir,
11
- :solr_home => test_jetty_dir + '/solr',
12
- :java_opts => "-Dsolr.data.dir=" + test_jetty_dir + "/solr/test/data",
13
- :jetty_port => 8985,
14
- :startup_wait => 25
15
- })
16
- error = Jettywrapper.wrap(jetty_params) do
17
- Rake::Task['sj_wrap:rspec_plain'].invoke
18
- end
19
- raise "TEST FAILURES: #{error}" if error
20
- end
21
-
22
- RSpec::Core::RakeTask.new(:rspec_plain) do |spec|
23
- spec.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
3
+ desc "Run all specs, with jetty instance running"
4
+ task :rspec_wrapped => ['setup_jetty'] do
5
+ jetty_dir = File.expand_path(File.dirname(__FILE__) + '../../../solrmarc-sw/test/jetty')
6
+ require 'jettywrapper'
7
+ jetty_params = Jettywrapper.load_config.merge({
8
+ :jetty_home => jetty_dir,
9
+ :solr_home => jetty_dir + '/solr',
10
+ :java_opts => "-Dsolr.data.dir=" + jetty_dir + "/solr/data",
11
+ :jetty_port => 8984,
12
+ :startup_wait => 45
13
+ })
14
+ error = Jettywrapper.wrap(jetty_params) do
15
+ Rake::Task['rspec'].invoke
24
16
  end
17
+ raise "TEST FAILURES: #{error}" if error
18
+ end
25
19
 
20
+ RSpec::Core::RakeTask.new(:rspec) do |spec|
21
+ spec.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
26
22
  end
@@ -25,8 +25,8 @@ Gem::Specification.new do |gem|
25
25
  gem.add_development_dependency "yard"
26
26
  # tests
27
27
  gem.add_development_dependency 'rspec'
28
+ gem.add_development_dependency 'coveralls'
28
29
  gem.add_development_dependency 'simplecov'
29
- gem.add_development_dependency 'simplecov-rcov'
30
30
  gem.add_development_dependency "jettywrapper"
31
31
 
32
32
  end
@@ -8,25 +8,25 @@ describe SolrjWrapper do
8
8
  end
9
9
 
10
10
  it "should initialize a query_server object" do
11
- @solrj_wrapper.query_server.should be_an_instance_of(Java::OrgApacheSolrClientSolrjImpl::CommonsHttpSolrServer)
11
+ expect(@solrj_wrapper.query_server).to be_an_instance_of(Java::OrgApacheSolrClientSolrjImpl::HttpSolrServer)
12
12
  end
13
13
 
14
14
  context "get_query_result_docs" do
15
15
  it "should return a SolrDocumentList object" do
16
16
  q = org.apache.solr.client.solrj.SolrQuery.new
17
- @solrj_wrapper.get_query_result_docs(q).should be_an_instance_of(Java::OrgApacheSolrCommon::SolrDocumentList)
17
+ expect(@solrj_wrapper.get_query_result_docs(q)).to be_an_instance_of(Java::OrgApacheSolrCommon::SolrDocumentList)
18
18
  end
19
19
 
20
20
  it "should return an object of size 0 when there are no hits" do
21
21
  q = org.apache.solr.client.solrj.SolrQuery.new
22
22
  q.setQuery("zzzzzznohitszzzzzzzz")
23
- @solrj_wrapper.get_query_result_docs(q).size.should == 0
23
+ expect(@solrj_wrapper.get_query_result_docs(q).size).to eq 0
24
24
  end
25
25
 
26
26
  it "should return an object of size 0 when rows = 0" do
27
27
  q = org.apache.solr.client.solrj.SolrQuery.new
28
28
  q.setRows(0)
29
- @solrj_wrapper.get_query_result_docs(q).size.should == 0
29
+ expect(@solrj_wrapper.get_query_result_docs(q).size).to eq 0
30
30
  end
31
31
 
32
32
  it "should return an object of size > 1 when there are hits and rows is > 0" do
@@ -35,67 +35,67 @@ describe SolrjWrapper do
35
35
  @solrj_wrapper.add_doc_to_ix(sid, "test_rec")
36
36
  @solrj_wrapper.commit
37
37
  q = org.apache.solr.client.solrj.SolrQuery.new
38
- @solrj_wrapper.get_query_result_docs(q).size.should_not == 0
38
+ expect(@solrj_wrapper.get_query_result_docs(q).size).not_to eq 0
39
39
  @solrj_wrapper.empty_ix
40
40
  end
41
41
  end
42
42
 
43
- it "should initialize a streaming_update_server object" do
44
- @solrj_wrapper.streaming_update_server.should be_an_instance_of(Java::OrgApacheSolrClientSolrjImpl::StreamingUpdateSolrServer)
43
+ it "streaming_update_server should be an HttpSolrServer object" do
44
+ expect(@solrj_wrapper.streaming_update_server).to be_an_instance_of(Java::OrgApacheSolrClientSolrjImpl::HttpSolrServer)
45
45
  end
46
46
 
47
47
  context "add_vals_to_fld" do
48
48
  it "should do nothing if the field name or value is nil or of size 0" do
49
49
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
50
50
  @solrj_wrapper.add_vals_to_fld(sid, nil, ["val"])
51
- sid.isEmpty.should be_true
51
+ expect(sid.isEmpty).to eq true
52
52
  @solrj_wrapper.add_vals_to_fld(sid, "", ["val"])
53
- sid.isEmpty.should be_true
53
+ expect(sid.isEmpty).to eq true
54
54
  @solrj_wrapper.add_vals_to_fld(sid, "fldname", nil)
55
- sid.isEmpty.should be_true
55
+ expect(sid.isEmpty).to eq true
56
56
  @solrj_wrapper.add_vals_to_fld(sid, "fldname", [])
57
- sid.isEmpty.should be_true
57
+ expect(sid.isEmpty).to eq true
58
58
  end
59
59
 
60
60
  it "should create a new field when none exists" do
61
61
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
62
62
  @solrj_wrapper.add_vals_to_fld(sid, "single", ["val"])
63
63
  vals = sid["single"].getValues
64
- vals.size.should == 1
65
- vals[0].should == "val"
64
+ expect(vals.size).to eq 1
65
+ expect(vals[0]).to eq "val"
66
66
  @solrj_wrapper.add_vals_to_fld(sid, "mult", ["val1", "val2"])
67
67
  vals = sid["mult"].getValues
68
- vals.size.should == 2
69
- vals[0].should == "val1"
70
- vals[1].should == "val2"
68
+ expect(vals.size).to eq 2
69
+ expect(vals[0]).to eq "val1"
70
+ expect(vals[1]).to eq "val2"
71
71
  end
72
72
 
73
73
  it "should keep the existing values when it adds a value to a field" do
74
74
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
75
75
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val"])
76
76
  vals = sid["fld"].getValues
77
- vals.size.should == 1
78
- vals[0].should == "val"
77
+ expect(vals.size).to eq 1
78
+ expect(vals[0]).to eq "val"
79
79
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val1", "val2"])
80
80
  vals = sid["fld"].getValues
81
- vals.size.should == 3
82
- vals.contains("val").should_not be_nil
83
- vals.contains("val1").should_not be_nil
84
- vals.contains("val2").should_not be_nil
81
+ expect(vals.size).to eq 3
82
+ expect(vals.contains("val")).not_to eq nil
83
+ expect(vals.contains("val1")).not_to eq nil
84
+ expect(vals.contains("val2")).not_to eq nil
85
85
  end
86
86
 
87
87
  it "should add all values, except those already present" do
88
88
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
89
89
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val"])
90
90
  vals = sid["fld"].getValues
91
- vals.size.should == 1
92
- vals[0].should == "val"
91
+ expect(vals.size).to eq 1
92
+ expect(vals[0]).to eq "val"
93
93
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val1", "val2", "val"])
94
94
  vals = sid["fld"].getValues
95
- vals.size.should == 3
96
- vals.contains("val").should_not be_nil
97
- vals.contains("val1").should_not be_nil
98
- vals.contains("val2").should_not be_nil
95
+ expect(vals.size).to eq 3
96
+ expect(vals.contains("val")).not_to eq nil
97
+ expect(vals.contains("val1")).not_to eq nil
98
+ expect(vals.contains("val2")).not_to eq nil
99
99
  end
100
100
  end # context add_vals_to_fld
101
101
 
@@ -103,21 +103,21 @@ describe SolrjWrapper do
103
103
  it "should do nothing if the field name or value is nil or of size 0" do
104
104
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
105
105
  @solrj_wrapper.add_val_to_fld(sid, nil, "val")
106
- sid.isEmpty.should be_true
106
+ expect(sid.isEmpty).to eq true
107
107
  @solrj_wrapper.add_val_to_fld(sid, "", "val")
108
- sid.isEmpty.should be_true
108
+ expect(sid.isEmpty).to eq true
109
109
  @solrj_wrapper.add_val_to_fld(sid, "fldname", nil)
110
- sid.isEmpty.should be_true
110
+ expect(sid.isEmpty).to eq true
111
111
  @solrj_wrapper.add_val_to_fld(sid, "fldname", [])
112
- sid.isEmpty.should be_true
112
+ expect(sid.isEmpty).to eq true
113
113
  end
114
114
 
115
115
  it "should create a new field when none exists" do
116
116
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
117
117
  @solrj_wrapper.add_val_to_fld(sid, "single", "val")
118
118
  vals = sid["single"].getValues
119
- vals.size.should == 1
120
- vals[0].should == "val"
119
+ expect(vals.size).to eq 1
120
+ expect(vals[0]).to eq "val"
121
121
  end
122
122
 
123
123
  it "should keep the existing values when it adds a value to a field" do
@@ -125,10 +125,10 @@ describe SolrjWrapper do
125
125
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val1", "val2"])
126
126
  @solrj_wrapper.add_val_to_fld(sid, "fld", "val")
127
127
  vals = sid["fld"].getValues
128
- vals.size.should == 3
129
- vals.contains("val").should_not be_nil
130
- vals.contains("val1").should_not be_nil
131
- vals.contains("val2").should_not be_nil
128
+ expect(vals.size).to eq 3
129
+ expect(vals.contains("val")).not_to eq nil
130
+ expect(vals.contains("val1")).not_to eq nil
131
+ expect(vals.contains("val2")).not_to eq nil
132
132
  end
133
133
 
134
134
  it "should add all values, except those already present" do
@@ -136,10 +136,10 @@ describe SolrjWrapper do
136
136
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val1", "val2", "val"])
137
137
  @solrj_wrapper.add_val_to_fld(sid, "fld", "val")
138
138
  vals = sid["fld"].getValues
139
- vals.size.should == 3
140
- vals.contains("val").should_not be_nil
141
- vals.contains("val1").should_not be_nil
142
- vals.contains("val2").should_not be_nil
139
+ expect(vals.size).to eq 3
140
+ expect(vals.contains("val")).not_to eq nil
141
+ expect(vals.contains("val1")).not_to eq nil
142
+ expect(vals.contains("val2")).not_to eq nil
143
143
  end
144
144
  end # context add_vals_to_fld
145
145
 
@@ -149,12 +149,12 @@ describe SolrjWrapper do
149
149
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val1", "val2", "val3"])
150
150
  @solrj_wrapper.replace_field_values(sid, "fld", ["val4", "val5"])
151
151
  vals = sid["fld"].getValues
152
- vals.size.should == 2
153
- vals.contains("val1").should be_false
154
- vals.contains("val2").should be_false
155
- vals.contains("val3").should be_false
156
- vals.contains("val4").should be_true
157
- vals.contains("val5").should be_true
152
+ expect(vals.size).to eq 2
153
+ expect(vals.contains("val1")).to eq false
154
+ expect(vals.contains("val2")).to eq false
155
+ expect(vals.contains("val3")).to eq false
156
+ expect(vals.contains("val4")).to eq true
157
+ expect(vals.contains("val5")).to eq true
158
158
  end
159
159
 
160
160
  it "should retain unchanged values" do
@@ -162,26 +162,26 @@ describe SolrjWrapper do
162
162
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val1", "val2"])
163
163
  @solrj_wrapper.replace_field_values(sid, "fld", ["val2", "val3"])
164
164
  vals = sid["fld"].getValues
165
- vals.size.should == 2
166
- vals.contains("val1").should be_false
167
- vals.contains("val2").should be_true
168
- vals.contains("val3").should be_true
165
+ expect(vals.size).to eq 2
166
+ expect(vals.contains("val1")).to eq false
167
+ expect(vals.contains("val2")).to eq true
168
+ expect(vals.contains("val3")).to eq true
169
169
  end
170
170
 
171
171
  it "should create a field when none existed before" do
172
172
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
173
- sid["fld"].should be_nil
173
+ expect(sid["fld"]).to eq nil
174
174
  @solrj_wrapper.replace_field_values(sid, "fld", ["val1"])
175
175
  vals = sid["fld"].getValues
176
- vals.size.should == 1
177
- vals.contains("val1").should be_true
176
+ expect(vals.size).to eq 1
177
+ expect(vals.contains("val1")).to eq true
178
178
  end
179
179
 
180
180
  it "should remove a field if there are no values to add" do
181
181
  sid = Java::OrgApacheSolrCommon::SolrInputDocument.new
182
182
  @solrj_wrapper.add_vals_to_fld(sid, "fld", ["val1", "val2"])
183
183
  @solrj_wrapper.replace_field_values(sid, "fld", [])
184
- sid["fld"].should be_nil
184
+ expect(sid["fld"]).to eq nil
185
185
  end
186
186
  end
187
187
 
data/spec/spec_helper.rb CHANGED
@@ -1,16 +1,13 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  # for test coverage
2
5
  require 'simplecov'
3
- require 'simplecov-rcov'
4
- class SimpleCov::Formatter::MergedFormatter
5
- def format(result)
6
- SimpleCov::Formatter::HTMLFormatter.new.format(result)
7
- SimpleCov::Formatter::RcovFormatter.new.format(result)
8
- end
9
- end
10
- SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter
6
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
11
7
  SimpleCov.start do
12
- add_filter "/spec/"
13
- add_filter "/lib/config/"
8
+ add_filter "spec"
9
+ add_filter "config"
10
+ add_filter "lib/config"
14
11
  end
15
12
 
16
13
  require 'solrj_wrapper/settings'
metadata CHANGED
@@ -1,91 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solrj_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.2
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Naomi Dushay
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-04-27 00:00:00.000000000Z
11
+ date: 2014-06-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
- version_requirements: &3808 !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
17
16
  requirements:
18
- - - ! '>='
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
19
23
  - !ruby/object:Gem::Version
20
24
  version: '0'
21
- none: false
22
- requirement: *3808
23
25
  prerelease: false
24
26
  type: :development
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: rdoc
27
- version_requirements: &3826 !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ requirement: !ruby/object:Gem::Requirement
28
35
  requirements:
29
- - - ! '>='
36
+ - - '>='
30
37
  - !ruby/object:Gem::Version
31
38
  version: '0'
32
- none: false
33
- requirement: *3826
34
39
  prerelease: false
35
40
  type: :development
36
41
  - !ruby/object:Gem::Dependency
37
42
  name: yard
38
- version_requirements: &3842 !ruby/object:Gem::Requirement
43
+ version_requirements: !ruby/object:Gem::Requirement
39
44
  requirements:
40
- - - ! '>='
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
41
51
  - !ruby/object:Gem::Version
42
52
  version: '0'
43
- none: false
44
- requirement: *3842
45
53
  prerelease: false
46
54
  type: :development
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: rspec
49
- version_requirements: &3858 !ruby/object:Gem::Requirement
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirement: !ruby/object:Gem::Requirement
50
63
  requirements:
51
- - - ! '>='
64
+ - - '>='
52
65
  - !ruby/object:Gem::Version
53
66
  version: '0'
54
- none: false
55
- requirement: *3858
56
67
  prerelease: false
57
68
  type: :development
58
69
  - !ruby/object:Gem::Dependency
59
- name: simplecov
60
- version_requirements: &3874 !ruby/object:Gem::Requirement
70
+ name: coveralls
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirement: !ruby/object:Gem::Requirement
61
77
  requirements:
62
- - - ! '>='
78
+ - - '>='
63
79
  - !ruby/object:Gem::Version
64
80
  version: '0'
65
- none: false
66
- requirement: *3874
67
81
  prerelease: false
68
82
  type: :development
69
83
  - !ruby/object:Gem::Dependency
70
- name: simplecov-rcov
71
- version_requirements: &3890 !ruby/object:Gem::Requirement
84
+ name: simplecov
85
+ version_requirements: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ! '>='
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
74
93
  - !ruby/object:Gem::Version
75
94
  version: '0'
76
- none: false
77
- requirement: *3890
78
95
  prerelease: false
79
96
  type: :development
80
97
  - !ruby/object:Gem::Dependency
81
98
  name: jettywrapper
82
- version_requirements: &3906 !ruby/object:Gem::Requirement
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirement: !ruby/object:Gem::Requirement
83
105
  requirements:
84
- - - ! '>='
106
+ - - '>='
85
107
  - !ruby/object:Gem::Version
86
108
  version: '0'
87
- none: false
88
- requirement: *3906
89
109
  prerelease: false
90
110
  type: :development
91
111
  description: Ruby wrapper for interacting with Solrj objects, such as org.apache.solr.client.solrj.impl.StreamingUpdateSolrServer
@@ -95,21 +115,23 @@ executables: []
95
115
  extensions: []
96
116
  extra_rdoc_files: []
97
117
  files:
118
+ - .coveralls.yml
98
119
  - .gitignore
99
- - .gitmodules
100
- - .rvmrc
120
+ - .ruby-gemset
121
+ - .ruby-version
122
+ - .travis.yml
123
+ - .yardopts
101
124
  - Gemfile
102
125
  - LICENSE
103
126
  - README.rdoc
104
127
  - Rakefile
128
+ - config/jetty.yml
105
129
  - lib/config/settings.yml
106
130
  - lib/solrj_wrapper.rb
107
131
  - lib/solrj_wrapper/settings.rb
108
132
  - lib/solrj_wrapper/version.rb
109
133
  - lib/tasks/ci.rake
110
134
  - lib/tasks/doc.rake
111
- - lib/tasks/jetty.rake
112
- - lib/tasks/solrmarc.rake
113
135
  - lib/tasks/spec.rake
114
136
  - solrj_wrapper.gemspec
115
137
  - spec/solr/solr.xml
@@ -117,37 +139,29 @@ files:
117
139
  - spec/spec_helper.rb
118
140
  homepage:
119
141
  licenses: []
142
+ metadata: {}
120
143
  post_install_message:
121
144
  rdoc_options: []
122
145
  require_paths:
123
146
  - lib
124
147
  required_ruby_version: !ruby/object:Gem::Requirement
125
148
  requirements:
126
- - - ! '>='
149
+ - - '>='
127
150
  - !ruby/object:Gem::Version
128
- segments:
129
- - 0
130
- hash: 2
131
151
  version: '0'
132
- none: false
133
152
  required_rubygems_version: !ruby/object:Gem::Requirement
134
153
  requirements:
135
- - - ! '>='
154
+ - - '>='
136
155
  - !ruby/object:Gem::Version
137
- segments:
138
- - 0
139
- hash: 2
140
156
  version: '0'
141
- none: false
142
157
  requirements: []
143
158
  rubyforge_project:
144
- rubygems_version: 1.8.15
159
+ rubygems_version: 2.2.0
145
160
  signing_key:
146
- specification_version: 3
161
+ specification_version: 4
147
162
  summary: This gem must be run under JRuby, and also requires a directory containing SolrJ jars and solr url (see config/settings.yml)
148
163
  test_files:
149
164
  - spec/solr/solr.xml
150
165
  - spec/solrj_wrapper_spec.rb
151
166
  - spec/spec_helper.rb
152
167
  has_rdoc:
153
- ...
data/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "solrmarc"]
2
- path = solrmarc
3
- url = git://github.com/solrmarc/stanford-solr-marc.git
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use jruby-1.6.7@solrj_wrapper --create
data/lib/tasks/jetty.rake DELETED
@@ -1,38 +0,0 @@
1
- require 'jettywrapper'
2
-
3
- namespace :sj_wrap do
4
- namespace :jetty do
5
-
6
- desc "Modify test jetty solr to be multicore"
7
- task :config => ['sj_wrap:solrmarc:setup_test_jetty'] do
8
-
9
- # copy the solr.xml file for multi-core to test jetty solr
10
- jetty_solr_dir = "solrmarc/test/jetty/solr"
11
- cp('spec/solr/solr.xml', jetty_solr_dir, :verbose => true)
12
-
13
- # set up solr dev and test conf directories
14
- dev_conf_dir = "#{jetty_solr_dir}/dev/conf"
15
- test_conf_dir = "#{jetty_solr_dir}/test/conf"
16
- mkdir_p(dev_conf_dir) unless Dir.exists?(dev_conf_dir)
17
- mkdir_p(test_conf_dir) unless Dir.exists?(test_conf_dir)
18
- single_core_conf_dir = "#{jetty_solr_dir}/conf"
19
- Dir["#{single_core_conf_dir}/*"].each { |f|
20
- cp_r(f, dev_conf_dir, :verbose => true)
21
- cp_r(f, test_conf_dir, :verbose => true)
22
- }
23
-
24
- require 'fileutils'
25
- # remove single core conf directory
26
- FileUtils.rm_rf("#{jetty_solr_dir}/conf/.", :verbose => true)
27
- Dir.foreach(jetty_solr_dir + "/conf") { |f|
28
- fn = File.join(jetty_solr_dir, f)
29
- File.delete(fn) if f != '.' && f != '..'
30
- }
31
-
32
- end
33
-
34
- desc "Copies the SOLR config files and starts up the test-jetty instance"
35
- task :load => [:config, 'jetty:start']
36
-
37
- end
38
- end
@@ -1,17 +0,0 @@
1
- namespace :sj_wrap do
2
- namespace :solrmarc do
3
- require 'ant'
4
-
5
- desc "run ant dist_site target in solrmarc"
6
- task :ant_dist_site do
7
- ant '-f solrmarc/build.xml dist_site'
8
- end
9
-
10
- desc "run ant target to set up testing jetty per straight solrmarc"
11
- task :setup_test_jetty do
12
- ant '-f solrmarc/build.xml test_clean_site'
13
- ant '-f solrmarc/build.xml site_setup_test_jetty'
14
- end
15
-
16
- end
17
- end