Skip to content

Commit

Permalink
Test on Solr 5
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Feb 4, 2016
1 parent 2d3db71 commit cb78aae
Show file tree
Hide file tree
Showing 32 changed files with 1,985 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ bin
.ruby-version
.ruby-gemset
gemfiles/*.gemfile.lock
/fcrepo4-data
25 changes: 12 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,30 @@ You can test ActiveFedora using the same process as our continuous
integration server. To do that, unzip a copy of hydra-jetty first. This includes copies of Fedora and Solr which are
used during the testing process.

```bash
rake jetty:unzip
```

Once hydra-jetty is unzipped, the ci rake task will spin up jetty,
import the fixtures, and run the tests for you.
The `ci` rake task will download solr and fedora, start them,
and run the tests for you.

```bash
rake active_fedora:ci
```

### Testing Manually

If you want to run the tests manually, follow these instructions.
If you want to run the tests manually, follow these instructions:

```bash
solr_wrapper -d solr/config/ --collection_name hydra-test
```

You can switch `hydra-test` to `hydra-dev` if you want to create a collection for development.

You need to have a copy of hydra-jetty running. To do this, download a
working copy of
[hydra-jetty](https://github.com/projecthydra/hydra-jetty), cd into its
root and run:
To start FCRepo, open another shell and run:

```bash
java -jar start.jar
fedora_wrapper -p 8984
```

Now you’re ready to run the tests. In the directory where active_fedora
Now you’re ready to run the tests. In the directory where active\_fedora
is installed, run:

```bash
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ load "lib/tasks/active_fedora_dev.rake"
CLEAN.include %w(**/.DS_Store tmp *.log *.orig *.tmp **/*~)

desc 'setup jetty and run tests'
task ci: ['jetty:clean', 'active_fedora:ci']
task ci: ['active_fedora:ci']
desc 'run tests'
task spec: ['active_fedora:rubocop', 'active_fedora:rspec']
task rcov: ['active_fedora:rcov']
Expand Down
3 changes: 2 additions & 1 deletion active-fedora.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Gem::Specification.new do |s|
s.add_development_dependency "rdoc"
s.add_development_dependency "yard"
s.add_development_dependency "rake"
s.add_development_dependency "jettywrapper", ">= 2.0.0"
s.add_development_dependency "solr_wrapper", "~> 0.4"
s.add_development_dependency 'fcrepo_wrapper', '~> 0.1'
s.add_development_dependency "rspec", "~> 3.0"
s.add_development_dependency "rspec-its"
s.add_development_dependency "equivalent-xml"
Expand Down
4 changes: 2 additions & 2 deletions config/fedora.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
development:
user: fedoraAdmin
password: fedoraAdmin
url: http://127.0.0.1:8983/fedora/rest
url: http://127.0.0.1:8984/rest
base_path: /dev
test:
user: fedoraAdmin
password: fedoraAdmin
url: http://localhost:8983/fedora/rest
url: http://localhost:8984/rest
base_path: /test
production:
user: fedoraAdmin
Expand Down
10 changes: 5 additions & 5 deletions config/solr.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
development:
default:
url: http://localhost:8983/solr/development
url: http://localhost:8983/solr/hydra-dev
full_text:
url: http://localhost:8983/solr/development
test:
test:
default:
url: http://localhost:8983/solr/test
url: http://localhost:8983/solr/hydra-test
full_text:
url: http://localhost:8983/solr/test
production:
default:
url: http://localhost:8080/solr/production
url: http://localhost:8080/solr/production
full_text:
url: http://localhost:8080/solr/production
url: http://localhost:8080/solr/production
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
development:
user: fedoraAdmin
password: fedoraAdmin
url: http://127.0.0.1:8983/fedora/rest
url: http://127.0.0.1:8984/rest
base_path: /dev
test:
user: fedoraAdmin
password: fedoraAdmin
url: http://localhost:8983/fedora/rest
url: http://localhost:8984/rest
base_path: /test
production:
user: fedoraAdmin
Expand Down
1 change: 0 additions & 1 deletion lib/generators/active_fedora/config/solr/solr_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class Config::SolrGenerator < Rails::Generators::Base

def generate
# Overwrite the configuration files that Blacklight has installed
copy_file 'jetty.yml', 'config/jetty.yml', force: true
copy_file 'solr.yml', 'config/solr.yml', force: true
directory 'solr_conf', 'solr_conf'
end
Expand Down
6 changes: 0 additions & 6 deletions lib/generators/active_fedora/config/solr/templates/jetty.yml

This file was deleted.

4 changes: 2 additions & 2 deletions lib/generators/active_fedora/config/solr/templates/solr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a sample config file that points to a solr server for each environment
development:
url: http://localhost:8983/solr/development
url: http://localhost:8983/solr/hydra-dev
test:
url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/test" %>
url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/hydra-test" %>
production:
url: http://your.production.server:8080/bl_solr/core0
21 changes: 13 additions & 8 deletions lib/tasks/active_fedora_dev.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
APP_ROOT = File.expand_path("#{File.dirname(__FILE__)}/../../")

require 'jettywrapper'
require 'solr_wrapper'
require 'fcrepo_wrapper'

namespace :active_fedora do
# Use yard to build docs
Expand Down Expand Up @@ -50,14 +51,18 @@ namespace :active_fedora do
desc "CI build"
task :ci do
ENV['environment'] = "test"
Rake::Task["active_fedora:configure_jetty"].invoke
jetty_params = Jettywrapper.load_config
error = Jettywrapper.wrap(jetty_params) do
Rake::Task['active_fedora:coverage'].invoke
# Rake::Task["active_fedora:configure_jetty"].invoke
# jetty_params = Jettywrapper.load_config
solr_params = { port: 8983, verbose: true, managed: true }
fcrepo_params = { port: 8984, verbose: true, managed: true }
error = nil
SolrWrapper.wrap(solr_params) do |solr|
solr.with_collection(name: 'hydra-test', dir: File.join(File.expand_path("../..", File.dirname(__FILE__)), "solr", "config")) do
FcrepoWrapper.wrap(fcrepo_params) do
Rake::Task['active_fedora:coverage'].invoke
end
end
end
raise "test failures: #{error}" if error
# Only create documentation if the tests have passed
Rake::Task["active_fedora:doc"].invoke
end

desc "Execute specs with coverage"
Expand Down
3 changes: 3 additions & 0 deletions solr/config/_rest_managed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"initArgs":{},
"managedList":[]}
31 changes: 31 additions & 0 deletions solr/config/admin-extra.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- The content of this page will be statically included into the top
of the admin page. Uncomment this as an example to see there the content
will show up.
<hr>
<i>This line will appear before the first table</i>
<tr>
<td colspan="2">
This row will be appended to the end of the first table
</td>
</tr>
<hr>
-->
36 changes: 36 additions & 0 deletions solr/config/elevate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- If this file is found in the config directory, it will only be
loaded once at startup. If it is found in Solr's data
directory, it will be re-loaded every commit.
-->

<elevate>
<query text="foo bar">
<doc id="1" />
<doc id="2" />
<doc id="3" />
</query>

<query text="ipod">
<doc id="MA147LL/A" /> <!-- put the actual ipod at the top -->
<doc id="IW-02" exclude="true" /> <!-- exclude this cable -->
</query>

</elevate>
Loading

0 comments on commit cb78aae

Please sign in to comment.