-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/harvard-lts/fits into dev
- Loading branch information
Showing
18 changed files
with
439 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2009 Harvard University Library | ||
* | ||
* This file is part of FITS (File Information Tool Set). | ||
* | ||
* FITS is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* FITS is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with FITS. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package edu.harvard.hul.ois.fits.junit; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import edu.harvard.hul.ois.fits.Fits; | ||
import edu.harvard.hul.ois.fits.FitsOutput; | ||
import edu.harvard.hul.ois.fits.tests.AbstractLoggingTest; | ||
|
||
|
||
public class M4aTest extends AbstractLoggingTest { | ||
|
||
/* | ||
* Only one Fits instance is needed to run all tests. | ||
* This also speeds up the tests. | ||
*/ | ||
private static Fits fits; | ||
|
||
@BeforeClass | ||
public static void beforeClass() throws Exception { | ||
// Set up FITS for entire class. | ||
File fitsConfigFile = new File("testfiles/properties/fits-full-with-tool-output.xml"); | ||
fits = new Fits(null, fitsConfigFile); | ||
} | ||
|
||
@AfterClass | ||
public static void afterClass() { | ||
fits = null; | ||
} | ||
|
||
@Test | ||
public void testM4a() throws Exception { | ||
|
||
String fileName = "sample.m4a"; | ||
File input = new File("testfiles/" + fileName); | ||
FitsOutput fitsOut = fits.examine(input); | ||
fitsOut.addStandardCombinedFormat(); | ||
fitsOut.saveToDisk("test-generated-output/" + fileName + "_Output.xml"); | ||
} | ||
|
||
} |
93 changes: 93 additions & 0 deletions
93
src/test/java/edu/harvard/hul/ois/fits/junit/M4aXmlUnitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Copyright 2009 Harvard University Library | ||
* | ||
* This file is part of FITS (File Information Tool Set). | ||
* | ||
* FITS is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* FITS is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with FITS. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package edu.harvard.hul.ois.fits.junit; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Scanner; | ||
|
||
import org.jdom.output.Format; | ||
import org.jdom.output.XMLOutputter; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import edu.harvard.hul.ois.fits.Fits; | ||
import edu.harvard.hul.ois.fits.FitsOutput; | ||
import edu.harvard.hul.ois.fits.tests.AbstractXmlUnitTest; | ||
|
||
|
||
public class M4aXmlUnitTest extends AbstractXmlUnitTest { | ||
|
||
/* | ||
* Only one Fits instance is needed to run all tests. | ||
* This also speeds up the tests. | ||
*/ | ||
private static Fits fits; | ||
|
||
@BeforeClass | ||
public static void beforeClass() throws Exception { | ||
// Set up FITS for entire class. | ||
fits = new Fits(); | ||
} | ||
|
||
@AfterClass | ||
public static void afterClass() { | ||
fits = null; | ||
} | ||
|
||
@Override | ||
protected String[] getIgnoredXmlElements() { | ||
String[] ignored = super.getIgnoredXmlElements(); | ||
List<String> additionalIgnored = new ArrayList<>(Arrays.asList(ignored)); | ||
additionalIgnored.add("ID"); | ||
additionalIgnored.add("audioObjectRef"); | ||
additionalIgnored.add("formatRef"); | ||
additionalIgnored.add("faceRef"); | ||
additionalIgnored.add("faceRegionRef"); | ||
additionalIgnored.add("ownerRef"); | ||
|
||
return additionalIgnored.toArray(new String[additionalIgnored.size()]); | ||
} | ||
|
||
@Test | ||
public void testM4a() throws Exception { | ||
|
||
String inputFilename = "sample.m4a"; | ||
File input = new File("testfiles/" + inputFilename); | ||
FitsOutput fitsOut = fits.examine(input); | ||
fitsOut.addStandardCombinedFormat(); | ||
fitsOut.saveToDisk("test-generated-output/" + inputFilename + ACTUAL_OUTPUT_FILE_SUFFIX); | ||
|
||
XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat()); | ||
String actualXmlStr = serializer.outputString(fitsOut.getFitsXml()); | ||
|
||
// Read in the expected XML file | ||
Scanner scan = new Scanner(new File( | ||
"testfiles/output/" + inputFilename + EXPECTED_OUTPUT_FILE_SUFFIX)); | ||
String expectedXmlStr = scan. | ||
useDelimiter("\\Z").next(); | ||
scan.close(); | ||
|
||
testActualAgainstExpected(actualXmlStr, expectedXmlStr, inputFilename); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
13 changes: 7 additions & 6 deletions
13
testfiles/output/006607203_00018.jp2_XmlUnitExpectedOutput.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
testfiles/output/2339337_not_well_formed.jp2_XmlUnitExpectedOutput.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
<identification> | ||
<identity format="JPEG 2000 JP2" mimetype="image/jp2" toolname="FITS" toolversion="1.4.1"> | ||
<tool toolname="Droid" toolversion="6.4" /> | ||
<tool toolname="Jhove" toolversion="1.20.1" /> | ||
<tool toolname="file utility" toolversion="5.31" /> | ||
<tool toolname="Exiftool" toolversion="11.14" /> | ||
<tool toolname="Tika" toolversion="1.19.1" /> | ||
<externalIdentifier toolname="Droid" toolversion="6.4" type="puid">x-fmt/392</externalIdentifier> | ||
</identity> | ||
</identification> | ||
<fileinfo> | ||
<size toolname="Jhove" toolversion="1.20.1">120521</size> | ||
<filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/dan179/git/git-daveneiman/fits/testfiles/2339337_not_well_formed.jp2</filepath> | ||
<filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">2339337_not_well_formed.jp2</filename> | ||
<md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1c9c7abb1cf187de78f550ec474f9952</md5checksum> | ||
<fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1554236769000</fslastmodified> | ||
</fileinfo> | ||
<filestatus> | ||
<well-formed toolname="Jhove" toolversion="1.20.1" status="SINGLE_RESULT">false</well-formed> | ||
<valid toolname="Jhove" toolversion="1.20.1" status="SINGLE_RESULT">false</valid> | ||
<message toolname="Jhove" toolversion="1.20.1" status="SINGLE_RESULT">First box of JP2 header must be image header severity=error offset=48</message> | ||
</filestatus> | ||
<metadata> | ||
<image> | ||
<compressionScheme toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">JPEG 2000</compressionScheme> | ||
<imageWidth toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">3039</imageWidth> | ||
<imageHeight toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">2490</imageHeight> | ||
<iccProfileName toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">Adobe RGB (1998)</iccProfileName> | ||
<samplingFrequencyUnit toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">cm</samplingFrequencyUnit> | ||
<xSamplingFrequency toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">3</xSamplingFrequency> | ||
<ySamplingFrequency toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">3</ySamplingFrequency> | ||
<iccProfileVersion toolname="Exiftool" toolversion="11.14" status="SINGLE_RESULT">2.1.0</iccProfileVersion> | ||
<standard> | ||
<mix:mix xmlns:mix="http://www.loc.gov/mix/v20"> | ||
<mix:BasicDigitalObjectInformation> | ||
<mix:Compression> | ||
<mix:compressionScheme>JPEG 2000</mix:compressionScheme> | ||
</mix:Compression> | ||
</mix:BasicDigitalObjectInformation> | ||
<mix:BasicImageInformation> | ||
<mix:BasicImageCharacteristics> | ||
<mix:imageWidth>3039</mix:imageWidth> | ||
<mix:imageHeight>2490</mix:imageHeight> | ||
<mix:PhotometricInterpretation> | ||
<mix:ColorProfile> | ||
<mix:IccProfile> | ||
<mix:iccProfileName>Adobe RGB (1998)</mix:iccProfileName> | ||
<mix:iccProfileVersion>2.1.0</mix:iccProfileVersion> | ||
</mix:IccProfile> | ||
</mix:ColorProfile> | ||
</mix:PhotometricInterpretation> | ||
</mix:BasicImageCharacteristics> | ||
</mix:BasicImageInformation> | ||
<mix:ImageCaptureMetadata> | ||
<mix:GeneralCaptureInformation /> | ||
</mix:ImageCaptureMetadata> | ||
<mix:ImageAssessmentMetadata> | ||
<mix:SpatialMetrics> | ||
<mix:samplingFrequencyUnit>cm</mix:samplingFrequencyUnit> | ||
<mix:xSamplingFrequency> | ||
<mix:numerator>3</mix:numerator> | ||
<mix:denominator>1</mix:denominator> | ||
</mix:xSamplingFrequency> | ||
<mix:ySamplingFrequency> | ||
<mix:numerator>3</mix:numerator> | ||
<mix:denominator>1</mix:denominator> | ||
</mix:ySamplingFrequency> | ||
</mix:SpatialMetrics> | ||
<mix:ImageColorEncoding /> | ||
</mix:ImageAssessmentMetadata> | ||
</mix:mix> | ||
</standard> | ||
</image> | ||
</metadata> | ||
<statistics fitsExecutionTime="713"> | ||
<tool toolname="MediaInfo" toolversion="0.7.75" status="did not run" /> | ||
<tool toolname="OIS Audio Information" toolversion="0.1" status="did not run" /> | ||
<tool toolname="ADL Tool" toolversion="0.1" status="did not run" /> | ||
<tool toolname="VTT Tool" toolversion="0.1" status="did not run" /> | ||
<tool toolname="Droid" toolversion="6.4" executionTime="145" /> | ||
<tool toolname="Jhove" toolversion="1.20.1" executionTime="583" /> | ||
<tool toolname="file utility" toolversion="5.31" executionTime="643" /> | ||
<tool toolname="Exiftool" toolversion="11.14" executionTime="660" /> | ||
<tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="did not run" /> | ||
<tool toolname="OIS File Information" toolversion="0.2" executionTime="145" /> | ||
<tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" /> | ||
<tool toolname="ffident" toolversion="0.2" executionTime="497" /> | ||
<tool toolname="Tika" toolversion="1.19.1" executionTime="185" /> | ||
</statistics> | ||
</fits> | ||
|
Oops, something went wrong.