activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: fixing map messages on AMQP
Date Fri, 03 Mar 2017 03:32:17 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/artemis-1009 19608cb4c -> 66396a59d


fixing map messages on AMQP


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/66396a59
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/66396a59
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/66396a59

Branch: refs/heads/artemis-1009
Commit: 66396a59d208c86ecbe00affcbfd1bd2bea1065c
Parents: 19608cb
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Thu Mar 2 22:29:46 2017 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Thu Mar 2 22:29:46 2017 -0500

----------------------------------------------------------------------
 .../protocol/amqp/converter/AMQPMessageSupport.java    |  2 +-
 .../protocol/amqp/converter/AmqpCoreConverter.java     |  2 ++
 .../protocol/amqp/converter/TestConversions.java       |  4 ++++
 .../artemis/tests/integration/client/ConsumerTest.java | 13 ++++++++++++-
 4 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/66396a59/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java
index 194fabe..4fb28a2 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java
@@ -258,7 +258,7 @@ public final class AMQPMessageSupport {
    private static CoreMessage newMessage(long id, byte messageType) {
       CoreMessage message = new CoreMessage(id, 512);
       message.setType(messageType);
-      ((ResetLimitWrappedActiveMQBuffer) message.getBodyBuffer()).setMessage(null);
+//      ((ResetLimitWrappedActiveMQBuffer) message.getBodyBuffer()).setMessage(null);
       return message;
    }
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/66396a59/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
index 23474a4..6ba1754 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java
@@ -189,6 +189,8 @@ public class AmqpCoreConverter {
 
       populateMessage(result, message.getProtonMessage());
 
+      result.encode();
+
       return result != null ? result.getInnerMessage() : null;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/66396a59/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java
b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java
index f132a45..8ced348 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/converter/TestConversions.java
@@ -128,6 +128,7 @@ public class TestConversions extends Assert {
       AMQPMessage encodedMessage = new AMQPMessage(message);
 
       ICoreMessage serverMessage = encodedMessage.toCore();
+      serverMessage.getReadOnlyBodyBuffer();
 
       ServerJMSMapMessage mapMessage = (ServerJMSMapMessage) ServerJMSMessage.wrapCoreMessage(serverMessage);
       mapMessage.decode();
@@ -136,6 +137,9 @@ public class TestConversions extends Assert {
 
       Assert.assertEquals(1, mapMessage.getInt("someint"));
       Assert.assertEquals("value", mapMessage.getString("somestr"));
+
+      AMQPMessage newAMQP = CoreAmqpConverter.fromCore(mapMessage.getInnerMessage());
+      System.out.println(newAMQP.getProtonMessage().getBody());
    }
 
    @Test

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/66396a59/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
index 03e9ec3..08ef43c 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client;
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.DeliveryMode;
+import javax.jms.MapMessage;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
@@ -207,7 +208,7 @@ public class ConsumerTest extends ActiveMQTestBase {
          return;
       }
 
-      internalSend(false, true);
+      internalSend(false, false);
    }
 
    @Test
@@ -252,6 +253,11 @@ public class ConsumerTest extends ActiveMQTestBase {
             TextMessage msg = session.createTextMessage("hello " + i);
             msg.setIntProperty("mycount", i);
             producer.send(msg);
+
+            MapMessage mapMessage = session.createMapMessage();
+            mapMessage.setInt("intOne", i);
+            mapMessage.setString("stringOne", Integer.toString(i));
+            producer.send(mapMessage);
          }
          long end = System.currentTimeMillis();
 
@@ -277,6 +283,11 @@ public class ConsumerTest extends ActiveMQTestBase {
             Assert.assertNotNull(message);
             Assert.assertEquals(i, message.getIntProperty("mycount"));
             Assert.assertEquals("hello " + i, message.getText());
+
+            MapMessage mapMessage = (MapMessage) consumer.receive(1000);
+            Assert.assertNotNull(mapMessage);
+            Assert.assertEquals(i, mapMessage.getInt("intOne"));
+            Assert.assertEquals(Integer.toString(i), mapMessage.getString("stringOne"));
          }
       } finally {
          connection.close();


Mime
View raw message