Package org.springframework.jms.listener.adapter

Examples of org.springframework.jms.listener.adapter.MessagingMessageListenerAdapter.onMessage()


  public void resolveConvertedPayload() throws JMSException {
    MessagingMessageListenerAdapter listener = createDefaultInstance(Integer.class);

    Session session = mock(Session.class);

    listener.onMessage(createSimpleJmsTextMessage("33"), session);
    assertDefaultListenerMethodInvocation();
  }

  @Test
  public void processAndReply() throws JMSException {
View Full Code Here


    given(session.createProducer(replyDestination)).willReturn(queueSender);

    listener.setDefaultResponseDestination(replyDestination);
    StubTextMessage inputMessage = createSimpleJmsTextMessage(body);
    inputMessage.setJMSCorrelationID(correlationId);
    listener.onMessage(inputMessage, session);
    assertDefaultListenerMethodInvocation();

    verify(reply).setJMSCorrelationID(correlationId);
    verify(queueSender).send(reply);
    verify(queueSender).close();
View Full Code Here

    Session session = mock(Session.class);
    given(session.createTextMessage("content")).willReturn(reply);

    thrown.expect(ReplyFailureException.class);
    thrown.expectCause(Matchers.isA(InvalidDestinationException.class));
    listener.onMessage(createSimpleJmsTextMessage("content"), session);
  }

  @Test
  public void invalidSendTo() {
    thrown.expect(IllegalStateException.class);
View Full Code Here

    initializeFactory(customFactory);

    Method method = getListenerMethod(methodName, String.class);
    MessagingMessageListenerAdapter listener = createInstance(customFactory, method);
    Session session = mock(Session.class);
    listener.onMessage(createSimpleJmsTextMessage("test"), session); // test is a valid value
    assertListenerMethodInvocation(sample, methodName);
  }

  @Test
  public void validatePayloadInvalid() throws JMSException {
View Full Code Here

    Method method = getListenerMethod("validatePayload", String.class);
    MessagingMessageListenerAdapter listener = createInstance(customFactory, method);
    Session session = mock(Session.class);

    thrown.expect(ListenerExecutionFailedException.class);
    listener.onMessage(createSimpleJmsTextMessage("invalid value"), session); // test is an invalid value

  }

  // failure scenario
View Full Code Here

    Session session = mock(Session.class);

    thrown.expect(ListenerExecutionFailedException.class);
    thrown.expectCause(Matchers.isA(MessageConversionException.class));
    thrown.expectMessage(getDefaultListenerMethod(Integer.class).toGenericString()); // ref to method
    listener.onMessage(createSimpleJmsTextMessage("test"), session); // test is not a valid integer
  }

  @Test
  public void invalidMessagePayloadType() throws JMSException {
    MessagingMessageListenerAdapter listener = createDefaultInstance(Message.class);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.