cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1565203 - in /cxf/trunk: rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/ systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/ systests/jaxrs/src/test/ja...
Date Thu, 06 Feb 2014 12:30:41 GMT
Author: cschneider
Date: Thu Feb  6 12:30:41 2014
New Revision: 1565203

URL: http://svn.apache.org/r1565203
Log:
CXF-5543 Fix JAXRSJMSTest

Modified:
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSMessageConverter.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=1565203&r1=1565202&r2=1565203&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Thu Feb  6 12:30:41 2014
@@ -333,10 +333,13 @@ public class JMSConduit extends Abstract
         
         LOG.log(Level.FINE, "client received reply: ", jmsMessage);
         try {
-            Message inMessage = JMSMessageUtils.asCXFMessage(jmsMessage, JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
+            Message inMessage = JMSMessageUtils.asCXFMessage(jmsMessage, 
+                                                             JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
             SecurityContext securityContext = JMSMessageUtils.buildSecurityContext(jmsMessage,
jmsConfig);
             inMessage.put(SecurityContext.class, securityContext);
             exchange.setInMessage(inMessage);
+            Object responseCode = inMessage.get(org.apache.cxf.message.Message.RESPONSE_CODE);
+            exchange.put(org.apache.cxf.message.Message.RESPONSE_CODE, responseCode);
 
             if (exchange.isSynchronous()) {
                 synchronized (exchange) {

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java?rev=1565203&r1=1565202&r2=1565203&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSMessageUtils.java
Thu Feb  6 12:30:41 2014
@@ -64,11 +64,9 @@ final class JMSMessageUtils {
     private JMSMessageUtils() {
 
     }
-
     public static org.apache.cxf.message.Message asCXFMessage(Message message, String headerType)

         throws UnsupportedEncodingException, JMSException {
-
-        org.apache.cxf.message.Message inMessage = new MessageImpl();            
+        org.apache.cxf.message.Message inMessage = new MessageImpl();
         populateIncomingContext(message, inMessage, headerType);
         retrieveAndSetPayload(inMessage, message);
         return inMessage;
@@ -150,8 +148,7 @@ final class JMSMessageUtils {
                 inMessage.put(org.apache.cxf.message.Message.ENCODING, getEncoding(val));
             }
             if (name.equals(org.apache.cxf.message.Message.RESPONSE_CODE)) {
-                inMessage.getExchange().put(org.apache.cxf.message.Message.RESPONSE_CODE,
-                                            Integer.valueOf(val));
+                inMessage.put(org.apache.cxf.message.Message.RESPONSE_CODE, Integer.valueOf(val));
             }
         }
         inMessage.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, protHeaders);

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSMessageConverter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSMessageConverter.java?rev=1565203&r1=1565202&r2=1565203&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSMessageConverter.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSMessageConverter.java
Thu Feb  6 12:30:41 2014
@@ -72,7 +72,7 @@ public class JMSMessageConverter {
             StreamMessage streamMessage = (StreamMessage)message;
             return streamMessage.readObject();
         } else {
-            throw new IllegalArgumentException("Unsupported message type " + nullSafeClassName(message));
+            return new byte[]{};
         }
     }
 

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java?rev=1565203&r1=1565202&r2=1565203&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSJmsTest.java
Thu Feb  6 12:30:41 2014
@@ -70,7 +70,7 @@ public class JAXRSJmsTest extends Abstra
         assertTrue("server did not launch correctly", 
                    launchServer(EmbeddedJMSBrokerLauncher.class, props, null));
         assertTrue("server did not launch correctly",
-                   launchServer(JMSServer.class));
+                   launchServer(JMSServer.class, true));
         serversStarted = true;
     }
     
@@ -241,7 +241,10 @@ public class JAXRSJmsTest extends Abstra
     private void checkBookInResponse(Session session, Destination replyToDestination,
                                      long bookId, String bookName) throws Exception {
         MessageConsumer consumer = session.createConsumer(replyToDestination);
-        BytesMessage jmsMessage = (BytesMessage)consumer.receive(300000);
+        BytesMessage jmsMessage = (BytesMessage)consumer.receive(5000);
+        if (jmsMessage == null) {
+            throw new RuntimeException("No response recieved on " + replyToDestination);
+        }
         byte[] bytes = new byte[(int)jmsMessage.getBodyLength()];
         jmsMessage.readBytes(bytes);
         InputStream is = new ByteArrayInputStream(bytes);
@@ -262,7 +265,7 @@ public class JAXRSJmsTest extends Abstra
     private void postGetMessage(Session session, Destination destination, Destination replyTo)

         throws Exception {
         MessageProducer producer = session.createProducer(destination);
-        Message message = session.createMessage();
+        Message message = session.createBytesMessage();
         message.setJMSReplyTo(replyTo);
         message.setStringProperty("Accept", "application/xml");
         message.setStringProperty(org.apache.cxf.message.Message.REQUEST_URI, "/bookstore/books/123");

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml?rev=1565203&r1=1565202&r2=1565203&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml
Thu Feb  6 12:30:41 2014
@@ -20,11 +20,17 @@
 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jms="http://cxf.apache.org/transports/jms" xmlns:p="http://www.springframework.org/schema/p"
xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
     <import resource="classpath:META-INF/cxf/cxf.xml"/>
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
p:brokerURL="tcp://localhost:${testutil.ports.EmbeddedJMSBrokerLauncher}"/>
+    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"

+    	p:brokerURL="tcp://localhost:${testutil.ports.EmbeddedJMSBrokerLauncher}"/>
     <bean id="singleConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory"
destroy-method="destroy">
         <property name="targetConnectionFactory" ref="jmsConnectionFactory"/>
     </bean>
-    <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration" p:connectionFactory-ref="singleConnectionFactory"
p:timeToLive="500000" p:concurrentConsumers="1" p:maxSuspendedContinuations="0" p:maxConcurrentConsumers="1"/>
+    <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration" 
+    	p:connectionFactory-ref="singleConnectionFactory" 
+    	p:timeToLive="500000" 
+    	p:concurrentConsumers="1" 
+    	p:maxSuspendedContinuations="0" 
+    	p:maxConcurrentConsumers="1"/>
     <jms:destination name="{http://books.com}BookService.jms-destination">
         <jms:address jndiConnectionFactoryName="ConnectionFactory" jndiDestinationName="dynamicQueues/test.jmstransport.text">
             <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>



Mime
View raw message