ARTEMIS-3137 Fixing Test with wrong message type on Xpath and Core
This commit is contained in:
parent
202601645b
commit
f49a163427
|
@ -73,8 +73,8 @@ public interface ICoreMessage extends Message {
|
|||
boolean isServerMessage();
|
||||
|
||||
/**
|
||||
* The body used for this message.
|
||||
*
|
||||
* The buffer to write the body.
|
||||
* Warning: If you just want to read the content of a message, use getDataBuffer() or getReadOnlyBuffer();
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -223,6 +223,8 @@ public interface Message {
|
|||
|
||||
/**
|
||||
* @deprecated do not use this, use through ICoreMessage or ClientMessage
|
||||
* Warning: if you need to read the content of a message use getDataBuffer(). This method is intended for when you
|
||||
* want to make changes.
|
||||
*/
|
||||
@Deprecated
|
||||
default ActiveMQBuffer getBodyBuffer() {
|
||||
|
|
|
@ -132,6 +132,7 @@ public interface ClientMessage extends ICoreMessage {
|
|||
|
||||
/**
|
||||
* The buffer to write the body.
|
||||
* Warning: If you just want to read the content of a message, use getDataBuffer() or getReadOnlyBuffer();
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -1283,7 +1283,7 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
|
|||
body = simpleBody.toString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1286,15 +1286,18 @@ public class ConsumerTest extends ActiveMQTestBase {
|
|||
ClientProducer producer = session.createProducer(QUEUE);
|
||||
|
||||
ClientMessage message = session.createMessage(false);
|
||||
message.setType(Message.TEXT_TYPE);
|
||||
message.getBodyBuffer().writeNullableSimpleString(SimpleString.toSimpleString("wrong"));
|
||||
producer.send(message);
|
||||
message = session.createMessage(false);
|
||||
message.setType(Message.TEXT_TYPE);
|
||||
message.getBodyBuffer().writeNullableSimpleString(BODY);
|
||||
producer.send(message);
|
||||
|
||||
ClientConsumer consumer = session.createConsumer(QUEUE.toString(), "XPATH 'root/a'");
|
||||
session.start();
|
||||
ClientMessage message2 = consumer.receive(1000);
|
||||
ClientMessage message2 = consumer.receive(5000);
|
||||
Assert.assertNotNull(message2);
|
||||
|
||||
Assert.assertEquals(BODY, message2.getBodyBuffer().readNullableSimpleString());
|
||||
Assert.assertEquals(1, getMessageCount(((Queue) server.getPostOffice().getBinding(QUEUE).getBindable())));
|
||||
|
|
Loading…
Reference in New Issue