Skip to content

Commit

Permalink
Fixing tests to use new jetty
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Mar 8, 2013
1 parent d325400 commit 2960e94
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,3 +11,4 @@ doc
tmp/
.rvmrc
jettywrapper.log
jetty
4 changes: 0 additions & 4 deletions .gitmodules
@@ -1,4 +0,0 @@
[submodule "jetty"]
path = jetty
url = git://github.com/projecthydra/hydra-jetty.git
ignore = dirty
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -15,7 +15,7 @@ rescue Bundler::BundlerError => e
exit e.status_code
end

RSpec::Core::RakeTask.new(:spec) do |spec|
RSpec::Core::RakeTask.new(:spec => 'jetty:unzip') do |spec|
# spec.libs << 'lib' << 'spec'
# spec.spec_files = FileList['spec/**/*_spec.rb']
end
Expand Down
2 changes: 1 addition & 1 deletion config/jetty.yml
@@ -1,5 +1,5 @@
default:
jetty_port: 8983
java_opts:
- "-XX:MaxPermSize=128m"
- "-XX:MaxPermSize=256m"
- "-Xmx256m"
1 change: 0 additions & 1 deletion jetty
Submodule jetty deleted from 387152
3 changes: 2 additions & 1 deletion lib/jettywrapper.rb
Expand Up @@ -77,7 +77,8 @@ def unzip
system "unzip -d #{tmp_save_dir} -qo #{zip_file}"
abort "Unable to unzip #{zip_file} into tmp_save_dir/" unless $?.success?

system "mv #{expanded_zip_dir} #{jetty_dir}"
expanded_dir = expanded_zip_dir(tmp_save_dir)
system "mv #{expanded_dir} #{jetty_dir}"
abort "Unable to move #{expanded_dir} into #{jetty_dir}/" unless $?.success?
end

Expand Down
8 changes: 6 additions & 2 deletions spec/lib/jettywrapper_integration_spec.rb
Expand Up @@ -9,12 +9,14 @@ module Hydra
context "integration" do
before(:all) do
$stderr.reopen("/dev/null", "w")
Jettywrapper.logger.level=3
end

it "starts" do
jetty_params = {
:jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty"),
:startup_wait => 45,
:java_opts => ["-Xmx256m", '-XX:MaxPermSize=256m'],
:jetty_port => TEST_JETTY_PORTS.first
}
Jettywrapper.configure(jetty_params)
Expand All @@ -28,7 +30,7 @@ module Hydra

# Can we connect to solr?
require 'net/http'
response = Net::HTTP.get_response(URI.parse("http://localhost:#{jetty_params[:jetty_port]}/solr/development/admin/"))
response = Net::HTTP.get_response(URI.parse("http://localhost:#{jetty_params[:jetty_port]}/solr/"))
response.code.should eql("200")
ts.stop

Expand All @@ -38,6 +40,7 @@ module Hydra
jetty_params = {
:jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty"),
:startup_wait => 45,
:java_opts => ["-Xmx256m", '-XX:MaxPermSize=256m'],
:jetty_port => TEST_JETTY_PORTS.first
}
Jettywrapper.configure(jetty_params)
Expand All @@ -46,7 +49,7 @@ module Hydra
ts.stop
ts.start
ts.logger.debug "Jetty started from rspec at #{ts.pid}"
response = Net::HTTP.get_response(URI.parse("http://localhost:#{jetty_params[:jetty_port]}/solr/development/admin/"))
response = Net::HTTP.get_response(URI.parse("http://localhost:#{jetty_params[:jetty_port]}/solr/"))
response.code.should eql("200")
lambda { ts.start }.should raise_exception(/Server is already running/)
ts.stop
Expand All @@ -56,6 +59,7 @@ module Hydra
jetty_params = {
:jetty_home => File.expand_path("#{File.dirname(__FILE__)}/../../jetty"),
:jetty_port => TEST_JETTY_PORTS.last,
:java_opts => ["-Xmx256m", '-XX:MaxPermSize=256m'],
:startup_wait => 30
}
Jettywrapper.stop(jetty_params)
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/jettywrapper_spec.rb
Expand Up @@ -11,7 +11,7 @@
:jetty_port => TEST_JETTY_PORTS.first,
:solr_home => "/path/to/solr",
:startup_wait => 0,
:java_opts => ["-Xmx256mb"],
:java_opts => ["-Xmx256m"],
:jetty_opts => ["/path/to/jetty_xml", "/path/to/other_jetty_xml"]
}

Expand Down

0 comments on commit 2960e94

Please sign in to comment.