use of javax.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method receiveDefaultDestination.
@Test
public void receiveDefaultDestination() {
Destination destination = new Destination() {
};
messagingTemplate.setDefaultDestination(destination);
javax.jms.Message jmsMessage = createJmsTextMessage();
given(jmsTemplate.receive(destination)).willReturn(jmsMessage);
Message<?> message = messagingTemplate.receive();
verify(jmsTemplate).receive(destination);
assertTextMessage(message);
}
use of javax.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method sendAndReceiveDefaultDestination.
@Test
public void sendAndReceiveDefaultDestination() {
Destination destination = new Destination() {
};
messagingTemplate.setDefaultDestination(destination);
Message<String> request = createTextMessage();
javax.jms.Message replyJmsMessage = createJmsTextMessage();
given(jmsTemplate.sendAndReceive(eq(destination), any())).willReturn(replyJmsMessage);
Message<?> actual = messagingTemplate.sendAndReceive(request);
verify(jmsTemplate, times(1)).sendAndReceive(eq(destination), any());
assertTextMessage(actual);
}
use of javax.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method convertAndSendPayloadAndHeaders.
@Test
public void convertAndSendPayloadAndHeaders() throws JMSException {
Destination destination = new Destination() {
};
Map<String, Object> headers = new HashMap<>();
headers.put("foo", "bar");
messagingTemplate.convertAndSend(destination, "Hello", headers);
verify(jmsTemplate).send(eq(destination), messageCreator.capture());
// see createTextMessage
assertTextMessage(messageCreator.getValue());
}
use of javax.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method send.
@Test
public void send() {
Destination destination = new Destination() {
};
Message<String> message = createTextMessage();
messagingTemplate.send(destination, message);
verify(jmsTemplate).send(eq(destination), messageCreator.capture());
assertTextMessage(messageCreator.getValue());
}
use of javax.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method convertAndSendPayload.
@Test
public void convertAndSendPayload() throws JMSException {
Destination destination = new Destination() {
};
messagingTemplate.convertAndSend(destination, "my Payload");
verify(jmsTemplate).send(eq(destination), messageCreator.capture());
TextMessage textMessage = createTextMessage(messageCreator.getValue());
assertEquals("my Payload", textMessage.getText());
}
Aggregations