cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r544431 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ systests/src/test/java/org/apache/cxf/systest/servlet/
Date Tue, 05 Jun 2007 09:26:20 GMT
Author: ningjiang
Date: Tue Jun  5 02:26:20 2007
New Revision: 544431

URL: http://svn.apache.org/viewvc?view=rev&rev=544431
Log:
CXF-663 add the systest for the HTTPBindingServletTest and now there is no ClassCastException

Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?view=diff&rev=544431&r1=544430&r2=544431
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
Tue Jun  5 02:26:20 2007
@@ -49,6 +49,7 @@
 import org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
 import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
+import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.resource.DefaultResourceManager;
 import org.apache.cxf.resource.ResourceManager;
 import org.apache.cxf.resource.ResourceResolver;
@@ -74,6 +75,7 @@
     private Object implementor;
     private Server server;
     private JaxWsServerFactoryBean serverFactory;
+    private JaxWsServiceFactoryBean serviceFactory;
     private Service service;
     private Map<String, Object> properties;
     private List<Source> metadata;
@@ -146,6 +148,10 @@
     public Service getService() {
         return service;
     }
+    
+    public JaxWsServiceFactoryBean getServiceFactory() {
+        return serviceFactory;
+    }
 
     
     @Override
@@ -186,6 +192,10 @@
         doPublish(addr);
     }
 
+    public void setServiceFactory(JaxWsServiceFactoryBean sf) {
+        serviceFactory = sf;
+    }
+    
     public void setMetadata(List<Source> metadata) {
         this.metadata = metadata;
     }
@@ -266,10 +276,14 @@
                 JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(getImplementorClass());
                 endpointName = implInfo.getEndpointName();
             }
+            
+            if (serviceFactory != null) {
+                serverFactory.setServiceFactory(serviceFactory);
+            }
 
-            if (serviceName != null) {
+            /*if (serviceName != null) {
                 serverFactory.getServiceFactory().setServiceName(serviceName);
-            }
+            }*/
 
             configureObject(this);
             

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java?view=diff&rev=544431&r1=544430&r2=544431
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/HttpBindingServletTest.java
Tue Jun  5 02:26:20 2007
@@ -49,12 +49,22 @@
     }
     
     @Test
-    public void testInvokingRestService() throws Exception {
+    public void testServerFactoryRestService() throws Exception {
+        testInvokingRestService("/services/serverFactory/restful");
+    }
+    
+    @Test
+    public void testEndpointRestService() throws Exception {
+        testInvokingRestService("/services/endpoint/restful");
+    }
+    
+    
+    private void testInvokingRestService(String serviceAddress) throws Exception {
         ServletUnitClient client = newClient();
         client.setExceptionsThrownOnErrorStatus(false);
         
         WebRequest req = 
-            new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers");
+            new GetMethodQueryWebRequest(CONTEXT_URL + serviceAddress + "/customers");
         
         WebResponse response = client.getResponse(req);        
         Document doc = DOMUtils.readXml(response.getInputStream());
@@ -65,7 +75,7 @@
         assertValid("/c:customers/c:customer/c:id[text()='123']", doc);
         assertValid("/c:customers/c:customer/c:name[text()='Dan Diephouse']", doc);
         
-        req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers/123");
+        req = new GetMethodQueryWebRequest(CONTEXT_URL + serviceAddress + "/customers/123");
         response = client.getResponse(req);        
         doc = DOMUtils.readXml(response.getInputStream());
         assertNotNull(doc);
@@ -75,7 +85,7 @@
         assertValid("/c:customer/c:name[text()='Dan Diephouse']", doc);
         
         // Try invalid customer
-        req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers/0");
+        req = new GetMethodQueryWebRequest(CONTEXT_URL + serviceAddress + "/customers/0");
         response = client.getResponse(req); 
         
         assertEquals("Expect the wrong response code", response.getResponseCode(), 500);
@@ -85,7 +95,7 @@
         assertValid("//c:CustomerNotFoundDetails", doc);
         
         PostMethodWebRequest postReq = 
-            new PostMethodWebRequest(CONTEXT_URL + "/services/restful/customers", 
+            new PostMethodWebRequest(CONTEXT_URL + serviceAddress + "/customers", 
                                  getClass().getResourceAsStream("add.xml"),
                                  "text/xml; charset=UTF-8");
         response = client.getResponse(postReq);
@@ -94,7 +104,7 @@
         assertValid("/c:addCustomer", doc);
         
         PutMethodWebRequest putReq = 
-            new PutMethodWebRequest(CONTEXT_URL + "/services/restful/customers/123", 
+            new PutMethodWebRequest(CONTEXT_URL + serviceAddress + "/customers/123", 
                                  getClass().getResourceAsStream("update.xml"),
                                  "text/xml; charset=UTF-8");
         response = client.getResponse(putReq);
@@ -103,7 +113,7 @@
         assertValid("/c:updateCustomer", doc);
       
         // Get the updated document
-        req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/restful/customers/123");
+        req = new GetMethodQueryWebRequest(CONTEXT_URL + serviceAddress + "/customers/123");
         response = client.getResponse(req);
         doc = DOMUtils.readXml(response.getInputStream());
         assertNotNull(doc);  

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml?view=diff&rev=544431&r1=544430&r2=544431
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/servlet/restful_service.xml
Tue Jun  5 02:26:20 2007
@@ -39,11 +39,20 @@
     <property name="serviceBean">
       <bean class="org.apache.cxf.customer.bare.CustomerService"/>
     </property>
-    <property name="address" value="/services/restful"/>
+    <property name="address" value="/services/serverFactory/restful"/>
     <property name="bus" ref="cxf"/>
     <property name="bindingId" value="http://apache.org/cxf/binding/http"/>
     <property name="transportId" value="http://schemas.xmlsoap.org/wsdl/soap/http"/>
     <property name="serviceFactory" ref="JaxWsServiceFactoryBean"/>
   </bean>  
+  
+  <jaxws:endpoint id="restfulServer" 
+              implementor="org.apache.cxf.customer.bare.CustomerService"
+              address="/services/endpoint/restful"
+              bindingUri="http://apache.org/cxf/binding/http">              
+     <jaxws:serviceFactory> 
+       <ref bean="JaxWsServiceFactoryBean"/>
+     </jaxws:serviceFactory> 
+  </jaxws:endpoint>
      
 </beans>



Mime
View raw message