forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade jhove from 1.11.0 to 1.20.1, add tests IQSS#2202
- Loading branch information
Showing
22 changed files
with
104 additions
and
50 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
Binary file removed
BIN
-41 KB
local_lib/edu/harvard/hul/ois/jhove/jhove-handler/1.11.0/jhove-handler-1.11.0.jar
Binary file not shown.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-handler/1.11.0/jhove-handler-1.11.0.jar.md5
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-handler/1.11.0/jhove-handler-1.11.0.jar.sha1
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
local_lib/edu/harvard/hul/ois/jhove/jhove-handler/1.11.0/jhove-handler-1.11.0.pom
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-handler/1.11.0/jhove-handler-1.11.0.pom.md5
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-handler/1.11.0/jhove-handler-1.11.0.pom.sha1
This file was deleted.
Oops, something went wrong.
Binary file removed
BIN
-519 KB
local_lib/edu/harvard/hul/ois/jhove/jhove-module/1.11.0/jhove-module-1.11.0.jar
Binary file not shown.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-module/1.11.0/jhove-module-1.11.0.jar.md5
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-module/1.11.0/jhove-module-1.11.0.jar.sha1
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
local_lib/edu/harvard/hul/ois/jhove/jhove-module/1.11.0/jhove-module-1.11.0.pom
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-module/1.11.0/jhove-module-1.11.0.pom.md5
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove-module/1.11.0/jhove-module-1.11.0.pom.sha1
This file was deleted.
Oops, something went wrong.
Binary file not shown.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove/1.11.0/jhove-1.11.0.jar.md5
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove/1.11.0/jhove-1.11.0.jar.sha1
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
local_lib/edu/harvard/hul/ois/jhove/jhove/1.11.0/jhove-1.11.0.pom
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove/1.11.0/jhove-1.11.0.pom.md5
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
local_lib/edu/harvard/hul/ois/jhove/jhove/1.11.0/jhove-1.11.0.pom.sha1
This file was deleted.
Oops, something went wrong.
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
80 changes: 80 additions & 0 deletions
80
src/test/java/edu/harvard/iq/dataverse/util/JhoveFileTypeTest.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,80 @@ | ||
package edu.harvard.iq.dataverse.util; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
import org.apache.commons.io.FileUtils; | ||
import static org.junit.Assert.assertEquals; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class JhoveFileTypeTest { | ||
|
||
static JhoveFileType jhoveFileType; | ||
static String baseDirForConfigFiles = "/tmp"; | ||
static File png; | ||
static File gif; | ||
static File jpg; | ||
static File pdf; | ||
static File zip; | ||
static File xml; | ||
static File html; | ||
static File ico; | ||
|
||
@BeforeClass | ||
public static void setUpClass() { | ||
jhoveFileType = new JhoveFileType(); | ||
copyConfigIntoPlace(); | ||
|
||
png = new File("src/test/resources/images/coffeeshop.png"); | ||
gif = new File("src/main/webapp/resources/images/ajax-loading.gif"); | ||
jpg = new File("src/main/webapp/resources/images/dataverseproject_logo.jpg"); | ||
pdf = new File("scripts/issues/1380/dvs.pdf"); | ||
zip = new File("src/test/resources/doi-10-5072-fk2hyixmyv1.0.zip"); | ||
xml = new File("pom.xml"); | ||
html = new File("src/main/webapp/mydata_templates/mydata.html"); | ||
ico = new File("src/main/webapp/resources/images/fav/favicon.ico"); | ||
} | ||
|
||
@Test | ||
public void testGetFileMimeType() { | ||
System.out.println("getFileMimeType"); | ||
// GOOD: figured it out. :) | ||
assertEquals("image/png", jhoveFileType.getFileMimeType(png)); | ||
assertEquals("image/gif", jhoveFileType.getFileMimeType(gif)); | ||
assertEquals("image/jpeg", jhoveFileType.getFileMimeType(jpg)); | ||
assertEquals("application/pdf", jhoveFileType.getFileMimeType(pdf)); | ||
// BAD: couldn't figure it out. :( | ||
assertEquals("application/octet-stream", jhoveFileType.getFileMimeType(zip)); | ||
assertEquals("application/octet-stream", jhoveFileType.getFileMimeType(ico)); | ||
// BAD: not very specific. :( | ||
assertEquals("text/plain; charset=US-ASCII", jhoveFileType.getFileMimeType(xml)); | ||
assertEquals("text/plain; charset=US-ASCII", jhoveFileType.getFileMimeType(html)); | ||
} | ||
|
||
@Test | ||
public void testCheckFileType() { | ||
System.out.println("checkFileType"); | ||
jhoveFileType = new JhoveFileType(); | ||
assertEquals(543938, jhoveFileType.checkFileType(png).getSize()); | ||
} | ||
|
||
@Test | ||
public void testGetJhoveConfigFile() { | ||
System.out.println("getJhoveConfigFile"); | ||
assertEquals(baseDirForConfigFiles + "/config/jhove.conf", JhoveFileType.getJhoveConfigFile()); | ||
} | ||
|
||
private static void copyConfigIntoPlace() { | ||
String testFile1Src = "conf/jhove/jhove.conf"; | ||
System.setProperty("com.sun.aas.instanceRoot", baseDirForConfigFiles); | ||
String testFile1Tmp = baseDirForConfigFiles + "/config/jhove.conf"; | ||
try { | ||
FileUtils.copyFile(new File(testFile1Src), new File(testFile1Tmp)); | ||
} catch (IOException ex) { | ||
Logger.getLogger(JhoveFileTypeTest.class.getName()).log(Level.SEVERE, null, ex); | ||
} | ||
} | ||
|
||
} |