hydra-works 0.17.0 → 1.0.0

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.
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <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="1.2.0" timestamp="12/28/17 2:57 PM">
3
+ <identification>
4
+ <identity format="JPEG EXIF" mimetype="image/jpeg" toolname="FITS" toolversion="1.2.0">
5
+ <tool toolname="Exiftool" toolversion="10.00" />
6
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" />
7
+ <version toolname="Exiftool" toolversion="10.00">1.02</version>
8
+ </identity>
9
+ </identification>
10
+ <fileinfo>
11
+ <size toolname="Jhove" toolversion="1.16">2510223</size>
12
+ <creatingApplicationName toolname="Exiftool" toolversion="10.00" status="CONFLICT">Canon EOS-1D Mark III</creatingApplicationName>
13
+ <creatingApplicationName toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="CONFLICT">Adobe Photoshop CS3 Macintosh</creatingApplicationName>
14
+ <lastmodified toolname="Exiftool" toolversion="10.00" status="CONFLICT">2009:02:04 16:10:47</lastmodified>
15
+ <lastmodified toolname="Tika" toolversion="1.10" status="CONFLICT">2009-02-04T16:10:47</lastmodified>
16
+ <created toolname="Exiftool" toolversion="10.00" status="CONFLICT">2009:02:04 11:05:25.36-06:00</created>
17
+ <created toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="CONFLICT">2009:02:04 16:10:47</created>
18
+ <filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/kefo/Work/fits/samples/image/127783_717918.jpg</filepath>
19
+ <filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">127783_717918.jpg</filename>
20
+ <md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">ece070706671c92a27386e8f3aeae346</md5checksum>
21
+ <fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1514490121000</fslastmodified>
22
+ </fileinfo>
23
+ <filestatus />
24
+ <metadata>
25
+ <image>
26
+ <compressionScheme toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">LZW</compressionScheme>
27
+ <imageWidth toolname="Exiftool" toolversion="10.00">3000</imageWidth>
28
+ <imageHeight toolname="Exiftool" toolversion="10.00">2153</imageHeight>
29
+ <colorSpace toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">RGB</colorSpace>
30
+ <iccProfileName toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">Adobe RGB (1998)</iccProfileName>
31
+ <iccProfileVersion toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">2.1.0</iccProfileVersion>
32
+ <YCbCrSubSampling toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">1 1</YCbCrSubSampling>
33
+ <orientation toolname="Exiftool" toolversion="10.00">normal*</orientation>
34
+ <samplingFrequencyUnit toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="SINGLE_RESULT">in.</samplingFrequencyUnit>
35
+ <xSamplingFrequency toolname="Exiftool" toolversion="10.00">240</xSamplingFrequency>
36
+ <ySamplingFrequency toolname="Exiftool" toolversion="10.00">240</ySamplingFrequency>
37
+ <bitsPerSample toolname="Exiftool" toolversion="10.00">8 8 8</bitsPerSample>
38
+ <samplesPerPixel toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">3</samplesPerPixel>
39
+ <digitalCameraManufacturer toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">Canon</digitalCameraManufacturer>
40
+ <digitalCameraModelName toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">Canon EOS-1D Mark III</digitalCameraModelName>
41
+ <scanningSoftwareName toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">Adobe Photoshop CS3 Macintosh</scanningSoftwareName>
42
+ <fNumber toolname="Exiftool" toolversion="10.00">11.0</fNumber>
43
+ <exposureTime toolname="Exiftool" toolversion="10.00">0.125</exposureTime>
44
+ <exposureProgram toolname="Exiftool" toolversion="10.00">Manual</exposureProgram>
45
+ <isoSpeedRating toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">100</isoSpeedRating>
46
+ <exifVersion toolname="Exiftool" toolversion="10.00" status="CONFLICT">0221</exifVersion>
47
+ <exifVersion toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="CONFLICT">1220</exifVersion>
48
+ <shutterSpeedValue toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">1/8</shutterSpeedValue>
49
+ <apertureValue toolname="Exiftool" toolversion="10.00" status="CONFLICT">11.0</apertureValue>
50
+ <apertureValue toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="CONFLICT">6.918863</apertureValue>
51
+ <exposureBiasValue toolname="Exiftool" toolversion="10.00" status="SINGLE_RESULT">0</exposureBiasValue>
52
+ <maxApertureValue toolname="Exiftool" toolversion="10.00" status="CONFLICT">2.5</maxApertureValue>
53
+ <maxApertureValue toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="CONFLICT">2.625</maxApertureValue>
54
+ <meteringMode toolname="Exiftool" toolversion="10.00">Pattern</meteringMode>
55
+ <lightSource toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="SINGLE_RESULT">unknown</lightSource>
56
+ <flash toolname="Exiftool" toolversion="10.00">Flash did not fire</flash>
57
+ <focalLength toolname="Exiftool" toolversion="10.00">50.0</focalLength>
58
+ </image>
59
+ </metadata>
60
+ <statistics fitsExecutionTime="255">
61
+ <tool toolname="MediaInfo" toolversion="0.7.75" status="did not run" />
62
+ <tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
63
+ <tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
64
+ <tool toolname="VTT Tool" toolversion="0.1" status="did not run" />
65
+ <tool toolname="Droid" toolversion="6.3" executionTime="5" />
66
+ <tool toolname="Jhove" toolversion="1.16" executionTime="68" />
67
+ <tool toolname="file utility" toolversion="5.29" executionTime="61" />
68
+ <tool toolname="Exiftool" toolversion="10.00" executionTime="240" />
69
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" executionTime="63" />
70
+ <tool toolname="OIS File Information" toolversion="0.2" executionTime="10" />
71
+ <tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
72
+ <tool toolname="ffident" toolversion="0.2" executionTime="4" />
73
+ <tool toolname="Tika" toolversion="1.10" executionTime="127" />
74
+ </statistics>
75
+ </fits>
76
+
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <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="1.2.0" timestamp="4/4/18 4:13 PM">
3
+ <identification>
4
+ <identity format="MPEG 1/2 Audio Layer 3" mimetype="audio/mpeg" toolname="FITS" toolversion="1.2.0">
5
+ <tool toolname="Droid" toolversion="6.3" />
6
+ <tool toolname="Exiftool" toolversion="10.00" />
7
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" />
8
+ <tool toolname="ffident" toolversion="0.2" />
9
+ <tool toolname="Tika" toolversion="1.10" />
10
+ <version toolname="NLNZ Metadata Extractor" toolversion="3.6GA">1</version>
11
+ <externalIdentifier toolname="Droid" toolversion="6.3" type="puid">fmt/134</externalIdentifier>
12
+ </identity>
13
+ </identification>
14
+ <fileinfo>
15
+ <filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/cjcolvar/Documents/Code/samvera/hydra-works/spec/fixtures/test5.mp3</filepath>
16
+ <filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">test5.mp3</filename>
17
+ <size toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">366464</size>
18
+ <md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">d98da8d92c397294164b02a0382eb0e6</md5checksum>
19
+ <fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1522855873000</fslastmodified>
20
+ </fileinfo>
21
+ <filestatus />
22
+ <metadata>
23
+ <audio>
24
+ <duration toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="SINGLE_RESULT">0:0:15:261</duration>
25
+ <bitRate toolname="Exiftool" toolversion="10.00" status="CONFLICT">192 kbps</bitRate>
26
+ <bitRate toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="CONFLICT">192000</bitRate>
27
+ <sampleRate toolname="Exiftool" toolversion="10.00">44100</sampleRate>
28
+ <channels toolname="Exiftool" toolversion="10.00">2</channels>
29
+ <milliseconds toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="SINGLE_RESULT">15261</milliseconds>
30
+ <author toolname="Tika" toolversion="1.10" status="SINGLE_RESULT">Hendrik Broekman</author>
31
+ <title toolname="Tika" toolversion="1.10" status="SINGLE_RESULT">BachGavotteShort</title>
32
+ <sampleRate toolname="Tika" toolversion="1.10" status="SINGLE_RESULT">44100</sampleRate>
33
+ </audio>
34
+ </metadata>
35
+ <statistics fitsExecutionTime="2609">
36
+ <tool toolname="MediaInfo" toolversion="0.7.75" status="did not run" />
37
+ <tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
38
+ <tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
39
+ <tool toolname="VTT Tool" toolversion="0.1" status="did not run" />
40
+ <tool toolname="Droid" toolversion="6.3" executionTime="1557" />
41
+ <tool toolname="Jhove" toolversion="1.16" executionTime="2561" />
42
+ <tool toolname="file utility" toolversion="5.31" executionTime="1513" />
43
+ <tool toolname="Exiftool" toolversion="10.00" executionTime="1568" />
44
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" executionTime="1251" />
45
+ <tool toolname="OIS File Information" toolversion="0.2" executionTime="463" />
46
+ <tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
47
+ <tool toolname="ffident" toolversion="0.2" executionTime="1315" />
48
+ <tool toolname="Tika" toolversion="1.10" executionTime="640" />
49
+ </statistics>
50
+ </fits>
51
+
@@ -0,0 +1,88 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <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="1.2.0" timestamp="4/4/18 3:02 PM">
3
+ <identification status="CONFLICT">
4
+ <identity format="Quicktime" mimetype="video/quicktime" toolname="FITS" toolversion="1.2.0">
5
+ <tool toolname="MediaInfo" toolversion="0.7.75" />
6
+ </identity>
7
+ <identity format="MPEG-4 Media File" mimetype="application/mp4, video/mp4" toolname="FITS" toolversion="1.2.0">
8
+ <tool toolname="Droid" toolversion="6.3" />
9
+ <externalIdentifier toolname="Droid" toolversion="6.3" type="puid">fmt/199</externalIdentifier>
10
+ </identity>
11
+ <identity format="ISO Media, MP4 v2 [ISO 14496-14]" mimetype="video/mp4" toolname="FITS" toolversion="1.2.0">
12
+ <tool toolname="file utility" toolversion="5.22" />
13
+ </identity>
14
+ </identification>
15
+ <fileinfo>
16
+ <filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/home/app/avalon/tmp/original_file.mp4</filepath>
17
+ <filename toolname="MediaInfo" toolversion="0.7.75">original_file.mp4</filename>
18
+ <size toolname="MediaInfo" toolversion="0.7.75">199160</size>
19
+ <md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">7ae24368ccb7a6c6422a14ff73f33c9a</md5checksum>
20
+ <fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1522853877000</fslastmodified>
21
+ </fileinfo>
22
+ <filestatus />
23
+ <metadata>
24
+ <video>
25
+ <location toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">/home/app/avalon/tmp/original_file.mp4</location>
26
+ <mimeType toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">video/quicktime</mimeType>
27
+ <format toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">Quicktime</format>
28
+ <formatProfile toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">Base Media / Version 2</formatProfile>
29
+ <duration toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">6315</duration>
30
+ <bitRate toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">252301</bitRate>
31
+ <dateCreated toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">UTC 2010-09-23 00:37:25</dateCreated>
32
+ <dateModified toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">UTC 2018-04-04 14:57:57</dateModified>
33
+ <track type="video" id="1" toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">
34
+ <videoDataEncoding>avc1</videoDataEncoding>
35
+ <codecId>avc1</codecId>
36
+ <codecCC>avc1</codecCC>
37
+ <codecVersion>Main@L1.1</codecVersion>
38
+ <codecName>AVC</codecName>
39
+ <codecFamily>H.264</codecFamily>
40
+ <codecInfo>Advanced Video Codec</codecInfo>
41
+ <compression>Unknown</compression>
42
+ <byteOrder>Unknown</byteOrder>
43
+ <bitDepth>8 bits</bitDepth>
44
+ <bitRate>74477</bitRate>
45
+ <duration>6282</duration>
46
+ <trackSize>58482</trackSize>
47
+ <width>200 pixels</width>
48
+ <height>110 pixels</height>
49
+ <frameRate>24.390</frameRate>
50
+ <frameRateMode>Variable</frameRateMode>
51
+ <frameCount>149</frameCount>
52
+ <aspectRatio>16:9</aspectRatio>
53
+ <scanningFormat>Progressive</scanningFormat>
54
+ <chromaSubsampling>4:2:0</chromaSubsampling>
55
+ <colorspace>YUV</colorspace>
56
+ </track>
57
+ <track type="audio" id="2" toolname="MediaInfo" toolversion="0.7.75" status="SINGLE_RESULT">
58
+ <audioDataEncoding>AAC</audioDataEncoding>
59
+ <codecId>40</codecId>
60
+ <codecFamily>AAC</codecFamily>
61
+ <compression>Lossy</compression>
62
+ <bitRate>201736</bitRate>
63
+ <bitRateMode>Variable</bitRateMode>
64
+ <duration>6315</duration>
65
+ <trackSize>134999</trackSize>
66
+ <soundField>Front: C</soundField>
67
+ <samplingRate>48000</samplingRate>
68
+ <numSamples>303120</numSamples>
69
+ <channels>1</channels>
70
+ </track>
71
+ </video>
72
+ </metadata>
73
+ <statistics fitsExecutionTime="266">
74
+ <tool toolname="MediaInfo" toolversion="0.7.75" executionTime="252" />
75
+ <tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
76
+ <tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
77
+ <tool toolname="VTT Tool" toolversion="0.1" status="did not run" />
78
+ <tool toolname="Droid" toolversion="6.3" executionTime="103" />
79
+ <tool toolname="Jhove" toolversion="1.16" status="did not run" />
80
+ <tool toolname="file utility" toolversion="5.22" executionTime="227" />
81
+ <tool toolname="Exiftool" toolversion="10.00" status="did not run" />
82
+ <tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="did not run" />
83
+ <tool toolname="OIS File Information" toolversion="0.2" executionTime="95" />
84
+ <tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
85
+ <tool toolname="ffident" toolversion="0.2" executionTime="198" />
86
+ <tool toolname="Tika" toolversion="1.10" status="did not run" />
87
+ </statistics>
88
+ </fits>
@@ -60,14 +60,17 @@ describe Hydra::Works::Characterization do
60
60
  it { is_expected.to respond_to(:height) }
61
61
  it { is_expected.to respond_to(:width) }
62
62
  it { is_expected.to respond_to(:frame_rate) }
63
+ it { is_expected.to respond_to(:bit_rate) }
63
64
  it { is_expected.to respond_to(:duration) }
64
65
  it { is_expected.to respond_to(:sample_rate) }
66
+ it { is_expected.to respond_to(:aspect_ratio) }
65
67
  end
66
68
  context "with Audio schema" do
67
69
  it { is_expected.to respond_to(:bit_depth) }
68
70
  it { is_expected.to respond_to(:channels) }
69
71
  it { is_expected.to respond_to(:data_format) }
70
72
  it { is_expected.to respond_to(:frame_rate) }
73
+ it { is_expected.to respond_to(:bit_rate) }
71
74
  it { is_expected.to respond_to(:duration) }
72
75
  it { is_expected.to respond_to(:sample_rate) }
73
76
  it { is_expected.to respond_to(:offset) }
@@ -77,17 +80,21 @@ describe Hydra::Works::Characterization do
77
80
  describe "::mapper" do
78
81
  let(:mapper_keys) do
79
82
  [
80
- :audio_duration,
81
- :audio_sample_rate,
82
- :exif_tool_version,
83
83
  :file_author,
84
84
  :file_language,
85
85
  :file_mime_type,
86
+ :audio_duration,
87
+ :audio_sample_rate,
88
+ :audio_bit_rate,
86
89
  :video_audio_sample_rate,
90
+ :track_frame_rate,
87
91
  :video_duration,
88
- :video_height,
89
92
  :video_sample_rate,
90
- :video_width
93
+ :video_bit_rate,
94
+ :video_width,
95
+ :video_track_width,
96
+ :video_height,
97
+ :video_track_height
91
98
  ]
92
99
  end
93
100
  subject { described_class.mapper.keys }
@@ -118,6 +118,18 @@ describe Hydra::Works::Collection do
118
118
  it { is_expected.to eq [collection1] }
119
119
  end
120
120
 
121
+ describe 'member_of_collections' do
122
+ let(:collection1) { described_class.create }
123
+ before do
124
+ collection.member_of_collections = [collection1]
125
+ end
126
+
127
+ it 'is a member of the collection' do
128
+ expect(collection.member_of_collections).to eq [collection1]
129
+ expect(collection.member_of_collection_ids).to eq [collection1.id]
130
+ end
131
+ end
132
+
121
133
  describe 'adding file_sets to collections' do
122
134
  let(:file_set) { Hydra::Works::FileSet.new }
123
135
  let(:exception) { ActiveFedora::AssociationTypeMismatch }
@@ -1,21 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Hydra::Works::ContainedFiles do
4
- let(:file_set) do
5
- Hydra::Works::FileSet.create
6
- end
7
-
8
- let(:thumbnail) do
9
- file = file_set.files.build
10
- Hydra::PCDM::AddTypeToFile.call(file, pcdm_thumbnail_uri)
11
- end
12
-
13
- let(:file) { file_set.files.build }
14
- let(:pcdm_thumbnail_uri) { ::RDF::URI('http://pcdm.org/use#ThumbnailImage') }
15
-
16
- before do
17
- file_set.files = [file]
18
- end
4
+ let(:file_set) { Hydra::Works::FileSet.create }
5
+ let(:pcdm_thumbnail_uri) { ::RDF::URI('http://pcdm.org/use#ThumbnailImage') }
19
6
 
20
7
  describe '#thumbnail' do
21
8
  context 'when a thumbnail is present' do
@@ -63,7 +50,7 @@ describe Hydra::Works::ContainedFiles do
63
50
  end
64
51
  it 'retains origin pcdm.File RDF type' do
65
52
  expect(subject.metadata_node.type).to include(::RDF::URI('http://pcdm.org/use#OriginalFile'))
66
- expect(file_set.original_file.metadata_node.type).to include(Hydra::PCDM::Vocab::PCDMTerms.File)
53
+ expect(subject.metadata_node.type).to include(Hydra::PCDM::Vocab::PCDMTerms.File)
67
54
  end
68
55
  end
69
56
 
@@ -81,20 +81,24 @@ describe Hydra::Works::CharacterizationService do
81
81
  end
82
82
 
83
83
  context "passing an object that does not have matching properties" do
84
- let!(:current_schemas) { ActiveFedora::WithMetadata::DefaultMetadataClassFactory.file_metadata_schemas }
85
-
86
84
  let(:characterization) { class_double("Hydra::FileCharacterization").as_stubbed_const }
87
85
  let(:fits_filename) { 'fits_0.8.5_pdf.xml' }
88
86
  let(:fits_response) { IO.read(File.join(fixture_path, fits_filename)) }
89
87
  let(:file_content) { 'dummy content' }
90
88
  let(:file) { Hydra::PCDM::File.new { |f| f.content = file_content } }
91
89
 
92
- before do
90
+ around do |example|
91
+ @current_schemas = ActiveFedora::WithMetadata::DefaultMetadataClassFactory.file_metadata_schemas
92
+ @metadata_schema = Hydra::PCDM::File::GeneratedMetadataSchema
93
93
  ActiveFedora::WithMetadata::DefaultMetadataClassFactory.file_metadata_schemas = [ActiveFedora::WithMetadata::DefaultSchema]
94
- allow(characterization).to receive(:characterize).and_return(fits_response)
94
+ example.run
95
+ ActiveFedora::WithMetadata::DefaultMetadataClassFactory.file_metadata_schemas = @current_schemas
96
+ # This next line required to force resetting the metadata schema class used by Hydra::PCDM::File
97
+ Hydra::PCDM::File.instance_variable_set(:@metadata_schema, @metadata_schema)
95
98
  end
96
- after do
97
- ActiveFedora::WithMetadata::DefaultMetadataClassFactory.file_metadata_schemas = [current_schemas]
99
+
100
+ before do
101
+ allow(characterization).to receive(:characterize).and_return(fits_response)
98
102
  end
99
103
 
100
104
  it 'does not explode with an error' do
@@ -133,38 +137,78 @@ describe Hydra::Works::CharacterizationService do
133
137
  end
134
138
 
135
139
  context 'using image metadata' do
136
- let(:fits_filename) { 'fits_0.8.5_jp2.xml' }
137
140
  let(:fits_response) { IO.read(File.join(fixture_path, fits_filename)) }
138
141
 
139
- it 'assigns expected values to image properties.' do
140
- expect(file.file_size).to eq(["11043"])
141
- expect(file.byte_order).to eq(["big endian"])
142
- expect(file.compression).to contain_exactly("JPEG 2000 Lossless", "JPEG 2000")
143
- expect(file.width).to eq(["512"])
144
- expect(file.height).to eq(["465"])
145
- expect(file.color_space).to eq(["sRGB"])
142
+ context 'with fits_0.8.5' do
143
+ let(:fits_filename) { 'fits_0.8.5_jp2.xml' }
144
+ it 'assigns expected values to image properties.' do
145
+ expect(file.file_size).to eq(["11043"])
146
+ expect(file.byte_order).to eq(["big endian"])
147
+ expect(file.compression).to contain_exactly("JPEG 2000 Lossless", "JPEG 2000")
148
+ expect(file.width).to eq(["512"])
149
+ expect(file.height).to eq(["465"])
150
+ expect(file.color_space).to eq(["sRGB"])
151
+ end
152
+ end
153
+
154
+ context 'with fits_1.2.0' do
155
+ let(:fits_filename) { 'fits_1.2.0_jpg.xml' }
156
+ it 'ensures duplicate values are not returned for exifVersion, dateCreated, dateModified.' do
157
+ expect(file.exif_version).to eq(["0221"])
158
+ expect(file.date_created).to eq(["2009:02:04 11:05:25.36-06:00"])
159
+ expect(file.date_modified).to eq(["2009:02:04 16:10:47"])
160
+ end
146
161
  end
147
162
  end
163
+
148
164
  context 'using video metadata' do
149
- let(:fits_filename) { 'fits_0.8.5_avi.xml' }
150
165
  let(:fits_response) { IO.read(File.join(fixture_path, fits_filename)) }
151
166
 
152
- it 'assigns expected values to video properties.' do
153
- expect(file.height).to eq(["264"])
154
- expect(file.width).to eq(["356"])
155
- expect(file.duration).to eq(["14.10 s"])
156
- expect(file.frame_rate).to eq(["10"])
157
- expect(file.sample_rate).to eq(["11025"])
167
+ context 'with fits_0.8.5' do
168
+ let(:fits_filename) { 'fits_0.8.5_avi.xml' }
169
+ it 'assigns expected values to video properties.' do
170
+ expect(file.height).to eq(["264"])
171
+ expect(file.width).to eq(["356"])
172
+ expect(file.duration).to eq(["14.10 s"])
173
+ expect(file.frame_rate).to eq(["10"])
174
+ expect(file.sample_rate).to eq(["11025"])
175
+ end
176
+ end
177
+
178
+ context 'with fits_1.2.0' do
179
+ let(:fits_filename) { 'fits_1.2.0_avi.xml' }
180
+ it 'assigns expected values to video properties.' do
181
+ expect(file.height).to eq(["264"])
182
+ expect(file.width).to eq(["356"])
183
+ expect(file.duration).to eq(["14148"])
184
+ expect(file.frame_rate).to eq(["10.000"])
185
+ expect(file.bit_rate).to eq(["409204"])
186
+ expect(file.aspect_ratio).to eq(["4:3"])
187
+ end
158
188
  end
159
189
  end
190
+
160
191
  context 'using audio metadata' do
161
- let(:fits_filename) { 'fits_0.8.5_mp3.xml' }
162
192
  let(:fits_response) { IO.read(File.join(fixture_path, fits_filename)) }
163
193
 
164
- it 'assigns expected values to audio properties.' do
165
- expect(file.mime_type).to eq("audio/mpeg")
166
- expect(file.duration).to eq(["0:0:15:261"])
167
- expect(file.sample_rate).to eq(["44100"])
194
+ context 'with fits_0.8.5' do
195
+ let(:fits_filename) { 'fits_0.8.5_mp3.xml' }
196
+ it 'assigns expected values to audio properties.' do
197
+ expect(file.mime_type).to eq("audio/mpeg")
198
+ expect(file.duration).to eq(["0:0:15:261"])
199
+ expect(file.bit_rate).to include("192000")
200
+ expect(file.sample_rate).to eq(["44100"])
201
+ end
202
+ end
203
+
204
+ context 'with fits_1.2.0' do
205
+ let(:fits_filename) { 'fits_1.2.0_mp3.xml' }
206
+ it 'assigns expected values to audio properties.' do
207
+ expect(file.mime_type).to eq("audio/mpeg")
208
+ expect(file.duration).to eq(["0:0:15:261"])
209
+ expect(file.bit_rate).to include("192000")
210
+ expect(file.sample_rate).to eq(["44100"])
211
+ end
168
212
  end
169
213
  end
170
214
 
@@ -114,4 +114,4 @@ Can have one or more physical volumes. Below assumes this is the case.
114
114
 
115
115
  ## Proposal
116
116
 
117
- No doubt there are other ways, but I feel confident that [this approach](https://github.com/projecthydra-labs/hydra-works/issues/9#issuecomment-58511913) would solve all of the above use cases. Validations included in subclasses of Hydra::Work would serve to constrain recursion.
117
+ No doubt there are other ways, but I feel confident that [this approach](https://github.com/samvera/hydra-works/issues/9#issuecomment-58511913) would solve all of the above use cases. Validations included in subclasses of Hydra::Work would serve to constrain recursion.