cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1533365 - in /cxf/trunk: rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/ systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/secconv/ systests/ws-security/src/test/java/org/apache...
Date Fri, 18 Oct 2013 09:10:38 GMT
Author: coheigea
Date: Fri Oct 18 09:10:37 2013
New Revision: 1533365

URL: http://svn.apache.org/r1533365
Log:
Adding some streaming SecureConversation tests

Added:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxServer.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxWSSCTest.java
Modified:
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
    cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/secconv/StaxSecureConversationTest.java

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java?rev=1533365&r1=1533364&r2=1533365&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/StaxSymmetricBindingHandler.java
Fri Oct 18 09:10:37 2013
@@ -558,7 +558,11 @@ public class StaxSymmetricBindingHandler
             }
         } else if (policyToken instanceof IssuedToken || policyToken instanceof SecurityContextToken
             || policyToken instanceof SecureConversationToken || policyToken instanceof SpnegoContextToken)
{
-            config.put(ConfigurationConstants.INCLUDE_SIGNATURE_TOKEN, "false");
+            if (!isRequestor()) {
+                config.put(ConfigurationConstants.INCLUDE_SIGNATURE_TOKEN, "false");
+            } else {
+                config.put(ConfigurationConstants.INCLUDE_SIGNATURE_TOKEN, "true");
+            }
             config.put(ConfigurationConstants.DERIVED_TOKEN_KEY_ID, "DirectReference");
         }
         

Modified: cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/secconv/StaxSecureConversationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/secconv/StaxSecureConversationTest.java?rev=1533365&r1=1533364&r2=1533365&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/secconv/StaxSecureConversationTest.java
(original)
+++ cxf/trunk/systests/ws-security-examples/src/test/java/org/apache/cxf/systest/wssec/examples/secconv/StaxSecureConversationTest.java
Fri Oct 18 09:10:37 2013
@@ -85,7 +85,7 @@ public class StaxSecureConversationTest 
         // DOM
         samlPort.doubleIt(25);
         
-        // TODO Streaming investigate
+        // TODO Streaming Ordering issue
         // SecurityTestUtil.enableStreaming(samlPort);
         // samlPort.doubleIt(25);
         

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxServer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxServer.java?rev=1533365&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxServer.java
(added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxServer.java
Fri Oct 18 09:10:37 2013
@@ -0,0 +1,286 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.wssc;
+
+import javax.jws.WebService;
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.systest.ws.common.KeystorePasswordCallback;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.ws.security.SecurityConstants;
+
+
+public class StaxServer extends AbstractBusTestServerBase {
+    static final String PORT = allocatePort(StaxServer.class);
+
+    public StaxServer() throws Exception {
+        
+    }
+    
+    protected StaxServer(String baseUrl) throws Exception {
+        
+        
+        //"SecureConversation_UserNameOverTransport_IPingService",
+        doPublish(baseUrl + "SecureConversation_MutualCertificate10SignEncrypt_IPingService",
+                  new SCMCSEIPingService());
+        
+        doPublish(baseUrl + "AC_IPingService", new ACIPingService());
+        doPublish(baseUrl + "ADC_IPingService", new ADCIPingService());
+        doPublish(baseUrl + "ADC-ES_IPingService", new ADCESIPingService()); 
+        doPublish(baseUrl + "_A_IPingService", new AIPingService());
+        doPublish(baseUrl + "_AD_IPingService", new ADIPingService());
+        doPublish(baseUrl + "_AD-ES_IPingService", new ADESIPingService());
+
+        doPublish(baseUrl + "UXC_IPingService", new UXCIPingService());
+        doPublish(baseUrl + "UXDC_IPingService", new UXDCIPingService());
+        doPublish(baseUrl + "UXDC-SEES_IPingService", new UXDCSEESIPingService());
+        doPublish(baseUrl + "_UX_IPingService", new UXIPingService());
+        doPublish(baseUrl + "_UXD_IPingService", new UXDIPingService());
+        doPublish(baseUrl + "_UXD-SEES_IPingService", new UXDSEESIPingService());
+
+        doPublish(baseUrl + "XC_IPingService", new XCIPingService());
+        doPublish(baseUrl + "XDC_IPingService", new XDCIPingService());
+        doPublish(baseUrl + "XDC_IPingService1", new XDC1IPingService());
+        doPublish(baseUrl + "XDC-ES_IPingService", new XDCESIPingService());
+        doPublish(baseUrl + "XDC-SEES_IPingService", new XDCSEESIPingService());
+        doPublish(baseUrl + "_X_IPingService", new XIPingService());
+        doPublish(baseUrl + "_X10_IPingService", new X10IPingService());
+        doPublish(baseUrl + "_XD_IPingService", new XDIPingService());
+        doPublish(baseUrl + "_XD-SEES_IPingService", new XDSEESIPingService());
+        doPublish(baseUrl + "_XD-ES_IPingService",  new XDESIPingService());
+        
+        
+        //Kerberos token - not sure where the token comes from or how these work
+        //"KC_IPingService",       
+        //"KDC_IPingService",
+        //"KC10_IPingService",
+        //"KDC10_IPingService",
+        //"_K10_IPingService",
+        //"_KD10_IPingService",
+        //"_K_IPingService",
+        //"_KD_IPingService", 
+        //"_KD-SEES_IPingService",
+        
+    }
+    
+    protected void run()  {
+        try {
+            Bus busLocal = new SpringBusFactory().createBus(
+                "org/apache/cxf/systest/ws/wssc/server.xml");
+            BusFactory.setDefaultBus(busLocal);
+            setBus(busLocal);
+            new StaxServer("http://localhost:" + PORT + "/");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void doPublish(String url, Object obj) {
+        Endpoint ep = Endpoint.create(obj);
+        ep.getProperties().put(SecurityConstants.ENABLE_STREAMING_SECURITY, "true");
+        ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER + ".sct", new KeystorePasswordCallback());
+        ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", 
+                "bob.properties");
+        
+        if (url.contains("X10_I")) {
+            ep.getProperties().put(SecurityConstants.SIGNATURE_PROPERTIES + ".sct", 
+                    "bob.properties");
+            ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", 
+                    "alice.properties");
+        } else if (url.contains("MutualCert")) {
+            ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", 
+                "bob.properties");
+            ep.getProperties().put(SecurityConstants.SIGNATURE_PROPERTIES + ".sct", 
+                "alice.properties");
+            ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
+        }
+        ep.publish(url);
+    }
+    
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "SecureConversation_MutualCertificate10SignEncrypt_IPingService",

+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class SCMCSEIPingService extends PingServiceImpl {
+    }
+
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "AC_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class ACIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "ADC_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class ADCIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "ADC-ES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class ADCESIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_A_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class AIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_AD_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class ADIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_AD-ES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class ADESIPingService extends PingServiceImpl {
+    }
+
+    
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "UXC_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class UXCIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "UXDC_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class UXDCIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "UXDC-SEES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class UXDCSEESIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_UX_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class UXIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_UXD_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class UXDIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_UXD-SEES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class UXDSEESIPingService extends PingServiceImpl {
+    }
+
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "XC_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XCIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "XDC_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XDCIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "XDC_IPingService1", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XDC1IPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "XDC-ES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XDCESIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "XDC-SEES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XDCSEESIPingService extends PingServiceImpl {
+    }
+    
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_X_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_X10_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class X10IPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_XD_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XDIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_XD-SEES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XDSEESIPingService extends PingServiceImpl {
+    }
+    @WebService(targetNamespace = "http://WSSec/wssc", 
+                serviceName = "PingService", 
+                portName = "_XD-ES_IPingService", 
+                endpointInterface = "wssec.wssc.IPingService",
+                wsdlLocation = "target/test-classes/wsdl_systest_wssec/wssc/WSSecureConversation.wsdl")
+    public static class XDESIPingService extends PingServiceImpl {
+    }
+}

Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxWSSCTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxWSSCTest.java?rev=1533365&view=auto
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxWSSCTest.java
(added)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/wssc/StaxWSSCTest.java
Fri Oct 18 09:10:37 2013
@@ -0,0 +1,271 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.ws.wssc;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.systest.ws.common.SecurityTestUtil;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.ws.security.SecurityConstants;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * SecureConversation tests.
+ * 
+ * It tests both DOM + StAX clients against the StAX server
+ */
+public class StaxWSSCTest extends AbstractBusClientServerTestBase {
+    static final String PORT = allocatePort(StaxServer.class);
+
+       
+    private static final String OUT = "CXF : ping";
+    private static wssec.wssc.PingService svc;
+    private static Bus bus;
+    
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue(
+            "Server failed to launch",
+            // run the server in the same process
+            // set this to false to fork
+            launchServer(StaxServer.class, true)
+        );
+        
+        bus = new SpringBusFactory().createBus("org/apache/cxf/systest/ws/wssc/client.xml");
+        BusFactory.setDefaultBus(bus);
+        BusFactory.setThreadDefaultBus(bus);
+        
+        svc = new wssec.wssc.PingService();
+    }
+    
+    @org.junit.AfterClass
+    public static void cleanup() throws Exception {
+        SecurityTestUtil.cleanup();
+        bus.shutdown(true);
+        stopAllServers();
+    }
+  /*  
+    @Test
+    public void testSecureConversationMutualCertificate10SignEncryptIPingService() throws
Exception {
+        runTest(false, "SecureConversation_MutualCertificate10SignEncrypt_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "SecureConversation_MutualCertificate10SignEncrypt_IPingService");
+    }
+*/
+    @Test
+    public void testACIPingService() throws Exception {
+        runTest(false, "AC_IPingService");
+        runTest(true, "AC_IPingService");
+    }
+/*
+    @Test
+    public void testADCIPingService() throws Exception {
+        runTest(false, "ADC_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "ADC_IPingService");
+    }
+
+    @Test
+    public void testADCESIPingService() throws Exception {
+        runTest(false, "ADC-ES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "ADC-ES_IPingService");
+    }
+*/
+    @Test
+    public void testAIPingService() throws Exception {
+        runTest(false, "_A_IPingService");
+        runTest(true, "_A_IPingService");
+    }
+/*
+    @Test
+    public void testADIPingService() throws Exception {
+        runTest(false, "_AD_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "_AD_IPingService");
+    }
+
+    @Test
+    public void testADESIPingService() throws Exception {
+        runTest(false, "_AD-ES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "_AD-ES_IPingService");
+    }
+*/
+    @Test
+    public void testUXCIPingService() throws Exception {
+        runTest(false, "UXC_IPingService");
+        runTest(true, "UXC_IPingService");
+    }
+/*
+    @Test
+    public void testUXDCIPingService() throws Exception {
+        runTest(false, "UXDC_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "UXDC_IPingService");
+    }
+
+    @Test
+    public void testUXDCSEESIPingService() throws Exception {
+        runTest(false, "UXDC-SEES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "UXDC-SEES_IPingService");
+    }
+*/
+    @Test
+    public void testUXIPingService() throws Exception {
+        runTest(false, "_UX_IPingService");
+        runTest(true, "_UX_IPingService");
+    }
+/*
+    @Test
+    public void testUXDIPingService() throws Exception {
+        runTest(false, "_UXD_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "_UXD_IPingService");
+    }
+
+    @Test
+    public void testUXDSEESIPingService() throws Exception {
+        runTest(false, "_UXD-SEES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "_UXD-SEES_IPingService");
+    }
+*/
+    @Test
+    public void testXCIPingService() throws Exception {
+        runTest(false, "XC_IPingService");
+        // TODO Streaming endorsing not working runTest(true, "XC_IPingService");
+    }
+/*
+    @Test
+    public void testXDCIPingService() throws Exception {
+        runTest(false, "XDC_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "XDC_IPingService");
+    }
+
+    @Test
+    public void testXDCIPingService1() throws Exception {
+        runTest(false, "XDC_IPingService1");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "XDC_IPingService1");
+    }
+
+    @Test
+    public void testXDCESIPingService() throws Exception {
+        runTest(false, "XDC-ES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "XDC-ES_IPingService");
+    }
+
+    @Test
+    public void testXDCSEESIPingService() throws Exception {
+        runTest(false, "XDC-SEES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "XDC-SEES_IPingService");
+    }
+*/
+    @Test
+    public void testXIPingService() throws Exception {
+        runTest(false, "_X_IPingService");
+        // TODO Streaming endorsing not working runTest(true, "_X_IPingService");
+    }
+
+    @Test
+    public void testX10IPingService() throws Exception {
+        runTest(false, "_X10_IPingService");
+        runTest(true, "_X10_IPingService");
+    }
+/*
+    @Test
+    public void testXDIPingService() throws Exception {
+        runTest(false, "_XD_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "_XD_IPingService");
+    }
+
+    @Test
+    public void testXDSEESIPingService() throws Exception {
+        runTest(false, "_XD-SEES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "_XD-SEES_IPingService");
+    }
+
+    @Test
+    public void testXDESIPingService() throws Exception {
+        runTest(false, "_XD-ES_IPingService");
+        // TODO Hanging due to Derived Keys...
+        // runTest(true, "_XD-ES_IPingService");
+    }
+*/
+
+    private void runTest(boolean streaming, String ... argv) throws Exception {
+        for (String portPrefix : argv) {
+            final wssec.wssc.IPingService port = 
+                svc.getPort(
+                    new QName(
+                        "http://WSSec/wssc",
+                        portPrefix
+                    ),
+                    wssec.wssc.IPingService.class
+                );
+           
+            ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                                                            "http://localhost:" + PORT +
"/" + portPrefix);
+            if (portPrefix.charAt(0) == '_') {
+                //MS would like the _ versions to send a cancel
+                ((BindingProvider)port).getRequestContext()
+                    .put(SecurityConstants.STS_TOKEN_DO_CANCEL, Boolean.TRUE);
+            }
+            
+            if (streaming) {
+                ((BindingProvider)port).getRequestContext().put(
+                    SecurityConstants.ENABLE_STREAMING_SECURITY, "true"
+                );
+                ((BindingProvider)port).getResponseContext().put(
+                    SecurityConstants.ENABLE_STREAMING_SECURITY, "true"
+                );
+            }
+            
+            wssec.wssc.PingRequest params = new wssec.wssc.PingRequest();
+            org.xmlsoap.ping.Ping ping = new org.xmlsoap.ping.Ping();
+            ping.setOrigin("CXF");
+            ping.setScenario("Scenario5");
+            ping.setText("ping");
+            params.setPing(ping);
+            try {
+                wssec.wssc.PingResponse output = port.ping(params);
+                assertEquals(OUT, output.getPingResponse().getText());
+            } catch (Exception ex) {
+                throw new Exception("Error doing " + portPrefix, ex);
+            }
+            ((java.io.Closeable)port).close();
+        }
+    }
+
+    
+}



Mime
View raw message