cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r747914 - in /cxf/sandbox/interopfest: wssc/src/main/java/interop/client/ wssc/src/main/java/interop/server/ wssc/src/main/resources/etc/ wssec10/src/main/java/interop/client/ wssec10/src/main/resources/etc/
Date Wed, 25 Feb 2009 20:43:52 GMT
Author: dkulp
Date: Wed Feb 25 20:43:52 2009
New Revision: 747914

URL: http://svn.apache.org/viewvc?rev=747914&view=rev
Log:
[CXF-2068] Patch from Eamonn Dwyer applied to enable more WS-SC tests

Modified:
    cxf/sandbox/interopfest/wssc/src/main/java/interop/client/Client.java
    cxf/sandbox/interopfest/wssc/src/main/java/interop/client/KeystorePasswordCallback.java
    cxf/sandbox/interopfest/wssc/src/main/java/interop/server/PingServiceImpl.java
    cxf/sandbox/interopfest/wssc/src/main/java/interop/server/Server.java
    cxf/sandbox/interopfest/wssc/src/main/resources/etc/client.xml
    cxf/sandbox/interopfest/wssec10/src/main/java/interop/client/Client.java
    cxf/sandbox/interopfest/wssec10/src/main/resources/etc/client.xml

Modified: cxf/sandbox/interopfest/wssc/src/main/java/interop/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssc/src/main/java/interop/client/Client.java?rev=747914&r1=747913&r2=747914&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssc/src/main/java/interop/client/Client.java (original)
+++ cxf/sandbox/interopfest/wssc/src/main/java/interop/client/Client.java Wed Feb 25 20:43:52
2009
@@ -53,34 +53,40 @@
      */
     public static void main(String argv[])
         throws Exception {
-        
-        if (argv.length < 1 || "".equals(argv[0]) || argv[0] == null) {
+    	
+    	boolean useLocalWCFServices = false;
+
+    	if (argv.length < 1 || "".equals(argv[0]) || argv[0] == null) {
             argv = new String[] {
                 //"SecureConversation_UserNameOverTransport_IPingService",  //cannot sign/endorse
in transport binding yet
                 "SecureConversation_MutualCertificate10SignEncrypt_IPingService",
                 "AC_IPingService",
                 "ADC_IPingService",
-                "ADC-ES_IPingService",  
+                "ADC-ES_IPingService",   
                 "_A_IPingService",
                 "_AD_IPingService",
                 "_AD-ES_IPingService",
                 
-                //"XC_IPingService",
-                //"XDC_IPingService",
-                //"XDC_IPingService1",
-                //"XDC-ES_IPingService",
-                //"XDC-SEES_IPingService",
-                //"_X_IPingService",
-                //"_X10_IPingService",
-                //"_XD_IPingService",
-                //"_XD-SEES_IPingService",
-                //"_XD-ES_IPingService",
-                "UXC_IPingService",
+                "UXC_IPingService", 
                 "UXDC_IPingService",
                 "UXDC-SEES_IPingService",
                 "_UX_IPingService",
                 "_UXD_IPingService",
                 "_UXD-SEES_IPingService",
+                
+                
+                "XC_IPingService", 
+                "XDC_IPingService", 
+                "XDC_IPingService1", 
+                "XDC-ES_IPingService", 
+                "XDC-SEES_IPingService", 
+                "_X_IPingService", 
+                "_X10_IPingService", 
+                "_XD_IPingService", 
+                "_XD-SEES_IPingService", 
+                "_XD-ES_IPingService",
+                
+
                 //"KC_IPingService",     //Kerberos token - not sure where the token comes
from or how this works
                 //"KDC_IPingService",     //Kerberos token - not sure where the token comes
from or how this works
                 //"KC10_IPingService",     //Kerberos token - not sure where the token comes
from or how this works
@@ -93,7 +99,7 @@
             };
         }
         //argv = new String[] {argv[1]};
-        //argv = new String[] {"UXC_IPingService"};
+        //argv = new String[] {"_X10_IPingService"};
         
         new SpringBusFactory().createBus("etc/client.xml");
         List<String> results = new ArrayList<String>(argv.length);
@@ -103,10 +109,20 @@
             try {
                 PingService svc;
                 //wsdlLocation = new URL("http://localhost:9001/" + portPrefix + "?wsdl");
-                if (wsdlLocation == null) {
-                    svc = new PingService();
-                } else {
+                boolean isLocal = false;
+                try {
+                    if (wsdlLocation != null) {
+                        wsdlLocation.getContent();
+                        isLocal = true;     
+                    }
+                } catch (Exception e) {
+                    isLocal = false;
+                }
+                
+                if (isLocal) {
                     svc = new PingService(wsdlLocation);
+                } else {
+                    svc = new PingService();
                 }
                 final IPingService port = 
                     svc.getPort(
@@ -117,6 +133,10 @@
                         IPingService.class
                     );
                
+                if (useLocalWCFServices) {
+                    ((BindingProvider)port).getRequestContext()
+                        .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpointName(portPrefix));
+                }
                 PingRequest params = new PingRequest();
                 Ping ping = new Ping();
                 ping.setOrigin("CXF");
@@ -124,19 +144,23 @@
                 ping.setText("ping");
                 params.setPing(ping);
                 PingResponse output = port.ping(params);
-                if (!output.getPingResponse().getText().equals(output.getPingResponse().getText()))
{
+                if (!OUT.equals(output.getPingResponse().getText())) {
                     System.err.println(
                         "Expected " + OUT + " but got " + output.getPingResponse().getText()
                     );
                     results.add("Unexpected output " + output.getPingResponse().getText());
                 } else {
-                    System.out.println("OK!");
+                    System.out.println(portPrefix + ": OK!");
                     results.add("OK!");
                 }
             } catch (Throwable t) {
                 t.printStackTrace();
                 results.add("Exception: " + t);
             }
+            //blasting the MS endpoints tends to cause a hang
+            //pause a sec to allow it to recover
+            Thread.sleep(1000);
+            System.gc();
         }
         for (int x = 0; x < argv.length; x++) {
             System.out.println(argv[x] + ": " + results.get(x));
@@ -144,4 +168,12 @@
     }
 
 
+    private static String getEndpointName(String testName) {
+    	if ("SecureConversation_UserNameOverTransport_IPingService".equals(testName)) {
+    		return "https://localhost/Security_WsSecurity_Service_Indigo/WSSecureConversation.svc/SecureConversation_UserNameOverTransport";
+    	}
+	    return "http://localhost/Security_WsSecurity_Service_Indigo/WSSecureConversation.svc/"

+	       + testName.substring(0, testName.indexOf("_IPingService"));
+    }    
 }
+

Modified: cxf/sandbox/interopfest/wssc/src/main/java/interop/client/KeystorePasswordCallback.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssc/src/main/java/interop/client/KeystorePasswordCallback.java?rev=747914&r1=747913&r2=747914&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssc/src/main/java/interop/client/KeystorePasswordCallback.java
(original)
+++ cxf/sandbox/interopfest/wssc/src/main/java/interop/client/KeystorePasswordCallback.java
Wed Feb 25 20:43:52 2009
@@ -27,6 +27,7 @@
         passwords.put("Bob", "abcd!1234");
         passwords.put("bob", "abcd!1234");
         passwords.put("abcd", "dcba");
+        passwords.put("6e0e88f36ebb8744d470f62f604d03ea4ebe5094", "password");
     }
 
     /**
@@ -36,6 +37,19 @@
     public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
{
         for (int i = 0; i < callbacks.length; i++) {
             WSPasswordCallback pc = (WSPasswordCallback)callbacks[i];
+            try {
+            	Integer.parseInt(pc.getIdentifier());
+            	//Its an alias generated for a pfx file,
+            	//this seems to be the way sun seem to load
+            	//.pfc files into keystores, assigning an int value
+            	//as the key aliases,
+            	//The above is an issue when doing encrypt or signing only.
+            	//Perhaps using a more suitable keystore format like .jks would be better
+            	pc.setPassword("password");
+                return;
+            } catch (NumberFormatException nfe) {
+            	//not a pfx alias, carry on to next
+            }
 
             String pass = passwords.get(pc.getIdentifier());
             if (pass != null) {

Modified: cxf/sandbox/interopfest/wssc/src/main/java/interop/server/PingServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssc/src/main/java/interop/server/PingServiceImpl.java?rev=747914&r1=747913&r2=747914&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssc/src/main/java/interop/server/PingServiceImpl.java (original)
+++ cxf/sandbox/interopfest/wssc/src/main/java/interop/server/PingServiceImpl.java Wed Feb
25 20:43:52 2009
@@ -64,7 +64,7 @@
         PingResponseBody body = new PingResponseBody();
         body.setOrigin("CXF");
         body.setScenario(parameters.getPing().getScenario());
-        body.setText(parameters.getPing().getOrigin() + ": "
+        body.setText(parameters.getPing().getOrigin() + " : "
                      + parameters.getPing().getText());
         resp.setPingResponse(body);
         return resp;

Modified: cxf/sandbox/interopfest/wssc/src/main/java/interop/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssc/src/main/java/interop/server/Server.java?rev=747914&r1=747913&r2=747914&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssc/src/main/java/interop/server/Server.java (original)
+++ cxf/sandbox/interopfest/wssc/src/main/java/interop/server/Server.java Wed Feb 25 20:43:52
2009
@@ -79,6 +79,11 @@
         Endpoint ep = Endpoint.create(obj);
         ep.getProperties().put(SecurityConstants.CALLBACK_HANDLER + ".sct", new KeystorePasswordCallback());
         ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", "etc/bob.properties");
+        
+        if (url.contains("X10_I")) {
+            ep.getProperties().put(SecurityConstants.SIGNATURE_PROPERTIES + ".sct", "etc/bob.properties");
+            ep.getProperties().put(SecurityConstants.ENCRYPT_PROPERTIES + ".sct", "etc/alice.properties");
+        }
         ep.publish(url);
     }
     

Modified: cxf/sandbox/interopfest/wssc/src/main/resources/etc/client.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssc/src/main/resources/etc/client.xml?rev=747914&r1=747913&r2=747914&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssc/src/main/resources/etc/client.xml (original)
+++ cxf/sandbox/interopfest/wssc/src/main/resources/etc/client.xml Wed Feb 25 20:43:52 2009
@@ -82,10 +82,82 @@
         <jaxws:properties>
             <entry key="ws-security.username.sct" value="abcd"/>
             <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
-            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>
         </jaxws:properties>
     </jaxws:client>
     
+    <jaxws:client name="{http://InteropBaseAddress/interop}XDC_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client> 
+    
+    <jaxws:client name="{http://InteropBaseAddress/interop}XDC_IPingService1" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client>        
+    
+    <jaxws:client name="{http://InteropBaseAddress/interop}XDC-ES_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client>  
+    
+    <jaxws:client name="{http://InteropBaseAddress/interop}XDC-SEES_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client>   
+
+    <jaxws:client name="{http://InteropBaseAddress/interop}_X_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client>   
+
+    <jaxws:client name="{http://InteropBaseAddress/interop}_X10_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.signature.properties.sct" value="etc/alice.properties"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client>   
+
+    <jaxws:client name="{http://InteropBaseAddress/interop}_XD_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client> 
+    
+    <jaxws:client name="{http://InteropBaseAddress/interop}_XD-SEES_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client>       
+
+    <jaxws:client name="{http://InteropBaseAddress/interop}_XD-ES_IPingService" createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username.sct" value="abcd"/>
+            <entry key="ws-security.callback-handler.sct" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.encryption.properties.sct" value="etc/bob.properties"/>

+        </jaxws:properties>
+    </jaxws:client>     
     
     <jaxws:client name="{http://InteropBaseAddress/interop}UXC_IPingService" createdFromAPI="true">
         <jaxws:properties>

Modified: cxf/sandbox/interopfest/wssec10/src/main/java/interop/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssec10/src/main/java/interop/client/Client.java?rev=747914&r1=747913&r2=747914&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssec10/src/main/java/interop/client/Client.java (original)
+++ cxf/sandbox/interopfest/wssec10/src/main/java/interop/client/Client.java Wed Feb 25 20:43:52
2009
@@ -52,6 +52,7 @@
         if (argv.length < 1) {
            argv = new String[] {
                                 "UserNameOverTransport",
+                                "MutualCertificate10SignEncrypt",
                                 "MutualCertificate10SignEncryptRsa15TripleDes"
                                 };
         }

Modified: cxf/sandbox/interopfest/wssec10/src/main/resources/etc/client.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/interopfest/wssec10/src/main/resources/etc/client.xml?rev=747914&r1=747913&r2=747914&view=diff
==============================================================================
--- cxf/sandbox/interopfest/wssec10/src/main/resources/etc/client.xml (original)
+++ cxf/sandbox/interopfest/wssec10/src/main/resources/etc/client.xml Wed Feb 25 20:43:52
2009
@@ -63,6 +63,28 @@
         </http:tlsClientParameters>
     </http:conduit>
     
+    
+    <!-- -->
+    <!-- Scenario 3.3 -->
+    <!-- -->
+    <jaxws:client name="{http://InteropBaseAddress/interop}MutualCertificate10SignEncrypt_IPingService"
createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username" value="Alice"/>
+            <entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.signature.properties" value="etc/alice.properties"/>
+            <entry key="ws-security.encryption.properties" value="etc/bob.properties"/>
+        </jaxws:properties>
+    </jaxws:client>
+    <!-- for call to local endpoint -->
+    <jaxws:client name="{http://InteropBaseAddress/interop}MutualCertificate10SignEncrypt_IPingService"
createdFromAPI="true">
+        <jaxws:properties>
+            <entry key="ws-security.username" value="Alice"/>
+            <entry key="ws-security.callback-handler" value="interop.client.KeystorePasswordCallback"/>
+            <entry key="ws-security.signature.properties" value="etc/alice.properties"/>
+            <entry key="ws-security.encryption.properties" value="etc/bob.properties"/>
+        </jaxws:properties>
+    </jaxws:client>
+    
     <!-- -->
     <!-- Scenario 3.4 -->
     <!-- -->



Mime
View raw message