cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r475593 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ testutils/src/main/resources/wsdl/
Date Thu, 16 Nov 2006 06:16:18 GMT
Author: ningjiang
Date: Wed Nov 15 22:16:17 2006
New Revision: 475593

URL: http://svn.apache.org/viewvc?view=rev&rev=475593
Log:
[JIRA CXF-243] 
Added code in WSDLServiceBuilder.buildEndpoint to handle the port address do notbe specified
we get the transport id from binding. 
Added unit tests of JMS configuration, the configuration file has been updated. For more information
please see 

testutils/src/main/resources/wsdl/jms_test_config.xml

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java
    incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
    incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/jms_test_config.xml

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=475593&r1=475592&r2=475593
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
Wed Nov 15 22:16:17 2006
@@ -45,6 +45,8 @@
 import javax.wsdl.extensions.schema.Schema;
 import javax.xml.namespace.QName;
 
+import com.ibm.wsdl.extensions.soap.SOAPBindingImpl;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingFactory;
@@ -206,8 +208,18 @@
     }
 
     public EndpointInfo buildEndpoint(ServiceInfo service, BindingInfo bi, Port port) {
-        String ns = ((ExtensibilityElement)port.getExtensibilityElements().get(0)).getElementType()
-            .getNamespaceURI();
+        List elements = port.getExtensibilityElements();
+        String ns = null;
+        if (null != elements && elements.size() > 0) {
+            ns = ((ExtensibilityElement)elements.get(0)).getElementType()
+                        .getNamespaceURI();
+        } else { // get the transport id from bindingInfo            
+            ExtensibilityElement extElem = (ExtensibilityElement)port.getBinding().
+                                            getExtensibilityElements().get(0);
+            if (extElem instanceof SOAPBindingImpl) {
+                ns = (String)((SOAPBindingImpl)extElem).getTransportURI();              
   
+            }            
+        }
         EndpointInfo ei = null;
 
         try {

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?view=diff&rev=475593&r1=475592&r2=475593
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Wed Nov 15 22:16:17 2006
@@ -65,8 +65,7 @@
 
 
 public class JMSDestination extends JMSTransportBase implements Destination {
-    static final Logger LOG = LogUtils.getL7dLogger(JMSDestination.class);
-    final EndpointInfo endpointInfo;
+    static final Logger LOG = LogUtils.getL7dLogger(JMSDestination.class);    
     final EndpointReferenceType reference;
     final ConduitInitiator conduitInitiator;
     JMSDestinationConfigBean jmsDestinationConfigBean;
@@ -77,8 +76,7 @@
     public JMSDestination(Bus b,
                           ConduitInitiator ci,
                           EndpointInfo info) throws IOException {
-        super(b, info, true);
-        endpointInfo = info;
+        super(b, info, true);        
         initConfig();
         conduitInitiator = ci;
         reference = new EndpointReferenceType();

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java?view=diff&rev=475593&r1=475592&r2=475593
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportBase.java
Wed Nov 15 22:16:17 2006
@@ -31,6 +31,7 @@
 
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.jms.base.JMSTransportBaseConfigBean;
 import org.apache.cxf.transports.jms.JMSAddressPolicyType;
@@ -53,6 +54,12 @@
     public JMSTransportBase(Bus b, EndpointInfo endpoint, boolean isServer) {
         bus = b;
         endpointInfo = endpoint;
+        
+        Configurer configurer = bus.getExtension(Configurer.class);
+        if (null != configurer) {
+            configurer.configureBean(this);
+        }
+        
         if (!isSetSessionPoolConfig()) {
             setSessionPoolConfig(new JMSSessionPoolConfigPolicy());
         }

Modified: incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java?view=diff&rev=475593&r1=475592&r2=475593
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
Wed Nov 15 22:16:17 2006
@@ -28,6 +28,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.transports.jms.context.JMSMessageHeadersType;
@@ -43,6 +44,31 @@
     public static Test suite() {
         TestSuite suite = new TestSuite(JMSConduitTest.class);
         return  new JMSBrokerSetup(suite, "tcp://localhost:61500");        
+    }
+    
+    public void testGetConfiguration() throws Exception {
+        // setup the new bus to get the configuration file
+        SpringBusFactory bf = new SpringBusFactory();
+        bf.setDefaultBus(null);
+        bus = bf.createBus("/wsdl/jms_test_config.xml");
+        bf.setDefaultBus(bus);
+        setupServiceInfo("http://cxf.apache.org/jms_conf_test",
+                         "/wsdl/jms_test_no_addr.wsdl",
+                         "HelloWorldQueueBinMsgService",
+                         "HelloWorldQueueBinMsgPort");
+        JMSConduit conduit = setupJMSConduit(false, false);
+        assertNotNull(conduit.jmsConduitConfigBean);
+        assertEquals("Can't get the right ClientReceiveTimeout",
+                     500,
+                     conduit.jmsConduitConfigBean.getClientConfig().getClientReceiveTimeout());
+        assertEquals("Can't get the right SessionPoolConfig's LowWaterMark",
+                     10,
+                     conduit.getSessionPoolConfig().getLowWaterMark());
+        assertEquals("Can't get the right AddressPolicy's ConnectionPassword",
+                     "testPassword",
+                     conduit.getAddressPolicy().getConnectionPassword());
+        bf.setDefaultBus(null);
+        
     }
     
     public void testPrepareSend() throws Exception {

Modified: incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java?view=diff&rev=475593&r1=475592&r2=475593
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
(original)
+++ incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
Wed Nov 15 22:16:17 2006
@@ -26,6 +26,7 @@
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.transport.Conduit;
@@ -86,6 +87,32 @@
             jmsDestination.setMessageObserver(observer);
         }
         return jmsDestination;
+    }
+    
+    public void testGetConfiguration() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        bf.setDefaultBus(null);
+        bus = bf.createBus("/wsdl/jms_test_config.xml");
+        bf.setDefaultBus(bus);
+        setupServiceInfo("http://cxf.apache.org/jms_conf_test",
+                         "/wsdl/jms_test_no_addr.wsdl",
+                         "HelloWorldQueueBinMsgService",
+                         "HelloWorldQueueBinMsgPort");
+        JMSDestination destination = setupJMSDestination(false);
+        assertEquals("Can't get the right ServerConfig's MessageTimeToLive ",
+                     500,
+                     destination.jmsDestinationConfigBean.getServerConfig().getMessageTimeToLive());
+        assertEquals("Can't get the right Server's MessageSelector",
+                     "cxf_message_selector",
+                     destination.jmsDestinationConfigBean.getServer().getMessageSelector());
+        assertEquals("Can't get the right SessionPoolConfig's LowWaterMark",
+                     10,
+                     destination.getSessionPoolConfig().getLowWaterMark());
+        assertEquals("Can't get the right AddressPolicy's ConnectionPassword",
+                     "testPassword",
+                     destination.getAddressPolicy().getConnectionPassword());
+        bf.setDefaultBus(null);
+        
     }
     
     public void testOneWayDestination() throws Exception {

Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/jms_test_config.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/jms_test_config.xml?view=diff&rev=475593&r1=475592&r2=475593
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/jms_test_config.xml (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/jms_test_config.xml Wed Nov 15 22:16:17
2006
@@ -17,24 +17,45 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<!DOCTYPE beans SYSTEM 
-     "http://cxf.apache.org/configuration/spring/cxf-spring-beans.dtd">
 
 <beans 
+    xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:ct="http://cxf.apache.org/configuration/types"
     xmlns:jms="http://cxf.apache.org/transports/jms"
-    xmlns:jms-conf="http://cxf.apache.org/transports/jms/jms-conf">
-
-  <bean id="cxf.{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgService/HelloWorldQueueBinMsgPort.jms-client"
-        class="org.apache.cxf.bus.transports.jms.jms_client_config.spring.JmsClientConfigBean">
-      
-      <property name="jmsClient">
+    xmlns:jms-conf="http://cxf.apache.org/transports/jms/jms-conf"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+    
+    <bean id="{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgPort.jms-conduit-base"
+        class="org.apache.cxf.transport.jms.base.JMSTransportBaseConfigBean">
+	<property name="addressPolicy">
           <value>
-              <jms:client messageType="binary"/>
+              <jms:address
+                  destinationStyle="queue"
+                  jndiConnectionFactoryName="MockConnectionFactory"
+                  jndiDestinationName="myOwnDestination"
+                  jndiReplyDestinationName="myOwnReplyDestination"
+                  connectionUserName="testUser"
+                  connectionPassword="testPassword">
+                  <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.cxf.transport.jms.MockInitialContextFactory"/>
+                  <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
+              </jms:address>
           </value>
       </property>
       
-      <property name="jmsAddress">
+      <property name="sessionPoolConfig">
+          <value>
+              <jms-conf:sessionPoolConfig 
+                  lowWaterMark="10"
+                  highWaterMark="5000"
+              />
+          </value>
+      </property>
+  </bean>     
+
+    <bean id="{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgPort.jms-destination-base"
+        class="org.apache.cxf.transport.jms.base.JMSTransportBaseConfigBean">
+	<property name="addressPolicy">
           <value>
               <jms:address
                   destinationStyle="queue"
@@ -49,7 +70,7 @@
           </value>
       </property>
       
-      <property name="jmsSessionPool">
+      <property name="sessionPoolConfig">
           <value>
               <jms-conf:sessionPoolConfig 
                   lowWaterMark="10"
@@ -57,8 +78,20 @@
               />
           </value>
       </property>
+  </bean>     
+	
+
+  <bean id="{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgPort.jms-conduit"
+        class="org.apache.cxf.transport.jms.conduit.JMSConduitConfigBean">
       
-      <property name="jmsClientConfig">
+      <property name="client">
+          <value>
+              <jms:client messageType="binary"/>
+          </value>
+      </property>
+     
+           
+      <property name="clientConfig">
           <value>
               <jms-conf:clientConfig
                   clientReceiveTimeout="500"
@@ -69,25 +102,10 @@
       
   </bean>
   
-  <bean id="cxf.{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgService.jms-server"
-        class="org.apache.cxf.bus.transports.jms.jms_server_config.spring.JmsServerConfigBean">
-        
-        <property name="jmsAddress">
-          <value>
-              <jms:address
-                  destinationStyle="queue"
-                  jndiConnectionFactoryName="MockConnectionFactory"
-                  jndiDestinationName="myOwnDestination"
-                  jndiReplyDestinationName="myOwnReplyDestination"
-                  connectionUserName="testUser"
-                  connectionPassword="testPassword">
-                  <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.cxf.transport.jms.MockInitialContextFactory"/>
-                  <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61616"/>
-              </jms:address>
-          </value>
-      </property>
+  <bean id="{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgPort.jms-destination"
+        class="org.apache.cxf.transport.jms.destination.JMSDestinationConfigBean">
 
-      <property name="jmsServer">
+      <property name="server">
           <value>
              <jms:server                   
                  messageSelector="cxf_message_selector"
@@ -97,17 +115,8 @@
              />
           </value>
       </property>
-      
-      <property name="jmsSessionPool">
-        <value>
-            <jms-conf:sessionPoolConfig 
-                lowWaterMark="10"
-                highWaterMark="5000"
-            />
-        </value>
-    </property>
 
-    <property name="jmsServerConfig">
+    <property name="serverConfig">
         <value>
             <jms-conf:serverConfig
                 messageTimeToLive="500"



Mime
View raw message