Author: coheigea
Date: Tue Jan 14 13:16:46 2014
New Revision: 1558029

URL: http://svn.apache.org/r1558029
Log:
Adding more policy error message checking

Modified:
    
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/binarysecuritytoken/BinarySecurityTokenTest.java
    
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/usernametoken/UsernameTokenTest.java
    
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
    
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenPolicyTest.java
    
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java
    
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java

Modified: 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/binarysecuritytoken/BinarySecurityTokenTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/binarysecuritytoken/BinarySecurityTokenTest.java?rev=1558029&r1=1558028&r2=1558029&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/binarysecuritytoken/BinarySecurityTokenTest.java
 (original)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/binarysecuritytoken/BinarySecurityTokenTest.java
 Tue Jan 14 13:16:46 2014
@@ -157,11 +157,9 @@ public class BinarySecurityTokenTest ext
             fail("Expected failure on a bad cert");
         } catch (javax.xml.ws.soap.SOAPFaultException fault) {
             String message = fault.getMessage();
-            if (!test.isStreaming()) {
-                assertTrue(message.contains("STS Authentication failed")
-                    || message.contains("Validation of security token failed")
-                    || message.contains("PolicyViolationException"));
-            }
+            assertTrue(message.contains("STS Authentication failed")
+                || message.contains("Validation of security token failed")
+                || message.contains("PolicyViolationException"));
         }
         
         ((java.io.Closeable)asymmetricBSTPort).close();

Modified: 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/usernametoken/UsernameTokenTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/usernametoken/UsernameTokenTest.java?rev=1558029&r1=1558028&r2=1558029&view=diff
==============================================================================
--- 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/usernametoken/UsernameTokenTest.java
 (original)
+++ 
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/usernametoken/UsernameTokenTest.java
 Tue Jan 14 13:16:46 2014
@@ -155,12 +155,10 @@ public class UsernameTokenTest extends A
             doubleIt(transportUTPort, 30);
             fail("Expected failure on a bad password");
         } catch (javax.xml.ws.soap.SOAPFaultException fault) {
-            if (!test.isStreaming()) {
-                String message = fault.getMessage();
-                assertTrue(message.contains("STS Authentication failed")
-                    || message.contains("Validation of security token failed")
-                    || message.contains("PolicyViolationException"));
-            }
+            String message = fault.getMessage();
+            assertTrue(message.contains("STS Authentication failed")
+                || message.contains("Validation of security token failed")
+                || message.contains("PolicyViolationException"));
         }
         
         ((java.io.Closeable)transportUTPort).close();

Modified: 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java?rev=1558029&r1=1558028&r2=1558029&view=diff
==============================================================================
--- 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
 (original)
+++ 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/tokens/SupportingTokenTest.java
 Tue Jan 14 13:16:46 2014
@@ -123,11 +123,9 @@ public class SupportingTokenTest extends
             port.doubleIt(25);
             fail("Failure expected on not signing the UsernameToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "The received token does not match the signed 
supporting token requirement";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = "The received token does not match the signed 
supporting token requirement";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
         }
         
         // This should fail, as the client is (encrypting) but not signing the 
UsernameToken
@@ -143,11 +141,9 @@ public class SupportingTokenTest extends
             port.doubleIt(25);
             fail("Failure expected on not signing the UsernameToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "The received token does not match the signed 
supporting token requirement";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = "The received token does not match the signed 
supporting token requirement";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
         }
         
         ((java.io.Closeable)port).close();
@@ -191,11 +187,9 @@ public class SupportingTokenTest extends
             port.doubleIt(25);
             fail("Failure expected on not encrypting the UsernameToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "The received token does not match the 
encrypted supporting token requirement";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = "The received token does not match the encrypted 
supporting token requirement";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
         }
         
         // This should fail, as the client is (signing) but not encrypting the 
UsernameToken
@@ -211,11 +205,9 @@ public class SupportingTokenTest extends
             port.doubleIt(25);
             fail("Failure expected on not encrypting the UsernameToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "The received token does not match the 
encrypted supporting token requirement";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = "The received token does not match the encrypted 
supporting token requirement";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
         }
         
         ((java.io.Closeable)port).close();
@@ -259,12 +251,10 @@ public class SupportingTokenTest extends
             port.doubleIt(25);
             fail("Failure expected on not encrypting the UsernameToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = 
-                    "The received token does not match the signed encrypted 
supporting token requirement";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = 
+                "The received token does not match the signed encrypted 
supporting token requirement";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
         }
         
         // This should fail, as the client is (encrypting) but not signing the 
UsernameToken
@@ -280,12 +270,10 @@ public class SupportingTokenTest extends
             port.doubleIt(25);
             fail("Failure expected on not encrypting the UsernameToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = 
-                    "The received token does not match the signed encrypted 
supporting token requirement";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = 
+                "The received token does not match the signed encrypted 
supporting token requirement";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
         }
         
         ((java.io.Closeable)port).close();

Modified: 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenPolicyTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenPolicyTest.java?rev=1558029&r1=1558028&r2=1558029&view=diff
==============================================================================
--- 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenPolicyTest.java
 (original)
+++ 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenPolicyTest.java
 Tue Jan 14 13:16:46 2014
@@ -121,11 +121,9 @@ public class UsernameTokenPolicyTest ext
             port.doubleIt(25);
             fail("Failure expected on not sending a UsernameToken Supporting 
Token");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "These policy alternatives can not be 
satisfied";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = "These policy alternatives can not be satisfied";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
         }
         
         ((java.io.Closeable)port).close();
@@ -168,11 +166,9 @@ public class UsernameTokenPolicyTest ext
             port.doubleIt(25);
             fail("Failure expected on a hashed password");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "These policy alternatives can not be 
satisfied";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("password must not be 
hashed"));
-            }
+            String error = "These policy alternatives can not be satisfied";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("password must not be 
hashed"));
         }
         
         // This should fail, as the client is not sending any password
@@ -231,11 +227,9 @@ public class UsernameTokenPolicyTest ext
             port.doubleIt(25);
             fail("Failure expected on a plaintext password");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "These policy alternatives can not be 
satisfied";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken does not 
contain a hashed password"));
-            }
+            String error = "These policy alternatives can not be satisfied";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken does not 
contain a hashed password"));
         }
         
         // This should fail, as the client is not sending any password
@@ -294,11 +288,9 @@ public class UsernameTokenPolicyTest ext
             port.doubleIt(25);
             fail("Failure expected on not sending a Created element");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "These policy alternatives can not be 
satisfied";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken does not 
contain a created"));
-            }
+            String error = "These policy alternatives can not be satisfied";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken does not 
contain a created"));
         }
         
         ((java.io.Closeable)port).close();
@@ -341,11 +333,9 @@ public class UsernameTokenPolicyTest ext
             port.doubleIt(25);
             fail("Failure expected on not sending a Nonce element");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "These policy alternatives can not be 
satisfied";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("UsernameToken does not 
contain a nonce"));
-            }
+            String error = "These policy alternatives can not be satisfied";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("UsernameToken does not 
contain a nonce"));
         }
         
         ((java.io.Closeable)port).close();

Modified: 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java?rev=1558029&r1=1558028&r2=1558029&view=diff
==============================================================================
--- 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java
 (original)
+++ 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java
 Tue Jan 14 13:16:46 2014
@@ -330,11 +330,9 @@ public class UsernameTokenTest extends A
             utPort.doubleIt(25);
             fail("Failure expected on no UsernameToken");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "The received token does not match the token 
inclusion requirement";
-                assertTrue(ex.getMessage().contains(error)
-                       || ex.getMessage().contains("UsernameToken not 
satisfied"));
-            }
+            String error = "The received token does not match the token 
inclusion requirement";
+            assertTrue(ex.getMessage().contains(error)
+                   || ex.getMessage().contains("UsernameToken not satisfied"));
         }
 
         ((java.io.Closeable)utPort).close();
@@ -452,10 +450,8 @@ public class UsernameTokenTest extends A
             utPort.doubleIt(30);
             fail("Failure expected on a user with the wrong role");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "Unauthorized";
-                assertTrue(ex.getMessage().contains(error));
-            }
+            String error = "Unauthorized";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)utPort).close();

Modified: 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java?rev=1558029&r1=1558028&r2=1558029&view=diff
==============================================================================
--- 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
 (original)
+++ 
cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
 Tue Jan 14 13:16:46 2014
@@ -1177,11 +1177,9 @@ public class X509TokenTest extends Abstr
             x509Port.doubleIt(25);
             fail("Failure expected on not endorsing the token");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "These policy alternatives can not be 
satisfied";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("X509Token not 
satisfied"));
-            }
+            String error = "These policy alternatives can not be satisfied";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("X509Token not satisfied"));
         }
         
         ((java.io.Closeable)x509Port).close();


Reply via email to