Package org.springframework.jms.support.converter

Examples of org.springframework.jms.support.converter.SimpleMessageConverter.toMessage()


        return byteArrayInputStream.read((byte[]) invocation.getArguments()[0]);
      }
    });

    SimpleMessageConverter converter = new SimpleMessageConverter();
    Message msg = converter.toMessage(content, session);
    assertEquals(content.length, ((byte[]) converter.fromMessage(msg)).length);

    verify(message).writeBytes(content);
  }
View Full Code Here


    given(message.getMapNames()).willReturn(Collections.enumeration(content.keySet()));
    given(message.getObject("key1")).willReturn("value1");
    given(message.getObject("key2")).willReturn("value2");

    SimpleMessageConverter converter = new SimpleMessageConverter();
    Message msg = converter.toMessage(content, session);
    assertEquals(content, converter.fromMessage(msg));

    verify(message).setObject("key1", "value1");
    verify(message).setObject("key2", "value2");
  }
View Full Code Here

    given(session.createObjectMessage(content)).willReturn(message);
    given(message.getObject()).willReturn(content);

    SimpleMessageConverter converter = new SimpleMessageConverter();
    Message msg = converter.toMessage(content, session);
    assertEquals(content, converter.fromMessage(msg));
  }

  @Test(expected=MessageConversionException.class)
  public void testToMessageThrowsExceptionIfGivenNullObjectToConvert() throws Exception {
View Full Code Here

    Session session = mock(Session.class);
    ObjectMessage message = mock(ObjectMessage.class);

    SimpleMessageConverter converter = new SimpleMessageConverter();
    Message msg = converter.toMessage(message, session);
    assertSame(message, msg);
  }

  @Test
  public void testFromMessageSimplyReturnsMessageAsIsIfSuppliedWithMessage() throws JMSException {
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.