cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r437633 - in /incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws: ClientServerTest.java HeaderClientServerTest.java
Date Mon, 28 Aug 2006 10:39:44 GMT
Author: ffang
Date: Mon Aug 28 03:39:43 2006
New Revision: 437633

URL: http://svn.apache.org/viewvc?rev=437633&view=rev
Log:
adding test framework for jax-ws holder support

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
  (with props)
Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ClientServerTest.java

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ClientServerTest.java?rev=437633&r1=437632&r2=437633&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/ClientServerTest.java
Mon Aug 28 03:39:43 2006
@@ -63,6 +63,8 @@
                 assertTrue("server did not launch correctly", launchServer(Server.class));
             }
         };
+        
+        
     }
     
     public void testBasicConnection() throws Exception {

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java?rev=437633&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
Mon Aug 28 03:39:43 2006
@@ -0,0 +1,192 @@
+package org.apache.cxf.jaxws;
+
+
+
+import java.lang.reflect.UndeclaredThrowableException;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Holder;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+import org.apache.cxf.systest.common.ClientServerSetupBase;
+import org.apache.cxf.systest.common.ClientServerTestBase;
+import org.apache.cxf.systest.common.TestServerBase;
+import org.apache.header_test.SOAPHeaderService;
+import org.apache.header_test.TestHeader;
+import org.apache.header_test.TestHeaderImpl;
+import org.apache.header_test.types.TestHeader1;
+import org.apache.header_test.types.TestHeader1Response;
+import org.apache.header_test.types.TestHeader2;
+import org.apache.header_test.types.TestHeader2Response;
+import org.apache.header_test.types.TestHeader3;
+import org.apache.header_test.types.TestHeader3Response;
+import org.apache.header_test.types.TestHeader5;
+
+
+public class HeaderClientServerTest extends ClientServerTestBase {
+
+    private final QName serviceName = new QName("http://apache.org/header_test",
+                                                "SOAPHeaderService");    
+    private final QName portName = new QName("http://apache.org/header_test",
+                                             "SoapHeaderPort");
+
+    private TestHeader proxy;
+    
+    
+    public static class MyServer extends TestServerBase {
+
+        protected void run()  {
+            Object implementor = new TestHeaderImpl();
+            String address = "http://localhost:9104/SoapHeaderContext/SoapHeaderPort";
+            Endpoint.publish(address, implementor);
+            
+        }
+        
+
+        public static void main(String[] args) {
+            try { 
+                MyServer s = new MyServer(); 
+                s.start();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                System.exit(-1);
+            } finally { 
+                System.out.println("done!");
+            }
+        }
+    }
+    
+    public static Test suite() throws Exception {
+        TestSuite suite = new TestSuite(HeaderClientServerTest.class);
+        return new ClientServerSetupBase(suite) {
+            public void startServers() throws Exception {
+                assertTrue("server did not launch correctly", launchServer(MyServer.class));
+            }
+        };
+
+    }  
+
+    
+    
+     
+    public void testInHeader() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/soapheader_test.wsdl");
+        assertNotNull(wsdl);
+        
+        SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
+        assertNotNull(service);
+        proxy = service.getPort(portName, TestHeader.class);
+        try {
+            TestHeader1 val = new TestHeader1();
+            for (int idx = 0; idx < 2; idx++) {
+                TestHeader1Response returnVal = proxy.testHeader1(val, val);
+                assertNotNull(returnVal);
+                assertEquals(TestHeader1.class.getSimpleName(), returnVal.getResponseType());
+            }
+        } catch (UndeclaredThrowableException ex) {
+            //throw (Exception)ex.getCause();
+        } catch (Exception e) {
+            //should get Exception since Holder is not supported now
+        }
+    } 
+
+    public void testOutHeader() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/soapheader_test.wsdl");
+        assertNotNull(wsdl);
+        
+        SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
+        assertNotNull(service);
+        proxy = service.getPort(portName, TestHeader.class);
+        try {
+            TestHeader2 in = new TestHeader2();
+            String val = new String(TestHeader2Response.class.getSimpleName());
+            Holder<TestHeader2Response> out = new Holder<TestHeader2Response>();
+            Holder<TestHeader2Response> outHeader = new Holder<TestHeader2Response>();
+            for (int idx = 0; idx < 2; idx++) {
+                val += idx;                
+                in.setRequestType(val);
+                proxy.testHeader2(in, out, outHeader);
+                
+                assertEquals(val, out.value.getResponseType());
+                assertEquals(val, outHeader.value.getResponseType());
+            }
+        } catch (UndeclaredThrowableException ex) {
+            //throw (Exception)ex.getCause();
+        } catch (Exception e) {
+            //should get Exception since Holder is not supported now
+        }
+    } 
+
+    public void testInOutHeader() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/soapheader_test.wsdl");
+        assertNotNull(wsdl);
+        
+        SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
+        assertNotNull(service);
+        proxy = service.getPort(portName, TestHeader.class);
+        
+        try {
+            TestHeader3 in = new TestHeader3();
+            String val = new String(TestHeader3.class.getSimpleName());
+            Holder<TestHeader3> inoutHeader = new Holder<TestHeader3>();
+            for (int idx = 0; idx < 2; idx++) {
+                val += idx;                
+                in.setRequestType(val);
+                inoutHeader.value = new TestHeader3();
+                TestHeader3Response returnVal = proxy.testHeader3(in, inoutHeader);
+                //inoutHeader copied to return
+                //in copied to inoutHeader
+                assertNotNull(returnVal);
+                assertNull(returnVal.getResponseType());
+                assertEquals(val, inoutHeader.value.getRequestType());
+                
+                in.setRequestType(null);
+                inoutHeader.value.setRequestType(val);
+                returnVal = proxy.testHeader3(in, inoutHeader);
+                assertNotNull(returnVal);
+                assertEquals(val, returnVal.getResponseType());
+                assertNull(inoutHeader.value.getRequestType());
+            }
+        } catch (UndeclaredThrowableException ex) {
+            //throw (Exception)ex.getCause();
+        } catch (Exception e) {
+            //should get Exception since Holder is not supported now
+        }
+    } 
+
+    public void testReturnHeader() throws Exception {
+        URL wsdl = getClass().getResource("/wsdl/soapheader_test.wsdl");
+        assertNotNull(wsdl);
+        
+        SOAPHeaderService service = new SOAPHeaderService(wsdl, serviceName);
+        assertNotNull(service);
+        proxy = service.getPort(portName, TestHeader.class);
+        try {
+            TestHeader5 in = new TestHeader5();
+            String val = new String(TestHeader5.class.getSimpleName());
+            for (int idx = 0; idx < 2; idx++) {
+                val += idx;                
+                in.setRequestType(val);
+                TestHeader5 returnVal = proxy.testHeader5(in);
+
+                //in copied to return                
+                assertNotNull(returnVal);
+                assertEquals(val, returnVal.getRequestType());
+            }
+        } catch (UndeclaredThrowableException ex) {
+            //throw (Exception)ex.getCause();
+        } catch (Exception e) {
+            //should get Exception since Holder is not supported now
+        }
+    } 
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(HeaderClientServerTest.class);
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/jaxws/HeaderClientServerTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message