use of jakarta.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method convertSendAndReceivePayload.
@Test
public void convertSendAndReceivePayload() throws JMSException {
Destination destination = new Destination() {
};
jakarta.jms.Message replyJmsMessage = createJmsTextMessage("My reply");
given(this.jmsTemplate.sendAndReceive(eq(destination), any())).willReturn(replyJmsMessage);
String reply = this.messagingTemplate.convertSendAndReceive(destination, "my Payload", String.class);
verify(this.jmsTemplate, times(1)).sendAndReceive(eq(destination), any());
assertThat(reply).isEqualTo("My reply");
}
use of jakarta.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method sendAndReceive.
@Test
public void sendAndReceive() {
Destination destination = new Destination() {
};
Message<String> request = createTextMessage();
jakarta.jms.Message replyJmsMessage = createJmsTextMessage();
given(this.jmsTemplate.sendAndReceive(eq(destination), any())).willReturn(replyJmsMessage);
Message<?> actual = this.messagingTemplate.sendAndReceive(destination, request);
verify(this.jmsTemplate, times(1)).sendAndReceive(eq(destination), any());
assertTextMessage(actual);
}
use of jakarta.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method convertAndSendDefaultDestination.
@Test
public void convertAndSendDefaultDestination() throws JMSException {
Destination destination = new Destination() {
};
this.messagingTemplate.setDefaultDestination(destination);
this.messagingTemplate.convertAndSend("my Payload");
verify(this.jmsTemplate).send(eq(destination), this.messageCreator.capture());
TextMessage textMessage = createTextMessage(this.messageCreator.getValue());
assertThat(textMessage.getText()).isEqualTo("my Payload");
}
use of jakarta.jms.Destination in project spring-framework by spring-projects.
the class JmsMessagingTemplateTests method sendDefaultDestination.
@Test
public void sendDefaultDestination() {
Destination destination = new Destination() {
};
this.messagingTemplate.setDefaultDestination(destination);
Message<String> message = createTextMessage();
this.messagingTemplate.send(message);
verify(this.jmsTemplate).send(eq(destination), this.messageCreator.capture());
assertTextMessage(this.messageCreator.getValue());
}
use of jakarta.jms.Destination in project spring-framework by spring-projects.
the class JmsResponseTests method resolveDestinationForQueue.
@Test
public void resolveDestinationForQueue() throws JMSException {
Session session = mock(Session.class);
DestinationResolver destinationResolver = mock(DestinationResolver.class);
Destination destination = mock(Destination.class);
given(destinationResolver.resolveDestinationName(session, "myQueue", false)).willReturn(destination);
JmsResponse<String> jmsResponse = JmsResponse.forQueue("foo", "myQueue");
Destination actual = jmsResponse.resolveDestination(destinationResolver, session);
assertThat(actual).isSameAs(destination);
}
Aggregations