Couple of changes to allow for some performance analysis.

This commit is contained in:
Timothy Bish 2014-01-29 12:28:55 -05:00
parent cce75e0926
commit 8b993b4dc6
2 changed files with 13 additions and 10 deletions

View File

@ -32,7 +32,6 @@ import javax.jms.TextMessage;
import org.apache.activemq.transport.amqp.AmqpTestSupport;
import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@ -76,12 +75,9 @@ public class AMQ4914Test extends AmqpTestSupport {
doTestSendLargeMessage(65536 * 4);
}
@Ignore("AMQ-4914")
@Test(timeout = 2 * 60 * 1000)
public void testSendLargeMessages() throws JMSException {
//for (int i = 32000; i < (32 *1024); i++) {
doTestSendLargeMessage(32604); // Fails at 32614; or 32604 with my changes to AmqpProtocolBuffer
//}
public void testSendHugeMessage() throws JMSException {
doTestSendLargeMessage(1024 * 1024 * 10);
}
public void doTestSendLargeMessage(int expectedSize) throws JMSException{
@ -91,21 +87,27 @@ public class AMQ4914Test extends AmqpTestSupport {
Connection connection = createAMQPConnection(port, false);
long startTime = System.currentTimeMillis();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
QueueImpl queue = new QueueImpl(QUEUE_NAME);
MessageProducer producer = session.createProducer(queue);
TextMessage message = session.createTextMessage();
message.setText(payload);
producer.send(message);
LOG.debug("Returned from send");
long endTime = System.currentTimeMillis();
LOG.info("Returned from send after {} ms", endTime - startTime);
startTime = System.currentTimeMillis();
MessageConsumer consumer = session.createConsumer(queue);
connection.start();
LOG.debug("Calling receive");
LOG.info("Calling receive");
Message receivedMessage = consumer.receive();
assertNotNull(receivedMessage);
assertTrue(receivedMessage instanceof TextMessage);
TextMessage receivedTextMessage = (TextMessage) receivedMessage;
assertNotNull(receivedMessage);
endTime = System.currentTimeMillis();
LOG.info("Returned from receive after {} ms", endTime - startTime);
String receivedText = receivedTextMessage.getText();
assertEquals(expectedSize, receivedText.getBytes().length);
assertEquals(payload, receivedText);
@ -115,6 +117,7 @@ public class AMQ4914Test extends AmqpTestSupport {
private Connection createAMQPConnection(int testPort, boolean useSSL) throws JMSException {
LOG.debug("In createConnection using port {} ssl? {}", testPort, useSSL);
final ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl("localhost", testPort, "admin", "password", null, useSSL);
connectionFactory.setSyncPublish(true);
final Connection connection = connectionFactory.createConnection();
connection.setExceptionListener(new ExceptionListener() {
@Override

View File

@ -20,14 +20,14 @@
#
log4j.rootLogger=WARN, console, file
log4j.logger.org.apache.activemq=INFO
log4j.logger.org.apache.activemq.transport.amqp=INFO
log4j.logger.org.apache.activemq.transport.amqp=TRACE
log4j.logger.org.apache.activemq.transport.amqp.FRAMES=TRACE
log4j.logger.org.fusesource=INFO
# Console will only display warnnings
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p | %t | %m%n
log4j.appender.console.layout.ConversionPattern=%d | %-5p | %t | %m%n
log4j.appender.console.threshold=TRACE
# File appender will contain all info messages