use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.
the class JMSTransformationSpeedComparisonTest method testBodyOnlyMessage.
@Test
public void testBodyOnlyMessage() throws Exception {
Message message = Proton.message();
message.setBody(new AmqpValue("String payload for AMQP message conversion performance testing."));
AMQPMessage encoded = new AMQPMessage(message);
// Warm up
for (int i = 0; i < WARM_CYCLES; ++i) {
ICoreMessage intermediate = encoded.toCore();
encode(AMQPConverter.getInstance().fromCore(intermediate));
}
long totalDuration = 0;
long startTime = System.nanoTime();
for (int i = 0; i < PROFILE_CYCLES; ++i) {
ICoreMessage intermediate = encoded.toCore();
encode(AMQPConverter.getInstance().fromCore(intermediate));
}
totalDuration += System.nanoTime() - startTime;
LOG_RESULTS(totalDuration);
}
use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.
the class JMSTransformationSpeedComparisonTest method testTypicalQpidJMSMessageOutBoundOnly.
@Test
public void testTypicalQpidJMSMessageOutBoundOnly() throws Exception {
AMQPMessage encoded = encode(createTypicalQpidJMSMessage());
// Warm up
for (int i = 0; i < WARM_CYCLES; ++i) {
ICoreMessage intermediate = encoded.toCore();
encode(AMQPConverter.getInstance().fromCore(intermediate));
}
long totalDuration = 0;
long startTime = System.nanoTime();
for (int i = 0; i < PROFILE_CYCLES; ++i) {
ICoreMessage intermediate = encoded.toCore();
encode(AMQPConverter.getInstance().fromCore(intermediate));
}
totalDuration += System.nanoTime() - startTime;
LOG_RESULTS(totalDuration);
}
use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.
the class JMSTransformationSpeedComparisonTest method testComplexQpidJMSMessage.
@Test
public void testComplexQpidJMSMessage() throws Exception {
AMQPMessage encoded = encode(createComplexQpidJMSMessage());
// Warm up
for (int i = 0; i < WARM_CYCLES; ++i) {
ICoreMessage intermediate = encoded.toCore();
encode(AMQPConverter.getInstance().fromCore(intermediate));
}
long totalDuration = 0;
long startTime = System.nanoTime();
for (int i = 0; i < PROFILE_CYCLES; ++i) {
ICoreMessage intermediate = encoded.toCore();
encode(AMQPConverter.getInstance().fromCore(intermediate));
}
totalDuration += System.nanoTime() - startTime;
LOG_RESULTS(totalDuration);
}
use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.
the class PageTest method addPageElements.
/**
* @param simpleDestination
* @param page
* @param numberOfElements
* @return
* @throws Exception
*/
protected void addPageElements(final SimpleString simpleDestination, final Page page, final int numberOfElements) throws Exception {
int initialNumberOfMessages = page.getNumberOfMessages();
for (int i = 0; i < numberOfElements; i++) {
ICoreMessage msg = new CoreMessage().initBuffer(100);
for (int j = 0; j < 10; j++) {
msg.getBodyBuffer().writeByte((byte) 'b');
}
msg.setAddress(simpleDestination);
page.write(new PagedMessageImpl(msg, new long[0]));
Assert.assertEquals(initialNumberOfMessages + i + 1, page.getNumberOfMessages());
}
}
use of org.apache.activemq.artemis.api.core.ICoreMessage in project activemq-artemis by apache.
the class PagingManagerImplTest method createMessage.
protected ICoreMessage createMessage(final long messageId, final SimpleString destination, final ByteBuffer buffer) {
ICoreMessage msg = new CoreMessage(messageId, 200);
msg.setAddress(destination);
msg.getBodyBuffer().writeBytes(buffer);
return msg;
}
Aggregations