cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1557771 - in /cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws: bindings/BindingPropertiesTest.java https/HttpsTokenTest.java parts/PartsTest.java saml/SamlTokenTest.java
Date Mon, 13 Jan 2014 16:58:06 GMT
Author: coheigea
Date: Mon Jan 13 16:58:06 2014
New Revision: 1557771

URL: http://svn.apache.org/r1557771
Log:
Checking for policy exception messages in some streaming tests

Modified:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java?rev=1557771&r1=1557770&r2=1557771&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/bindings/BindingPropertiesTest.java
Mon Jan 13 16:58:06 2014
@@ -123,10 +123,8 @@ public class BindingPropertiesTest exten
             port.doubleIt(25);
             fail("Failure expected on OnlySignEntireHeadersAndBody property");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "OnlySignEntireHeadersAndBody";
-                assertTrue(ex.getMessage().contains(error));
-            }
+            String error = "OnlySignEntireHeadersAndBody";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)port).close();
@@ -170,11 +168,9 @@ public class BindingPropertiesTest exten
             port.doubleIt(25);
             fail("Failure expected on not encrypting the signature property");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "The signature is not protected";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("Signature must be encrypted"));
-            }
+            String error = "The signature is not protected";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("Signature must be encrypted"));
         }
         
         ((java.io.Closeable)port).close();
@@ -218,11 +214,9 @@ public class BindingPropertiesTest exten
             port.doubleIt(25);
             fail("Failure expected on not sending a Timestamp");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "Received Timestamp does not match the requirements";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("Timestamp must be present"));
-            }
+            String error = "Received Timestamp does not match the requirements";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("Timestamp must be present"));
         }
         
         ((java.io.Closeable)port).close();
@@ -266,11 +260,9 @@ public class BindingPropertiesTest exten
             port.doubleIt(25);
             fail("Failure expected on not encrypting before signing");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "Not encrypted before signed";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("EncryptBeforeSigning"));
-            }
+            String error = "Not encrypted before signed";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("EncryptBeforeSigning"));
         }
         
         ((java.io.Closeable)port).close();
@@ -315,11 +307,9 @@ public class BindingPropertiesTest exten
             port.doubleIt(25);
             fail("Failure expected on not signing before encrypting");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "Not signed before encrypted";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("SignBeforeEncrypting"));
-            }
+            String error = "Not signed before encrypted";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("SignBeforeEncrypting"));
         }
         
         ((java.io.Closeable)port).close();
@@ -422,10 +412,8 @@ public class BindingPropertiesTest exten
                 fail("Failure expected on sending the timestamp first");
             }
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "Layout does not match the requirements";
-                assertTrue(ex.getMessage().contains(error));
-            }
+            String error = "Layout does not match the requirements";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)port).close();
@@ -475,10 +463,8 @@ public class BindingPropertiesTest exten
                 fail("Failure expected on sending the timestamp last");
             }
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "Layout does not match the requirements";
-                assertTrue(ex.getMessage().contains(error));
-            }
+            String error = "Layout does not match the requirements";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)port).close();
@@ -574,10 +560,9 @@ public class BindingPropertiesTest exten
             port.doubleIt(25);
             fail("Failure expected on not enabling SignatureConfirmation");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "Check Signature confirmation";
-                assertTrue(ex.getMessage().contains(error));
-            }
+            String error = "Check Signature confirmation";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("SignatureConfirmation must be present"));
         }
         
         ((java.io.Closeable)port).close();

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java?rev=1557771&r1=1557770&r2=1557771&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/https/HttpsTokenTest.java
Mon Jan 13 16:58:06 2014
@@ -121,7 +121,7 @@ public class HttpsTokenTest extends Abst
             port.doubleIt(25);
             fail("Failure expected on not using a client cert");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming() && !STAX_PORT.equals(test.getPort())) {
+            if (!STAX_PORT.equals(test.getPort())) {
                 String error = "HttpsToken";
                 assertTrue(ex.getMessage().contains(error));
             }
@@ -167,7 +167,7 @@ public class HttpsTokenTest extends Abst
             port.doubleIt(25);
             fail("Failure expected on not sending a UsernamePassword");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming() && !STAX_PORT.equals(test.getPort())) {
+            if (!STAX_PORT.equals(test.getPort())) {
                 String error = "HttpsToken";
                 assertTrue(ex.getMessage().contains(error));
             }

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java?rev=1557771&r1=1557770&r2=1557771&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java
Mon Jan 13 16:58:06 2014
@@ -90,7 +90,6 @@ public class PartsTest extends AbstractB
     }
     
     @org.junit.Test
-    @org.junit.Ignore
     public void testSOAPFaultError() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();
@@ -162,10 +161,8 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a required header which isn't present");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "RequiredParts: No header element";
-                assertTrue(ex.getMessage().contains(error) || ex.getMessage().contains("ToTo"));
-            }
+            String error = "RequiredParts: No header element";
+            assertTrue(ex.getMessage().contains(error) || ex.getMessage().contains("ToTo"));
         }
 
         ((java.io.Closeable)port).close();
@@ -209,11 +206,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a required header which isn't present");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "RequiredElements: No header element";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("ToTo must be present"));
-            }
+            String error = "RequiredElements: No header element";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("ToTo must be present"));
         }
         
         ((java.io.Closeable)port).close();
@@ -257,11 +252,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a body which isn't signed");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "SignedParts";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("Body must be signed"));
-            }
+            String error = "SignedParts";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("Body must be signed"));
         }
         
         // This should fail, as the service requires that the To header must be signed
@@ -277,11 +270,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a header which isn't signed");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "SignedParts";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("To must be signed"));
-            }
+            String error = "SignedParts";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("To must be signed"));
         }
         
         ((java.io.Closeable)port).close();
@@ -325,11 +316,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a header which isn't signed");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "SignedElements";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("To must be signed"));
-            }
+            String error = "SignedElements";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("To must be signed"));
         }
         
         ((java.io.Closeable)port).close();
@@ -373,11 +362,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a body which isn't encrypted");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "EncryptedParts";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("Body must be encrypted"));
-            }
+            String error = "EncryptedParts";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("Body must be encrypted"));
         }
         
         // This should fail, as the service requires that the To header must be encrypted
@@ -393,11 +380,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a header which isn't encrypted");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "EncryptedParts";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("To must be encrypted"));
-            }
+            String error = "EncryptedParts";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("To must be encrypted"));
         }
         
         ((java.io.Closeable)port).close();
@@ -441,11 +426,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a header which isn't encrypted");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "EncryptedElements";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("To must be encrypted"));
-            }
+            String error = "EncryptedElements";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("To must be encrypted"));
         }
         
         ((java.io.Closeable)port).close();
@@ -489,11 +472,9 @@ public class PartsTest extends AbstractB
             port.doubleIt(25);
             fail("Failure expected on a header which isn't encrypted");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "EncryptedElements";
-                assertTrue(ex.getMessage().contains(error)
-                           || ex.getMessage().contains("To must be encrypted"));
-            }
+            String error = "EncryptedElements";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("To must be encrypted"));
         }
         
         ((java.io.Closeable)port).close();
@@ -541,10 +522,8 @@ public class PartsTest extends AbstractB
             port.doubleIt3(doubleIt, "12345".getBytes());
             fail("Failure expected on an attachment which isn't signed");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "SignedParts";
-                assertTrue(ex.getMessage().contains(error));
-            }
+            String error = "SignedParts";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)port).close();
@@ -592,10 +571,8 @@ public class PartsTest extends AbstractB
             port.doubleIt3(doubleIt, "12345".getBytes());
             fail("Failure expected on an attachment which isn't encrypted");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                String error = "EncryptedParts";
-                assertTrue(ex.getMessage().contains(error));
-            }
+            String error = "EncryptedParts";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)port).close();

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java?rev=1557771&r1=1557770&r2=1557771&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/saml/SamlTokenTest.java
Mon Jan 13 16:58:06 2014
@@ -138,10 +138,8 @@ public class SamlTokenTest extends Abstr
             saml1Port.doubleIt(25);
             fail("Expected failure on an invocation with a SAML2 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                assertTrue(ex.getMessage().contains("Wrong SAML Version")
-                           || ex.getMessage().contains("enforces SamlVersion11Profile11 but
we got 2.0"));
-            }
+            assertTrue(ex.getMessage().contains("Wrong SAML Version")
+                       || ex.getMessage().contains("enforces SamlVersion11Profile11 but we
got 2.0"));
         }
 
         ((BindingProvider)saml1Port).getRequestContext().put(
@@ -163,10 +161,8 @@ public class SamlTokenTest extends Abstr
             saml1Port.doubleIt(25);
             fail("Failure expected on no token");
         } 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));
-            }
+            String error = "The received token does not match the token inclusion requirement";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)saml1Port).close();
@@ -290,9 +286,7 @@ public class SamlTokenTest extends Abstr
             saml1Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
-            }
+            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
         }
         
         ((BindingProvider)saml1Port).getRequestContext().put(
@@ -330,9 +324,7 @@ public class SamlTokenTest extends Abstr
             saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
-            }
+            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
         }
         
         ((BindingProvider)saml2Port).getRequestContext().put(
@@ -342,10 +334,8 @@ public class SamlTokenTest extends Abstr
             saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with a SAML1 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                assertTrue(ex.getMessage().contains("Wrong SAML Version")
-                           || ex.getMessage().contains("enforces SamlVersion20Profile11 but
we got 1.1"));
-            }
+            assertTrue(ex.getMessage().contains("Wrong SAML Version")
+                       || ex.getMessage().contains("enforces SamlVersion20Profile11 but we
got 1.1"));
         }
         
         ((BindingProvider)saml2Port).getRequestContext().put(
@@ -390,10 +380,8 @@ public class SamlTokenTest extends Abstr
             saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with an unsigned SAML SV Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                assertTrue(ex.getMessage().contains("An error was discovered processing")
-                           || ex.getMessage().contains("SamlToken not satisfied"));
-            }
+            assertTrue(ex.getMessage().contains("An error was discovered processing")
+                       || ex.getMessage().contains("SamlToken not satisfied"));
         }
         
         ((java.io.Closeable)saml2Port).close();
@@ -425,9 +413,7 @@ public class SamlTokenTest extends Abstr
             saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with no SAML Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
-            }
+            assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
         }
         
         ((BindingProvider)saml2Port).getRequestContext().put(
@@ -437,10 +423,8 @@ public class SamlTokenTest extends Abstr
             saml2Port.doubleIt(25);
             fail("Expected failure on an invocation with a SAML1 Assertion");
         } catch (javax.xml.ws.soap.SOAPFaultException ex) {
-            if (!test.isStreaming()) {
-                assertTrue(ex.getMessage().contains("Wrong SAML Version")
-                           || ex.getMessage().contains("enforces SamlVersion20Profile11 but
we got 1.1"));
-            }
+            assertTrue(ex.getMessage().contains("Wrong SAML Version")
+                       || ex.getMessage().contains("enforces SamlVersion20Profile11 but we
got 1.1"));
         }
         
         ((BindingProvider)saml2Port).getRequestContext().put(
@@ -462,10 +446,8 @@ public class SamlTokenTest extends Abstr
             saml2Port.doubleIt(25);
             fail("Failure expected on no token");
         } 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));
-            }
+            String error = "The received token does not match the token inclusion requirement";
+            assertTrue(ex.getMessage().contains(error));
         }
         
         ((java.io.Closeable)saml2Port).close();
@@ -855,11 +837,9 @@ public class SamlTokenTest extends Abstr
             saml2Port.doubleIt(25);
             fail("Failure expected on no SamlToken");
         } 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("SamlToken not satisfied"));
-            }
+            String error = "The received token does not match the token inclusion requirement";
+            assertTrue(ex.getMessage().contains(error)
+                       || ex.getMessage().contains("SamlToken not satisfied"));
         }
         
         ((java.io.Closeable)saml2Port).close();



Mime
View raw message