Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ static byte getTypeByte(AmqpJmsMessageFacade message, Symbol annotationName) {
if (typeAnnotation == null) {
// Doesn't exist, or null.
return UNKNOWN_TYPE;
} else if (typeAnnotation instanceof Byte) {
// Return the value found.
return (Byte) typeAnnotation;
} else if (typeAnnotation instanceof Number) {
// Return the found value as a byte.
return ((Number)typeAnnotation).byteValue();
} else {
// Handle legacy strings.
String typeString = String.valueOf(typeAnnotation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.apache.qpid.jms.JmsTemporaryTopic;
import org.apache.qpid.jms.JmsTopic;
import org.apache.qpid.jms.provider.amqp.AmqpConnection;
import org.apache.qpid.proton.amqp.UnsignedByte;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

Expand Down Expand Up @@ -688,6 +689,34 @@ public void testGetJmsReplToWithLegacyTempTopicTypeAnnotationNoConsumerDestinati
assertEquals(testAddress, destination.getAddress());
}

@Test
public void doGetJmsReplToWithTempQueueUnsignedByteTypeAnnotationTestImpl() throws Exception {
String testAddress = "testAddress";
AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn(UnsignedByte.valueOf(TEMP_QUEUE_TYPE));

JmsDestination destination = AmqpDestinationHelper.getJmsReplyTo(message, null);
assertNotNull(destination);
assertTrue(destination.isQueue());
assertTrue(destination.isTemporary());
assertEquals(testAddress, destination.getAddress());
}

@Test
public void doGetJmsReplToWithTempQueueLongTypeAnnotationTestImpl() throws Exception {
String testAddress = "testAddress";
AmqpJmsMessageFacade message = Mockito.mock(AmqpJmsMessageFacade.class);
Mockito.when(message.getReplyToAddress()).thenReturn(testAddress);
Mockito.when(message.getMessageAnnotation(JMS_REPLY_TO_TYPE_MSG_ANNOTATION_SYMBOL)).thenReturn((long) TEMP_QUEUE_TYPE);

JmsDestination destination = AmqpDestinationHelper.getJmsReplyTo(message, null);
assertNotNull(destination);
assertTrue(destination.isQueue());
assertTrue(destination.isTemporary());
assertEquals(testAddress, destination.getAddress());
}

//========================================================================//
//--------------- Test setToAddressFromDestination method ----------------//
//========================================================================//
Expand Down