You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tsik-dev@ws.apache.org by ha...@apache.org on 2005/08/08 22:03:01 UTC

svn commit: r230871 [56/61] - in /incubator/tsik/trunk: ./ data/ data/schema/ resources/ resources/junit/ src/ src/org/ src/org/apache/ src/org/apache/tsik/ src/org/apache/tsik/c14n/ src/org/apache/tsik/c14n/elements/ src/org/apache/tsik/common/ src/or...

Added: incubator/tsik/trunk/test/src/org/apache/tsik/crl/test/TestCrl.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/crl/test/TestCrl.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/crl/test/TestCrl.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/crl/test/TestCrl.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,303 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.crl.test;
+
+import org.apache.tsik.crl.CRLTrustVerifier;
+import org.apache.tsik.verifier.TrustVerificationException;
+import java.io.ByteArrayInputStream;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TestCrl extends TestCase
+{
+    public static void main(String[] args) 
+    {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    public TestCrl(String name) 
+    {
+        super(name);
+    }
+
+    public static Test suite() 
+    {
+        org.apache.log4j.PropertyConfigurator.configure("log4j/log4j.props");
+        return new TestSuite(TestCrl.class);
+    }
+
+    // test a Keon cert
+    public void testKeonCert()
+    {
+        String s =  "-----BEGIN CERTIFICATE-----\n" +
+    "MIIDpDCCAoygAwIBAgIQW+qKt5qQYs0z69ZUbz1luDANBgkqhkiG9w0BAQUFADBFMQswCQYD" +
+    "VQQGEwJ1czELMAkGA1UEChMCcWExCzAJBgNVBAsTAnFhMRwwGgYDVQQDExNDRFAtQUlBLVZB" +
+    "TElELUlOVENBMB4XDTAzMDgwNTE5NDA1M1oXDTE5MDcyNjIzNTI1M1owRjELMAkGA1UEBhMC" +
+    "dXMxCzAJBgNVBAoTAnFhMQswCQYDVQQLEwJxYTEdMBsGA1UEAxMUY3VzdG9tZW5kLWJvdGgt" +
+    "dmFsaWQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMCgL/l8qfzGQdtbmaDdzKiv8SAQ" +
+    "f4QbRQ7fVEaB+5NAp8nzY85TyaGVEizIiUFAudzChGkVMpn+SIw9+C+PgYZL8G/QuzRBBHAI" +
+    "HuV35tsv3nTOcax/sBJKGfZJEgWF4kf8fKTgj7h57iLG328sjkegW3AQHpq2RN9iwVjgJ1Ul" +
+    "AgMBAAGjggERMIIBDTBfBggrBgEFBQcBAQRTMFEwTwYIKwYBBQUHMAKGQ2h0dHA6Ly9tam9z" +
+    "aGktcGMudmVyaXNpZ24uY29tOjkwL2NybHRlc3RpbmcvQ0RQLUFJQS1WQUxJRC1JTlRDQS5j" +
+    "ZXIwHwYDVR0jBBgwFoAUCBBuMc+uTWgHM7tmCBH0gKmRkCYwCQYDVR0TBAIwADAOBgNVHQ8B" +
+    "Af8EBAMCB4AwHQYDVR0OBBYEFLOg7d3ykh/fb+bYxTln5AhNBSTrME8GA1UdHwRIMEYwRKBC" +
+    "oECGPmh0dHA6Ly9NSk9TSEktUEMudmNvcnAuYWQudnJzbi5jb206NDQ3L0NEUC1BSUEtVkFM" +
+    "SUQtSU5UQ0EuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQAxYTIR4yk/3oLJU8WS820DaK6BuuRo" +
+    "bUcUdUoH4/FZNufJKqA09kJtqIKeUYUJEIFXznYtEF2OsvjUiN20pnnqnHQnhRF6fL3mReZq" +
+    "nXZlbIwHIOrvnk8TfG8InstuqtLADCHxCzxC2IXc8UJ8DEefJYpnbUupydQBffc/5rWRtPjG" +
+    "Lh0KgS8QGIzT7fyvSWM2+5Yu5zuPIhM8r65rGCJ3vbwzPGXGgCQ8/pKsKslZvhOHTODhbgo0" +
+    "NNDGJ7x4kOv59boX2iL5wklWnAxQqNNS7H6+bwhYUgy/RsWEiBaiks0Qd2Xv0h1qBJ/H5uRQ" +
+    "k6e0M9FBYx77JJqE1iVJ5vUZ\n" +
+    "-----END CERTIFICATE-----\n";
+
+        try {
+            checkStatusUsingCRL(s);
+        } catch (TrustVerificationException tve) {
+            assertTrue(tve.toString(), true);
+        }
+    }
+
+    // test a server cert that is revoked
+    public void testRevokedServerCert()
+    {
+        String s =  "-----BEGIN CERTIFICATE-----\n" +
+    "MIIDbDCCAtmgAwIBAgIQAnY8RcPmhiQ4N8uM2aMejzANBgkqhkiG9w0BAQUFADBf" +
+    "MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXUlNBIERhdGEgU2VjdXJpdHksIEluYy4x" +
+    "LjAsBgNVBAsTJVNlY3VyZSBTZXJ2ZXIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw" +
+    "HhcNMDMwNTEzMDAwMDAwWhcNMDQwNTEyMjM1OTU5WjCBljELMAkGA1UEBhMCVVMx" +
+    "EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcUDU1vdW50YWluIFZpZXcxFTAT" +
+    "BgNVBAoUDFZlcmlTaWduVGVzdDEjMCEGA1UECxQaVHJ1c3QgR2F0ZXdheSBNUEtJ" +
+    "IFJldm9rZWQxHjAcBgNVBAMUFWFwZXgtdzJrLnZlcmlzaWduLmNvbTCBnzANBgkq" +
+    "hkiG9w0BAQEFAAOBjQAwgYkCgYEAt2ydWFj6svSMCXYuKLdkUrnSq0HGaonWJcat" +
+    "W301xsdfrccTtTVjsZ1wPEB5h6g1AKIejhYm0hlVNyv+tZmkMTFmoBW1ROEJ5XQY" +
+    "CVylj/Jfn/U3AvoSxjXi01eIVPg2NM+PGze9H/QnOC1Q27rrPIITArl8Pt8dmWhW" +
+    "yL/jAwcCAwEAAaOB9DCB8TAJBgNVHRMEAjAAMAsGA1UdDwQEAwIFoDA8BgNVHR8E" +
+    "NTAzMDGgL6AthitodHRwOi8vY3JsLnZlcmlzaWduLmNvbS9SU0FTZWN1cmVTZXJ2" +
+    "ZXIuY3JsMEQGA1UdIAQ9MDswOQYLYIZIAYb4RQEHFwMwKjAoBggrBgEFBQcCARYc" +
+    "aHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYTAdBgNVHSUEFjAUBggrBgEFBQcD" +
+    "AQYIKwYBBQUHAwIwNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8v" +
+    "b2NzcC52ZXJpc2lnbi5jb20wDQYJKoZIhvcNAQEFBQADfgAMy1h17faNZOscULUP" +
+    "MU8oAWS2v5dR1DAUhcJIjiLC7K5u/y6oW79ZIVIuKRchJDNGIqozNkP+XeSGpzHN" +
+    "doaLPLyVK0L5nPAJi2guM8Ya6DN/2Gp9PpBWjV8CCIEmayjiFgZU7z2cTBRgiwLM" +
+    "tdWh7eJ5gDzoEh445WjLzg==\n" +
+    "-----END CERTIFICATE-----\n";
+
+        try {
+            checkStatusUsingCRL(s);
+        } catch (TrustVerificationException tve) {
+            assertTrue(tve.toString(), true);
+        }
+    }
+
+    // test a MPKI client certificate
+    public void testMPKIRevokedCert()
+    {
+        String s =  "-----BEGIN CERTIFICATE-----\n" +
+    "MIIDvjCCA2igAwIBAgIQSLU/CNIXAntudc2EDfVwYDANBgkqhkiG9w0BAQQFADCB" +
+    "mTERMA8GA1UEChMIVmVyaVNpZ24xLjAsBgNVBAsTJVZlcmlTaWduIENsYXNzIDIg" +
+    "T25TaXRlIEluZGl2aWR1YWwgQ0ExHzAdBgNVBAsTFkZvciBUZXN0IFB1cnBvc2Vz" +
+    "IE9ubHkxMzAxBgNVBAMTKlZlcmlTaWduIENsYXNzIDIgT25TaXRlIEluZGl2aWR1" +
+    "YWwgVEVTVCBDQTAeFw0wMzA1MTAwMDAwMDBaFw0wNDA1MDkyMzU5NTlaMIGvMREw" +
+    "DwYDVQQKFAhWZXJpU2lnbjESMBAGA1UECxQJWEtNUyBUZXN0MUYwRAYDVQQLEz13" +
+    "d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTIEluY29ycC4gYnkgUmVmLixM" +
+    "SUFCLkxURChjKTk5MRcwFQYDVQQDEw5TdGV2ZSBIZWxsZXIxNzElMCMGCSqGSIb3" +
+    "DQEJARYWc2hlbGxlcjE3QHZlcmlzaWduLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOB" +
+    "jQAwgYkCgYEA5EvqJfWZ7BJH25qXX0oZKL5Xrn8AUK/oLJ6VW6R5p5E0YZjQWBfr" +
+    "PWOs3C+iKBM3WqWVWOpiunZJbxelMOzQy/EswAyNP+OB7Gjz32+DMIbgDuo7ZZTy" +
+    "9RnN3MELwa9IchQcBHe5jXwXrirzWgUdRICidQCoPURgQN8M1wlPc8kCAwEAAaOC" +
+    "AS4wggEqMAkGA1UdEwQCMAAwgawGA1UdIASBpDCBoTCBngYLYIZIAYb4RQEHAQEw" +
+    "gY4wKAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9DUFMwYgYI" +
+    "KwYBBQUHAgIwVjAVFg5WZXJpU2lnbiwgSW5jLjADAgEBGj1WZXJpU2lnbidzIENQ" +
+    "UyBpbmNvcnAuIGJ5IHJlZmVyZW5jZSBsaWFiLiBsdGQuIChjKTk3IFZlcmlTaWdu" +
+    "MAsGA1UdDwQEAwIFoDARBglghkgBhvhCAQEEBAMCB4AwTgYDVR0fBEcwRTBDoEGg" +
+    "P4Y9aHR0cDovL3BpbG90b25zaXRlY3JsLnZlcmlzaWduLmNvbS9PblNpdGVQdWJs" +
+    "aWMvTGF0ZXN0Q1JMLmNybDANBgkqhkiG9w0BAQQFAANBABp44xksxRNHgNC2Bzcv" +
+    "6dH/XTeKr7lEKndLk5ztoR1Rb26vxYK2w1kkOPeezYwcam2kOf+2lU8ZgfPi84Ji" +
+    "JoQ=\n" +
+    "-----END CERTIFICATE-----\n";
+	
+        try {
+            checkStatusUsingCRL(s);
+        } catch (TrustVerificationException tve) {
+            assertTrue(tve.toString(), true);
+        }
+        
+     }
+
+   // test a MPKI client certificate
+     public void testMPKINotRevokedCertPopulateCA()
+     {
+        String s =  "-----BEGIN CERTIFICATE-----\n" +
+         "MIIDtzCCA2GgAwIBAgIQUtcfj/JYvfjWmj1VBY1kZTANBgkqhkiG9w0BAQQFADCB" +
+         "mTERMA8GA1UEChMIVmVyaVNpZ24xLjAsBgNVBAsTJVZlcmlTaWduIENsYXNzIDIg" +
+         "T25TaXRlIEluZGl2aWR1YWwgQ0ExHzAdBgNVBAsTFkZvciBUZXN0IFB1cnBvc2Vz" +
+         "IE9ubHkxMzAxBgNVBAMTKlZlcmlTaWduIENsYXNzIDIgT25TaXRlIEluZGl2aWR1" +
+         "YWwgVEVTVCBDQTAeFw0wMzAzMjgwMDAwMDBaFw0wNDAzMjcyMzU5NTlaMIGoMREw" +
+         "DwYDVQQKFAhWZXJpU2lnbjESMBAGA1UECxQJWEtNUyBUZXN0MUYwRAYDVQQLEz13" +
+         "d3cudmVyaXNpZ24uY29tL3JlcG9zaXRvcnkvQ1BTIEluY29ycC4gYnkgUmVmLixM" +
+         "SUFCLkxURChjKTk5MRMwEQYDVQQDEwpzYW1wbGUga2V5MSIwIAYJKoZIhvcNAQkB" +
+         "FhNzYW1wbGVfa2V5QHhrbXMub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB" +
+         "gQDBlqZiqaBTC1QzdevgJd0uAsUMI6Iihu3/RzbfqHuhd3AAU7L+dYbvb2DLNvfI" +
+         "ha2sFA6NHaIMeK4EDWHKkBoJkIWFU4ox27t6u6EhWHJdwo+/5gyFN7qfCIfNXKxl" +
+         "cbo+Llw0+EUj+dS8rbQb3UmScuihBHvEibPkzHbq5ZqSywIDAQABo4IBLjCCASow" +
+         "CQYDVR0TBAIwADCBrAYDVR0gBIGkMIGhMIGeBgtghkgBhvhFAQcBATCBjjAoBggr" +
+         "BgEFBQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQUzBiBggrBgEFBQcC" +
+         "AjBWMBUWDlZlcmlTaWduLCBJbmMuMAMCAQEaPVZlcmlTaWduJ3MgQ1BTIGluY29y" +
+         "cC4gYnkgcmVmZXJlbmNlIGxpYWIuIGx0ZC4gKGMpOTcgVmVyaVNpZ24wCwYDVR0P" +
+         "BAQDAgWgMBEGCWCGSAGG+EIBAQQEAwIHgDBOBgNVHR8ERzBFMEOgQaA/hj1odHRw" +
+         "Oi8vcGlsb3RvbnNpdGVjcmwudmVyaXNpZ24uY29tL09uU2l0ZVB1YmxpYy9MYXRl" +
+         "c3RDUkwuY3JsMA0GCSqGSIb3DQEBBAUAA0EAMk/Kkm1N8/yU6UpKZt/kIdKVaL4m" +
+         "FIQWr8yCUK8ro9bTZV5qdMoHbSN/Y7rF0If5KRsDAJOOAAFDZs3dh38ieg==\n" +
+         "-----END CERTIFICATE-----\n";
+
+        String ca = "-----BEGIN CERTIFICATE-----\n" +
+    "MIIDnTCCAwagAwIBAgIQIgulbZZhm1cviRALwTJz+DANBgkqhkiG9w0BAQUFADCB8DELMAkG"+
+    "A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMUEwPwYDVQQLEzhDbGFzcyAyIFRF"+
+    "U1QgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjFDMEEGA1UE"+
+    "CxM6VGVybXMgb2YgdXNlIGF0IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9jcHMvdGVzdGNh"+
+    "LyAoYykwMjEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazEfMB0GA1UECxMWRm9y"+
+    "IFRlc3QgUHVycG9zZXMgT25seTAeFw0wMjA0MjEwMDAwMDBaFw0wNzA0MjAyMzU5NTlaMIGZ"+
+    "MREwDwYDVQQKEwhWZXJpU2lnbjEuMCwGA1UECxMlVmVyaVNpZ24gQ2xhc3MgMiBPblNpdGUg"+
+    "SW5kaXZpZHVhbCBDQTEfMB0GA1UECxMWRm9yIFRlc3QgUHVycG9zZXMgT25seTEzMDEGA1UE"+
+    "AxMqVmVyaVNpZ24gQ2xhc3MgMiBPblNpdGUgSW5kaXZpZHVhbCBURVNUIENBMFwwDQYJKoZI"+
+    "hvcNAQEBBQADSwAwSAJBAKEVY1nZYy55310CHBAZYtshi/HWfcxHfsfJ3Fc8/Rs0ejW3g+4I"+
+    "Uakmzt2mxj2DzbPO0pJbbT54G3cCALy/RdcCAwEAAaOB0DCBzTAPBgNVHRMECDAGAQH/AgEA"+
+    "MEsGA1UdIAREMEIwQAYKYIZIAYb4RQEHFTAyMDAGCCsGAQUFBwIBFiRodHRwczovL3d3dy52"+
+    "ZXJpc2lnbi5jb20vY3BzL3Rlc3RjYS8wCwYDVR0PBAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIB"+
+    "BjBNBgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vcGlsb3RvbnNpdGVjcmwudmVyaXNpZ24uY29t"+
+    "L09mZmxpbmVDQS90ZXN0cGNhMi1nMi5jcmwwDQYJKoZIhvcNAQEFBQADgYEAisE+ssacHdi/"+
+    "MNW54ckP/e06JWYjWsFnxz4ADWka93gLebeF5Yw6OqASx0FnmhpF5iH7mfCiF3GdxPyxjTHn"+
+    "4Jo8Xb1++YoTI15t+mzu7WX2P49KsMsx04Hw39envD63LcqZ7xV8X+tbRldx5P+6K7tcGxSN"+
+    "aVMZqE9vfttKzEc=\n"+
+    "-----END CERTIFICATE-----\n";
+        try {
+            checkStatusUsingCRL(s, ca);
+        } catch (TrustVerificationException tve) {
+            assertTrue(tve.toString(), false);
+        }
+        assertTrue(true);
+     }
+
+    // test a MPKI affliate client certificate (HSBC)
+     public void testMPKIAffiliateGoodCert()
+     {
+        String s =  "-----BEGIN CERTIFICATE-----\n" +
+            "MIIDCjCCAnOgAwIBAgIQZAOIY81bkQpeFCRi+dFYyzANBgkqhkiG9w0BAQQFADAX" +
+            "MRUwEwYDVQQKEwxIU0JDIEVUIEFzaWEwHhcNMDAxMTE3MDAwMDAwWhcNMDExMTIx" +
+            "MjM1OTU5WjCB5TELMAkGA1UEBhMCSEsxFTATBgNVBAoUDEhTQkMgRVQgQXNpYTEc" +
+            "MBoGA1UECxQTRW1wbG95ZWVJRCAtIDYyMzMwMDEXMBUGA1UECxQOTWFpbFN0b3Ag" +
+            "LSBUUlMxHjAcBgNVBAsUFUNvbXBhbnkgTmFtZSAtIFRDTSBJVDEfMB0GA1UECxQW" +
+            "SFNCQyBFVCBJRCAtIFVBVENMSUVOVDENMAsGA1UEDBQEU0lUTzETMBEGA1UEAxMK" +
+            "Q2xpZW50IFVBVDEjMCEGCSqGSIb3DQEJARYUbGVvY2hvbmdAaHNiYy5jb20uaGsw" +
+            "gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL/+La/tQGJ9/iCoHOVuRrMSwJc7" +
+            "3Hc++7omogFJatvSRUn5Y3/D+5qolrlgafteE7YBDIB48UIGvaDUEtl/IRFK5vLx" +
+            "spWptgeessIb3sCZUC0rwtt4mDSyjRQt0MWyKx4OnPahJ3ZCGfVs/c5M0wiD6Ift" +
+            "J2TlcYbGwPwwhkRZAgMBAAGjgYcwgYQwCQYDVR0TBAIwADALBgNVHQ8EBAMCBaAw" +
+            "EQYJYIZIAYb4QgEBBAQDAgeAMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA6Ly9vbnNp" +
+            "dGVjcmwudHJ1c3R3aXNlLmNvbS9IU0JDRVRBc2lhL0xhdGVzdENSTDARBgpghkgB" +
+            "hvhFAQYJBAMBAf8wDQYJKoZIhvcNAQEEBQADgYEAQY2IMIp8nYjyavFXs5E9wP2z" +
+            "QCA1lwukB8NOFqdb09NpWCSgU/GL7vHinQHvlnK+3dJTqrpamKJD8UhwdA6OoIwW" +
+            "iytk9nkraZu3pCxxJ3JvIHDIpNVFWcZvLkLIzqgWSMA6M5s/R2ICGTj4aB3jKdTW" +
+            "h6P0X/FXwc57waVSUHQ=\n" +
+            "-----END CERTIFICATE-----\n";
+
+        String ca =   "-----BEGIN CERTIFICATE-----\n" +
+            "MIICDjCCAXegAwIBAgIRAOUNVxm5hFS/wtMf3iaRrkIwDQYJKoZIhvcNAQEEBQAw" +
+            "FzEVMBMGA1UEChMMSFNCQyBFVCBBc2lhMB4XDTAwMDgxODAwMDAwMFoXDTA1MDgx" +
+            "NzIzNTk1OVowFzEVMBMGA1UEChMMSFNCQyBFVCBBc2lhMIGfMA0GCSqGSIb3DQEB" +
+            "AQUAA4GNADCBiQKBgQDDfnMa+bcK0pozPqgonNhEVA33DCF+jblqU5t1NZb5AHns" +
+            "p+15UgbW/9gHg+R5SJK0VlMgBWacNAjfd+8R4+4+NBUc1kE1r57ZmV/iIJeE0AJj" +
+            "GgNvILHMX2ofJO9yhLbgN+ggEo+zTR8wAv3tygvkXlHXkq2ZcH08Xzg/VfpTwQID" +
+            "AQABo1owWDAlBgNVHREEHjAcpBowGDEWMBQGA1UEAxMNQlRQcml2YXRlMS0zNTAR" +
+            "BglghkgBhvhCAQEEBAMCAQYwDwYDVR0TBAgwBgEB/wIBADALBgNVHQ8EBAMCAQYw" +
+            "DQYJKoZIhvcNAQEEBQADgYEAfvBisAi/59PeHdpdEmNpLdvxUuASGkL7mL9JbkP5" +
+            "OrmaazPcDkDe43TXcjnzyQMeSoswoXuYG9pIALs7VBXV8fntKde98xPSW9kc+4nv" +
+            "niiCgt3WMW0EOhBAqW7G9IXFFTPKPtWvTo6m5xvpeOCjqhX1s6RbWIO56DrH3clp" +
+            "2YU=\n" +
+            "-----END CERTIFICATE-----\n";
+        try {
+            checkStatusUsingCRL(s, ca);
+        } catch (TrustVerificationException tve) {
+            assertTrue(tve.toString(), false);
+        }
+        
+     }
+
+    // tests that the CRL can be located by http cdp
+    // and that the CA can be found
+    public void checkStatusUsingCRL(String s) throws TrustVerificationException
+    {
+        X509Certificate chain[] = new X509Certificate[1];
+
+        try {
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+            X509Certificate cert = (X509Certificate)
+                cf.generateCertificate(new ByteArrayInputStream(s.getBytes()));
+
+            chain[0] = cert;
+            assertTrue(cert != null && chain.length == 1);
+
+        } catch (Exception e) {
+            System.out.println("Exception = " + e);
+            fail();
+        }
+
+        CRLTrustVerifier ctv = new CRLTrustVerifier();
+        ctv.verifyTrust(chain);
+    }
+
+    // tests that the CRL can be located by http cdp
+    // and that the CA can be found
+    public void checkStatusUsingCRL(String s, String ca) 
+        throws TrustVerificationException
+    {
+        X509Certificate chain[] = new X509Certificate[1];
+        ArrayList cas = new ArrayList();
+
+        try {
+            CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+            X509Certificate cert = (X509Certificate)
+                cf.generateCertificate(new ByteArrayInputStream(s.getBytes()));
+
+            chain[0] = cert;
+            assertTrue(cert != null && chain.length == 1);
+
+            cert = (X509Certificate)
+                cf.generateCertificate(new ByteArrayInputStream(ca.getBytes()));
+
+            cas.add(cert);
+            assertTrue(cert != null);
+
+        } catch (Exception e) {
+            System.out.println("Exception = " + e);
+            fail();
+        }
+
+        CRLTrustVerifier ctv = new CRLTrustVerifier();
+        
+        ctv.addCRLsigners(cas);
+        ctv.verifyTrust(chain);
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/crl/test/TestCrl.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/DOMCursorTest.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/DOMCursorTest.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/DOMCursorTest.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/DOMCursorTest.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,368 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.domutil.test;
+
+import org.apache.tsik.domutil.DOMCursor;
+import org.apache.tsik.domutil.DOMWriteCursor;
+import org.apache.tsik.xpath.XPath;
+import org.apache.tsik.test.BaseTestCase;
+import org.apache.tsik.util.test.UtilTestSuite;
+import junit.framework.Test;
+
+public class DOMCursorTest extends BaseTestCase
+{
+    static final XPath ROOT_XPATH = new XPath("/");
+    static final String N1_URI = "http://xxx/n1";
+    static final String N1_PREFIX = "n1";
+    static final String[] NS_ARRAY = {
+        N1_PREFIX, N1_URI,
+    };
+
+    public static void main(String[] args)
+    {
+        org.apache.tsik.test.Runner.runTextUI(suite(), args);
+    }
+
+    public static Test suite()
+    {
+        return new DOMCursorTest();
+    }
+
+    // --- end static members, begin instance members ---
+
+    public DOMCursorTest()
+    {
+        super(DOMCursorTest.class.getName(), UtilTestSuite.MODULE);
+    }
+
+    public void runTest()
+    {
+        DOMWriteCursor c = new DOMWriteCursor();
+        DOMWriteCursor c1;
+        DOMCursor c2;
+        XPath p;
+        
+        // Document: empty
+
+        checkEmptyDoc(c);
+        checkEmptyDoc(c.cloneCursor());
+
+        c1 = c.addUnder(N1_URI, N1_PREFIX, "x");
+
+        // XPath '/' is translated into '/*'
+        assertTrue(c.moveToXPath(new XPath("/")));
+        
+        // Document:
+        //  <n1:x/>   <<-- c,c1
+
+        assertTrue(c.moveToXPath(new XPath("/")));
+        assertTrue(c.moveToXPath(new XPath("/*")));
+        assertTrue(!c.moveToXPath(new XPath("/*/*[last()]")));
+        assertTrue(!c.moveToXPath(new XPath("/x")));
+        checkName(c, N1_PREFIX, N1_URI, "x");
+        checkPath(c, null, "/n1:x[1]");
+        assertTrue(!c.isDocumentEmpty());
+        assertTrue(c.getDocument() != null);
+        assertTrue(c.getElement() != null);
+        checkClone(c, c1);
+
+        c1 = c.addUnder(N1_URI, N1_PREFIX, "x");
+        
+        // Document:
+        //  <n1:x>     <<-- c
+        //    <n1:x/>  <<-- c1
+        //  </n1:x>
+
+        checkName(c1, N1_PREFIX, N1_URI, "x");
+        checkPath(c1, null, "/n1:x[1]/n1:x[1]");
+        checkPath(c1, c, "n1:x[1]");
+        checkPath(c, c1, "..");
+        assertTrue(c1.moveToXPath(new XPath("/*/*[last()]")));
+        checkPath(c1, null, "/n1:x[1]/n1:x[1]");
+
+        c1 = c.addUnder(N1_URI, N1_PREFIX, "y");
+        
+        // Document:
+        //  <n1:x>     <<-- c
+        //    <n1:x/>
+        //    <n1:y/>  <<-- c1
+        //  </n1:x>
+
+        checkName(c1, N1_PREFIX, N1_URI, "y");
+        checkPath(c1, null, "/n1:x[1]/n1:y[1]");
+        checkPath(c1, c, "n1:y[1]");
+        checkPath(c, c1, "..");
+        assertTrue(c1.moveToXPath(new XPath("/*/*[last()]")));
+        checkPath(c1, null, "/n1:x[1]/n1:y[1]");
+
+        c1 = c.addUnder(N1_URI, N1_PREFIX, "x");
+        
+        // Document:
+        //  <n1:x>     <<-- c
+        //    <n1:x/>
+        //    <n1:y/>
+        //    <n1:x/>  <<-- c1
+        //  </n1:x>
+
+        checkName(c1, N1_PREFIX, N1_URI, "x");
+        checkPath(c1, null, "/n1:x[1]/n1:x[2]");
+        checkPath(c1, c, "n1:x[2]");
+        checkPath(c, c1, "..");
+
+        c1 = c1.addBefore(N1_URI, N1_PREFIX, "z");
+        
+        // Document:
+        //  <n1:x>     <<-- c
+        //    <n1:x/>
+        //    <n1:y/>
+        //    <n1:z/>  <<-- c1
+        //    <n1:x/>
+        //  </n1:x>
+
+        checkName(c1, N1_PREFIX, N1_URI, "z");
+        checkPath(c1, null, "/n1:x[1]/n1:z[1]");
+        checkPath(c1, c, "n1:z[1]");
+        checkPath(c, c1, "..");
+
+        c.moveToChild(1);
+        c = c.addBefore(null, null, "x");
+        
+        // Document:
+        //  <n1:x>
+        //    <x/>     <<-- c
+        //    <n1:x/>
+        //    <n1:y/>
+        //    <n1:z/>  <<-- c1
+        //    <n1:x/>
+        //  </n1:x>
+
+        checkName(c, null, null, "x");
+        checkPath(c, null, "/n1:x[1]/x[1]");
+        checkPath(c, c1, "../x[1]");
+        checkPath(c1, c, "../n1:z[1]");
+
+        c.moveToSibling(2);
+        c = c.addUnder(null, null, "y");
+        
+        // Document:
+        //  <n1:x>
+        //    <x/>
+        //    <n1:x/>
+        //    <n1:y/>
+        //      <y/>    <<-- c
+        //    <n1:z/>   <<-- c1
+        //    <n1:x/>
+        //  </n1:x>
+
+        checkName(c, null, null, "y");
+        checkPath(c, null, "/n1:x[1]/n1:y[1]/y[1]");
+        checkPath(c, c1, "../n1:y[1]/y[1]");
+        checkPath(c1, c, "../../n1:z[1]");
+
+        textAndAttributeTests(c);
+        textAndAttributeTests(c1);
+
+        // moveToDescendant tests
+
+        assertTrue(!c.moveToDescendant(null, "y", false));
+        assertTrue(!c1.moveToDescendant(N1_URI, "z", false));
+        c2 = c.cloneCursor();
+        c2.moveToTop();
+        assertTrue(c2.moveToDescendant(N1_URI, "x", true));
+        c2.moveToTop();
+        assertTrue(c2.moveToDescendant(N1_URI, "x", false));
+        c2.moveToTop();
+        assertTrue(c2.moveToDescendant(null, "x", false));
+        c2.moveToTop();
+        assertTrue(c2.moveToDescendant(null, "y", false));
+        assertTrue(c2.moveToDescendant(null, "y", true));
+        assertTrue(!c2.moveToDescendant(null, "y", false));
+
+        // XPath evaluation tests
+
+        String s = c.evalToString(new XPath("//y", NS_ARRAY));
+        assertNotNull(s);
+        assertEquals(0, s.length());
+        c.setText("123");
+        s = c.evalToString(new XPath("//y", NS_ARRAY));
+        assertNotNull(s);
+        assertEquals("123", s);
+        assertEquals(123, (int) c.evalToDouble(new XPath("//y", NS_ARRAY)));
+        assertEquals(true, c.evalToBoolean(new XPath("//y", NS_ARRAY)));
+        assertEquals(false, c.evalToBoolean(new XPath("//z", NS_ARRAY)));
+        c.setText(null);
+
+        DOMCursor[] ac = c.evalToElements(new XPath("//n1:x", NS_ARRAY));
+        assertNotNull(ac);
+        assertEquals(3, ac.length);
+        checkPath(ac[0], null, "/n1:x[1]");
+        checkPath(ac[1], null, "/n1:x[1]/n1:x[1]");
+        checkPath(ac[2], null, "/n1:x[1]/n1:x[2]");
+        ac = c.evalToElements(new XPath("//z", NS_ARRAY));
+        assertNotNull(ac);
+        assertEquals(0, ac.length);
+        try {
+            c.evalToElements(new XPath("/"));
+            fail("expected exception");
+        } catch (IllegalArgumentException e) {}
+        try {
+            c.evalToElements(new XPath("boolean(//x)"));
+            fail("expected exception");
+        } catch (IllegalArgumentException e) {}
+        try {
+            c.evalToElements(new XPath("string(//x)"));
+            fail("expected exception");
+        } catch (IllegalArgumentException e) {}
+        try {
+            c.evalToElements(new XPath("number(//x)"));
+            fail("expected exception");
+        } catch (IllegalArgumentException e) {}
+    }
+
+    private void textAndAttributeTests(DOMWriteCursor c1)
+    {
+        // Text tests
+        //
+        c1.setText("123");
+        assertTrue("123".equals(c1.getText()));
+        c1.addUnder(N1_URI, N1_PREFIX, "z");
+        c1.setText("456");
+        assertTrue("456".equals(c1.getText()));
+        assertTrue(c1.moveToChild(1) == false);
+        c1.setText("");
+        assertTrue("".equals(c1.getText()));
+
+        // Attributes w/ namespaces tests
+        //
+        c1.setAttribute(N1_URI, N1_PREFIX, "a", "123");
+        assertTrue("123".equals(c1.getAttribute(N1_URI, "a")));
+        c1.setAttribute(N1_URI, N1_PREFIX, "a", null);
+        assertTrue(null == c1.getAttribute(N1_URI, "a"));
+        c1.setAttribute(N1_URI, N1_PREFIX, "a", "");
+        assertTrue("".equals(c1.getAttribute(N1_URI, "a")));
+        c1.setAttribute(N1_URI, N1_PREFIX, "a", null);
+        assertTrue(null == c1.getAttribute(N1_URI, "a"));
+
+        // Attributes w/o namespaces
+        //
+        c1.setAttribute("a", "123");
+        assertTrue("123".equals(c1.getAttribute(null, "a")));
+        assertTrue("123".equals(c1.getAttribute("a")));
+        c1.setAttribute("a", "");
+        assertTrue("".equals(c1.getAttribute(null, "a")));
+        assertTrue("".equals(c1.getAttribute("a")));
+        c1.setAttribute("a", null);
+        assertTrue(null == c1.getAttribute(null, "a"));
+        assertTrue(null == c1.getAttribute("a"));
+
+        // Attributes w/o namespaces, set with null namespace
+        //
+        c1.setAttribute(null, null, "a", "123");
+        assertTrue("123".equals(c1.getAttribute(null, "a")));
+        assertTrue("123".equals(c1.getAttribute("a")));
+        c1.setAttribute(null, null, "a", null);
+        assertTrue(null == c1.getAttribute(null, "a"));
+        assertTrue(null == c1.getAttribute("a"));
+        c1.setAttribute(null, null, "a", "");
+        assertTrue("".equals(c1.getAttribute(null, "a")));
+        assertTrue("".equals(c1.getAttribute("a")));
+        c1.setAttribute(null, null, "a", null);
+        assertTrue(null == c1.getAttribute(null, "a"));
+        assertTrue(null == c1.getAttribute("a"));
+    }
+
+    private void checkPath(DOMCursor to, DOMCursor from, String path)
+    {
+        XPath p = (from != null) ? to.createXPath(from) : to.createXPath();
+        assertTrue(p != null);
+        assertTrue("Expected path:" + path + " but got:" + p.getXPath(),
+                    path.equals(p.getXPath()));
+        
+        DOMCursor c = (from != null) ? from.cloneCursor() : to.cloneCursor();
+        assertTrue(c.moveToXPath(p));
+        assertTrue(c.equals(to));
+    }
+
+    private void checkName(DOMCursor c, String prefix, String uri, String name)
+    {
+        assertTrue(c.atElement(uri, name));
+        assertTrue(c.matchName(uri, name));
+
+        if (uri != null) {
+            XPath p = c.createXPath();
+            assertTrue(p != null);
+            assertTrue(uri.equals(p.getNamespaceMap().get(prefix)));
+        }
+    }
+
+    private void checkClone(DOMCursor c, DOMCursor c1)
+    {
+        assertTrue(c.equals(c1));
+        assertTrue(c.isDocumentEmpty() == c1.isDocumentEmpty());
+        assertTrue(c.getDocument() == c1.getDocument());
+        assertTrue(c.getElement() == c1.getElement());
+    }
+
+    private void checkEmptyDoc(DOMCursor c)
+    {
+        assertTrue(c.isDocumentEmpty());
+        assertTrue(c.getDocument() != null);
+        assertTrue(c.getElement() == null);
+        assertTrue(c.atElement(null, "x") == false);
+        assertTrue(c.matchName(null, "x") == false);
+        assertTrue(c.atElement(N1_URI, "x") == false);
+        assertTrue(c.matchName(N1_URI, "x") == false);
+        assertTrue(c.moveToChild(0) == false);
+        assertTrue(c.moveToChild(1) == false);
+        assertTrue(c.moveToChild(-1) == false);
+        assertTrue(c.moveToChild(null, "x") == false);
+        assertTrue(c.moveToSibling(0) == false);
+        assertTrue(c.moveToSibling(1) == false);
+        assertTrue(c.moveToSibling(-1) == false);
+        assertTrue(c.moveToSibling(null, "x") == false);
+        assertTrue(c.moveToParent() == false);
+        assertTrue(c.moveToTop() == false);
+        assertTrue(c.moveToXPath(ROOT_XPATH) == false);
+
+        boolean done = false;
+        for (int i = 0; !done; i += 1) {
+            boolean gotException = false;
+            try {
+                switch (i) {
+                case 0: c.createXPath(); break;
+                case 1: c.createXPath(c.cloneCursor()); break;
+                case 2: c.getAttribute("x"); break;
+                case 3: c.getAttribute(null, "x"); break;
+                case 4: c.getLocalName(); break;
+                case 5: c.getNamespaceURI(); break;
+                case 6: c.getText(); break;
+                case 7: c.getXPathAttribute("x"); break;
+                case 8: c.getXPathAttribute(null, "x"); break;
+                case 9: c.getXPathText(); break;
+                default: done = true;
+                }
+            } catch (IllegalStateException e) {
+                gotException = true;
+            }
+            assertTrue(
+                 "IllegalStateException expected with empty document, i=" + i,
+                 done || gotException);
+        }
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/DOMCursorTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/package.html
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/package.html?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/package.html (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/package.html Mon Aug  8 12:58:58 2005
@@ -0,0 +1,8 @@
+<html>
+<!-- $Id: package.html,v 1.1 2002/08/30 14:53:24 mark Exp $ -->
+<body>
+
+(TESTS) Tests the org.apache.tsik.domutil package.
+
+</body>
+</html>

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/domutil/test/package.html
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/HttpHeaderTest.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/HttpHeaderTest.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/HttpHeaderTest.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/HttpHeaderTest.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,141 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.domutil.DOMCursor;
+import org.apache.tsik.domutil.DOMWriteCursor;
+import org.apache.tsik.messaging.SimpleRequest;
+import org.apache.tsik.messaging.AbstractTransport;
+import org.apache.tsik.messaging.XmlResponse;
+import org.apache.tsik.test.BaseTestCase;
+import org.apache.tsik.test.BaseTestSuite;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import junit.framework.Test;
+import org.w3c.dom.Document;
+
+public class HttpHeaderTest extends BaseTestCase
+{
+    public static void main(String[] args)
+        throws Exception
+    {
+        org.apache.tsik.test.Runner.runTextUI(suite(), args);
+    }
+
+    public static Test suite()
+        throws Exception
+    {
+        BaseTestSuite suite = new BaseTestSuite(XmlMsgTestSuite.MODULE);
+        suite.addTest(new HttpHeaderTest());
+        return suite;
+    }
+
+    // Just need any reliable URL here that returns an XML document
+    //
+    private static final String WEB_SERVICE_URL =
+        "http://pilot-xkms.verisign.com/xkms/Acceptor.nano";
+
+    private static final String[] REQUEST_HEADERS = {
+        "one", "one value",
+        "two", "two value",
+    };
+
+    // --- end static members, begin instance members ---
+
+    private URL url;
+    private TestTransport transport;
+    private SimpleRequest request;
+
+    private HttpHeaderTest()
+    {
+        super(HttpHeaderTest.class.getName(), XmlMsgTestSuite.MODULE);
+    }
+
+    public void setUp()
+        throws Exception
+    {
+        url = new URL(WEB_SERVICE_URL);
+        transport = new TestTransport(url);
+
+        DOMWriteCursor c = new DOMWriteCursor();
+        c.addUnder(null, null, "Request");
+        request = new SimpleRequest(c.getDocument());
+    }
+
+    public void runTest()
+        throws Exception
+    {
+        // Set request headers; these are checked by TestTransport
+        //
+        for (int i = 0; i < REQUEST_HEADERS.length; i += 2) {
+            String key = REQUEST_HEADERS[i];
+            String val = REQUEST_HEADERS[i + 1];
+            transport.setHTTPRequestHeader(key, val);
+        }
+
+        // Send the request, ignore the response
+        //
+        XmlResponse response = transport.sendRequest(request);
+
+        // Check the response headers for something recognizable
+        //
+        String contentType = null;
+        String[] headers = transport.getHTTPResponseHeaders();
+        for (int i = 0; i < headers.length; i += 2) {
+            String key = headers[i];
+            String val = headers[i + 1];
+            //System.out.println(key + ':' + val);
+            String val2 = transport.getHTTPResponseHeader(key);
+            assertEquals(val, val2);
+            if (key.equalsIgnoreCase("CONTENT-TYPE")) {
+                contentType = val;
+            }
+        }
+        String val = transport.getHTTPResponseHeader("CONTENT-TYPE");
+        assertTrue("No CONTENT-TYPE", val != null && val.length() > 0);
+        assertEquals(val, contentType);
+
+        //(new DOMCursor(response.getXML())).publish(System.out, false);
+    }
+
+    private class TestTransport extends AbstractTransport
+    {
+        private TestTransport(URL url)
+        {
+            super(url);
+        }
+
+        protected void beforeConnect(URLConnection connection)
+            throws IOException
+        {
+            for (int i = 0; i < REQUEST_HEADERS.length; i += 2) {
+                String key = REQUEST_HEADERS[i];
+                String val = REQUEST_HEADERS[i + 1];
+                String val2 = connection.getRequestProperty(key);
+                assertEquals(val, val2);
+            }
+        }
+
+        protected void afterConnect(URLConnection connection)
+            throws IOException
+        {
+        }
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/HttpHeaderTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestCase.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestCase.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestCase.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,71 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.messaging.AbstractTransport;
+import org.apache.tsik.test.DataDrivenTestCase;
+
+/**
+ * A base class for web service tests, which are data-driven tests with a
+ * transport.  The transport is set externally, usually by {@link
+ * MessageTestSuite}.
+ *
+ * <p> <em>NOTE:</em> messaging tests may not use reflection to define the
+ * test methods, i.e., they must use only a runTest() method. </p>
+ */
+public abstract class MessageTestCase extends DataDrivenTestCase
+{
+    /**
+     * The transport should be used by subclasses for sending test messages.
+     * It will always be set before the setUp() or running of the test.
+     */
+    protected AbstractTransport transport;
+
+    /**
+     * Create a test case.  Note that the transport will not be set yet.
+     *
+     * @param name is the test case name, which may be modified when this test
+     * is cloned.
+     *
+     * @param moduleName is the module directory name, relative to $TSIK_HOME.
+     */
+    public MessageTestCase(String name, String moduleName)
+    {
+        super(name, moduleName);
+    }
+
+    /**
+     * Set the transport.  This is usually called by {@link MessageTestSuite}.
+     */
+    public void setTransport(AbstractTransport transport)
+    {
+        this.transport = transport;
+    }
+
+    /**
+     * Returns whether the test live transports.  If false, the test will only
+     * be used with the simulator transport.  This method returns true
+     * by default and should be overridden in subclasses if live transports
+     * are not supported.
+     */
+    public boolean supportsLiveTransports()
+    {
+        return true;
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestCase.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestSuite.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestSuite.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestSuite.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestSuite.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,211 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.domutil.DOMCursor;
+import org.apache.tsik.messaging.AbstractTransport;
+import org.apache.tsik.messaging.XmlTransport;
+import org.apache.tsik.test.BaseTestCase;
+import org.apache.tsik.test.BaseTestSuite;
+import org.apache.tsik.test.DocumentMatcher;
+import org.apache.tsik.test.TestData;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * A suite that expands one or more {@link MessageTestCase}s into multiple
+ * tests, one for each supported transport.
+ *
+ * <p> <em>NOTE:</em> messaging tests may not use reflection to define the
+ * test methods, i.e., they must use only a runTest() method. </p>
+ */
+public class MessageTestSuite extends BaseTestSuite
+{
+    private static final String SIM_NAME = "SimulatorTransport";
+
+    private Map transports;
+    private DocumentMatcher requestMatcher;
+    private SimulatorFilter simFilter;
+    private URL serviceURL;
+
+    /**
+     * Creates an empty test suite.  The live transports added with
+     * addTransport() will be used for each test that supports live transports.
+     * A simulator transport will also be used for each test with a non-empty
+     * simulate/response element.
+     *
+     * @param moduleName is the module directory name, relative to $TSIK_HOME.
+     */
+    public MessageTestSuite(String moduleName)
+        throws MalformedURLException, IOException
+    {
+        super(moduleName);
+
+        this.serviceURL = TestData.getServiceURL(moduleName);
+        this.requestMatcher = new DocumentMatcher();
+        this.simFilter = new SimulatorFilter();
+        this.transports = new HashMap();
+    }
+
+    /**
+     * Add a live transport to be used for testing.  This will be used for all
+     * test cases that support live transports.  Note that the simulator
+     * transport is used implicitly, and should not be added with this method.
+     * The live transports will not be used if the TEST_ENV system property is
+     * not set or if the testEnvironment/URL is missing or empty.
+     *
+     * @param transport is the live transport to use.  The url of
+     * the transport will be changed by the test suite to the
+     * testEnvironment/URL, so it may be null in the transport given.
+     *
+     * @param name is the name to be appended to the test case name to identify
+     * this transport, or null to use the transport's class name.
+     */
+    public void addTransport(AbstractTransport transport, String name)
+    {
+        if (serviceURL != null) {
+            transport.setUrl(serviceURL);
+            if (name == null) {
+                name = transport.getClass().getName();
+                name = name.substring(name.lastIndexOf('.') + 1);
+            }
+            if (transports.containsKey(name) || name.equals(SIM_NAME)) {
+                throw new IllegalArgumentException("transport name [" +
+                    name + "] already in use");
+            }
+            transports.put(name, transport);
+        }
+    }
+
+    /**
+     * Sets the request message matcher.  This should be called before calling
+     * addTest().  The default request message matcher matches exactly, i.e.,
+     * no data items are considered irrelevant.
+     *
+     * @param requestMatcher matches the testData/expect/request message, if
+     * any, with the request generated.
+     */
+    public void setRequestMatcher(DocumentMatcher requestMatcher)
+    {
+        this.requestMatcher = requestMatcher;
+    }
+
+    /**
+     * Sets the simulator filter.  This should be called before calling
+     * addTest().  The default simulator filter does nothing.
+     *
+     * @param simFilter filters the testData/simulate/response message, if
+     * any, using information in the request message.
+     */
+    public void setSimulatorFilter(SimulatorFilter simFilter)
+    {
+        this.simFilter = simFilter;
+    }
+
+    /**
+     * Adds one or more tests and sets their transport.  The MessageTestCase(s)
+     * given are cloned, their setTransport() method is called, and their name
+     * is changed, appending ".xxx" where xxx is the transport class name.
+     *
+     * @param test is a single Test object, or a TestSuite containing any
+     * combination of MessageTestCase objects or TestSuite objects.  If a
+     * Test other than a MessageTestCase is given, it is added to the suite
+     * without modification.  All MessageTestCase objects must support the
+     * clone() method since they will be cloned once for each transport.
+     */
+    public void addTest(Test test)
+    {
+        if (test instanceof TestSuite) {
+            //
+            // Recursively add tests from sute.
+            //
+            Enumeration tests = ((TestSuite) test).tests();
+            while (tests.hasMoreElements()) {
+                addTest((Test) tests.nextElement());
+            }
+        } else if (test instanceof MessageTestCase) {
+            MessageTestCase msgTest = (MessageTestCase) test;
+            //
+            // Find expected request.
+            //
+            DOMCursor expectRequest = msgTest.getExpectData();
+            if (expectRequest != null) {
+                if (!expectRequest.moveToChild(TestData.NAMESPACE,
+                                                "request")) {
+                    expectRequest = null;
+                } else if (!expectRequest.moveToChild(1)) {
+                    expectRequest = null;
+                }
+            }
+            //
+            // Add simulated transport test.
+            //
+            DOMCursor simResponse = msgTest.getSimulateData();
+            if (simResponse != null) {
+                if (!simResponse.moveToChild(TestData.NAMESPACE,
+                                             "response")) {
+                    simResponse = null;
+                } else if (!simResponse.moveToChild(1)) {
+                    simResponse = null;
+                }
+            }
+            if (simResponse != null) {
+                MessageTestCase newTest = (MessageTestCase)
+                                    ((MessageTestCase) test).clone();
+                AbstractTransport simTransport = 
+                    new SimulatorTransport(simResponse, simFilter);
+                AbstractTransport wrapTransport =
+                    new WrapperTransport(simTransport, expectRequest,
+                                         requestMatcher);
+                newTest.setTransport(wrapTransport);
+                newTest.setName(newTest.getName() + '.' + SIM_NAME);
+                super.addTest(newTest);
+            }
+            //
+            // Add live transport tests.
+            //
+            if (msgTest.supportsLiveTransports()) {
+                Iterator i = transports.entrySet().iterator();
+                while (i.hasNext()) {
+                    Map.Entry entry = (Map.Entry) i.next();
+                    AbstractTransport transport =
+                        (AbstractTransport) entry.getValue();
+                    String transportName = (String) entry.getKey();
+                    MessageTestCase newTest = (MessageTestCase)
+                                            ((MessageTestCase) test).clone();
+                    AbstractTransport wrapTransport =
+                        new WrapperTransport(transport, expectRequest,
+                                             requestMatcher);
+                    newTest.setTransport(wrapTransport);
+                    newTest.setName(newTest.getName() + '.' + transportName);
+                    super.addTest(newTest);
+                }
+            }
+        } else {
+            super.addTest(test);
+        }
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/MessageTestSuite.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorFilter.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorFilter.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorFilter.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorFilter.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,45 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.domutil.DOMCursor;
+import org.apache.tsik.domutil.DOMWriteCursor;
+
+/**
+ * Filters the response document returned by the simulator transport.
+ * For example, the transaction ID in the response could be changed to match
+ * the transaction ID in the request.
+ */
+public class SimulatorFilter
+{
+    /**
+     * Create a filter which does nothing.
+     */
+    public SimulatorFilter()
+    {
+    }
+
+    /**
+     * Modifies the simulated response document, based on the contents of the
+     * request document.  The default implementation does nothing.
+     */
+    public void filterResponse(DOMCursor request, DOMWriteCursor response)
+    {
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorFilter.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorTransport.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorTransport.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorTransport.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorTransport.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,90 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.domutil.DOMCursor;
+import org.apache.tsik.domutil.DOMWriteCursor;
+import org.apache.tsik.messaging.AbstractTransport;
+import org.apache.tsik.messaging.XmlMessageException;
+import org.apache.tsik.xpath.XPath;
+import java.io.IOException;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import org.w3c.dom.Document;
+import org.apache.tsik.verifier.TrustVerifier;
+
+/**
+ * Simulates a web service by returning a predetermined response document.
+ * TODO: support the features of AbstractTransport, e.g., logging, etc.
+ */
+class SimulatorTransport extends AbstractTransport
+{
+    private DOMCursor simResponse;
+    private SimulatorFilter simFilter;
+
+    /**
+     * Creates a simulated tranport.
+     *
+     * @param simResponse is the XML element to return as the unsigned,
+     * unenveloped response.
+     *
+     * @param simFilter is the filter to be used to modify the simulated
+     * response before returned it, or null if no filter should be used.
+     */
+    public SimulatorTransport(DOMCursor simResponse,
+                              SimulatorFilter simFilter)
+    {
+        super(null);
+        this.simResponse = simResponse;
+        this.simFilter = simFilter;
+    }
+
+    /**
+     * Simply returns the canned simResponse.
+     */
+    public Document call(Document inputDoc) 
+        throws IOException
+    {
+        DOMWriteCursor response = new DOMWriteCursor();
+        response.copyUnder(simResponse);
+        if (simFilter != null) {
+            simFilter.filterResponse(new DOMCursor(inputDoc), response);
+        }
+        return response.getDocument();
+    }
+
+    protected Document signRequestBody(Document request,
+                                       PrivateKey signingPrivateKey,
+                                       PublicKey signingPublicKey,
+                                       X509Certificate signingCert,
+                                       XPath signatureLocation,
+                                       boolean insertBefore)
+        throws XmlMessageException
+    {
+        return request;
+    }
+
+    protected void verifyResponseBody(Document response,
+                                      TrustVerifier trustVerifier,
+                                      XPath signatureLocation)
+        throws XmlMessageException
+    {
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SimulatorTransport.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SoapProcessingTest.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SoapProcessingTest.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SoapProcessingTest.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SoapProcessingTest.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,150 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.domutil.DOMWriteCursor;
+import org.apache.tsik.messaging.SoapFault;
+import org.apache.tsik.messaging.SoapMessage;
+import org.apache.tsik.resource.ResourceFactory;
+import org.apache.tsik.resource.XMLResource;
+
+import java.io.File;
+import java.io.FileInputStream;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.w3c.dom.Document;
+
+
+public class SoapProcessingTest extends TestCase
+{
+    public static void main(String[] args) throws Exception
+    {
+        org.apache.tsik.test.Runner.runTextUI(suite(), args);
+    }
+
+    public static Test suite() throws Exception
+    {
+        return new TestSuite(SoapProcessingTest.class);
+    }
+
+    public SoapProcessingTest(String name) {
+        super(name);
+    }
+
+    // test reading a soap message with a soap fault
+
+    public void testReadBadSoapFault1_1() throws Exception
+    {
+        XMLResource xmlres = ResourceFactory.getXMLResource();
+        File f = new File("messaging", "bad_soap_1_1_fault.xml");
+
+        FileInputStream in = new FileInputStream(f);
+        SoapMessage msg = new SoapMessage(xmlres.parseXML(in, false));
+        SoapFault soapFault = msg.getFault();
+    }
+
+    public void testReadSoapFault1_1() throws Exception
+    {
+        XMLResource xmlres = ResourceFactory.getXMLResource();
+        File f = new File("messaging", "soap_1_1_fault.xml");
+
+        FileInputStream in = new FileInputStream(f);
+        SoapMessage msg = new SoapMessage(xmlres.parseXML(in, false));
+        SoapFault soapFault = msg.getFault();
+    }
+
+    public void testReadSoapFault1_2_2002_12() throws Exception
+    {
+        XMLResource xmlres = ResourceFactory.getXMLResource();
+        File f = new File("messaging", "soap_1_2_2002_12_fault.xml");
+
+        FileInputStream in = new FileInputStream(f);
+        SoapMessage msg = new SoapMessage(xmlres.parseXML(in, false));
+        SoapFault soapFault = msg.getFault();
+    }
+
+    public void testReadSoapFault1_2_200305() throws Exception
+    {
+        XMLResource xmlres = ResourceFactory.getXMLResource();
+        File f = new File("messaging", "soap_1_2_fault.xml");
+
+        FileInputStream in = new FileInputStream(f);
+        SoapMessage msg = new SoapMessage(xmlres.parseXML(in, false));
+        SoapFault soapFault = msg.getFault();
+    }
+
+    // test create the fault, then read it
+
+    public void testCreateSoapFault1_1() throws Exception
+    {
+        SoapFault fault 
+            = new SoapFault(SoapFault.RECEIVER, "string", "actor", null);
+
+        DOMWriteCursor wc = new DOMWriteCursor();
+        wc.addUnder(null, null, "Root");
+        fault.toXML(wc);
+
+        DOMWriteCursor msgWc = new DOMWriteCursor();
+        SoapMessage msg = new SoapMessage(msgWc.getDocument());
+        msg.setFault(fault);
+        fault = msg.getFault();
+    }
+
+    public void testCreateSoapFault1_2_2002_12() throws Exception
+    {
+        SoapFault fault 
+            = new SoapFault(SoapFault.RECEIVER, "string", "actor", null);
+
+        DOMWriteCursor wc = new DOMWriteCursor();
+        wc.addUnder(null, null, "Root");
+        try {
+            fault.toXML(wc, SoapMessage.VERSION_1_2_2002_12);
+        } catch (IllegalArgumentException e){
+            // expected
+        }
+
+        DOMWriteCursor msgWc = new DOMWriteCursor();
+        try {
+            SoapMessage msg = new SoapMessage(msgWc.getDocument(), 
+                                              SoapMessage.VERSION_1_2_2002_12);
+        } catch (IllegalArgumentException e){
+            // expected
+            return;
+        }
+        assertTrue(false);
+    }
+
+    public void testCreateSoapFault1_2() throws Exception
+    {
+        SoapFault fault 
+            = new SoapFault(SoapFault.RECEIVER, "string", "actor", null);
+
+        DOMWriteCursor wc = new DOMWriteCursor();
+        wc.addUnder(null, null, "Root");
+        fault.toXML(wc, SoapMessage.VERSION_1_2);
+
+        DOMWriteCursor msgWc = new DOMWriteCursor();
+        SoapMessage msg = new SoapMessage(msgWc.getDocument(), 
+                                          SoapMessage.VERSION_1_2);
+        msg.setFault(fault);
+        fault = msg.getFault();
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/SoapProcessingTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/WrapperTransport.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/WrapperTransport.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/WrapperTransport.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/WrapperTransport.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,204 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.domutil.DOMCursor;
+import org.apache.tsik.domutil.DOMWriteCursor;
+import org.apache.tsik.messaging.AbstractTransport;
+import org.apache.tsik.messaging.InsecureTransportException;
+import org.apache.tsik.messaging.XmlMessageException;
+import org.apache.tsik.messaging.XmlRequest;
+import org.apache.tsik.messaging.XmlResponse;
+import org.apache.tsik.test.DocumentMatcher;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.URL;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import java.util.Iterator;
+import org.w3c.dom.Document;
+import org.apache.tsik.verifier.TrustVerifier;
+
+/**
+ * Wraps a transport to implement checking of an expected request message.
+ */
+class WrapperTransport extends AbstractTransport
+{
+    private AbstractTransport transport;
+    private DOMWriteCursor expectRequest;
+    private DocumentMatcher requestMatcher;
+
+    public WrapperTransport(AbstractTransport transport,
+                              DOMCursor expectRequest,
+                              DocumentMatcher requestMatcher)
+    {
+        super(null);
+        this.transport = transport;
+        if (expectRequest != null) {
+            this.expectRequest = new DOMWriteCursor();
+            this.expectRequest.copyUnder(expectRequest);
+        }
+        this.requestMatcher = requestMatcher;
+    }
+
+    public XmlResponse sendRequest(XmlRequest req)
+        throws InsecureTransportException, IOException, XmlMessageException
+    {
+        if (expectRequest != null && requestMatcher != null) {
+            String err = requestMatcher.match(expectRequest.cloneCursor(),
+                                              new DOMCursor(req.getXML()));
+            if (err != null) {
+                throw new XmlMessageException(
+                    "testData/expect/request differs " + err);
+            }
+        }
+        return transport.sendRequest(req);
+    }
+
+    public URL getUrl()
+    {
+        return transport.getUrl();
+    }
+
+    public void setUrl(URL url)
+    {
+        transport.setUrl(url);
+    }
+
+    public PrintStream getLogOutput()
+    {
+        return transport.getLogOutput();
+    }
+
+    public void setLogOutput(PrintStream logOutput)
+    {
+        transport.setLogOutput(logOutput);
+    }
+
+    public TrustVerifier getTrustVerifier()
+    {
+        return transport.getTrustVerifier();
+    }
+
+    public void setTrustVerifier(TrustVerifier verifier)
+    {
+        transport.setTrustVerifier(verifier);
+    }
+
+    public PrivateKey getSigningPrivateKey()
+    {
+        return transport.getSigningPrivateKey();
+    }
+
+    public PublicKey getSigningPublicKey()
+    {
+        return transport.getSigningPublicKey();
+    }
+
+    public X509Certificate getSigningCertificate()
+    {
+        return transport.getSigningCertificate();
+    }
+
+    public void setSigningPrivateKey(PrivateKey signingPrivateKey)
+    {
+        transport.setSigningPrivateKey(signingPrivateKey);
+    }
+
+    public void setSigningPublicKey(PublicKey signingPublicKey)
+    {
+        transport.setSigningPublicKey(signingPublicKey);
+    }
+
+    public void setSigningCertificate(X509Certificate signingCert)
+    {
+        transport.setSigningCertificate(signingCert);
+    }
+
+    public boolean getSSLTrustVerification()
+    {
+        return transport.getSSLTrustVerification();
+    }
+
+    public void setSSLTrustVerification(boolean enabled)
+    {
+        transport.setSSLTrustVerification(enabled);
+    }
+
+    public boolean getSSLClientAuthentication()
+    {
+        return transport.getSSLClientAuthentication();
+    }
+
+    public void setSSLClientAuthentication(boolean enabled)
+    {
+        transport.setSSLClientAuthentication(enabled);
+    }
+
+    public boolean getRequestSchemaValidation()
+    {
+        return transport.getRequestSchemaValidation();
+    }
+
+    public void setRequestSchemaValidation(boolean enabled)
+    {
+        transport.setRequestSchemaValidation(enabled);
+    }
+
+    public boolean getResponseSchemaValidation()
+    {
+        return transport.getResponseSchemaValidation();
+    }
+
+    public void setResponseSchemaValidation(boolean enabled)
+    {
+        transport.setResponseSchemaValidation(enabled);
+    }
+    
+    public void clearHTTPRequestHeaders()
+    {
+        transport.clearHTTPRequestHeaders();
+    }
+    
+    public void setHTTPRequestHeader(String name, String value)
+    {
+        transport.setHTTPRequestHeader(name, value);
+    }
+
+    public Iterator getHTTPRequestHeaders()
+    {
+        return transport.getHTTPRequestHeaders();
+    }
+
+    public String getHTTPResponseHeader(String name)
+    {
+        return transport.getHTTPResponseHeader(name);
+    }
+
+    public String[] getHTTPResponseHeaders()
+    {
+        return transport.getHTTPResponseHeaders();
+    }
+
+    public boolean isTransportPrivate()
+    {
+        return transport.isTransportPrivate();
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/WrapperTransport.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/XmlMsgTestSuite.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/XmlMsgTestSuite.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/XmlMsgTestSuite.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/XmlMsgTestSuite.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,42 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.messaging.test;
+
+import org.apache.tsik.test.BaseTestSuite;
+import junit.framework.Test;
+
+public class XmlMsgTestSuite
+{
+    public static final String MODULE = "xmlmsg";
+
+    public static void main(String[] args)
+        throws Exception
+    {
+        org.apache.tsik.test.Runner.runTextUI(suite(), args);
+    }
+
+    public static Test suite()
+        throws Exception
+    {
+        BaseTestSuite suite = new BaseTestSuite(MODULE);
+        suite.addTest(HttpHeaderTest.suite());
+        suite.addTest(SoapProcessingTest.suite());
+        return suite;
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/XmlMsgTestSuite.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/package.html
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/package.html?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/package.html (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/package.html Mon Aug  8 12:58:58 2005
@@ -0,0 +1,58 @@
+<html>
+<body>
+Messaging.
+
+<p> Extends the data-driven testing framework to support web service testing.
+This documentation assumes you are familiar with the testing framework defined
+in the {@link org.apache.tsik.test} package. If not, please review that framework now. </p>
+
+<p> Messaging test cases extend the 
+{@link org.apache.tsik.messaging.test.MessageTestCase} class and use the protected
+transport member to perform their test. Of course, they may get input data and
+expected result data using the methods of the base class 
+{@link org.apache.tsik.test.DataDrivenTestCase}. </p>
+
+<p> To create a test suite, first create your {@link org.apache.tsik.messaging.test.MessageTestCase} objects and then add them to a
+{@link org.apache.tsik.test.DataDrivenTestSuite}.  Set this suite aside while you setup your message test suite.</p>
+
+<p> Create a {@link org.apache.tsik.messaging.test.MessageTestSuite}.
+Use the {@link org.apache.tsik.messaging.test.MessageTestSuite#addTransport} method
+to add whatever transports are supported by the service. The URL of the transport will be set automatically by the test suite based on the
+<i>env/serviceURL</i> in the <code>testenv.xml</code> file. </p>
+<ul><b>Note:</b> If no service URL is defined in the environment or the environment is null, no live
+service tests will be performed. </ul>
+
+<p> A simulator transport is not added explicitly -- it will be used
+automatically whenever a test case has a <code>case/simulate/response</code>
+element.  Simulator tests are performed regardless of the environment.  If
+desired, you can write a simulator filter to modify the response before it is
+returned by the simulator transport.  See {@link
+org.apache.tsik.messaging.test.MessageTestSuite#setSimulatorFilter}.  For example,
+if the request and response have matching transaction IDs you will need to
+change the ID in the response to match the ID in the request. </p>
+
+<p> When a <code>case/expect/request</code> element is present, the message
+test suite will automatically match this value with the request message created
+by the test.  If it doesn't match the test will fail.  By default an exact
+match is performed by the {@link org.apache.tsik.test.DocumentMatcher}
+class, ignoring whitespace between elements and namespace prefixes.  You can
+exclude elements from the matching process by supplying a matcher for
+which you pass a list of XPaths to the constructor.  You could also override
+the matcher to provide a custom matching algorithm, but this should not
+normally be needed.  Note that request matching occurs for all transports, live
+and simulated. </p>
+
+<p> After all modifications to the message suite have been
+made, then add your data-driven test suite(s) to the message suite.  Just like
+the data-driven suite clones tests and appends the <code>case/@name</code> to
+the test name, the message suite clones tests for each transport and appends
+the transport name to the test name.  Test names will then be in three parts:
+<pre> <li>{originalName}</li><li>{dataName}</li><li>{transportName} </li></pre>
+where {transportName} is the name passed to {@link
+org.apache.tsik.messaging.test.MessageTestSuite#addTransport}. </p>
+
+<ol><b>Note:</b> It is important that this step is done only after all the modifications have been made.</ol>
+
+
+</body>
+</html>

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/messaging/test/package.html
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/resource/test/XMLResourceTest.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/resource/test/XMLResourceTest.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/resource/test/XMLResourceTest.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/resource/test/XMLResourceTest.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,123 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.resource.test;
+
+import org.apache.tsik.test.BaseTestCase;
+import org.apache.tsik.resource.XMLResource;
+import org.apache.tsik.resource.ResourceFactory;
+import org.apache.tsik.util.test.UtilTestSuite;
+import java.io.StringReader;
+import java.io.StringWriter;
+import javax.xml.parsers.DocumentBuilderFactory;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class XMLResourceTest extends BaseTestCase
+{
+    public static void main(String[] args)
+    {
+        org.apache.tsik.test.Runner.runTextUI(suite(), args);
+    }
+
+    public static Test suite()
+    {
+        return new TestSuite(XMLResourceTest.class);
+    }
+
+    // --- end static members, begin instance members ---
+
+    private XMLResource xml;
+
+    public XMLResourceTest(String name)
+    {
+        super(name, UtilTestSuite.MODULE);
+        //setName(XMLResourceTest.class.getName() + '-' + name);
+    }
+
+    public void setUp()
+    {
+        xml = ResourceFactory.getXMLResource();
+    }
+
+    public void testReportVersions()
+    {
+        System.out.println("Java version: " +
+                            System.getProperty("java.vm.version"));
+        System.out.println("DOM factory: " +
+                    DocumentBuilderFactory.newInstance().getClass().getName());
+        System.out.println("DOM class: " +
+                    xml.createDocument().getClass().getName());
+    }
+
+    static String docType = "<!DOCTYPE records SYSTEM \"missing.dtd\">";
+    static String docData = "<test>X&amp;Y&lt;Z</test>";
+
+    public void testEntities() throws Exception
+    {
+        Document doc = parse(docData);
+        //print(doc);
+        String txt = publish(doc);
+        int i;
+        i = txt.indexOf(docData);
+        if (i < 0) fail("Expected " + docData + " in: " + txt);
+    }
+
+    /**
+     * This test fails with Crimson, but is correct with Xerces
+     */
+    public void testDocType() throws Exception
+    {
+        Document doc = parse(docType + docData);
+        String txt = publish(doc);
+        int i;
+        i = txt.indexOf(docType);
+        if (i < 0) fail("Expected " + docType + " in: " + txt);
+        i = txt.indexOf(docData);
+        if (i < 0) fail("Expected " + docData + " in: " + txt);
+    }
+
+    private Document parse(String txt) throws Exception
+    {
+        return xml.parseXML(new StringReader(txt));
+    }
+
+    private String publish(Document doc) throws Exception
+    {
+        StringWriter writer = new StringWriter();
+        xml.publish(doc, writer);
+        return writer.toString();
+    }
+
+    private void print(Node n)
+    {
+        n = n.getFirstChild();
+        if (n == null) return;
+        System.out.println("--begin nodes--");
+        for (; n != null; n = n.getNextSibling())
+        {
+            System.out.println("node: " + n.getClass().getName());
+            System.out.println("value: " + n.getNodeValue());
+            print(n);
+        }
+        System.out.println("--end nodes--");
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/resource/test/XMLResourceTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTest.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTest.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTest.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTest.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,93 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.schema.test;
+
+import org.apache.tsik.schema.SchemaValidator;
+import org.apache.tsik.domutil.DOMCursor;
+import org.apache.tsik.test.DataDrivenTestCase;
+import org.apache.tsik.test.DataDrivenTestSuite;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.Test;
+
+public class SchemaTest extends DataDrivenTestCase
+{
+    public static void main(String[] args)
+        throws Exception
+    {
+        org.apache.tsik.test.Runner.runTextUI(suite(), args);
+    }
+
+    public static Test suite()
+        throws Exception
+    {
+        DataDrivenTestSuite ddSuite =
+            new DataDrivenTestSuite(SchemaTestSuite.MODULE);
+        ddSuite.addTest(new SchemaTest(), "schema_test.xml");
+        return ddSuite;
+    }
+
+    // --- end static members, begin instance members ---
+
+    private File instance;
+    private File[] schemata;
+
+    public SchemaTest()
+    {
+        super(SchemaTest.class.getName(), SchemaTestSuite.MODULE);
+    }
+
+    public void setUp()
+        throws Exception
+    {
+        DOMCursor c = getInputData();
+        List schemaList = new ArrayList();
+        boolean more = c.moveToChild(1);
+        while (more) {
+            if (c.atElement(null, "instance")) {
+                if (instance != null) {
+                    throw new IllegalArgumentException(
+                            "More than one instance: " + c);
+                }
+                instance = new File(getDataDirectory(), c.getText());
+            } else if (c.atElement(null, "schema")) {
+                schemaList.add(new File(getDataDirectory(), c.getText()));
+            } else {
+                throw new IllegalArgumentException(c.toString());
+            }
+            more = c.moveToSibling(1);
+        }
+        schemata = new File[schemaList.size()];
+        schemaList.toArray(schemata);
+    }
+
+    public void runTest()
+        throws Exception
+    {
+        SchemaValidator val = new SchemaValidator(schemata);
+        String err = val.validate(instance);
+
+        if (isNegativeTest()) {
+            assertTrue("Expected failure", err != null);
+        } else {
+            assertTrue(err, err == null);
+        }
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTestSuite.java
URL: http://svn.apache.org/viewcvs/incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTestSuite.java?rev=230871&view=auto
==============================================================================
--- incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTestSuite.java (added)
+++ incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTestSuite.java Mon Aug  8 12:58:58 2005
@@ -0,0 +1,42 @@
+// $Id$
+
+//
+// (C) Copyright 2005 VeriSign, Inc.  All Rights Reserved.
+//
+// VeriSign, Inc. shall have no responsibility, financial or
+// otherwise, for any consequences arising out of the use of
+// this material. The program material is provided on an "AS IS"
+// BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. The user is responsible for determining
+// any necessary third party rights or authorizations that may
+// be required for the use of the materials. Users are advised 
+// that they may need authorizations under certain patents from 
+// Microsoft and IBM, or others. Please see notice.txt file. 
+// VeriSign disclaims any obligation to notify the user of any 
+// such third party rights.
+//
+
+package org.apache.tsik.schema.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class SchemaTestSuite
+{
+    static final String MODULE = "schema";
+
+    public static void main(String[] args)
+        throws Exception
+    {
+        org.apache.tsik.test.Runner.runTextUI(suite(), args);
+    }
+
+    public static Test suite()
+        throws Exception
+    {
+        TestSuite suite = new TestSuite(MODULE);
+        suite.addTest(SchemaTest.suite());
+        suite.addTest(TestDatatypes.suite());
+        return suite;
+    }
+}

Propchange: incubator/tsik/trunk/test/src/org/apache/tsik/schema/test/SchemaTestSuite.java
------------------------------------------------------------------------------
    svn:executable = 



---------------------------------------------------------------------
To unsubscribe, e-mail: tsik-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tsik-dev-help@ws.apache.org