Search in sources :

Example 11 with SimpleMessageConverter

use of org.springframework.jms.support.converter.SimpleMessageConverter in project spring-framework by spring-projects.

the class SimpleMessageConverterTests method testToMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage.

@Test
public void testToMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage() throws JMSException {
    Session session = mock(Session.class);
    ObjectMessage message = mock(ObjectMessage.class);
    SimpleMessageConverter converter = new SimpleMessageConverter();
    Message msg = converter.toMessage(message, session);
    assertSame(message, msg);
}
Also used : TextMessage(javax.jms.TextMessage) MapMessage(javax.jms.MapMessage) ObjectMessage(javax.jms.ObjectMessage) BytesMessage(javax.jms.BytesMessage) Message(javax.jms.Message) ObjectMessage(javax.jms.ObjectMessage) SimpleMessageConverter(org.springframework.jms.support.converter.SimpleMessageConverter) Session(javax.jms.Session) Test(org.junit.Test)

Example 12 with SimpleMessageConverter

use of org.springframework.jms.support.converter.SimpleMessageConverter in project spring-framework by spring-projects.

the class SimpleMessageConverterTests method testFromMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage.

@Test
public void testFromMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage() throws JMSException {
    Message message = mock(Message.class);
    SimpleMessageConverter converter = new SimpleMessageConverter();
    Object msg = converter.fromMessage(message);
    assertSame(message, msg);
}
Also used : TextMessage(javax.jms.TextMessage) MapMessage(javax.jms.MapMessage) ObjectMessage(javax.jms.ObjectMessage) BytesMessage(javax.jms.BytesMessage) Message(javax.jms.Message) SimpleMessageConverter(org.springframework.jms.support.converter.SimpleMessageConverter) Test(org.junit.Test)

Aggregations

SimpleMessageConverter (org.springframework.jms.support.converter.SimpleMessageConverter)12 Test (org.junit.Test)11 TextMessage (javax.jms.TextMessage)9 MapMessage (javax.jms.MapMessage)8 Session (javax.jms.Session)8 BytesMessage (javax.jms.BytesMessage)6 Message (javax.jms.Message)6 ObjectMessage (javax.jms.ObjectMessage)6 HashMap (java.util.HashMap)3 JMSException (javax.jms.JMSException)2 MessageProducer (javax.jms.MessageProducer)2 MessageConversionException (org.springframework.jms.support.converter.MessageConversionException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ExceptionListener (javax.jms.ExceptionListener)1 StringContains (org.hamcrest.core.StringContains)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 JmsException (org.springframework.jms.JmsException)1 StubTextMessage (org.springframework.jms.StubTextMessage)1 UncategorizedJmsException (org.springframework.jms.UncategorizedJmsException)1 Message (org.springframework.messaging.Message)1