hydra-file_characterization 0.3.1 → 1.1.1
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 +5 -5
- data/.circleci/config.yml +90 -0
- data/.github_changelog_generator +2 -0
- data/.travis.yml +9 -0
- data/CHANGELOG.md +180 -0
- data/CODE_OF_CONDUCT.md +36 -0
- data/CONTRIBUTING.md +70 -22
- data/Gemfile +8 -0
- data/LICENSE +14 -16
- data/README.md +54 -13
- data/Rakefile +6 -0
- data/SUPPORT.md +5 -0
- data/hydra-file_characterization.gemspec +5 -1
- data/lib/hydra/file_characterization/characterizer.rb +44 -24
- data/lib/hydra/file_characterization/characterizers.rb +1 -0
- data/lib/hydra/file_characterization/characterizers/fits.rb +14 -3
- data/lib/hydra/file_characterization/characterizers/fits_servlet.rb +23 -0
- data/lib/hydra/file_characterization/version.rb +1 -1
- data/spec/lib/hydra/file_characterization/characterizer_spec.rb +8 -5
- data/spec/lib/hydra/file_characterization/characterizers/fit_servlet_spec.rb +68 -0
- data/spec/lib/hydra/file_characterization/characterizers/fits_spec.rb +50 -20
- data/spec/lib/hydra/file_characterization_spec.rb +9 -4
- data/spec/spec_helper.rb +5 -2
- metadata +84 -21
data/Gemfile
CHANGED
@@ -2,3 +2,11 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in hydra/file_characterization.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
if ENV['RAILS_VERSION']
|
7
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
8
|
+
gem 'rails', github: 'rails/rails'
|
9
|
+
else
|
10
|
+
gem 'rails', ENV['RAILS_VERSION']
|
11
|
+
end
|
12
|
+
end
|
data/LICENSE
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
1
|
+
Copyright 2013 Notre Dame
|
2
|
+
Additional copyright may be held by others, as reflected in the commit history.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -1,12 +1,28 @@
|
|
1
|
-
# hydra-
|
1
|
+
# hydra-file_characterization
|
2
2
|
|
3
|
-
|
3
|
+
Code: [](http://badge.fury.io/rb/hydra-file_characterization) [](https://circleci.com/gh/samvera/hydra-file_characterization) [](https://coveralls.io/github/samvera/hydra-file_characterization?branch=master)
|
4
4
|
|
5
|
-
|
5
|
+
Docs: [](./CONTRIBUTING.md) [](./LICENSE)
|
6
6
|
|
7
|
-
|
7
|
+
Jump in: [](http://slack.samvera.org/)
|
8
8
|
|
9
|
-
|
9
|
+
# What is hydra-file_characterization?
|
10
|
+
|
11
|
+
Provides a wrapper for file characterization.
|
12
|
+
|
13
|
+
## Product Owner & Maintenance
|
14
|
+
|
15
|
+
hydra-file_characterization is a Core Component of the Samvera community. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
|
16
|
+
|
17
|
+
### Product Owner
|
18
|
+
|
19
|
+
[little9](https://github.com/little9)
|
20
|
+
|
21
|
+
# Help
|
22
|
+
|
23
|
+
The Samvera community is here to help. Please see our [support guide](./SUPPORT.md).
|
24
|
+
|
25
|
+
# Getting Started
|
10
26
|
|
11
27
|
If you are using Rails add the following to an initializer (./config/initializers/hydra-file_characterization_config.rb):
|
12
28
|
|
@@ -16,12 +32,20 @@ Hydra::FileCharacterization.configure do |config|
|
|
16
32
|
end
|
17
33
|
```
|
18
34
|
|
19
|
-
You can call a single characterizer…
|
20
35
|
```ruby
|
21
|
-
|
36
|
+
Hydra::FileCharacterization.characterize(File.read(filename), File.basename(filename), :fits)
|
22
37
|
```
|
23
38
|
|
24
|
-
|
39
|
+
- Why `file.read`? To highlight that we want a string. In the case of ActiveFedora, we have a StringIO instead of a file.
|
40
|
+
- Why `file.basename`? In the case of Fits, the characterization takes cues from the extension name.
|
41
|
+
|
42
|
+
You can call a single characterizer...
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
xml_string = Hydra::FileCharacterization.characterize(File.read("/path/to/my/file.rb"), 'file.rb', :fits)
|
46
|
+
```
|
47
|
+
|
48
|
+
...for this particular call, you can specify custom fits path...
|
25
49
|
|
26
50
|
```ruby
|
27
51
|
xml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :fits) do |config|
|
@@ -29,7 +53,7 @@ xml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.
|
|
29
53
|
end
|
30
54
|
```
|
31
55
|
|
32
|
-
|
56
|
+
...or even make the path callable...
|
33
57
|
|
34
58
|
```ruby
|
35
59
|
xml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :fits) do |config|
|
@@ -37,7 +61,7 @@ xml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.
|
|
37
61
|
end
|
38
62
|
```
|
39
63
|
|
40
|
-
|
64
|
+
...or even create your custom characterizer on the file...
|
41
65
|
|
42
66
|
```ruby
|
43
67
|
xml_string = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :my_characterizer) do |config|
|
@@ -51,9 +75,26 @@ You can also call multiple characterizers at the same time.
|
|
51
75
|
fits_xml, ffprobe_xml = Hydra::FileCharacterization.characterize(contents_of_a_file, 'file.rb', :fits, :ffprobe)
|
52
76
|
```
|
53
77
|
|
54
|
-
* Why `file.read`? To highlight that we want a string. In the case of ActiveFedora, we have a StringIO instead of a file.
|
55
|
-
* Why `file.basename`? In the case of Fits, the characterization takes cues from the extension name.
|
56
|
-
|
57
78
|
## Registering New Characterizers
|
58
79
|
|
59
80
|
This is possible by adding a characterizer to the `Hydra::FileCharacterization::Characterizers`' namespace.
|
81
|
+
|
82
|
+
## Releasing
|
83
|
+
|
84
|
+
1. `bundle install`
|
85
|
+
2. Increase the version number in `lib/hydra/file_characterization/version.rb`
|
86
|
+
3. Increase the same version number in `.github_changelog_generator`
|
87
|
+
4. Update `CHANGELOG.md` by running this command:
|
88
|
+
|
89
|
+
```
|
90
|
+
github_changelog_generator --user samvera --project hydra-file_characterization --token YOUR_GITHUB_TOKEN_HERE
|
91
|
+
```
|
92
|
+
|
93
|
+
5. Commit these changes to the master branch
|
94
|
+
6. Run `rake release`
|
95
|
+
|
96
|
+
# Acknowledgments
|
97
|
+
|
98
|
+
This software has been developed by and is brought to you by the Samvera community. Learn more at the [Samvera website](http://samvera.org/).
|
99
|
+
|
100
|
+

|
data/Rakefile
CHANGED
data/SUPPORT.md
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
If you would like to report an issue, first search [the list of issues](https://github.com/samvera/hydra-file_characterization/issues/) to see if someone else has already reported it, and then feel free to [create a new issue](https://github.com/samvera/hydra-file_characterization/issues/new).
|
2
|
+
i
|
3
|
+
If you have questions or need help, please email [the Samvera community tech list](https://groups.google.com/forum/#!forum/samvera-tech) or stop by the #dev channel in [the Samvera community Slack team](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391#Getintouch!-Slack).
|
4
|
+
|
5
|
+
You can learn more about the various Samvera communication channels on the [Get in touch!](https://wiki.duraspace.org/pages/viewpage.action?pageId=87460391) wiki page.
|
@@ -29,7 +29,11 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.require_paths = ["lib"]
|
30
30
|
|
31
31
|
gem.add_dependency "activesupport", ">= 3.0.0"
|
32
|
-
gem.add_development_dependency
|
32
|
+
gem.add_development_dependency 'coveralls'
|
33
|
+
gem.add_development_dependency 'github_changelog_generator'
|
33
34
|
gem.add_development_dependency "guard"
|
34
35
|
gem.add_development_dependency 'guard-rspec'
|
36
|
+
gem.add_development_dependency "rake"
|
37
|
+
gem.add_development_dependency "rspec"
|
38
|
+
gem.add_development_dependency 'rspec_junit_formatter'
|
35
39
|
end
|
@@ -19,40 +19,60 @@ module Hydra::FileCharacterization
|
|
19
19
|
raise Hydra::FileCharacterization::FileNotFoundError.new("File: #{filename} does not exist.")
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
tool_path.call(filename)
|
24
|
-
else
|
25
|
-
internal_call
|
26
|
-
end
|
22
|
+
post_process(output)
|
27
23
|
end
|
28
24
|
|
29
25
|
def tool_path
|
30
26
|
@tool_path || self.class.tool_path || convention_based_tool_name
|
31
27
|
end
|
32
28
|
|
29
|
+
def logger
|
30
|
+
@logger ||= activefedora_logger || Logger.new(STDERR)
|
31
|
+
end
|
32
|
+
|
33
33
|
protected
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
# Override this method if you want your processor to mutate the
|
36
|
+
# raw output
|
37
|
+
def post_process(raw_output)
|
38
|
+
raw_output
|
39
|
+
end
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
begin
|
42
|
-
out = stdout.read
|
43
|
-
err = stderr.read
|
44
|
-
exit_status = wait_thr.value
|
45
|
-
raise "Unable to execute command \"#{command}\"\n#{err}" unless exit_status.success?
|
46
|
-
out
|
47
|
-
ensure
|
48
|
-
stdin.close
|
49
|
-
stdout.close
|
50
|
-
stderr.close
|
41
|
+
def convention_based_tool_name
|
42
|
+
self.class.name.split("::").last.downcase
|
51
43
|
end
|
52
|
-
end
|
53
44
|
|
54
|
-
|
55
|
-
|
56
|
-
|
45
|
+
def internal_call
|
46
|
+
stdin, stdout, stderr, wait_thr = popen3(command)
|
47
|
+
begin
|
48
|
+
out = stdout.read
|
49
|
+
err = stderr.read
|
50
|
+
exit_status = wait_thr.value
|
51
|
+
raise "Unable to execute command \"#{command}\"\n#{err}" unless exit_status.success?
|
52
|
+
out
|
53
|
+
ensure
|
54
|
+
stdin.close
|
55
|
+
stdout.close
|
56
|
+
stderr.close
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def command
|
61
|
+
raise NotImplementedError, "Method #command should be overriden in child classes"
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def output
|
67
|
+
if tool_path.respond_to?(:call)
|
68
|
+
tool_path.call(filename)
|
69
|
+
else
|
70
|
+
internal_call
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def activefedora_logger
|
75
|
+
ActiveFedora::Base.logger if defined? ActiveFedora
|
76
|
+
end
|
57
77
|
end
|
58
78
|
end
|
@@ -1,12 +1,23 @@
|
|
1
1
|
require 'hydra/file_characterization/exceptions'
|
2
2
|
require 'hydra/file_characterization/characterizer'
|
3
|
+
require 'logger'
|
3
4
|
module Hydra::FileCharacterization::Characterizers
|
4
5
|
class Fits < Hydra::FileCharacterization::Characterizer
|
5
6
|
|
6
7
|
protected
|
7
|
-
def command
|
8
|
-
"#{tool_path} -i \"#{filename}\""
|
9
|
-
end
|
10
8
|
|
9
|
+
def command
|
10
|
+
"#{tool_path} -i \"#{filename}\""
|
11
|
+
end
|
12
|
+
|
13
|
+
# Remove any non-XML output that precedes the <?xml> tag
|
14
|
+
# See: https://github.com/harvard-lts/fits/issues/20
|
15
|
+
# https://github.com/harvard-lts/fits/issues/40
|
16
|
+
# https://github.com/harvard-lts/fits/issues/46
|
17
|
+
def post_process(raw_output)
|
18
|
+
md = /\A(.*)(<\?xml.*)\Z/m.match(raw_output)
|
19
|
+
logger.warn "FITS produced non-xml output: \"#{md[1].chomp}\"" unless md[1].empty?
|
20
|
+
md[2]
|
21
|
+
end
|
11
22
|
end
|
12
23
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'hydra/file_characterization/exceptions'
|
2
|
+
require 'hydra/file_characterization/characterizer'
|
3
|
+
require 'logger'
|
4
|
+
module Hydra::FileCharacterization::Characterizers
|
5
|
+
class FitsServlet < Hydra::FileCharacterization::Characterizer
|
6
|
+
|
7
|
+
protected
|
8
|
+
|
9
|
+
def command
|
10
|
+
"curl -k -F datafile=@#{filename} #{ENV['FITS_SERVLET_URL']}/examine"
|
11
|
+
end
|
12
|
+
|
13
|
+
# Remove any non-XML output that precedes the <?xml> tag
|
14
|
+
# See: https://github.com/harvard-lts/fits/issues/20
|
15
|
+
# https://github.com/harvard-lts/fits/issues/40
|
16
|
+
# https://github.com/harvard-lts/fits/issues/46
|
17
|
+
def post_process(raw_output)
|
18
|
+
md = /\A(.*)(<\?xml.*)\Z/m.match(raw_output)
|
19
|
+
logger.warn "FITS produced non-xml output: \"#{md[1].chomp}\"" unless md[1].empty?
|
20
|
+
md[2]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -6,7 +6,8 @@ module Hydra::FileCharacterization
|
|
6
6
|
let(:instance_tool_path) { nil }
|
7
7
|
let(:class_tool_path) { nil }
|
8
8
|
|
9
|
-
|
9
|
+
let(:characterizer) { Hydra::FileCharacterization::Characterizer.new(filename, instance_tool_path) }
|
10
|
+
subject { characterizer }
|
10
11
|
around(:each) do |example|
|
11
12
|
Hydra::FileCharacterization::Characterizer.tool_path = class_tool_path
|
12
13
|
example.run
|
@@ -30,23 +31,25 @@ module Hydra::FileCharacterization
|
|
30
31
|
end
|
31
32
|
|
32
33
|
context 'tool_path' do
|
34
|
+
subject { characterizer.tool_path }
|
35
|
+
|
33
36
|
context 'with custom instance tool_path' do
|
34
37
|
let(:instance_tool_path) { '/arbitrary/path' }
|
35
38
|
let(:class_tool_path) { '/a_different/path' }
|
36
39
|
|
37
|
-
|
40
|
+
it { is_expected.to eq instance_tool_path }
|
38
41
|
end
|
39
42
|
|
40
43
|
context 'with custom class tool_path' do
|
41
44
|
let(:instance_tool_path) { nil }
|
42
45
|
let(:class_tool_path) { '/a_different/path' }
|
43
46
|
|
44
|
-
|
47
|
+
it { is_expected.to eq class_tool_path }
|
45
48
|
end
|
46
49
|
|
47
50
|
context 'without a specified tool_path' do
|
48
|
-
|
51
|
+
it { is_expected.to eq 'characterizer' }
|
49
52
|
end
|
50
53
|
end
|
51
54
|
end
|
52
|
-
end
|
55
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'hydra/file_characterization/characterizers/fits_servlet'
|
3
|
+
|
4
|
+
module Hydra::FileCharacterization::Characterizers
|
5
|
+
describe FitsServlet do
|
6
|
+
let(:fits) { Fits.new(filename) }
|
7
|
+
|
8
|
+
describe "#call", unless: ENV['TRAVIS'] do
|
9
|
+
subject { fits.call }
|
10
|
+
|
11
|
+
context 'validfile' do
|
12
|
+
let(:filename) { fixture_file('brendan_behan.jpeg') }
|
13
|
+
it { is_expected.to include(%(<identity format="JPEG File Interchange Format" mimetype="image/jpeg")) }
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'invalidFile' do
|
17
|
+
let(:filename) { fixture_file('nofile.pdf') }
|
18
|
+
it "raises an error" do
|
19
|
+
expect { subject }.to raise_error(Hydra::FileCharacterization::FileNotFoundError)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'corruptFile' do
|
24
|
+
let(:filename) { fixture_file('brendan_broken.dxxd') }
|
25
|
+
it { is_expected.to include(%(<identity format="Unknown Binary" mimetype="application/octet-stream")) }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'zip file should be characterized not its contents' do
|
29
|
+
let(:filename) { fixture_file('archive.zip') }
|
30
|
+
it { is_expected.to include(%(<identity format="ZIP Format" mimetype="application/zip"))}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when JHOVE adds non-xml' do
|
35
|
+
# https://github.com/harvard-lts/fits/issues/20
|
36
|
+
subject { fits.call }
|
37
|
+
|
38
|
+
before do
|
39
|
+
expect(fits.logger).to receive(:warn)
|
40
|
+
allow(fits).to receive(:internal_call).and_return(
|
41
|
+
'READBOX seen=true
|
42
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
43
|
+
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
|
44
|
+
<identification/></fits>')
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:filename) { fixture_file('brendan_behan.jpeg') }
|
48
|
+
it { is_expected.not_to include('READBOX') }
|
49
|
+
end
|
50
|
+
|
51
|
+
context "when FITS itself adds non-xml" do
|
52
|
+
# https://github.com/harvard-lts/fits/issues/46
|
53
|
+
subject { fits.call }
|
54
|
+
|
55
|
+
before do
|
56
|
+
expect(fits.logger).to receive(:warn)
|
57
|
+
allow(fits).to receive(:internal_call).and_return(
|
58
|
+
'2015-10-15 17:14:25,761 ERROR [main] ToolBelt:79 - Thread 1 error initializing edu.harvard.hul.ois.fits.tools.droid.Droid: edu.harvard.hul.ois.fits.exceptions.FitsToolException Message: DROID cannot run under Java 8
|
59
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
60
|
+
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
|
61
|
+
<identification/></fits>')
|
62
|
+
end
|
63
|
+
|
64
|
+
let(:filename) { fixture_file('brendan_behan.jpeg') }
|
65
|
+
it { is_expected.not_to include('FitsToolException') }
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -2,37 +2,67 @@ require 'spec_helper'
|
|
2
2
|
require 'hydra/file_characterization/characterizers/fits'
|
3
3
|
|
4
4
|
module Hydra::FileCharacterization::Characterizers
|
5
|
-
|
6
5
|
describe Fits do
|
6
|
+
let(:fits) { Fits.new(filename) }
|
7
7
|
|
8
|
-
|
8
|
+
describe "#call", unless: ENV['TRAVIS'] do
|
9
|
+
subject { fits.call }
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
expect(subject.call).to include(%(<identity format="JPEG File Interchange Format" mimetype="image/jpeg"))
|
11
|
+
context 'validfile' do
|
12
|
+
let(:filename) { fixture_file('brendan_behan.jpeg') }
|
13
|
+
it { is_expected.to include(%(<identity format="JPEG File Interchange Format" mimetype="image/jpeg")) }
|
14
14
|
end
|
15
|
-
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
context 'invalidFile' do
|
17
|
+
let(:filename) { fixture_file('nofile.pdf') }
|
18
|
+
it "raises an error" do
|
19
|
+
expect { subject }.to raise_error(Hydra::FileCharacterization::FileNotFoundError)
|
20
|
+
end
|
21
21
|
end
|
22
|
-
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
context 'corruptFile' do
|
24
|
+
let(:filename) { fixture_file('brendan_broken.dxxd') }
|
25
|
+
it { is_expected.to include(%(<identity format="Unknown Binary" mimetype="application/octet-stream")) }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'zip file should be characterized not its contents' do
|
29
|
+
let(:filename) { fixture_file('archive.zip') }
|
30
|
+
it { is_expected.to include(%(<identity format="ZIP Format" mimetype="application/zip"))}
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
+
context 'when JHOVE adds non-xml' do
|
35
|
+
# https://github.com/harvard-lts/fits/issues/20
|
36
|
+
subject { fits.call }
|
37
|
+
|
38
|
+
before do
|
39
|
+
expect(fits.logger).to receive(:warn)
|
40
|
+
allow(fits).to receive(:internal_call).and_return(
|
41
|
+
'READBOX seen=true
|
42
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
43
|
+
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
|
44
|
+
<identification/></fits>')
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:filename) { fixture_file('brendan_behan.jpeg') }
|
48
|
+
it { is_expected.not_to include('READBOX') }
|
34
49
|
end
|
35
50
|
|
36
|
-
|
51
|
+
context "when FITS itself adds non-xml" do
|
52
|
+
# https://github.com/harvard-lts/fits/issues/46
|
53
|
+
subject { fits.call }
|
54
|
+
|
55
|
+
before do
|
56
|
+
expect(fits.logger).to receive(:warn)
|
57
|
+
allow(fits).to receive(:internal_call).and_return(
|
58
|
+
'2015-10-15 17:14:25,761 ERROR [main] ToolBelt:79 - Thread 1 error initializing edu.harvard.hul.ois.fits.tools.droid.Droid: edu.harvard.hul.ois.fits.exceptions.FitsToolException Message: DROID cannot run under Java 8
|
59
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
60
|
+
<fits xmlns="http://hul.harvard.edu/ois/xml/ns/fits/fits_output" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hul.harvard.edu/ois/xml/ns/fits/fits_output http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd" version="0.8.2" timestamp="15/09/14 10:00 AM">
|
61
|
+
<identification/></fits>')
|
62
|
+
end
|
37
63
|
|
64
|
+
let(:filename) { fixture_file('brendan_behan.jpeg') }
|
65
|
+
it { is_expected.not_to include('FitsToolException') }
|
66
|
+
end
|
67
|
+
end
|
38
68
|
end
|