View | Details | Raw Unified | Return to bug 47260
Collapse All | Expand All

(-)build.xml (-8 / +1 lines)
Lines 362-375 Link Here
362
	        <formatter type="plain" usefile="false"/>
362
	        <formatter type="plain" usefile="false"/>
363
	        <batchtest fork="yes" todir="${dir.build.junit.xml}">
363
	        <batchtest fork="yes" todir="${dir.build.junit.xml}">
364
	            <fileset dir="${dir.src.test}">
364
	            <fileset dir="${dir.src.test}">
365
	                <include name="**/*Test*.java"/>
365
	                <include name="org/apache/xml/security/test/AllTests.java"/>
366
	                <include name="org/apache/xml/security/test/c14n/implementations/ExclusiveC14NInterop.java"/>
367
	                <exclude name="org/apache/xml/security/test/TestUtils.java"/>
368
	                <exclude name="org/apache/xml/security/test/interop/InteropTest.java"/>
369
	                <exclude name="**/TestVectorResolver.java"/>
370
	                <exclude name="**/IBMTest.java"/>
371
	                <exclude name="javax/xml/crypto/test/dsig/TestUtils.java"/>
372
                        <exclude name="javax/xml/crypto/test/dsig/InteropC14nTest.java"/>
373
	             </fileset>
366
	             </fileset>
374
	        </batchtest>
367
	        </batchtest>
375
	        <test if="ibm.available" name="org.apache.xml.security.test.interop.IBMTest" todir="${dir.build.junit.xml}"/>
368
	        <test if="ibm.available" name="org.apache.xml.security.test.interop.IBMTest" todir="${dir.build.junit.xml}"/>
(-)src_unitTests/org/apache/xml/security/test/encryption/EncryptContentTest.java (-3 / +3 lines)
Lines 98-104 Link Here
98
	// child should be EncryptedData, if not throw exception
98
	// child should be EncryptedData, if not throw exception
99
	Element childElem = (Element) child;
99
	Element childElem = (Element) child;
100
	if (!childElem.getLocalName().equals("EncryptedData")) {
100
	if (!childElem.getLocalName().equals("EncryptedData")) {
101
	    t.transform(new DOMSource(doc), new StreamResult(System.out));
101
	    // t.transform(new DOMSource(doc), new StreamResult(System.out));
102
	    throw new Exception("Element content not replaced");
102
	    throw new Exception("Element content not replaced");
103
	}
103
	}
104
	// there shouldn't be any more children elements
104
	// there shouldn't be any more children elements
Lines 107-116 Link Here
107
            sibling = sibling.getNextSibling();
107
            sibling = sibling.getNextSibling();
108
        }
108
        }
109
	if (sibling != null) {
109
	if (sibling != null) {
110
	    t.transform(new DOMSource(doc), new StreamResult(System.out));
110
	    // t.transform(new DOMSource(doc), new StreamResult(System.out));
111
	    throw new Exception("Sibling element content not replaced");
111
	    throw new Exception("Sibling element content not replaced");
112
	}
112
	}
113
113
114
	t.transform(new DOMSource(doc), new StreamResult(System.out));
114
	// t.transform(new DOMSource(doc), new StreamResult(System.out));
115
    }
115
    }
116
}
116
}
(-)src_unitTests/org/apache/xml/security/test/transforms/RegisterTest.java (+6 lines)
Lines 7-13 Link Here
7
import org.apache.xml.security.exceptions.AlgorithmAlreadyRegisteredException;
7
import org.apache.xml.security.exceptions.AlgorithmAlreadyRegisteredException;
8
import org.apache.xml.security.transforms.Transform;
8
import org.apache.xml.security.transforms.Transform;
9
9
10
import junit.framework.Test;
10
import junit.framework.TestCase;
11
import junit.framework.TestCase;
12
import junit.framework.TestSuite;
11
13
12
/**
14
/**
13
 * RegisterTest tests registering a custom Transform implementation loaded
15
 * RegisterTest tests registering a custom Transform implementation loaded
Lines 21-26 Link Here
21
        super(name);
23
        super(name);
22
    }
24
    }
23
25
26
    public static Test suite() {
27
       return new TestSuite(RegisterTest.class);
28
    }
29
24
    public static void test() throws Exception {
30
    public static void test() throws Exception {
25
31
26
        Transform.init();
32
        Transform.init();
(-)src_unitTests/org/apache/xml/security/test/transforms/implementations/AllTests.java (+1 lines)
Lines 10-15 Link Here
10
				"Test for org.apache.xml.security.test.transforms.implementations");
10
				"Test for org.apache.xml.security.test.transforms.implementations");
11
		//$JUnit-BEGIN$
11
		//$JUnit-BEGIN$
12
		suite.addTest(TransformBase64DecodeTest.suite());
12
		suite.addTest(TransformBase64DecodeTest.suite());
13
		suite.addTest(TransformXSLTTest.suite());
13
		suite.addTest(Xpath2TransformationTest.suite());
14
		suite.addTest(Xpath2TransformationTest.suite());
14
		//$JUnit-END$
15
		//$JUnit-END$
15
		return suite;
16
		return suite;
(-)src_unitTests/org/apache/xml/security/test/signature/InvalidKeyTest.java (-2 / +9 lines)
Lines 12-18 Link Here
12
import org.w3c.dom.Element;
12
import org.w3c.dom.Element;
13
import org.w3c.dom.NodeList;
13
import org.w3c.dom.NodeList;
14
14
15
import junit.framework.Test;
15
import junit.framework.TestCase;
16
import junit.framework.TestCase;
17
import junit.framework.TestSuite;
16
18
17
/**
19
/**
18
 * Test case contributed by Matthias Germann for testing that bug 43239 is
20
 * Test case contributed by Matthias Germann for testing that bug 43239 is
Lines 25-30 Link Here
25
	Init.init();
27
	Init.init();
26
    }
28
    }
27
29
30
    public static Test suite() {
31
       return new TestSuite(InvalidKeyTest.class);
32
    }
33
28
    private static final String BASEDIR = System.getProperty("basedir");
34
    private static final String BASEDIR = System.getProperty("basedir");
29
    private static final String SEP = System.getProperty("file.separator");
35
    private static final String SEP = System.getProperty("file.separator");
30
36
Lines 36-43 Link Here
36
        
42
        
37
	try {
43
	try {
38
            validate(trustStore.getCertificate("bedag-test").getPublicKey());
44
            validate(trustStore.getCertificate("bedag-test").getPublicKey());
45
            throw new Exception("Failure expected on a DSA key");
39
	} catch (Exception e) {
46
	} catch (Exception e) {
40
	    e.printStackTrace();
47
	    // e.printStackTrace();
41
	}
48
	}
42
        validate(trustStore.getCertificate("a70-garaio-frontend-u").getPublicKey());
49
        validate(trustStore.getCertificate("a70-garaio-frontend-u").getPublicKey());
43
    }
50
    }
Lines 56-61 Link Here
56
        XMLSignature si = new XMLSignature((Element)n,"");
63
        XMLSignature si = new XMLSignature((Element)n,"");
57
        si.checkSignatureValue(pk);
64
        si.checkSignatureValue(pk);
58
65
59
       	System.out.println("VALIDATION OK" );
66
       	// System.out.println("VALIDATION OK" );
60
    }
67
    }
61
}
68
}
(-)src_unitTests/org/apache/xml/security/test/signature/SignatureTest.java (+4 lines)
Lines 40-45 Link Here
40
        super(test);
40
        super(test);
41
    }
41
    }
42
42
43
    public static Test suite() {
44
       return new TestSuite(SignatureTest.class);
45
    }
46
43
    /**
47
    /**
44
     * Loads the 'localhost' keystore from the test keystore.
48
     * Loads the 'localhost' keystore from the test keystore.
45
     * 
49
     * 
(-)src_unitTests/org/apache/xml/security/test/signature/AllTests.java (+4 lines)
Lines 11-19 Link Here
11
	//$JUnit-BEGIN$
11
	//$JUnit-BEGIN$
12
	suite.addTest(CreateSignatureTest.suite());
12
	suite.addTest(CreateSignatureTest.suite());
13
	suite.addTestSuite(X509DataTest.class);
13
	suite.addTestSuite(X509DataTest.class);
14
	suite.addTestSuite(SignatureTest.class);
15
	suite.addTestSuite(XmlSecTest.class);
16
	suite.addTestSuite(InvalidKeyTest.class);
14
	suite.addTest(XMLSignatureInputTest.suite());
17
	suite.addTest(XMLSignatureInputTest.suite());
15
	suite.addTest(UnknownAlgoSignatureTest.suite());
18
	suite.addTest(UnknownAlgoSignatureTest.suite());
16
	suite.addTest(KeyValueTest.suite());
19
	suite.addTest(KeyValueTest.suite());
20
	suite.addTest(NoKeyInfoTest.suite());
17
	//$JUnit-END$
21
	//$JUnit-END$
18
	return suite;
22
	return suite;
19
    }
23
    }
(-)src_unitTests/org/apache/xml/security/test/signature/XmlSecTest.java (-3 / +9 lines)
Lines 42-48 Link Here
42
import org.w3c.dom.Element;
42
import org.w3c.dom.Element;
43
import org.w3c.dom.NodeList;
43
import org.w3c.dom.NodeList;
44
44
45
import junit.framework.Test;
45
import junit.framework.TestCase;
46
import junit.framework.TestCase;
47
import junit.framework.TestSuite;
46
48
47
/**
49
/**
48
 * Tests creating and validating an XML Signature with an XPath Transform.
50
 * Tests creating and validating an XML Signature with an XPath Transform.
Lines 56-61 Link Here
56
        org.apache.commons.logging.LogFactory.getLog
58
        org.apache.commons.logging.LogFactory.getLog
57
            (XmlSecTest.class.getName());
59
            (XmlSecTest.class.getName());
58
60
61
    public static Test suite() {
62
       return new TestSuite(XmlSecTest.class);
63
    }
64
59
    public void testCheckXmlSignatureSoftwareStack() throws Exception {
65
    public void testCheckXmlSignatureSoftwareStack() throws Exception {
60
	checkXmlSignatureSoftwareStack(false);
66
	checkXmlSignatureSoftwareStack(false);
61
    }
67
    }
Lines 131-139 Link Here
131
137
132
	signature.sign(privateKey);
138
	signature.sign(privateKey);
133
139
134
	TransformerFactory tf = TransformerFactory.newInstance();
140
	// TransformerFactory tf = TransformerFactory.newInstance();
135
	Transformer t = tf.newTransformer();
141
	// Transformer t = tf.newTransformer();
136
	t.transform(new DOMSource(testDocument), new StreamResult(System.out));
142
	// t.transform(new DOMSource(testDocument), new StreamResult(System.out));
137
143
138
	NodeList signatureElems = XPathAPI.selectNodeList(testDocument,
144
	NodeList signatureElems = XPathAPI.selectNodeList(testDocument,
139
				"//ds:Signature", nsElement);
145
				"//ds:Signature", nsElement);
(-)src_unitTests/org/apache/xml/security/test/ModuleTest.java (+7 lines)
Lines 44-58 Link Here
44
44
45
      //J-
45
      //J-
46
      suite.addTest(org.apache.xml.security.test.c14n.helper.C14nHelperTest.suite());
46
      suite.addTest(org.apache.xml.security.test.c14n.helper.C14nHelperTest.suite());
47
      suite.addTest(org.apache.xml.security.test.c14n.helper.AttrCompareTest.suite());
47
      suite.addTest(org.apache.xml.security.test.c14n.implementations.Canonicalizer20010315Test.suite());
48
      suite.addTest(org.apache.xml.security.test.c14n.implementations.Canonicalizer20010315Test.suite());
48
      suite.addTest(org.apache.xml.security.test.c14n.implementations.Canonicalizer20010315ExclusiveTest.suite());
49
      suite.addTest(org.apache.xml.security.test.c14n.implementations.Canonicalizer20010315ExclusiveTest.suite());
50
      suite.addTest(org.apache.xml.security.test.c14n.implementations.ExclusiveC14NInterop.suite());
51
      suite.addTest(org.apache.xml.security.test.c14n.implementations.Bug45961Test.suite());
49
      suite.addTest(org.apache.xml.security.test.external.org.apache.xalan.XPathAPI.XalanBug1425Test.suite());
52
      suite.addTest(org.apache.xml.security.test.external.org.apache.xalan.XPathAPI.XalanBug1425Test.suite());
50
      suite.addTest(org.apache.xml.security.test.external.org.apache.xalan.XPathAPI.AttributeAncestorOrSelfTest.suite());
53
      suite.addTest(org.apache.xml.security.test.external.org.apache.xalan.XPathAPI.AttributeAncestorOrSelfTest.suite());
51
      suite.addTest(org.apache.xml.security.test.signature.AllTests.suite());      
54
      suite.addTest(org.apache.xml.security.test.signature.AllTests.suite());      
52
      suite.addTest(org.apache.xml.security.test.utils.AllTests.suite());
55
      suite.addTest(org.apache.xml.security.test.utils.AllTests.suite());
53
      suite.addTest(org.apache.xml.security.c14n.implementations.AllTests.suite());
56
      suite.addTest(org.apache.xml.security.c14n.implementations.AllTests.suite());
54
      suite.addTest(org.apache.xml.security.test.transforms.implementations.AllTests.suite());
57
      suite.addTest(org.apache.xml.security.test.transforms.implementations.AllTests.suite());
58
      suite.addTest(org.apache.xml.security.test.transforms.RegisterTest.suite());
55
      suite.addTest(org.apache.xml.security.test.algorithms.AllTests.suite());
59
      suite.addTest(org.apache.xml.security.test.algorithms.AllTests.suite());
60
      suite.addTest(org.apache.xml.security.test.keys.content.x509.XMLX509SKITest.suite());
61
      suite.addTest(org.apache.xml.security.test.keys.content.x509.XMLX509IssuerSerialTest.suite());
62
      suite.addTest(org.apache.xml.security.test.keys.content.x509.XMLX509CertificateTest.suite());
56
      // suite.addTest(org.apache.xml.security.test.algorithms.implementations.KeyWrapTest.suite());
63
      // suite.addTest(org.apache.xml.security.test.algorithms.implementations.KeyWrapTest.suite());
57
      // suite.addTest(org.apache.xml.security.test.algorithms.implementations.BlockEncryptionTest.suite());
64
      // suite.addTest(org.apache.xml.security.test.algorithms.implementations.BlockEncryptionTest.suite());
58
      //J+
65
      //J+
(-)src_unitTests/org/apache/xml/security/test/c14n/helper/AttrCompareTest.java (-1 / +1 lines)
Lines 156-162 Link Here
156
      Attr attr0 = doc.createAttributeNS(null, "foo");
156
      Attr attr0 = doc.createAttributeNS(null, "foo");
157
      Attr attr1 = doc.createAttributeNS("http://goo", "goo:foo");
157
      Attr attr1 = doc.createAttributeNS("http://goo", "goo:foo");
158
158
159
      System.out.println("Attr1: " + attr1 + " (" + attr1.getLocalName()  +")");
159
      // System.out.println("Attr1: " + attr1 + " (" + attr1.getLocalName()  +")");
160
160
161
161
162
      AttrCompare attrCompare = new AttrCompare();
162
      AttrCompare attrCompare = new AttrCompare();
(-)src_unitTests/org/apache/xml/security/test/c14n/implementations/Bug45961Test.java (+6 lines)
Lines 22-28 Link Here
22
import org.w3c.dom.Element;
22
import org.w3c.dom.Element;
23
import org.w3c.dom.NodeList;
23
import org.w3c.dom.NodeList;
24
24
25
import junit.framework.Test;
25
import junit.framework.TestCase;
26
import junit.framework.TestCase;
27
import junit.framework.TestSuite;
26
28
27
public class Bug45961Test extends TestCase {
29
public class Bug45961Test extends TestCase {
28
30
Lines 32-37 Link Here
32
	private static final String ALIAS = "mullan";
34
	private static final String ALIAS = "mullan";
33
	private DocumentBuilder _builder;
35
	private DocumentBuilder _builder;
34
36
37
    public static Test suite() {
38
       return new TestSuite(Bug45961Test.class);
39
    }
40
35
	@Override
41
	@Override
36
	protected void setUp() throws Exception {
42
	protected void setUp() throws Exception {
37
		Init.init();
43
		Init.init();
(-)src_unitTests/org/apache/xml/security/test/keys/content/x509/XMLX509IssuerSerialTest.java (-2 / +2 lines)
Lines 57-66 Link Here
57
	XMLX509IssuerSerial is = 
57
	XMLX509IssuerSerial is = 
58
	    new XMLX509IssuerSerial(doc, issuer, 0);
58
	    new XMLX509IssuerSerial(doc, issuer, 0);
59
	assertEquals(issuer, is.getIssuerName());
59
	assertEquals(issuer, is.getIssuerName());
60
	System.out.println(is.getIssuerName());
60
	// System.out.println(is.getIssuerName());
61
	issuer = "CN=#abc123";
61
	issuer = "CN=#abc123";
62
	is = new XMLX509IssuerSerial(doc, issuer, 0);
62
	is = new XMLX509IssuerSerial(doc, issuer, 0);
63
	assertEquals("CN=\\#abc123", is.getIssuerName());
63
	assertEquals("CN=\\#abc123", is.getIssuerName());
64
	System.out.println(is.getIssuerName());
64
	// System.out.println(is.getIssuerName());
65
    }
65
    }
66
}
66
}
(-)src_unitTests/org/apache/xml/security/test/keys/content/x509/XMLX509CertificateTest.java (-1 / +1 lines)
Lines 67-72 Link Here
67
	XMLX509Certificate xmlCert = 
67
	XMLX509Certificate xmlCert = 
68
	    new XMLX509Certificate((Element) nl.item(0), "");
68
	    new XMLX509Certificate((Element) nl.item(0), "");
69
	X509Certificate cert = xmlCert.getX509Certificate();
69
	X509Certificate cert = xmlCert.getX509Certificate();
70
	System.out.println(cert);
70
	// System.out.println(cert);
71
    }
71
    }
72
}
72
}
(-)src_unitTests/org/apache/xml/security/test/AllTests.java (+1 lines)
Lines 51-56 Link Here
51
      //J-
51
      //J-
52
      suite.addTest(org.apache.xml.security.test.ModuleTest.suite());
52
      suite.addTest(org.apache.xml.security.test.ModuleTest.suite());
53
      suite.addTest(org.apache.xml.security.test.InteropTest.suite());
53
      suite.addTest(org.apache.xml.security.test.InteropTest.suite());
54
      suite.addTest(org.apache.xml.security.test.EncryptionTest.suite());
54
      //J+
55
      //J+
55
56
56
      return suite;
57
      return suite;
(-)src_unitTests/org/apache/xml/security/c14n/implementations/UtfHelperTest.java (-1 / +1 lines)
Lines 39-45 Link Here
39
		String str=new String(chs);
39
		String str=new String(chs);
40
		byte a[]=UtfHelpper.getStringInUtf8(str);
40
		byte a[]=UtfHelpper.getStringInUtf8(str);
41
		try {
41
		try {
42
			System.out.println("chunk:"+j);
42
			// System.out.println("chunk:"+j);
43
			byte correct[]=str.getBytes("UTF8");
43
			byte correct[]=str.getBytes("UTF8");
44
			assertTrue("UtfHelper.getStringInUtf8 failse",Arrays.equals(correct, a));
44
			assertTrue("UtfHelper.getStringInUtf8 failse",Arrays.equals(correct, a));
45
			assertTrue("UtfHelper.getStringInUtf8 failse",Arrays.equals(correct, charByCharOs.toByteArray()));
45
			assertTrue("UtfHelper.getStringInUtf8 failse",Arrays.equals(correct, charByCharOs.toByteArray()));
(-)src_unitTests/javax/xml/crypto/test/dsig/SecureXSLTTest.java (-2 / +2 lines)
Lines 38-44 Link Here
38
        File f = new File("doc.xml");
38
        File f = new File("doc.xml");
39
        for (int i=0; i<signatures.length; i++) {
39
        for (int i=0; i<signatures.length; i++) {
40
	    String signature = signatures[i];
40
	    String signature = signatures[i];
41
            System.out.println("Validating " + signature);
41
            // System.out.println("Validating " + signature);
42
            Document doc = dbf.newDocumentBuilder().parse
42
            Document doc = dbf.newDocumentBuilder().parse
43
                (new FileInputStream(new File(baseDir, signature)));
43
                (new FileInputStream(new File(baseDir, signature)));
44
44
Lines 74-79 Link Here
74
                    ("Test FAILED: doc.xml was successfully created");
74
                    ("Test FAILED: doc.xml was successfully created");
75
            }
75
            }
76
        }
76
        }
77
        System.out.println("Test PASSED");
77
        // System.out.println("Test PASSED");
78
    }
78
    }
79
}
79
}
(-)src_unitTests/javax/xml/crypto/test/dsig/ClassLoaderTest.java (-1 / +1 lines)
Lines 88-94 Link Here
88
        long end = System.currentTimeMillis();
88
        long end = System.currentTimeMillis();
89
        long elapsed = end-start;
89
        long elapsed = end-start;
90
        System.out.println("Elapsed:"+elapsed);
90
        System.out.println("Elapsed:"+elapsed);
91
        System.out.println("dsig succeeded");
91
        // System.out.println("dsig succeeded");
92
    }
92
    }
93
93
94
    public void test_provider_multiple_loaders_two() throws Exception {
94
    public void test_provider_multiple_loaders_two() throws Exception {
(-)src_unitTests/javax/xml/crypto/test/dsig/C14N11Test.java (-2 / +2 lines)
Lines 140-146 Link Here
140
    private void test_c14n11(String test) throws Exception {
140
    private void test_c14n11(String test) throws Exception {
141
	for (int i=0; i<vendors.length; i++) {
141
	for (int i=0; i<vendors.length; i++) {
142
	    String file = test + "-" + vendors[i] + ".xml";
142
	    String file = test + "-" + vendors[i] + ".xml";
143
	    System.out.println("Validating " + file);
143
	    // System.out.println("Validating " + file);
144
            boolean coreValidity = validator.validate(file, sks);
144
            boolean coreValidity = validator.validate(file, sks);
145
            assertTrue(file + " failed core validation", coreValidity);
145
            assertTrue(file + " failed core validation", coreValidity);
146
	}
146
	}
Lines 149-155 Link Here
149
    private void test_c14n11(String test, String[] vendors) throws Exception {
149
    private void test_c14n11(String test, String[] vendors) throws Exception {
150
	for (int i=0; i<vendors.length; i++) {
150
	for (int i=0; i<vendors.length; i++) {
151
	    String file = test + "-" + vendors[i] + ".xml";
151
	    String file = test + "-" + vendors[i] + ".xml";
152
	    System.out.println("Validating " + file);
152
	    // System.out.println("Validating " + file);
153
            boolean coreValidity = validator.validate(file, sks);
153
            boolean coreValidity = validator.validate(file, sks);
154
            assertTrue(file + " failed core validation", coreValidity);
154
            assertTrue(file + " failed core validation", coreValidity);
155
	}
155
	}

Return to bug 47260