use of org.apache.qpid.server.protocol.v0_8.AMQShortString in project qpid-broker-j by apache.
the class AMQShortStringEncodingTest method testWriteReadShortStringWithLengthOver127.
public void testWriteReadShortStringWithLengthOver127() {
AMQShortString value = createString('a', 128);
// write into tuple output
TupleOutput tupleOutput = new TupleOutput();
AMQShortStringEncoding.writeShortString(value, tupleOutput);
byte[] data = tupleOutput.getBufferBytes();
// read from tuple input
TupleInput tupleInput = new TupleInput(data);
AMQShortString result = AMQShortStringEncoding.readShortString(tupleInput);
assertEquals("Expected " + value + " but got " + result, value, result);
}
use of org.apache.qpid.server.protocol.v0_8.AMQShortString in project qpid-broker-j by apache.
the class AMQShortStringEncodingTest method testWriteReadShortStringWithLengthLess127.
public void testWriteReadShortStringWithLengthLess127() {
AMQShortString value = new AMQShortString("test");
// write into tuple output
TupleOutput tupleOutput = new TupleOutput();
AMQShortStringEncoding.writeShortString(value, tupleOutput);
byte[] data = tupleOutput.getBufferBytes();
// read from tuple input
TupleInput tupleInput = new TupleInput(data);
AMQShortString result = AMQShortStringEncoding.readShortString(tupleInput);
assertEquals("Expected " + value + " but got " + result, value, result);
}
use of org.apache.qpid.server.protocol.v0_8.AMQShortString in project qpid-broker-j by apache.
the class QpidExceptionTest method testGetMessageAsString.
public void testGetMessageAsString() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 25; i++) {
sb.append("message [" + i + "]");
}
AMQException e = new AMQException(ErrorCodes.INTERNAL_ERROR, sb.toString(), null);
AMQShortString message = AMQShortString.validValueOf(e.getMessage());
assertEquals(sb.substring(0, AMQShortString.MAX_LENGTH - 3) + "...", message.toString());
}
Aggregations