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/09/25 12:15:31 UTC
svn commit: r1389782 - in
/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java:
javax/xml/crypto/test/dsig/ javax/xml/crypto/test/dsig/keyinfo/
org/apache/xml/security/test/c14n/implementations/
org/apache/xml/security/test/encryption/ org/a...
Author: coheigea
Date: Tue Sep 25 10:15:30 2012
New Revision: 1389782
URL: http://svn.apache.org/viewvc?rev=1389782&view=rev
Log:
Backporting some test cleanups
Modified:
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ClassLoaderTest.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/DetachedTest.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ReferenceTest.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer11Test.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/MockCanonicalizationMethod.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/BobKeyResolver.java
santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTPTest.java
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ClassLoaderTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ClassLoaderTest.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ClassLoaderTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ClassLoaderTest.java Tue Sep 25 10:15:30 2012
@@ -65,7 +65,6 @@ public class ClassLoaderTest extends org
}
@org.junit.Test
- @SuppressWarnings("unchecked")
public void testProviderMultipleLoaders() throws Exception {
String baseDir = System.getProperty("basedir");
String fs = System.getProperty("file.separator");
@@ -79,7 +78,7 @@ public class ClassLoaderTest extends org
(urls, Thread.currentThread().getContextClassLoader());
//load security provider using current class loader
final Provider provider = new XMLDSigRI();
- AccessController.doPrivileged(new java.security.PrivilegedAction() {
+ AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
public Object run() {
Security.addProvider(provider);
return null;
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/DetachedTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/DetachedTest.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/DetachedTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/DetachedTest.java Tue Sep 25 10:15:30 2012
@@ -160,7 +160,7 @@ public class DetachedTest extends org.ju
if (coreValidity == false) {
// check the validation status of each Reference
Iterator<?> i = signature.getSignedInfo().getReferences().iterator();
- for (int j = 0; i.hasNext(); j++) {
+ while (i.hasNext()) {
Reference reference = (Reference) i.next();
reference.validate(vc);
}
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ReferenceTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ReferenceTest.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ReferenceTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/ReferenceTest.java Tue Sep 25 10:15:30 2012
@@ -248,7 +248,7 @@ public class ReferenceTest extends org.j
assertTrue(result);
Iterator<?> iter = sig.getSignedInfo().getReferences().iterator();
- for (int j=0; iter.hasNext(); j++) {
+ while (iter.hasNext()) {
Reference validated_ref = (Reference) iter.next();
if (!cache) {
assertNull(validated_ref.getDereferencedData());
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/KeyInfoTest.java Tue Sep 25 10:15:30 2012
@@ -62,7 +62,7 @@ public class KeyInfoTest extends org.jun
(Collections.singletonList(fac.newKeyName("foo")));
for (int j = 0; j < infos.length; j++) {
KeyInfo ki = infos[j];
- List li = ki.getContent();
+ List<Object> li = ki.getContent();
assertNotNull(ki.getContent());
if (!li.isEmpty()) {
Object[] content = li.toArray();
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/javax/xml/crypto/test/dsig/keyinfo/X509DataTest.java Tue Sep 25 10:15:30 2012
@@ -46,7 +46,7 @@ public class X509DataTest extends org.ju
@SuppressWarnings("unchecked")
public void testgetTypes() {
X509Data x509 = fac.newX509Data(Collections.singletonList("cn=foo"));
- List li = x509.getContent();
+ List<Object> li = x509.getContent();
assertNotNull(li);
if (!li.isEmpty()) {
Object[] content = li.toArray();
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer11Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer11Test.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer11Test.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer11Test.java Tue Sep 25 10:15:30 2012
@@ -408,8 +408,9 @@ public class Canonicalizer11Test extends
FileOutputStream fos = new FileOutputStream(f);
fos.write(c14nBytes);
- log.debug("Wrote errorneous result to file " + f.toURI().toURL().toString());
+ log.debug("Wrote erroneous result to file " + f.toURI().toURL().toString());
assertEquals(new String(refBytes), new String(c14nBytes));
+ fos.close();
}
return result;
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/Canonicalizer20010315Test.java Tue Sep 25 10:15:30 2012
@@ -1101,8 +1101,9 @@ public class Canonicalizer20010315Test e
FileOutputStream fos = new FileOutputStream(f);
fos.write(c14nBytes);
- log.debug("Wrote errorneous result to file " + f.toURI().toURL().toString());
+ log.debug("Wrote erroneous result to file " + f.toURI().toURL().toString());
assertEquals(new String(refBytes),new String(c14nBytes));
+ fos.close();
}
return result;
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/MockCanonicalizationMethod.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/MockCanonicalizationMethod.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/MockCanonicalizationMethod.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/c14n/implementations/MockCanonicalizationMethod.java Tue Sep 25 10:15:30 2012
@@ -46,14 +46,12 @@ public class MockCanonicalizationMethod
return _impl.engineCanonicalizeSubTree(rootNode, inclusiveNamespaces);
}
- @SuppressWarnings("unchecked")
- public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet)
+ public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet)
throws CanonicalizationException {
return _impl.engineCanonicalizeXPathNodeSet(xpathNodeSet);
}
- @SuppressWarnings("unchecked")
- public byte[] engineCanonicalizeXPathNodeSet(Set xpathNodeSet, String inclusiveNamespaces)
+ public byte[] engineCanonicalizeXPathNodeSet(Set<Node> xpathNodeSet, String inclusiveNamespaces)
throws CanonicalizationException {
return _impl.engineCanonicalizeXPathNodeSet(xpathNodeSet, inclusiveNamespaces);
}
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/BobKeyResolver.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/BobKeyResolver.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/BobKeyResolver.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/encryption/BobKeyResolver.java Tue Sep 25 10:15:30 2012
@@ -54,10 +54,10 @@ public class BobKeyResolver extends KeyR
*
*/
public boolean engineCanResolve(Element element, String BaseURI, StorageResolver storage) {
- log.debug("Can I resolve " + element.getTagName());
if (element == null) {
return false;
}
+ log.debug("Can I resolve " + element.getTagName());
boolean isKeyName = XMLUtils.elementIsInSignatureSpace(element, Constants._TAG_KEYNAME);
try {
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTPTest.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTPTest.java?rev=1389782&r1=1389781&r2=1389782&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTPTest.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/test/java/org/apache/xml/security/test/utils/resolver/ResolverDirectHTTPTest.java Tue Sep 25 10:15:30 2012
@@ -18,8 +18,9 @@
*/
package org.apache.xml.security.test.utils.resolver;
+import javax.xml.parsers.DocumentBuilderFactory;
+
import org.apache.xml.security.Init;
-import org.apache.xml.security.signature.XMLSignatureInput;
import org.apache.xml.security.utils.resolver.ResourceResolver;
import org.apache.xml.security.utils.resolver.ResourceResolverException;
import org.apache.xml.security.utils.resolver.implementations.ResolverDirectHTTP;
@@ -31,8 +32,6 @@ import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import javax.xml.parsers.DocumentBuilderFactory;
-
public class ResolverDirectHTTPTest extends org.junit.Assert {
//change these properties to match your environment
@@ -76,7 +75,7 @@ public class ResolverDirectHTTPTest exte
resolverDirectHTTP.engineSetProperty("http.proxy.port", proxyPort);
resolverDirectHTTP.engineSetProperty("http.proxy.username", proxyUsername);
resolverDirectHTTP.engineSetProperty("http.proxy.password", proxyPassword);
- XMLSignatureInput xmlSignatureInput = resolverDirectHTTP.engineResolve(uri, url);
+ resolverDirectHTTP.engineResolve(uri, url);
}
@Test
@@ -92,7 +91,7 @@ public class ResolverDirectHTTPTest exte
resolverDirectHTTP.engineSetProperty("http.proxy.username", proxyUsername);
resolverDirectHTTP.engineSetProperty("http.proxy.password", "wrongPassword");
try {
- XMLSignatureInput xmlSignatureInput = resolverDirectHTTP.engineResolve(uri, url);
+ resolverDirectHTTP.engineResolve(uri, url);
Assert.fail("Expected ResourceResolverException");
} catch (ResourceResolverException e) {
Assert.assertEquals("Server returned HTTP response code: 407 for URL: " + url, e.getMessage());
@@ -109,7 +108,7 @@ public class ResolverDirectHTTPTest exte
ResolverDirectHTTP resolverDirectHTTP = new ResolverDirectHTTP();
resolverDirectHTTP.engineSetProperty("http.basic.username", serverUsername);
resolverDirectHTTP.engineSetProperty("http.basic.password", serverPassword);
- XMLSignatureInput xmlSignatureInput = resolverDirectHTTP.engineResolve(uri, url);
+ resolverDirectHTTP.engineResolve(uri, url);
}
@Test
@@ -123,7 +122,7 @@ public class ResolverDirectHTTPTest exte
resolverDirectHTTP.engineSetProperty("http.basic.username", serverUsername);
resolverDirectHTTP.engineSetProperty("http.basic.password", "wrongPassword");
try {
- XMLSignatureInput xmlSignatureInput = resolverDirectHTTP.engineResolve(uri, url);
+ resolverDirectHTTP.engineResolve(uri, url);
Assert.fail("Expected ResourceResolverException");
} catch (ResourceResolverException e) {
Assert.assertEquals("Server returned HTTP response code: 401 for URL: " + url, e.getMessage());
@@ -144,6 +143,6 @@ public class ResolverDirectHTTPTest exte
resolverDirectHTTP.engineSetProperty("http.proxy.password", proxyPassword);
resolverDirectHTTP.engineSetProperty("http.basic.username", serverUsername);
resolverDirectHTTP.engineSetProperty("http.basic.password", serverPassword);
- XMLSignatureInput xmlSignatureInput = resolverDirectHTTP.engineResolve(uri, url);
+ resolverDirectHTTP.engineResolve(uri, url);
}
}