cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1565125 - 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/ rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ systests/jaxrs/src/test...
Date Thu, 06 Feb 2014 09:03:09 GMT
Author: cschneider
Date: Thu Feb  6 09:03:08 2014
New Revision: 1565125

URL: http://svn.apache.org/r1565125
Log:
CXF-5543 Fix for compile error in jaxrs systests

Modified:
    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/JMSUtil.java
    cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.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/JMSBookStore.java

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=1565125&r1=1565124&r2=1565125&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 09:03:08 2014
@@ -37,7 +37,6 @@ import javax.jms.BytesMessage;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Message;
-import javax.jms.ObjectMessage;
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.TextMessage;
@@ -54,6 +53,7 @@ import org.apache.cxf.transport.jms.spec
 import org.apache.cxf.transport.jms.uri.JMSEndpoint;
 import org.apache.cxf.transport.jms.uri.JMSEndpointParser;
 import org.apache.cxf.transport.jms.util.JMSMessageConverter;
+import org.apache.cxf.transport.jms.util.JMSUtil;
 
 public final class JMSMessageUtils {
     private static final Logger LOG = LogUtils.getL7dLogger(JMSMessageUtils.class);
@@ -62,30 +62,6 @@ public final class JMSMessageUtils {
 
     }
 
-    /**
-     * Create a JMS of the appropriate type populated with the given payload.
-     * 
-     * @param payload the message payload, expected to be either of type String or byte[]
depending on payload
-     *            type
-     * @param session the JMS session
-     * @param replyTo the ReplyTo destination if any
-     * @return a JMS of the appropriate type populated with the given payload
-     */
-    static Message createAndSetPayload(Object payload, Session session, String messageType)
-        throws JMSException {
-        Message message = null;
-        if (JMSConstants.TEXT_MESSAGE_TYPE.equals(messageType)) {
-            message = session.createTextMessage((String)payload);
-        } else if (JMSConstants.BYTE_MESSAGE_TYPE.equals(messageType)) {
-            message = session.createBytesMessage();
-            ((BytesMessage)message).writeBytes((byte[])payload);
-        } else {
-            message = session.createObjectMessage();
-            ((ObjectMessage)message).setObject((byte[])payload);
-        }
-        return message;
-    }
-
     public static org.apache.cxf.message.Message asCXFMessage(Message message, String headerType)

         throws UnsupportedEncodingException, JMSException {
 
@@ -103,7 +79,7 @@ public final class JMSMessageUtils {
      * @throws UnsupportedEncodingException
      * @throws JMSException 
      */
-    private static void retrieveAndSetPayload(org.apache.cxf.message.Message inMessage, Message
message)
+    public static void retrieveAndSetPayload(org.apache.cxf.message.Message inMessage, Message
message)
         throws UnsupportedEncodingException, JMSException {
         String messageType = null;
         Object converted = new JMSMessageConverter().fromMessage(message);
@@ -360,7 +336,7 @@ public final class JMSMessageUtils {
                                        String headerType)
         throws JMSException {
 
-        Message jmsMessage = JMSMessageUtils.createAndSetPayload(payload, session, messageType);
+        Message jmsMessage = JMSUtil.createAndSetPayload(payload, session, messageType);
         JMSMessageHeadersType messageProperties = getOrCreateHeader(outMessage, headerType);
         JMSMessageUtils.prepareJMSMessageHeaderProperties(messageProperties, outMessage,
jmsConfig);
         JMSMessageUtils.prepareJMSMessageProperties(messageProperties, outMessage, 

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java?rev=1565125&r1=1565124&r2=1565125&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSUtil.java
Thu Feb  6 09:03:08 2014
@@ -18,12 +18,16 @@
  */
 package org.apache.cxf.transport.jms.util;
 
+import javax.jms.BytesMessage;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
+import javax.jms.ObjectMessage;
 import javax.jms.Session;
 
+import org.apache.cxf.transport.jms.JMSConstants;
+
 public final class JMSUtil {
     private static final char[] CORRELATTION_ID_PADDING = {
         '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'
@@ -66,6 +70,30 @@ public final class JMSUtil {
         id.append(index);
         return id.toString();
     }
+
+    /**
+     * Create a JMS of the appropriate type populated with the given payload.
+     * 
+     * @param payload the message payload, expected to be either of type String or byte[]
depending on payload
+     *            type
+     * @param session the JMS session
+     * @param replyTo the ReplyTo destination if any
+     * @return a JMS of the appropriate type populated with the given payload
+     */
+    public static Message createAndSetPayload(Object payload, Session session, String messageType)
+        throws JMSException {
+        Message message = null;
+        if (JMSConstants.TEXT_MESSAGE_TYPE.equals(messageType)) {
+            message = session.createTextMessage((String)payload);
+        } else if (JMSConstants.BYTE_MESSAGE_TYPE.equals(messageType)) {
+            message = session.createBytesMessage();
+            ((BytesMessage)message).writeBytes((byte[])payload);
+        } else {
+            message = session.createObjectMessage();
+            ((ObjectMessage)message).setObject((byte[])payload);
+        }
+        return message;
+    }
     
 
 }

Modified: cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java?rev=1565125&r1=1565124&r2=1565125&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
(original)
+++ cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
Thu Feb  6 09:03:08 2014
@@ -39,6 +39,7 @@ import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transport.jms.util.JMSUtil;
 import org.apache.cxf.transport.jms.util.ResourceCloser;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -146,7 +147,7 @@ public class JMSConduitTest extends Abst
         try {
             Session session = JMSFactory.createJmsSessionFactory(jmsConfig, closer).createSession();
             javax.jms.Message jmsMessage = 
-                JMSMessageUtils.createAndSetPayload(testBytes, session, JMSConstants.BYTE_MESSAGE_TYPE);
+                JMSUtil.createAndSetPayload(testBytes, session, JMSConstants.BYTE_MESSAGE_TYPE);
             assertTrue("Message should have been of type BytesMessage ", jmsMessage instanceof
BytesMessage);
         } finally {
             closer.close();

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=1565125&r1=1565124&r2=1565125&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 09:03:08 2014
@@ -44,8 +44,8 @@ import org.apache.cxf.jaxrs.client.WebCl
 import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
-import org.apache.cxf.transport.jms.JMSUtils;
-
+import org.apache.cxf.transport.jms.JMSMessageUtils;
+import org.apache.cxf.transport.jms.util.JMSUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -243,7 +243,7 @@ public class JAXRSJmsTest extends Abstra
         MessageConsumer consumer = session.createConsumer(replyToDestination);
         Message jmsMessage = consumer.receive(300000);
         org.apache.cxf.message.Message cxfMessage = new org.apache.cxf.message.MessageImpl();
-        JMSUtils.retrieveAndSetPayload(cxfMessage, jmsMessage, null);
+        JMSMessageUtils.retrieveAndSetPayload(cxfMessage, jmsMessage);
         Book b = readBook(cxfMessage.getContent(InputStream.class));
         assertEquals(bookId, b.getId());
         assertEquals(bookName, b.getName());
@@ -274,7 +274,7 @@ public class JAXRSJmsTest extends Abstra
         throws Exception {
         MessageProducer producer = session.createProducer(destination);
         
-        Message message = JMSUtils.createAndSetPayload(
+        Message message = JMSUtil.createAndSetPayload(
             writeBook(new Book("JMS OneWay", 125L)), session, "byte");
         message.setStringProperty("Content-Type", "application/xml");
         message.setStringProperty(org.apache.cxf.message.Message.REQUEST_URI, "/bookstore/oneway");
@@ -288,7 +288,7 @@ public class JAXRSJmsTest extends Abstra
         throws Exception {
         MessageProducer producer = session.createProducer(destination);
         
-        Message message = JMSUtils.createAndSetPayload(writeBook(new Book("JMS", 3L)), session,
"byte");
+        Message message = JMSUtil.createAndSetPayload(writeBook(new Book("JMS", 3L)), session,
"byte");
         message.setJMSReplyTo(replyTo);
         // or, if oneway,
         // message.setStringProperty("OnewayRequest", "true");

Modified: cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java?rev=1565125&r1=1565124&r2=1565125&view=diff
==============================================================================
--- cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java
(original)
+++ cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java
Thu Feb  6 09:03:08 2014
@@ -50,7 +50,7 @@ import javax.xml.bind.Marshaller;
 import org.apache.cxf.jaxrs.ext.Oneway;
 import org.apache.cxf.jaxrs.ext.ProtocolHeaders;
 import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
-import org.apache.cxf.transport.jms.JMSUtils;
+import org.apache.cxf.transport.jms.util.JMSUtil;
 
 @Path("/bookstore")
 public class JMSBookStore {
@@ -162,8 +162,7 @@ public class JMSBookStore {
         throws Exception {
         MessageProducer producer = session.createProducer(destination);
         
-        Message message = JMSUtils.createAndSetPayload(
-            writeBook(book), session, "byte");
+        Message message = JMSUtil.createAndSetPayload(writeBook(book), session, "byte");
                     
         producer.send(message);
         producer.close();



Mime
View raw message