You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2009/06/18 23:04:16 UTC

svn commit: r786272 - in /cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws: wssc/WSSCTest.java wssec10/WSSecurity10Test.java wssec11/WSSecurity11Common.java

Author: dkulp
Date: Thu Jun 18 21:04:15 2009
New Revision: 786272

URL: http://svn.apache.org/viewvc?rev=786272&view=rev
Log:
Update to not print stuff on the console

Modified:
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java?rev=786272&r1=786271&r2=786272&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssc/WSSCTest.java Thu Jun 18 21:04:15 2009
@@ -20,8 +20,6 @@
 package org.apache.cxf.systest.ws.wssc;
 
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
@@ -42,7 +40,6 @@
 import wssec.wssc.PingResponse;
 import wssec.wssc.PingService;
 
-
 /**
  *
  */
@@ -66,7 +63,7 @@
     }
 
     @Test
-    public void testClientServer() {
+    public void testClientServer() throws Exception {
         if (!WSSecurity11Common.checkUnrestrictedPoliciesInstalled()) {
             //do nothing
             return;
@@ -104,67 +101,36 @@
             new SpringBusFactory().createBus("org/apache/cxf/systest/ws/wssc/client/client.xml");
         BusFactory.setDefaultBus(bus);
         BusFactory.setThreadDefaultBus(bus);
-        List<String> results = new ArrayList<String>(argv.length);
         URL wsdlLocation = null;
         
         for (String portPrefix : argv) {
-            try {
-                PingService svc;
-                wsdlLocation = new URL("http://localhost:9001/" + portPrefix + "?wsdl");
-                
-                svc = new PingService(wsdlLocation);
-                final IPingService port = 
-                    svc.getPort(
-                        new QName(
-                            "http://WSSec/wssc",
-                            portPrefix
-                        ),
-                        IPingService.class
-                    );
-               
-                
-                if (portPrefix.charAt(0) == '_') {
-                    //MS would like the _ versions to send a cancel
-                    ((BindingProvider)port).getRequestContext()
-                        .put(SecurityConstants.STS_TOKEN_DO_CANCEL, Boolean.TRUE);
-                }
-                PingRequest params = new PingRequest();
-                Ping ping = new Ping();
-                ping.setOrigin("CXF");
-                ping.setScenario("Scenario5");
-                ping.setText("ping");
-                params.setPing(ping);
-                PingResponse output = port.ping(params);
-                assertTrue("Expected OUT, " + OUT + ", not equal to received :" 
-                        + output.getPingResponse().getText(),
-                        OUT.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(portPrefix + ": OK!");
-                    results.add("OK!");
-                }
-            } catch (Throwable t) {
-                t.printStackTrace();
-                results.add("Exception: " + t);
-                assertTrue("Unexpected exception thrown, t : " + t,
-                        t == null);
-            }
-            //blasting the MS endpoints tends to cause a hang
-            //pause a sec to allow it to recover
-            try {
-                Thread.sleep(1000);
-                System.gc();
-            } catch (Exception e) {
-                //not really a problem
+            PingService svc;
+            wsdlLocation = new URL("http://localhost:9001/" + portPrefix + "?wsdl");
+            
+            svc = new PingService(wsdlLocation);
+            final IPingService port = 
+                svc.getPort(
+                    new QName(
+                        "http://WSSec/wssc",
+                        portPrefix
+                    ),
+                    IPingService.class
+                );
+           
+            
+            if (portPrefix.charAt(0) == '_') {
+                //MS would like the _ versions to send a cancel
+                ((BindingProvider)port).getRequestContext()
+                    .put(SecurityConstants.STS_TOKEN_DO_CANCEL, Boolean.TRUE);
             }
-        }
-        for (int x = 0; x < argv.length; x++) {
-            System.out.println(argv[x] + ": " + results.get(x));
+            PingRequest params = new PingRequest();
+            Ping ping = new Ping();
+            ping.setOrigin("CXF");
+            ping.setScenario("Scenario5");
+            ping.setText("ping");
+            params.setPing(ping);
+            PingResponse output = port.ping(params);
+            assertEquals(OUT, output.getPingResponse().getText());
         }
     }
 

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java?rev=786272&r1=786271&r2=786272&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec10/WSSecurity10Test.java Thu Jun 18 21:04:15 2009
@@ -22,8 +22,6 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
 
 import javax.xml.namespace.QName;
 
@@ -81,43 +79,22 @@
         }
         BusFactory.setDefaultBus(bus);
         BusFactory.setThreadDefaultBus(bus);
-        List<String> results = new ArrayList<String>();
         URL wsdlLocation = null;
         for (String portPrefix : argv) {
-            try {
-                PingService svc = null; 
-                wsdlLocation = getWsdlLocation(portPrefix); 
-                svc = new PingService(wsdlLocation);
-                final IPingService port = 
-                    svc.getPort(
-                        new QName(
-                            "http://WSSec/wssec10",
-                            portPrefix + "_IPingService"
-                        ),
-                        IPingService.class
-                    );
-                
-                final String output = port.echo(INPUT);
-                assertTrue("Input, " + INPUT + " not equal to Output " + output, 
-                        INPUT.equals(output));
-                if (!INPUT.equals(output)) {
-                    System.err.println(
-                        "Expected " + INPUT + " but got " + output
-                    );
-                    results.add("Expected " + INPUT + " but got " + output);
-                } else {
-                    System.out.println("OK!");
-                    results.add("OK");
-                }
-            } catch (Throwable t) {
-                results.add("Exception: " + t);
-                t.printStackTrace();
-                assertTrue("Caught excetion: " + t, 
-                        false);
-            }
-        }
-        for (int x = 0; x < argv.length; x++) {
-            System.out.println(argv[x] + ": " + results.get(x));
+            PingService svc = null; 
+            wsdlLocation = getWsdlLocation(portPrefix); 
+            svc = new PingService(wsdlLocation);
+            final IPingService port = 
+                svc.getPort(
+                    new QName(
+                        "http://WSSec/wssec10",
+                        portPrefix + "_IPingService"
+                    ),
+                    IPingService.class
+                );
+            
+            final String output = port.echo(INPUT);
+            assertEquals(INPUT, output);
         }
     }
     

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java?rev=786272&r1=786271&r2=786272&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/wssec11/WSSecurity11Common.java Thu Jun 18 21:04:15 2009
@@ -22,8 +22,6 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
 
 import javax.crypto.Cipher;
 import javax.crypto.SecretKey;
@@ -58,44 +56,22 @@
         }
         BusFactory.setDefaultBus(bus);
         BusFactory.setThreadDefaultBus(bus);
-        List<String> results = new ArrayList<String>();
         URL wsdlLocation = null;
         for (String portPrefix : argv) {
-            try {
-                PingService11 svc = null; 
-                wsdlLocation = getWsdlLocation(portPrefix); 
-                svc = new PingService11(wsdlLocation);
-                final IPingService port = 
-                    svc.getPort(
-                        new QName(
-                            "http://WSSec/wssec11",
-                            portPrefix + "_IPingService"
-                        ),
-                        IPingService.class
-                    );
-                
-                final String output = port.echo(INPUT);
-                assertTrue("INPUT, " + INPUT + " not equal to output, " + output, 
-                        output.equals(INPUT));
-                if (!INPUT.equals(output)) {
-                    System.err.println(
-                        "Expected " + INPUT + " but got " + output
-                    );
-                    results.add("Expected " + INPUT + " but got " + output);
-                } else {
-                    System.out.println("OK!");
-                    results.add("OK");
-                }
-            } catch (Throwable t) {
-                results.add("Exception: " + t);
-                t.printStackTrace();
-                assertTrue("Unexpected exception thrown, t = " + t,
-                        t == null);
-                
-            }
-        }
-        for (int x = 0; x < argv.length; x++) {
-            System.out.println(argv[x] + ": " + results.get(x));
+            PingService11 svc = null; 
+            wsdlLocation = getWsdlLocation(portPrefix); 
+            svc = new PingService11(wsdlLocation);
+            final IPingService port = 
+                svc.getPort(
+                    new QName(
+                        "http://WSSec/wssec11",
+                        portPrefix + "_IPingService"
+                    ),
+                    IPingService.class
+                );
+            
+            final String output = port.echo(INPUT);
+            assertEquals(INPUT, output);
         }
     }