org.apache.activemq.artemis.core.protocol.proton.converter.jms.ServerJMSTextMessage

Here are the examples of the java api class org.apache.activemq.artemis.core.protocol.proton.converter.jms.ServerJMSTextMessage taken from open source projects.

1. TestConversions#testSimpleConversionText()

View license
@Test
public void testSimpleConversionText() throws Exception {
    Map<String, Object> mapprop = createPropertiesMap();
    ApplicationProperties properties = new ApplicationProperties(mapprop);
    MessageImpl message = (MessageImpl) Message.Factory.create();
    message.setApplicationProperties(properties);
    String text = "someText";
    message.setBody(new AmqpValue(text));
    EncodedMessage encodedMessage = encodeMessage(message);
    ProtonMessageConverter converter = new ProtonMessageConverter(new SimpleIDGenerator(0));
    ServerJMSTextMessage serverMessage = (ServerJMSTextMessage) converter.inboundJMSType(encodedMessage);
    simulatePersistence(serverMessage);
    verifyProperties(serverMessage);
    Assert.assertEquals(text, serverMessage.getText());
    Object obj = converter.outbound((ServerMessage) serverMessage.getInnerMessage(), 0);
    reEncodeMsg(obj);
    MessageImpl outMessage = (MessageImpl) obj;
    AmqpValue value = (AmqpValue) outMessage.getBody();
    String textValue = (String) value.getValue();
    Assert.assertEquals(text, textValue);
    System.out.println("output = " + obj);
}