Bug 47260 - Improve Java unit testing
Summary: Improve Java unit testing
Alias: None
Product: Security - Now in JIRA
Classification: Unclassified
Component: Signature (show other bugs)
Version: Java 1.4.2
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: XML Security Developers Mailing List
Depends on:
Reported: 2009-05-25 06:29 UTC by coheigea
Modified: 2009-07-08 04:09 UTC (History)
0 users

A patch for this issue (17.18 KB, patch)
2009-05-26 03:25 UTC, coheigea
Details | Diff
A second patch for this issue (3.02 KB, patch)
2009-06-26 07:20 UTC, coheigea
Details | Diff
Patch no. 3 (1.41 KB, patch)
2009-06-29 03:16 UTC, coheigea
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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:


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.

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.