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 2011/01/17 17:00:32 UTC

svn commit: r1059966 [1/2] - in /santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test: resource/ transforms/ transforms/implementations/ utils/ utils/resolver/ version/

Author: coheigea
Date: Mon Jan 17 16:00:31 2011
New Revision: 1059966

URL: http://svn.apache.org/viewvc?rev=1059966&view=rev
Log:
[SANTUARIO-257] - More work on the tests.

Added:
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTPTest.java
      - copied, changed from r1059838, santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTP.java
Removed:
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/AllTests.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/AllTests.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/resolver/AllTests.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTP.java
Modified:
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/resource/TestVectorResolver.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/RegisterTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformBase64DecodeTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/Xpath2TransformationTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/Base64Test.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/IdResolverTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/resolver/OfflineResolver.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/resolver/ResourceResolverTest.java
    santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/version/VersionTest.java

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/resource/TestVectorResolver.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/resource/TestVectorResolver.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/resource/TestVectorResolver.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/resource/TestVectorResolver.java Mon Jan 17 16:00:31 2011
@@ -17,7 +17,6 @@
  */
 package org.apache.xml.security.test.resource;
 
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -26,178 +25,178 @@ import java.io.IOException;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 
-
 /**
  * This package is responsible for retrieving test vectors for our unit tests.
  *
  * @author Christian Geuer-Pollmann
- * $todo$ Currently, the test vectors are in the file system under the data/ directory. It is planned to put them all into a single jar/zip which is deployed with the library.
+ * $todo$ Currently, the test vectors are in the file system under the data/ directory. 
+ * It is planned to put them all into a single jar/zip which is deployed with the library.
  */
 public class TestVectorResolver implements EntityResolver {
 
-   /** {@link org.apache.commons.logging} logging facility */
+    /** {@link org.apache.commons.logging} logging facility */
     static org.apache.commons.logging.Log log = 
-        org.apache.commons.logging.LogFactory.getLog(
-                        TestVectorResolver.class.getName());
+        org.apache.commons.logging.LogFactory.getLog(TestVectorResolver.class.getName());
+    
+    /** Field alreadyInitialized */
+    static boolean alreadyInitialized = false;
+
+    /** Field zis */
+    static java.util.zip.ZipInputStream zis = null;
+
+    /** Field vectors */
+    static java.util.Map<String, byte[]> vectors = null;
+    
+    static {
+        org.apache.xml.security.Init.init();
+        TestVectorResolver.init();
+    }
+
+    /** Field _firstEntityResolved */
+    boolean _firstEntityResolved = false;
+
+    /** Field _firstEntitySystemId */
+    String _firstEntitySystemIdDirectory = null;
+    
+    /**
+     * Method init
+     *
+     */
+    public static void init() {
+        String thisClass =
+            "org.apache.xml.security.test.resource.TestVectorResolver";
+        String testVectorFile = "testvectors.zip";
+
+        if (!TestVectorResolver.alreadyInitialized) {
+            TestVectorResolver.alreadyInitialized = true;
+            TestVectorResolver.vectors = new java.util.HashMap<String, byte[]>(30);
+
+            try {
+                zis = 
+                    new java.util.zip.ZipInputStream(
+                         Class.forName(thisClass).getResourceAsStream(testVectorFile)
+                     );
+
+                java.util.zip.ZipEntry ze = null;
+                while ((ze = zis.getNextEntry()) != null) {
+                    if (!ze.isDirectory()) {
+                        byte data[] =
+                            org.apache.xml.security.utils.JavaUtils.getBytesFromStream(zis);
+
+                        TestVectorResolver.vectors.put(ze.getName(), data);
+                        log.debug("Contents of " + thisClass + "/" + testVectorFile
+                                  + "#" + ze.getName() + " " + data.length + " bytes");
+                    }
+                }
+            } catch (java.lang.ClassNotFoundException e) {
+                //
+            }
+            catch (java.io.IOException e) {
+                //
+            }
+        }
+    }
 
-   /** Field _firstEntityResolved */
-   boolean _firstEntityResolved = false;
+    /**
+     * Method getCurrentDir
+     *
+     *
+     * @throws IOException
+     */
+    private String getCurrentDir() throws IOException {
+
+        String currentDir = new java.io.File(".").getCanonicalPath();
+
+        currentDir = currentDir.replace(File.separatorChar, '/');
+        currentDir = "file:///" + currentDir + "/";
+
+        return currentDir;
+    }
+
+    /**
+     * Method getFileName
+     *
+     * @param systemId
+     *
+     * @throws IOException
+     */
+    private String getFileName(String systemId) throws IOException {
+
+        // clean up file name
+        String currentDir = getCurrentDir();
+
+        if (systemId.startsWith(currentDir)) {
+            return systemId.substring(currentDir.length());
+        } else {
+            return systemId;
+        }
+    }
+
+    /**
+     * Method getFilePath
+     *
+     * @param systemId
+     *
+     * @throws IOException
+     */
+    private String getFilePath(String systemId) throws IOException {
+
+        String t = new File(systemId).getCanonicalPath();
+
+        t = t.replace(File.separatorChar, '/');
+        t = "file:///" + t;
+
+        String currentDir = getCurrentDir();
+
+        if (t.startsWith(currentDir)) {
+            t = t.substring(currentDir.length());
+        }
+
+        t = t.substring(0, t.lastIndexOf("/"));
+
+        return t;
+    }
+
+    /**
+     * Method set1stSystemId
+     *
+     * @param systemId
+     * @throws IOException
+     */
+    private void set1stSystemId(String systemId) throws IOException {
+
+        this._firstEntitySystemIdDirectory = getFilePath(systemId);
+
+        log.debug("this._firstEntitySystemIdDirectory = "
+                  + this._firstEntitySystemIdDirectory);
+    }
+
+    /**
+     * Method resolveEntity
+     *
+     * @param publicId
+     * @param systemId
+     *
+     */
+    public InputSource resolveEntity(String publicId, String systemId) {
+        try {
+            if (!this._firstEntityResolved) {
+                this.set1stSystemId(systemId);
+            }
 
-   /** Field _firstEntitySystemId */
-   String _firstEntitySystemIdDirectory = null;
+            systemId = this.getFileName(systemId);
+
+            log.debug("publicId=\"" + publicId + "\" systemId=\"" + systemId
+                      + "\"");
+
+            // InputStream result = this.getInputStream(systemId);
+            // return new InputSource(result);
+            return new InputSource(new FileInputStream(systemId));
+        } catch (FileNotFoundException ex) {
+            return null;
+        } catch (IOException ex) {
+            return null;
+        }
+    }
 
-   /**
-    * Method getCurrentDir
-    *
-    *
-    * @throws IOException
-    */
-   private String getCurrentDir() throws IOException {
-
-      String currentDir = new java.io.File(".").getCanonicalPath();
-
-      currentDir = currentDir.replace(File.separatorChar, '/');
-      currentDir = "file:///" + currentDir + "/";
-
-      return currentDir;
-   }
-
-   /**
-    * Method getFileName
-    *
-    * @param systemId
-    *
-    * @throws IOException
-    */
-   private String getFileName(String systemId) throws IOException {
-
-      // clean up file name
-      String currentDir = getCurrentDir();
-
-      if (systemId.startsWith(currentDir)) {
-         return systemId.substring(currentDir.length());
-      } else {
-         return systemId;
-      }
-   }
-
-   /**
-    * Method getFilePath
-    *
-    * @param systemId
-    *
-    * @throws IOException
-    */
-   private String getFilePath(String systemId) throws IOException {
-
-      String t = new File(systemId).getCanonicalPath();
-
-      t = t.replace(File.separatorChar, '/');
-      t = "file:///" + t;
-
-      String currentDir = getCurrentDir();
-
-      if (t.startsWith(currentDir)) {
-         t = t.substring(currentDir.length());
-      }
-
-      t = t.substring(0, t.lastIndexOf("/"));
-
-      return t;
-   }
-
-   /**
-    * Method set1stSystemId
-    *
-    * @param systemId
-    * @throws IOException
-    */
-   private void set1stSystemId(String systemId) throws IOException {
-
-      this._firstEntitySystemIdDirectory = getFilePath(systemId);
-
-      log.debug("this._firstEntitySystemIdDirectory = "
-                + this._firstEntitySystemIdDirectory);
-   }
-
-   /**
-    * Method resolveEntity
-    *
-    * @param publicId
-    * @param systemId
-    *
-    */
-   public InputSource resolveEntity(String publicId, String systemId) {
-
-      try {
-         if (!this._firstEntityResolved) {
-            this.set1stSystemId(systemId);
-         }
-
-         systemId = this.getFileName(systemId);
-
-         log.debug("publicId=\"" + publicId + "\" systemId=\"" + systemId
-                   + "\"");
-
-         // InputStream result = this.getInputStream(systemId);
-         // return new InputSource(result);
-         return new InputSource(new FileInputStream(systemId));
-      } catch (FileNotFoundException ex) {
-         return null;
-      } catch (IOException ex) {
-         return null;
-      }
-   }
-
-   /** Field alreadyInitialized */
-   static boolean alreadyInitialized = false;
-
-   /** Field zis */
-   static java.util.zip.ZipInputStream zis = null;
-
-   /** Field vectors */
-   static java.util.HashMap vectors = null;
-
-   /**
-    * Method init
-    *
-    */
-   public static void init() {
-
-      String thisClass =
-         "org.apache.xml.security.test.resource.TestVectorResolver";
-      String testVectorFile = "testvectors.zip";
-
-      if (!TestVectorResolver.alreadyInitialized) {
-         TestVectorResolver.alreadyInitialized = true;
-         TestVectorResolver.vectors = new java.util.HashMap(30);
-
-         try {
-            zis = new java.util.zip
-               .ZipInputStream(Class.forName(thisClass)
-                  .getResourceAsStream(testVectorFile));
-
-            java.util.zip.ZipEntry ze = null;
-
-            while ((ze = zis.getNextEntry()) != null) {
-               if (!ze.isDirectory()) {
-                  byte data[] =
-                     org.apache.xml.security.utils.JavaUtils
-                        .getBytesFromStream(zis);
-
-                  TestVectorResolver.vectors.put(ze.getName(), data);
-                  log.debug("Contents of " + thisClass + "/" + testVectorFile
-                            + "#" + ze.getName() + " " + data.length
-                            + " bytes");
-               }
-            }
-         } catch (java.lang.ClassNotFoundException e) {}
-         catch (java.io.IOException e) {}
-      }
-   }
-
-   static {
-      org.apache.xml.security.Init.init();
-      TestVectorResolver.init();
-   }
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/RegisterTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/RegisterTest.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/RegisterTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/RegisterTest.java Mon Jan 17 16:00:31 2011
@@ -24,36 +24,25 @@ import java.net.URLClassLoader;
 import org.apache.xml.security.exceptions.AlgorithmAlreadyRegisteredException;
 import org.apache.xml.security.transforms.Transform;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 /**
  * RegisterTest tests registering a custom Transform implementation loaded
  * by a URLCLassLoader.
  */
-public class RegisterTest extends TestCase {
+public class RegisterTest extends org.junit.Assert {
 
     private final static String basedir = System.getProperty("basedir", "./");
 
-    public RegisterTest(String name) {
-        super(name);
-    }
-
-    public static Test suite() {
-       return new TestSuite(RegisterTest.class);
-    }
-
-    public static void test() throws Exception {
+    @org.junit.Test
+    public void test() throws Exception {
 
         Transform.init();
         File file = new File(basedir);
         URL[] urls = new URL[1];
         urls[0] = file.toURI().toURL();
         URLClassLoader ucl = new URLClassLoader(urls);
-        Class c = ucl.loadClass
+        Class<?> c = ucl.loadClass
             ("org.apache.xml.security.test.transforms.SampleTransform");
-        Constructor cons = c.getConstructor(new Class[0]);
+        Constructor<?> cons = c.getConstructor(new Class[0]);
         cons.newInstance(new Object[0]);
         // Apache code swallows the ClassNotFoundExc, so we need to
         // check if the Transform has already been registered by registering

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformBase64DecodeTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformBase64DecodeTest.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformBase64DecodeTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformBase64DecodeTest.java Mon Jan 17 16:00:31 2011
@@ -16,27 +16,14 @@
  */
 package org.apache.xml.security.test.transforms.implementations;
 
-
-
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.xml.security.c14n.CanonicalizationException;
-import org.apache.xml.security.c14n.InvalidCanonicalizerException;
-import org.apache.xml.security.exceptions.XMLSecurityException;
-import org.apache.xml.security.signature.XMLSignatureException;
 import org.apache.xml.security.signature.XMLSignatureInput;
 import org.apache.xml.security.test.TestUtils;
-import org.apache.xml.security.transforms.InvalidTransformException;
-import org.apache.xml.security.transforms.TransformationException;
 import org.apache.xml.security.transforms.Transforms;
 import org.apache.xml.security.transforms.implementations.TransformBase64Decode;
 import org.apache.xml.security.utils.Constants;
@@ -45,192 +32,117 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-
 /**
  * Unit test for {@link org.apache.xml.security.transforms.implementations.TransformBase64Decode}
  *
  * @author Christian Geuer-Pollmann
  */
-public class TransformBase64DecodeTest extends TestCase {
+public class TransformBase64DecodeTest extends org.junit.Assert {
 
-   /** {@link org.apache.commons.logging} logging facility */
+    /** {@link org.apache.commons.logging} logging facility */
     static org.apache.commons.logging.Log log = 
-        org.apache.commons.logging.LogFactory.getLog(
-                    TransformBase64DecodeTest.class.getName());
+        org.apache.commons.logging.LogFactory.getLog(TransformBase64DecodeTest.class.getName());
 
-   /**
-    * Method suite
-    *
-    *
-    */
-   public static Test suite() {
-      return new TestSuite(TransformBase64DecodeTest.class);
-   }
-
-   /**
-    * Constructor TransformBase64DecodeTest
-    *
-    * @param Name_
-    */
-   public TransformBase64DecodeTest(String Name_) {
-      super(Name_);
-   }
-
-   /**
-    * Method main
-    *
-    * @param args
-    */
-   public static void main(String[] args) {
-
-      String[] testCaseName = { "-noloading",
-                                TransformBase64DecodeTest.class.getName() };
-
-      junit.textui.TestRunner.main(testCaseName);
-   }
-
-   private static Document createDocument() throws ParserConfigurationException {
-
-      DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
-
-      dfactory.setNamespaceAware(true);
-
-      DocumentBuilder db = dfactory.newDocumentBuilder();
-      Document doc = db.newDocument();
-
-      if (doc == null) {
-          throw new RuntimeException("Could not create a Document");
-      } else {
-         log.debug("I could create the Document");
-      }
-      return doc;
-   }
-
-   /**
-    * Method test1
-    *
-    * @throws CanonicalizationException
-    * @throws IOException
-    * @throws InvalidCanonicalizerException
-    * @throws InvalidTransformException
-    * @throws NotYetImplementedException
-    * @throws ParserConfigurationException
-    * @throws TransformationException
-    * @throws XMLSecurityException
-    * @throws XMLSignatureException
-    */
-   public static void test1()
-           throws IOException, InvalidTransformException,
-                  CanonicalizationException, InvalidCanonicalizerException,
-                  TransformationException,
-                  XMLSignatureException, XMLSecurityException,
-                  ParserConfigurationException {
-
-      // base64 encoded
-      String s1 =
-         "VGhlIFVSSSBvZiB0aGUgdHJhbnNmb3JtIGlzIGh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1s\n"
-         + "ZHNpZyNiYXNlNjQ=";
-
-      Document doc = TransformBase64DecodeTest.createDocument();
-      Transforms t = new Transforms(doc);
-      doc.appendChild(t.getElement());
-      t.addTransform(TransformBase64Decode.implementedTransformURI);
-
-      XMLSignatureInput in =
-         new XMLSignatureInput(new ByteArrayInputStream(s1.getBytes()));
-      XMLSignatureInput out = t.performTransforms(in);
-      String result = new String(out.getBytes());
-
-      assertTrue(
-         result.equals(
-            "The URI of the transform is http://www.w3.org/2000/09/xmldsig#base64"));
-   }
-
-   /**
-    * Method testTwice
-    *
-    * @throws CanonicalizationException
-    * @throws IOException
-    * @throws InvalidCanonicalizerException
-    * @throws InvalidTransformException
-    * @throws NotYetImplementedException
-    * @throws ParserConfigurationException
-    * @throws TransformationException
-    * @throws XMLSecurityException
-    * @throws XMLSignatureException
-    */
-   public static void test2()
-           throws IOException, InvalidTransformException,
-                  TransformationException, CanonicalizationException,
-                  InvalidCanonicalizerException,
-                  XMLSignatureException, XMLSecurityException,
-                  ParserConfigurationException {
-
-      // base64 encoded twice
-      String s2 =
-         "VkdobElGVlNTU0J2WmlCMGFHVWdkSEpoYm5ObWIzSnRJR2x6SUdoMGRIQTZMeTkzZDNjdWR6TXVi\n"
-         + "M0puTHpJd01EQXZNRGt2ZUcxcwpaSE5wWnlOaVlYTmxOalE9";
-      Document doc = TransformBase64DecodeTest.createDocument();
-      Transforms t = new Transforms(doc);
-      doc.appendChild(t.getElement());
-
-      t.addTransform(TransformBase64Decode.implementedTransformURI);
-
-      XMLSignatureInput in =
-         new XMLSignatureInput(new ByteArrayInputStream(s2.getBytes()));
-      XMLSignatureInput out = t.performTransforms(t.performTransforms(in));
-      String result = new String(out.getBytes());
-
-      assertTrue(
-         result.equals(
-            "The URI of the transform is http://www.w3.org/2000/09/xmldsig#base64"));
-   }
-
-   /**
-    * Method test3
-    *
-    * @throws Exception
-    */
-   public static void test3() throws Exception {
-      //J-
-      String input = ""
-         + "<Object xmlns:signature='http://www.w3.org/2000/09/xmldsig#'>\n"
-         + "<signature:Base64>\n"
-         + "VGhlIFVSSSBvZiB0aGU   gdHJhbn<RealText>Nmb  3JtIGlzIG<test/>h0dHA6</RealText>Ly93d3cudzMub3JnLzIwMDAvMDkveG1s\n"
-         + "ZHNpZyNiYXNlNjQ=\n"
-         + "</signature:Base64>\n"
-         + "</Object>\n"
-         ;
-      //J+
-      DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
-
-      dfactory.setNamespaceAware(true);
-
-      DocumentBuilder db = dfactory.newDocumentBuilder();
-
-      db.setErrorHandler(new org.apache.xml.security.utils
-         .IgnoreAllErrorHandler());
-
-      Document doc = db.parse(new ByteArrayInputStream(input.getBytes()));
-      //XMLUtils.circumventBug2650(doc);
-      Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
-
-      Node base64Node = XPathAPI.selectSingleNode(doc, "//ds:Base64", nscontext);
-      XMLSignatureInput xmlinput = new XMLSignatureInput(base64Node);
-
-      Document doc2 = TransformBase64DecodeTest.createDocument();
-      Transforms t = new Transforms(doc2);
-      doc2.appendChild(t.getElement());
-      t.addTransform(Transforms.TRANSFORM_BASE64_DECODE);
-
-      XMLSignatureInput out = t.performTransforms(xmlinput);
-      String result = new String(out.getBytes());
-
-      assertTrue("\"" + result + "\"", result.equals(
-            "The URI of the transform is http://www.w3.org/2000/09/xmldsig#base64"));
-   }
-
-   static {
-      org.apache.xml.security.Init.init();
-   }
+    static {
+        org.apache.xml.security.Init.init();
+    }
+    
+    @org.junit.Test
+    public void test1() throws Exception {
+        // base64 encoded
+        String s1 =
+            "VGhlIFVSSSBvZiB0aGUgdHJhbnNmb3JtIGlzIGh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1s\n"
+            + "ZHNpZyNiYXNlNjQ=";
+
+        Document doc = TransformBase64DecodeTest.createDocument();
+        Transforms t = new Transforms(doc);
+        doc.appendChild(t.getElement());
+        t.addTransform(TransformBase64Decode.implementedTransformURI);
+
+        XMLSignatureInput in =
+            new XMLSignatureInput(new ByteArrayInputStream(s1.getBytes()));
+        XMLSignatureInput out = t.performTransforms(in);
+        String result = new String(out.getBytes());
+
+        assertTrue(
+            result.equals("The URI of the transform is http://www.w3.org/2000/09/xmldsig#base64")
+        );
+    }
+
+    @org.junit.Test
+    public void test2() throws Exception {
+        // base64 encoded twice
+        String s2 =
+            "VkdobElGVlNTU0J2WmlCMGFHVWdkSEpoYm5ObWIzSnRJR2x6SUdoMGRIQTZMeTkzZDNjdWR6TXVi\n"
+            + "M0puTHpJd01EQXZNRGt2ZUcxcwpaSE5wWnlOaVlYTmxOalE9";
+        Document doc = TransformBase64DecodeTest.createDocument();
+        Transforms t = new Transforms(doc);
+        doc.appendChild(t.getElement());
+
+        t.addTransform(TransformBase64Decode.implementedTransformURI);
+
+        XMLSignatureInput in =
+            new XMLSignatureInput(new ByteArrayInputStream(s2.getBytes()));
+        XMLSignatureInput out = t.performTransforms(t.performTransforms(in));
+        String result = new String(out.getBytes());
+
+        assertTrue(
+            result.equals("The URI of the transform is http://www.w3.org/2000/09/xmldsig#base64")
+        );
+    }
+
+    @org.junit.Test
+    public void test3() throws Exception {
+        //J-
+        String input = ""
+            + "<Object xmlns:signature='http://www.w3.org/2000/09/xmldsig#'>\n"
+            + "<signature:Base64>\n"
+            + "VGhlIFVSSSBvZiB0aGU   gdHJhbn<RealText>Nmb  3JtIGlzIG<test/>h0dHA6</RealText>Ly93d3cudzMub3JnLzIwMDAvMDkveG1s\n"
+            + "ZHNpZyNiYXNlNjQ=\n"
+            + "</signature:Base64>\n"
+            + "</Object>\n"
+            ;
+        //J+
+        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+        dfactory.setNamespaceAware(true);
+        DocumentBuilder db = dfactory.newDocumentBuilder();
+
+        db.setErrorHandler(new org.apache.xml.security.utils.IgnoreAllErrorHandler());
+
+        Document doc = db.parse(new ByteArrayInputStream(input.getBytes()));
+        //XMLUtils.circumventBug2650(doc);
+        Element nscontext = TestUtils.createDSctx(doc, "ds", Constants.SignatureSpecNS);
+
+        Node base64Node = XPathAPI.selectSingleNode(doc, "//ds:Base64", nscontext);
+        XMLSignatureInput xmlinput = new XMLSignatureInput(base64Node);
+
+        Document doc2 = TransformBase64DecodeTest.createDocument();
+        Transforms t = new Transforms(doc2);
+        doc2.appendChild(t.getElement());
+        t.addTransform(Transforms.TRANSFORM_BASE64_DECODE);
+
+        XMLSignatureInput out = t.performTransforms(xmlinput);
+        String result = new String(out.getBytes());
+
+        assertTrue(
+            "\"" + result + "\"", 
+            result.equals("The URI of the transform is http://www.w3.org/2000/09/xmldsig#base64")
+        );
+    }
+
+    private static Document createDocument() throws ParserConfigurationException {
+        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+        dfactory.setNamespaceAware(true);
+
+        DocumentBuilder db = dfactory.newDocumentBuilder();
+        Document doc = db.newDocument();
+
+        if (doc == null) {
+            throw new RuntimeException("Could not create a Document");
+        } else {
+            log.debug("I could create the Document");
+        }
+        return doc;
+    }
+    
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/TransformXSLTTest.java Mon Jan 17 16:00:31 2011
@@ -27,10 +27,6 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.xml.security.signature.XMLSignatureInput;
 import org.apache.xml.security.test.TestUtils;
 import org.apache.xml.security.transforms.Transform;
@@ -38,7 +34,7 @@ import org.apache.xml.security.transform
 import org.apache.xml.security.utils.Constants;
 import org.apache.xpath.XPathAPI;
 
-public class TransformXSLTTest extends TestCase {
+public class TransformXSLTTest extends org.junit.Assert {
 
     private static final String BASEDIR = 
         System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
@@ -51,39 +47,18 @@ public class TransformXSLTTest extends T
 
     /** {@link org.apache.commons.logging} logging facility */
     static org.apache.commons.logging.Log log = 
-        org.apache.commons.logging.LogFactory.getLog(
-                    TransformXSLTTest.class.getName());
-
-    public static Test suite() {
-        return new TestSuite(TransformXSLTTest.class);
-    }
-
-    public TransformXSLTTest(String name) {
-        super(name);
-    }
-
-    public static void main(String[] args) {
-
-        String[] testCaseName = { "-noloading",
-                                TransformXSLTTest.class.getName() };
-        junit.textui.TestRunner.main(testCaseName);
-    }
-
-    private static Document getDocument(File file) 
-        throws ParserConfigurationException, SAXException, IOException {
-
-        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
-        dfactory.setNamespaceAware(true);
-        DocumentBuilder db = dfactory.newDocumentBuilder();
-        Document doc = db.parse(new FileInputStream(file));
-        return doc;
+        org.apache.commons.logging.LogFactory.getLog(TransformXSLTTest.class.getName());
+    
+    static {
+        org.apache.xml.security.Init.init();
     }
 
     /**
      * Make sure Transform.performTransform does not throw NullPointerException.
      * See bug 41927 for more info.
      */
-    public static void test1() throws Exception {
+    @org.junit.Test
+    public void test1() throws Exception {
         File file1  = null;
         File file2  = null;
         if (BASEDIR != null && !"".equals(BASEDIR)) {
@@ -96,17 +71,22 @@ public class TransformXSLTTest extends T
         Document doc1 = getDocument(file1);
         Document doc2 = getDocument(file2);
 
-        Element nscontext = TestUtils.createDSctx
-            (doc1, "dsig", Constants.SignatureSpecNS);
-        Node transformEl = XPathAPI.selectSingleNode
-            (doc1, "//dsig:Transform[1]", nscontext);
-        Transform transform = Transform.getInstance
-            (doc1, Transforms.TRANSFORM_XSLT, transformEl.getChildNodes());
+        Element nscontext = 
+            TestUtils.createDSctx(doc1, "dsig", Constants.SignatureSpecNS);
+        Node transformEl = 
+            XPathAPI.selectSingleNode(doc1, "//dsig:Transform[1]", nscontext);
+        Transform transform = 
+            Transform.getInstance(doc1, Transforms.TRANSFORM_XSLT, transformEl.getChildNodes());
 
         transform.performTransform(new XMLSignatureInput(doc2));
     }
-
-    static {
-        org.apache.xml.security.Init.init();
+    
+    private static Document getDocument(File file) 
+        throws ParserConfigurationException, SAXException, IOException {
+        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+        dfactory.setNamespaceAware(true);
+        DocumentBuilder db = dfactory.newDocumentBuilder();
+        return db.parse(new FileInputStream(file));
     }
+
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/Xpath2TransformationTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/Xpath2TransformationTest.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/Xpath2TransformationTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/transforms/implementations/Xpath2TransformationTest.java Mon Jan 17 16:00:31 2011
@@ -18,146 +18,139 @@ package org.apache.xml.security.test.tra
 
 import java.io.ByteArrayInputStream;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.xml.security.Init;
 import org.apache.xml.security.signature.XMLSignature;
 import org.apache.xml.security.utils.Constants;
 import org.w3c.dom.Element;
 
-public class Xpath2TransformationTest extends TestCase {
-        static {
-                Init.init();
-        }
-   /**
-    * Method suite
-    *
-    *
-    */
-   public static Test suite() {
-      return new TestSuite(Xpath2TransformationTest.class);
-   }
-
-
-        public static void testXpath2Transform() throws Exception {
-                String sig="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + 
-                                "<edoc:EDOC xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" sysid=\"CC9CC230-C0A8024E01A3CA10-AC154F78\">\r\n" + 
-                                "   <edoc:Version>2.0</edoc:Version>\r\n" + 
-                                "   <edoc:Object edocVersion=\"2.0\">\r\n" + 
-                                "      <edoc:ObjectMetadata>\r\n" + 
-                                "         <edoc:ObjectType>Record</edoc:ObjectType>\r\n" + 
-                                "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\r\n" + 
-                                "      </edoc:ObjectMetadata>\r\n" + 
-                                "      <edoc:ObjectContent>\r\n" + 
-                                "         <edoc:Record>\r\n" + 
-                                "            <edoc:RecordMetadata></edoc:RecordMetadata>\r\n" + 
-                                "            <edoc:Document id=\"Revision-1-Document-1\">\r\n" + 
-                                "               <edoc:DocumentMetadata>\r\n" + 
-                                "                  <dc:date>2003-07-20</dc:date>\r\n" + 
-                                "                  <dc:type>20</dc:type>\r\n" + 
-                                "                  <dc:format>PDF</dc:format>\r\n" + 
-                                "                  <edoc:customer-number>222222</edoc:customer-number>\r\n" + 
-                                "               </edoc:DocumentMetadata>\r\n" + 
-                                "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\r\n" + 
-                                "                  <edoc:EncodingMetadata>\r\n" + 
-                                "                  </edoc:EncodingMetadata>\r\n" + 
-                                "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\r\n" + 
-                                "               </edoc:Encoding>\r\n" + 
-                                "            </edoc:Document>\r\n" + 
-                                "         </edoc:Record>\r\n" + 
-                                "      </edoc:ObjectContent>\r\n" + 
-                                "   </edoc:Object>\r\n" + 
-                                "<edoc:SignatureBlock id=\"Revision-1-Signature-1\"><edoc:SignatureDate>2006-08-09T17:21:35</edoc:SignatureDate><edoc:Signer>Hess Yvan (first signature)</edoc:Signer><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\r\n" + 
-                                "<ds:SignedInfo>\r\n" + 
-                                "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"></ds:CanonicalizationMethod>\r\n" + 
-                                "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\r\n" + 
-                                "<ds:Reference URI=\"\">\r\n" + 
-                                "<ds:Transforms>\r\n" + 
-                                "<ds:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\">\r\n" + 
-                                "<dsig-xpath:XPath xmlns:dsig-xpath=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">/edoc:EDOC/edoc:Object</dsig-xpath:XPath>\r\n" + 
-                                "</ds:Transform>\r\n" + 
-                                "</ds:Transforms>\r\n" + 
-                                "<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\r\n" + 
-                                "<ds:DigestValue>YMXHTYArDBcWDG99epurfdSEAWM=</ds:DigestValue>\r\n" + 
-                                "</ds:Reference>\r\n" + 
-                                "</ds:SignedInfo>\r\n" + 
-                                "<ds:SignatureValue>\r\n" + 
-                                "Un2HBIOcwGe36k8eDEJISKP8/EmCp813JlmV0qqxIPVgdMsIJXR5Wky6uqwP+E3wAXj4NykW76GV\r\n" + 
-                                "1eSD9dTKw/M/bFMbId0nBp0ZFaFE5DKU/My4956qr2oyJqiFRKOokCxds0jMQvGcKeWVC9oAROxR\r\n" + 
-                                "byZQbrtjGw9YS+D5afY=\r\n" + 
-                                "</ds:SignatureValue>\r\n" + 
-                                "<ds:KeyInfo>\r\n" + 
-                                "<ds:X509Data>\r\n" + 
-                                "<ds:X509Certificate>\r\n" + 
-                                "MIIDADCCAmmgAwIBAgIGAQpEtx7tMA0GCSqGSIb3DQEBBQUAMIGXMRQwEgYDVQQGEwtTd2l0emVy\r\n" + 
-                                "bGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6MRUwEwYDVQQLEwxIeXBl\r\n" + 
-                                "cnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxJzAlBgNVBAMTHklNVEYgUm9vdENl\r\n" + 
-                                "cnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNjAzMjgyMjAwMDBaFw0xNjAzMTcyMzAwMDBaMIGMMRQw\r\n" + 
-                                "EgYDVQQGEwtTd2l0emVybGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6\r\n" + 
-                                "MRUwEwYDVQQLEwxIeXBlcnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxHDAaBgNV\r\n" + 
-                                "BAMTE0lNVEYgRW5kQ2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOxpALzU\r\n" + 
-                                "r8TjtFB7ghScWXdaDuHHRM7bPOoyuDSCxCznCBQitrwT/Un/vkZjDxSTG1bLWObqUMf1Yf6ul30n\r\n" + 
-                                "nU9NsHO2fr7+YwtGnCV5vZ+qzWSQBY7qS+Gg8Ft9z0PluNRe84ukcQt7mdqSYet2qKbYWLP8tyFc\r\n" + 
-                                "XCYs0JL5E6aTAgMBAAGjYDBeMB8GA1UdIwQYMBaAFIeIxHkuiPSRw5OArsqR7wZYgVPlMB0GA1Ud\r\n" + 
-                                "DgQWBBRrfNhYheJHag+VBqDPWEOQyt3rqDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIFoDAN\r\n" + 
-                                "BgkqhkiG9w0BAQUFAAOBgQB4OVKzObDkpadteusbvcEin2GdK3B2qz/HwqH07AEt/pQbJ/oQOsYL\r\n" + 
-                                "qVyDFt3umJ5uHon15nkps3HRE4MoYNfVbtz1G+0nMcAbxVYJDIfC4YBJRUAm/aA0twfkiH6gFmLi\r\n" + 
-                                "V8o5YRtkjXvZQKUtJ/Ps/m0DAC4A935jTHDd6F4FCw==\r\n" + 
-                                "</ds:X509Certificate>\r\n" + 
-                                "</ds:X509Data>\r\n" + 
-                                "</ds:KeyInfo>\r\n" + 
-                                "</ds:Signature></edoc:SignatureBlock></edoc:EDOC>";
-                String correctC14n="<edoc:Object xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" edocVersion=\"2.0\">\n" + 
-                                "      <edoc:ObjectMetadata>\n" + 
-                                "         <edoc:ObjectType>Record</edoc:ObjectType>\n" + 
-                                "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\n" + 
-                                "      </edoc:ObjectMetadata>\n" + 
-                                "      <edoc:ObjectContent>\n" + 
-                                "         <edoc:Record>\n" + 
-                                "            <edoc:RecordMetadata></edoc:RecordMetadata>\n" + 
-                                "            <edoc:Document id=\"Revision-1-Document-1\">\n" + 
-                                "               <edoc:DocumentMetadata>\n" + 
-                                "                  <dc:date>2003-07-20</dc:date>\n" + 
-                                "                  <dc:type>20</dc:type>\n" + 
-                                "                  <dc:format>PDF</dc:format>\n" + 
-                                "                  <edoc:customer-number>222222</edoc:customer-number>\n" + 
-                                "               </edoc:DocumentMetadata>\n" + 
-                                "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\n" + 
-                                "                  <edoc:EncodingMetadata>\n" + 
-                                "                  </edoc:EncodingMetadata>\n" + 
-                                "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\n" + 
-                                "               </edoc:Encoding>\n" + 
-                                "            </edoc:Document>\n" + 
-                                "         </edoc:Record>\n" + 
-                                "      </edoc:ObjectContent>\n" + 
-                                "   </edoc:Object>";
-                ByteArrayInputStream is=new ByteArrayInputStream(sig.getBytes());
-                javax.xml.parsers.DocumentBuilderFactory dbf =
-                 javax.xml.parsers.DocumentBuilderFactory.newInstance();
-
-              dbf.setNamespaceAware(true);
-
-              javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
-              org.w3c.dom.Document doc = db.parse(is);
-              Element sigElement =
-                  (Element) doc.getElementsByTagNameNS(Constants.SignatureSpecNS,
-                                                       Constants._TAG_SIGNATURE).item(0);
-               XMLSignature sign = new XMLSignature(sigElement,
-                                                         "");
-               boolean verify =
-                   sign.checkSignatureValue(sign.getKeyInfo().getPublicKey());
-               if (!verify) {
-               for (int i = 0; i < sign.getSignedInfo().getLength(); i++) {
-                    boolean refVerify =
-                       sign.getSignedInfo().getVerificationResult(i);	            
-                    if (!refVerify) {	            
-                       assertEquals(correctC14n, new String(sign.getSignedInfo().item(i).getContentsAfterTransformation().getBytes()));
-                    }
-                 }
-               }
-
-               
+public class Xpath2TransformationTest extends org.junit.Assert {
+    
+    static {
+        Init.init();
+    }
+    
+    @org.junit.Test
+    public void testXpath2Transform() throws Exception {
+        String sig="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + 
+        "<edoc:EDOC xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" sysid=\"CC9CC230-C0A8024E01A3CA10-AC154F78\">\r\n" + 
+        "   <edoc:Version>2.0</edoc:Version>\r\n" + 
+        "   <edoc:Object edocVersion=\"2.0\">\r\n" + 
+        "      <edoc:ObjectMetadata>\r\n" + 
+        "         <edoc:ObjectType>Record</edoc:ObjectType>\r\n" + 
+        "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\r\n" + 
+        "      </edoc:ObjectMetadata>\r\n" + 
+        "      <edoc:ObjectContent>\r\n" + 
+        "         <edoc:Record>\r\n" + 
+        "            <edoc:RecordMetadata></edoc:RecordMetadata>\r\n" + 
+        "            <edoc:Document id=\"Revision-1-Document-1\">\r\n" + 
+        "               <edoc:DocumentMetadata>\r\n" + 
+        "                  <dc:date>2003-07-20</dc:date>\r\n" + 
+        "                  <dc:type>20</dc:type>\r\n" + 
+        "                  <dc:format>PDF</dc:format>\r\n" + 
+        "                  <edoc:customer-number>222222</edoc:customer-number>\r\n" + 
+        "               </edoc:DocumentMetadata>\r\n" + 
+        "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\r\n" + 
+        "                  <edoc:EncodingMetadata>\r\n" + 
+        "                  </edoc:EncodingMetadata>\r\n" + 
+        "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\r\n" + 
+        "               </edoc:Encoding>\r\n" + 
+        "            </edoc:Document>\r\n" + 
+        "         </edoc:Record>\r\n" + 
+        "      </edoc:ObjectContent>\r\n" + 
+        "   </edoc:Object>\r\n" + 
+        "<edoc:SignatureBlock id=\"Revision-1-Signature-1\"><edoc:SignatureDate>2006-08-09T17:21:35</edoc:SignatureDate><edoc:Signer>Hess Yvan (first signature)</edoc:Signer><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\r\n" + 
+        "<ds:SignedInfo>\r\n" + 
+        "<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"></ds:CanonicalizationMethod>\r\n" + 
+        "<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"></ds:SignatureMethod>\r\n" + 
+        "<ds:Reference URI=\"\">\r\n" + 
+        "<ds:Transforms>\r\n" + 
+        "<ds:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\">\r\n" + 
+        "<dsig-xpath:XPath xmlns:dsig-xpath=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">/edoc:EDOC/edoc:Object</dsig-xpath:XPath>\r\n" + 
+        "</ds:Transform>\r\n" + 
+        "</ds:Transforms>\r\n" + 
+        "<ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></ds:DigestMethod>\r\n" + 
+        "<ds:DigestValue>YMXHTYArDBcWDG99epurfdSEAWM=</ds:DigestValue>\r\n" + 
+        "</ds:Reference>\r\n" + 
+        "</ds:SignedInfo>\r\n" + 
+        "<ds:SignatureValue>\r\n" + 
+        "Un2HBIOcwGe36k8eDEJISKP8/EmCp813JlmV0qqxIPVgdMsIJXR5Wky6uqwP+E3wAXj4NykW76GV\r\n" + 
+        "1eSD9dTKw/M/bFMbId0nBp0ZFaFE5DKU/My4956qr2oyJqiFRKOokCxds0jMQvGcKeWVC9oAROxR\r\n" + 
+        "byZQbrtjGw9YS+D5afY=\r\n" + 
+        "</ds:SignatureValue>\r\n" + 
+        "<ds:KeyInfo>\r\n" + 
+        "<ds:X509Data>\r\n" + 
+        "<ds:X509Certificate>\r\n" + 
+        "MIIDADCCAmmgAwIBAgIGAQpEtx7tMA0GCSqGSIb3DQEBBQUAMIGXMRQwEgYDVQQGEwtTd2l0emVy\r\n" + 
+        "bGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6MRUwEwYDVQQLEwxIeXBl\r\n" + 
+        "cnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxJzAlBgNVBAMTHklNVEYgUm9vdENl\r\n" + 
+        "cnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNjAzMjgyMjAwMDBaFw0xNjAzMTcyMzAwMDBaMIGMMRQw\r\n" + 
+        "EgYDVQQGEwtTd2l0emVybGFuZDERMA8GA1UECBMIRnJpYm91cmcxETAPBgNVBAcTCEdpdmlzaWV6\r\n" + 
+        "MRUwEwYDVQQLEwxIeXBlcnN1aXRlIDUxGTAXBgNVBAoTEEluZm9ybWF0aXF1ZS1NVEYxHDAaBgNV\r\n" + 
+        "BAMTE0lNVEYgRW5kQ2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOxpALzU\r\n" + 
+        "r8TjtFB7ghScWXdaDuHHRM7bPOoyuDSCxCznCBQitrwT/Un/vkZjDxSTG1bLWObqUMf1Yf6ul30n\r\n" + 
+        "nU9NsHO2fr7+YwtGnCV5vZ+qzWSQBY7qS+Gg8Ft9z0PluNRe84ukcQt7mdqSYet2qKbYWLP8tyFc\r\n" + 
+        "XCYs0JL5E6aTAgMBAAGjYDBeMB8GA1UdIwQYMBaAFIeIxHkuiPSRw5OArsqR7wZYgVPlMB0GA1Ud\r\n" + 
+        "DgQWBBRrfNhYheJHag+VBqDPWEOQyt3rqDAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB/wQEAwIFoDAN\r\n" + 
+        "BgkqhkiG9w0BAQUFAAOBgQB4OVKzObDkpadteusbvcEin2GdK3B2qz/HwqH07AEt/pQbJ/oQOsYL\r\n" + 
+        "qVyDFt3umJ5uHon15nkps3HRE4MoYNfVbtz1G+0nMcAbxVYJDIfC4YBJRUAm/aA0twfkiH6gFmLi\r\n" + 
+        "V8o5YRtkjXvZQKUtJ/Ps/m0DAC4A935jTHDd6F4FCw==\r\n" + 
+        "</ds:X509Certificate>\r\n" + 
+        "</ds:X509Data>\r\n" + 
+        "</ds:KeyInfo>\r\n" + 
+        "</ds:Signature></edoc:SignatureBlock></edoc:EDOC>";
+        
+        String correctC14n="<edoc:Object xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:edoc=\"http://www.imtf.com/hypersuite/edoc/2.0/\" edocVersion=\"2.0\">\n" + 
+        "      <edoc:ObjectMetadata>\n" + 
+        "         <edoc:ObjectType>Record</edoc:ObjectType>\n" + 
+        "         <edoc:ObjectCreationDate>2004-12-13T14:27:35</edoc:ObjectCreationDate>\n" + 
+        "      </edoc:ObjectMetadata>\n" + 
+        "      <edoc:ObjectContent>\n" + 
+        "         <edoc:Record>\n" + 
+        "            <edoc:RecordMetadata></edoc:RecordMetadata>\n" + 
+        "            <edoc:Document id=\"Revision-1-Document-1\">\n" + 
+        "               <edoc:DocumentMetadata>\n" + 
+        "                  <dc:date>2003-07-20</dc:date>\n" + 
+        "                  <dc:type>20</dc:type>\n" + 
+        "                  <dc:format>PDF</dc:format>\n" + 
+        "                  <edoc:customer-number>222222</edoc:customer-number>\n" + 
+        "               </edoc:DocumentMetadata>\n" + 
+        "               <edoc:Encoding id=\"Revision-1-Document-1-Encoding-1\">\n" + 
+        "                  <edoc:EncodingMetadata>\n" + 
+        "                  </edoc:EncodingMetadata>\n" + 
+        "                  <edoc:ContentData encapsulation=\"Base64\" id=\"Revision-1-Document-1-Encoding-1-ContentData-1\" sourceFileSize=\"102550\">AAA</edoc:ContentData>\n" + 
+        "               </edoc:Encoding>\n" + 
+        "            </edoc:Document>\n" + 
+        "         </edoc:Record>\n" + 
+        "      </edoc:ObjectContent>\n" + 
+        "   </edoc:Object>";
+        
+        ByteArrayInputStream is = new ByteArrayInputStream(sig.getBytes());
+        javax.xml.parsers.DocumentBuilderFactory dbf =
+            javax.xml.parsers.DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+
+        javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+        org.w3c.dom.Document doc = db.parse(is);
+        Element sigElement =
+            (Element) doc.getElementsByTagNameNS(
+                Constants.SignatureSpecNS, Constants._TAG_SIGNATURE).item(0);
+        XMLSignature sign = new XMLSignature(sigElement, "");
+        boolean verify =
+            sign.checkSignatureValue(sign.getKeyInfo().getPublicKey());
+        if (!verify) {
+            for (int i = 0; i < sign.getSignedInfo().getLength(); i++) {
+                boolean refVerify =
+                    sign.getSignedInfo().getVerificationResult(i);	            
+                if (!refVerify) {
+                    byte[] contentBytes = 
+                        sign.getSignedInfo().item(i).getContentsAfterTransformation().getBytes();
+                    assertEquals(
+                        correctC14n, 
+                        new String(contentBytes)
+                    );
+                }
+            }
         }
+    }
+    
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/Base64Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/Base64Test.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/Base64Test.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/Base64Test.java Mon Jan 17 16:00:31 2011
@@ -17,14 +17,8 @@
  */
 package org.apache.xml.security.test.utils;
 
-
-
 import java.io.ByteArrayOutputStream;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
 import org.apache.xml.security.utils.Base64;
 import org.apache.xml.security.utils.XMLUtils;
 
@@ -34,123 +28,70 @@ import org.apache.xml.security.utils.XML
  *
  * @author Christian Geuer-Pollmann
  */
-public class Base64Test extends TestCase {
+public class Base64Test extends org.junit.Assert {
 
-   /** {@link org.apache.commons.logging} logging facility */
+    /** {@link org.apache.commons.logging} logging facility */
     static org.apache.commons.logging.Log log = 
         org.apache.commons.logging.LogFactory.getLog(Base64Test.class.getName());
-
-   /**
-    * Method suite
-    * @return
-    *    
-    */
-   public static Test suite() {
-      return new TestSuite(Base64Test.class);
-   }
-
-   /**
-    *
-    * @param Name_
-    */
-   public Base64Test(String Name_) {
-      super(Name_);
-   }
-
-   /**
-    *
-    * @param args
-    */
-   public static void main(String[] args) {
-
-      String[] testCaseName = { "-noloading", Base64Test.class.getName() };
-
-      junit.textui.TestRunner.main(testCaseName);
-
-      // junit.swingui.TestRunner.main(testCaseName);
-   }    //public static void main(String[] args)
-
-   /**
-    * Method testA1
-    * @throws Exception
-    *
-    * @throws java.io.UnsupportedEncodingException
-    * $todo$ Extend more tests
-    */
-   public static void testA1() throws Exception {
-
-      String textData = "Hallo";
-      String result0 = Base64.encode(textData.getBytes("UTF-8"));
-
-      assertNotNull("Result of encoding result0", result0);
-
-      byte resultBytes[] = Base64.decode(result0);
-      String resultStr = new String(resultBytes, "UTF-8");
-
-      assertEquals("Result of decoding", 0, textData.compareTo(resultStr));
-      ByteArrayOutputStream os=new ByteArrayOutputStream();
-      Base64.decode(result0.getBytes(),os);
-      resultStr = new String(os.toByteArray(), "UTF-8");
-      assertEquals("Result of decoding", 0, textData.compareTo(resultStr));
-   }
-
-   /**
-    * Method testWrap1
-    *
-        * Test for correct line wrapping at end of an exactly 76 char string
-        *
-    * @throws java.io.UnsupportedEncodingException
-    * @throws Exception
-    */
-
-        public static void testWrap1() 
-                throws java.io.UnsupportedEncodingException,Exception {
-
-                String inputData = "The quick brown fox jumps over the lazy dog and some extr";
-                String expectedResult = "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZyBhbmQgc29tZSBleHRy";
-                String result = Base64.encode(inputData.getBytes("UTF-8"));
-                assertEquals("Result of encoding", result, expectedResult);
-
-                String result2 = new String(Base64.decode(result), "UTF-8");
-                assertEquals("Result of encoding", result2, inputData);
-        ByteArrayOutputStream os=new ByteArrayOutputStream();
+    
+    static {
+        org.apache.xml.security.Init.init();
+    }
+
+    @org.junit.Test
+    public void testA1() throws Exception {
+        String textData = "Hallo";
+        String result0 = Base64.encode(textData.getBytes("UTF-8"));
+        assertNotNull("Result of encoding result0", result0);
+
+        byte resultBytes[] = Base64.decode(result0);
+        String resultStr = new String(resultBytes, "UTF-8");
+
+        assertEquals("Result of decoding", 0, textData.compareTo(resultStr));
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        Base64.decode(result0.getBytes(),os);
+        resultStr = new String(os.toByteArray(), "UTF-8");
+        assertEquals("Result of decoding", 0, textData.compareTo(resultStr));
+    }
+
+    @org.junit.Test
+    public void testWrap1() throws java.io.UnsupportedEncodingException,Exception {
+        String inputData = "The quick brown fox jumps over the lazy dog and some extr";
+        String expectedResult = 
+            "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZyBhbmQgc29tZSBleHRy";
+        String result = Base64.encode(inputData.getBytes("UTF-8"));
+        assertEquals("Result of encoding", result, expectedResult);
+
+        String result2 = new String(Base64.decode(result), "UTF-8");
+        assertEquals("Result of encoding", result2, inputData);
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
         Base64.decode(expectedResult.getBytes(),os);
-          result2 = new String(os.toByteArray(), "UTF-8");
-          assertEquals("Result of encoding", result2, inputData);
-
+        result2 = new String(os.toByteArray(), "UTF-8");
+        assertEquals("Result of encoding", result2, inputData);
+    }
+
+    @org.junit.Test
+    public void testWrap2() throws java.io.UnsupportedEncodingException, Exception {
+
+        String inputData = 
+            "The quick brown fox jumps over the lazy dog and some extra text that will cause a line wrap";
+        String expectedResult = null;
+        if (XMLUtils.ignoreLineBreaks()) {
+            expectedResult = 
+                "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZyBhbmQgc29tZSBleHRyYSB0ZXh0IHRoYXQgd2lsbCBjYXVzZSBhIGxpbmUgd3JhcA==";
+        } else {
+            expectedResult = 
+                "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZyBhbmQgc29tZSBleHRy\nYSB0ZXh0IHRoYXQgd2lsbCBjYXVzZSBhIGxpbmUgd3JhcA==";
         }
+        String result = Base64.encode(inputData.getBytes("UTF-8"));
+        assertEquals("Result of encoding", result, expectedResult);
 
-   /**
-    * Method testWrap2
-    *
-        * Test for correct line wrapping after more than 76 characters
-        *
-    * @throws java.io.UnsupportedEncodingException
-    * @throws Exception
-    */
-
-        public static void testWrap2() 
-                throws java.io.UnsupportedEncodingException, Exception {
-
-                String inputData = "The quick brown fox jumps over the lazy dog and some extra text that will cause a line wrap";
-                String expectedResult = null;
-                if (XMLUtils.ignoreLineBreaks()) {
-                    expectedResult = "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZyBhbmQgc29tZSBleHRyYSB0ZXh0IHRoYXQgd2lsbCBjYXVzZSBhIGxpbmUgd3JhcA==";
-                } else {
-                    expectedResult = "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZyBhbmQgc29tZSBleHRy\nYSB0ZXh0IHRoYXQgd2lsbCBjYXVzZSBhIGxpbmUgd3JhcA==";
-                }
-                String result = Base64.encode(inputData.getBytes("UTF-8"));
-                assertEquals("Result of encoding", result, expectedResult);
-
-                String result2 = new String(Base64.decode(result), "UTF-8");
-                assertEquals("Result of encoding", result2, inputData);
-        ByteArrayOutputStream os=new ByteArrayOutputStream();
+        String result2 = new String(Base64.decode(result), "UTF-8");
+        assertEquals("Result of encoding", result2, inputData);
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
         Base64.decode(expectedResult.getBytes(),os);
-          result2 = new String(os.toByteArray(), "UTF-8");
-          assertEquals("Result of encoding", result2, inputData);
-        }
+        result2 = new String(os.toByteArray(), "UTF-8");
+        assertEquals("Result of encoding", result2, inputData);
+    }
 
-   static {
-      org.apache.xml.security.Init.init();
-   }
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/IdResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/IdResolverTest.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/IdResolverTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/IdResolverTest.java Mon Jan 17 16:00:31 2011
@@ -24,48 +24,48 @@ import org.apache.xml.security.utils.IdR
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class IdResolverTest extends TestCase {
-        public static Test suite() {
-              return new TestSuite(IdResolverTest.class);
-           }
-        public void testIdSoap() throws Exception {
-                String s="<env:Envelope xmlns:SOAP-SEC=\"http://schemas.xmlsoap.org/soap/security/2000-12\" xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\" actor=\"some-uri\" mustUnderstand=\"1\">\r\n" + 
-                                "<env:Header><SOAP-SEC:Signature>xxxx</SOAP-SEC:Signature></env:Header>\r\n" + 
-                                "<env:Body SOAP-SEC:id=\"Body\">This is signed together with it\'s Body ancestor</env:Body>\r\n" + 
-                                "</env:Envelope>";
-                DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
-                dbf.setNamespaceAware(true);
-                Document doc=dbf.newDocumentBuilder().parse(new ByteArrayInputStream(s.getBytes()));
-                Element el=IdResolver.getElementById(doc, "Body");
-                assertNotNull(el);
-                assertEquals("Body",el.getLocalName());
-        }
-        public void testIdWithOtherIdSoap() throws Exception {
-                String s="<env:Envelope xmlns:SOAP-SEC=\"http://schemas.xmlsoap.org/soap/security/2000-12\" xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\" actor=\"some-uri\" mustUnderstand=\"1\">\r\n" + 
-                                "<env:Header><SOAP-SEC:Signature>xxxx</SOAP-SEC:Signature></env:Header>\r\n" + 
-                                "<a id=\"Body\"/><env:Body SOAP-SEC:id=\"Body\">This is signed together with it\'s Body ancestor</env:Body>\r\n" + 
-                                "</env:Envelope>";
-                DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
-                dbf.setNamespaceAware(true);
-                Document doc=dbf.newDocumentBuilder().parse(new ByteArrayInputStream(s.getBytes()));
-                Element el=IdResolver.getElementById(doc, "Body");
-                assertNotNull(el);
-                assertEquals("Body",el.getLocalName());
-        }
-        public void testANoId() throws Exception {
-                String s="<env:Envelope xmlns:SOAP-SEC=\"http://schemas.xmlsoap.org/soap/security/2000-12\" xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\" actor=\"some-uri\" mustUnderstand=\"1\">\r\n" + 
-                                "<env:Header><SOAP-SEC:Signature>xxxx</SOAP-SEC:Signature></env:Header>\r\n" + 
-                                "<a id=\"Body\"/>" + 
-                                "</env:Envelope>";
-                DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
-                dbf.setNamespaceAware(true);
-                Document doc=dbf.newDocumentBuilder().parse(new ByteArrayInputStream(s.getBytes()));
-                Element el=IdResolver.getElementById(doc, "Body");
-                assertNotNull(el);
-                assertEquals("a",el.getLocalName());
-        }
+public class IdResolverTest extends org.junit.Assert {
+    
+    @org.junit.Test
+    public void testIdSoap() throws Exception {
+        String s="<env:Envelope xmlns:SOAP-SEC=\"http://schemas.xmlsoap.org/soap/security/2000-12\" xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\" actor=\"some-uri\" mustUnderstand=\"1\">\r\n" 
+            + "<env:Header><SOAP-SEC:Signature>xxxx</SOAP-SEC:Signature></env:Header>\r\n"
+            + "<env:Body SOAP-SEC:id=\"Body\">This is signed together with it\'s Body ancestor</env:Body>\r\n" 
+            + "</env:Envelope>";
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        Document doc = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(s.getBytes()));
+        Element el = IdResolver.getElementById(doc, "Body");
+        assertNotNull(el);
+        assertEquals("Body", el.getLocalName());
+    }
+    
+    @org.junit.Test
+    public void testIdWithOtherIdSoap() throws Exception {
+        String s="<env:Envelope xmlns:SOAP-SEC=\"http://schemas.xmlsoap.org/soap/security/2000-12\" xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\" actor=\"some-uri\" mustUnderstand=\"1\">\r\n" 
+            + "<env:Header><SOAP-SEC:Signature>xxxx</SOAP-SEC:Signature></env:Header>\r\n"
+            + "<a id=\"Body\"/><env:Body SOAP-SEC:id=\"Body\">This is signed together with it\'s Body ancestor</env:Body>\r\n" 
+            + "</env:Envelope>";
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        Document doc = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(s.getBytes()));
+        Element el = IdResolver.getElementById(doc, "Body");
+        assertNotNull(el);
+        assertEquals("Body", el.getLocalName());
+    }
+    
+    @org.junit.Test
+    public void testANoId() throws Exception {
+        String s = "<env:Envelope xmlns:SOAP-SEC=\"http://schemas.xmlsoap.org/soap/security/2000-12\" xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\" actor=\"some-uri\" mustUnderstand=\"1\">\r\n"
+            + "<env:Header><SOAP-SEC:Signature>xxxx</SOAP-SEC:Signature></env:Header>\r\n"
+            + "<a id=\"Body\"/>"
+            + "</env:Envelope>";
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        Document doc = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(s.getBytes()));
+        Element el = IdResolver.getElementById(doc, "Body");
+        assertNotNull(el);
+        assertEquals("a", el.getLocalName());
+    }
+    
 }

Modified: santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java?rev=1059966&r1=1059965&r2=1059966&view=diff
==============================================================================
--- santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java (original)
+++ santuario/xml-security-java/trunk/src/test/java/org/apache/xml/security/test/utils/OldApiTest.java Mon Jan 17 16:00:31 2011
@@ -24,8 +24,6 @@ import javax.crypto.SecretKey;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import junit.framework.TestCase;
-
 import org.apache.xml.security.Init;
 import org.apache.xml.security.c14n.CanonicalizationException;
 import org.apache.xml.security.c14n.InvalidCanonicalizerException;
@@ -46,153 +44,169 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-public class OldApiTest extends TestCase {
+public class OldApiTest extends org.junit.Assert {
+
+    public static class OldTransform extends TransformSpi {
+        static Transform compare;
         
-        public static class OldTransform extends TransformSpi {
-                static Transform compare;
-                protected XMLSignatureInput enginePerformTransform(
-                              XMLSignatureInput input)
-                                 throws IOException,
-                                        CanonicalizationException, InvalidCanonicalizerException,
-                                        TransformationException, ParserConfigurationException,
-                                        SAXException {
-                        assertEquals(compare,_transformObject);
-                                 return null ;
-             }
-
-                protected String engineGetURI() {
-                        // TODO Auto-generated method stub
-                        return null;
-                };
-        };
-        public void testOldTransformSpiApi() throws Exception {
-                Init.init();
-                Document doc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
-                Transform.register("old", OldTransform.class.getName());
-
-                Transform a=new Transform(doc,"old",null);
-                OldTransform.compare=a;
-                a.performTransform(null);
+        @SuppressWarnings("deprecation")
+        protected XMLSignatureInput enginePerformTransform(
+            XMLSignatureInput input
+        ) throws IOException, CanonicalizationException, InvalidCanonicalizerException,
+            TransformationException, ParserConfigurationException, SAXException {
+            assertEquals(compare, _transformObject);
+            return null ;
+        }
+
+        protected String engineGetURI() {
+            return null;
         };
+    }
+    
+    public static class OldResourceResolverSpi extends ResourceResolverSpi {
+        Attr uriCompare;
+        String baseCompare;
         
-        public static class OldResourceResolverSpi extends ResourceResolverSpi {
-                Attr uriCompare;
-                String baseCompare;
-                public boolean engineCanResolve(Attr uri, String BaseURI) {
-                        if (uri.getValue().indexOf("!!!test=")!=0) {
-                                return false;
-                        }
-                        uriCompare=uri;
-                        baseCompare=BaseURI;
-                        return true;
-                }
-
-                public XMLSignatureInput engineResolve(Attr uri, String BaseURI) throws ResourceResolverException {
-                        assertEquals(uriCompare, uri);
-                        assertEquals(baseCompare,BaseURI);
-                        return null;
-                }
-                
-        };
-        public void testOldResourceResolverSpi() throws Exception {
-                Document doc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();		
-                Attr uri=doc.createAttribute("id");
-                uri.setNodeValue("!!!test=1");
-                ((Element)doc.createElement("test")).setAttributeNode(uri);
-                Attr uri1=doc.createAttribute("id");
-                uri1.setNodeValue("!!!test=2");
-                doc.createElement("test1").setAttributeNode(uri1);
-                ResourceResolver.registerAtStart(OldResourceResolverSpi.class.getName());
-                ResourceResolver resolver=ResourceResolver.getInstance(uri, "test");
-                ResourceResolver resolver1=ResourceResolver.getInstance(uri1, "test1");
-                ResourceResolver resolver2=ResourceResolver.getInstance(uri1, "test2");
-                
-                resolver2.resolve(uri1, "test2");		
-                resolver.resolve(uri, "test");
-                resolver1.resolve(uri1, "test1");
-                
-                
-        };
-        static class PublicKeyMock implements PublicKey {
+        public boolean engineCanResolve(Attr uri, String BaseURI) {
+            if (uri.getValue().indexOf("!!!test=") != 0) {
+                return false;
+            }
+            uriCompare = uri;
+            baseCompare = BaseURI;
+            return true;
+        }
 
-                   public String getAlgorithm() {
-                           // TODO Auto-generated method stub
-                           return null;
-                   }
-
-                   public byte[] getEncoded() {
-                           // TODO Auto-generated method stub
-                           return null;
-                   }
-
-                   public String getFormat() {
-                           // TODO Auto-generated method stub
-                           return null;
-                   }				   
-           };			
-        static public class OldKeyResolverSpi extends KeyResolverSpi {
-                static int number=0;
-                PublicKey pk=null;
-                public OldKeyResolverSpi() {
-                        number++;
-                };
-                public boolean engineCanResolve(Element element, String BaseURI,
-                                                                    StorageResolver storage) {
-                           if ("!!!testUri".equals(BaseURI)) 
-                                   return true;
-                           return false;
-                }
-                   public PublicKey engineResolvePublicKey(
-                      Element element, String BaseURI, StorageResolver storage)
-                         throws KeyResolverException {
-                           if (pk==null)
-                                   pk=new PublicKeyMock();
-                           return pk;
-                    };
-                   
-                   
-                    public X509Certificate engineResolveX509Certificate(
-                       Element element, String BaseURI, StorageResolver storage)
-                         throws KeyResolverException{
-                        return null;
-                    };
-
-                    public SecretKey engineResolveSecretKey(
-                       Element element, String BaseURI, StorageResolver storage)
-                          throws KeyResolverException{
-                        return null;
-                    }; 
-        };
+        public XMLSignatureInput engineResolve(
+            Attr uri, String BaseURI
+        ) throws ResourceResolverException {
+            assertEquals(uriCompare, uri);
+            assertEquals(baseCompare,BaseURI);
+            return null;
+        }
+    }
+    
+    static class PublicKeyMock implements PublicKey {
+
+        public String getAlgorithm() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public byte[] getEncoded() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public String getFormat() {
+            // TODO Auto-generated method stub
+            return null;
+        }                  
+    }
+    
+    static public class OldKeyResolverSpi extends KeyResolverSpi {
+        static int number = 0;
+        PublicKey pk = null;
         
-        public void testOldKeyResolverSpi() throws Exception{
-                KeyResolver.register(OldKeyResolverSpi.class.getName());
-                Document doc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();				
-                Element el=((Element)doc.createElement("test"));
-                PublicKey pk=KeyResolver.getPublicKey(el, "!!!testUri", null);
-                assertNotNull(pk);
-                assertTrue(pk instanceof PublicKeyMock);
-                assertEquals(2, OldKeyResolverSpi.number);
-                PublicKey pk1=KeyResolver.getPublicKey(el, "!!!testUri", null);
-                assertNotSame(pk,pk1);
-                assertEquals(3, OldKeyResolverSpi.number);
-        }
-        static public class OldKeyResolverNoPublicConsSpi extends OldKeyResolverSpi {
-                protected OldKeyResolverNoPublicConsSpi() {		
-                };
-                public OldKeyResolverNoPublicConsSpi(PublicKey pk) {
-                        this.pk=pk;
-                }
-        };
+        public OldKeyResolverSpi() {
+            number++;
+        }
+        
+        public boolean engineCanResolve(
+            Element element, String BaseURI, StorageResolver storage
+        ) {
+            if ("!!!testUri".equals(BaseURI)) {
+                return true;
+            }
+            return false;
+        }
         
+        public PublicKey engineResolvePublicKey(
+            Element element, String BaseURI, StorageResolver storage
+        ) throws KeyResolverException {
+            if (pk == null) {
+                pk = new PublicKeyMock();
+            }
+            return pk;
+        }
+
+        public X509Certificate engineResolveX509Certificate(
+            Element element, String BaseURI, StorageResolver storage
+        ) throws KeyResolverException {
+            return null;
+        };
 
-        public void testOldKeyResolverSpiInKeyInfo() throws Exception{
-                Document doc=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
-                Element el=(Element)doc.createElementNS("http://www.w3.org/2000/09/xmldsig#","KeyInfo");
-                el.appendChild((Element)doc.createElementNS("http://www.w3.org/2000/09/xmldsig#","KeyInfo"));
-                KeyInfo ki=new KeyInfo(el,"!!!testUri");
-                PublicKey pk=new PublicKeyMock();
-                ki.registerInternalKeyResolver(new OldKeyResolverNoPublicConsSpi(pk));
-                assertNotNull(ki.getPublicKey());
-                
+        public SecretKey engineResolveSecretKey(
+            Element element, String BaseURI, StorageResolver storage
+        ) throws KeyResolverException{
+            return null;
         }
+    }
+    
+    static public class OldKeyResolverNoPublicConsSpi extends OldKeyResolverSpi {
+        
+        protected OldKeyResolverNoPublicConsSpi() {
+            //
+        }
+        
+        public OldKeyResolverNoPublicConsSpi(PublicKey pk) {
+            this.pk = pk;
+        }
+    }
+
+    @org.junit.Test
+    public void testOldTransformSpiApi() throws Exception {
+        Init.init();
+        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+        Transform.register("old", OldTransform.class.getName());
+
+        Transform a = new Transform(doc, "old", null);
+        OldTransform.compare = a;
+        a.performTransform(null);
+    }
+
+    @org.junit.Test
+    public void testOldResourceResolverSpi() throws Exception {
+        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();		
+        Attr uri = doc.createAttribute("id");
+        uri.setNodeValue("!!!test=1");
+        ((Element)doc.createElement("test")).setAttributeNode(uri);
+        Attr uri1 = doc.createAttribute("id");
+        uri1.setNodeValue("!!!test=2");
+        doc.createElement("test1").setAttributeNode(uri1);
+        ResourceResolver.registerAtStart(OldResourceResolverSpi.class.getName());
+        ResourceResolver resolver = ResourceResolver.getInstance(uri, "test");
+        ResourceResolver resolver1 = ResourceResolver.getInstance(uri1, "test1");
+        ResourceResolver resolver2 = ResourceResolver.getInstance(uri1, "test2");
+
+        resolver2.resolve(uri1, "test2");		
+        resolver.resolve(uri, "test");
+        resolver1.resolve(uri1, "test1");
+    }
+    
+    @org.junit.Test
+    public void testOldKeyResolverSpi() throws Exception{
+        KeyResolver.register(OldKeyResolverSpi.class.getName());
+        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();				
+        Element el = ((Element)doc.createElement("test"));
+        PublicKey pk = KeyResolver.getPublicKey(el, "!!!testUri", null);
+        assertNotNull(pk);
+        assertTrue(pk instanceof PublicKeyMock);
+        assertEquals(2, OldKeyResolverSpi.number);
+        PublicKey pk1 = KeyResolver.getPublicKey(el, "!!!testUri", null);
+        assertNotSame(pk, pk1);
+        assertEquals(3, OldKeyResolverSpi.number);
+    }
+
+    @org.junit.Test
+    public void testOldKeyResolverSpiInKeyInfo() throws Exception{
+        Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+        Element el = (Element)doc.createElementNS("http://www.w3.org/2000/09/xmldsig#","KeyInfo");
+        el.appendChild((Element)doc.createElementNS("http://www.w3.org/2000/09/xmldsig#","KeyInfo"));
+        KeyInfo ki = new KeyInfo(el,"!!!testUri");
+        PublicKey pk = new PublicKeyMock();
+        ki.registerInternalKeyResolver(new OldKeyResolverNoPublicConsSpi(pk));
+        assertNotNull(ki.getPublicKey());
+
+    }
+    
 }