You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2003/11/22 13:01:27 UTC
cvs commit: xml-security/src_unitTests/org/apache/xml/security/test/c14n/implementations Canonicalizer20010315ExclusiveTest.java
blautenb 2003/11/22 04:01:27
Modified: src_unitTests/org/apache/xml/security/test/c14n/implementations
Canonicalizer20010315ExclusiveTest.java
Log:
Added unit test for exclusive canonicalisation (nodelist) - xml provided by Gabriel McGoldrick - see e-mail 21/11/03
Revision Changes Path
1.8 +42 -0 xml-security/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315ExclusiveTest.java
Index: Canonicalizer20010315ExclusiveTest.java
===================================================================
RCS file: /home/cvs/xml-security/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315ExclusiveTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Canonicalizer20010315ExclusiveTest.java 29 Apr 2003 21:36:58 -0000 1.7
+++ Canonicalizer20010315ExclusiveTest.java 22 Nov 2003 12:01:27 -0000 1.8
@@ -84,9 +84,12 @@
import org.apache.xml.security.signature.XMLSignatureException;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.JavaUtils;
+import org.apache.xml.security.utils.XMLUtils;
+import org.apache.xpath.XPathAPI;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
@@ -347,4 +350,43 @@
assertTrue(equals);
}
+
+ /**
+ * 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
+ */
+ public void test223excl()
+ throws IOException, FileNotFoundException, SAXException,
+ ParserConfigurationException, CanonicalizationException,
+ InvalidCanonicalizerException, TransformerException,
+ XMLSignatureException, XMLSecurityException {
+
+ Document doc =
+ this.db
+ .parse("data/org/apache/xml/security/c14n/inExcl/example2_2_3.xml");
+ XMLUtils.circumventBug2650(doc);
+ NodeList nodes = XPathAPI.selectNodeList(doc.getDocumentElement(),
+ "(//. | //@* | //namespace::*)[ancestor-or-self::p]");
+ Canonicalizer20010315Excl c = new Canonicalizer20010315ExclWithComments();
+ byte[] reference = JavaUtils.getBytesFromFile(
+ "data/org/apache/xml/security/c14n/inExcl/example2_2_3_c14nized_exclusive.xml");
+ byte[] result = c.engineCanonicalizeXPathNodeSet(nodes);
+ boolean equals = JavaUtils.binaryCompare(reference, result);
+ if (!equals) {
+ log.warn("Error output = " + new String(result));
+ }
+ assertTrue(equals);
+ }
+
}