You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by ra...@apache.org on 2006/08/05 19:36:07 UTC

svn commit: r429015 - in /xml/security/trunk/src_unitTests/org/apache/xml/security: c14n/implementations/UtfHelperTest.java test/ModuleTest.java test/c14n/implementations/Canonicalizer20010315Test.java

Author: raul
Date: Sat Aug  5 10:36:07 2006
New Revision: 429015

URL: http://svn.apache.org/viewvc?rev=429015&view=rev
Log: (empty)

Added:
    xml/security/trunk/src_unitTests/org/apache/xml/security/c14n/implementations/UtfHelperTest.java
Modified:
    xml/security/trunk/src_unitTests/org/apache/xml/security/test/ModuleTest.java
    xml/security/trunk/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java

Added: xml/security/trunk/src_unitTests/org/apache/xml/security/c14n/implementations/UtfHelperTest.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_unitTests/org/apache/xml/security/c14n/implementations/UtfHelperTest.java?rev=429015&view=auto
==============================================================================
--- xml/security/trunk/src_unitTests/org/apache/xml/security/c14n/implementations/UtfHelperTest.java (added)
+++ xml/security/trunk/src_unitTests/org/apache/xml/security/c14n/implementations/UtfHelperTest.java Sat Aug  5 10:36:07 2006
@@ -0,0 +1,38 @@
+package org.apache.xml.security.c14n.implementations;
+
+import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.xml.security.c14n.implementations.UtfHelpper;
+import org.apache.xml.security.signature.XMLSignatureInput;
+import org.apache.xml.security.transforms.Transforms;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class UtfHelperTest extends TestCase {
+	public void testBug40156() {
+		String s="äöü";
+		byte a[]=UtfHelpper.getStringInUtf8(s);
+		try {
+			byte correct[]=s.getBytes("UTF8");
+			boolean equals=Arrays.equals(correct, a);
+			assertTrue(equals);
+		} catch (UnsupportedEncodingException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+	}
+	public static Test suite() {
+		return new TestSuite(UtfHelperTest.class);
+	}
+}

Modified: xml/security/trunk/src_unitTests/org/apache/xml/security/test/ModuleTest.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_unitTests/org/apache/xml/security/test/ModuleTest.java?rev=429015&r1=429014&r2=429015&view=diff
==============================================================================
--- xml/security/trunk/src_unitTests/org/apache/xml/security/test/ModuleTest.java (original)
+++ xml/security/trunk/src_unitTests/org/apache/xml/security/test/ModuleTest.java Sat Aug  5 10:36:07 2006
@@ -17,6 +17,8 @@
 package org.apache.xml.security.test;
 
 import org.apache.xml.security.c14n.implementations.NameSpaceSymbTableTest;
+import org.apache.xml.security.c14n.implementations.UtfHelperTest;
+import org.apache.xml.security.c14n.implementations.UtfHelpper;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -55,6 +57,7 @@
       suite.addTest(org.apache.xml.security.test.transforms.implementations.TransformBase64DecodeTest.suite());      
       suite.addTest(org.apache.xml.security.test.utils.Base64Test.suite());
       suite.addTest(NameSpaceSymbTableTest.suite());
+      suite.addTest(UtfHelperTest.suite());
       // suite.addTest(org.apache.xml.security.test.algorithms.implementations.KeyWrapTest.suite());
       // suite.addTest(org.apache.xml.security.test.algorithms.implementations.BlockEncryptionTest.suite());
       //J+

Modified: xml/security/trunk/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/xml/security/trunk/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java?rev=429015&r1=429014&r2=429015&view=diff
==============================================================================
--- xml/security/trunk/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java (original)
+++ xml/security/trunk/src_unitTests/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java Sat Aug  5 10:36:07 2006
@@ -1086,7 +1086,7 @@
          xpathAPI.selectNodeList(doc, "(//*[local-name()='included'] | //@*[parent::node()[local-name()='included']])");
       byte result[] = c14nizer.canonicalizeXPathNodeSet(nodes);
       byte defined[] = definedOutput.getBytes();
-
+      assertEquals(definedOutput, new String(result));
       return java.security.MessageDigest.isEqual(defined, result);
    }