use of org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method resolveCustomHeaderNameAndPayload.
@Test
public void resolveCustomHeaderNameAndPayload() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, int.class);
Session session = mock(Session.class);
StubTextMessage message = createSimpleJmsTextMessage("my payload");
message.setIntProperty("myCounter", 24);
listener.onMessage(message, session);
assertDefaultListenerMethodInvocation();
}
use of org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method resolveMessageHeaders.
@Test
public void resolveMessageHeaders() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(MessageHeaders.class);
Session session = mock(Session.class);
StubTextMessage message = createSimpleJmsTextMessage("my payload");
message.setLongProperty("customLong", 4567L);
message.setJMSType("myMessageType");
listener.onMessage(message, session);
assertDefaultListenerMethodInvocation();
}
use of org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method processFromTopicAndReplyWithSendToQueue.
@Test
public void processFromTopicAndReplyWithSendToQueue() throws JMSException {
String methodName = "processAndReplyWithSendTo";
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setPubSubDomain(true);
container.setReplyPubSubDomain(false);
MessagingMessageListenerAdapter listener = createInstance(this.factory, getListenerMethod(methodName, String.class), container);
processAndReplyWithSendTo(listener, "replyDestination", false);
assertListenerMethodInvocation(sample, methodName);
}
use of org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method invalidMessagePayloadType.
@Test
public void invalidMessagePayloadType() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(Message.class);
Session session = mock(Session.class);
thrown.expect(ListenerExecutionFailedException.class);
thrown.expectCause(Matchers.isA(MessageConversionException.class));
// Message<String> as Message<Integer>
listener.onMessage(createSimpleJmsTextMessage("test"), session);
}
use of org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method resolveConvertedPayload.
@Test
public void resolveConvertedPayload() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(Integer.class);
Session session = mock(Session.class);
listener.onMessage(createSimpleJmsTextMessage("33"), session);
assertDefaultListenerMethodInvocation();
}
Aggregations