@Test public void testSendReplyMessage() throws JMSException, MessageQueueCommunicationException { String testContent = "test_content"; String testCorrelationId = "test_correlation_id"; TransferMessage tm = new TransferMessage(); tm.setContent(testContent); tm.putHeader(TransferMessage.HEADER_CORRELATION_ID, testCorrelationId); tm.putHeader(TransferMessage.HEADER_MESSAGE_TYPE, "TestMessage"); tm.putHeader(TransferMessage.HEADER_MESSAGE_VERSION, "1.0.0"); tm.putHeader(TransferMessage.HEADER_CONTENT_TYPE, TMContentType.JSON.toString()); EasyMock.expect( sessionMock.createTextMessage(testContent)) .andReturn(messageMock); Queue queueMock = createMock(Queue.class); expect(sessionMock.createQueue(testCorrelationId)).andReturn(queueMock); messageMock.setJMSCorrelationID(testCorrelationId); messageMock.setStringProperty(TransferMessage.HEADER_MESSAGE_TYPE, "TestMessage"); messageMock.setStringProperty(TransferMessage.HEADER_MESSAGE_VERSION, "1.0.0"); messageMock.setStringProperty(TransferMessage.HEADER_CONTENT_TYPE, TMContentType.JSON.toString()); producerMock.send(messageMock); EasyMock.replay(producerMock, sessionMock, messageMock); JMSMessageSender sender = new MockJMSMessageSender(producerMock); sender.setSession(sessionMock); sender.sendReplyMessage(tm); EasyMock.verify(producerMock); }
@Override public void sendReplyMessage(TransferMessage transferMessage) throws MessageQueueCommunicationException { try { MessageProducer producer = getProducer((Destination) transferMessage .getHeader(TransferMessage.HEADER_REPLY_QUEUE)); producer.send(convertToJMSMessage(transferMessage)); } catch (JMSException e) { LOGGER.error("Exception while sending reply message.", e); throw new MessageQueueCommunicationException("Error while sending reply message: " + e.getMessage(), e); } }
JMSMessageSender implements ProviderMessageSender { @Override public void sendReplyMessage(TransferMessage transferMessage) throws MessageQueueCommunicationException { try { MessageProducer producer = getProducer((Destination) transferMessage .getHeader(TransferMessage.HEADER_REPLY_QUEUE)); producer.send(convertToJMSMessage(transferMessage)); } catch (JMSException e) { LOGGER.error("Exception while sending reply message.", e); throw new MessageQueueCommunicationException("Error while sending reply message: " + e.getMessage(), e); } } }
JMSMessageSender implements ProviderMessageSender { @Override public void sendReplyMessage(TransferMessage transferMessage) throws MessageQueueCommunicationException { try { MessageProducer producer = getProducer((Destination) transferMessage .getHeader(TransferMessage.HEADER_REPLY_QUEUE)); producer.send(convertToJMSMessage(transferMessage)); } catch (JMSException e) { LOGGER.error("Exception while sending reply message.", e); throw new MessageQueueCommunicationException("Error while sending reply message: " + e.getMessage(), e); } }  }
JMSMessageSender implements ProviderMessageSender { @Override public void sendReplyMessage(TransferMessage transferMessage) throws MessageQueueCommunicationException { try { MessageProducer producer = getProducer((Destination) transferMessage .getHeader(TransferMessage.HEADER_REPLY_QUEUE)); producer.send(convertToJMSMessage(transferMessage)); } catch (JMSException e) { LOGGER.error("Exception while sending reply message.", e); throw new MessageQueueCommunicationException("Error while sending reply message: " + e.getMessage(), e); } }  @Invalidate void close(); @Validate void init(); @Override void sendMessageInternal(TransferMessage transferMessage); @Override void sendReplyMessage(TransferMessage transferMessage); void setSession(Session session); }
JMSMessageSender implements ProviderMessageSender { @Override public void sendReplyMessage(TransferMessage transferMessage) throws MessageQueueCommunicationException { try { MessageProducer producer = getProducer((Destination) transferMessage .getHeader(TransferMessage.HEADER_REPLY_QUEUE)); producer.send(convertToJMSMessage(transferMessage)); } catch (JMSException e) { LOGGER.error("Exception while sending reply message.", e); throw new MessageQueueCommunicationException("Error while sending reply message: " + e.getMessage(), e); } }  @Invalidate void close(); @Validate void init(); @Override void sendMessageInternal(TransferMessage transferMessage); @Override void sendReplyMessage(TransferMessage transferMessage); void setSession(Session session);  }