ASF Bugzilla – Attachment 23888 Details for
Bug 47260
Improve Java unit testing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A second patch for this issue
xml-sec-47260-2.patch (text/plain), 3.02 KB, created by
coheigea
on 2009-06-26 07:20:50 UTC
(
hide
)
Description:
A second patch for this issue
Filename:
MIME Type:
Creator:
coheigea
Created:
2009-06-26 07:20:50 UTC
Size:
3.02 KB
patch
obsolete
>Index: src_unitTests/javax/xml/crypto/test/dsig/IaikCoreFeaturesTest.java >=================================================================== >--- src_unitTests/javax/xml/crypto/test/dsig/IaikCoreFeaturesTest.java (revision 787181) >+++ src_unitTests/javax/xml/crypto/test/dsig/IaikCoreFeaturesTest.java (working copy) >@@ -26,6 +26,7 @@ > > import junit.framework.*; > >+import javax.xml.crypto.dsig.XMLSignatureFactory; > import javax.xml.crypto.test.KeySelectors; > > /** >@@ -53,6 +54,7 @@ > validator = new SignatureValidator(new File > (base, "coreFeatures/signatures")); > } >+ > public void test_anonymousReferenceSignature() throws Exception { > String file = "anonymousReferenceSignature.xml"; > >@@ -61,6 +63,7 @@ > new NullURIDereferencer(base)); > assertTrue("Signature failed core validation", coreValidity); > } >+ > public void test_manifestSignature() throws Exception { > String file = "manifestSignature.xml"; > >@@ -68,13 +71,16 @@ > (file, new KeySelectors.KeyValueKeySelector()); > assertTrue("Signature failed core validation", coreValidity); > } >+ > public void test_signatureTypesSignature() throws Exception { > String file = "signatureTypesSignature.xml"; > > boolean coreValidity = validator.validate >- (file, new KeySelectors.KeyValueKeySelector()); >+ (file, new KeySelectors.KeyValueKeySelector(), >+ new OfflineDereferencer()); > assertTrue("Signature failed core validation", coreValidity); > } >+ > public static void main(String[] args) throws Exception { > IaikCoreFeaturesTest it = new IaikCoreFeaturesTest(""); > it.test_anonymousReferenceSignature(); >@@ -102,4 +108,34 @@ > return osd; > } > } >+ >+ private static class OfflineDereferencer implements URIDereferencer { >+ private String w3cRec; >+ private URIDereferencer defaultDereferencer; >+ >+ OfflineDereferencer() throws Exception { >+ String fs = System.getProperty("file.separator"); >+ String base = System.getProperty("basedir") == null ? "./" : >+ System.getProperty("basedir"); >+ w3cRec = base + fs + "data" + fs + "org" + fs + "w3c" + fs + "www" + >+ fs + "TR" + fs + "2000"; >+ defaultDereferencer = >+ XMLSignatureFactory.getInstance().getURIDereferencer(); >+ } >+ >+ public Data dereference(URIReference uriReference, >+ XMLCryptoContext context) throws URIReferenceException { >+ >+ try { >+ if ("http://www.w3.org/TR/2000/REC-xml-20001006".equals(uriReference.getURI())) { >+ File content = new File(w3cRec, "REC-xml-20001006"); >+ return new OctetStreamData(new FileInputStream(content)); >+ } else { >+ return defaultDereferencer.dereference(uriReference, context); >+ } >+ } catch (java.io.FileNotFoundException ex) { >+ throw new URIReferenceException(ex.getMessage(), ex); >+ } >+ } >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 47260
:
23714
| 23888 |
23898