use of org.apache.activemq.command.ActiveMQBytesMessage in project activemq-artemis by apache.
the class ActiveMQBytesMessageTest method createObject.
@Override
public Object createObject() throws Exception {
ActiveMQBytesMessage info = new ActiveMQBytesMessage();
populateObject(info);
return info;
}
use of org.apache.activemq.command.ActiveMQBytesMessage in project activemq-artemis by apache.
the class CompressionOverNetworkTest method testBytesMessageCompression.
@Test
public void testBytesMessageCompression() throws Exception {
MessageConsumer consumer1 = remoteSession.createConsumer(included);
MessageProducer producer = localSession.createProducer(included);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
waitForConsumerRegistration(localBroker, 1, included);
StringBuilder payload = new StringBuilder("test-");
for (int i = 0; i < 100; ++i) {
payload.append(UUID.randomUUID().toString());
}
byte[] bytes = payload.toString().getBytes(StandardCharsets.UTF_8);
BytesMessage test = localSession.createBytesMessage();
test.writeBytes(bytes);
producer.send(test);
Message msg = consumer1.receive(RECEIVE_TIMEOUT_MILLS);
assertNotNull(msg);
ActiveMQBytesMessage message = (ActiveMQBytesMessage) msg;
assertTrue(message.isCompressed());
assertTrue(message.getContent().getLength() < bytes.length);
byte[] result = new byte[bytes.length];
assertEquals(bytes.length, message.readBytes(result));
assertEquals(-1, message.readBytes(result));
for (int i = 0; i < bytes.length; ++i) {
assertEquals(bytes[i], result[i]);
}
}
use of org.apache.activemq.command.ActiveMQBytesMessage in project activemq-artemis by apache.
the class ActiveMQBytesMessageTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ActiveMQBytesMessage info = (ActiveMQBytesMessage) object;
}
use of org.apache.activemq.command.ActiveMQBytesMessage in project activemq-artemis by apache.
the class ActiveMQBytesMessageTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ActiveMQBytesMessage info = (ActiveMQBytesMessage) object;
}
Aggregations