Bug 47260

Summary: Improve Java unit testing
Product: Security - Now in JIRA Reporter: coheigea <coheigea>
Component: SignatureAssignee: XML Security Developers Mailing List <security-dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: Java 1.4.2   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: A patch for this issue
A second patch for this issue
Patch no. 3

Description coheigea 2009-05-25 06:29:34 UTC
There are some issues with the Java unit testing framework of XML Security, namely:

 - Most of the org.apache.* unit tests can be run via the "AllTests" class, but some are omitted.
 - The test configuration in build.xml runs AllTests, but also runs *Test*.java, so most of the org.apache.* unit tests are run twice.
 - Some of the tests write to System.out
 - One of the tests, IaikCoreFeaturesTest, is failing.

I'll submit a patch for these issues later this week hopefully.
Comment 1 coheigea 2009-05-26 03:25:55 UTC
Created attachment 23714 [details]
A patch for this issue


Attached is a patch for these issues. 

Namely, "ant test" only runs the src_unitTests\org\apache\xml\security\test\AllTests.java test suite, which in turn runs all of the org.apache test suites, whereas before most of these tests were run twice. I also removed a lot of the test output to System.out.

I couldn't find out why one of the javax unit tests, IaikCoreFeaturesTest, was failing. I checked the 1.4.2 and 1.4.1 release tags, and the test was failing in both of these tags.
Comment 2 coheigea 2009-06-26 07:20:50 UTC
Created attachment 23888 [details]
A second patch for this issue


This is part two of a patch for improving the unit tests.

This patch fixes the failing IaikCoreFeaturesTest. The test verifies an iaik test signature which contains a number of different references. One of the references is to the document found here:

http://www.w3.org/TR/2000/REC-xml-20001006

The reason signature verification was failing is that this document seems to have been modified since the signature was created....specifically, it used to be:

<html lang="EN">

but now it has:

<html xmlns="http://www.w3.org/1999/xhtml" lang="EN">

and so the digest comparison fails. I changed the test by adding a URIDerefencer which points to a local copy of the document in "data" which was there previously and doesn't have the additional default namespace.

Colm.
Comment 3 coheigea 2009-06-29 03:16:37 UTC
Created attachment 23898 [details]
Patch no. 3


Patch no. 3 for cleaning up the tests.

This patch stops the Baltimore interop test writing out bad signatures to the "data" directory...these particular tests are expected to fail, and we shouldn't be writing anything to a directory that isn't cleaned with ant/mvn clean.
Comment 4 coheigea 2009-07-08 04:09:31 UTC
Patches applied.

Colm.