Skip to content

Commit 350c86c

Browse files
committed
Merge branch 'dev' of https://github.com/harvard-lts/fits into dev
2 parents e175bf1 + aa678b2 commit 350c86c

18 files changed

+439
-68
lines changed

License.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#### FITS Servlet Package License
2-
Copyright ©2018 The President and Fellows of Harvard College
2+
Copyright ©2019 The President and Fellows of Harvard College
33

44
Licensed 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
55

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>edu.harvard.huit.lts</groupId>
55
<artifactId>fits</artifactId>
6-
<version>1.4.0</version>
6+
<version>1.4.1-SNAPSHOT</version>
77
<packaging>jar</packaging>
88

99
<name>FITS</name>
@@ -17,7 +17,7 @@
1717
<bcmail.version>132</bcmail.version>
1818
<log4j.version>1.2.17</log4j.version>
1919
<slf4j.version>1.7.22</slf4j.version>
20-
<tika.version>1.19.1</tika.version>
20+
<tika.version>1.20</tika.version>
2121
<jdom.version>1.1.3</jdom.version>
2222
<woodstox.version>4.4.1</woodstox.version>
2323
<xmlunit.version>1.6</xmlunit.version>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright 2009 Harvard University Library
3+
*
4+
* This file is part of FITS (File Information Tool Set).
5+
*
6+
* FITS is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* FITS is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with FITS. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
package edu.harvard.hul.ois.fits.junit;
20+
21+
import java.io.File;
22+
23+
import org.junit.AfterClass;
24+
import org.junit.BeforeClass;
25+
import org.junit.Test;
26+
27+
import edu.harvard.hul.ois.fits.Fits;
28+
import edu.harvard.hul.ois.fits.FitsOutput;
29+
import edu.harvard.hul.ois.fits.tests.AbstractLoggingTest;
30+
31+
32+
public class M4aTest extends AbstractLoggingTest {
33+
34+
/*
35+
* Only one Fits instance is needed to run all tests.
36+
* This also speeds up the tests.
37+
*/
38+
private static Fits fits;
39+
40+
@BeforeClass
41+
public static void beforeClass() throws Exception {
42+
// Set up FITS for entire class.
43+
File fitsConfigFile = new File("testfiles/properties/fits-full-with-tool-output.xml");
44+
fits = new Fits(null, fitsConfigFile);
45+
}
46+
47+
@AfterClass
48+
public static void afterClass() {
49+
fits = null;
50+
}
51+
52+
@Test
53+
public void testM4a() throws Exception {
54+
55+
String fileName = "sample.m4a";
56+
File input = new File("testfiles/" + fileName);
57+
FitsOutput fitsOut = fits.examine(input);
58+
fitsOut.addStandardCombinedFormat();
59+
fitsOut.saveToDisk("test-generated-output/" + fileName + "_Output.xml");
60+
}
61+
62+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*
2+
* Copyright 2009 Harvard University Library
3+
*
4+
* This file is part of FITS (File Information Tool Set).
5+
*
6+
* FITS is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* FITS is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with FITS. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
package edu.harvard.hul.ois.fits.junit;
20+
21+
import java.io.File;
22+
import java.util.ArrayList;
23+
import java.util.Arrays;
24+
import java.util.List;
25+
import java.util.Scanner;
26+
27+
import org.jdom.output.Format;
28+
import org.jdom.output.XMLOutputter;
29+
import org.junit.AfterClass;
30+
import org.junit.BeforeClass;
31+
import org.junit.Test;
32+
33+
import edu.harvard.hul.ois.fits.Fits;
34+
import edu.harvard.hul.ois.fits.FitsOutput;
35+
import edu.harvard.hul.ois.fits.tests.AbstractXmlUnitTest;
36+
37+
38+
public class M4aXmlUnitTest extends AbstractXmlUnitTest {
39+
40+
/*
41+
* Only one Fits instance is needed to run all tests.
42+
* This also speeds up the tests.
43+
*/
44+
private static Fits fits;
45+
46+
@BeforeClass
47+
public static void beforeClass() throws Exception {
48+
// Set up FITS for entire class.
49+
fits = new Fits();
50+
}
51+
52+
@AfterClass
53+
public static void afterClass() {
54+
fits = null;
55+
}
56+
57+
@Override
58+
protected String[] getIgnoredXmlElements() {
59+
String[] ignored = super.getIgnoredXmlElements();
60+
List<String> additionalIgnored = new ArrayList<>(Arrays.asList(ignored));
61+
additionalIgnored.add("ID");
62+
additionalIgnored.add("audioObjectRef");
63+
additionalIgnored.add("formatRef");
64+
additionalIgnored.add("faceRef");
65+
additionalIgnored.add("faceRegionRef");
66+
additionalIgnored.add("ownerRef");
67+
68+
return additionalIgnored.toArray(new String[additionalIgnored.size()]);
69+
}
70+
71+
@Test
72+
public void testM4a() throws Exception {
73+
74+
String inputFilename = "sample.m4a";
75+
File input = new File("testfiles/" + inputFilename);
76+
FitsOutput fitsOut = fits.examine(input);
77+
fitsOut.addStandardCombinedFormat();
78+
fitsOut.saveToDisk("test-generated-output/" + inputFilename + ACTUAL_OUTPUT_FILE_SUFFIX);
79+
80+
XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
81+
String actualXmlStr = serializer.outputString(fitsOut.getFitsXml());
82+
83+
// Read in the expected XML file
84+
Scanner scan = new Scanner(new File(
85+
"testfiles/output/" + inputFilename + EXPECTED_OUTPUT_FILE_SUFFIX));
86+
String expectedXmlStr = scan.
87+
useDelimiter("\\Z").next();
88+
scan.close();
89+
90+
testActualAgainstExpected(actualXmlStr, expectedXmlStr, inputFilename);
91+
}
92+
93+
}

src/test/java/edu/harvard/hul/ois/fits/junit/MixTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
package edu.harvard.hul.ois.fits.junit;
2020

2121
import java.io.File;
22+
import java.util.Scanner;
2223

24+
import org.jdom.output.Format;
25+
import org.jdom.output.XMLOutputter;
2326
import org.junit.AfterClass;
2427
import org.junit.BeforeClass;
2528
import org.junit.Test;
@@ -153,5 +156,17 @@ public void testJp2_2() throws Exception {
153156
fitsOut.addStandardCombinedFormat(); // output all data to file
154157
fitsOut.saveToDisk("test-generated-output/" + inputFilename + "_Output.xml");
155158
}
159+
160+
@Test
161+
public void testNotWellFormedJp2() throws Exception {
162+
163+
String inputFilename = "2339337_not_well_formed.jp2";
164+
File input = new File("testfiles/" + inputFilename);
165+
166+
FitsOutput fitsOut = fits.examine(input);
167+
168+
fitsOut.addStandardCombinedFormat(); // output all data to file
169+
fitsOut.saveToDisk("test-generated-output/" + inputFilename + "_Output.xml");
170+
}
156171

157172
}

src/test/java/edu/harvard/hul/ois/fits/junit/MixXmlUnitTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,5 +269,29 @@ public void testJp2_2() throws Exception {
269269

270270
testActualAgainstExpected(actualXmlStr, expectedXmlStr, inputFilename);
271271
}
272+
273+
@Test
274+
public void testNotWellFormedJp2() throws Exception {
275+
276+
String inputFilename = "2339337_not_well_formed.jp2";
277+
File input = new File("testfiles/" + inputFilename);
278+
279+
FitsOutput fitsOut = fits.examine(input);
280+
281+
fitsOut.addStandardCombinedFormat(); // output all data to file
282+
fitsOut.saveToDisk("test-generated-output/" + inputFilename + ACTUAL_OUTPUT_FILE_SUFFIX);
283+
284+
XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat());
285+
String actualXmlStr = serializer.outputString(fitsOut.getFitsXml());
286+
287+
// Read in the expected XML file
288+
Scanner scan = new Scanner(new File(
289+
"testfiles/output/" + inputFilename + EXPECTED_OUTPUT_FILE_SUFFIX));
290+
String expectedXmlStr = scan.
291+
useDelimiter("\\Z").next();
292+
scan.close();
293+
294+
testActualAgainstExpected(actualXmlStr, expectedXmlStr, inputFilename);
295+
}
272296

273297
}

testfiles/2339337_not_well_formed.jp2

118 KB
Binary file not shown.

testfiles/output/006607203_00018.jp2_XmlUnitExpectedOutput.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<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.x" timestamp="2/13/18 2:58 PM">
33
<identification>
4-
<identity format="JPEG 2000 JP2" mimetype="image/jp2" toolname="FITS" toolversion="1.2.x">
5-
<tool toolname="Droid" toolversion="6.3" />
6-
<tool toolname="Jhove" toolversion="1.16" />
7-
<tool toolname="Exiftool" toolversion="10.00" />
8-
<tool toolname="Tika" toolversion="1.10" />
9-
<externalIdentifier toolname="Droid" toolversion="6.3" type="puid">x-fmt/392</externalIdentifier>
4+
<identity format="JPEG 2000 JP2" mimetype="image/jp2" toolname="FITS" toolversion="1.4.1">
5+
<tool toolname="Droid" toolversion="6.4" />
6+
<tool toolname="Jhove" toolversion="1.20.1" />
7+
<tool toolname="file utility" toolversion="5.31" />
8+
<tool toolname="Exiftool" toolversion="11.14" />
9+
<tool toolname="Tika" toolversion="1.19.1" />
10+
<externalIdentifier toolname="Droid" toolversion="6.4" type="puid">x-fmt/392</externalIdentifier>
1011
</identity>
1112
</identification>
1213
<fileinfo>
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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.4.0-SNAPSHOT" timestamp="4/2/19 4:22 PM">
3+
<identification>
4+
<identity format="JPEG 2000 JP2" mimetype="image/jp2" toolname="FITS" toolversion="1.4.1">
5+
<tool toolname="Droid" toolversion="6.4" />
6+
<tool toolname="Jhove" toolversion="1.20.1" />
7+
<tool toolname="file utility" toolversion="5.31" />
8+
<tool toolname="Exiftool" toolversion="11.14" />
9+
<tool toolname="Tika" toolversion="1.19.1" />
10+
<externalIdentifier toolname="Droid" toolversion="6.4" type="puid">x-fmt/392</externalIdentifier>
11+
</identity>
12+
</identification>
13+
<fileinfo>
14+
<size toolname="Jhove" toolversion="1.20.1">120521</size>
15+
<filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/dan179/git/git-daveneiman/fits/testfiles/2339337_not_well_formed.jp2</filepath>
16+
<filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">2339337_not_well_formed.jp2</filename>
17+
<md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1c9c7abb1cf187de78f550ec474f9952</md5checksum>
18+
<fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1554236769000</fslastmodified>
19+
</fileinfo>
20+
<filestatus>
21+
<well-formed toolname="Jhove" toolversion="1.20.1" status="SINGLE_RESULT">false</well-formed>
22+
<valid toolname="Jhove" toolversion="1.20.1" status="SINGLE_RESULT">false</valid>
23+
<message toolname="Jhove" toolversion="1.20.1" status="SINGLE_RESULT">First box of JP2 header must be image header severity=error offset=48</message>
24+
</filestatus>
25+
<metadata>
26+
<image>
27+
<compressionScheme toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">JPEG 2000</compressionScheme>
28+
<imageWidth toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">3039</imageWidth>
29+
<imageHeight toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">2490</imageHeight>
30+
<iccProfileName toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">Adobe RGB (1998)</iccProfileName>
31+
<samplingFrequencyUnit toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">cm</samplingFrequencyUnit>
32+
<xSamplingFrequency toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">3</xSamplingFrequency>
33+
<ySamplingFrequency toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">3</ySamplingFrequency>
34+
<iccProfileVersion toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">2.1.0</iccProfileVersion>
35+
<standard>
36+
<mix:mix xmlns:mix="http://www.loc.gov/mix/v20">
37+
<mix:BasicDigitalObjectInformation>
38+
<mix:Compression>
39+
<mix:compressionScheme>JPEG 2000</mix:compressionScheme>
40+
</mix:Compression>
41+
</mix:BasicDigitalObjectInformation>
42+
<mix:BasicImageInformation>
43+
<mix:BasicImageCharacteristics>
44+
<mix:imageWidth>3039</mix:imageWidth>
45+
<mix:imageHeight>2490</mix:imageHeight>
46+
<mix:PhotometricInterpretation>
47+
<mix:ColorProfile>
48+
<mix:IccProfile>
49+
<mix:iccProfileName>Adobe RGB (1998)</mix:iccProfileName>
50+
<mix:iccProfileVersion>2.1.0</mix:iccProfileVersion>
51+
</mix:IccProfile>
52+
</mix:ColorProfile>
53+
</mix:PhotometricInterpretation>
54+
</mix:BasicImageCharacteristics>
55+
</mix:BasicImageInformation>
56+
<mix:ImageCaptureMetadata>
57+
<mix:GeneralCaptureInformation />
58+
</mix:ImageCaptureMetadata>
59+
<mix:ImageAssessmentMetadata>
60+
<mix:SpatialMetrics>
61+
<mix:samplingFrequencyUnit>cm</mix:samplingFrequencyUnit>
62+
<mix:xSamplingFrequency>
63+
<mix:numerator>3</mix:numerator>
64+
<mix:denominator>1</mix:denominator>
65+
</mix:xSamplingFrequency>
66+
<mix:ySamplingFrequency>
67+
<mix:numerator>3</mix:numerator>
68+
<mix:denominator>1</mix:denominator>
69+
</mix:ySamplingFrequency>
70+
</mix:SpatialMetrics>
71+
<mix:ImageColorEncoding />
72+
</mix:ImageAssessmentMetadata>
73+
</mix:mix>
74+
</standard>
75+
</image>
76+
</metadata>
77+
<statistics fitsExecutionTime="713">
78+
<tool toolname="MediaInfo" toolversion="0.7.75" status="did not run" />
79+
<tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" />
80+
<tool toolname="ADL Tool" toolversion="0.1" status="did not run" />
81+
<tool toolname="VTT Tool" toolversion="0.1" status="did not run" />
82+
<tool toolname="Droid" toolversion="6.4" executionTime="145" />
83+
<tool toolname="Jhove" toolversion="1.20.1" executionTime="583" />
84+
<tool toolname="file utility" toolversion="5.31" executionTime="643" />
85+
<tool toolname="Exiftool" toolversion="11.14" executionTime="660" />
86+
<tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="did not run" />
87+
<tool toolname="OIS File Information" toolversion="0.2" executionTime="145" />
88+
<tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
89+
<tool toolname="ffident" toolversion="0.2" executionTime="497" />
90+
<tool toolname="Tika" toolversion="1.19.1" executionTime="185" />
91+
</statistics>
92+
</fits>
93+

0 commit comments

Comments
 (0)