Package org.springframework.jms

Examples of org.springframework.jms.StubTextMessage


    assertAttemptReadDisallowedPropertyIsNotFatal(jmsMessage, JmsHeaders.REPLY_TO);
  }

  @Test
  public void attemptToReadDisallowedRedeliveredPropertyIsNotFatal() throws JMSException {
    javax.jms.Message jmsMessage = new StubTextMessage() {
      @Override
      public boolean getJMSRedelivered() throws JMSException {
        throw new JMSException("illegal property");
      }
    };
View Full Code Here


    assertAttemptReadDisallowedPropertyIsNotFatal(jmsMessage, JmsHeaders.REDELIVERED);
  }

  @Test
  public void attemptToReadDisallowedTypePropertyIsNotFatal() throws JMSException {
    javax.jms.Message jmsMessage = new StubTextMessage() {
      @Override
      public String getJMSType() throws JMSException {
        throw new JMSException("illegal property");
      }
    };
View Full Code Here

    assertAttemptReadDisallowedPropertyIsNotFatal(jmsMessage, JmsHeaders.TYPE);
  }

  @Test
  public void attemptToReadDisallowedTimestampPropertyIsNotFatal() throws JMSException {
    javax.jms.Message jmsMessage = new StubTextMessage() {
      @Override
      public long getJMSTimestamp() throws JMSException {
        throw new JMSException("illegal property");
      }
    };
View Full Code Here

    assertAttemptReadDisallowedPropertyIsNotFatal(jmsMessage, JmsHeaders.TIMESTAMP);
  }

  @Test
  public void attemptToReadDisallowedUserPropertyIsNotFatal() throws JMSException {
    javax.jms.Message jmsMessage = new StubTextMessage() {
      @Override
      public Object getObjectProperty(String name) throws JMSException {
        if (name.equals("fail")) {
          throw new JMSException("illegal property");
        }
        else {
          return super.getObjectProperty(name);
        }
      }
    };
    jmsMessage.setBooleanProperty("fail", true);
    assertAttemptReadDisallowedPropertyIsNotFatal(jmsMessage, "fail");
  }
View Full Code Here

  // Inbound mapping

  @Test
  public void jmsCorrelationIdMappedToHeader() throws JMSException {
    String correlationId = "ABC-123";
    javax.jms.Message jmsMessage = new StubTextMessage();
    jmsMessage.setJMSCorrelationID(correlationId);
    assertInboundHeader(jmsMessage, JmsHeaders.CORRELATION_ID, correlationId);
  }
View Full Code Here

  @Test
  public void messageConverterUsedIfSet() throws JMSException {
    containerFactory.setMessageConverter(new UpperCaseMessageConverter());

    MethodJmsListenerEndpoint endpoint = createDefaultMethodJmsEndpoint("expectFooBarUpperCase", String.class);
    Message message = new StubTextMessage("foo-bar");

    invokeListener(endpoint, message);
    assertListenerMethodInvocation("expectFooBarUpperCase");
  }
View Full Code Here

  private static class UpperCaseMessageConverter implements MessageConverter {

    @Override
    public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
      return new StubTextMessage(object.toString().toUpperCase());
    }
View Full Code Here

  @Test
  public void resolveHeaderAndPayload() throws JMSException {
    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, int.class);

    Session session = mock(Session.class);
    StubTextMessage message = createSimpleJmsTextMessage("my payload");
    message.setIntProperty("myCounter", 55);
    listener.onMessage(message, session);
    assertDefaultListenerMethodInvocation();
  }
View Full Code Here

  @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();
  }
View Full Code Here

  @Test
  public void resolveHeaders() throws JMSException {
    MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, Map.class);

    Session session = mock(Session.class);
    StubTextMessage message = createSimpleJmsTextMessage("my payload");
    message.setIntProperty("customInt", 1234);
    message.setJMSMessageID("abcd-1234");
    listener.onMessage(message, session);
    assertDefaultListenerMethodInvocation();
  }
View Full Code Here

TOP

Related Classes of org.springframework.jms.StubTextMessage

Copyright © 2018 www.massapicom. 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.