mirror of https://github.com/apache/activemq.git
Remove redundant tests and clean up a few small nits.
This commit is contained in:
parent
b1a9a9382b
commit
45f60e4133
|
@ -220,7 +220,7 @@ public class JMSMappingOutboundTransformer implements OutboundTransformer {
|
||||||
if (header == null) {
|
if (header == null) {
|
||||||
header = new Header();
|
header = new Header();
|
||||||
}
|
}
|
||||||
header.setDeliveryCount(new UnsignedInteger(deliveryCount));
|
header.setDeliveryCount(UnsignedInteger.valueOf(deliveryCount));
|
||||||
}
|
}
|
||||||
String userId = message.getUserID();
|
String userId = message.getUserID();
|
||||||
if (userId != null) {
|
if (userId != null) {
|
||||||
|
@ -238,11 +238,10 @@ public class JMSMappingOutboundTransformer implements OutboundTransformer {
|
||||||
}
|
}
|
||||||
int groupSequence = message.getGroupSequence();
|
int groupSequence = message.getGroupSequence();
|
||||||
if (groupSequence > 0) {
|
if (groupSequence > 0) {
|
||||||
UnsignedInteger value = new UnsignedInteger(groupSequence);
|
|
||||||
if (properties == null) {
|
if (properties == null) {
|
||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
}
|
}
|
||||||
properties.setGroupSequence(value);
|
properties.setGroupSequence(UnsignedInteger.valueOf(groupSequence));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<String, Object> entries;
|
final Map<String, Object> entries;
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.transport.amqp.message;
|
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.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -277,67 +273,6 @@ public class JMSTransformationSpeedComparisonTest {
|
||||||
transformer, PROFILE_CYCLES, TimeUnit.NANOSECONDS.toMillis(totalDuration), test.getMethodName());
|
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() {
|
private Message createTypicalQpidJMSMessage() {
|
||||||
Map<String, Object> applicationProperties = new HashMap<String, Object>();
|
Map<String, Object> applicationProperties = new HashMap<String, Object>();
|
||||||
Map<Symbol, Object> messageAnnotations = new HashMap<Symbol, Object>();
|
Map<Symbol, Object> messageAnnotations = new HashMap<Symbol, Object>();
|
||||||
|
|
Loading…
Reference in New Issue