You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2013/12/12 12:57:06 UTC

svn commit: r1550400 - in /cxf/trunk: services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/binarysecuritytoken/ services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/usernametoken/ systests/ws-security/src/test/java...

Author: coheigea
Date: Thu Dec 12 11:57:06 2013
New Revision: 1550400

URL: http://svn.apache.org/r1550400
Log:
Added a test-case for a problem with streaming SOAP Faults

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/parts/PartsTest.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=1550400&r1=1550399&r2=1550400&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 Thu Dec 12 11:57:06 2013
@@ -157,7 +157,7 @@ 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()) {
+            if (!test.isStreaming()) {
                 assertTrue(message.contains("STS Authentication failed")
                     || message.contains("Validation of security token failed")
                     || message.contains("PolicyViolationException"));

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=1550400&r1=1550399&r2=1550400&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 Thu Dec 12 11:57:06 2013
@@ -155,7 +155,7 @@ 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()) {
+            if (!test.isStreaming()) {
                 String message = fault.getMessage();
                 assertTrue(message.contains("STS Authentication failed")
                     || message.contains("Validation of security token failed")

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=1550400&r1=1550399&r2=1550400&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 Thu Dec 12 11:57:06 2013
@@ -90,6 +90,42 @@ public class PartsTest extends AbstractB
     }
     
     @org.junit.Test
+    @org.junit.Ignore
+    public void testSOAPFaultError() throws Exception {
+
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = PartsTest.class.getResource("client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+
+        URL wsdl = PartsTest.class.getResource("DoubleItParts.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+       
+        // This should fail, as the service requires a (bad) header
+        QName portQName = new QName(NAMESPACE, "DoubleItRequiredPartsPort2");
+        DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(port, test.getPort());
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
+        
+        try {
+            port.doubleIt(25);
+            fail("Failure expected on a required header which isn't present");
+        } catch (javax.xml.ws.soap.SOAPFaultException ex) {
+            String error = "RequiredParts: No header element";
+            assertTrue(ex.getMessage().contains(error) 
+                       || ex.getMessage().contains("ToTo must be present"));
+        }
+
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
+    
+    @org.junit.Test
     public void testRequiredParts() throws Exception {
 
         SpringBusFactory bf = new SpringBusFactory();