cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1489304 - in /cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet: CXFServletTest.java ExternalServicesServletTest.java cxf-servlet.xml
Date Tue, 04 Jun 2013 07:21:54 GMT
Author: ffang
Date: Tue Jun  4 07:21:54 2013
New Revision: 1489304

URL: http://svn.apache.org/r1489304
Log:
[CXF-5047]add a testcase to demonstrate that how multiple endpoints with publishedEndpointUrl
property work

Modified:
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
    cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/cxf-servlet.xml

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java?rev=1489304&r1=1489303&r2=1489304&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/CXFServletTest.java
Tue Jun  4 07:21:54 2013
@@ -19,10 +19,14 @@
 package org.apache.cxf.systest.servlet;
 
 
+
 import java.util.HashSet;
 import java.util.Set;
 
 import javax.jws.WebService;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.soap.SOAPBinding;
 
@@ -39,6 +43,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.helpers.XMLUtils;
 import org.apache.hello_world_soap_http.BaseGreeterImpl;
 
 import org.junit.Before;
@@ -47,6 +52,9 @@ import org.junit.Test;
 
 public class CXFServletTest extends AbstractServletTest {
     
+    public static final QName SERVICE_NAME = new QName("http://apache.org/hello_world_soap_http",
"SOAPService");
+   
+    
     
     @Before
     public void setUp() throws Exception {
@@ -97,7 +105,7 @@ public class CXFServletTest extends Abst
         
         
         WebLink[] links = res.getLinks();
-        assertEquals("Wrong number of service links", 4, links.length);
+        assertEquals("Wrong number of service links", 6, links.length);
         
         Set<String> links2 = new HashSet<String>();
         for (WebLink l : links) {
@@ -118,7 +126,7 @@ public class CXFServletTest extends Abst
             links2.add(l.getURLString());
         }
         
-        assertEquals("Wrong number of service links", 4, links.length);
+        assertEquals("Wrong number of service links", 6, links.length);
         assertTrue(links2.contains(CONTEXT_URL + "/services/greeter?wsdl"));       
         assertTrue(links2.contains(CONTEXT_URL + "/services/greeter2?wsdl")); 
         assertTrue(links2.contains("http://cxf.apache.org/MyGreeter?wsdl")); 
@@ -178,10 +186,36 @@ public class CXFServletTest extends Abst
         assertEquals("text/xml", res.getContentType());
         Document doc = DOMUtils.readXml(res.getInputStream());
         assertNotNull(doc);
+        XMLUtils.printDOM(doc);
         
         assertValid("//wsdl:operation[@name='greetMe']", doc);
         assertValid("//wsdlsoap:address[@location='" + CONTEXT_URL + "/services/greeter']",
doc);
     }
+    
+    
+    @Test
+    public void testGetWSDLWithMultiplePublishedEndpointUrl() throws Exception {
+        ServletUnitClient client = newClient();
+        client.setExceptionsThrownOnErrorStatus(true);
+        
+        WebRequest req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/greeter5?wsdl");
+        
+        WebResponse res = client.getResponse(req); 
+        assertEquals(200, res.getResponseCode());
+        assertEquals("text/xml", res.getContentType());
+        Document doc = DOMUtils.readXml(res.getInputStream());
+        assertNotNull(doc);
+        WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+        wsdlReader.setFeature("javax.wsdl.verbose", false);
+        
+        XMLUtils.printDOM(doc);
+        
+        assertValid("//wsdl:service[@name='SOAPService']/wsdl:port[@name='SoapPort']/wsdlsoap:address[@location='"

+            + "http://cxf.apache.org/publishedEndpointUrl1']", doc);
+        assertValid("//wsdl:service[@name='SOAPService']/wsdl:port[@name='SoapPort1']/wsdlsoap:address[@location='"

+            + "http://cxf.apache.org/publishedEndpointUrl2']", doc);
+        
+    }
     @Test
     public void testGetWSDLWithIncludes() throws Exception {
         ServletUnitClient client = newClient();

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java?rev=1489304&r1=1489303&r2=1489304&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/ExternalServicesServletTest.java
Tue Jun  4 07:21:54 2013
@@ -59,7 +59,7 @@ public class ExternalServicesServletTest
         //test the '/' context get service list
         WebResponse  res = client.getResponse(CONTEXT_URL + "/");
         WebLink[] links = res.getLinks();
-        assertEquals("Wrong number of service links", 4, links.length);
+        assertEquals("Wrong number of service links", 6, links.length);
         
         Set<String> links2 = new HashSet<String>();
         for (WebLink l : links) {

Modified: cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/cxf-servlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/cxf-servlet.xml?rev=1489304&r1=1489303&r2=1489304&view=diff
==============================================================================
--- cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/cxf-servlet.xml
(original)
+++ cxf/trunk/systests/transports/src/test/java/org/apache/cxf/systest/servlet/cxf-servlet.xml
Tue Jun  4 07:21:54 2013
@@ -57,5 +57,24 @@ http://cxf.apache.org/jaxws http://cxf.a
     </jaxws:properties>
   </jaxws:endpoint>
 
+  <jaxws:endpoint
+    id="greeter5"
+    address="/greeter5"
+    publishedEndpointUrl="http://cxf.apache.org/publishedEndpointUrl1"
+        implementor="org.apache.hello_world_soap_http.GreeterImpl"
+        wsdlLocation="/org/apache/cxf/systest/servlet/hello_world.wsdl"
+        serviceName="e:SOAPService"
+        endpointName="e:SoapPort" 
+        xmlns:e="http://apache.org/hello_world_soap_http"     />
+ 
+  <jaxws:endpoint
+    id="greeter6"
+    address="/greeter6"
+    publishedEndpointUrl="http://cxf.apache.org/publishedEndpointUrl2"
+        implementor="org.apache.hello_world_soap_http.GreeterImpl"
+        wsdlLocation="/org/apache/cxf/systest/servlet/hello_world.wsdl"      
+        serviceName="e:SOAPService"
+        endpointName="e:SoapPort1"
+        xmlns:e="http://apache.org/hello_world_soap_http"    />
   
-</beans>
\ No newline at end of file
+</beans>



Mime
View raw message