activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6438
Date Mon, 26 Sep 2016 21:19:54 GMT
Repository: activemq
Updated Branches:
  refs/heads/master a82c95cd2 -> 5702ec8d7


https://issues.apache.org/jira/browse/AMQ-6438

Add additional test for larger more complex AMQP message

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

Branch: refs/heads/master
Commit: 5702ec8d7ca330c94d6e4b59cea4606285b2c196
Parents: a82c95c
Author: Timothy Bish <tabish121@gmail.com>
Authored: Mon Sep 26 17:19:42 2016 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Mon Sep 26 17:19:42 2016 -0400

----------------------------------------------------------------------
 .../JMSTransformationSpeedComparisonTest.java   | 73 ++++++++++++++++++++
 1 file changed, 73 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/5702ec8d/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/JMSTransformationSpeedComparisonTest.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/JMSTransformationSpeedComparisonTest.java
b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/JMSTransformationSpeedComparisonTest.java
index e1b6a46..98d6722 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/JMSTransformationSpeedComparisonTest.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/message/JMSTransformationSpeedComparisonTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
@@ -196,6 +197,34 @@ public class JMSTransformationSpeedComparisonTest {
     }
 
     @Test
+    public void testComplexQpidJMSMessage() throws Exception {
+
+        EncodedMessage encoded = encode(createComplexQpidJMSMessage());
+        InboundTransformer inboundTransformer = getInboundTransformer();
+        OutboundTransformer outboundTransformer = getOutboundTransformer();
+
+        // Warm up
+        for (int i = 0; i < WARM_CYCLES; ++i) {
+            ActiveMQMessage intermediate = (ActiveMQMessage) inboundTransformer.transform(encoded);
+            intermediate.onSend();
+            outboundTransformer.transform(intermediate);
+        }
+
+        long totalDuration = 0;
+
+        long startTime = System.nanoTime();
+        for (int i = 0; i < PROFILE_CYCLES; ++i) {
+            ActiveMQMessage intermediate = (ActiveMQMessage) inboundTransformer.transform(encoded);
+            intermediate.onSend();
+            outboundTransformer.transform(intermediate);
+        }
+        totalDuration += System.nanoTime() - startTime;
+
+        LOG.info("[{}] Total time for {} cycles of transforms = {} ms  -> [{}]",
+            transformer, PROFILE_CYCLES, TimeUnit.NANOSECONDS.toMillis(totalDuration), test.getMethodName());
+    }
+
+    @Test
     public void testTypicalQpidJMSMessageInBoundOnly() throws Exception {
 
         EncodedMessage encoded = encode(createTypicalQpidJMSMessage());
@@ -314,6 +343,50 @@ public class JMSTransformationSpeedComparisonTest {
         return message;
     }
 
+    private Message createComplexQpidJMSMessage() {
+        Map<String, Object> applicationProperties = new HashMap<String, Object>();
+        Map<Symbol, Object> messageAnnotations = new HashMap<Symbol, Object>();
+
+        applicationProperties.put("property-1", "string-1");
+        applicationProperties.put("property-2", 512);
+        applicationProperties.put("property-3", true);
+        applicationProperties.put("property-4", "string-2");
+        applicationProperties.put("property-5", 512);
+        applicationProperties.put("property-6", true);
+        applicationProperties.put("property-7", "string-3");
+        applicationProperties.put("property-8", 512);
+        applicationProperties.put("property-9", true);
+
+        messageAnnotations.put(Symbol.valueOf("x-opt-jms-msg-type"), 0);
+        messageAnnotations.put(Symbol.valueOf("x-opt-jms-dest"), 0);
+
+        Message message = Proton.message();
+
+        // Header Values
+        message.setPriority((short) 9);
+        message.setDurable(true);
+        message.setDeliveryCount(2);
+        message.setTtl(5000);
+
+        // Properties
+        message.setMessageId("ID:SomeQualifier:0:0:1");
+        message.setGroupId("Group-ID-1");
+        message.setGroupSequence(15);
+        message.setAddress("queue://test-queue");
+        message.setReplyTo("queue://reply-queue");
+        message.setCreationTime(System.currentTimeMillis());
+        message.setContentType("text/plain");
+        message.setCorrelationId("ID:SomeQualifier:0:7:9");
+        message.setUserId("username".getBytes(StandardCharsets.UTF_8));
+
+        // Application Properties / Message Annotations / Body
+        message.setApplicationProperties(new ApplicationProperties(applicationProperties));
+        message.setMessageAnnotations(new MessageAnnotations(messageAnnotations));
+        message.setBody(new AmqpValue("String payload for AMQP message conversion performance
testing."));
+
+        return message;
+    }
+
     private EncodedMessage encode(Message message) {
         ProtonJMessage amqp = (ProtonJMessage) message;
 


Mime
View raw message