ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1720187 [2/2] - in /webservices/wss4j/branches/2_1_x-fixes: ./ 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/...
Date Tue, 15 Dec 2015 16:08:33 GMT
Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/SecurityTokenReferenceTest.java
Tue Dec 15 16:08:32 2015
@@ -30,6 +30,7 @@ import org.apache.wss4j.common.util.DOM2
 import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.common.SOAPUtil;
 import org.apache.wss4j.dom.common.SecurityTestUtil;
+import org.apache.wss4j.dom.engine.WSSConfig;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -45,6 +46,10 @@ public class SecurityTokenReferenceTest
         SecurityTestUtil.cleanup();
     }
     
+    public SecurityTokenReferenceTest() {
+        WSSConfig.init();
+    }
+    
     /**
      * Test for a Reference with no URI
      */
@@ -102,7 +107,7 @@ public class SecurityTokenReferenceTest
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on multiple data references");
         } catch (WSSecurityException ex) {
-            // Expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
         
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3061));
@@ -132,7 +137,7 @@ public class SecurityTokenReferenceTest
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on a Key Identifier with no ValueType");
         } catch (WSSecurityException ex) {
-            // Expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
         
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3054));
@@ -166,7 +171,7 @@ public class SecurityTokenReferenceTest
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on a Key Identifier with a Bad EncodingType");
         } catch (WSSecurityException ex) {
-            // Expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
         
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3071));
@@ -200,7 +205,7 @@ public class SecurityTokenReferenceTest
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on a Key Identifier with no EncodingType");
         } catch (WSSecurityException ex) {
-            // Expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
         
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3070));
@@ -262,7 +267,7 @@ public class SecurityTokenReferenceTest
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on an Embedded Child with a SecurityTokenReference child");
         } catch (WSSecurityException ex) {
-            // Expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
         
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3056));
@@ -299,7 +304,7 @@ public class SecurityTokenReferenceTest
             new SecurityTokenReference(strElement,bspEnforcer);
             fail("Failure expected on an Embedded Child with multiple children");
         } catch (WSSecurityException ex) {
-            // Expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
         
         bspEnforcer.setIgnoredBSPRules(Collections.singletonList(BSPRule.R3060));

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/token/WCFUsernameTokenTest.java
Tue Dec 15 16:08:32 2015
@@ -90,7 +90,7 @@ public class WCFUsernameTokenTest extend
             verify(doc);
             fail("Failure expected on a bad password type");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
     }
     

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/SecurityHeaderTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/SecurityHeaderTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/SecurityHeaderTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/SecurityHeaderTest.java
Tue Dec 15 16:08:32 2015
@@ -98,7 +98,7 @@ public class SecurityHeaderTest extends
             secEngine.processSecurityHeader(doc, null, null, null);
             fail("Failure expected on a null actor");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
     }
     
@@ -112,7 +112,7 @@ public class SecurityHeaderTest extends
             secEngine.processSecurityHeader(doc, "user", null, null);
             fail("Failure expected on a duplicate actor");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.INVALID_SECURITY);

         }
     }
     

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAlgorithmSuiteTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAlgorithmSuiteTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAlgorithmSuiteTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAlgorithmSuiteTest.java
Tue Dec 15 16:08:32 2015
@@ -91,15 +91,15 @@ public class SamlAlgorithmSuiteTest exte
         Element securityHeader = WSSecurityUtil.getSecurityHeader(signedDoc, null);
         AlgorithmSuite algorithmSuite = createAlgorithmSuite();
         
-        verify(securityHeader, algorithmSuite, crypto, false);
+        verify(securityHeader, algorithmSuite, crypto);
         
         algorithmSuite.setMinimumAsymmetricKeyLength(1024);
         
         try {
-            verify(securityHeader, algorithmSuite, crypto, false);
+            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);

         }
     }
     
@@ -136,14 +136,14 @@ public class SamlAlgorithmSuiteTest exte
         AlgorithmSuite algorithmSuite = createAlgorithmSuite();
         
         try {
-            verify(securityHeader, algorithmSuite, dsaCrypto, false);
+            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);
-        verify(securityHeader, algorithmSuite, dsaCrypto, false);
+        verify(securityHeader, algorithmSuite, dsaCrypto);
     }
     
     @org.junit.Test
@@ -179,14 +179,14 @@ public class SamlAlgorithmSuiteTest exte
         AlgorithmSuite algorithmSuite = createAlgorithmSuite();
         
         try {
-            verify(securityHeader, algorithmSuite, crypto, false);
+            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);
-        verify(securityHeader, algorithmSuite, crypto, false);
+        verify(securityHeader, algorithmSuite, crypto);
     }
 
     private AlgorithmSuite createAlgorithmSuite() {
@@ -200,8 +200,7 @@ public class SamlAlgorithmSuiteTest exte
     }
 
     private WSHandlerResult verify(
-        Element securityHeader, AlgorithmSuite algorithmSuite, Crypto sigVerCrypto,
-        boolean saml2
+        Element securityHeader, AlgorithmSuite algorithmSuite, Crypto sigVerCrypto
     ) throws Exception {
         WSSecurityEngine secEngine = new WSSecurityEngine();
         RequestData data = new RequestData();

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAuthnTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAuthnTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAuthnTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlAuthnTest.java
Tue Dec 15 16:08:32 2015
@@ -118,7 +118,7 @@ public class SamlAuthnTest extends org.j
         callbackHandler.setStatement(SAML1CallbackHandler.Statement.AUTHN);
         callbackHandler.setIssuer("www.example.com");
         
-        callbackHandler.setSubjectLocality("127.0.0.1", "xyz.ws.apache.org");
+        callbackHandler.setSubjectLocality("127.0.0.1", "xyz.ws.apache.org");   //NOPMD
         
         createAndVerifyMessage(callbackHandler, true);
     }
@@ -129,7 +129,7 @@ public class SamlAuthnTest extends org.j
         callbackHandler.setStatement(SAML1CallbackHandler.Statement.AUTHN);
         callbackHandler.setIssuer("www.example.com");
         
-        callbackHandler.setSubjectLocality("127.0.0.1", "xyz.ws.apache.org");
+        callbackHandler.setSubjectLocality("127.0.0.1", "xyz.ws.apache.org");   //NOPMD
         
         createAndVerifyMessage(callbackHandler, true);
     }

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlConditionsTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlConditionsTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlConditionsTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlConditionsTest.java
Tue Dec 15 16:08:32 2015
@@ -501,7 +501,7 @@ public class SamlConditionsTest extends
             newEngine.processSecurityHeader(doc, data);
             fail("Failure expected on a bad audience restriction");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getMessage().contains("SAML token security failure"));
         }
         
         // Now add the correct audience back in...
@@ -561,7 +561,7 @@ public class SamlConditionsTest extends
             newEngine.processSecurityHeader(doc, data);
             fail("Failure expected on a bad audience restriction");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getMessage().contains("SAML token security failure"));
         }
         
         // Now add the correct audience back in...
@@ -674,7 +674,7 @@ public class SamlConditionsTest extends
             newEngine.processSecurityHeader(doc, data);
             fail("Failure expected on a bad audience restriction");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getMessage().contains("SAML token security failure"));
         }
         
         // Now add the correct audience back in...

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlNegativeTest.java
Tue Dec 15 16:08:32 2015
@@ -130,7 +130,7 @@ public class SamlNegativeTest extends or
         //
         Element envelope = signedDoc.getDocumentElement();
         NodeList list = envelope.getElementsByTagNameNS(WSConstants.SAML2_NS, "Assertion");
-        Element assertionElement = (org.w3c.dom.Element)list.item(0);
+        Element assertionElement = (Element)list.item(0);
         assertionElement.setAttributeNS(null, "MinorVersion", "5");
 
         if (LOG.isDebugEnabled()) {
@@ -143,8 +143,8 @@ public class SamlNegativeTest extends or
         try {
             verify(signedDoc, trustCrypto);
             fail("Failure expected on a modified SAML Assertion");
-        } catch (Exception ex) {
-            // expected
+        } catch (WSSecurityException ex) {
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_CHECK);

         }
     }
     
@@ -180,11 +180,11 @@ public class SamlNegativeTest extends or
         //
         Element envelope = signedDoc.getDocumentElement();
         NodeList list = envelope.getElementsByTagNameNS(WSConstants.SAML_NS, "Assertion");
-        Element assertionElement = (org.w3c.dom.Element)list.item(0);
+        Element assertionElement = (Element)list.item(0);
         list = assertionElement.getElementsByTagNameNS(WSConstants.SIG_NS, "Signature");
-        Element sigElement = (org.w3c.dom.Element)list.item(0);
+        Element sigElement = (Element)list.item(0);
         list = sigElement.getElementsByTagNameNS(WSConstants.SIG_NS, "Transform");
-        Element transformElement = (org.w3c.dom.Element)list.item(0);
+        Element transformElement = (Element)list.item(0);
         transformElement.setAttributeNS(null, "Algorithm", WSConstants.C14N_EXCL_OMIT_COMMENTS);
         
         if (LOG.isDebugEnabled()) {
@@ -198,7 +198,7 @@ public class SamlNegativeTest extends or
             verify(signedDoc, trustCrypto);
             fail("Expected failure on a modified signature");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     
@@ -231,7 +231,7 @@ public class SamlNegativeTest extends or
         //
         Element envelope = signedDoc.getDocumentElement();
         NodeList list = envelope.getElementsByTagNameNS(WSConstants.SAML2_NS, "Assertion");
-        Element assertionElement = (org.w3c.dom.Element)list.item(0);
+        Element assertionElement = (Element)list.item(0);
         assertionElement.setAttributeNS(null, "MinorVersion", "5");
         
         if (LOG.isDebugEnabled()) {
@@ -245,7 +245,7 @@ public class SamlNegativeTest extends or
             verify(signedDoc, trustCrypto);
             fail("Expected failure on a modified signature");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     
@@ -284,7 +284,7 @@ public class SamlNegativeTest extends or
             verify(signedDoc, trustCrypto);
             fail("Expected failure on a holder-of-key confirmation method with no KeyInfo");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     
@@ -327,7 +327,7 @@ public class SamlNegativeTest extends or
             verify(signedDoc, trustCrypto);
             fail("Expected failure on an unsigned assertion with holder-of-key confirmation
method");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getMessage().contains("SAML token security failure"));
         }
     }
     
@@ -375,7 +375,7 @@ public class SamlNegativeTest extends or
             verify(signedDoc, trustCrypto);
             fail ("Failure expected on an untrusted signed assertion");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
     }
     

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlReferenceTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlReferenceTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlReferenceTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlReferenceTest.java
Tue Dec 15 16:08:32 2015
@@ -385,8 +385,8 @@ public class SamlReferenceTest extends o
         //
         // Remove the assertion its place in the security header and then append it
         //
-        org.w3c.dom.Element secHeaderElement = secHeader.getSecurityHeader();
-        org.w3c.dom.Node assertionNode = 
+        Element secHeaderElement = secHeader.getSecurityHeader();
+        Node assertionNode = 
             secHeaderElement.getElementsByTagNameNS(WSConstants.SAML_NS, "Assertion").item(0);
         secHeaderElement.removeChild(assertionNode);
         secHeaderElement.appendChild(assertionNode);

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenCustomSignatureTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenCustomSignatureTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenCustomSignatureTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenCustomSignatureTest.java
Tue Dec 15 16:08:32 2015
@@ -109,7 +109,7 @@ public class SamlTokenCustomSignatureTes
             verify(doc);
             fail("Failure expected on a signature that doesn't conform with the signature
profile");
         } catch (WSSecurityException ex) {
-            // expected failure
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
         
         // This should pass as we are disabling signature profile validation in the Validator
@@ -150,7 +150,7 @@ public class SamlTokenCustomSignatureTes
             verify(doc);
             fail("Failure expected on a signature that doesn't conform with the signature
profile");
         } catch (WSSecurityException ex) {
-            // expected failure
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
         
         // This should pass as we are disabling signature profile validation in the Validator

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/SamlTokenTest.java
Tue Dec 15 16:08:32 2015
@@ -89,6 +89,7 @@ public class SamlTokenTest extends org.j
     private static final org.slf4j.Logger LOG = 
         org.slf4j.LoggerFactory.getLogger(SamlTokenTest.class);
     private WSSecurityEngine secEngine = new WSSecurityEngine();
+    private static final String IP_ADDRESS = "12.34.56.78"; //NOPMD
     
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
@@ -406,7 +407,7 @@ public class SamlTokenTest extends org.j
         SAML1CallbackHandler callbackHandler = new SAML1CallbackHandler();
         callbackHandler.setStatement(SAML1CallbackHandler.Statement.AUTHN);
         callbackHandler.setIssuer("www.example.com");
-        callbackHandler.setSubjectLocality("12.34.56.78", "test-dns");
+        callbackHandler.setSubjectLocality(IP_ADDRESS, "test-dns");
         
         SAMLCallback samlCallback = new SAMLCallback();
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
@@ -426,7 +427,7 @@ public class SamlTokenTest extends org.j
             LOG.debug("SAML 1.1 Authn Assertion (sender vouches):");
             LOG.debug(outputString);
         }
-        assertTrue(outputString.contains("12.34.56.78"));
+        assertTrue(outputString.contains(IP_ADDRESS));
         assertTrue(outputString.contains("test-dns"));
         
         WSHandlerResult results = verify(unsignedDoc);
@@ -489,7 +490,7 @@ public class SamlTokenTest extends org.j
         SAML2CallbackHandler callbackHandler = new SAML2CallbackHandler();
         callbackHandler.setStatement(SAML2CallbackHandler.Statement.AUTHN);
         callbackHandler.setIssuer("www.example.com");
-        callbackHandler.setSubjectLocality("12.34.56.78", "test-dns");
+        callbackHandler.setSubjectLocality(IP_ADDRESS, "test-dns");
         
         SAMLCallback samlCallback = new SAMLCallback();
         SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
@@ -509,7 +510,7 @@ public class SamlTokenTest extends org.j
             LOG.debug("SAML 2 Authn Assertion (sender vouches):");
             LOG.debug(outputString);
         }
-        assertTrue(outputString.contains("12.34.56.78"));
+        assertTrue(outputString.contains(IP_ADDRESS));
         assertTrue(outputString.contains("test-dns"));
         
         WSHandlerResult results = verify(unsignedDoc);
@@ -945,7 +946,7 @@ public class SamlTokenTest extends org.j
             newEngine.processSecurityHeader(unsignedDoc, null, null, null);
             fail("Failure expected on an incorrect subject confirmation method");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE);
         }
     }
     
@@ -973,7 +974,7 @@ public class SamlTokenTest extends org.j
             newEngine.processSecurityHeader(unsignedDoc, null, null, null);
             fail("Failure expected on an unknown subject confirmation method");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE);
         }
 
         // Now disable this check
@@ -1015,7 +1016,7 @@ public class SamlTokenTest extends org.j
             newEngine.processSecurityHeader(unsignedDoc, null, null, null);
             fail("Failure expected on an unsigned bearer token");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE);
         }
 
         // Now disable this check

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/saml/ext/AssertionSigningTest.java
Tue Dec 15 16:08:32 2015
@@ -48,7 +48,7 @@ import org.w3c.dom.Element;
  * SamlAssertionWrapper class implementation.
  */
 
-public class AssertionSigningTest extends org.junit.Assert {
+public class AssertionSigningTest extends Assert {
 
     private Crypto issuerCrypto = null;
     // Default Canonicalization algorithm used by SamlAssertionWrapper class.

Modified: webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/validate/ValidatorTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/validate/ValidatorTest.java?rev=1720187&r1=1720186&r2=1720187&view=diff
==============================================================================
--- webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/validate/ValidatorTest.java
(original)
+++ webservices/wss4j/branches/2_1_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/validate/ValidatorTest.java
Tue Dec 15 16:08:32 2015
@@ -134,7 +134,7 @@ public class ValidatorTest extends org.j
             newEngine.processSecurityHeader(signedDoc, data);
             fail("Failure expected on issuer serial");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
         
         // Now switch out the default signature validator
@@ -172,7 +172,6 @@ public class ValidatorTest extends org.j
             fail("Failure expected on a bad password text");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
-            // expected
         }
         
         // Now switch out the default UsernameToken validator
@@ -257,7 +256,7 @@ public class ValidatorTest extends org.j
             secEngine.processSecurityHeader(doc, null, null, crypto);
             fail("Expected failure on untrusted signature");
         } catch (WSSecurityException ex) {
-            // expected
+            assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.FAILURE); 
         }
         
         config.setValidator(WSConstants.BINARY_TOKEN, new BSTValidator());



Mime
View raw message