diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/message/JMSMappingOutboundTransformer.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/message/JMSMappingOutboundTransformer.java index fa915e8ca0..69039eacf4 100644 --- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/message/JMSMappingOutboundTransformer.java +++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/message/JMSMappingOutboundTransformer.java @@ -220,7 +220,7 @@ public class JMSMappingOutboundTransformer implements OutboundTransformer { if (header == null) { header = new Header(); } - header.setDeliveryCount(new UnsignedInteger(deliveryCount)); + header.setDeliveryCount(UnsignedInteger.valueOf(deliveryCount)); } String userId = message.getUserID(); if (userId != null) { @@ -238,11 +238,10 @@ public class JMSMappingOutboundTransformer implements OutboundTransformer { } int groupSequence = message.getGroupSequence(); if (groupSequence > 0) { - UnsignedInteger value = new UnsignedInteger(groupSequence); if (properties == null) { properties = new Properties(); } - properties.setGroupSequence(value); + properties.setGroupSequence(UnsignedInteger.valueOf(groupSequence)); } final Map entries; 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 204c65264f..cd93af7af0 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 @@ -16,10 +16,6 @@ */ package org.apache.activemq.transport.amqp.message; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; @@ -277,67 +273,6 @@ public class JMSTransformationSpeedComparisonTest { transformer, PROFILE_CYCLES, TimeUnit.NANOSECONDS.toMillis(totalDuration), test.getMethodName()); } - @Test - public void testEncodeDecodeIsWorking() throws Exception { - Message incomingMessage = createTypicalQpidJMSMessage(); - EncodedMessage encoded = encode(incomingMessage); - InboundTransformer inboundTransformer = getInboundTransformer(); - OutboundTransformer outboundTransformer = getOutboundTransformer(); - - ActiveMQMessage outbound = inboundTransformer.transform(encoded); - outbound.onSend(); - Message outboudMessage = outboundTransformer.transform(outbound).decode(); - - // Test that message details are equal - assertEquals(incomingMessage.getAddress(), outboudMessage.getAddress()); - assertEquals(incomingMessage.getDeliveryCount(), outboudMessage.getDeliveryCount()); - assertEquals(incomingMessage.getCreationTime(), outboudMessage.getCreationTime()); - assertEquals(incomingMessage.getContentType(), outboudMessage.getContentType()); - - // Test Message annotations - ApplicationProperties incomingApplicationProperties = incomingMessage.getApplicationProperties(); - ApplicationProperties outgoingApplicationProperties = outboudMessage.getApplicationProperties(); - - assertEquals(incomingApplicationProperties.getValue(), outgoingApplicationProperties.getValue()); - - // Test Message properties - MessageAnnotations incomingMessageAnnotations = incomingMessage.getMessageAnnotations(); - MessageAnnotations outgoingMessageAnnotations = outboudMessage.getMessageAnnotations(); - - assertEquals(incomingMessageAnnotations.getValue(), outgoingMessageAnnotations.getValue()); - - // Test that bodies are equal - assertTrue(incomingMessage.getBody() instanceof AmqpValue); - assertTrue(outboudMessage.getBody() instanceof AmqpValue); - - AmqpValue incomingBody = (AmqpValue) incomingMessage.getBody(); - AmqpValue outgoingBody = (AmqpValue) outboudMessage.getBody(); - - assertTrue(incomingBody.getValue() instanceof String); - assertTrue(outgoingBody.getValue() instanceof String); - - assertEquals(incomingBody.getValue(), outgoingBody.getValue()); - } - - @Test - public void testBodyOnlyEncodeDecode() throws Exception { - - Message incomingMessage = Proton.message(); - - incomingMessage.setBody(new AmqpValue("String payload for AMQP message conversion performance testing.")); - - EncodedMessage encoded = encode(incomingMessage); - InboundTransformer inboundTransformer = getInboundTransformer(); - OutboundTransformer outboundTransformer = getOutboundTransformer(); - - ActiveMQMessage intermediate = inboundTransformer.transform(encoded); - intermediate.onSend(); - Message outboudMessage = outboundTransformer.transform(intermediate).decode(); - - assertNull(outboudMessage.getHeader()); - assertNull(outboudMessage.getProperties()); - } - private Message createTypicalQpidJMSMessage() { Map applicationProperties = new HashMap(); Map messageAnnotations = new HashMap();