Search in sources :

Example 36 with Destination

use of jakarta.jms.Destination in project spring-framework by spring-projects.

the class JmsMessagingTemplateTests method receiveDefaultDestination.

@Test
public void receiveDefaultDestination() {
    Destination destination = new Destination() {
    };
    this.messagingTemplate.setDefaultDestination(destination);
    jakarta.jms.Message jmsMessage = createJmsTextMessage();
    given(this.jmsTemplate.receive(destination)).willReturn(jmsMessage);
    Message<?> message = this.messagingTemplate.receive();
    verify(this.jmsTemplate).receive(destination);
    assertTextMessage(message);
}
Also used : Destination(jakarta.jms.Destination) Test(org.junit.jupiter.api.Test)

Example 37 with Destination

use of jakarta.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();
    this.messagingTemplate.send(destination, message);
    verify(this.jmsTemplate).send(eq(destination), this.messageCreator.capture());
    assertTextMessage(this.messageCreator.getValue());
}
Also used : Destination(jakarta.jms.Destination) Test(org.junit.jupiter.api.Test)

Example 38 with Destination

use of jakarta.jms.Destination in project spring-framework by spring-projects.

the class DefaultJmsActivationSpecFactoryTests method webSphereResourceAdapterSetup.

@Test
public void webSphereResourceAdapterSetup() throws Exception {
    Destination destination = new StubQueue();
    DestinationResolver destinationResolver = mock(DestinationResolver.class);
    given(destinationResolver.resolveDestinationName(null, "destinationname", false)).willReturn(destination);
    DefaultJmsActivationSpecFactory activationSpecFactory = new DefaultJmsActivationSpecFactory();
    activationSpecFactory.setDestinationResolver(destinationResolver);
    StubWebSphereActivationSpecImpl spec = (StubWebSphereActivationSpecImpl) activationSpecFactory.createActivationSpec(new StubWebSphereResourceAdapterImpl(), activationSpecConfig);
    assertThat(spec.getDestination()).isEqualTo(destination);
    assertThat(spec.getMaxConcurrency()).isEqualTo(5);
    assertThat(spec.getMaxBatchSize()).isEqualTo(3);
}
Also used : Destination(jakarta.jms.Destination) DestinationResolver(org.springframework.jms.support.destination.DestinationResolver) StubQueue(org.springframework.jms.StubQueue) Test(org.junit.jupiter.api.Test)

Example 39 with Destination

use of jakarta.jms.Destination in project spring-framework by spring-projects.

the class SimpleJmsHeaderMapperTests method jmsReplyToMappedToHeader.

@Test
public void jmsReplyToMappedToHeader() throws JMSException {
    Destination replyTo = new Destination() {
    };
    jakarta.jms.Message jmsMessage = new StubTextMessage();
    jmsMessage.setJMSReplyTo(replyTo);
    assertInboundHeader(jmsMessage, JmsHeaders.REPLY_TO, replyTo);
}
Also used : Destination(jakarta.jms.Destination) StubTextMessage(org.springframework.jms.StubTextMessage) Test(org.junit.jupiter.api.Test)

Example 40 with Destination

use of jakarta.jms.Destination in project spring-framework by spring-projects.

the class SimpleJmsHeaderMapperTests method destinationMappedToHeader.

@Test
public void destinationMappedToHeader() throws JMSException {
    Destination destination = new Destination() {
    };
    jakarta.jms.Message jmsMessage = new StubTextMessage();
    jmsMessage.setJMSDestination(destination);
    assertInboundHeader(jmsMessage, JmsHeaders.DESTINATION, destination);
}
Also used : Destination(jakarta.jms.Destination) StubTextMessage(org.springframework.jms.StubTextMessage) Test(org.junit.jupiter.api.Test)

Aggregations

Destination (jakarta.jms.Destination)41 Test (org.junit.jupiter.api.Test)31 StubTextMessage (org.springframework.jms.StubTextMessage)11 Session (jakarta.jms.Session)8 TextMessage (jakarta.jms.TextMessage)5 JMSException (jakarta.jms.JMSException)3 HashMap (java.util.HashMap)3 DestinationResolutionException (org.springframework.jms.support.destination.DestinationResolutionException)3 DestinationResolver (org.springframework.jms.support.destination.DestinationResolver)3 MessageProducer (jakarta.jms.MessageProducer)2 QueueSender (jakarta.jms.QueueSender)2 NamingException (javax.naming.NamingException)2 StubQueue (org.springframework.jms.StubQueue)2 Connection (jakarta.jms.Connection)1 ConnectionFactory (jakarta.jms.ConnectionFactory)1 Message (jakarta.jms.Message)1 MessageConsumer (jakarta.jms.MessageConsumer)1 Map (java.util.Map)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1 JmsTemplate (org.springframework.jms.core.JmsTemplate)1