mirror of https://github.com/apache/activemq.git
Couple of changes to allow for some performance analysis.
This commit is contained in:
parent
cce75e0926
commit
8b993b4dc6
|
@ -32,7 +32,6 @@ import javax.jms.TextMessage;
|
||||||
import org.apache.activemq.transport.amqp.AmqpTestSupport;
|
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.ConnectionFactoryImpl;
|
||||||
import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl;
|
import org.apache.qpid.amqp_1_0.jms.impl.QueueImpl;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.TestName;
|
import org.junit.rules.TestName;
|
||||||
|
@ -76,12 +75,9 @@ public class AMQ4914Test extends AmqpTestSupport {
|
||||||
doTestSendLargeMessage(65536 * 4);
|
doTestSendLargeMessage(65536 * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("AMQ-4914")
|
|
||||||
@Test(timeout = 2 * 60 * 1000)
|
@Test(timeout = 2 * 60 * 1000)
|
||||||
public void testSendLargeMessages() throws JMSException {
|
public void testSendHugeMessage() throws JMSException {
|
||||||
//for (int i = 32000; i < (32 *1024); i++) {
|
doTestSendLargeMessage(1024 * 1024 * 10);
|
||||||
doTestSendLargeMessage(32604); // Fails at 32614; or 32604 with my changes to AmqpProtocolBuffer
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doTestSendLargeMessage(int expectedSize) throws JMSException{
|
public void doTestSendLargeMessage(int expectedSize) throws JMSException{
|
||||||
|
@ -91,21 +87,27 @@ public class AMQ4914Test extends AmqpTestSupport {
|
||||||
|
|
||||||
Connection connection = createAMQPConnection(port, false);
|
Connection connection = createAMQPConnection(port, false);
|
||||||
|
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||||
QueueImpl queue = new QueueImpl(QUEUE_NAME);
|
QueueImpl queue = new QueueImpl(QUEUE_NAME);
|
||||||
MessageProducer producer = session.createProducer(queue);
|
MessageProducer producer = session.createProducer(queue);
|
||||||
TextMessage message = session.createTextMessage();
|
TextMessage message = session.createTextMessage();
|
||||||
message.setText(payload);
|
message.setText(payload);
|
||||||
producer.send(message);
|
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);
|
MessageConsumer consumer = session.createConsumer(queue);
|
||||||
connection.start();
|
connection.start();
|
||||||
LOG.debug("Calling receive");
|
LOG.info("Calling receive");
|
||||||
Message receivedMessage = consumer.receive();
|
Message receivedMessage = consumer.receive();
|
||||||
assertNotNull(receivedMessage);
|
assertNotNull(receivedMessage);
|
||||||
assertTrue(receivedMessage instanceof TextMessage);
|
assertTrue(receivedMessage instanceof TextMessage);
|
||||||
TextMessage receivedTextMessage = (TextMessage) receivedMessage;
|
TextMessage receivedTextMessage = (TextMessage) receivedMessage;
|
||||||
|
assertNotNull(receivedMessage);
|
||||||
|
endTime = System.currentTimeMillis();
|
||||||
|
LOG.info("Returned from receive after {} ms", endTime - startTime);
|
||||||
String receivedText = receivedTextMessage.getText();
|
String receivedText = receivedTextMessage.getText();
|
||||||
assertEquals(expectedSize, receivedText.getBytes().length);
|
assertEquals(expectedSize, receivedText.getBytes().length);
|
||||||
assertEquals(payload, receivedText);
|
assertEquals(payload, receivedText);
|
||||||
|
@ -115,6 +117,7 @@ public class AMQ4914Test extends AmqpTestSupport {
|
||||||
private Connection createAMQPConnection(int testPort, boolean useSSL) throws JMSException {
|
private Connection createAMQPConnection(int testPort, boolean useSSL) throws JMSException {
|
||||||
LOG.debug("In createConnection using port {} ssl? {}", testPort, useSSL);
|
LOG.debug("In createConnection using port {} ssl? {}", testPort, useSSL);
|
||||||
final ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl("localhost", testPort, "admin", "password", null, useSSL);
|
final ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl("localhost", testPort, "admin", "password", null, useSSL);
|
||||||
|
connectionFactory.setSyncPublish(true);
|
||||||
final Connection connection = connectionFactory.createConnection();
|
final Connection connection = connectionFactory.createConnection();
|
||||||
connection.setExceptionListener(new ExceptionListener() {
|
connection.setExceptionListener(new ExceptionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
#
|
#
|
||||||
log4j.rootLogger=WARN, console, file
|
log4j.rootLogger=WARN, console, file
|
||||||
log4j.logger.org.apache.activemq=INFO
|
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.apache.activemq.transport.amqp.FRAMES=TRACE
|
||||||
log4j.logger.org.fusesource=INFO
|
log4j.logger.org.fusesource=INFO
|
||||||
|
|
||||||
# Console will only display warnnings
|
# Console will only display warnnings
|
||||||
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
log4j.appender.console=org.apache.log4j.ConsoleAppender
|
||||||
log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
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
|
log4j.appender.console.threshold=TRACE
|
||||||
|
|
||||||
# File appender will contain all info messages
|
# File appender will contain all info messages
|
||||||
|
|
Loading…
Reference in New Issue