diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2017-06-22 14:56:15 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2017-06-22 14:56:15 +0200 |
commit | d840a372f84518c4026efd3d463cfcffac930e46 (patch) | |
tree | 63e3e273ceeb8f55de18467eda109c0f488c5f67 /BKUViewer/src/test/java | |
parent | 345a8534ff39cc9550cbacabe2b3fffe20293508 (diff) | |
download | mocca-d840a372f84518c4026efd3d463cfcffac930e46.tar.gz mocca-d840a372f84518c4026efd3d463cfcffac930e46.tar.bz2 mocca-d840a372f84518c4026efd3d463cfcffac930e46.zip |
update jUnit test do validate XXE prevention in Signed data viewer
Diffstat (limited to 'BKUViewer/src/test/java')
-rw-r--r-- | BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java b/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java index 1dd8c45f..d51b52eb 100644 --- a/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java +++ b/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java @@ -71,4 +71,26 @@ public class ValidatorTest { } + @Test + public void testValidateWithDocType() throws ValidationException { + + String slxhtmlFile = "at/gv/egiz/bku/slxhtml/zugang_with_DocType.xhtml"; + + Validator validator = ValidatorFactory.newValidator("application/xhtml+xml"); + + ClassLoader cl = ValidatorTest.class.getClassLoader(); + InputStream slxhtml = cl.getResourceAsStream(slxhtmlFile); + long t0 = System.currentTimeMillis(); + try { + validator.validate(slxhtml, null); + + } catch (ValidationException e) { + e.printStackTrace(); + throw e; + } + long t1 = System.currentTimeMillis(); + log.info("Validated SLXHTML file '{}' in {}ms.", slxhtmlFile, t1 - t0); + + } + } |