cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r542137 - in /incubator/cxf/trunk: rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java testutils/src/main/resources/wsdl/jms_test_config.xml
Date Mon, 28 May 2007 07:45:58 GMT
Author: ningjiang
Date: Mon May 28 00:45:58 2007
New Revision: 542137

URL: http://svn.apache.org/viewvc?view=rev&rev=542137
Log:
CXF-690 Added the unit tests in cxf-rt-transports-jms to show how to setup the durable subscription

Modified:
    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/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=542137&r1=542136&r2=542137
==============================================================================
--- 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
Mon May 28 00:45:58 2007
@@ -92,7 +92,7 @@
     }
     
     @Test    
-    public void testGetConfiguration() throws Exception {
+    public void testGetConfigurationFromSpring() throws Exception {
         SpringBusFactory bf = new SpringBusFactory();
         BusFactory.setDefaultBus(null);
         bus = bf.createBus("/wsdl/jms_test_config.xml");
@@ -114,11 +114,76 @@
         assertEquals("Can't get the right AddressPolicy's ConnectionPassword",
                      "testPassword",
                      destination.getJMSAddress().getConnectionPassword());
+        assertEquals("Can't get the right DurableSubscriberName",
+                     "cxf_subscriber",
+                     destination.getRuntimePolicy().getDurableSubscriberName());
+        assertEquals("Can't get the right MessageSelectorName",
+                     "cxf_message_selector",
+                     destination.getRuntimePolicy().getMessageSelector());
         BusFactory.setDefaultBus(null);
         
     }
     
     @Test    
+    public void testGetConfigurationFormWSDL() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        BusFactory.setDefaultBus(null);
+        bus = bf.createBus();
+        BusFactory.setDefaultBus(bus);
+        setupServiceInfo("http://cxf.apache.org/hello_world_jms",
+                         "/wsdl/jms_test.wsdl",
+                         "HelloWorldQueueBinMsgService",
+                         "HelloWorldQueueBinMsgPort");
+      
+        JMSDestination destination = setupJMSDestination(false);
+        
+        assertEquals("Can't get the right DurableSubscriberName",
+                     "CXF_subscriber",
+                     destination.getRuntimePolicy().getDurableSubscriberName());
+        
+        assertEquals("Can't get the right AddressPolicy's ConnectionPassword",
+                     "dynamicQueues/test.jmstransport.binary",
+                     destination.getJMSAddress().getJndiDestinationName());
+       
+        BusFactory.setDefaultBus(null);
+        
+    }
+    
+    @Test   
+    public void testDurableSubscriber() throws Exception {
+        SpringBusFactory bf = new SpringBusFactory();
+        BusFactory.setDefaultBus(null);
+        bus = bf.createBus("/wsdl/jms_test_config.xml");
+        BusFactory.setDefaultBus(bus);
+        destMessage = null;
+        inMessage = null;
+        setupServiceInfo("http://cxf.apache.org/hello_world_jms", 
+                         "/wsdl/jms_test.wsdl", 
+                         "HelloWorldPubSubService", 
+                         "HelloWorldPubSubPort");
+        JMSConduit conduit = setupJMSConduit(true, false);
+        Message outMessage = new MessageImpl();
+        setupMessageHeader(outMessage);
+        JMSDestination destination = null;
+        try {
+            destination = setupJMSDestination(true);        
+            //destination.activate();
+        } catch (IOException e) {
+            assertFalse("The JMSDestination activate should not through exception ", false);
           
+            e.printStackTrace();
+        }        
+        sendoutMessage(conduit, outMessage, true);  
+        // wait for the message to be get from the destination
+        waitForReceiveDestMessage();
+        Thread.sleep(2000000);
+        // just verify the Destination inMessage
+        assertTrue("The destiantion should have got the message ", destMessage != null);
+        verifyReceivedMessage(destMessage);
+        verifyHeaders(destMessage, outMessage);
+        destination.shutdown();
+    }
+    
+    @Test    
     public void testOneWayDestination() throws Exception {
         destMessage = null;
         inMessage = null;
@@ -201,6 +266,8 @@
                      outHeader.getJMSType(), inHeader.getJMSType());
         
     }
+    
+    
     
     @Test    
     public void testRoundTripDestination() 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=542137&r1=542136&r2=542137
==============================================================================
--- 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 Mon May 28 00:45:58
2007
@@ -63,6 +63,17 @@
       <jms:serverConfig
         messageTimeToLive="500"
         durableSubscriptionClientId="test-server-id"/>
+  </jms:destination> 
+  
+   <jms:destination id="{http://cxf.apache.org/hello_world_jms}HelloWorldPubSubPort.jms-destination">
+      <jms:sessionPool
+          lowWaterMark="10"
+          highWaterMark="5000"/>
+      <jms:runtimePolicy              
+         durableSubscriberName="cxf_subscriber"/>
+      <jms:serverConfig
+        messageTimeToLive="500"
+        durableSubscriptionClientId="test-server-id"/>
   </jms:destination>  
 
 </beans>



Mime
View raw message