You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2018/08/30 12:06:37 UTC
svn commit: r1839666 - in
/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom:
c14n/implementations/ signature/ transforms/implementations/
Author: coheigea
Date: Thu Aug 30 12:06:37 2018
New Revision: 1839666
URL: http://svn.apache.org/viewvc?rev=1839666&view=rev
Log:
Simplifying exception handling in the tests
Modified:
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java
santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java?rev=1839666&r1=1839665&r2=1839666&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer11Test.java Thu Aug 30 12:06:37 2018
@@ -18,32 +18,25 @@
*/
package org.apache.xml.security.test.dom.c14n.implementations;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import org.apache.xml.security.c14n.CanonicalizationException;
import org.apache.xml.security.c14n.Canonicalizer;
-import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.utils.IgnoreAllErrorHandler;
import org.apache.xml.security.utils.JavaUtils;
import org.apache.xml.security.utils.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
/**
* Unit test for
@@ -71,21 +64,9 @@ public class Canonicalizer11Test {
/**
* 3.1 PIs, Comments, and Outside of Document Element
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test31withCommentsSubtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test31withCommentsSubtree() throws Exception {
String descri =
"3.1: PIs, Comments, and Outside of Document Element. (commented)";
@@ -102,22 +83,11 @@ public class Canonicalizer11Test {
/**
* 3.2 Whitespace in Document Content
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
+
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test32subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test32subtree() throws Exception {
String descri = "3.2 Whitespace in Document Content. (uncommented)";
String fileIn = prefix + "in/32_input.xml";
String fileRef = prefix + "in/32_c14n.xml";
@@ -133,21 +103,10 @@ public class Canonicalizer11Test {
/**
* 3.3 Start and End Tags
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-SETags">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test33subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test33subtree() throws Exception {
String descri = "3.3 Start and End Tags. (uncommented)";
String fileIn = prefix + "in/33_input.xml";
String fileRef = prefix + "in/33_c14n.xml";
@@ -163,22 +122,11 @@ public class Canonicalizer11Test {
/**
* 3.4 Character Modifications and Character References
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see #test34validatingParser
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test34()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test34() throws Exception {
String descri =
"3.4 Character Modifications and Character References. (uncommented)";
String fileIn = prefix + "in/34_input.xml";
@@ -195,21 +143,10 @@ public class Canonicalizer11Test {
/**
* 3.5 Entity References
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test35subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test35subtree() throws Exception {
String descri = "3.5 Entity References. (uncommented)";
String fileIn = prefix + "in/35_input.xml";
String fileRef = prefix + "in/35_c14n.xml";
@@ -225,21 +162,10 @@ public class Canonicalizer11Test {
/**
* 3.6 UTF-8 Encoding
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test36subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test36subtree() throws Exception {
String descri = "3.6 UTF-8 Encoding. (uncommented)";
String fileIn = prefix + "in/36_input.xml";
String fileRef = prefix + "in/36_c14n.xml";
@@ -255,21 +181,10 @@ public class Canonicalizer11Test {
/**
* 3.7 Document Subsets
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-DocSubsets">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test37()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test37() throws Exception {
String descri = "3.7 Document Subsets. (uncommented)";
String fileIn = prefix + "in/37_input.xml";
String fileRef = prefix + "in/37_c14n.xml";
@@ -293,21 +208,9 @@ public class Canonicalizer11Test {
/**
* 3.8 Document Subsets and XML Attributes
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test38()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test38() throws Exception {
String descri = "3.8 Document Subsets and XML Attributes (uncommented)";
String fileIn = prefix + "in/38_input.xml";
String fileRef = prefix + "in/38_c14n.xml";
@@ -336,9 +239,7 @@ public class Canonicalizer11Test {
String c14nURI,
boolean validating,
String xpath
- ) throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ ) throws Exception {
Map<String, String> namespace = new HashMap<>();
return c14nAndCompare(fileIn, fileRef, fileOut,
c14nURI, validating, xpath, namespace);
@@ -352,9 +253,7 @@ public class Canonicalizer11Test {
boolean validating,
String xpath,
Map<String, String> namespaces
- ) throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ ) throws Exception {
Document doc = XMLUtils.read(fileIn, validating, false, new IgnoreAllErrorHandler());
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java?rev=1839666&r1=1839665&r2=1839666&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315ExclusiveTest.java Thu Aug 30 12:06:37 2018
@@ -18,33 +18,25 @@
*/
package org.apache.xml.security.test.dom.c14n.implementations;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.io.StringReader;
import java.util.HashSet;
import java.util.Set;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
-import org.apache.xml.security.c14n.CanonicalizationException;
-import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.apache.xml.security.c14n.implementations.Canonicalizer20010315;
import org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl;
import org.apache.xml.security.c14n.implementations.Canonicalizer20010315ExclOmitComments;
import org.apache.xml.security.c14n.implementations.Canonicalizer20010315ExclWithComments;
import org.apache.xml.security.c14n.implementations.Canonicalizer20010315WithComments;
-import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.signature.XMLSignature;
-import org.apache.xml.security.signature.XMLSignatureException;
import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.utils.Constants;
@@ -55,7 +47,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
/**
@@ -73,25 +64,9 @@ public class Canonicalizer20010315Exclus
/**
* Method testA
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XMLSecurityException
- * @throws XMLSignatureException
- * @throws org.apache.xml.security.keys.keyresolver.KeyResolverException
*/
@org.junit.Test
- public void testA()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException,
- XMLSignatureException, XMLSecurityException,
- org.apache.xml.security.keys.keyresolver.KeyResolverException {
+ public void testA() throws Exception {
File fileIn = new File(getAbsolutePath(
"src/test/resources/ie/baltimore/merlin-examples/ec-merlin-iaikTests-two/signature.xml"));
@@ -125,23 +100,9 @@ public class Canonicalizer20010315Exclus
/**
* Method test221
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XMLSecurityException
- * @throws XMLSignatureException
*/
@org.junit.Test
- public void test221()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException,
- XMLSignatureException, XMLSecurityException {
+ public void test221() throws Exception {
Document doc =
XMLUtils.read(
@@ -160,23 +121,9 @@ public class Canonicalizer20010315Exclus
/**
* Method test222
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XMLSecurityException
- * @throws XMLSignatureException
*/
@org.junit.Test
- public void test222()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException,
- XMLSignatureException, XMLSecurityException {
+ public void test222() throws Exception {
Document doc =
XMLUtils.read(new FileInputStream(getAbsolutePath(
"src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_2.xml")
@@ -193,23 +140,9 @@ public class Canonicalizer20010315Exclus
/**
* Method test221excl
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XMLSecurityException
- * @throws XMLSignatureException
*/
@org.junit.Test
- public void test221excl()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException,
- XMLSignatureException, XMLSecurityException {
+ public void test221excl() throws Exception {
Document doc =
XMLUtils.read(new FileInputStream(getAbsolutePath(
"src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_1.xml")),
@@ -226,23 +159,9 @@ public class Canonicalizer20010315Exclus
/**
* Method test222excl
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XMLSecurityException
- * @throws XMLSignatureException
*/
@org.junit.Test
- public void test222excl()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException,
- XMLSignatureException, XMLSecurityException {
+ public void test222excl() throws Exception {
Document doc =
XMLUtils.read(new FileInputStream(getAbsolutePath(
"src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_2.xml")),
@@ -261,24 +180,9 @@ public class Canonicalizer20010315Exclus
* Method test223excl
*
* Provided by Gabriel McGoldrick - see e-mail of 21/11/03
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XMLSecurityException
- * @throws XMLSignatureException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test223excl()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException,
- XMLSignatureException, XMLSecurityException, XPathExpressionException {
+ public void test223excl() throws Exception {
Document doc =
XMLUtils.read(new FileInputStream(getAbsolutePath(
"src/test/resources/org/apache/xml/security/c14n/inExcl/example2_2_3.xml")),
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java?rev=1839666&r1=1839665&r2=1839666&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/c14n/implementations/Canonicalizer20010315Test.java Thu Aug 30 12:06:37 2018
@@ -18,42 +18,35 @@
*/
package org.apache.xml.security.test.dom.c14n.implementations;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.xml.security.c14n.CanonicalizationException;
import org.apache.xml.security.c14n.Canonicalizer;
-import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.utils.IgnoreAllErrorHandler;
import org.apache.xml.security.utils.JavaUtils;
import org.apache.xml.security.utils.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
/**
@@ -83,21 +76,9 @@ public class Canonicalizer20010315Test {
/**
* 3.1 PIs, Comments, and Outside of Document Element
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test31withCommentsSubtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test31withCommentsSubtree() throws Exception {
String descri =
"3.1: PIs, Comments, and Outside of Document Element. (commented)";
@@ -114,21 +95,9 @@ public class Canonicalizer20010315Test {
/**
* 3.1 PIs, Comments, and Outside of Document Element
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test31withCommentsSubset()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test31withCommentsSubset() throws Exception {
String descri =
"3.1: PIs, Comments, and Outside of Document Element. (commented)";
@@ -145,22 +114,11 @@ public class Canonicalizer20010315Test {
/**
* 3.1 PIs, Comments, and Outside of Document Element
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
+
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-OutsideDoc">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test31subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test31subtree() throws Exception {
String descri =
"3.1: PIs, Comments, and Outside of Document Element. (uncommented)";
String fileIn = prefix + "in/31_input.xml";
@@ -177,21 +135,10 @@ public class Canonicalizer20010315Test {
/**
* 3.1 PIs, Comments, and Outside of Document Element
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-OutsideDoc">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test31subset()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test31subset() throws Exception {
String descri =
"3.1: PIs, Comments, and Outside of Document Element. (uncommented)";
@@ -209,21 +156,10 @@ public class Canonicalizer20010315Test {
/**
* 3.2 Whitespace in Document Content
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test32subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test32subtree() throws Exception {
String descri = "3.2 Whitespace in Document Content. (uncommented)";
String fileIn = prefix + "in/32_input.xml";
String fileRef = prefix + "in/32_c14n.xml";
@@ -239,21 +175,10 @@ public class Canonicalizer20010315Test {
/**
* 3.2 Whitespace in Document Content
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-WhitespaceInContent">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test32subset()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test32subset() throws Exception {
String descri = "3.2 Whitespace in Document Content. (uncommented)";
String fileIn = prefix + "in/32_input.xml";
String fileRef = prefix + "in/32_c14n.xml";
@@ -269,21 +194,10 @@ public class Canonicalizer20010315Test {
/**
* 3.3 Start and End Tags
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-SETags">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test33subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test33subtree() throws Exception {
String descri = "3.3 Start and End Tags. (uncommented)";
String fileIn = prefix + "in/33_input.xml";
String fileRef = prefix + "in/33_c14n.xml";
@@ -297,10 +211,7 @@ public class Canonicalizer20010315Test {
}
@org.junit.Test
- public void test33subset()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test33subset() throws Exception {
String descri = "3.3 Start and End Tags. (uncommented)";
String fileIn = prefix + "in/33_input.xml";
String fileRef = prefix + "in/33_c14n.xml";
@@ -316,22 +227,11 @@ public class Canonicalizer20010315Test {
/**
* 3.4 Character Modifications and Character References
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see #test34validatingParser
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test34()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test34() throws Exception {
String descri =
"3.4 Character Modifications and Character References. (uncommented)";
String fileIn = prefix + "in/34_input.xml";
@@ -356,21 +256,10 @@ public class Canonicalizer20010315Test {
* containing this element from the input and canonical form. In general,
* XML consumers should be discouraged from using this feature of XML.
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test34subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test34subtree() throws Exception {
String descri =
"3.4 Character Modifications and Character References. (uncommented, patched to run on validating Parsers)";
String fileIn = prefix + "in/34_input_validatingParser.xml";
@@ -395,21 +284,10 @@ public class Canonicalizer20010315Test {
* containing this element from the input and canonical form. In general,
* XML consumers should be discouraged from using this feature of XML.
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Chars">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test34subset()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test34subset() throws Exception {
String descri =
"3.4 Character Modifications and Character References. (uncommented, patched to run on validating Parsers)";
@@ -427,21 +305,10 @@ public class Canonicalizer20010315Test {
/**
* 3.5 Entity References
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test35subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test35subtree() throws Exception{
String descri = "3.5 Entity References. (uncommented)";
String fileIn = prefix + "in/35_input.xml";
String fileRef = prefix + "in/35_c14n.xml";
@@ -457,21 +324,10 @@ public class Canonicalizer20010315Test {
/**
* 3.5 Entity References
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-Entities">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test35subset()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test35subset() throws Exception {
String descri = "3.5 Entity References. (uncommented)";
String fileIn = prefix + "in/35_input.xml";
String fileRef = prefix + "in/35_c14n.xml";
@@ -487,21 +343,10 @@ public class Canonicalizer20010315Test {
/**
* 3.6 UTF-8 Encoding
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test36subtree()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test36subtree() throws Exception {
String descri = "3.6 UTF-8 Encoding. (uncommented)";
String fileIn = prefix + "in/36_input.xml";
String fileRef = prefix + "in/36_c14n.xml";
@@ -517,21 +362,10 @@ public class Canonicalizer20010315Test {
/**
* 3.6 UTF-8 Encoding
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-UTF8">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test36subset()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test36subset() throws Exception {
String descri = "3.6 UTF-8 Encoding. (uncommented)";
String fileIn = prefix + "in/36_input.xml";
String fileRef = prefix + "in/36_c14n.xml";
@@ -547,21 +381,10 @@ public class Canonicalizer20010315Test {
/**
* 3.7 Document Subsets
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-DocSubsets">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test37()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test37() throws Exception {
String descri = "3.7 Document Subsets. (uncommented)";
String fileIn = prefix + "in/37_input.xml";
String fileRef = prefix + "in/37_c14n.xml";
@@ -586,21 +409,10 @@ public class Canonicalizer20010315Test {
/**
* 3.7 Document Subsets
*
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
* @see <A HREF="http://www.w3.org/TR/2001/PR-xml-c14n-20010119#Example-DocSubsets">the example from the spec</A>
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void test37byNodeList()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void test37byNodeList() throws Exception {
//String descri = "3.7 Document Subsets. (uncommented), c14n by NodeList";
String fileIn = prefix + "in/37_input.xml";
@@ -644,20 +456,9 @@ public class Canonicalizer20010315Test {
*
* Implementations MUST report an operation failure on documents containing
* relative namespace URIs.
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
*/
@org.junit.Test
- public void testRelativeNSbehaviour()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException {
+ public void testRelativeNSbehaviour() throws Exception {
//J-
String inputStr = ""
@@ -698,20 +499,9 @@ public class Canonicalizer20010315Test {
* within the UTF-16 data are not removed) [UTF-16, Section 3.2]. Support
* for ISO-8859-1 encoding is RECOMMENDED, and all other character encodings
* are OPTIONAL.
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
*/
@org.junit.Test
- public void testTranslationFromUTF16toUTF8()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException {
+ public void testTranslationFromUTF16toUTF8() throws Exception {
String val =
"<UTF16>The german &auml (which is Unicode &#xE4;): "ä"</UTF16>";
byte utf16[] = convertToUTF16(val.getBytes());
@@ -727,21 +517,9 @@ public class Canonicalizer20010315Test {
/**
* Method testXMLAttributes1
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void testXMLAttributes1()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void testXMLAttributes1() throws Exception {
//J-
String input = ""
+ "<included xml:lang='de'>"
@@ -764,21 +542,9 @@ public class Canonicalizer20010315Test {
/**
* Method testXMLAttributes2
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void testXMLAttributes2()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void testXMLAttributes2() throws Exception {
//J-
String input = ""
+ "<included xml:lang='uk'>"
@@ -801,21 +567,9 @@ public class Canonicalizer20010315Test {
/**
* Method testXMLAttributes3
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
- public void testXMLAttributes3()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void testXMLAttributes3() throws Exception {
//J-
String input = ""
+ "<included xml:lang='de'>"
@@ -838,22 +592,10 @@ public class Canonicalizer20010315Test {
/**
* Method testXMLAttributes4
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
@org.junit.Ignore
- public void _testXMLAttributes4()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void _testXMLAttributes4() throws Exception {
//J-
String input = ""
+ "<included xml:lang='de'>"
@@ -878,22 +620,10 @@ public class Canonicalizer20010315Test {
/**
* Method testXMLAttributes5
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
@org.junit.Ignore
- public void _testXMLAttributes5()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void _testXMLAttributes5() throws Exception {
//J-
String input = ""
+ "<included xml:lang='de'>"
@@ -918,22 +648,10 @@ public class Canonicalizer20010315Test {
/**
* Method testXMLAttributes6
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
*/
@org.junit.Test
@org.junit.Ignore
- public void _testXMLAttributes6()
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ public void _testXMLAttributes6() throws Exception {
//J-
String input = ""
+ "<included xml:space='preserve' xml:lang='de'>"
@@ -962,20 +680,8 @@ public class Canonicalizer20010315Test {
* @param input
* @param definedOutput
* @param writeResultsToFile
- *
- * @throws CanonicalizationException
- * @throws FileNotFoundException
- * @throws IOException
- * @throws InvalidCanonicalizerException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerException
- * @throws XPathExpressionException
- */
- private boolean doTestXMLAttributes(String input, String definedOutput)
- throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ */
+ private boolean doTestXMLAttributes(String input, String definedOutput) throws Exception {
Document doc = null;
try (InputStream is = new ByteArrayInputStream(input.getBytes())) {
@@ -1008,9 +714,7 @@ public class Canonicalizer20010315Test {
String c14nURI,
boolean validating,
String xpath
- ) throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ ) throws Exception {
Map<String, String> namespace = new HashMap<>();
return c14nAndCompare(fileIn, fileRef, fileOut,
c14nURI, validating, xpath, namespace);
@@ -1024,9 +728,7 @@ public class Canonicalizer20010315Test {
boolean validating,
String xpath,
Map<String, String> namespaces
- ) throws IOException, FileNotFoundException, SAXException,
- ParserConfigurationException, CanonicalizationException,
- InvalidCanonicalizerException, TransformerException, XPathExpressionException {
+ ) throws Exception {
Document doc = XMLUtils.read(fileIn, validating, false, new IgnoreAllErrorHandler());
@@ -1080,16 +782,8 @@ public class Canonicalizer20010315Test {
* UTF-16 encoded XML document which is serialized to byte[] and returned.
*
* @param input
- *
- * @throws IOException
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws TransformerConfigurationException
- * @throws TransformerException
- */
- public static byte[] convertToUTF16(byte input[])
- throws ParserConfigurationException, IOException, SAXException,
- TransformerConfigurationException, TransformerException {
+ */
+ public static byte[] convertToUTF16(byte input[]) throws Exception {
//String ENCODING_ISO8859_1 = "ISO-8859-1";
//String ENCODING_UTF8 = java.nio.charset.StandardCharsets.UTF_8;
String ENCODING_UTF16 = "UTF-16";
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java?rev=1839666&r1=1839665&r2=1839666&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/PreCalculatedDigestSignatureTest.java Thu Aug 30 12:06:37 2018
@@ -37,7 +37,6 @@ import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
@@ -119,7 +118,7 @@ public class PreCalculatedDigestSignatur
assertTrue(signature.checkSignatureValue(signingCert));
}
- private XMLSignature openSignature(String signatureFile) throws ParserConfigurationException, SAXException, IOException, XMLSecurityException {
+ private XMLSignature openSignature(String signatureFile) throws Exception {
Document document = XMLUtils.read(new FileInputStream(new File(signatureFile)), false);
Element root = document.getDocumentElement();
Element signatureDocument = (Element) root.getFirstChild();
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java?rev=1839666&r1=1839665&r2=1839666&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/signature/UnknownAlgoSignatureTest.java Thu Aug 30 12:06:37 2018
@@ -18,35 +18,27 @@
*/
package org.apache.xml.security.test.dom.signature;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;
import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
-import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.xml.security.Init;
import org.apache.xml.security.c14n.InvalidCanonicalizerException;
-import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.signature.XMLSignature;
import org.apache.xml.security.signature.XMLSignatureException;
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.utils.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
/**
* Tests cases where signature algorithms are unknown.
@@ -76,8 +68,7 @@ public class UnknownAlgoSignatureTest {
Init.init();
}
- public UnknownAlgoSignatureTest() throws KeyStoreException, NoSuchAlgorithmException,
- CertificateException, IOException {
+ public UnknownAlgoSignatureTest() throws Exception {
FileInputStream fis = null;
if (BASEDIR != null && !"".equals(BASEDIR)) {
fis = new FileInputStream(BASEDIR + SEP + KEYSTORE_FILE);
@@ -91,14 +82,12 @@ public class UnknownAlgoSignatureTest {
}
@org.junit.Test
- public void testGood() throws ParserConfigurationException, SAXException,
- IOException, TransformerException, XMLSignatureException, XMLSecurityException, XPathExpressionException {
+ public void testGood() throws Exception {
assertTrue(checkSignature("signature-good.xml"));
}
@org.junit.Test
- public void testBadC14NAlgo() throws ParserConfigurationException,
- SAXException, IOException, TransformerException, XMLSecurityException, XPathExpressionException {
+ public void testBadC14NAlgo() throws Exception {
try {
assertTrue(checkSignature("signature-bad-c14n-algo.xml"));
fail("Exception not caught");
@@ -108,8 +97,7 @@ public class UnknownAlgoSignatureTest {
}
@org.junit.Test
- public void testBadSigAlgo() throws ParserConfigurationException,
- SAXException, IOException, TransformerException, XMLSecurityException, XPathExpressionException {
+ public void testBadSigAlgo() throws Exception {
try {
assertTrue(checkSignature("signature-bad-sig-algo.xml"));
fail("Exception not caught");
@@ -119,8 +107,7 @@ public class UnknownAlgoSignatureTest {
}
@org.junit.Test
- public void testBadTransformAlgo() throws ParserConfigurationException,
- SAXException, IOException, TransformerException, XMLSecurityException, XPathExpressionException {
+ public void testBadTransformAlgo() throws Exception {
try {
assertTrue(checkReferences("signature-bad-transform-algo.xml"));
fail("Exception not caught");
@@ -129,23 +116,17 @@ public class UnknownAlgoSignatureTest {
}
}
- protected boolean checkSignature(String fileName)
- throws ParserConfigurationException, SAXException, IOException,
- TransformerException, XMLSecurityException, XPathExpressionException {
+ protected boolean checkSignature(String fileName) throws Exception {
XMLSignature signature = unmarshalXMLSignature(fileName);
return signature.checkSignatureValue(publicKey);
}
- protected boolean checkReferences(String fileName)
- throws ParserConfigurationException, SAXException, IOException,
- TransformerException, XMLSecurityException, XPathExpressionException {
+ protected boolean checkReferences(String fileName) throws Exception {
XMLSignature signature = unmarshalXMLSignature(fileName);
return signature.getSignedInfo().verify(false);
}
- private XMLSignature unmarshalXMLSignature(String fileName)
- throws ParserConfigurationException, SAXException, IOException,
- TransformerException, XMLSecurityException, XPathExpressionException {
+ private XMLSignature unmarshalXMLSignature(String fileName) throws Exception {
File file = null;
if (BASEDIR != null && !"".equals(BASEDIR)) {
file = new File(BASEDIR + SEP + SIGNATURE_SOURCE_PATH, fileName);
@@ -164,8 +145,7 @@ public class UnknownAlgoSignatureTest {
return new XMLSignature(sigElement, file.toURI().toURL().toString());
}
- public static Document getDocument(File file)
- throws ParserConfigurationException, SAXException, IOException {
+ public static Document getDocument(File file) throws Exception {
return XMLUtils.read(new FileInputStream(file), false);
}
Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java?rev=1839666&r1=1839665&r2=1839666&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/dom/transforms/implementations/TransformXSLTTest.java Thu Aug 30 12:06:37 2018
@@ -20,21 +20,18 @@ package org.apache.xml.security.test.dom
import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.test.dom.DSNamespaceContext;
import org.apache.xml.security.transforms.Transform;
import org.apache.xml.security.transforms.Transforms;
import org.apache.xml.security.utils.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
public class TransformXSLTTest {
@@ -86,8 +83,7 @@ public class TransformXSLTTest {
transform.performTransform(new XMLSignatureInput(doc2));
}
- private static Document getDocument(File file)
- throws ParserConfigurationException, SAXException, IOException {
+ private static Document getDocument(File file) throws Exception {
return XMLUtils.read(new FileInputStream(file), false);
}