You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2012/12/07 19:10:51 UTC
svn commit: r1418419 [2/2] - in
/santuario/xml-security-java/branches/1.5.x-fixes/src:
main/java/org/apache/xml/security/c14n/implementations/
main/java/org/apache/xml/security/encryption/
main/java/org/apache/xml/security/keys/content/ main/java/org/a...
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java?rev=1418419&r1=1418418&r2=1418419&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/dom/keys/keyresolver/X509DigestResolverTest.java Fri Dec 7 18:10:49 2012
@@ -34,64 +34,64 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class X509DigestResolverTest extends Assert {
-
+
private static final String BASEDIR = System.getProperty("basedir") == null ? "./": System.getProperty("basedir");
private static final String SEP = System.getProperty("file.separator");
-
+
private DocumentBuilder documentBuilder;
-
+
private X509Certificate certControl;
-
+
private StorageResolver storageResolver;
-
+
public X509DigestResolverTest() throws Exception {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware(true);
- documentBuilder = dbf.newDocumentBuilder();
-
- certControl = loadCertificate("cert-X509Digest.crt");
-
- storageResolver = new StorageResolver(new SingleCertificateResolver(certControl));
-
- if (!Init.isInitialized()) {
- Init.init();
- }
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ documentBuilder = dbf.newDocumentBuilder();
+
+ certControl = loadCertificate("cert-X509Digest.crt");
+
+ storageResolver = new StorageResolver(new SingleCertificateResolver(certControl));
+
+ if (!Init.isInitialized()) {
+ Init.init();
+ }
+ }
+
+ @org.junit.Test
+ public void testDigest() throws Exception {
+ Document doc = loadXML("X509Digest.xml");
+ Element element = doc.getDocumentElement();
+
+ KeyInfo keyInfo = new KeyInfo(element, "");
+
+ assertNull(keyInfo.getX509Certificate());
+ assertNull(keyInfo.getPublicKey());
+
+ keyInfo.addStorageResolver(storageResolver);
+
+ assertEquals(certControl, keyInfo.getX509Certificate());
+ assertEquals(certControl.getPublicKey(), keyInfo.getPublicKey());
}
-
- @org.junit.Test
- public void testDigest() throws Exception {
- Document doc = loadXML("X509Digest.xml");
- Element element = doc.getDocumentElement();
-
- KeyInfo keyInfo = new KeyInfo(element, "");
-
- assertNull(keyInfo.getX509Certificate());
- assertNull(keyInfo.getPublicKey());
-
- keyInfo.addStorageResolver(storageResolver);
-
- assertEquals(certControl, keyInfo.getX509Certificate());
- assertEquals(certControl.getPublicKey(), keyInfo.getPublicKey());
- }
-
-
+
+
// Utility methods
-
+
private String getControlFilePath(String fileName) {
return BASEDIR + SEP + "src" + SEP + "test" + SEP + "resources" +
- SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
- SEP + "keys" + SEP + "content" + SEP + "x509" +
- SEP + fileName;
- }
-
+ SEP + "org" + SEP + "apache" + SEP + "xml" + SEP + "security" +
+ SEP + "keys" + SEP + "content" + SEP + "x509" +
+ SEP + fileName;
+ }
+
private Document loadXML(String fileName) throws Exception {
- return documentBuilder.parse(new FileInputStream(getControlFilePath(fileName)));
+ return documentBuilder.parse(new FileInputStream(getControlFilePath(fileName)));
}
- private X509Certificate loadCertificate(String fileName) throws Exception {
- FileInputStream fis = new FileInputStream(getControlFilePath(fileName));
- CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
- return (X509Certificate) certFactory.generateCertificate(fis);
- }
+ private X509Certificate loadCertificate(String fileName) throws Exception {
+ FileInputStream fis = new FileInputStream(getControlFilePath(fileName));
+ CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
+ return (X509Certificate) certFactory.generateCertificate(fis);
+ }
}
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTest.java?rev=1418419&r1=1418418&r2=1418419&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/XMLCipherTest.java Fri Dec 7 18:10:49 2012
@@ -621,7 +621,7 @@ public class XMLCipherTest extends org.j
byte[] decryptBytes = cipherDecrypt.decryptToByteArray(ee);
assertEquals("A test encrypted secret",
- new String(decryptBytes, "ASCII"));
+ new String(decryptBytes, "ASCII"));
} else {
log.warn(
"Test testSameDocumentCipherReference skipped as "