From 8b993b4dc6de85199f2ac19b178275180859ed15 Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Wed, 29 Jan 2014 12:28:55 -0500 Subject: [PATCH] Couple of changes to allow for some performance analysis. --- .../transport/amqp/bugs/AMQ4914Test.java | 19 +++++++++++-------- .../src/test/resources/log4j.properties | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java index aefae8b7fa..b6fb1ea728 100644 --- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java +++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/bugs/AMQ4914Test.java @@ -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 diff --git a/activemq-amqp/src/test/resources/log4j.properties b/activemq-amqp/src/test/resources/log4j.properties index 41aa7cd59c..106fd996f4 100755 --- a/activemq-amqp/src/test/resources/log4j.properties +++ b/activemq-amqp/src/test/resources/log4j.properties @@ -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