cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [1/2] git commit: Test optionalSignatureParts
Date Mon, 15 Sep 2014 14:31:53 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes ff4bb478e -> 5ae190595


Test optionalSignatureParts


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/74e64bfe
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/74e64bfe
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/74e64bfe

Branch: refs/heads/3.0.x-fixes
Commit: 74e64bfec6b338d57f19e825c95e42bc636b2993
Parents: ff4bb47
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Sep 15 12:29:08 2014 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Sep 15 15:31:41 2014 +0100

----------------------------------------------------------------------
 .../CryptoCoverageCheckerTest.java              | 48 ++++++++++++++++++++
 1 file changed, 48 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/74e64bfe/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java
index f521436..990b177 100644
--- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java
+++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/coverage_checker/CryptoCoverageCheckerTest.java
@@ -560,6 +560,54 @@ public class CryptoCoverageCheckerTest extends AbstractBusClientServerTestBase
{
         bus.shutdown(true);
     }
     
+    @org.junit.Test
+    public void testWSAddressingOptionalSignatureParts() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        URL busFile = CryptoCoverageCheckerTest.class.getResource("client.xml");
+
+        Bus bus = bf.createBus(busFile.toString());
+        SpringBusFactory.setDefaultBus(bus);
+        SpringBusFactory.setThreadDefaultBus(bus);
+        
+        URL wsdl = CryptoCoverageCheckerTest.class.getResource("DoubleItCoverageChecker.wsdl");
+        Service service = Service.create(wsdl, SERVICE_QNAME);
+        QName portQName = new QName(NAMESPACE, "DoubleItWSAPort");
+        DoubleItPortType port = 
+                service.getPort(portQName, DoubleItPortType.class);
+        updateAddressPort(port, test.getPort());
+        
+        Map<String, Object> outProps = new HashMap<String, Object>();
+        outProps.put("action", "Timestamp Signature");
+        outProps.put("signaturePropFile", "alice.properties");
+        outProps.put("user", "alice");
+        outProps.put("passwordCallbackClass", 
+                     "org.apache.cxf.systest.ws.common.KeystorePasswordCallback");
+        outProps.put("optionalSignatureParts",
+                     "{}{http://schemas.xmlsoap.org/soap/envelope/}Body;"
+                     + "{}{http://docs.oasis-open.org/wss/2004/01/oasis-"
+                     + "200401-wss-wssecurity-utility-1.0.xsd}Timestamp;"
+                     + "{}{http://www.w3.org/2005/08/addressing}ReplyTo;");
+        
+        if (test.isStreaming()) {
+            SecurityTestUtil.enableStreaming(port);
+        }
+        
+        WSS4JStaxOutInterceptor staxOutInterceptor = null;
+        WSS4JOutInterceptor outInterceptor = null;
+        if (test.isStreaming()) {
+            staxOutInterceptor = new WSS4JStaxOutInterceptor(outProps);
+            bus.getOutInterceptors().add(staxOutInterceptor);
+        } else {
+            outInterceptor = new WSS4JOutInterceptor(outProps);
+            bus.getOutInterceptors().add(outInterceptor);
+        }
+        
+        port.doubleIt(25);
+        
+        ((java.io.Closeable)port).close();
+        bus.shutdown(true);
+    }
+    
     // Here the service is sending an secured message back to the client. For a server Fault

     // message it returns the original fault, as the CryptoCoverageChecker is configured
not 
     // to check a fault (see CXF-4954)


Mime
View raw message