Add an additional test that accounts for the fallback transformer case.
This commit is contained in:
Timothy Bish 2016-09-30 15:54:09 -04:00
parent 02082b1aec
commit ee9f316c20
1 changed files with 26 additions and 7 deletions

View File

@ -35,6 +35,7 @@ import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
import org.apache.qpid.proton.amqp.messaging.ApplicationProperties;
import org.apache.qpid.proton.amqp.messaging.MessageAnnotations;
import org.apache.qpid.proton.amqp.messaging.Section;
import org.apache.qpid.proton.codec.CompositeWritableBuffer;
import org.apache.qpid.proton.codec.DroppingWritableBuffer;
import org.apache.qpid.proton.codec.WritableBuffer;
@ -87,13 +88,7 @@ public class MessageTransformationTest {
}
private OutboundTransformer getOutboundTransformer() {
switch (transformer) {
case "raw":
case "native":
return new AMQPNativeOutboundTransformer();
default:
return new JMSMappingOutboundTransformer();
}
return new AutoOutboundTransformer();
}
@Test
@ -216,6 +211,30 @@ public class MessageTransformationTest {
assertNull(outboudMessage.getProperties());
}
@Test
public void testMessageWithAmqpValueThatFailsJMSConversion() throws Exception {
Message incomingMessage = Proton.message();
incomingMessage.setBody(new AmqpValue(new Boolean(true)));
EncodedMessage encoded = encode(incomingMessage);
InboundTransformer inboundTransformer = getInboundTransformer();
OutboundTransformer outboundTransformer = getOutboundTransformer();
ActiveMQMessage intermediate = inboundTransformer.transform(encoded);
intermediate.onSend();
Message outboudMessage = outboundTransformer.transform(intermediate).decode();
Section section = outboudMessage.getBody();
assertNotNull(section);
assertTrue(section instanceof AmqpValue);
AmqpValue amqpValue = (AmqpValue) section;
assertNotNull(amqpValue.getValue());
assertTrue(amqpValue.getValue() instanceof Boolean);
assertEquals(true, amqpValue.getValue());
}
@Test
public void testComplexQpidJMSMessageEncodeDecode() throws Exception {