ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1720185 [1/2] - in /webservices/wss4j/trunk: ./ integration/src/test/java/org/apache/wss4j/integration/test/kerberos/ ws-security-common/src/test/java/org/apache/wss4j/common/attachment/ ws-security-common/src/test/java/org/apache/wss4j/co...
Date Tue, 15 Dec 2015 15:52:42 GMT
Author: coheigea
Date: Tue Dec 15 15:52:41 2015
New Revision: 1720185

URL: http://svn.apache.org/viewvc?rev=1720185&view=rev
Log:
Adding partial test coverage via PMD

Modified:
    webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java
    webservices/wss4j/trunk/pom.xml
    webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/attachment/CRLFOutputStreamTest.java
    webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/AuthorityKeyIdentifierTest.java
    webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/SKITest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CombinedCallbackHandler.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomCrypto.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecurityTestUtil.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CertificateStoreTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoProviderTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/UseReqSigCertTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyActionTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionAlgorithmSuiteTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/RequireSignedEncryptedDataElementsTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureAlgorithmSuiteTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCRLTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertConstraintsTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TimestampTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/SecurityHeaderTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAlgorithmSuiteTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAuthnTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlConditionsTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlReferenceTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenCustomSignatureTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/validate/ValidatorTest.java

Modified: webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java (original)
+++ webservices/wss4j/trunk/integration/src/test/java/org/apache/wss4j/integration/test/kerberos/KerberosTest.java Tue Dec 15 15:52:41 2015
@@ -125,7 +125,7 @@ import org.w3c.dom.NodeList;
 
 @CreateKdcServer(
     transports = {
-        @CreateTransport(protocol = "KRB", address = "127.0.0.1")
+        @CreateTransport(protocol = "KRB", address = "127.0.0.1") //NOPMD
     },
     primaryRealm = "service.ws.apache.org",
     kdcPrincipal = "krbtgt/service.ws.apache.org@service.ws.apache.org"

Modified: webservices/wss4j/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/pom.xml?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/pom.xml (original)
+++ webservices/wss4j/trunk/pom.xml Tue Dec 15 15:52:41 2015
@@ -128,25 +128,13 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-pmd-plugin</artifactId>
-                <version>3.4</version>
-                <dependencies>
-                    <dependency>
-                        <groupId>net.sourceforge.pmd</groupId>
-                        <artifactId>pmd-core</artifactId>
-                        <version>5.3.0</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>net.sourceforge.pmd</groupId>
-                        <artifactId>pmd-java</artifactId>
-                        <version>5.3.0</version>
-                    </dependency>
-                </dependencies>
+                <version>3.5</version>
                 <configuration>
                     <sourceEncoding>UTF-8</sourceEncoding>
                     <failOnViolation>true</failOnViolation>
                     <linkXRef>false</linkXRef>
                     <verbose>true</verbose>
-                    <minimumTokens>100</minimumTokens>
+                    <!--<includeTests>true</includeTests>-->
                     <targetJdk>${targetJdk}</targetJdk>
                     <excludeRoots>
                         <excludeRoot>${basedir}/src/main/generated</excludeRoot>

Modified: webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/attachment/CRLFOutputStreamTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/attachment/CRLFOutputStreamTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/attachment/CRLFOutputStreamTest.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/attachment/CRLFOutputStreamTest.java Tue Dec 15 15:52:41 2015
@@ -102,10 +102,8 @@ public class CRLFOutputStreamTest {
                 if (res[i + 1] != '\n') {
                     throw new Exception("Missing \\n in\n" + createEscapedString(res) + "\n input string: " + createEscapedString(testString.toByteArray()));
                 }
-            } else if (re == '\n') {
-                if (res[i - 1] != '\r') {
-                    throw new Exception("Missing \\r in\n" + createEscapedString(res) + "\n input string: " + createEscapedString(testString.toByteArray()));
-                }
+            } else if (re == '\n' && res[i - 1] != '\r') {
+                throw new Exception("Missing \\r in\n" + createEscapedString(res) + "\n input string: " + createEscapedString(testString.toByteArray()));
             }
         }
     }

Modified: webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/AuthorityKeyIdentifierTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/AuthorityKeyIdentifierTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/AuthorityKeyIdentifierTest.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/AuthorityKeyIdentifierTest.java Tue Dec 15 15:52:41 2015
@@ -24,6 +24,7 @@ import java.security.KeyStore;
 import java.security.cert.X509Certificate;
 import java.util.Arrays;
 
+import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.util.Loader;
 
 /**
@@ -90,8 +91,8 @@ public class AuthorityKeyIdentifierTest
         try {
             crypto.verifyTrust(new X509Certificate[]{badCert}, false, null);
             fail("Failure expected on trying to validate an untrusted cert");
-        } catch (Exception ex) {
-            // expected
+        } catch (WSSecurityException ex) {
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE);
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/SKITest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/SKITest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/SKITest.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/test/java/org/apache/wss4j/common/crypto/SKITest.java Tue Dec 15 15:52:41 2015
@@ -24,9 +24,6 @@ import java.security.KeyStore;
 import java.security.Security;
 import java.security.cert.X509Certificate;
 
-import org.apache.wss4j.common.crypto.Crypto;
-import org.apache.wss4j.common.crypto.CryptoType;
-import org.apache.wss4j.common.crypto.Merlin;
 import org.apache.wss4j.common.util.Loader;
 import org.apache.xml.security.utils.Base64;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CombinedCallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CombinedCallbackHandler.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CombinedCallbackHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CombinedCallbackHandler.java Tue Dec 15 15:52:41 2015
@@ -48,8 +48,8 @@ public class CombinedCallbackHandler imp
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof WSPasswordCallback) {
                 WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
-                if ((pc.getUsage() == WSPasswordCallback.SECRET_KEY)
-                    || (pc.getUsage() == WSPasswordCallback.SECURITY_CONTEXT_TOKEN)) {
+                if (pc.getUsage() == WSPasswordCallback.SECRET_KEY
+                    || pc.getUsage() == WSPasswordCallback.SECURITY_CONTEXT_TOKEN) {
                     secretCallbackHandler.handle(callbacks);
                 } else {
                     keystoreCallbackHandler.handle(callbacks);

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomCrypto.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomCrypto.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomCrypto.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomCrypto.java Tue Dec 15 15:52:41 2015
@@ -28,7 +28,7 @@ public class CustomCrypto extends Merlin
     public
     CustomCrypto(
         java.util.Map<String, Object> config,
-        java.lang.ClassLoader loader
+        java.lang.ClassLoader loader    //NOPMD
     ) {
         this.config = config;
     }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecretKeyCallbackHandler.java Tue Dec 15 15:52:41 2015
@@ -45,8 +45,8 @@ public class SecretKeyCallbackHandler im
         for (int i = 0; i < callbacks.length; i++) {
             if (callbacks[i] instanceof WSPasswordCallback) {
                 WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
-                if ((pc.getUsage() == WSPasswordCallback.SECRET_KEY)
-                    || (pc.getUsage() == WSPasswordCallback.SECURITY_CONTEXT_TOKEN)) {
+                if (pc.getUsage() == WSPasswordCallback.SECRET_KEY
+                    || pc.getUsage() == WSPasswordCallback.SECURITY_CONTEXT_TOKEN) {
                     byte[] secret = this.secrets.get(pc.getIdentifier());
                     if (secret == null) {
                         secret = outboundSecret;

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecurityTestUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecurityTestUtil.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecurityTestUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/SecurityTestUtil.java Tue Dec 15 15:52:41 2015
@@ -35,7 +35,7 @@ public final class SecurityTestUtil {
             File[] tmpFiles = new File(tmpDir).listFiles();
             if (tmpFiles != null) {
                 for (File tmpFile : tmpFiles) {
-                    if (tmpFile.exists() && (tmpFile.getName().endsWith(".data"))) {
+                    if (tmpFile.exists() && tmpFile.getName().endsWith(".data")) {
                         tmpFile.delete();
                     }
                 }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CertificateStoreTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CertificateStoreTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CertificateStoreTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CertificateStoreTest.java Tue Dec 15 15:52:41 2015
@@ -270,7 +270,7 @@ public class CertificateStoreTest extend
             verify(signedDoc, receiverCrypto);
             fail("Failure expected on an unknown certificate");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoProviderTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoProviderTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoProviderTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoProviderTest.java Tue Dec 15 15:52:41 2015
@@ -26,6 +26,7 @@ import org.apache.wss4j.dom.common.Secur
 import org.apache.wss4j.dom.engine.WSSecurityEngine;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
+import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.util.XMLUtils;
 import org.apache.wss4j.dom.message.WSSecEncrypt;
 import org.apache.wss4j.dom.message.WSSecHeader;
@@ -187,7 +188,7 @@ public class CryptoProviderTest extends
                 CertificateFactory.getInstance("X.509", "BC");
             X509Certificate cert = 
                 (X509Certificate)factory.generateCertificate(
-                    new java.io.ByteArrayInputStream(certBytes)
+                    new ByteArrayInputStream(certBytes)
                 );
     
             WSSecEncrypt encrypt = new WSSecEncrypt();
@@ -242,7 +243,7 @@ public class CryptoProviderTest extends
                 CertificateFactory.getInstance("X.509", "BC");
             X509Certificate cert = 
                 (X509Certificate)factory.generateCertificate(
-                    new java.io.ByteArrayInputStream(certBytes)
+                    new ByteArrayInputStream(certBytes)
                 );
     
             WSSecEncrypt encrypt = new WSSecEncrypt();
@@ -260,8 +261,8 @@ public class CryptoProviderTest extends
             try {
                 verify(encryptedDoc);
                 fail("Failure expected on encryption with a key that does not exist in the keystore");
-            } catch (Exception ex) {
-                // expected
+            } catch (WSSecurityException ex) {
+                assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
             }
         } finally {
             Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/components/crypto/CryptoTest.java Tue Dec 15 15:52:41 2015
@@ -69,8 +69,7 @@ public class CryptoTest extends org.juni
     public void testCustomCrypto() throws Exception {
         java.util.Map<Object, Object> tmp = new java.util.TreeMap<>();
         Crypto crypto = CryptoFactory.getInstance(
-            org.apache.wss4j.dom.common.CustomCrypto.class,
-            tmp
+            CustomCrypto.class, tmp
         );
         assertNotNull(crypto);
         assertTrue(crypto instanceof CustomCrypto);
@@ -133,7 +132,7 @@ public class CryptoTest extends org.juni
             secEngine.processSecurityHeader(signedDoc, null, null, processCrypto);
             fail("Expected failure on a bad trust store");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/CustomActionProcessorTest.java Tue Dec 15 15:52:41 2015
@@ -88,8 +88,7 @@ public class CustomActionProcessorTest e
         WSSConfig cfg = WSSConfig.getNewInstance();
         String p = "org.apache.wss4j.dom.common.CustomProcessor";
         cfg.setProcessor(
-            WSConstants.SIGNATURE,
-            org.apache.wss4j.dom.common.CustomProcessor.class
+            WSConstants.SIGNATURE, CustomProcessor.class
         );
         final WSSecurityEngine engine = new WSSecurityEngine();
         engine.setWssConfig(cfg);
@@ -98,10 +97,8 @@ public class CustomActionProcessorTest e
         boolean found = false;
         for (WSSecurityEngineResult result : results.getResults()) {
             Object obj = result.get("foo");
-            if (obj != null) {
-                if (obj.getClass().getName().equals(p)) {
-                    found = true;
-                }
+            if (obj != null && obj.getClass().getName().equals(p)) {
+                found = true;
             }
         }
         assertTrue("Unable to find result from CustomProcessor", found);
@@ -143,10 +140,8 @@ public class CustomActionProcessorTest e
         boolean found = false;
         for (WSSecurityEngineResult result : results.getResults()) {
             Object obj = result.get("foo");
-            if (obj != null) {
-                if (obj.getClass().getName().equals(CustomProcessor.class.getName())) {
-                    found = true;
-                }
+            if (obj != null && obj.getClass().getName().equals(CustomProcessor.class.getName())) {
+                found = true;
             }
         }
         assertTrue("Unable to find result from CustomProcessor", found);
@@ -162,7 +157,7 @@ public class CustomActionProcessorTest e
         
         final WSSConfig cfg = WSSConfig.getNewInstance();
         final int action = 0xDEADF000;
-        cfg.setAction(action, org.apache.wss4j.dom.common.CustomAction.class);
+        cfg.setAction(action, CustomAction.class);
         final RequestData reqData = new RequestData();
         reqData.setWssConfig(cfg);
         
@@ -226,7 +221,7 @@ public class CustomActionProcessorTest e
             WSSecurityUtil.decodeHandlerAction(actionString, cfg);
             fail("Failure expected on unknown action");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
         
         //
@@ -238,13 +233,13 @@ public class CustomActionProcessorTest e
             WSSecurityUtil.decodeHandlerAction(badActionString, cfg);
             fail("Failure expected on unknown action");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
         
         //
         // This parsing should pass as WSSConfig has been configured with the custom action
         //
-        cfg.setAction(customAction, org.apache.wss4j.dom.common.CustomAction.class);
+        cfg.setAction(customAction, CustomAction.class);
         List<HandlerAction> actionList = WSSecurityUtil.decodeHandlerAction(actionString, cfg);
         
         final RequestData reqData = new RequestData();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/SignatureConfirmationTest.java Tue Dec 15 15:52:41 2015
@@ -299,7 +299,7 @@ public class SignatureConfirmationTest e
             newEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
             fail("Failure expected on a request with no wsu:Id");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         RequestData data = new RequestData();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/UseReqSigCertTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/UseReqSigCertTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/UseReqSigCertTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/handler/UseReqSigCertTest.java Tue Dec 15 15:52:41 2015
@@ -214,7 +214,7 @@ public class UseReqSigCertTest extends o
         config.put(WSHandlerConstants.RECV_RESULTS, handlerResults);
         reqData.setMsgContext(config);
         
-        final java.util.List<Integer> actions = new java.util.ArrayList<Integer>();
+        final List<Integer> actions = new ArrayList<Integer>();
         actions.add(WSConstants.ENCR);
         final Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
         

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/AttachmentTest.java Tue Dec 15 15:52:41 2015
@@ -57,7 +57,7 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-public class AttachmentTest extends org.junit.Assert {
+public class AttachmentTest extends Assert {
 
     private static final org.slf4j.Logger LOG =
             org.slf4j.LoggerFactory.getLogger(AttachmentTest.class);
@@ -459,7 +459,7 @@ public class AttachmentTest extends org.
     
             Map<String, String> attHeaders = responseAttachment.getHeaders();
             Assert.assertEquals(6, attHeaders.size());
-        } catch (IOException ex) {
+        } catch (IOException ex) { //NOPMD
             // expected
         }
     }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyActionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyActionTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyActionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyActionTest.java Tue Dec 15 15:52:41 2015
@@ -49,7 +49,7 @@ import org.junit.Assert;
 /**
  * A set of tests for using a derived key for encryption/signature using WSHandler actions.
  */
-public class DerivedKeyActionTest extends org.junit.Assert {
+public class DerivedKeyActionTest extends Assert {
     private static final org.slf4j.Logger LOG = 
         org.slf4j.LoggerFactory.getLogger(DerivedKeyActionTest.class);
     private CallbackHandler callbackHandler = new KeystoreCallbackHandler();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionAlgorithmSuiteTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionAlgorithmSuiteTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionAlgorithmSuiteTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionAlgorithmSuiteTest.java Tue Dec 15 15:52:41 2015
@@ -92,7 +92,7 @@ public class EncryptionAlgorithmSuiteTes
             verify(securityHeader, algorithmSuite, crypto);
             fail("Expected failure as 512-bit keys are not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
     }
     
@@ -126,7 +126,7 @@ public class EncryptionAlgorithmSuiteTes
             verify(securityHeader, algorithmSuite, wssCrypto);
             fail("Expected failure as RSA 15 is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         algorithmSuite.addKeyWrapAlgorithm(WSConstants.KEYTRANSPORT_RSA15);
@@ -162,7 +162,7 @@ public class EncryptionAlgorithmSuiteTes
             verify(securityHeader, null, wssCrypto);
             fail("Expected failure as RSA 15 is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         // Now enable RSA v1.5 processing
@@ -205,7 +205,7 @@ public class EncryptionAlgorithmSuiteTes
             verify(securityHeader, algorithmSuite, wssCrypto);
             fail("Expected failure as AES 128 is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         algorithmSuite.addEncryptionMethod(WSConstants.AES_128);
@@ -260,7 +260,7 @@ public class EncryptionAlgorithmSuiteTes
             secEngine.processSecurityHeader(securityHeader, data);
             fail("Expected failure as a 128 bit key is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         algorithmSuite.setMinimumSymmetricKeyLength(64);
@@ -269,7 +269,7 @@ public class EncryptionAlgorithmSuiteTes
             secEngine.processSecurityHeader(securityHeader, data);
             fail("Expected failure as a 128 bit key is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionCRLTest.java Tue Dec 15 15:52:41 2015
@@ -147,7 +147,7 @@ public class EncryptionCRLTest extends o
                 true
             );
             fail ("Failure expected on a revoked certificate");
-        } catch (Exception ex) {
+        } catch (Exception ex) { //NOPMD
             // expected
         }
        

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionGCMTest.java Tue Dec 15 15:52:41 2015
@@ -185,8 +185,8 @@ public class EncryptionGCMTest extends o
             final Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION);
             assertNotNull(action);
             if ((action & WSConstants.ENCR) != 0) {
-                final java.util.List<WSDataRef> refs =
-                    (java.util.List<WSDataRef>) result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
+                final List<WSDataRef> refs =
+                    (List<WSDataRef>) result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
                 assertNotNull(refs);
                 encrypted = true;
                 for (java.util.Iterator<WSDataRef> jpos = refs.iterator(); jpos.hasNext();) {

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionPartsTest.java Tue Dec 15 15:52:41 2015
@@ -122,8 +122,8 @@ public class EncryptionPartsTest extends
             results.getActionResults().get(WSConstants.ENCR).get(0);
         assertTrue(actionResult != null);
         assertFalse(actionResult.isEmpty());
-        final java.util.List<WSDataRef> refs =
-            (java.util.List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
+        final List<WSDataRef> refs =
+            (List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
         
         assertEquals(WSConstants.KEYTRANSPORT_RSAOEP, 
                 actionResult.get(WSSecurityEngineResult.TAG_ENCRYPTED_KEY_TRANSPORT_METHOD));
@@ -243,7 +243,7 @@ public class EncryptionPartsTest extends
             encrypt.build(doc, crypto, secHeader);
             fail("Failure expected on not encrypting a required element");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     
@@ -285,8 +285,8 @@ public class EncryptionPartsTest extends
                 results.getActionResults().get(WSConstants.ENCR).get(0);
         assertTrue(actionResult != null);
         assertFalse(actionResult.isEmpty());
-        final java.util.List<WSDataRef> refs =
-            (java.util.List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
+        final List<WSDataRef> refs =
+            (List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
         
         assertEquals(WSConstants.KEYTRANSPORT_RSAOEP, 
                 actionResult.get(WSSecurityEngineResult.TAG_ENCRYPTED_KEY_TRANSPORT_METHOD));
@@ -333,8 +333,8 @@ public class EncryptionPartsTest extends
             results.getActionResults().get(WSConstants.ENCR).get(0);
         assertTrue(actionResult != null);
         assertFalse(actionResult.isEmpty());
-        final java.util.List<WSDataRef> refs =
-            (java.util.List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
+        final List<WSDataRef> refs =
+            (List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
 
         assertEquals(WSConstants.KEYTRANSPORT_RSAOEP,
             actionResult.get(WSSecurityEngineResult.TAG_ENCRYPTED_KEY_TRANSPORT_METHOD));
@@ -369,7 +369,7 @@ public class EncryptionPartsTest extends
             encrypt.build(doc, crypto, secHeader);
             fail("Failure expected on a bad localname");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     
@@ -399,7 +399,7 @@ public class EncryptionPartsTest extends
             encrypt.build(doc, crypto, secHeader);
             fail("Failure expected on a bad namespace");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     
@@ -452,8 +452,8 @@ public class EncryptionPartsTest extends
         assertFalse(actionResult.isEmpty());
         
         @SuppressWarnings("unchecked")
-        final java.util.List<WSDataRef> refs =
-            (java.util.List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
+        final List<WSDataRef> refs =
+            (List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
         assertTrue(refs != null && !refs.isEmpty());
         
         boolean foundFoo = false;

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/EncryptionTest.java Tue Dec 15 15:52:41 2015
@@ -577,7 +577,7 @@ public class EncryptionTest extends org.
             newEngine.processSecurityHeader(encryptedDoc, null, keystoreCallbackHandler, crypto);
             fail("Failure expected on a bad attribute type");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
         
         RequestData data = new RequestData();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/ModifiedRequestTest.java Tue Dec 15 15:52:41 2015
@@ -113,11 +113,11 @@ public class ModifiedRequestTest extends
         // Replace the signed element with a modified element, and move the original
         // signed element into the SOAP header
         //
-        org.w3c.dom.Element secHeaderElement = secHeader.getSecurityHeader();
-        org.w3c.dom.Element envelopeElement = signedDoc.getDocumentElement();
-        org.w3c.dom.Node valueNode = 
+        Element secHeaderElement = secHeader.getSecurityHeader();
+        Element envelopeElement = signedDoc.getDocumentElement();
+        Node valueNode = 
             envelopeElement.getElementsByTagNameNS("http://blah.com", "value").item(0);
-        org.w3c.dom.Node clonedValueNode = valueNode.cloneNode(true);
+        Node clonedValueNode = valueNode.cloneNode(true);
         secHeaderElement.appendChild(clonedValueNode);
         valueNode.getFirstChild().setNodeValue("250");
         
@@ -167,14 +167,14 @@ public class ModifiedRequestTest extends
         // Replace the signed element with a modified element, and move the original
         // signed element into the SOAP header
         //
-        org.w3c.dom.Element secHeaderElement = secHeader.getSecurityHeader();
-        org.w3c.dom.Element envelopeElement = signedDoc.getDocumentElement();
-        org.w3c.dom.Node valueNode = 
+        Element secHeaderElement = secHeader.getSecurityHeader();
+        Element envelopeElement = signedDoc.getDocumentElement();
+        Node valueNode = 
             envelopeElement.getElementsByTagNameNS("http://blah.com", "value").item(0);
-        org.w3c.dom.Node clonedValueNode = valueNode.cloneNode(true);
+        Node clonedValueNode = valueNode.cloneNode(true);
         secHeaderElement.appendChild(clonedValueNode);
         valueNode.getFirstChild().setNodeValue("250");
-        ((org.w3c.dom.Element)valueNode).setAttributeNS(
+        ((Element)valueNode).setAttributeNS(
              WSConstants.WSU_NS, "wsu:Id", "id-250"
         );
         
@@ -194,19 +194,19 @@ public class ModifiedRequestTest extends
         // Finally we need to check that the Element that was signed is what we expect to be signed
         //
         envelopeElement = signedDoc.getDocumentElement();
-        org.w3c.dom.Node bodyNode = 
+        Node bodyNode = 
             envelopeElement.getElementsByTagNameNS(
                 WSConstants.URI_SOAP11_ENV, "Body"
             ).item(0);
         valueNode = 
-            ((org.w3c.dom.Element)bodyNode).getElementsByTagNameNS(
+            ((Element)bodyNode).getElementsByTagNameNS(
                 "http://blah.com", "value"
             ).item(0);
         
         List<WSSecurityEngineResult> signedResults = 
             results.getActionResults().get(WSConstants.SIGN);
         try {
-            WSSecurityUtil.verifySignedElement((org.w3c.dom.Element)valueNode, signedResults);
+            WSSecurityUtil.verifySignedElement((Element)valueNode, signedResults);
             fail("Failure expected on the required element not being signed");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_CHECK);
@@ -342,7 +342,7 @@ public class ModifiedRequestTest extends
             newEngine.processSecurityHeader(doc, null, new KeystoreCallbackHandler(), wssCrypto);
             fail("Failure expected on a modified EncryptedData structure");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/PasswordTypeTest.java Tue Dec 15 15:52:41 2015
@@ -197,7 +197,7 @@ public class PasswordTypeTest extends or
             secEngine.processSecurityHeader(doc, reqData);
             fail("Expected failure on the wrong password type");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
         }
     }
 

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/RequireSignedEncryptedDataElementsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/RequireSignedEncryptedDataElementsTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/RequireSignedEncryptedDataElementsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/RequireSignedEncryptedDataElementsTest.java Tue Dec 15 15:52:41 2015
@@ -274,7 +274,7 @@ public class RequireSignedEncryptedDataE
     private RequestData getRequestData(boolean reqSignedEncData) throws WSSecurityException {
         RequestData reqData = new RequestData();
         Map<String, Object> messageContext = new TreeMap<>();
-        messageContext = new java.util.TreeMap<String, Object>();
+        messageContext = new TreeMap<String, Object>();
         messageContext.put(WSHandlerConstants.REQUIRE_SIGNED_ENCRYPTED_DATA_ELEMENTS, Boolean.toString(reqSignedEncData));
         reqData.setMsgContext(messageContext);
         CustomHandler handler = new CustomHandler();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureAlgorithmSuiteTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureAlgorithmSuiteTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureAlgorithmSuiteTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureAlgorithmSuiteTest.java Tue Dec 15 15:52:41 2015
@@ -96,7 +96,7 @@ public class SignatureAlgorithmSuiteTest
             verify(securityHeader, algorithmSuite, crypto);
             fail("Expected failure as 512-bit keys are not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
     }
     
@@ -127,7 +127,7 @@ public class SignatureAlgorithmSuiteTest
             verify(securityHeader, algorithmSuite, dsaCrypto);
             fail("Expected failure as DSA is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
         
         algorithmSuite.addSignatureMethod(WSConstants.DSA);
@@ -178,7 +178,7 @@ public class SignatureAlgorithmSuiteTest
             secEngine.processSecurityHeader(securityHeader, data);
             fail("Expected failure as HMAC-SHA1 is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
         
         algorithmSuite.addSignatureMethod(WSConstants.HMAC_SHA1);
@@ -189,7 +189,7 @@ public class SignatureAlgorithmSuiteTest
             secEngine.processSecurityHeader(securityHeader, data);
             fail("Expected failure as a 128 bit key is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
         
         algorithmSuite.setMinimumSymmetricKeyLength(64);
@@ -198,7 +198,7 @@ public class SignatureAlgorithmSuiteTest
             secEngine.processSecurityHeader(securityHeader, data);
             fail("Expected failure as a 128 bit key is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
     }
     
@@ -228,7 +228,7 @@ public class SignatureAlgorithmSuiteTest
             verify(securityHeader, algorithmSuite, crypto);
             fail("Expected failure as C14n algorithm is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
         
         algorithmSuite.addC14nAlgorithm(WSConstants.C14N_EXCL_WITH_COMMENTS);
@@ -261,7 +261,7 @@ public class SignatureAlgorithmSuiteTest
             verify(securityHeader, algorithmSuite, crypto);
             fail("Expected failure as Digest algorithm is not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);
         }
         
         algorithmSuite.addDigestAlgorithm(WSConstants.SHA256);

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCRLTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCRLTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCRLTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCRLTest.java Tue Dec 15 15:52:41 2015
@@ -29,6 +29,7 @@ import org.apache.wss4j.dom.engine.WSSec
 import org.apache.wss4j.dom.engine.WSSecurityEngineResult;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
+import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.util.XMLUtils;
 import org.apache.wss4j.dom.handler.RequestData;
 import org.apache.wss4j.dom.handler.WSHandlerResult;
@@ -142,8 +143,8 @@ public class SignatureCRLTest extends or
         try {
             verify(signedDoc, cryptoCA, true);
             fail ("Failure expected on a revoked certificate");
-        } catch (Exception ex) {
-            // expected
+        } catch (WSSecurityException ex) {
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
     }
     
@@ -180,8 +181,8 @@ public class SignatureCRLTest extends or
         try {
             verify(signedDoc, crypto, true);
             fail ("Failure expected on a revoked certificate");
-        } catch (Exception ex) {
-            // expected
+        } catch (WSSecurityException ex) {
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertConstraintsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertConstraintsTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertConstraintsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertConstraintsTest.java Tue Dec 15 15:52:41 2015
@@ -89,7 +89,7 @@ public class SignatureCertConstraintsTes
             verify(securityHeader, cryptoCA, certConstraint);
             fail("Failure expected on a bad cert constraint");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
     }
     
@@ -124,7 +124,7 @@ public class SignatureCertConstraintsTes
             verify(securityHeader, cryptoCA, certConstraint);
             fail("Failure expected on a bad cert constraint");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureCertTest.java Tue Dec 15 15:52:41 2015
@@ -227,7 +227,6 @@ public class SignatureCertTest extends o
             fail("Failure expected on issuer serial");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_CHECK);
-            // expected
         }
     }
     
@@ -261,7 +260,7 @@ public class SignatureCertTest extends o
             verify(signedDoc, CryptoFactory.getInstance("wss40badcatrust.properties"));
             fail("Failure expected on bad CA cert!");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE);
         }
     }
     
@@ -340,7 +339,7 @@ public class SignatureCertTest extends o
             newEngine.processSecurityHeader(doc, null, null, cryptoCA);
             fail("Failure expected on an expired cert");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE);
         }
     }
     
@@ -379,7 +378,7 @@ public class SignatureCertTest extends o
             newEngine.processSecurityHeader(doc, null, null, clientCrypto);
             fail("Failure expected on an expired cert");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_CHECK);
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureKeyValueTest.java Tue Dec 15 15:52:41 2015
@@ -26,6 +26,7 @@ import org.w3c.dom.Document;
 import org.apache.wss4j.common.bsp.BSPRule;
 import org.apache.wss4j.common.crypto.Crypto;
 import org.apache.wss4j.common.crypto.CryptoFactory;
+import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.util.XMLUtils;
 import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.common.SOAPUtil;
@@ -126,8 +127,8 @@ public class SignatureKeyValueTest exten
             data.setIgnoredBSPRules(Collections.singletonList(BSPRule.R5417));
             secEngine.processSecurityHeader(signedDoc, data);
             fail("Failure expected on bad public key");
-        } catch (Exception ex) {
-            // expected
+        } catch (WSSecurityException ex) {
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
         
     }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignaturePartsTest.java Tue Dec 15 15:52:41 2015
@@ -260,7 +260,7 @@ public class SignaturePartsTest extends
             sign.build(doc, crypto, secHeader);
             fail("Failure expected on not signing a required element");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_SIGNATURE); 
         }
     }
     
@@ -369,7 +369,7 @@ public class SignaturePartsTest extends
             sign.build(doc, crypto, secHeader);
             fail("Failure expected on a bad localname");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_SIGNATURE);
         }
     }
     
@@ -398,7 +398,7 @@ public class SignaturePartsTest extends
             sign.build(doc, crypto, secHeader);
             fail("Failure expected on a bad namespace");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_SIGNATURE);
         }
     }
     
@@ -451,8 +451,8 @@ public class SignaturePartsTest extends
         assertFalse(actionResult.isEmpty());
         
         @SuppressWarnings("unchecked")
-        final java.util.List<WSDataRef> refs =
-            (java.util.List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
+        final List<WSDataRef> refs =
+            (List<WSDataRef>) actionResult.get(WSSecurityEngineResult.TAG_DATA_REF_URIS);
         assertTrue(refs != null && !refs.isEmpty());
         
         boolean foundFoo = false;

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/SignatureTest.java Tue Dec 15 15:52:41 2015
@@ -212,7 +212,7 @@ public class SignatureTest extends org.j
             newEngine.processSecurityHeader(doc, null, null, crypto);
             fail("Failure expected on a bad c14n algorithm");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         RequestData data = new RequestData();
@@ -476,10 +476,10 @@ public class SignatureTest extends org.j
         builder.getParts().add(encP);
         
         Document signedDoc = builder.build(createdDoc, crypto, secHeader);
-        org.w3c.dom.Element secHeaderElement = secHeader.getSecurityHeader();
-        org.w3c.dom.Node timestampNode = 
+        Element secHeaderElement = secHeader.getSecurityHeader();
+        Node timestampNode = 
             secHeaderElement.getElementsByTagNameNS(WSConstants.WSU_NS, "Timestamp").item(0);
-        ((org.w3c.dom.Element)timestampNode).setAttributeNS(
+        ((Element)timestampNode).setAttributeNS(
             WSConstants.XMLNS_NS, "xmlns", WSConstants.WSU_NS
         );
         
@@ -586,9 +586,9 @@ public class SignatureTest extends org.j
         Document signedDoc = builder.build(doc, crypto, secHeader);
         
         // Add a comment node as the first node element
-        org.w3c.dom.Node firstChild = signedDoc.getFirstChild();
-        org.w3c.dom.Node newNode = signedDoc.removeChild(firstChild);
-        org.w3c.dom.Node commentNode = signedDoc.createComment("This is a comment");
+        Node firstChild = signedDoc.getFirstChild();
+        Node newNode = signedDoc.removeChild(firstChild);
+        Node commentNode = signedDoc.createComment("This is a comment");
         signedDoc.appendChild(commentNode);
         signedDoc.appendChild(newNode);
 
@@ -907,7 +907,7 @@ public class SignatureTest extends org.j
         
         // Add a comment node
         Element body = WSSecurityUtil.findBodyElement(signedDoc);
-        org.w3c.dom.Node commentNode = signedDoc.createComment("This is a comment");
+        Node commentNode = signedDoc.createComment("This is a comment");
         body.getFirstChild().appendChild(commentNode);
 
         if (LOG.isDebugEnabled()) {

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TimestampTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TimestampTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TimestampTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TimestampTest.java Tue Dec 15 15:52:41 2015
@@ -157,7 +157,7 @@ public class TimestampTest extends org.j
             secEngine.processSecurityHeader(doc, requestData);
             fail("Failure expected on no Expires Element");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.SECURITY_ERROR); 
         }
 
         requestData.setWssConfig(WSSConfig.getNewInstance());
@@ -383,7 +383,7 @@ public class TimestampTest extends org.j
             verify(doc);
             fail("The timestamp validation should have failed");
         } catch (WSSecurityException ex) {
-            //
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.MESSAGE_EXPIRED); 
         }
     }
     
@@ -418,7 +418,7 @@ public class TimestampTest extends org.j
             verify(createdDoc);
             fail("Expected failure on multiple timestamps");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         verify(createdDoc, Collections.singletonList(BSPRule.R3227));
@@ -464,7 +464,7 @@ public class TimestampTest extends org.j
             verify(doc);
             fail("The timestamp validation should have failed on multiple Created elements");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         verify(doc, Collections.singletonList(BSPRule.R3203));
@@ -511,7 +511,7 @@ public class TimestampTest extends org.j
             verify(doc);
             fail("The timestamp validation should have failed on no Created element");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         List<BSPRule> rules = new ArrayList<>();
@@ -571,7 +571,7 @@ public class TimestampTest extends org.j
             verify(doc);
             fail("The timestamp validation should have failed on multiple Expires elements");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         verify(doc, Collections.singletonList(BSPRule.R3224));
@@ -625,7 +625,7 @@ public class TimestampTest extends org.j
             verify(doc);
             fail("The timestamp validation should have failed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         verify(doc, Collections.singletonList(BSPRule.R3221));
@@ -672,7 +672,7 @@ public class TimestampTest extends org.j
             verify(doc, wssConfig, new ArrayList<BSPRule>());
             fail("The timestamp validation should have failed");
         } catch (WSSecurityException ex) {
-            //assertTrue(ex.getMessage().contains("Unparseable date"));
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
     }
     
@@ -719,7 +719,7 @@ public class TimestampTest extends org.j
             verify(doc);
             fail("The timestamp validation should have failed");
         } catch (WSSecurityException ex) {
-            //
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         // Now it should pass...
@@ -783,7 +783,7 @@ public class TimestampTest extends org.j
             verify(doc);
             fail("The timestamp validation should have failed");
         } catch (WSSecurityException ex) {
-            //
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         // Now it should pass...

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTDerivedKeyTest.java Tue Dec 15 15:52:41 2015
@@ -174,7 +174,7 @@ public class UTDerivedKeyTest extends or
             verify(encryptedDoc, false);
             fail("Failure expected on deriving keys from a UsernameToken not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
     }
     
@@ -277,7 +277,6 @@ public class UTDerivedKeyTest extends or
             fail("Failure expected on a bad derived encryption");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_CHECK);
-            // expected
         }
     }
     
@@ -328,7 +327,6 @@ public class UTDerivedKeyTest extends or
             fail("Failure expected on a bad derived encryption");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
-            // expected
         }
     }
     
@@ -486,7 +484,6 @@ public class UTDerivedKeyTest extends or
             fail("Failure expected on a bad derived signature");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_CHECK);
-            // expected
         }
     }
     
@@ -532,7 +529,6 @@ public class UTDerivedKeyTest extends or
             fail("Failure expected on a bad derived signature");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
-            // expected
         }
     }
     
@@ -583,7 +579,7 @@ public class UTDerivedKeyTest extends or
             verify(encryptedDoc);
             fail("Failure expected on no salt element");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     
@@ -632,7 +628,7 @@ public class UTDerivedKeyTest extends or
             verify(encryptedDoc);
             fail("Failure expected on no iteration element");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN); 
         }
     }
     
@@ -682,7 +678,7 @@ public class UTDerivedKeyTest extends or
             verify(encryptedDoc);
             fail("Failure expected on a low iteration value");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
 
         RequestData data = new RequestData();
@@ -744,7 +740,7 @@ public class UTDerivedKeyTest extends or
             verify(encryptedDoc);
             fail("Failure expected on a bad value type");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         // Turn off BSP compliance and it should work
@@ -812,7 +808,7 @@ public class UTDerivedKeyTest extends or
             verify(encryptedDoc);
             fail("Failure expected on a key identifier");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         WSSecurityEngine newEngine = new WSSecurityEngine();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UTSignatureTest.java Tue Dec 15 15:52:41 2015
@@ -109,7 +109,7 @@ public class UTSignatureTest extends org
             verify(signedDoc, false);
             fail("Failure expected on deriving keys from a UsernameToken not allowed");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/UsernameTokenTest.java Tue Dec 15 15:52:41 2015
@@ -53,6 +53,8 @@ import org.apache.wss4j.dom.util.XmlSche
 import org.apache.xml.security.utils.Base64;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * WS-Security Test Case for UsernameTokens.
@@ -526,7 +528,7 @@ public class UsernameTokenTest extends o
             newEngine.processSecurityHeader(doc, null, callbackHandler, null);
             fail("Expected failure as it is not BSP compliant");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         RequestData data = new RequestData();
         data.setCallbackHandler(callbackHandler);
@@ -707,10 +709,10 @@ public class UsernameTokenTest extends o
         //
         // Manually find the Nonce node and set the content to null
         //
-        org.w3c.dom.Element elem = builder.getUsernameTokenElement();
-        org.w3c.dom.NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Nonce");
-        org.w3c.dom.Node nonceNode = list.item(0);
-        org.w3c.dom.Node childNode = nonceNode.getFirstChild();
+        Element elem = builder.getUsernameTokenElement();
+        NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Nonce");
+        Node nonceNode = list.item(0);
+        Node childNode = nonceNode.getFirstChild();
         childNode.setNodeValue("");
         
         if (LOG.isDebugEnabled()) {
@@ -750,10 +752,10 @@ public class UsernameTokenTest extends o
         //
         // Manually find the Created node and set the content to null
         //
-        org.w3c.dom.Element elem = builder.getUsernameTokenElement();
-        org.w3c.dom.NodeList list = elem.getElementsByTagNameNS(WSConstants.WSU_NS, "Created");
-        org.w3c.dom.Node nonceNode = list.item(0);
-        org.w3c.dom.Node childNode = nonceNode.getFirstChild();
+        Element elem = builder.getUsernameTokenElement();
+        NodeList list = elem.getElementsByTagNameNS(WSConstants.WSU_NS, "Created");
+        Node nonceNode = list.item(0);
+        Node childNode = nonceNode.getFirstChild();
         childNode.setNodeValue("");
         
         if (LOG.isDebugEnabled()) {
@@ -900,10 +902,10 @@ public class UsernameTokenTest extends o
         //
         // Manually find the Nonce node and duplicate it
         //
-        org.w3c.dom.Element elem = builder.getUsernameTokenElement();
-        org.w3c.dom.NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Nonce");
-        org.w3c.dom.Node nonceNode = list.item(0);
-        org.w3c.dom.Node nonceCopy = nonceNode.cloneNode(true);
+        Element elem = builder.getUsernameTokenElement();
+        NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Nonce");
+        Node nonceNode = list.item(0);
+        Node nonceCopy = nonceNode.cloneNode(true);
         nonceNode.getParentNode().insertBefore(nonceCopy, nonceNode);
         
         if (LOG.isDebugEnabled()) {
@@ -917,7 +919,7 @@ public class UsernameTokenTest extends o
             newEngine.processSecurityHeader(doc, null, callbackHandler, null);
             fail("Expected failure as it is not BSP compliant");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY      ); 
         }
 
         RequestData data = new RequestData();
@@ -943,10 +945,10 @@ public class UsernameTokenTest extends o
         //
         // Manually find the Created node and duplicate it
         //
-        org.w3c.dom.Element elem = builder.getUsernameTokenElement();
-        org.w3c.dom.NodeList list = elem.getElementsByTagNameNS(WSConstants.WSU_NS, "Created");
-        org.w3c.dom.Node createdNode = list.item(0);
-        org.w3c.dom.Node createdCopy = createdNode.cloneNode(true);
+        Element elem = builder.getUsernameTokenElement();
+        NodeList list = elem.getElementsByTagNameNS(WSConstants.WSU_NS, "Created");
+        Node createdNode = list.item(0);
+        Node createdCopy = createdNode.cloneNode(true);
         createdNode.getParentNode().insertBefore(createdCopy, createdNode);
         
         if (LOG.isDebugEnabled()) {
@@ -960,7 +962,7 @@ public class UsernameTokenTest extends o
             newEngine.processSecurityHeader(doc, null, callbackHandler, null);
             fail("Expected failure as it is not BSP compliant");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         RequestData data = new RequestData();
@@ -986,10 +988,10 @@ public class UsernameTokenTest extends o
         //
         // Manually find the Nonce node and duplicate it
         //
-        org.w3c.dom.Element elem = builder.getUsernameTokenElement();
-        org.w3c.dom.NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Password");
-        org.w3c.dom.Node passwordNode = list.item(0);
-        org.w3c.dom.Node passwordCopy = passwordNode.cloneNode(true);
+        Element elem = builder.getUsernameTokenElement();
+        NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Password");
+        Node passwordNode = list.item(0);
+        Node passwordCopy = passwordNode.cloneNode(true);
         passwordNode.getParentNode().insertBefore(passwordCopy, passwordNode);
         
         if (LOG.isDebugEnabled()) {
@@ -1003,7 +1005,7 @@ public class UsernameTokenTest extends o
             newEngine.processSecurityHeader(doc, null, callbackHandler, null);
             fail("Expected failure as it is not BSP compliant");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         RequestData data = new RequestData();
@@ -1029,10 +1031,10 @@ public class UsernameTokenTest extends o
         //
         // Manually find the Nonce node and duplicate it
         //
-        org.w3c.dom.Element elem = builder.getUsernameTokenElement();
-        org.w3c.dom.NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Nonce");
-        org.w3c.dom.Node nonceNode = list.item(0);
-        ((org.w3c.dom.Element)nonceNode).setAttributeNS(
+        Element elem = builder.getUsernameTokenElement();
+        NodeList list = elem.getElementsByTagNameNS(WSConstants.WSSE_NS, "Nonce");
+        Node nonceNode = list.item(0);
+        ((Element)nonceNode).setAttributeNS(
             null, "EncodingType", "http://bad_encoding_type"
         );
         
@@ -1047,7 +1049,7 @@ public class UsernameTokenTest extends o
             newEngine.processSecurityHeader(doc, null, callbackHandler, null);
             fail("Expected failure as it is not BSP compliant");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         RequestData data = new RequestData();

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BSTKerberosTest.java Tue Dec 15 15:52:41 2015
@@ -245,7 +245,7 @@ public class BSTKerberosTest extends org
             customEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
             fail("Failure expected on a bad token");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION); 
         }
     }
     

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/BinarySecurityTokenTest.java Tue Dec 15 15:52:41 2015
@@ -165,7 +165,7 @@ public class BinarySecurityTokenTest ext
             secEngine.processSecurityHeader(doc, null, null, crypto);
             fail("Expected failure on no ValueType");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         
         doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/DerivedKeyTokenTest.java Tue Dec 15 15:52:41 2015
@@ -81,7 +81,7 @@ public class DerivedKeyTokenTest extends
     @org.junit.Test
     public void testHashcode() throws Exception{
         assertEquals(token.hashCode(), tokenEqual.hashCode());
-        assertFalse((token.hashCode() == tokenNotEqual.hashCode()));
+        assertFalse(token.hashCode() == tokenNotEqual.hashCode());
     }
 
     private static org.w3c.dom.Document createReferenceDocument(

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java?rev=1720185&r1=1720184&r2=1720185&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/ReferenceTest.java Tue Dec 15 15:52:41 2015
@@ -22,6 +22,7 @@ package org.apache.wss4j.dom.message.tok
 import org.apache.wss4j.common.ext.WSSecurityException;
 import org.apache.wss4j.common.token.Reference;
 import org.apache.wss4j.dom.common.SecurityTestUtil;
+import org.apache.wss4j.dom.engine.WSSConfig;
 
 /**
  * unit test for the Reference type
@@ -61,20 +62,20 @@ public class ReferenceTest extends org.j
         ref = new Reference (createReferenceDocument(TEST_REFERENCE_TEMPLATE, "test", "equalscheck").getDocumentElement());
         refEqual = new Reference (createReferenceDocument(TEST_REFERENCE_TEMPLATE, "test", "equalscheck").getDocumentElement());
         refNotEqual = new Reference (createReferenceDocument(TEST_REFERENCE_TEMPLATE, "test", "unequalscheck").getDocumentElement());
+        WSSConfig.init();
     }
     
  
     @org.junit.Test
-    public void
-    testConstructor() throws Exception {
+    public void testConstructor() throws Exception {
         //
         // null input
         //
         try {
             new Reference((org.w3c.dom.Element) null);
             fail("Expected failure on null Element passed to ctor");
-        } catch (final WSSecurityException e) {
-            // complete
+        } catch (final WSSecurityException ex) {
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY); 
         }
         //
         // The XML doesn't conform to the WSS namespace
@@ -87,8 +88,8 @@ public class ReferenceTest extends org.j
                 ).getDocumentElement()
             );
             fail("Expected failure on bogus template");
-        } catch (final Exception e) {
-            // complete
+        } catch (final WSSecurityException ex) {
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
         //
         // create a Reference from valid XML
@@ -132,7 +133,7 @@ public class ReferenceTest extends org.j
     @org.junit.Test
     public void testHashcode() throws Exception{
         assertEquals(ref.hashCode(), refEqual.hashCode());
-        assertFalse((ref.hashCode() == refNotEqual.hashCode()));
+        assertFalse(ref.hashCode() == refNotEqual.hashCode());
     }
     
     private static org.w3c.dom.Document



Mime
View raw message