cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r546028 - in /incubator/cxf/trunk: systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java testutils/src/main/java/org/apache/cxf/greeter_control/GreeterImplBase.java
Date Mon, 11 Jun 2007 07:12:29 GMT
Author: ningjiang
Date: Mon Jun 11 00:12:29 2007
New Revision: 546028

URL: http://svn.apache.org/viewvc?view=rev&rev=546028
Log:
Added the http get test for service built from class

Modified:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
    incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/greeter_control/GreeterImplBase.java

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java?view=diff&rev=546028&r1=546027&r2=546028
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerGreeterNoWsdlTest.java
Mon Jun 11 00:12:29 2007
@@ -19,11 +19,23 @@
 
 package org.apache.cxf.systest.jaxws;
 
+import java.io.InputStream;
 import java.lang.reflect.UndeclaredThrowableException;
+import java.net.HttpURLConnection;
+import java.util.HashMap;
+import java.util.Map;
 
+import javax.xml.xpath.XPathConstants;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+
+import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.GreeterService;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.helpers.XPathUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -52,6 +64,37 @@
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();
         }
+    }
+    
+    // test the http get invocation 
+    
+    @Test
+    public void testGetGreetMe() throws Exception {
+        HttpURLConnection httpConnection = 
+            getHttpConnection("http://localhost:9020/SoapContext/GreeterPort/greetMe/requestType/cxf");
   
+        httpConnection.connect();        
+        
+        assertEquals(200, httpConnection.getResponseCode());
+    
+        assertEquals("text/xml", httpConnection.getContentType());
+        assertEquals("OK", httpConnection.getResponseMessage());
+        
+        InputStream in = httpConnection.getInputStream();
+        assertNotNull(in);
+        
+        Document doc = XMLUtils.parse(in);
+        assertNotNull(doc);
+        
+        Map<String, String> ns = new HashMap<String, String>();
+        ns.put("soap", Soap11.SOAP_NAMESPACE);
+        ns.put("ns2", "http://cxf.apache.org/greeter_control/types");
+        XPathUtils xu = new XPathUtils(ns);
+        Node body = (Node) xu.getValue("/soap:Envelope/soap:Body", doc, XPathConstants.NODE);
+        assertNotNull(body);
+        String response = (String) xu.getValue("//ns2:greetMeResponse/ns2:responseType/text()",

+                                               body, 
+                                               XPathConstants.STRING);
+        assertEquals("Hello cxf", response);
     }
 
 }

Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/greeter_control/GreeterImplBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/greeter_control/GreeterImplBase.java?view=diff&rev=546028&r1=546027&r2=546028
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/greeter_control/GreeterImplBase.java
(original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/greeter_control/GreeterImplBase.java
Mon Jun 11 00:12:29 2007
@@ -32,8 +32,7 @@
 @WebService(serviceName = "GreeterService",
             portName = "GreeterPort",
             endpointInterface = "org.apache.cxf.greeter_control.Greeter",
-            targetNamespace = "http://cxf.apache.org/greeter_control",
-            wsdlLocation = "testutils/greeter_control.wsdl")
+            targetNamespace = "http://cxf.apache.org/greeter_control")
 /* This class does not implement the SEI */
 public class GreeterImplBase {
 



Mime
View raw message