Skip to content

Commit

Permalink
Add new unit test; remove misplaced test; update README; change POM t…
Browse files Browse the repository at this point in the history
…o release version
  • Loading branch information
daveneiman committed May 25, 2018
1 parent e7aa364 commit 6e4eedf
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 17 deletions.
18 changes: 16 additions & 2 deletions README.md
Expand Up @@ -5,9 +5,23 @@ System Requirements
-------------------
FITS is a Java program and requires Java version 1.7 or higher. To find out your Java version type java -version in a command-line window.

Building FITS
-------------
As of release 1.3.0 FITS is built using [Apache Maven](https://maven.apache.org/).
The build artifacts are fits-<version>.jar and fits-<version>.zip. The JAR file contains the compiled Java source files contained in this project whereas the ZIP file contains the final artifact which can be extracted and used to process input files for analysis.
The ZIP file can be built with the following command, which will also run the entire test suite:

mvn clean package

To build yet skip the tests, use the following command:

mvn clean package -DskipTests

NOTE: A few Maven dependencies are not in public repositories. These are within the source tree in the lib-local directory. Other dependencies are within the lib directory for use by the FITS custom classloader.

Installation
------------
Download the latest official release from our [Downloads](http://fitstool.org/downloads) page.
Download the latest official binary release from our [Downloads](http://fitstool.org/downloads) page.

**IMPORTANT NOTE**: The code on this GitHub site is not meant for direct installation since it does NOT include the necessary fits.jar file (which is a primary build artifact of this project). If you want to use this GitHub site for installing FITS, you must first download (or Git clone) the code then build the project using the Ant 'release' target.

Expand All @@ -19,7 +33,7 @@ If this is your first time downloading FITS, create a directory for FITS, for ex

Extract the contents of your ZIP file to your FITS directory. You should end up with a another directory under your top-level FITS directory that has a version number embedded in it, for example on Windows:

C:\Program Files\Fits\fits-1.0.0
C:\Program Files\Fits\fits-1.3.0

Running FITS
------------
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.harvard.huit.lts</groupId>
<artifactId>fits</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.3.0</version>
<packaging>jar</packaging>

<name>FITS</name>
Expand Down
15 changes: 13 additions & 2 deletions src/test/java/edu/harvard/hul/ois/fits/junit/TextMDTest.java
Expand Up @@ -40,7 +40,8 @@ public class TextMDTest extends AbstractLoggingTest {
@BeforeClass
public static void beforeClass() throws Exception {
// Set up FITS for entire class.
fits = new Fits();
File fitsConfigFile = new File("testfiles/properties/fits-full-with-tool-output.xml");
fits = new Fits(null, fitsConfigFile);
}

@AfterClass
Expand All @@ -49,14 +50,24 @@ public static void afterClass() {
}

@Test
public void testTextMD() throws Exception {
public void testUTF16TextMD() throws Exception {

String fileName = "utf16.txt";
File input = new File("testfiles/" + fileName);
FitsOutput fitsOut = fits.examine(input);
fitsOut.addStandardCombinedFormat();
fitsOut.saveToDisk("test-generated-output/" + fileName + "_Output.xml");
}

@Test
public void testPlainText() throws Exception {

String fileName = "plain-text.txt";
File input = new File("testfiles/" + fileName);
FitsOutput fitsOut = fits.examine(input);
fitsOut.addStandardCombinedFormat();
fitsOut.saveToDisk("test-generated-output/" + fileName + "_Output.xml");
}

@Test
public void testCsv() throws Exception {
Expand Down
Expand Up @@ -52,7 +52,7 @@ public static void afterClass() {
}

@Test
public void testTextMD() throws Exception {
public void testUTF16TextMD() throws Exception {

String inputFilename = "utf16.txt";
File input = new File("testfiles/" + inputFilename);
Expand All @@ -72,7 +72,29 @@ public void testTextMD() throws Exception {

testActualAgainstExpected(actualXmlStr, expectedXmlStr, inputFilename);
}


@Test
public void testPlainText() throws Exception {

String inputFilename = "plain-text.txt";
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);
}

@Test
public void testCsv() throws Exception {

Expand Down
Expand Up @@ -49,16 +49,6 @@ public static void beforeClass() throws Exception {
public static void afterClass() {
fits = null;
}

@Test
public void testVideo_AVC() throws Exception {

String fileName = "utf16.txt";
File input = new File("testfiles/" + fileName);
FitsOutput fitsOut = fits.examine(input);
fitsOut.addStandardCombinedFormat();
fitsOut.saveToDisk("test-generated-output/" + fileName + "_Output.xml");
}

@Test
public void testVideo_DV() throws Exception {
Expand Down
52 changes: 52 additions & 0 deletions testfiles/output/plain-text.txt_XmlUnitExpectedOutput.xml
@@ -0,0 +1,52 @@
<?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="build.version=1.3.0" timestamp="5/15/18 11:05 AM">
<identification>
<identity format="Plain text" mimetype="text/plain" toolname="FITS" toolversion="build.version=1.3.0">
<tool toolname="Droid" toolversion="6.3" />
<tool toolname="Jhove" toolversion="1.20" />
<tool toolname="file utility" toolversion="5.31" />
<externalIdentifier toolname="Droid" toolversion="6.3" type="puid">x-fmt/111</externalIdentifier>
</identity>
</identification>
<fileinfo>
<size toolname="Jhove" toolversion="1.20">42</size>
<filepath toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">/Users/dan179/git/git-daveneiman/fits/testfiles/plain-text.txt</filepath>
<filename toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">plain-text.txt</filename>
<md5checksum toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">b5b143e235cb5328a0f284679ed93a6e</md5checksum>
<fslastmodified toolname="OIS File Information" toolversion="0.2" status="SINGLE_RESULT">1526312227000</fslastmodified>
</fileinfo>
<filestatus>
<well-formed toolname="Jhove" toolversion="1.20" status="SINGLE_RESULT">true</well-formed>
<valid toolname="Jhove" toolversion="1.20" status="SINGLE_RESULT">true</valid>
</filestatus>
<metadata>
<text>
<linebreak toolname="Jhove" toolversion="1.20" status="SINGLE_RESULT">LF</linebreak>
<charset toolname="Jhove" toolversion="1.20">US-ASCII</charset>
<standard>
<textMD:textMD xmlns:textMD="info:lc/xmlns/textMD-v3">
<textMD:character_info>
<textMD:charset>US-ASCII</textMD:charset>
<textMD:linebreak>LF</textMD:linebreak>
</textMD:character_info>
</textMD:textMD>
</standard>
</text>
</metadata>
<statistics fitsExecutionTime="1192">
<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.3" executionTime="146" />
<tool toolname="Jhove" toolversion="1.20" executionTime="1005" />
<tool toolname="file utility" toolversion="5.31" executionTime="1173" />
<tool toolname="Exiftool" toolversion="10.00" status="did not run" />
<tool toolname="NLNZ Metadata Extractor" toolversion="3.6GA" status="did not run" />
<tool toolname="OIS File Information" toolversion="0.2" executionTime="141" />
<tool toolname="OIS XML Metadata" toolversion="0.2" status="did not run" />
<tool toolname="ffident" toolversion="0.2" executionTime="949" />
<tool toolname="Tika" toolversion="1.10" executionTime="257" />
</statistics>
</fits>

1 change: 1 addition & 0 deletions testfiles/plain-text.txt
@@ -0,0 +1 @@
Just some plain text for FITS processing.

0 comments on commit 6e4eedf

Please sign in to comment.