cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r560897 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/ rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ systests/src/test/java/org/apache/cxf/systest/jms/
Date Mon, 30 Jul 2007 09:14:47 GMT
Author: ningjiang
Date: Mon Jul 30 02:14:38 2007
New Revision: 560897

URL: http://svn.apache.org/viewvc?view=rev&rev=560897
Log:
Fixed <jaxws:client> not support wsdlLocation attribute.
Added unit test and jms systest for it.

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml 
 (with props)
Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?view=diff&rev=560897&r1=560896&r2=560897
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
Mon Jul 30 02:14:38 2007
@@ -37,6 +37,7 @@
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.jaxws.service.Hello;
 import org.apache.hello_world_soap_http.Greeter;
@@ -217,5 +218,12 @@
         assertTrue(logging);
         
         assertTrue(client.getEndpoint().getService().getDataBinding() instanceof SourceDataBinding);
+        
+        JaxWsProxyFactoryBean factory = (JaxWsProxyFactoryBean)ctx.getBean("wsdlLocation.proxyFactory");
+        assertNotNull(factory);
+        String wsdlLocation = factory.getWsdlLocation();
+        assertEquals("We should get the right wsdl location" , wsdlLocation, "wsdl/hello_world.wsdl");
+        
+        
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml?view=diff&rev=560897&r1=560896&r2=560897
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml
Mon Jul 30 02:14:38 2007
@@ -60,37 +60,13 @@
       <bean class="org.apache.cxf.databinding.source.SourceDataBinding"/>
     </jaxws:dataBinding>
   </jaxws:client>
-    
-<!--
-  
-  <jaxws:endpoint id="epWithProps" 
-    implementor="#greeter"
-    address="http://localhost:8080/test">
-    <jaxws:properties>
-      <entry key="foo" value="bar"/>
-    </jaxws:properties>
-  </jaxws:endpoint>
-  
-  <jaxws:endpoint id="classImpl" 
-    implementor="org.apache.cxf.jaxws.service.Hello"
-    address="http://localhost:8080/test"/>
-    
-  <jaxws:endpoint id="wsdlLocation" 
-    implementor="#greeter" address="http://localhost:8080/simpleWithAddress"
+   
+  <jaxws:client id="wsdlLocation" 
+    serviceClass="org.apache.hello_world_soap_http.Greeter"
+    serviceName="s:SOAPService"
+    xmlns:s="http://apache.org/hello_world_soap_http"
+    address="http://localhost:8080/simpleWithAddress"
     wsdlLocation="wsdl/hello_world.wsdl"/>
     
       
-  <jaxws:endpoint id="epWithInterceptors" 
-    implementor="org.apache.cxf.jaxws.service.Hello"
-    address="http://localhost:8080/test">
-	<jaxws:inInterceptors>
-	  <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
-	  <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
-	</jaxws:inInterceptors>
-	<jaxws:outInterceptors>
-	  <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
-	  <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
-	</jaxws:outInterceptors>
-  </jaxws:endpoint>
-    -->
 </beans>

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java?view=diff&rev=560897&r1=560896&r2=560897
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java
Mon Jul 30 02:14:38 2007
@@ -149,6 +149,14 @@
     public void setUsername(String username) {
         this.username = username;
     }
+    
+    public String getWsdlLocation() {
+        return getWsdlURL();
+    }
+    
+    public void setWsdlLocation(String wsdlURL) {
+        setWsdlURL(wsdlURL);
+    }
 
     public String getWsdlURL() {
         return clientFactoryBean.getServiceFactory().getWsdlURL();

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?view=diff&rev=560897&r1=560896&r2=560897
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Mon Jul 30 02:14:38 2007
@@ -28,6 +28,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 
+
 import org.apache.cxf.hello_world_jms.BadRecordLitFault;
 import org.apache.cxf.hello_world_jms.HelloWorldOneWayPort;
 import org.apache.cxf.hello_world_jms.HelloWorldOneWayQueueService;
@@ -46,6 +47,8 @@
 import org.junit.Before;
 import org.junit.Test;
 
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
 public class JMSClientServerTest extends AbstractBusClientServerTestBase {
     
     protected static boolean serversStarted;
@@ -185,6 +188,58 @@
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();
         }
+    }
+    
+    @Test 
+    public void testConnectionsWithinSpring() throws Exception {
+        ClassPathXmlApplicationContext ctx = 
+            new ClassPathXmlApplicationContext(
+                new String[] {"/org/apache/cxf/systest/jms/JMSClients.xml"});
+               
+        HelloWorldPortType greeter = (HelloWorldPortType)ctx.getBean("jmsRPCClient");
+        assertNotNull(greeter);
+        
+        String response1 = new String("Hello Milestone-");
+        String response2 = new String("Bonjour");
+        try {
+            
+            for (int idx = 0; idx < 5; idx++) {
+                String greeting = greeter.greetMe("Milestone-" + idx);
+                assertNotNull("no response received from service", greeting);
+                String exResponse = response1 + idx;
+                assertEquals(exResponse, greeting);
+
+                String reply = greeter.sayHi();
+                assertNotNull("no response received from service", reply);
+                assertEquals(response2, reply);
+                
+                try {
+                    greeter.testRpcLitFault("BadRecordLitFault");
+                    fail("Should have thrown BadRecoedLitFault");
+                } catch (BadRecordLitFault ex) {
+                    assertNotNull(ex.getFaultInfo());
+                }
+                
+                try {
+                    greeter.testRpcLitFault("NoSuchCodeLitFault");
+                    fail("Should have thrown NoSuchCodeLitFault exception");
+                } catch (NoSuchCodeLitFault nslf) {
+                    assertNotNull(nslf.getFaultInfo());
+                    assertNotNull(nslf.getFaultInfo().getCode());
+                } 
+            }
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+        
+        HelloWorldOneWayPort greeter1 = (HelloWorldOneWayPort)ctx.getBean("jmsQueueOneWayServiceClient");
+        assertNotNull(greeter1);
+        try {
+            greeter1.greetMeOneWay("hello");
+        } catch (Exception ex) {
+            fail("There should not throw the exception" + ex);
+        }
+        
     }
     
     @Test

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml?view=auto&rev=560897
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml Mon
Jul 30 02:14:38 2007
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xmlns:jaxws="http://cxf.apache.org/jaxws"
+      xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-extension-jms.xml"/>
+    <!--jaxws:endpoint
+        id="GreerterJMSService"
+        implementor="org.apache.cxf.systest.jms.GreeterImplQueueOneWay"
+        address="http://cxf.apache.org/transports/jms" /-->
+        
+    <jaxws:client id="jmsRPCClient" 
+    	serviceClass="org.apache.cxf.hello_world_jms.HelloWorldPortType"    
+    	serviceName="s:HelloWorldService"
+    	endpointName="s:HelloWorldPort"    	
+    	xmlns:s="http://cxf.apache.org/hello_world_jms"
+    	wsdlLocation="classpath:wsdl/jms_test.wsdl"/>       
+    		   
+    
+    <bean id="jmsQueueOneWayServiceClient" class="org.apache.cxf.hello_world_jms.HelloWorldOneWayPort"
+       factory-bean="jmsQueueOneWayServiceClientFactory"
+ 	   factory-method="create"/>
+
+    <bean id="jmsQueueOneWayServiceClientFactory"
+          class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
+          <property name="serviceClass" value="org.apache.cxf.hello_world_jms.HelloWorldOneWayPort"/>
+          <property name="wsdlURL" value="classpath:wsdl/jms_test.wsdl" />
+          <property name="serviceName">
+              <bean class="javax.xml.namespace.QName" scope="prototype">
+                  <constructor-arg value="http://cxf.apache.org/hello_world_jms" />
+                  <constructor-arg value="HelloWorldOneWayQueueService" />
+              </bean>
+          </property>
+          <property name="endpointName">
+              <bean class="javax.xml.namespace.QName" scope="prototype">
+                  <constructor-arg value="http://cxf.apache.org/hello_world_jms" />
+                  <constructor-arg value="HelloWorldOneWayQueuePort" />
+              </bean>
+          </property>
+   </bean>
+   
+ </beans>  
\ No newline at end of file

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClients.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message