ARTEMIS-4020 removing ActiveMQTestBase::instanceLog

This commit is contained in:
Clebert Suconic 2022-09-29 14:15:23 -04:00 committed by clebertsuconic
parent 12cc70c5bf
commit 2ba6452b83
97 changed files with 842 additions and 440 deletions

View File

@ -175,8 +175,6 @@ public abstract class ActiveMQTestBase extends Assert {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected final Logger instanceLog = LoggerFactory.getLogger(this.getClass());
static { static {
Env.setTestEnv(true); Env.setTestEnv(true);
} }

View File

@ -47,19 +47,17 @@ public class ClasspathBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final Logger instanceLog = logger;
@Rule @Rule
public TestRule watcher = new TestWatcher() { public TestRule watcher = new TestWatcher() {
@Override @Override
protected void starting(Description description) { protected void starting(Description description) {
instanceLog.info("**** start #test {}::{}() ***", ClasspathBase.this.getClass().getName(), description.getMethodName()); logger.info("**** start #test {}::{}() ***", ClasspathBase.this.getClass().getName(), description.getMethodName());
} }
@Override @Override
protected void finished(Description description) { protected void finished(Description description) {
instanceLog.info("**** end #test {}::{}() ***", ClasspathBase.this.getClass().getName(), description.getMethodName()); logger.info("**** end #test {}::{}() ***", ClasspathBase.this.getClass().getName(), description.getMethodName());
} }
}; };

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.addressing; package org.apache.activemq.artemis.tests.integration.addressing;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
@ -36,9 +37,11 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.TimeUtils; import org.apache.activemq.artemis.utils.TimeUtils;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AnycastTest extends ActiveMQTestBase { public class AnycastTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private SimpleString baseAddress = new SimpleString("anycast.address"); private SimpleString baseAddress = new SimpleString("anycast.address");
private AddressInfo addressInfo; private AddressInfo addressInfo;
@ -98,7 +101,7 @@ public class AnycastTest extends ActiveMQTestBase {
for (int j = 0; j < num / 2; j++) { for (int j = 0; j < num / 2; j++) {
ClientMessage m = consumers[i].receive(2000); ClientMessage m = consumers[i].receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString()); logger.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
} }
assertNull(consumers[i].receive(200)); assertNull(consumers[i].receive(200));
@ -157,7 +160,7 @@ public class AnycastTest extends ActiveMQTestBase {
for (int j = 0; j < num / 2; j++) { for (int j = 0; j < num / 2; j++) {
ClientMessage m = consumers[i].receive(2000); ClientMessage m = consumers[i].receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString()); logger.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
} }
assertNull(consumers[i].receive(200)); assertNull(consumers[i].receive(200));
@ -173,7 +176,7 @@ public class AnycastTest extends ActiveMQTestBase {
for (int j = 0; j < num / 2; j++) { for (int j = 0; j < num / 2; j++) {
ClientMessage m = consumers[i].receive(2000); ClientMessage m = consumers[i].receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString()); logger.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
} }
assertNull(consumers[i].receive(200)); assertNull(consumers[i].receive(200));

View File

@ -34,10 +34,14 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.TimeUtils; import org.apache.activemq.artemis.utils.TimeUtils;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class MulticastTest extends ActiveMQTestBase { public class MulticastTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private SimpleString baseAddress = new SimpleString("multicast.address"); private SimpleString baseAddress = new SimpleString("multicast.address");
@ -98,7 +102,7 @@ public class MulticastTest extends ActiveMQTestBase {
for (int j = 0; j < num; j++) { for (int j = 0; j < num; j++) {
ClientMessage m = consumers[i].receive(2000); ClientMessage m = consumers[i].receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString()); logger.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
} }
assertNull(consumers[i].receive(200)); assertNull(consumers[i].receive(200));
@ -157,7 +161,7 @@ public class MulticastTest extends ActiveMQTestBase {
for (int j = 0; j < num; j++) { for (int j = 0; j < num; j++) {
ClientMessage m = consumers[i].receive(2000); ClientMessage m = consumers[i].receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString()); logger.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
} }
assertNull(consumers[i].receive(200)); assertNull(consumers[i].receive(200));
@ -173,7 +177,7 @@ public class MulticastTest extends ActiveMQTestBase {
for (int j = 0; j < num; j++) { for (int j = 0; j < num; j++) {
ClientMessage m = consumers[i].receive(2000); ClientMessage m = consumers[i].receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString()); logger.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
} }
assertNull(consumers[i].receive(200)); assertNull(consumers[i].receive(200));

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
@ -26,12 +27,16 @@ import org.apache.activemq.transport.amqp.client.AmqpMessage;
import org.apache.activemq.transport.amqp.client.AmqpReceiver; import org.apache.activemq.transport.amqp.client.AmqpReceiver;
import org.apache.activemq.transport.amqp.client.AmqpSession; import org.apache.activemq.transport.amqp.client.AmqpSession;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Tests for broker side support of the Durable Subscription mapping for JMS. * Tests for broker side support of the Durable Subscription mapping for JMS.
*/ */
public class AmqpDLQReceiverTest extends AmqpClientTestSupport { public class AmqpDLQReceiverTest extends AmqpClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 60000) @Test(timeout = 60000)
public void testCreateDurableReceiver() throws Exception { public void testCreateDurableReceiver() throws Exception {
@ -45,22 +50,22 @@ public class AmqpDLQReceiverTest extends AmqpClientTestSupport {
assertNotNull(queue); assertNotNull(queue);
receiver.flow(100); receiver.flow(100);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
instanceLog.debug("i = " + i); logger.debug("i = " + i);
AmqpMessage receive = receiver.receive(5000, TimeUnit.MILLISECONDS); AmqpMessage receive = receiver.receive(5000, TimeUnit.MILLISECONDS);
receive.modified(true, false); receive.modified(true, false);
Queue queueView = getProxyToQueue(getQueueName()); Queue queueView = getProxyToQueue(getQueueName());
instanceLog.debug("receive = " + receive.getWrappedMessage().getDeliveryCount()); logger.debug("receive = " + receive.getWrappedMessage().getDeliveryCount());
instanceLog.debug("queueView.getMessageCount() = " + queueView.getMessageCount()); logger.debug("queueView.getMessageCount() = " + queueView.getMessageCount());
instanceLog.debug("queueView.getDeliveringCount() = " + queueView.getDeliveringCount()); logger.debug("queueView.getDeliveringCount() = " + queueView.getDeliveringCount());
instanceLog.debug("queueView.getPersistentSize() = " + queueView.getPersistentSize()); logger.debug("queueView.getPersistentSize() = " + queueView.getPersistentSize());
} }
receiver.close(); receiver.close();
connection.close(); connection.close();
Queue queueView = getProxyToQueue(getQueueName()); Queue queueView = getProxyToQueue(getQueueName());
instanceLog.debug("queueView.getMessageCount() = " + queueView.getMessageCount()); logger.debug("queueView.getMessageCount() = " + queueView.getMessageCount());
instanceLog.debug("queueView.getDeliveringCount() = " + queueView.getDeliveringCount()); logger.debug("queueView.getDeliveringCount() = " + queueView.getDeliveringCount());
instanceLog.debug("queueView.getPersistentSize() = " + queueView.getPersistentSize()); logger.debug("queueView.getPersistentSize() = " + queueView.getPersistentSize());
Wait.assertEquals(0, queueView::getMessageCount); Wait.assertEquals(0, queueView::getMessageCount);
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.HashMap; import java.util.HashMap;
import javax.jms.Connection; import javax.jms.Connection;
@ -42,9 +43,13 @@ import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.activemq.artemis.utils.CompositeAddress; import org.apache.activemq.artemis.utils.CompositeAddress;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport { public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private SimpleString anycastAddress = new SimpleString("address.anycast"); private SimpleString anycastAddress = new SimpleString("address.anycast");
private SimpleString multicastAddress = new SimpleString("address.multicast"); private SimpleString multicastAddress = new SimpleString("address.multicast");
@ -227,7 +232,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport {
Bindings bindings = server.getPostOffice().getBindingsForAddress(multicastAddress); Bindings bindings = server.getPostOffice().getBindingsForAddress(multicastAddress);
for (Binding b : bindings.getBindings()) { for (Binding b : bindings.getBindings()) {
instanceLog.debug("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages()); logger.debug("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages());
SimpleString qName = b.getUniqueName(); SimpleString qName = b.getUniqueName();
//do FQQN query //do FQQN query
QueueQueryResult result = server.queueQuery(CompositeAddress.toFullyQualified(multicastAddress, qName)); QueueQueryResult result = server.queueQuery(CompositeAddress.toFullyQualified(multicastAddress, qName));
@ -314,7 +319,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport {
producer3.send(session.createMessage()); producer3.send(session.createMessage());
assertTrue(Wait.waitFor(() -> server.locateQueue(anycastQ3).getMessageCount() == 5, 2000, 200)); assertTrue(Wait.waitFor(() -> server.locateQueue(anycastQ3).getMessageCount() == 5, 2000, 200));
instanceLog.debug("Queue is: " + q1); logger.debug("Queue is: " + q1);
MessageConsumer consumer1 = session.createConsumer(q1); MessageConsumer consumer1 = session.createConsumer(q1);
MessageConsumer consumer2 = session.createConsumer(q2); MessageConsumer consumer2 = session.createConsumer(q2);
MessageConsumer consumer3 = session.createConsumer(q3); MessageConsumer consumer3 = session.createConsumer(q3);

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -38,10 +39,14 @@ import org.apache.activemq.transport.amqp.client.AmqpSession;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class AmqpIngressTimestampTest extends AmqpClientTestSupport { public class AmqpIngressTimestampTest extends AmqpClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public int amqpMinLargeMessageSize = ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE; public int amqpMinLargeMessageSize = ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE;
@Parameterized.Parameters(name = "restart={0}, large={1}") @Parameterized.Parameters(name = "restart={0}, large={1}")
@ -107,7 +112,7 @@ public class AmqpIngressTimestampTest extends AmqpClientTestSupport {
receiver.flow(1); receiver.flow(1);
AmqpMessage receive = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage receive = receiver.receive(5, TimeUnit.SECONDS);
assertNotNull(receive); assertNotNull(receive);
instanceLog.info("{}", receive); logger.info("{}", receive);
Object ingressTimestampHeader = receive.getMessageAnnotation(AMQPMessageSupport.X_OPT_INGRESS_TIME); Object ingressTimestampHeader = receive.getMessageAnnotation(AMQPMessageSupport.X_OPT_INGRESS_TIME);
assertNotNull(ingressTimestampHeader); assertNotNull(ingressTimestampHeader);
assertTrue(ingressTimestampHeader instanceof Long); assertTrue(ingressTimestampHeader instanceof Long);

View File

@ -312,7 +312,7 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
if (wrapped.getBody() instanceof Data) { if (wrapped.getBody() instanceof Data) {
// converters can change this to AmqValue // converters can change this to AmqValue
Data data = (Data) wrapped.getBody(); Data data = (Data) wrapped.getBody();
instanceLog.debug("received : message: " + data.getValue().getLength()); LOG.debug("received : message: " + data.getValue().getLength());
assertEquals(payload, data.getValue().getLength()); assertEquals(payload, data.getValue().getLength());
} }
message.accept(); message.accept();
@ -366,7 +366,7 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
MessageImpl wrapped = (MessageImpl) message.getWrappedMessage(); MessageImpl wrapped = (MessageImpl) message.getWrappedMessage();
if (wrapped.getBody() instanceof Data) { if (wrapped.getBody() instanceof Data) {
Data data = (Data) wrapped.getBody(); Data data = (Data) wrapped.getBody();
instanceLog.debug("received : message: " + data.getValue().getLength()); LOG.debug("received : message: " + data.getValue().getLength());
assertEquals(payload, data.getValue().getLength()); assertEquals(payload, data.getValue().getLength());
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
@ -27,12 +28,16 @@ import org.apache.activemq.transport.amqp.client.AmqpReceiver;
import org.apache.activemq.transport.amqp.client.AmqpSender; import org.apache.activemq.transport.amqp.client.AmqpSender;
import org.apache.activemq.transport.amqp.client.AmqpSession; import org.apache.activemq.transport.amqp.client.AmqpSession;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Test various behaviors of AMQP receivers with the broker. * Test various behaviors of AMQP receivers with the broker.
*/ */
public class AmqpPresettledReceiverTest extends AmqpClientTestSupport { public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 60000) @Test(timeout = 60000)
public void testPresettledReceiverAndNonPresettledReceiverOnSameQueue() throws Exception { public void testPresettledReceiverAndNonPresettledReceiverOnSameQueue() throws Exception {
final int MSG_COUNT = 2; final int MSG_COUNT = 2;
@ -66,7 +71,7 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
receiver1.close(); receiver1.close();
receiver2.close(); receiver2.close();
instanceLog.debug("Message Count after all consumed: " + queueView.getMessageCount()); logger.debug("Message Count after all consumed: " + queueView.getMessageCount());
// Should be nothing left on the Queue // Should be nothing left on the Queue
AmqpReceiver receiver3 = session.createReceiver(getQueueName()); AmqpReceiver receiver3 = session.createReceiver(getQueueName());
@ -74,7 +79,7 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
AmqpMessage received = receiver3.receive(5, TimeUnit.SECONDS); AmqpMessage received = receiver3.receive(5, TimeUnit.SECONDS);
if (received != null) { if (received != null) {
instanceLog.debug("Message read: " + received.getMessageId()); logger.debug("Message read: " + received.getMessageId());
} }
assertNull(received); assertNull(received);
@ -103,14 +108,14 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
} }
receiver.close(); receiver.close();
instanceLog.debug("Message Count after all consumed: " + queueView.getMessageCount()); logger.debug("Message Count after all consumed: " + queueView.getMessageCount());
// Open a new receiver and see if any message are left on the Queue // Open a new receiver and see if any message are left on the Queue
receiver = session.createReceiver(getQueueName()); receiver = session.createReceiver(getQueueName());
receiver.flow(1); receiver.flow(1);
AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS);
if (received != null) { if (received != null) {
instanceLog.debug("Message read: " + received.getMessageId()); logger.debug("Message read: " + received.getMessageId());
} }
assertNull(received); assertNull(received);
@ -155,14 +160,14 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
receiver.close(); receiver.close();
instanceLog.debug("Message Count after all consumed: " + queueView.getMessageCount()); logger.debug("Message Count after all consumed: " + queueView.getMessageCount());
// Open a new receiver and see if any message are left on the Queue // Open a new receiver and see if any message are left on the Queue
receiver = session.createReceiver(getQueueName()); receiver = session.createReceiver(getQueueName());
receiver.flow(1); receiver.flow(1);
AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS);
if (received != null) { if (received != null) {
instanceLog.debug("Message read: " + received.getMessageId()); logger.debug("Message read: " + received.getMessageId());
} }
assertNull(received); assertNull(received);

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
@ -26,12 +27,16 @@ import org.apache.activemq.transport.amqp.client.AmqpMessage;
import org.apache.activemq.transport.amqp.client.AmqpReceiver; import org.apache.activemq.transport.amqp.client.AmqpReceiver;
import org.apache.activemq.transport.amqp.client.AmqpSession; import org.apache.activemq.transport.amqp.client.AmqpSession;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Tests various behaviors of broker side drain support. * Tests various behaviors of broker side drain support.
*/ */
public class AmqpReceiverDrainTest extends AmqpClientTestSupport { public class AmqpReceiverDrainTest extends AmqpClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 60000) @Test(timeout = 60000)
public void testReceiverCanDrainMessagesQueue() throws Exception { public void testReceiverCanDrainMessagesQueue() throws Exception {
doTestReceiverCanDrainMessages(false); doTestReceiverCanDrainMessages(false);
@ -69,7 +74,7 @@ public class AmqpReceiverDrainTest extends AmqpClientTestSupport {
for (int i = 0; i < MSG_COUNT; ++i) { for (int i = 0; i < MSG_COUNT; ++i) {
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
assertNotNull("Failed to read message: " + (i + 1), message); assertNotNull("Failed to read message: " + (i + 1), message);
instanceLog.info("Read message: " + message.getMessageId()); logger.info("Read message: " + message.getMessageId());
message.accept(); message.accept();
} }
receiver.close(); receiver.close();

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.amqp;
import static org.apache.activemq.transport.amqp.AmqpSupport.findFilter; import static org.apache.activemq.transport.amqp.AmqpSupport.findFilter;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -41,12 +42,16 @@ import org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy;
import org.apache.qpid.proton.engine.Receiver; import org.apache.qpid.proton.engine.Receiver;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Test various behaviors of AMQP receivers with the broker. * Test various behaviors of AMQP receivers with the broker.
*/ */
public class AmqpReceiverWithFiltersTest extends AmqpClientTestSupport { public class AmqpReceiverWithFiltersTest extends AmqpClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 60000) @Test(timeout = 60000)
public void testUnsupportedFiltersAreNotListedAsSupported() throws Exception { public void testUnsupportedFiltersAreNotListedAsSupported() throws Exception {
AmqpClient client = createAmqpClient(); AmqpClient client = createAmqpClient();
@ -148,7 +153,7 @@ public class AmqpReceiverWithFiltersTest extends AmqpClientTestSupport {
for (int i = 0; i < NUM_MESSAGES / 2; ++i) { for (int i = 0; i < NUM_MESSAGES / 2; ++i) {
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
Assert.assertNotNull(message); Assert.assertNotNull(message);
instanceLog.debug("Read message: " + message.getApplicationProperty("myNewID")); logger.debug("Read message: " + message.getApplicationProperty("myNewID"));
assertNotNull(message); assertNotNull(message);
messages.add(message); messages.add(message);
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -33,9 +34,13 @@ import org.apache.qpid.proton.engine.Delivery;
import org.apache.qpid.proton.engine.Receiver; import org.apache.qpid.proton.engine.Receiver;
import org.apache.qpid.proton.engine.Sender; import org.apache.qpid.proton.engine.Sender;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AmqpSecurityTest extends AmqpClientTestSupport { public class AmqpSecurityTest extends AmqpClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
protected boolean isSecurityEnabled() { protected boolean isSecurityEnabled() {
return true; return true;
@ -118,7 +123,7 @@ public class AmqpSecurityTest extends AmqpClientTestSupport {
session.createSender(getQueueName()); session.createSender(getQueueName());
fail("Should not be able to consume here."); fail("Should not be able to consume here.");
} catch (Exception ex) { } catch (Exception ex) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
connection.getStateInspector().assertValid(); connection.getStateInspector().assertValid();
@ -216,7 +221,7 @@ public class AmqpSecurityTest extends AmqpClientTestSupport {
session.createReceiver(getQueueName()); session.createReceiver(getQueueName());
fail("Should not be able to consume here."); fail("Should not be able to consume here.");
} catch (Exception ex) { } catch (Exception ex) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
connection.getStateInspector().assertValid(); connection.getStateInspector().assertValid();
@ -253,7 +258,7 @@ public class AmqpSecurityTest extends AmqpClientTestSupport {
session.createReceiver(getQueueName(getPrecreatedQueueSize() + 1)); session.createReceiver(getQueueName(getPrecreatedQueueSize() + 1));
fail("Should not be able to consume here."); fail("Should not be able to consume here.");
} catch (Exception ex) { } catch (Exception ex) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
connection.getStateInspector().assertValid(); connection.getStateInspector().assertValid();

View File

@ -63,7 +63,7 @@ import java.lang.invoke.MethodHandles;
*/ */
public class AmqpSendReceiveTest extends AmqpClientTestSupport { public class AmqpSendReceiveTest extends AmqpClientTestSupport {
protected static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
protected boolean isAutoCreateQueues() { protected boolean isAutoCreateQueues() {
@ -372,7 +372,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
sender.send(message); sender.send(message);
sender.close(); sender.close();
LOG.debug("Attempting to read message with receiver"); logger.debug("Attempting to read message with receiver");
AmqpReceiver receiver = session.createReceiver(getQueueName()); AmqpReceiver receiver = session.createReceiver(getQueueName());
receiver.flow(2); receiver.flow(2);
AmqpMessage received = receiver.receive(10, TimeUnit.SECONDS); AmqpMessage received = receiver.receive(10, TimeUnit.SECONDS);
@ -408,7 +408,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
sender.send(message); sender.send(message);
sender.close(); sender.close();
LOG.debug("Attempting to read message with receiver"); logger.debug("Attempting to read message with receiver");
AmqpReceiver receiver = session.createReceiver(getQueueName(), "\"m.x-opt-serialNo\"=2"); AmqpReceiver receiver = session.createReceiver(getQueueName(), "\"m.x-opt-serialNo\"=2");
receiver.flow(2); receiver.flow(2);
AmqpMessage received = receiver.receive(10, TimeUnit.SECONDS); AmqpMessage received = receiver.receive(10, TimeUnit.SECONDS);
@ -440,7 +440,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
message.setMessageAnnotation("serialNo", i); message.setMessageAnnotation("serialNo", i);
message.setText("Test-Message"); message.setText("Test-Message");
instanceLog.debug("Sending message: " + message.getMessageId()); logger.debug("Sending message: " + message.getMessageId());
sender.send(message); sender.send(message);
} }
@ -462,7 +462,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
for (int i = 0; i < MSG_COUNT; ++i) { for (int i = 0; i < MSG_COUNT; ++i) {
received = receiver2.receive(5, TimeUnit.SECONDS); received = receiver2.receive(5, TimeUnit.SECONDS);
assertNotNull("Should have got a message", received); assertNotNull("Should have got a message", received);
instanceLog.debug("Read message: " + received.getMessageId()); logger.debug("Read message: " + received.getMessageId());
assertEquals("msg" + i, received.getMessageId()); assertEquals("msg" + i, received.getMessageId());
} }
@ -556,7 +556,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
sender.close(); sender.close();
LOG.debug("Attempting to read first two messages with receiver #1"); logger.debug("Attempting to read first two messages with receiver #1");
AmqpReceiver receiver1 = session.createReceiver(getQueueName()); AmqpReceiver receiver1 = session.createReceiver(getQueueName());
receiver1.flow(2); receiver1.flow(2);
AmqpMessage message1 = receiver1.receive(10, TimeUnit.SECONDS); AmqpMessage message1 = receiver1.receive(10, TimeUnit.SECONDS);
@ -568,7 +568,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
message1.accept(); message1.accept();
message2.accept(); message2.accept();
LOG.debug("Attempting to read next two messages with receiver #2"); logger.debug("Attempting to read next two messages with receiver #2");
AmqpReceiver receiver2 = session.createReceiver(getQueueName()); AmqpReceiver receiver2 = session.createReceiver(getQueueName());
receiver2.flow(2); receiver2.flow(2);
AmqpMessage message3 = receiver2.receive(10, TimeUnit.SECONDS); AmqpMessage message3 = receiver2.receive(10, TimeUnit.SECONDS);
@ -580,7 +580,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
message3.accept(); message3.accept();
message4.accept(); message4.accept();
LOG.debug("Attempting to read remaining messages with receiver #1"); logger.debug("Attempting to read remaining messages with receiver #1");
receiver1.flow(MSG_COUNT - 4); receiver1.flow(MSG_COUNT - 4);
for (int i = 4; i < MSG_COUNT; i++) { for (int i = 4; i < MSG_COUNT; i++) {
AmqpMessage message = receiver1.receive(10, TimeUnit.SECONDS); AmqpMessage message = receiver1.receive(10, TimeUnit.SECONDS);
@ -643,24 +643,24 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
message3.accept(); message3.accept();
message4.accept(); message4.accept();
LOG.debug("*** Attempting to read remaining messages with both receivers"); logger.debug("*** Attempting to read remaining messages with both receivers");
int splitCredit = (MSG_COUNT - 4) / 2; int splitCredit = (MSG_COUNT - 4) / 2;
LOG.debug("**** Receiver #1 granting credit[{}] for its block of messages", splitCredit); logger.debug("**** Receiver #1 granting credit[{}] for its block of messages", splitCredit);
receiver1.flow(splitCredit); receiver1.flow(splitCredit);
for (int i = 0; i < splitCredit; i++) { for (int i = 0; i < splitCredit; i++) {
AmqpMessage message = receiver1.receive(10, TimeUnit.SECONDS); AmqpMessage message = receiver1.receive(10, TimeUnit.SECONDS);
assertNotNull("Receiver #1 should have read a message", message); assertNotNull("Receiver #1 should have read a message", message);
LOG.debug("Receiver #1 read message: {}", message.getMessageId()); logger.debug("Receiver #1 read message: {}", message.getMessageId());
message.accept(); message.accept();
} }
LOG.debug("**** Receiver #2 granting credit[{}] for its block of messages", splitCredit); logger.debug("**** Receiver #2 granting credit[{}] for its block of messages", splitCredit);
receiver2.flow(splitCredit); receiver2.flow(splitCredit);
for (int i = 0; i < splitCredit; i++) { for (int i = 0; i < splitCredit; i++) {
AmqpMessage message = receiver2.receive(10, TimeUnit.SECONDS); AmqpMessage message = receiver2.receive(10, TimeUnit.SECONDS);
assertNotNull("Receiver #2 should have read message[" + i + "]", message); assertNotNull("Receiver #2 should have read message[" + i + "]", message);
LOG.debug("Receiver #2 read message: {}", message.getMessageId()); logger.debug("Receiver #2 read message: {}", message.getMessageId());
message.accept(); message.accept();
} }
@ -717,7 +717,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
@Override @Override
public void run() { public void run() {
try { try {
LOG.debug("Starting consumer connection"); logger.debug("Starting consumer connection");
AmqpConnection connection = addConnection(client.connect()); AmqpConnection connection = addConnection(client.connect());
AmqpSession session = connection.createSession(); AmqpSession session = connection.createSession();
AmqpReceiver receiver = session.createReceiver(address); AmqpReceiver receiver = session.createReceiver(address);
@ -968,7 +968,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
sender.send(message); sender.send(message);
} }
LOG.debug("Attempting to read first two messages with receiver #1"); logger.debug("Attempting to read first two messages with receiver #1");
receiver1.flow(2); receiver1.flow(2);
AmqpMessage message1 = receiver1.receive(10, TimeUnit.SECONDS); AmqpMessage message1 = receiver1.receive(10, TimeUnit.SECONDS);
AmqpMessage message2 = receiver1.receive(10, TimeUnit.SECONDS); AmqpMessage message2 = receiver1.receive(10, TimeUnit.SECONDS);
@ -979,7 +979,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
message1.accept(); message1.accept();
message2.accept(); message2.accept();
LOG.debug("Attempting to read next two messages with receiver #2"); logger.debug("Attempting to read next two messages with receiver #2");
receiver2.flow(2); receiver2.flow(2);
AmqpMessage message3 = receiver2.receive(10, TimeUnit.SECONDS); AmqpMessage message3 = receiver2.receive(10, TimeUnit.SECONDS);
AmqpMessage message4 = receiver2.receive(10, TimeUnit.SECONDS); AmqpMessage message4 = receiver2.receive(10, TimeUnit.SECONDS);
@ -990,24 +990,24 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
message3.accept(); message3.accept();
message4.accept(); message4.accept();
LOG.debug("*** Attempting to read remaining messages with both receivers"); logger.debug("*** Attempting to read remaining messages with both receivers");
int splitCredit = (MSG_COUNT - 4) / 2; int splitCredit = (MSG_COUNT - 4) / 2;
LOG.debug("**** Receiver #1 granting credit[{}] for its block of messages", splitCredit); logger.debug("**** Receiver #1 granting credit[{}] for its block of messages", splitCredit);
receiver1.flow(splitCredit); receiver1.flow(splitCredit);
for (int i = 0; i < splitCredit; i++) { for (int i = 0; i < splitCredit; i++) {
AmqpMessage message = receiver1.receive(10, TimeUnit.SECONDS); AmqpMessage message = receiver1.receive(10, TimeUnit.SECONDS);
assertNotNull("Receiver #1 should have read a message", message); assertNotNull("Receiver #1 should have read a message", message);
LOG.debug("Receiver #1 read message: {}", message.getMessageId()); logger.debug("Receiver #1 read message: {}", message.getMessageId());
message.accept(); message.accept();
} }
LOG.debug("**** Receiver #2 granting credit[{}] for its block of messages", splitCredit); logger.debug("**** Receiver #2 granting credit[{}] for its block of messages", splitCredit);
receiver2.flow(splitCredit); receiver2.flow(splitCredit);
for (int i = 0; i < splitCredit; i++) { for (int i = 0; i < splitCredit; i++) {
AmqpMessage message = receiver2.receive(10, TimeUnit.SECONDS); AmqpMessage message = receiver2.receive(10, TimeUnit.SECONDS);
assertNotNull("Receiver #2 should have read a message[" + i + "]", message); assertNotNull("Receiver #2 should have read a message[" + i + "]", message);
LOG.debug("Receiver #2 read message: {}", message.getMessageId()); logger.debug("Receiver #2 read message: {}", message.getMessageId());
message.accept(); message.accept();
} }
@ -1193,7 +1193,7 @@ public class AmqpSendReceiveTest extends AmqpClientTestSupport {
received.accept(); received.accept();
done.countDown(); done.countDown();
} catch (Exception ex) { } catch (Exception ex) {
LOG.debug("Caught error: {}", ex.getClass().getSimpleName()); logger.debug("Caught error: {}", ex.getClass().getSimpleName());
error.set(true); error.set(true);
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.core.server.ServerSession; import org.apache.activemq.artemis.core.server.ServerSession;
import org.apache.activemq.artemis.core.server.impl.ServerSessionImpl; import org.apache.activemq.artemis.core.server.impl.ServerSessionImpl;
import org.apache.activemq.transport.amqp.client.AmqpClient; import org.apache.activemq.transport.amqp.client.AmqpClient;
@ -28,8 +30,11 @@ import org.apache.qpid.proton.engine.Receiver;
import org.apache.qpid.proton.engine.Session; import org.apache.qpid.proton.engine.Session;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AmqpSessionTest extends AmqpClientTestSupport { public class AmqpSessionTest extends AmqpClientTestSupport {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 60000) @Test(timeout = 60000)
public void testCreateSession() throws Exception { public void testCreateSession() throws Exception {
@ -49,7 +54,7 @@ public class AmqpSessionTest extends AmqpClientTestSupport {
@Override @Override
public void inspectClosedResource(Session session) { public void inspectClosedResource(Session session) {
instanceLog.debug("Session closed: " + session.getContext()); log.debug("Session closed: " + session.getContext());
} }
@Override @Override

View File

@ -56,7 +56,7 @@ import java.lang.invoke.MethodHandles;
*/ */
public class AmqpTransactionTest extends AmqpClientTestSupport { public class AmqpTransactionTest extends AmqpClientTestSupport {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 30000) @Test(timeout = 30000)
public void testBeginAndCommitTransaction() throws Exception { public void testBeginAndCommitTransaction() throws Exception {
@ -103,9 +103,9 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
if (delivery.remotelySettled()) { if (delivery.remotelySettled()) {
DeliveryState state = delivery.getRemoteState(); DeliveryState state = delivery.getRemoteState();
if (state instanceof TransactionalState) { if (state instanceof TransactionalState) {
LOG.debug("Remote settled with TX state: {}", state); logger.debug("Remote settled with TX state: {}", state);
} else { } else {
LOG.warn("Remote settled with non-TX state: {}", state); logger.warn("Remote settled with non-TX state: {}", state);
markAsInvalid("Remote did not settled with TransactionState."); markAsInvalid("Remote did not settled with TransactionState.");
} }
} }
@ -716,7 +716,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
receiver.flow((NUM_MESSAGES + 2) * 2); receiver.flow((NUM_MESSAGES + 2) * 2);
for (int i = 0; i < NUM_MESSAGES; ++i) { for (int i = 0; i < NUM_MESSAGES; ++i) {
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
instanceLog.debug("Read message: " + message.getApplicationProperty("msgId")); logger.debug("Read message: " + message.getApplicationProperty("msgId"));
assertNotNull(message); assertNotNull(message);
messages.add(message); messages.add(message);
} }
@ -724,7 +724,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
// Commit half the consumed messages [0, 1, 2, 3, 4] // Commit half the consumed messages [0, 1, 2, 3, 4]
txnSession.begin(); txnSession.begin();
for (int i = 0; i < NUM_MESSAGES / 2; ++i) { for (int i = 0; i < NUM_MESSAGES / 2; ++i) {
instanceLog.debug("Commit: Accepting message: " + messages.get(i).getApplicationProperty("msgId")); logger.debug("Commit: Accepting message: " + messages.get(i).getApplicationProperty("msgId"));
messages.get(i).accept(txnSession, false); messages.get(i).accept(txnSession, false);
} }
txnSession.commit(); txnSession.commit();
@ -732,7 +732,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
// Rollback the other half the consumed messages [5, 6, 7, 8, 9] // Rollback the other half the consumed messages [5, 6, 7, 8, 9]
txnSession.begin(); txnSession.begin();
for (int i = NUM_MESSAGES / 2; i < NUM_MESSAGES; ++i) { for (int i = NUM_MESSAGES / 2; i < NUM_MESSAGES; ++i) {
instanceLog.debug("Rollback: Accepting message: " + messages.get(i).getApplicationProperty("msgId")); logger.debug("Rollback: Accepting message: " + messages.get(i).getApplicationProperty("msgId"));
messages.get(i).accept(txnSession, false); messages.get(i).accept(txnSession, false);
} }
txnSession.rollback(); txnSession.rollback();
@ -740,7 +740,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
// After rollback messages should still be acquired so we read last sent message [10] // After rollback messages should still be acquired so we read last sent message [10]
{ {
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
instanceLog.debug("Read message: " + message.getApplicationProperty("msgId")); logger.debug("Read message: " + message.getApplicationProperty("msgId"));
assertNotNull(message); assertNotNull(message);
assertEquals(NUM_MESSAGES, message.getApplicationProperty("msgId")); assertEquals(NUM_MESSAGES, message.getApplicationProperty("msgId"));
message.release(); message.release();
@ -758,7 +758,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
{ {
receiver.flow(1); receiver.flow(1);
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
instanceLog.debug("Read message: " + message.getApplicationProperty("msgId")); logger.debug("Read message: " + message.getApplicationProperty("msgId"));
assertNotNull(message); assertNotNull(message);
assertEquals(NUM_MESSAGES, message.getApplicationProperty("msgId")); assertEquals(NUM_MESSAGES, message.getApplicationProperty("msgId"));
message.accept(); message.accept();
@ -768,7 +768,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
receiver.flow(1); receiver.flow(1);
AmqpMessage message = receiver.receive(1, TimeUnit.SECONDS); AmqpMessage message = receiver.receive(1, TimeUnit.SECONDS);
if (message != null) { if (message != null) {
instanceLog.debug("Read message: " + message.getApplicationProperty("msgId")); logger.debug("Read message: " + message.getApplicationProperty("msgId"));
} }
assertNull(message); assertNull(message);
} finally { } finally {
@ -808,7 +808,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
{ {
// This will result in message [0[ being consumed once we commit. // This will result in message [0[ being consumed once we commit.
message1.accept(txnSession, false); message1.accept(txnSession, false);
instanceLog.debug("Commit: accepting message: " + message1.getApplicationProperty("msgId")); logger.debug("Commit: accepting message: " + message1.getApplicationProperty("msgId"));
AmqpMessage message = new AmqpMessage(); AmqpMessage message = new AmqpMessage();
message.setText("Test-Message"); message.setText("Test-Message");
@ -822,7 +822,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
txnSession.begin(); txnSession.begin();
{ {
message2.accept(txnSession, false); message2.accept(txnSession, false);
instanceLog.debug("Rollback: accepting message: " + message2.getApplicationProperty("msgId")); logger.debug("Rollback: accepting message: " + message2.getApplicationProperty("msgId"));
AmqpMessage message = new AmqpMessage(); AmqpMessage message = new AmqpMessage();
message.setText("Test-Message"); message.setText("Test-Message");
@ -840,7 +840,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
for (int i = 1; i <= NUM_MESSAGES; ++i) { for (int i = 1; i <= NUM_MESSAGES; ++i) {
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS); AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
assertNotNull("Expected a message for: " + i, message); assertNotNull("Expected a message for: " + i, message);
instanceLog.debug("Accepting message: " + message.getApplicationProperty("msgId")); logger.debug("Accepting message: " + message.getApplicationProperty("msgId"));
assertEquals(i, message.getApplicationProperty("msgId")); assertEquals(i, message.getApplicationProperty("msgId"));
message.accept(); message.accept();
} }
@ -879,7 +879,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
} }
if (i % 100 == 0) { if (i % 100 == 0) {
if (i % 1000 == 0) instanceLog.debug("Read message " + i); if (i % 1000 == 0) logger.debug("Read message " + i);
consumerSession.commit(); consumerSession.commit();
} }
} }
@ -904,7 +904,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
for (int i = 0; i < MESSAGE_COUNT; i++) { for (int i = 0; i < MESSAGE_COUNT; i++) {
producer.send(sendingSession.createTextMessage("message " + i), DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); producer.send(sendingSession.createTextMessage("message " + i), DeliveryMode.PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
if (i % 100 == 0) { if (i % 100 == 0) {
if (i % 1000 == 0) instanceLog.debug("Sending " + i); if (i % 1000 == 0) logger.debug("Sending " + i);
sendingSession.commit(); sendingSession.commit();
} }
} }
@ -942,7 +942,7 @@ public class AmqpTransactionTest extends AmqpClientTestSupport {
@Override @Override
public void inspectDeliveryUpdate(Sender sender, Delivery delivery) { public void inspectDeliveryUpdate(Sender sender, Delivery delivery) {
if (delivery.remotelySettled()) { if (delivery.remotelySettled()) {
LOG.debug("Receiver got delivery update for: {}", delivery); logger.debug("Receiver got delivery update for: {}", delivery);
if (!(delivery.getRemoteState() instanceof TransactionalState)) { if (!(delivery.getRemoteState() instanceof TransactionalState)) {
markAsInvalid("Transactionally acquire work no tagged as being in a transaction."); markAsInvalid("Transactionally acquire work no tagged as being in a transaction.");
} else { } else {

View File

@ -28,11 +28,16 @@ import javax.jms.TextMessage;
import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.JmsConnectionFactory;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.invoke.MethodHandles;
import java.net.URI; import java.net.URI;
public class JMSConnectionWithSecurityTest extends JMSClientTestSupport { public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
protected boolean isSecurityEnabled() { protected boolean isSecurityEnabled() {
return true; return true;
@ -51,7 +56,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
connection.start(); connection.start();
fail("Expected JMSException"); fail("Expected JMSException");
} catch (JMSSecurityException ex) { } catch (JMSSecurityException ex) {
instanceLog.debug("Failed to authenticate connection with no user / password.", ex); logger.debug("Failed to authenticate connection with no user / password.", ex);
} finally { } finally {
if (connection != null) { if (connection != null) {
@ -69,7 +74,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
connection.start(); connection.start();
fail("Expected Exception"); fail("Expected Exception");
} catch (JMSSecurityException ex) { } catch (JMSSecurityException ex) {
instanceLog.debug("Failed to authenticate connection with no user / password."); logger.debug("Failed to authenticate connection with no user / password.");
} catch (Exception ex) { } catch (Exception ex) {
fail("Expected JMSSecurityException"); fail("Expected JMSSecurityException");
} finally { } finally {
@ -87,7 +92,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
connection.start(); connection.start();
fail("Expected JMSException"); fail("Expected JMSException");
} catch (JMSSecurityException ex) { } catch (JMSSecurityException ex) {
instanceLog.debug("Failed to authenticate connection with unknown user ID"); logger.debug("Failed to authenticate connection with unknown user ID");
} finally { } finally {
if (connection != null) { if (connection != null) {
connection.close(); connection.close();
@ -103,7 +108,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
connection.start(); connection.start();
fail("Expected JMSException"); fail("Expected JMSException");
} catch (JMSSecurityException ex) { } catch (JMSSecurityException ex) {
instanceLog.debug("Failed to authenticate connection with incorrect password."); logger.debug("Failed to authenticate connection with incorrect password.");
} finally { } finally {
if (connection != null) { if (connection != null) {
connection.close(); connection.close();
@ -120,7 +125,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
connection.start(); connection.start();
fail("Expected JMSException"); fail("Expected JMSException");
} catch (JMSSecurityException ex) { } catch (JMSSecurityException ex) {
instanceLog.debug("Failed to authenticate connection with incorrect password."); logger.debug("Failed to authenticate connection with incorrect password.");
} finally { } finally {
if (connection != null) { if (connection != null) {
connection.close(); connection.close();
@ -167,7 +172,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
session.createConsumer(queue); session.createConsumer(queue);
fail("Should not be able to consume here."); fail("Should not be able to consume here.");
} catch (JMSSecurityException jmsSE) { } catch (JMSSecurityException jmsSE) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
} finally { } finally {
connection.close(); connection.close();
@ -187,7 +192,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
browser.getEnumeration(); browser.getEnumeration();
fail("Should not be able to consume here."); fail("Should not be able to consume here.");
} catch (JMSSecurityException jmsSE) { } catch (JMSSecurityException jmsSE) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
} finally { } finally {
connection.close(); connection.close();
@ -205,7 +210,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
session.createConsumer(queue); session.createConsumer(queue);
fail("Should not be able to consume here."); fail("Should not be able to consume here.");
} catch (JMSSecurityException jmsSE) { } catch (JMSSecurityException jmsSE) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
} finally { } finally {
connection.close(); connection.close();
@ -223,7 +228,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
session.createProducer(queue); session.createProducer(queue);
fail("Should not be able to produce here."); fail("Should not be able to produce here.");
} catch (JMSSecurityException jmsSE) { } catch (JMSSecurityException jmsSE) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
} finally { } finally {
connection.close(); connection.close();
@ -243,7 +248,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
producer.send(queue, session.createTextMessage()); producer.send(queue, session.createTextMessage());
fail("Should not be able to produce here."); fail("Should not be able to produce here.");
} catch (JMSSecurityException jmsSE) { } catch (JMSSecurityException jmsSE) {
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
} finally { } finally {
connection.close(); connection.close();
@ -260,7 +265,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
try { try {
session.createTemporaryQueue(); session.createTemporaryQueue();
} catch (JMSSecurityException jmsse) { } catch (JMSSecurityException jmsse) {
instanceLog.debug("Client should have thrown a JMSSecurityException but only threw JMSException"); logger.debug("Client should have thrown a JMSSecurityException but only threw JMSException");
} }
// Should not be fatal // Should not be fatal
@ -280,7 +285,7 @@ public class JMSConnectionWithSecurityTest extends JMSClientTestSupport {
try { try {
session.createTemporaryTopic(); session.createTemporaryTopic();
} catch (JMSSecurityException jmsse) { } catch (JMSSecurityException jmsse) {
instanceLog.debug("Client should have thrown a JMSSecurityException but only threw JMSException"); logger.debug("Client should have thrown a JMSSecurityException but only threw JMSException");
} }
// Should not be fatal // Should not be fatal

View File

@ -731,7 +731,7 @@ public class JMSMessageConsumerTest extends JMSClientTestSupport {
while (count > 0) { while (count > 0) {
try { try {
if (++n % 1000 == 0) { if (++n % 1000 == 0) {
instanceLog.debug("received " + n + " messages"); LOG.debug("received " + n + " messages");
} }
Message m = consumer.receive(5000); Message m = consumer.receive(5000);
@ -783,11 +783,11 @@ public class JMSMessageConsumerTest extends JMSClientTestSupport {
Wait.assertEquals(0, queueView::getMessageCount); Wait.assertEquals(0, queueView::getMessageCount);
long taken = (System.currentTimeMillis() - time); long taken = (System.currentTimeMillis() - time);
instanceLog.debug("Microbenchamrk ran in " + taken + " milliseconds, sending/receiving " + numMessages); LOG.debug("Microbenchamrk ran in " + taken + " milliseconds, sending/receiving " + numMessages);
double messagesPerSecond = ((double) numMessages / (double) taken) * 1000; double messagesPerSecond = ((double) numMessages / (double) taken) * 1000;
instanceLog.debug(((int) messagesPerSecond) + " messages per second"); LOG.debug(((int) messagesPerSecond) + " messages per second");
} }
@Test(timeout = 60000) @Test(timeout = 60000)

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.io.Serializable; import java.io.Serializable;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import javax.jms.BytesMessage; import javax.jms.BytesMessage;
@ -42,12 +43,16 @@ import org.apache.activemq.artemis.utils.ByteUtil;
import org.apache.activemq.artemis.utils.RandomUtil; import org.apache.activemq.artemis.utils.RandomUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Test that various message types are handled as expected with an AMQP JMS client. * Test that various message types are handled as expected with an AMQP JMS client.
*/ */
public class JMSMessageTypesTest extends JMSClientTestSupport { public class JMSMessageTypesTest extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
final int NUM_MESSAGES = 10; final int NUM_MESSAGES = 10;
@Override @Override
@ -129,7 +134,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
MessageProducer producer = session.createProducer(queue); MessageProducer producer = session.createProducer(queue);
for (int i = 0; i < NUM_MESSAGES; i++) { for (int i = 0; i < NUM_MESSAGES; i++) {
instanceLog.debug("Sending " + i); logger.debug("Sending " + i);
BytesMessage message = session.createBytesMessage(); BytesMessage message = session.createBytesMessage();
message.writeBytes(bytes); message.writeBytes(bytes);
@ -151,13 +156,13 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
byte[] bytesReceived = new byte[(int) size]; byte[] bytesReceived = new byte[(int) size];
m.readBytes(bytesReceived); m.readBytes(bytesReceived);
instanceLog.debug("Received " + ByteUtil.bytesToHex(bytesReceived, 1) + " count - " + m.getIntProperty("count")); logger.debug("Received " + ByteUtil.bytesToHex(bytesReceived, 1) + " count - " + m.getIntProperty("count"));
Assert.assertArrayEquals(bytes, bytesReceived); Assert.assertArrayEquals(bytes, bytesReceived);
} }
long taken = (System.currentTimeMillis() - time) / 1000; long taken = (System.currentTimeMillis() - time) / 1000;
instanceLog.debug("taken = " + taken); logger.debug("taken = " + taken);
} }
@Test(timeout = 60000) @Test(timeout = 60000)
@ -188,7 +193,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
MessageProducer producer = session.createProducer(queue); MessageProducer producer = session.createProducer(queue);
for (int i = 0; i < NUM_MESSAGES; i++) { for (int i = 0; i < NUM_MESSAGES; i++) {
instanceLog.debug("Sending " + i); logger.debug("Sending " + i);
Message message = session.createMessage(); Message message = session.createMessage();
message.setIntProperty("count", i); message.setIntProperty("count", i);
@ -205,7 +210,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
} }
long taken = (System.currentTimeMillis() - time) / 1000; long taken = (System.currentTimeMillis() - time) / 1000;
instanceLog.debug("taken = " + taken); logger.debug("taken = " + taken);
} }
@Test(timeout = 60000) @Test(timeout = 60000)
@ -231,7 +236,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
MessageProducer producer = session.createProducer(queue); MessageProducer producer = session.createProducer(queue);
for (int i = 0; i < NUM_MESSAGES; i++) { for (int i = 0; i < NUM_MESSAGES; i++) {
instanceLog.debug("Sending " + i); logger.debug("Sending " + i);
MapMessage message = session.createMapMessage(); MapMessage message = session.createMapMessage();
message.setInt("i", i); message.setInt("i", i);
@ -252,7 +257,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
} }
long taken = (System.currentTimeMillis() - time) / 1000; long taken = (System.currentTimeMillis() - time) / 1000;
instanceLog.debug("taken = " + taken); logger.debug("taken = " + taken);
} }
@Test(timeout = 60000) @Test(timeout = 60000)
@ -278,7 +283,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
MessageProducer producer = session.createProducer(queue); MessageProducer producer = session.createProducer(queue);
for (int i = 0; i < NUM_MESSAGES; i++) { for (int i = 0; i < NUM_MESSAGES; i++) {
instanceLog.debug("Sending " + i); logger.debug("Sending " + i);
TextMessage message = session.createTextMessage("text" + i); TextMessage message = session.createTextMessage("text" + i);
message.setStringProperty("text", "text" + i); message.setStringProperty("text", "text" + i);
producer.send(message); producer.send(message);
@ -295,7 +300,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
} }
long taken = (System.currentTimeMillis() - time) / 1000; long taken = (System.currentTimeMillis() - time) / 1000;
instanceLog.debug("taken = " + taken); logger.debug("taken = " + taken);
} }
@Test(timeout = 60000) @Test(timeout = 60000)
@ -403,7 +408,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
MessageProducer producer = session.createProducer(queue); MessageProducer producer = session.createProducer(queue);
for (int i = 0; i < NUM_MESSAGES; i++) { for (int i = 0; i < NUM_MESSAGES; i++) {
instanceLog.debug("Sending " + i); logger.debug("Sending " + i);
ObjectMessage message = session.createObjectMessage(new AnythingSerializable(i)); ObjectMessage message = session.createObjectMessage(new AnythingSerializable(i));
producer.send(message); producer.send(message);
} }
@ -421,7 +426,7 @@ public class JMSMessageTypesTest extends JMSClientTestSupport {
} }
long taken = (System.currentTimeMillis() - time) / 1000; long taken = (System.currentTimeMillis() - time) / 1000;
instanceLog.debug("taken = " + taken); logger.debug("taken = " + taken);
} }
@Test(timeout = 60000) @Test(timeout = 60000)

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.jms.Connection; import javax.jms.Connection;
@ -29,9 +30,13 @@ import javax.jms.TextMessage;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JMSTemporaryDestinationTest extends JMSClientTestSupport { public class JMSTemporaryDestinationTest extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 60000) @Test(timeout = 60000)
public void testCreateTemporaryQueue() throws Throwable { public void testCreateTemporaryQueue() throws Throwable {
Connection connection = createConnection(); Connection connection = createConnection();
@ -39,7 +44,7 @@ public class JMSTemporaryDestinationTest extends JMSClientTestSupport {
try { try {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
TemporaryQueue queue = session.createTemporaryQueue(); TemporaryQueue queue = session.createTemporaryQueue();
instanceLog.debug("queue:" + queue.getQueueName()); logger.debug("queue:" + queue.getQueueName());
MessageProducer producer = session.createProducer(queue); MessageProducer producer = session.createProducer(queue);
TextMessage message = session.createTextMessage(); TextMessage message = session.createTextMessage();
@ -92,7 +97,7 @@ public class JMSTemporaryDestinationTest extends JMSClientTestSupport {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
TemporaryTopic topic = session.createTemporaryTopic(); TemporaryTopic topic = session.createTemporaryTopic();
instanceLog.debug("topic:" + topic.getTopicName()); logger.debug("topic:" + topic.getTopicName());
MessageConsumer consumer = session.createConsumer(topic); MessageConsumer consumer = session.createConsumer(topic);
MessageProducer producer = session.createProducer(topic); MessageProducer producer = session.createProducer(topic);

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.amqp; package org.apache.activemq.artemis.tests.integration.amqp;
import java.lang.invoke.MethodHandles;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@ -31,16 +32,20 @@ import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JMSTransactionTest extends JMSClientTestSupport { public class JMSTransactionTest extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test(timeout = 60000) @Test(timeout = 60000)
public void testProduceMessageAndCommit() throws Throwable { public void testProduceMessageAndCommit() throws Throwable {
Connection connection = createConnection(); Connection connection = createConnection();
Session session = connection.createSession(true, Session.SESSION_TRANSACTED); Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
javax.jms.Queue queue = session.createQueue(getQueueName()); javax.jms.Queue queue = session.createQueue(getQueueName());
instanceLog.debug("queue:" + queue.getQueueName()); logger.debug("queue:" + queue.getQueueName());
MessageProducer p = session.createProducer(queue); MessageProducer p = session.createProducer(queue);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
TextMessage message = session.createTextMessage(); TextMessage message = session.createTextMessage();
@ -62,7 +67,7 @@ public class JMSTransactionTest extends JMSClientTestSupport {
Session session = connection.createSession(true, Session.SESSION_TRANSACTED); Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
javax.jms.Queue queue = session.createQueue(getQueueName()); javax.jms.Queue queue = session.createQueue(getQueueName());
instanceLog.debug("queue:" + queue.getQueueName()); logger.debug("queue:" + queue.getQueueName());
MessageProducer p = session.createProducer(queue); MessageProducer p = session.createProducer(queue);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
TextMessage message = session.createTextMessage(); TextMessage message = session.createTextMessage();
@ -106,7 +111,7 @@ public class JMSTransactionTest extends JMSClientTestSupport {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
javax.jms.Queue queue = session.createQueue(getQueueName()); javax.jms.Queue queue = session.createQueue(getQueueName());
instanceLog.debug("queue:" + queue.getQueueName()); logger.debug("queue:" + queue.getQueueName());
MessageProducer p = session.createProducer(queue); MessageProducer p = session.createProducer(queue);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
TextMessage message = session.createTextMessage(); TextMessage message = session.createTextMessage();

View File

@ -33,6 +33,8 @@ import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.ConnectionFactory; import javax.jms.ConnectionFactory;
@ -44,6 +46,7 @@ import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import java.lang.invoke.MethodHandles;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
@ -51,6 +54,8 @@ import java.util.Random;
//adapted from https://issues.apache.org/jira/browse/ARTEMIS-1416 //adapted from https://issues.apache.org/jira/browse/ARTEMIS-1416
public class QueueAutoCreationTest extends JMSClientTestSupport { public class QueueAutoCreationTest extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
Queue queue1; Queue queue1;
Random random = new Random(); Random random = new Random();
ActiveMQConnection testConn; ActiveMQConnection testConn;
@ -90,7 +95,7 @@ public class QueueAutoCreationTest extends JMSClientTestSupport {
Map.Entry<String, AddressSettings> entry = map.entrySet().iterator().next(); Map.Entry<String, AddressSettings> entry = map.entrySet().iterator().next();
AddressSettings settings = entry.getValue(); AddressSettings settings = entry.getValue();
settings.setAutoCreateQueues(true); settings.setAutoCreateQueues(true);
instanceLog.debug("server cofg, isauto? " + entry.getValue().isAutoCreateQueues()); logger.debug("server cofg, isauto? " + entry.getValue().isAutoCreateQueues());
} }
@ -118,7 +123,7 @@ public class QueueAutoCreationTest extends JMSClientTestSupport {
ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:5672"); ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:5672");
Connection connection = factory.createConnection(); Connection connection = factory.createConnection();
SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID();
instanceLog.debug("Address is " + addressName); logger.debug("Address is " + addressName);
clientSession.createAddress(addressName, RoutingType.ANYCAST, false); clientSession.createAddress(addressName, RoutingType.ANYCAST, false);
Topic topic = new ActiveMQTopic(addressName.toString()); Topic topic = new ActiveMQTopic(addressName.toString());
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -137,7 +142,7 @@ public class QueueAutoCreationTest extends JMSClientTestSupport {
ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:5672"); ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:5672");
Connection connection = factory.createConnection(); Connection connection = factory.createConnection();
SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID();
instanceLog.debug("Address is " + addressName); logger.debug("Address is " + addressName);
clientSession.createAddress(addressName, RoutingType.ANYCAST, false); clientSession.createAddress(addressName, RoutingType.ANYCAST, false);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -158,7 +163,7 @@ public class QueueAutoCreationTest extends JMSClientTestSupport {
ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:5672"); ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:5672");
Connection connection = factory.createConnection(); Connection connection = factory.createConnection();
SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID();
instanceLog.debug("Address is " + addressName); logger.debug("Address is " + addressName);
clientSession.createAddress(addressName, RoutingType.ANYCAST, false); clientSession.createAddress(addressName, RoutingType.ANYCAST, false);
Connection recConnection = factory.createConnection(); Connection recConnection = factory.createConnection();

View File

@ -30,6 +30,7 @@ import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
@ -43,11 +44,15 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.Wait;
import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.JmsConnectionFactory;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
public class TopicDurableTests extends JMSClientTestSupport { public class TopicDurableTests extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
protected void addConfiguration(ActiveMQServer server) { protected void addConfiguration(ActiveMQServer server) {
server.getConfiguration().setAddressQueueScanPeriod(100); server.getConfiguration().setAddressQueueScanPeriod(100);
@ -59,7 +64,7 @@ public class TopicDurableTests extends JMSClientTestSupport {
Connection connection = connectionFactory.createConnection(); Connection connection = connectionFactory.createConnection();
connection.start(); connection.start();
instanceLog.debug("testMessageDurableSubscription"); logger.debug("testMessageDurableSubscription");
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Topic testTopic = session.createTopic("jmsTopic"); Topic testTopic = session.createTopic("jmsTopic");
@ -73,39 +78,39 @@ public class TopicDurableTests extends JMSClientTestSupport {
String batchPrefix = "First"; String batchPrefix = "First";
List<Message> listMsgs = generateMessages(session, batchPrefix, count); List<Message> listMsgs = generateMessages(session, batchPrefix, count);
sendMessages(messageProducer, listMsgs); sendMessages(messageProducer, listMsgs);
instanceLog.debug("First batch messages sent"); logger.debug("First batch messages sent");
List<Message> recvd1 = receiveMessages(subscriber1, count); List<Message> recvd1 = receiveMessages(subscriber1, count);
List<Message> recvd2 = receiveMessages(subscriber2, count); List<Message> recvd2 = receiveMessages(subscriber2, count);
assertThat(recvd1.size(), is(count)); assertThat(recvd1.size(), is(count));
assertMessageContent(recvd1, batchPrefix); assertMessageContent(recvd1, batchPrefix);
instanceLog.debug(sub1ID + " :First batch messages received"); logger.debug(sub1ID + " :First batch messages received");
assertThat(recvd2.size(), is(count)); assertThat(recvd2.size(), is(count));
assertMessageContent(recvd2, batchPrefix); assertMessageContent(recvd2, batchPrefix);
instanceLog.debug(sub2ID + " :First batch messages received"); logger.debug(sub2ID + " :First batch messages received");
subscriber1.close(); subscriber1.close();
instanceLog.debug(sub1ID + " : closed"); logger.debug(sub1ID + " : closed");
batchPrefix = "Second"; batchPrefix = "Second";
listMsgs = generateMessages(session, batchPrefix, count); listMsgs = generateMessages(session, batchPrefix, count);
sendMessages(messageProducer, listMsgs); sendMessages(messageProducer, listMsgs);
instanceLog.debug("Second batch messages sent"); logger.debug("Second batch messages sent");
recvd2 = receiveMessages(subscriber2, count); recvd2 = receiveMessages(subscriber2, count);
assertThat(recvd2.size(), is(count)); assertThat(recvd2.size(), is(count));
assertMessageContent(recvd2, batchPrefix); assertMessageContent(recvd2, batchPrefix);
instanceLog.debug(sub2ID + " :Second batch messages received"); logger.debug(sub2ID + " :Second batch messages received");
subscriber1 = session.createDurableSubscriber(testTopic, sub1ID); subscriber1 = session.createDurableSubscriber(testTopic, sub1ID);
instanceLog.debug(sub1ID + " :connected"); logger.debug(sub1ID + " :connected");
recvd1 = receiveMessages(subscriber1, count); recvd1 = receiveMessages(subscriber1, count);
assertThat(recvd1.size(), is(count)); assertThat(recvd1.size(), is(count));
assertMessageContent(recvd1, batchPrefix); assertMessageContent(recvd1, batchPrefix);
instanceLog.debug(sub1ID + " :Second batch messages received"); logger.debug(sub1ID + " :Second batch messages received");
subscriber1.close(); subscriber1.close();
subscriber2.close(); subscriber2.close();
@ -119,7 +124,7 @@ public class TopicDurableTests extends JMSClientTestSupport {
public void testSharedNonDurableSubscription() throws Exception { public void testSharedNonDurableSubscription() throws Exception {
int iterations = 10; int iterations = 10;
for (int i = 0; i < iterations; i++) { for (int i = 0; i < iterations; i++) {
instanceLog.debug("testSharedNonDurableSubscription; iteration: " + i); logger.debug("testSharedNonDurableSubscription; iteration: " + i);
//SETUP-START //SETUP-START
JmsConnectionFactory connectionFactory1 = new JmsConnectionFactory(getBrokerQpidJMSConnectionURI()); JmsConnectionFactory connectionFactory1 = new JmsConnectionFactory(getBrokerQpidJMSConnectionURI());
Connection connection1 = connectionFactory1.createConnection(); Connection connection1 = connectionFactory1.createConnection();
@ -153,14 +158,14 @@ public class TopicDurableTests extends JMSClientTestSupport {
List<Message> listMsgs = generateMessages(session, count); List<Message> listMsgs = generateMessages(session, count);
List<CompletableFuture<List<Message>>> results = receiveMessagesAsync(count, subscriber1, subscriber2, subscriber3); List<CompletableFuture<List<Message>>> results = receiveMessagesAsync(count, subscriber1, subscriber2, subscriber3);
sendMessages(messageProducer, listMsgs); sendMessages(messageProducer, listMsgs);
instanceLog.debug("messages sent"); logger.debug("messages sent");
assertThat("Each message should be received only by one consumer", assertThat("Each message should be received only by one consumer",
results.get(0).get(20, TimeUnit.SECONDS).size() + results.get(0).get(20, TimeUnit.SECONDS).size() +
results.get(1).get(20, TimeUnit.SECONDS).size() + results.get(1).get(20, TimeUnit.SECONDS).size() +
results.get(2).get(20, TimeUnit.SECONDS).size(), results.get(2).get(20, TimeUnit.SECONDS).size(),
is(count)); is(count));
instanceLog.debug("messages received"); logger.debug("messages received");
//BODY-E //BODY-E
//TEAR-DOWN-S //TEAR-DOWN-S
@ -244,7 +249,7 @@ public class TopicDurableTests extends JMSClientTestSupport {
resultsList.add(new CompletableFuture<>()); resultsList.add(new CompletableFuture<>());
receivedResList.add(new ArrayList<>()); receivedResList.add(new ArrayList<>());
MessageListener myListener = message -> { MessageListener myListener = message -> {
instanceLog.debug("Mesages received" + message + " count: " + totalCount.get()); logger.debug("Mesages received" + message + " count: " + totalCount.get());
receivedResList.get(index).add(message); receivedResList.get(index).add(message);
if (totalCount.decrementAndGet() == 0) { if (totalCount.decrementAndGet() == 0) {
for (int j = 0; j < consumer.length; j++) { for (int j = 0; j < consumer.length; j++) {

View File

@ -79,8 +79,9 @@ import static org.apache.qpid.proton.engine.EndpointState.ACTIVE;
*/ */
public class ValidateAMQPErrorsTest extends AmqpClientTestSupport { public class ValidateAMQPErrorsTest extends AmqpClientTestSupport {
protected static final int AMQP_PORT_2 = 5673;
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected static final int AMQP_PORT_2 = 5673;
protected Vertx vertx; protected Vertx vertx;
protected MockServer mockServer; protected MockServer mockServer;
@ -638,7 +639,7 @@ public class ValidateAMQPErrorsTest extends AmqpClientTestSupport {
fail("Link should have been refused."); fail("Link should have been refused.");
} catch (Exception ex) { } catch (Exception ex) {
Assert.assertTrue(ex.getMessage().contains("AMQ119024")); Assert.assertTrue(ex.getMessage().contains("AMQ119024"));
instanceLog.debug("Caught expected exception"); logger.debug("Caught expected exception");
} }
connection.getStateInspector().assertValid(); connection.getStateInspector().assertValid();

View File

@ -22,6 +22,7 @@ import javax.jms.Destination;
import javax.jms.MessageConsumer; import javax.jms.MessageConsumer;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -40,9 +41,13 @@ import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.qpid.jms.JmsConnectionFactory; import org.apache.qpid.jms.JmsConnectionFactory;
import org.apache.qpid.jms.JmsTopic; import org.apache.qpid.jms.JmsTopic;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AmqpCoreTest extends JMSClientTestSupport { public class AmqpCoreTest extends JMSClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
protected String getConfiguredProtocols() { protected String getConfiguredProtocols() {
return "AMQP,OPENWIRE,CORE"; return "AMQP,OPENWIRE,CORE";
@ -154,13 +159,13 @@ public class AmqpCoreTest extends JMSClientTestSupport {
@Override @Override
public void onMessage(ClientMessage message) { public void onMessage(ClientMessage message) {
instanceLog.debug("received: " + message.getBodySize()); logger.debug("received: " + message.getBodySize());
if (message.getBodySize() == 0) { if (message.getBodySize() == 0) {
instanceLog.debug("xxx found zero len message!"); logger.debug("xxx found zero len message!");
zeroLen.set(true); zeroLen.set(true);
} }
instanceLog.debug("[receiver " + id + "] recieved: " + numMsg.incrementAndGet()); logger.debug("[receiver " + id + "] recieved: " + numMsg.incrementAndGet());
} }
public void assertMessagesReceived(int num) throws Exception { public void assertMessagesReceived(int num) throws Exception {

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.tests.integration.amqp.largemessages; package org.apache.activemq.artemis.tests.integration.amqp.largemessages;
import java.lang.invoke.MethodHandles;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -40,9 +41,13 @@ import org.apache.activemq.transport.amqp.client.AmqpSession;
import org.apache.qpid.proton.amqp.messaging.Data; import org.apache.qpid.proton.amqp.messaging.Data;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class InterruptedAMQPLargeMessage extends AmqpClientTestSupport { public class InterruptedAMQPLargeMessage extends AmqpClientTestSupport {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final int NUMBER_OF_THREADS = 10; private static final int NUMBER_OF_THREADS = 10;
private static final int MINIMAL_SEND = 2; private static final int MINIMAL_SEND = 2;
@ -129,7 +134,7 @@ public class InterruptedAMQPLargeMessage extends AmqpClientTestSupport {
} }
browserIterator.close(); browserIterator.close();
instanceLog.debug("There are " + serverQueue.getMessageCount() + " on the queue"); logger.debug("There are " + serverQueue.getMessageCount() + " on the queue");
int messageCount = (int)serverQueue.getMessageCount(); int messageCount = (int)serverQueue.getMessageCount();
AmqpClient client = createLocalClient(); AmqpClient client = createLocalClient();
@ -148,7 +153,7 @@ public class InterruptedAMQPLargeMessage extends AmqpClientTestSupport {
message.accept(true); message.accept(true);
received++; received++;
instanceLog.debug("Received " + received); logger.debug("Received " + received);
Data data = (Data)message.getWrappedMessage().getBody(); Data data = (Data)message.getWrappedMessage().getBody();
byte[] byteArray = data.getValue().getArray(); byte[] byteArray = data.getValue().getArray();

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cli;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.lang.invoke.MethodHandles;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.EnumSet; import java.util.EnumSet;
@ -42,9 +43,13 @@ import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.Wait;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AddressCommandTest extends JMSTestBase { public class AddressCommandTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
//the command //the command
private ByteArrayOutputStream output; private ByteArrayOutputStream output;
private ByteArrayOutputStream error; private ByteArrayOutputStream error;
@ -157,7 +162,7 @@ public class AddressCommandTest extends JMSTestBase {
ShowAddress showAddress = new ShowAddress(); ShowAddress showAddress = new ShowAddress();
showAddress.setName(address); showAddress.setName(address);
showAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); showAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
instanceLog.debug(output.toString()); logger.debug(output.toString());
} }
@Test @Test
@ -188,7 +193,7 @@ public class AddressCommandTest extends JMSTestBase {
showAddress.setName(address.toString()); showAddress.setName(address.toString());
showAddress.setBindings(true); showAddress.setBindings(true);
showAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error))); showAddress.execute(new ActionContext(System.in, new PrintStream(output), new PrintStream(error)));
instanceLog.debug(output.toString()); logger.debug(output.toString());
} }
@Test @Test
@ -238,13 +243,13 @@ public class AddressCommandTest extends JMSTestBase {
private void checkExecutionPassed(AbstractAction command) throws Exception { private void checkExecutionPassed(AbstractAction command) throws Exception {
String fullMessage = output.toString(); String fullMessage = output.toString();
instanceLog.debug("output: " + fullMessage); logger.debug("output: " + fullMessage);
assertTrue(fullMessage, fullMessage.contains("successfully")); assertTrue(fullMessage, fullMessage.contains("successfully"));
} }
private void checkExecutionFailure(AbstractAction command, String message) throws Exception { private void checkExecutionFailure(AbstractAction command, String message) throws Exception {
String fullMessage = error.toString(); String fullMessage = error.toString();
instanceLog.debug("error: " + fullMessage); logger.debug("error: " + fullMessage);
assertTrue(fullMessage, fullMessage.contains(message)); assertTrue(fullMessage, fullMessage.contains(message));
} }
} }

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.cli;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.PrintStream; import java.io.PrintStream;
import java.lang.invoke.MethodHandles;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -39,9 +40,13 @@ import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class QueueCommandTest extends JMSTestBase { public class QueueCommandTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
//the command //the command
private ByteArrayOutputStream output; private ByteArrayOutputStream output;
private ByteArrayOutputStream error; private ByteArrayOutputStream error;
@ -379,13 +384,13 @@ public class QueueCommandTest extends JMSTestBase {
private void checkExecutionPassed(AbstractAction command) throws Exception { private void checkExecutionPassed(AbstractAction command) throws Exception {
String fullMessage = output.toString(); String fullMessage = output.toString();
instanceLog.debug("output: " + fullMessage); logger.debug("output: " + fullMessage);
assertTrue(fullMessage, fullMessage.contains("successfully")); assertTrue(fullMessage, fullMessage.contains("successfully"));
} }
private void checkExecutionFailure(AbstractAction command, String message) throws Exception { private void checkExecutionFailure(AbstractAction command, String message) throws Exception {
String fullMessage = error.toString(); String fullMessage = error.toString();
instanceLog.debug("error: " + fullMessage); logger.debug("error: " + fullMessage);
assertTrue(fullMessage, fullMessage.contains(message)); assertTrue(fullMessage, fullMessage.contains(message));
} }
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -29,9 +31,13 @@ import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AckBatchSizeTest extends ActiveMQTestBase { public class AckBatchSizeTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public final SimpleString addressA = new SimpleString("addressA"); public final SimpleString addressA = new SimpleString("addressA");
public final SimpleString queueA = new SimpleString("queueA"); public final SimpleString queueA = new SimpleString("queueA");
@ -82,7 +88,7 @@ public class AckBatchSizeTest extends ActiveMQTestBase {
ClientConsumer consumer = session.createConsumer(queueA); ClientConsumer consumer = session.createConsumer(queueA);
session.start(); session.start();
for (int i = 0; i < numMessages - 1; i++) { for (int i = 0; i < numMessages - 1; i++) {
instanceLog.debug("Receive "); logger.debug("Receive ");
ClientMessage m = consumer.receive(5000); ClientMessage m = consumer.receive(5000);
Assert.assertEquals(0, m.getPropertyNames().size()); Assert.assertEquals(0, m.getPropertyNames().size());
Assert.assertEquals("expected to be " + originalSize, originalSize, m.getEncodeSize()); Assert.assertEquals("expected to be " + originalSize, originalSize, m.getEncodeSize());

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -47,9 +48,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.UUID; import org.apache.activemq.artemis.utils.UUID;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AcknowledgeTest extends ActiveMQTestBase { public class AcknowledgeTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public final SimpleString addressA = new SimpleString("addressA"); public final SimpleString addressA = new SimpleString("addressA");
public final SimpleString queueA = new SimpleString("queueA"); public final SimpleString queueA = new SimpleString("queueA");
@ -105,7 +110,7 @@ public class AcknowledgeTest extends ActiveMQTestBase {
} }
Thread.sleep(500); Thread.sleep(500);
instanceLog.debug("woke up"); logger.debug("woke up");
final CountDownLatch latch = new CountDownLatch(numMessages); final CountDownLatch latch = new CountDownLatch(numMessages);
session.start(); session.start();
@ -114,7 +119,7 @@ public class AcknowledgeTest extends ActiveMQTestBase {
@Override @Override
public void onMessage(final ClientMessage message) { public void onMessage(final ClientMessage message) {
instanceLog.debug("Got message " + c++); logger.debug("Got message " + c++);
latch.countDown(); latch.countDown();
} }
}); });

View File

@ -26,6 +26,7 @@ import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import java.lang.invoke.MethodHandles;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -56,12 +57,16 @@ import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.activemq.artemis.api.core.management.ResourceNames.ADDRESS; import static org.apache.activemq.artemis.api.core.management.ResourceNames.ADDRESS;
import static org.apache.activemq.artemis.api.core.management.ResourceNames.QUEUE; import static org.apache.activemq.artemis.api.core.management.ResourceNames.QUEUE;
public class AutoCreateJmsDestinationTest extends JMSTestBase { public class AutoCreateJmsDestinationTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final String QUEUE_NAME = "test"; public static final String QUEUE_NAME = "test";
ClientSessionFactory factory; ClientSessionFactory factory;
@ -378,7 +383,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase {
ConnectionFactory factory = new ActiveMQConnectionFactory(); ConnectionFactory factory = new ActiveMQConnectionFactory();
Connection connection = factory.createConnection(); Connection connection = factory.createConnection();
SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID();
instanceLog.debug("Address is " + addressName); logger.debug("Address is " + addressName);
clientSession.createAddress(addressName, RoutingType.ANYCAST, false); clientSession.createAddress(addressName, RoutingType.ANYCAST, false);
Topic topic = new ActiveMQTopic(addressName.toString()); Topic topic = new ActiveMQTopic(addressName.toString());
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -402,7 +407,7 @@ public class AutoCreateJmsDestinationTest extends JMSTestBase {
ConnectionFactory factory = new ActiveMQConnectionFactory(); ConnectionFactory factory = new ActiveMQConnectionFactory();
try (Connection connection = factory.createConnection()) { try (Connection connection = factory.createConnection()) {
SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID(); SimpleString addressName = UUIDGenerator.getInstance().generateSimpleStringUUID();
instanceLog.debug("Address is " + addressName); logger.debug("Address is " + addressName);
javax.jms.Queue queue = new ActiveMQQueue(addressName.toString()); javax.jms.Queue queue = new ActiveMQQueue(addressName.toString());
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(null); MessageProducer producer = session.createProducer(null);

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientConsumer;
import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientMessage;
@ -28,10 +30,12 @@ import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BlockingSendTest extends ActiveMQTestBase { public class BlockingSendTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test @Test
public void testSinglePersistentBlockingNonSync() throws Exception { public void testSinglePersistentBlockingNonSync() throws Exception {
@ -46,7 +50,7 @@ public class BlockingSendTest extends ActiveMQTestBase {
server.start(); server.start();
instanceLog.debug("sync = " + server.getConfiguration().isJournalSyncNonTransactional()); logger.debug("sync = " + server.getConfiguration().isJournalSyncNonTransactional());
locator = createInVMNonHALocator().setBlockOnDurableSend(true); locator = createInVMNonHALocator().setBlockOnDurableSend(true);
factory = createSessionFactory(locator); factory = createSessionFactory(locator);

View File

@ -35,7 +35,7 @@ import java.lang.invoke.MethodHandles;
public class ConsumerFilterTest extends ActiveMQTestBase { public class ConsumerFilterTest extends ActiveMQTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ActiveMQServer server; private ActiveMQServer server;
private ClientSession session; private ClientSession session;
@ -92,7 +92,7 @@ public class ConsumerFilterTest extends ActiveMQTestBase {
message.putStringProperty("animal", "giraffe"); message.putStringProperty("animal", "giraffe");
log.debug("sending second msg"); logger.debug("sending second msg");
producer.send(message); producer.send(message);
@ -245,7 +245,7 @@ public class ConsumerFilterTest extends ActiveMQTestBase {
readConsumer("anyConsumer", anyConsumer); readConsumer("anyConsumer", anyConsumer);
log.debug("### closing consumer ###"); logger.debug("### closing consumer ###");
anyConsumer.close(); anyConsumer.close();
@ -253,7 +253,7 @@ public class ConsumerFilterTest extends ActiveMQTestBase {
readConsumer("redConsumer", redConsumer); readConsumer("redConsumer", redConsumer);
log.debug("### recreating consumer ###"); logger.debug("### recreating consumer ###");
anyConsumer = session.createConsumer("foo"); anyConsumer = session.createConsumer("foo");
@ -275,7 +275,7 @@ public class ConsumerFilterTest extends ActiveMQTestBase {
private void readConsumer(String consumerName, ClientConsumer consumer) throws Exception { private void readConsumer(String consumerName, ClientConsumer consumer) throws Exception {
ClientMessage message = consumer.receive(5000); ClientMessage message = consumer.receive(5000);
assertNotNull(message); assertNotNull(message);
instanceLog.debug("consumer = " + consumerName + " message, color=" + message.getStringProperty("color") + ", msg = " + message.getStringProperty("value")); logger.debug("consumer = " + consumerName + " message, color=" + message.getStringProperty("color") + ", msg = " + message.getStringProperty("value"));
message.acknowledge(); message.acknowledge();
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -31,9 +33,13 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConsumerStuckTest extends ActiveMQTestBase { public class ConsumerStuckTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ActiveMQServer server; private ActiveMQServer server;
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
@ -85,7 +91,7 @@ public class ConsumerStuckTest extends ActiveMQTestBase {
try { try {
while (!Thread.interrupted()) { while (!Thread.interrupted()) {
ClientMessage received = consumer.receive(500); ClientMessage received = consumer.receive(500);
instanceLog.debug("Received " + received); logger.debug("Received " + received);
if (first) { if (first) {
first = false; first = false;
nettyConnection.getNettyChannel().config().setAutoRead(false); nettyConnection.getNettyChannel().config().setAutoRead(false);
@ -107,7 +113,7 @@ public class ConsumerStuckTest extends ActiveMQTestBase {
assertEquals(1, server.getSessions().size()); assertEquals(1, server.getSessions().size());
instanceLog.debug("sessions = " + server.getSessions().size()); logger.debug("sessions = " + server.getSessions().size());
assertEquals(1, server.getConnectionCount()); assertEquals(1, server.getConnectionCount());
@ -119,16 +125,16 @@ public class ConsumerStuckTest extends ActiveMQTestBase {
Thread.sleep(10); Thread.sleep(10);
} }
instanceLog.debug("Time = " + System.currentTimeMillis() + " time diff = " + (System.currentTimeMillis() - timeStart) + ", connections Size = " + server.getConnectionCount() + " sessions = " + server.getSessions().size()); logger.debug("Time = " + System.currentTimeMillis() + " time diff = " + (System.currentTimeMillis() - timeStart) + ", connections Size = " + server.getConnectionCount() + " sessions = " + server.getSessions().size());
if (server.getSessions().size() != 0) { if (server.getSessions().size() != 0) {
System.out.println(threadDump("Thread dump")); System.out.println(threadDump("Thread dump"));
fail("The cleanup wasn't able to finish cleaning the session. It's probably stuck, look at the thread dump generated by the test for more information"); fail("The cleanup wasn't able to finish cleaning the session. It's probably stuck, look at the thread dump generated by the test for more information");
} }
instanceLog.debug("Size = " + server.getConnectionCount()); logger.debug("Size = " + server.getConnectionCount());
instanceLog.debug("sessions = " + server.getSessions().size()); logger.debug("sessions = " + server.getSessions().size());
if (server.getSessions().size() != 0) { if (server.getSessions().size() != 0) {
System.out.println(threadDump("Thread dump")); System.out.println(threadDump("Thread dump"));
@ -168,7 +174,7 @@ public class ConsumerStuckTest extends ActiveMQTestBase {
try { try {
while (!Thread.interrupted()) { while (!Thread.interrupted()) {
ClientMessage received = consumer.receive(500); ClientMessage received = consumer.receive(500);
instanceLog.debug("Received " + received); logger.debug("Received " + received);
if (first) { if (first) {
first = false; first = false;
nettyConnection.getNettyChannel().config().setAutoRead(false); nettyConnection.getNettyChannel().config().setAutoRead(false);
@ -217,7 +223,7 @@ public class ConsumerStuckTest extends ActiveMQTestBase {
assertEquals(2, server.getSessions().size()); assertEquals(2, server.getSessions().size());
instanceLog.debug("sessions = " + server.getSessions().size()); logger.debug("sessions = " + server.getSessions().size());
assertEquals(2, server.getConnectionCount()); assertEquals(2, server.getConnectionCount());
@ -227,9 +233,9 @@ public class ConsumerStuckTest extends ActiveMQTestBase {
Thread.sleep(10); Thread.sleep(10);
} }
instanceLog.debug("Size = " + server.getConnectionCount()); logger.debug("Size = " + server.getConnectionCount());
instanceLog.debug("sessions = " + server.getSessions().size()); logger.debug("sessions = " + server.getSessions().size());
if (server.getSessions().size() != 1) { if (server.getSessions().size() != 1) {
System.out.println(threadDump("Thread dump")); System.out.println(threadDump("Thread dump"));

View File

@ -31,6 +31,7 @@ import javax.jms.Session;
import javax.jms.StreamMessage; import javax.jms.StreamMessage;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.io.Serializable; import java.io.Serializable;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
@ -78,10 +79,24 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(value = Parameterized.class) @RunWith(value = Parameterized.class)
public class ConsumerTest extends ActiveMQTestBase { public class ConsumerTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override
protected boolean waitForBindings(ActiveMQServer server,
String address,
boolean local,
int expectedBindingCount,
int expectedConsumerCount,
long timeout) throws Exception {
return super.waitForBindings(server, address, local, expectedBindingCount, expectedConsumerCount, timeout);
}
@Parameterized.Parameters(name = "isNetty={0}, persistent={1}") @Parameterized.Parameters(name = "isNetty={0}, persistent={1}")
public static Collection getParameters() { public static Collection getParameters() {
return Arrays.asList(new Object[][]{{true, true}, {false, false}, {false, true}, {true, false}}); return Arrays.asList(new Object[][]{{true, true}, {false, false}, {false, true}, {true, false}});
@ -194,13 +209,13 @@ public class ConsumerTest extends ActiveMQTestBase {
Assert.assertNotNull(message2); Assert.assertNotNull(message2);
instanceLog.debug("Id::" + message2.getMessageID()); logger.debug("Id::" + message2.getMessageID());
instanceLog.debug("Received " + message2); logger.debug("Received " + message2);
instanceLog.debug("Clie:" + ByteUtil.bytesToHex(message2.getBuffer().array(), 4)); logger.debug("Clie:" + ByteUtil.bytesToHex(message2.getBuffer().array(), 4));
instanceLog.debug("String::" + message2.getReadOnlyBodyBuffer().readString()); logger.debug("String::" + message2.getReadOnlyBodyBuffer().readString());
Assert.assertEquals("elo", message2.getStringProperty("hello")); Assert.assertEquals("elo", message2.getStringProperty("hello"));
@ -581,7 +596,7 @@ public class ConsumerTest extends ActiveMQTestBase {
} }
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
instanceLog.debug("Time = " + (end - time)); logger.debug("Time = " + (end - time));
{ {
TextMessage dummyMessage = session.createTextMessage(); TextMessage dummyMessage = session.createTextMessage();
@ -1014,7 +1029,7 @@ public class ConsumerTest extends ActiveMQTestBase {
} }
if (cons.receiveImmediate() != null) { if (cons.receiveImmediate() != null) {
instanceLog.debug("ERROR: Received an extra message"); logger.debug("ERROR: Received an extra message");
errors.incrementAndGet(); errors.incrementAndGet();
} }
sessionSend.close(); sessionSend.close();
@ -1251,11 +1266,11 @@ public class ConsumerTest extends ActiveMQTestBase {
final long messagesPerRun = (forks * messages); final long messagesPerRun = (forks * messages);
for (int r = 0; r < runs; r++) { for (int r = 0; r < runs; r++) {
onStartRun.await(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); onStartRun.await(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
instanceLog.debug("started run " + r); logger.debug("started run " + r);
final long start = System.currentTimeMillis(); final long start = System.currentTimeMillis();
onFinishRun.await(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); onFinishRun.await(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
final long elapsedMillis = System.currentTimeMillis() - start; final long elapsedMillis = System.currentTimeMillis() - start;
instanceLog.debug((messagesPerRun * 1000L) / elapsedMillis + " msg/sec"); logger.debug((messagesPerRun * 1000L) / elapsedMillis + " msg/sec");
} }
Stream.of(producersRunners).forEach(runner -> { Stream.of(producersRunners).forEach(runner -> {
try { try {

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.client;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -52,9 +53,13 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConsumerWindowSizeTest extends ActiveMQTestBase { public class ConsumerWindowSizeTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final SimpleString addressA = new SimpleString("addressA"); private final SimpleString addressA = new SimpleString("addressA");
private final SimpleString queueA = new SimpleString("queueA"); private final SimpleString queueA = new SimpleString("queueA");
@ -411,7 +416,7 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase {
ClientMessage msg = consumer.receiveImmediate(); ClientMessage msg = consumer.receiveImmediate();
if (msg == null) { if (msg == null) {
instanceLog.debug("Returning null"); logger.debug("Returning null");
break; break;
} }
msg.acknowledge(); msg.acknowledge();

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -32,9 +34,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.Wait; import org.apache.activemq.artemis.utils.Wait;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExpireTestOnRestartTest extends ActiveMQTestBase { public class ExpireTestOnRestartTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
ActiveMQServer server; ActiveMQServer server;
@Override @Override
@ -118,7 +124,7 @@ public class ExpireTestOnRestartTest extends ActiveMQTestBase {
int extras = 0; int extras = 0;
ClientMessage msg; ClientMessage msg;
while ((msg = cons.receiveImmediate()) != null) { while ((msg = cons.receiveImmediate()) != null) {
instanceLog.debug("{}", msg); logger.debug("{}", msg);
extras++; extras++;
} }

View File

@ -23,6 +23,7 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import java.io.File; import java.io.File;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
@ -42,12 +43,15 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.tests.util.CFUtil; import org.apache.activemq.artemis.tests.util.CFUtil;
import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* This test will send large messages in page-mode, DLQ then, expiry then, and they should be received fine * This test will send large messages in page-mode, DLQ then, expiry then, and they should be received fine
*/ */
public class ExpiryLargeMessageTest extends ActiveMQTestBase { public class ExpiryLargeMessageTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
final SimpleString EXPIRY = new SimpleString("my-expiry"); final SimpleString EXPIRY = new SimpleString("my-expiry");
@ -156,7 +160,7 @@ public class ExpiryLargeMessageTest extends ActiveMQTestBase {
assertNotNull(message); assertNotNull(message);
if (i % 10 == 0) { if (i % 10 == 0) {
instanceLog.debug("Received " + i); logger.debug("Received " + i);
} }
for (int location = 0; location < messageSize; location++) { for (int location = 0; location < messageSize; location++) {
@ -206,7 +210,7 @@ public class ExpiryLargeMessageTest extends ActiveMQTestBase {
assertNotNull(message); assertNotNull(message);
if (i % 10 == 0) { if (i % 10 == 0) {
instanceLog.debug("Received " + i); logger.debug("Received " + i);
} }
for (int location = 0; location < messageSize; location++) { for (int location = 0; location < messageSize; location++) {
@ -443,7 +447,7 @@ public class ExpiryLargeMessageTest extends ActiveMQTestBase {
assertNotNull(message); assertNotNull(message);
if (i % 10 == 0) { if (i % 10 == 0) {
instanceLog.debug("Received " + i); logger.debug("Received " + i);
} }
for (int location = 0; location < messageSize; location++) { for (int location = 0; location < messageSize; location++) {

View File

@ -206,7 +206,7 @@ public class FlowControlOnIgnoreLargeMessageBodyTest extends JMSTestBase {
Session session = null; Session session = null;
stopped = false; stopped = false;
requestForStop = false; requestForStop = false;
instanceLog.debug("Starting consumer for {} - {}", topic, getName()); log.debug("Starting consumer for {} - {}", topic, getName());
try { try {
connection = cf.createConnection(); connection = cf.createConnection();
@ -224,11 +224,11 @@ public class FlowControlOnIgnoreLargeMessageBodyTest extends JMSTestBase {
while (counter < numberOfMessages && !requestForStop && !error) { while (counter < numberOfMessages && !requestForStop && !error) {
if (counter == 0) { if (counter == 0) {
instanceLog.debug("Starting to consume for {} - {}", topic, getName()); log.debug("Starting to consume for {} - {}", topic, getName());
} }
BytesMessage msg = (BytesMessage) subscriber.receive(receiveTimeout); BytesMessage msg = (BytesMessage) subscriber.receive(receiveTimeout);
if (msg == null) { if (msg == null) {
instanceLog.debug("Cannot get message in specified timeout: {} - {}", topic, getName()); log.debug("Cannot get message in specified timeout: {} - {}", topic, getName());
error = true; error = true;
} else { } else {
counter++; counter++;
@ -246,7 +246,7 @@ public class FlowControlOnIgnoreLargeMessageBodyTest extends JMSTestBase {
} }
session.commit(); session.commit();
} catch (Exception e) { } catch (Exception e) {
instanceLog.debug("Exception in consumer {} : {}", getName(), e.getMessage()); log.debug("Exception in consumer {} : {}", getName(), e.getMessage());
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
if (session != null) { if (session != null) {
@ -265,7 +265,7 @@ public class FlowControlOnIgnoreLargeMessageBodyTest extends JMSTestBase {
} }
} }
stopped = true; stopped = true;
instanceLog.debug("Stopping consumer for {} - {}, received {}", topic, getName(), getReceivedMessages()); log.debug("Stopping consumer for {} - {}, received {}", topic, getName(), getReceivedMessages());
} }
public int getReceivedMessages() { public int getReceivedMessages() {

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException; import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.RoutingType;
@ -32,9 +34,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.CompositeAddress; import org.apache.activemq.artemis.utils.CompositeAddress;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FullQualifiedQueueTest extends ActiveMQTestBase { public class FullQualifiedQueueTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private SimpleString anycastAddress = new SimpleString("address.anycast"); private SimpleString anycastAddress = new SimpleString("address.anycast");
private SimpleString multicastAddress = new SimpleString("address.multicast"); private SimpleString multicastAddress = new SimpleString("address.multicast");
private SimpleString mixedAddress = new SimpleString("address.mixed"); private SimpleString mixedAddress = new SimpleString("address.mixed");
@ -91,31 +97,31 @@ public class FullQualifiedQueueTest extends ActiveMQTestBase {
//each anycast consumer receives one, each multicast receives three. //each anycast consumer receives one, each multicast receives three.
ClientMessage m = consumer1.receive(2000); ClientMessage m = consumer1.receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer1 : " + m); logger.debug("consumer1 : " + m);
m.acknowledge(); m.acknowledge();
m = consumer2.receive(2000); m = consumer2.receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer2 : " + m); logger.debug("consumer2 : " + m);
m.acknowledge(); m.acknowledge();
m = consumer3.receive(2000); m = consumer3.receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer3 : " + m); logger.debug("consumer3 : " + m);
m.acknowledge(); m.acknowledge();
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
m = consumer4.receive(2000); m = consumer4.receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer4 : " + m); logger.debug("consumer4 : " + m);
m.acknowledge(); m.acknowledge();
m = consumer5.receive(2000); m = consumer5.receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer5 : " + m); logger.debug("consumer5 : " + m);
m.acknowledge(); m.acknowledge();
m = consumer6.receive(2000); m = consumer6.receive(2000);
assertNotNull(m); assertNotNull(m);
instanceLog.debug("consumer6 : " + m); logger.debug("consumer6 : " + m);
m.acknowledge(); m.acknowledge();
} }

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import javax.management.MBeanServer; import javax.management.MBeanServer;
import java.lang.invoke.MethodHandles;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Map; import java.util.Map;
@ -78,6 +79,8 @@ import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* This test will simulate a consumer hanging on the delivery packet due to unbehaved clients * This test will simulate a consumer hanging on the delivery packet due to unbehaved clients
@ -86,6 +89,8 @@ import org.junit.Test;
*/ */
public class HangConsumerTest extends ActiveMQTestBase { public class HangConsumerTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ActiveMQServer server; private ActiveMQServer server;
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
@ -440,14 +445,14 @@ public class HangConsumerTest extends ActiveMQTestBase {
int bindings = 0; int bindings = 0;
for (RecordInfo info : infos) { for (RecordInfo info : infos) {
instanceLog.debug("info: " + info); logger.debug("info: " + info);
if (info.getUserRecordType() == JournalRecordIds.QUEUE_BINDING_RECORD) { if (info.getUserRecordType() == JournalRecordIds.QUEUE_BINDING_RECORD) {
bindings++; bindings++;
} }
} }
assertEquals(1, bindings); assertEquals(1, bindings);
instanceLog.debug("Bindings: " + bindings); logger.debug("Bindings: " + bindings);
messagesJournal.stop(); messagesJournal.stop();
if (i < 4) if (i < 4)
server.start(); server.start();
@ -614,7 +619,7 @@ public class HangConsumerTest extends ActiveMQTestBase {
@Override @Override
public boolean intercept(final Packet packet, final RemotingConnection connection) throws ActiveMQException { public boolean intercept(final Packet packet, final RemotingConnection connection) throws ActiveMQException {
if (packet instanceof SessionReceiveMessage) { if (packet instanceof SessionReceiveMessage) {
instanceLog.debug("Receiving message"); logger.debug("Receiving message");
try { try {
reusableLatch.countDown(); reusableLatch.countDown();
semaphore.acquire(); semaphore.acquire();

View File

@ -21,6 +21,8 @@ import javax.management.MBeanServerFactory;
import javax.transaction.xa.XAResource; import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid; import javax.transaction.xa.Xid;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientConsumer;
@ -40,9 +42,13 @@ import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HeuristicXATest extends ActiveMQTestBase { public class HeuristicXATest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
final SimpleString ADDRESS = new SimpleString("ADDRESS"); final SimpleString ADDRESS = new SimpleString("ADDRESS");
final String body = "this is the body"; final String body = "this is the body";
@ -111,7 +117,7 @@ public class HeuristicXATest extends ActiveMQTestBase {
Assert.assertEquals(1, preparedTransactions.length); Assert.assertEquals(1, preparedTransactions.length);
instanceLog.debug(preparedTransactions[0]); logger.debug(preparedTransactions[0]);
Assert.assertEquals(0, jmxServer.listHeuristicCommittedTransactions().length); Assert.assertEquals(0, jmxServer.listHeuristicCommittedTransactions().length);
Assert.assertEquals(0, jmxServer.listHeuristicRolledBackTransactions().length); Assert.assertEquals(0, jmxServer.listHeuristicRolledBackTransactions().length);
@ -183,7 +189,7 @@ public class HeuristicXATest extends ActiveMQTestBase {
String[] preparedTransactions = jmxServer.listPreparedTransactions(); String[] preparedTransactions = jmxServer.listPreparedTransactions();
Assert.assertEquals(1, preparedTransactions.length); Assert.assertEquals(1, preparedTransactions.length);
instanceLog.debug(preparedTransactions[0]); logger.debug(preparedTransactions[0]);
if (isCommit) { if (isCommit) {
jmxServer.commitPreparedTransaction(XidImpl.toBase64String(xid)); jmxServer.commitPreparedTransaction(XidImpl.toBase64String(xid));
@ -208,11 +214,11 @@ public class HeuristicXATest extends ActiveMQTestBase {
if (isCommit) { if (isCommit) {
String[] listHeuristicCommittedTransactions = jmxServer.listHeuristicCommittedTransactions(); String[] listHeuristicCommittedTransactions = jmxServer.listHeuristicCommittedTransactions();
Assert.assertEquals(1, listHeuristicCommittedTransactions.length); Assert.assertEquals(1, listHeuristicCommittedTransactions.length);
instanceLog.debug(listHeuristicCommittedTransactions[0]); logger.debug(listHeuristicCommittedTransactions[0]);
} else { } else {
String[] listHeuristicRolledBackTransactions = jmxServer.listHeuristicRolledBackTransactions(); String[] listHeuristicRolledBackTransactions = jmxServer.listHeuristicRolledBackTransactions();
Assert.assertEquals(1, listHeuristicRolledBackTransactions.length); Assert.assertEquals(1, listHeuristicRolledBackTransactions.length);
instanceLog.debug(listHeuristicRolledBackTransactions[0]); logger.debug(listHeuristicRolledBackTransactions[0]);
} }
} }
@ -261,7 +267,7 @@ public class HeuristicXATest extends ActiveMQTestBase {
String[] preparedTransactions = jmxServer.listPreparedTransactions(); String[] preparedTransactions = jmxServer.listPreparedTransactions();
Assert.assertEquals(1, preparedTransactions.length); Assert.assertEquals(1, preparedTransactions.length);
instanceLog.debug(preparedTransactions[0]); logger.debug(preparedTransactions[0]);
if (heuristicCommit) { if (heuristicCommit) {
jmxServer.commitPreparedTransaction(XidImpl.toBase64String(xid)); jmxServer.commitPreparedTransaction(XidImpl.toBase64String(xid));
@ -287,11 +293,11 @@ public class HeuristicXATest extends ActiveMQTestBase {
if (heuristicCommit) { if (heuristicCommit) {
String[] listHeuristicCommittedTransactions = jmxServer.listHeuristicCommittedTransactions(); String[] listHeuristicCommittedTransactions = jmxServer.listHeuristicCommittedTransactions();
Assert.assertEquals(1, listHeuristicCommittedTransactions.length); Assert.assertEquals(1, listHeuristicCommittedTransactions.length);
instanceLog.debug(listHeuristicCommittedTransactions[0]); logger.debug(listHeuristicCommittedTransactions[0]);
} else { } else {
String[] listHeuristicRolledBackTransactions = jmxServer.listHeuristicRolledBackTransactions(); String[] listHeuristicRolledBackTransactions = jmxServer.listHeuristicRolledBackTransactions();
Assert.assertEquals(1, listHeuristicRolledBackTransactions.length); Assert.assertEquals(1, listHeuristicRolledBackTransactions.length);
instanceLog.debug(listHeuristicRolledBackTransactions[0]); logger.debug(listHeuristicRolledBackTransactions[0]);
} }
session = sf.createSession(true, false, false); session = sf.createSession(true, false, false);
@ -362,7 +368,7 @@ public class HeuristicXATest extends ActiveMQTestBase {
String[] preparedTransactions = jmxServer.listPreparedTransactions(); String[] preparedTransactions = jmxServer.listPreparedTransactions();
Assert.assertEquals(1, preparedTransactions.length); Assert.assertEquals(1, preparedTransactions.length);
instanceLog.debug(preparedTransactions[0]); logger.debug(preparedTransactions[0]);
if (heuristicCommit) { if (heuristicCommit) {
jmxServer.commitPreparedTransaction(XidImpl.toBase64String(xid)); jmxServer.commitPreparedTransaction(XidImpl.toBase64String(xid));

View File

@ -76,10 +76,10 @@ import java.lang.invoke.MethodHandles;
public class InterruptedLargeMessageTest extends LargeMessageTestBase { public class InterruptedLargeMessageTest extends LargeMessageTestBase {
static final int RECEIVE_WAIT_TIME = 60000;
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
static final int RECEIVE_WAIT_TIME = 60000;
private final int LARGE_MESSAGE_SIZE = ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE * 3; private final int LARGE_MESSAGE_SIZE = ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE * 3;
protected ServerLocator locator; protected ServerLocator locator;
@ -181,7 +181,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
@Override @Override
public void run() { public void run() {
try { try {
instanceLog.debug("Receiving message"); log.debug("Receiving message");
ClientMessage msg = cons.receive(5000); ClientMessage msg = cons.receive(5000);
if (msg == null) { if (msg == null) {
System.err.println("Message not received"); System.err.println("Message not received");
@ -235,7 +235,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
@Override @Override
public void run() { public void run() {
try { try {
instanceLog.debug("Receiving message"); log.debug("Receiving message");
javax.jms.Message msg = consumer.receive(5000); javax.jms.Message msg = consumer.receive(5000);
if (msg == null) { if (msg == null) {
System.err.println("Message not received"); System.err.println("Message not received");
@ -243,10 +243,10 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
return; return;
} }
} catch (JMSException e) { } catch (JMSException e) {
instanceLog.debug("This exception was ok as it was expected", e); log.debug("This exception was ok as it was expected", e);
expectedErrors.incrementAndGet(); expectedErrors.incrementAndGet();
} catch (Throwable e) { } catch (Throwable e) {
instanceLog.warn("Captured unexpected exception", e); log.warn("Captured unexpected exception", e);
unexpectedErrors.incrementAndGet(); unexpectedErrors.incrementAndGet();
} }
} }
@ -452,7 +452,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
server.start(); server.start();
for (int start = 0; start < 2; start++) { for (int start = 0; start < 2; start++) {
instanceLog.debug("Start " + start); log.debug("Start " + start);
sf = createSessionFactory(locator); sf = createSessionFactory(locator);
@ -466,7 +466,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
ClientConsumer cons1 = session.createConsumer(ADDRESS); ClientConsumer cons1 = session.createConsumer(ADDRESS);
session.start(); session.start();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
instanceLog.info("I = " + i); log.info("I = " + i);
ClientMessage msg = cons1.receive(5000); ClientMessage msg = cons1.receive(5000);
Assert.assertNotNull(msg); Assert.assertNotNull(msg);
Assert.assertEquals(1, msg.getIntProperty("txid").intValue()); Assert.assertEquals(1, msg.getIntProperty("txid").intValue());
@ -531,7 +531,7 @@ public class InterruptedLargeMessageTest extends LargeMessageTestBase {
@Override @Override
public void postAcknowledge(final MessageReference ref, AckReason reason) { public void postAcknowledge(final MessageReference ref, AckReason reason) {
instanceLog.debug("Ignoring postACK on message " + ref); log.debug("Ignoring postACK on message " + ref);
} }
@Override @Override

View File

@ -23,13 +23,19 @@ import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.api.core.management.QueueControl;
import org.apache.activemq.artemis.api.core.management.ResourceNames; import org.apache.activemq.artemis.api.core.management.ResourceNames;
import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JMSMessageCounterTest extends JMSTestBase { public class JMSMessageCounterTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
protected boolean usePersistence() { protected boolean usePersistence() {
return true; return true;
@ -57,7 +63,7 @@ public class JMSMessageCounterTest extends JMSTestBase {
QueueControl control = (QueueControl) server.getManagementService().getResource(ResourceNames.QUEUE + queue.getQueueName()); QueueControl control = (QueueControl) server.getManagementService().getResource(ResourceNames.QUEUE + queue.getQueueName());
assertNotNull(control); assertNotNull(control);
instanceLog.debug(control.listMessageCounterAsHTML()); logger.debug(control.listMessageCounterAsHTML());
jmsServer.stop(); jmsServer.stop();
@ -66,7 +72,7 @@ public class JMSMessageCounterTest extends JMSTestBase {
control = (QueueControl) server.getManagementService().getResource(ResourceNames.QUEUE + queue.getQueueName()); control = (QueueControl) server.getManagementService().getResource(ResourceNames.QUEUE + queue.getQueueName());
assertNotNull(control); assertNotNull(control);
instanceLog.debug(control.listMessageCounterAsHTML()); logger.debug(control.listMessageCounterAsHTML());
} }
} }

View File

@ -24,6 +24,8 @@ import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.Topic; import javax.jms.Topic;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.paging.PagingStore; import org.apache.activemq.artemis.core.paging.PagingStore;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
@ -31,12 +33,16 @@ import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.apache.activemq.artemis.tests.util.Wait; import org.apache.activemq.artemis.tests.util.Wait;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* This will perform cleanup tests on paging while using JMS topics * This will perform cleanup tests on paging while using JMS topics
*/ */
public class JMSPagingFileDeleteTest extends JMSTestBase { public class JMSPagingFileDeleteTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
Topic topic1; Topic topic1;
Connection connection; Connection connection;
@ -97,13 +103,13 @@ public class JMSPagingFileDeleteTest extends JMSTestBase {
subscriber1 = session.createConsumer(topic1); subscriber1 = session.createConsumer(topic1);
// -----------------(Step1) Publish Messages to make Paging Files. -------------------- // -----------------(Step1) Publish Messages to make Paging Files. --------------------
instanceLog.debug("---------- Send messages. ----------"); logger.debug("---------- Send messages. ----------");
BytesMessage bytesMessage = session.createBytesMessage(); BytesMessage bytesMessage = session.createBytesMessage();
bytesMessage.writeBytes(new byte[JMSPagingFileDeleteTest.MESSAGE_SIZE]); bytesMessage.writeBytes(new byte[JMSPagingFileDeleteTest.MESSAGE_SIZE]);
for (int i = 0; i < JMSPagingFileDeleteTest.MESSAGE_NUM; i++) { for (int i = 0; i < JMSPagingFileDeleteTest.MESSAGE_NUM; i++) {
producer.send(bytesMessage); producer.send(bytesMessage);
} }
instanceLog.debug("Sent " + JMSPagingFileDeleteTest.MESSAGE_NUM + " messages."); logger.debug("Sent " + JMSPagingFileDeleteTest.MESSAGE_NUM + " messages.");
pagingStore = server.getPagingManager().getPageStore(new SimpleString("topic1")); pagingStore = server.getPagingManager().getPageStore(new SimpleString("topic1"));
printPageStoreInfo(pagingStore); printPageStoreInfo(pagingStore);
@ -145,13 +151,13 @@ public class JMSPagingFileDeleteTest extends JMSTestBase {
subscriber2 = session.createDurableSubscriber(topic1, "subscriber-2"); subscriber2 = session.createDurableSubscriber(topic1, "subscriber-2");
// -----------------(Step1) Publish Messages to make Paging Files. -------------------- // -----------------(Step1) Publish Messages to make Paging Files. --------------------
instanceLog.debug("---------- Send messages. ----------"); logger.debug("---------- Send messages. ----------");
BytesMessage bytesMessage = session.createBytesMessage(); BytesMessage bytesMessage = session.createBytesMessage();
bytesMessage.writeBytes(new byte[JMSPagingFileDeleteTest.MESSAGE_SIZE]); bytesMessage.writeBytes(new byte[JMSPagingFileDeleteTest.MESSAGE_SIZE]);
for (int i = 0; i < JMSPagingFileDeleteTest.MESSAGE_NUM; i++) { for (int i = 0; i < JMSPagingFileDeleteTest.MESSAGE_NUM; i++) {
producer.send(bytesMessage); producer.send(bytesMessage);
} }
instanceLog.debug("Sent " + JMSPagingFileDeleteTest.MESSAGE_NUM + " messages."); logger.debug("Sent " + JMSPagingFileDeleteTest.MESSAGE_NUM + " messages.");
pagingStore = server.getPagingManager().getPageStore(new SimpleString("topic1")); pagingStore = server.getPagingManager().getPageStore(new SimpleString("topic1"));
printPageStoreInfo(pagingStore); printPageStoreInfo(pagingStore);
@ -164,7 +170,7 @@ public class JMSPagingFileDeleteTest extends JMSTestBase {
stopAndStartServer(); // If try this test without restarting server, please comment out this line; stopAndStartServer(); // If try this test without restarting server, please comment out this line;
// -----------------(Step3) Subscribe to all the messages from the topic.-------------- // -----------------(Step3) Subscribe to all the messages from the topic.--------------
instanceLog.debug("---------- Receive all messages. ----------"); logger.debug("---------- Receive all messages. ----------");
for (int i = 0; i < JMSPagingFileDeleteTest.MESSAGE_NUM; i++) { for (int i = 0; i < JMSPagingFileDeleteTest.MESSAGE_NUM; i++) {
Message message1 = subscriber1.receive(JMSPagingFileDeleteTest.RECEIVE_TIMEOUT); Message message1 = subscriber1.receive(JMSPagingFileDeleteTest.RECEIVE_TIMEOUT);
assertNotNull(message1); assertNotNull(message1);
@ -205,7 +211,7 @@ public class JMSPagingFileDeleteTest extends JMSTestBase {
} }
private void stopAndStartServer() throws Exception { private void stopAndStartServer() throws Exception {
instanceLog.debug("---------- Restart server. ----------"); logger.debug("---------- Restart server. ----------");
connection.close(); connection.close();
jmsServer.stop(); jmsServer.stop();
@ -228,11 +234,11 @@ public class JMSPagingFileDeleteTest extends JMSTestBase {
} }
private void printPageStoreInfo(PagingStore pagingStore) throws Exception { private void printPageStoreInfo(PagingStore pagingStore) throws Exception {
instanceLog.debug("---------- Paging Store Info ----------"); logger.debug("---------- Paging Store Info ----------");
instanceLog.debug(" CurrentPage = " + pagingStore.getCurrentPage()); logger.debug(" CurrentPage = " + pagingStore.getCurrentPage());
instanceLog.debug(" FirstPage = " + pagingStore.getFirstPage()); logger.debug(" FirstPage = " + pagingStore.getFirstPage());
instanceLog.debug(" Number of Pages = " + pagingStore.getNumberOfPages()); logger.debug(" Number of Pages = " + pagingStore.getNumberOfPages());
instanceLog.debug(" Address Size = " + pagingStore.getAddressSize()); logger.debug(" Address Size = " + pagingStore.getAddressSize());
instanceLog.debug(" Is Paging = " + pagingStore.isPaging()); logger.debug(" Is Paging = " + pagingStore.isPaging());
} }
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import java.util.HashMap; import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -33,6 +34,8 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Multiple Threads producing Messages, with Multiple Consumers with different queues, each queue with a different filter * Multiple Threads producing Messages, with Multiple Consumers with different queues, each queue with a different filter
@ -40,6 +43,7 @@ import org.junit.Test;
*/ */
public class MultipleThreadFilterOneTest extends ActiveMQTestBase { public class MultipleThreadFilterOneTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
final String ADDRESS = "ADDRESS"; final String ADDRESS = "ADDRESS";
@ -148,7 +152,7 @@ public class MultipleThreadFilterOneTest extends ActiveMQTestBase {
msg.acknowledge(); msg.acknowledge();
if (i % 500 == 0) { if (i % 500 == 0) {
instanceLog.debug("Consumed " + i); logger.debug("Consumed " + i);
consumerSession.commit(); consumerSession.commit();
} }
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -46,9 +47,13 @@ import org.apache.activemq.artemis.utils.RandomUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ProducerFlowControlTest extends ActiveMQTestBase { public class ProducerFlowControlTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ServerLocator locator; private ServerLocator locator;
private ClientSessionFactory sf; private ClientSessionFactory sf;
@ -244,7 +249,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase {
} }
} catch (Exception e) { } catch (Exception e) {
instanceLog.error("Failed to handle message", e); logger.error("Failed to handle message", e);
exception = e; exception = e;
@ -300,7 +305,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase {
double rate = 1000 * (double) numMessages / (end - start); double rate = 1000 * (double) numMessages / (end - start);
instanceLog.debug("rate is " + rate + " msgs / sec"); logger.debug("rate is " + rate + " msgs / sec");
} }
@Test @Test

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -39,9 +40,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ProducerTest extends ActiveMQTestBase { public class ProducerTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ActiveMQServer server; private ActiveMQServer server;
private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue"); private final SimpleString QUEUE = new SimpleString("ConsumerTestQueue");
@ -94,7 +99,7 @@ public class ProducerTest extends ActiveMQTestBase {
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
instanceLog.debug("Try " + i); logger.debug("Try " + i);
ClientSessionFactory cf = locator.createSessionFactory(); ClientSessionFactory cf = locator.createSessionFactory();
final ClientSession session = cf.createSession(false, true, true); final ClientSession session = cf.createSession(false, true, true);

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.client; package org.apache.activemq.artemis.tests.integration.client;
import java.lang.invoke.MethodHandles;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -40,9 +41,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RedeliveryConsumerTest extends ActiveMQTestBase { public class RedeliveryConsumerTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
ActiveMQServer server; ActiveMQServer server;
@ -164,7 +168,7 @@ public class RedeliveryConsumerTest extends ActiveMQTestBase {
setUp(strictUpdate); setUp(strictUpdate);
ClientSession session = factory.createSession(false, false, false); ClientSession session = factory.createSession(false, false, false);
instanceLog.debug("created"); logger.debug("created");
ClientProducer prod = session.createProducer(ADDRESS); ClientProducer prod = session.createProducer(ADDRESS);
prod.send(createTextMessage(session, "Hello")); prod.send(createTextMessage(session, "Hello"));
@ -216,7 +220,7 @@ public class RedeliveryConsumerTest extends ActiveMQTestBase {
setUp(strict); setUp(strict);
ClientSession session = factory.createSession(false, false, false); ClientSession session = factory.createSession(false, false, false);
instanceLog.debug("created"); logger.debug("created");
ClientProducer prod = session.createProducer(ADDRESS); ClientProducer prod = session.createProducer(ADDRESS);
prod.send(createTextMessage(session, "Hello")); prod.send(createTextMessage(session, "Hello"));

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.client;
import javax.transaction.xa.Xid; import javax.transaction.xa.Xid;
import java.io.File; import java.io.File;
import java.lang.invoke.MethodHandles;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.HashSet; import java.util.HashSet;
@ -93,9 +94,13 @@ import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SendAckFailTest extends SpawnedTestBase { public class SendAckFailTest extends SpawnedTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Before @Before
@After @After
public void deleteDirectory() throws Exception { public void deleteDirectory() throws Exception {
@ -191,14 +196,14 @@ public class SendAckFailTest extends SpawnedTestBase {
ClientMessage message = consumer.receive(1000); ClientMessage message = consumer.receive(1000);
if (message == null) { if (message == null) {
for (Integer msgi : listSent) { for (Integer msgi : listSent) {
instanceLog.debug("Message " + msgi + " was lost"); logger.debug("Message " + msgi + " was lost");
} }
fail("missed messages!"); fail("missed messages!");
} }
message.acknowledge(); message.acknowledge();
if (!listSent.remove(message.getIntProperty("myid"))) { if (!listSent.remove(message.getIntProperty("myid"))) {
instanceLog.debug("Message " + message + " with id " + message.getIntProperty("myid") + " received in duplicate"); logger.debug("Message " + message + " with id " + message.getIntProperty("myid") + " received in duplicate");
fail("Message " + message + " with id " + message.getIntProperty("myid") + " received in duplicate"); fail("Message " + message + " with id " + message.getIntProperty("myid") + " received in duplicate");
} }
} }
@ -271,7 +276,7 @@ public class SendAckFailTest extends SpawnedTestBase {
instanceLog.debug("Location::" + server.getConfiguration().getJournalLocation().getAbsolutePath()); logger.debug("Location::" + server.getConfiguration().getJournalLocation().getAbsolutePath());
addServer(server); addServer(server);
server.start(); server.start();
return server; return server;

View File

@ -1497,7 +1497,7 @@ public class BridgeTest extends ActiveMQTestBase {
msgCount.incrementAndGet(); msgCount.incrementAndGet();
if (i % 500 == 0) if (i % 500 == 0)
instanceLog.debug("received {}", i); log.debug("received {}", i);
} }
boolean failed = false; boolean failed = false;
@ -1815,7 +1815,7 @@ public class BridgeTest extends ActiveMQTestBase {
File outputFile = new File(getTemporaryDir(), "huge_message_received.dat"); File outputFile = new File(getTemporaryDir(), "huge_message_received.dat");
instanceLog.debug("-----message save to: {}", outputFile.getAbsolutePath()); log.debug("-----message save to: {}", outputFile.getAbsolutePath());
FileOutputStream fileOutputStream = new FileOutputStream(outputFile); FileOutputStream fileOutputStream = new FileOutputStream(outputFile);
BufferedOutputStream bufferedOutput = new BufferedOutputStream(fileOutputStream); BufferedOutputStream bufferedOutput = new BufferedOutputStream(fileOutputStream);
@ -1860,7 +1860,7 @@ public class BridgeTest extends ActiveMQTestBase {
createFile(fileInput, largeMessageSize); createFile(fileInput, largeMessageSize);
instanceLog.debug("File created at: {}", fileInput.getAbsolutePath()); log.debug("File created at: {}", fileInput.getAbsolutePath());
ClientMessage message = session.createMessage(Message.BYTES_TYPE, true); ClientMessage message = session.createMessage(Message.BYTES_TYPE, true);

View File

@ -23,6 +23,7 @@ import javax.jms.Message;
import javax.jms.MessageConsumer; import javax.jms.MessageConsumer;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -55,9 +56,14 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(value = Parameterized.class) @RunWith(value = Parameterized.class)
public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase { public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final int NUMBER_OF_SERVERS = 2; private static final int NUMBER_OF_SERVERS = 2;
private static final SimpleString queueName = SimpleString.toSimpleString("queues.0"); private static final SimpleString queueName = SimpleString.toSimpleString("queues.0");
@ -303,7 +309,7 @@ public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase {
startServers(MessageLoadBalancingType.STRICT); startServers(MessageLoadBalancingType.STRICT);
instanceLog.debug("connections " + servers[1].getRemotingService().getConnections().size()); logger.debug("connections " + servers[1].getRemotingService().getConnections().size());
Wait.assertEquals(3, () -> servers[1].getRemotingService().getConnections().size()); Wait.assertEquals(3, () -> servers[1].getRemotingService().getConnections().size());
Wait.assertEquals(3, () -> servers[0].getRemotingService().getConnections().size()); Wait.assertEquals(3, () -> servers[0].getRemotingService().getConnections().size());
@ -360,7 +366,7 @@ public class ProtocolsMessageLoadBalancingTest extends ClusterTestBase {
waitForBindings(0, "queues.0", 1, 1, false); waitForBindings(0, "queues.0", 1, 1, false);
waitForBindings(1, "queues.0", 1, 1, false); waitForBindings(1, "queues.0", 1, 1, false);
instanceLog.debug("connections " + servers[1].getRemotingService().getConnections().size()); logger.debug("connections " + servers[1].getRemotingService().getConnections().size());
// sending Messages.. they should be load balanced // sending Messages.. they should be load balanced
{ {

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.distribution; package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import java.lang.invoke.MethodHandles;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -25,9 +26,13 @@ import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImp
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OneWayChainClusterTest extends ClusterTestBase { public class OneWayChainClusterTest extends ClusterTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
@ -295,23 +300,23 @@ public class OneWayChainClusterTest extends ClusterTestBase {
verifyReceiveRoundRobin(10, 0, 1); verifyReceiveRoundRobin(10, 0, 1);
verifyNotReceive(0, 1); verifyNotReceive(0, 1);
instanceLog.debug("============================================ before restart"); logger.debug("============================================ before restart");
instanceLog.debug(clusterDescription(servers[0])); logger.debug(clusterDescription(servers[0]));
instanceLog.debug(clusterDescription(servers[1])); logger.debug(clusterDescription(servers[1]));
instanceLog.debug(clusterDescription(servers[2])); logger.debug(clusterDescription(servers[2]));
instanceLog.debug(clusterDescription(servers[3])); logger.debug(clusterDescription(servers[3]));
instanceLog.debug(clusterDescription(servers[4])); logger.debug(clusterDescription(servers[4]));
stopServers(2); stopServers(2);
waitForTopology(servers[1], 4); waitForTopology(servers[1], 4);
Thread.sleep(1000); Thread.sleep(1000);
instanceLog.debug("============================================ after stop"); logger.debug("============================================ after stop");
instanceLog.debug(clusterDescription(servers[0])); logger.debug(clusterDescription(servers[0]));
instanceLog.debug(clusterDescription(servers[1])); logger.debug(clusterDescription(servers[1]));
instanceLog.debug(clusterDescription(servers[3])); logger.debug(clusterDescription(servers[3]));
instanceLog.debug(clusterDescription(servers[4])); logger.debug(clusterDescription(servers[4]));
startServers(2); startServers(2);
@ -319,12 +324,12 @@ public class OneWayChainClusterTest extends ClusterTestBase {
waitForTopology(servers[1], 5); waitForTopology(servers[1], 5);
instanceLog.debug("============================================ after start"); logger.debug("============================================ after start");
instanceLog.debug(clusterDescription(servers[0])); logger.debug(clusterDescription(servers[0]));
instanceLog.debug(clusterDescription(servers[1])); logger.debug(clusterDescription(servers[1]));
instanceLog.debug(clusterDescription(servers[2])); logger.debug(clusterDescription(servers[2]));
instanceLog.debug(clusterDescription(servers[3])); logger.debug(clusterDescription(servers[3]));
instanceLog.debug(clusterDescription(servers[4])); logger.debug(clusterDescription(servers[4]));
send(0, "queues.testaddress", 10, false, null); send(0, "queues.testaddress", 10, false, null);

View File

@ -36,7 +36,7 @@ import java.util.Map;
public class TwoWayTwoNodeClusterTest extends ClusterTestBase { public class TwoWayTwoNodeClusterTest extends ClusterTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
@Before @Before
@ -237,13 +237,13 @@ public class TwoWayTwoNodeClusterTest extends ClusterTestBase {
waitForTopology(servers[1], 2); waitForTopology(servers[1], 2);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
log.debug("Sleep #test {}", i); logger.debug("Sleep #test {}", i);
log.debug("#stop #test #{}", i); logger.debug("#stop #test #{}", i);
Thread.sleep(500); Thread.sleep(500);
stopServers(1); stopServers(1);
waitForTopology(servers[0], 1, -1, 2000); waitForTopology(servers[0], 1, -1, 2000);
log.debug("#start #test #{}", i); logger.debug("#start #test #{}", i);
startServers(1); startServers(1);
waitForTopology(servers[0], 2, -1, 2000); waitForTopology(servers[0], 2, -1, 2000);
waitForTopology(servers[1], 2, -1, 2000); waitForTopology(servers[1], 2, -1, 2000);
@ -286,12 +286,12 @@ public class TwoWayTwoNodeClusterTest extends ClusterTestBase {
//allow the topology to be propagated before restarting //allow the topology to be propagated before restarting
waitForTopology(servers[0], 1, -1, 2000); waitForTopology(servers[0], 1, -1, 2000);
instanceLog.debug(clusterDescription(servers[0])); logger.debug(clusterDescription(servers[0]));
startServers(1); startServers(1);
instanceLog.debug(clusterDescription(servers[0])); logger.debug(clusterDescription(servers[0]));
instanceLog.debug(clusterDescription(servers[1])); logger.debug(clusterDescription(servers[1]));
setupSessionFactory(1, isNetty()); setupSessionFactory(1, isNetty());

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.failover; package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -40,9 +41,13 @@ import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils; import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FailoverListenerTest extends FailoverTestBase { public class FailoverListenerTest extends FailoverTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ServerLocatorInternal locator; private ServerLocatorInternal locator;
private ClientSessionFactoryInternal sf; private ClientSessionFactoryInternal sf;
@ -72,9 +77,9 @@ public class FailoverListenerTest extends FailoverTestBase {
assertTrue(failureLatch.await(5, TimeUnit.SECONDS)); assertTrue(failureLatch.await(5, TimeUnit.SECONDS));
assertEquals(FailoverEventType.FAILURE_DETECTED, listener.getFailoverEventType().get(0)); assertEquals(FailoverEventType.FAILURE_DETECTED, listener.getFailoverEventType().get(0));
instanceLog.debug("backup (nowLive) topology = " + backupServer.getServer().getClusterManager().getDefaultConnection(null).getTopology().describe()); logger.debug("backup (nowLive) topology = " + backupServer.getServer().getClusterManager().getDefaultConnection(null).getTopology().describe());
instanceLog.debug("Server Crash!!!"); logger.debug("Server Crash!!!");
assertTrue(failureDoneLatch.await(5, TimeUnit.SECONDS)); assertTrue(failureDoneLatch.await(5, TimeUnit.SECONDS));
//the backup server should be online by now //the backup server should be online by now
@ -90,7 +95,7 @@ public class FailoverListenerTest extends FailoverTestBase {
verifyMessageOnServer(1, 1); verifyMessageOnServer(1, 1);
instanceLog.debug("******* starting live server back"); logger.debug("******* starting live server back");
liveServer.start(); liveServer.start();
Thread.sleep(1000); Thread.sleep(1000);
//starting the live server trigger a failover event //starting the live server trigger a failover event
@ -99,7 +104,7 @@ public class FailoverListenerTest extends FailoverTestBase {
//the life server should be online by now //the life server should be online by now
assertEquals(FailoverEventType.FAILOVER_COMPLETED, listener.getFailoverEventType().get(3)); assertEquals(FailoverEventType.FAILOVER_COMPLETED, listener.getFailoverEventType().get(3));
instanceLog.debug("After failback: " + locator.getTopology().describe()); logger.debug("After failback: " + locator.getTopology().describe());
message = session.createMessage(true); message = session.createMessage(true);
@ -266,7 +271,7 @@ public class FailoverListenerTest extends FailoverTestBase {
@Override @Override
public void failoverEvent(FailoverEventType eventType) { public void failoverEvent(FailoverEventType eventType) {
this.failoverTypeEvent.add(eventType); this.failoverTypeEvent.add(eventType);
instanceLog.debug("Failover event just happen : " + eventType.toString()); logger.debug("Failover event just happen : " + eventType.toString());
if (eventType == FailoverEventType.FAILURE_DETECTED) { if (eventType == FailoverEventType.FAILURE_DETECTED) {
failureLatch.countDown(); failureLatch.countDown();
} else if (eventType == FailoverEventType.FAILOVER_COMPLETED || eventType == FailoverEventType.FAILOVER_FAILED) { } else if (eventType == FailoverEventType.FAILOVER_COMPLETED || eventType == FailoverEventType.FAILOVER_FAILED) {

View File

@ -95,7 +95,7 @@ import java.lang.invoke.MethodHandles;
public class FailoverTest extends FailoverTestBase { public class FailoverTest extends FailoverTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Rule @Rule
public RetryRule retryRule = new RetryRule(2); public RetryRule retryRule = new RetryRule(2);
@ -241,7 +241,7 @@ public class FailoverTest extends FailoverTestBase {
Integer counter = message.getIntProperty("counter"); Integer counter = message.getIntProperty("counter");
received.put(counter, message); received.put(counter, message);
try { try {
log.debug("acking message = id = {}, counter = {}", message.getMessageID(), message.getIntProperty("counter")); logger.debug("acking message = id = {}, counter = {}", message.getMessageID(), message.getIntProperty("counter"));
message.acknowledge(); message.acknowledge();
session.commit(); session.commit();
} catch (ActiveMQException e) { } catch (ActiveMQException e) {
@ -253,7 +253,7 @@ public class FailoverTest extends FailoverTestBase {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
log.debug("Acked counter = {}", counter); logger.debug("Acked counter = {}", counter);
if (counter.equals(10)) { if (counter.equals(10)) {
latch.countDown(); latch.countDown();
} }
@ -264,7 +264,7 @@ public class FailoverTest extends FailoverTestBase {
}); });
latch.await(10, TimeUnit.SECONDS); latch.await(10, TimeUnit.SECONDS);
log.debug("crashing session"); logger.debug("crashing session");
crash(session); crash(session);
Assert.assertTrue(endLatch.await(60, TimeUnit.SECONDS)); Assert.assertTrue(endLatch.await(60, TimeUnit.SECONDS));
@ -311,13 +311,13 @@ public class FailoverTest extends FailoverTestBase {
Integer counter = message.getIntProperty("counter"); Integer counter = message.getIntProperty("counter");
received.put(counter, message); received.put(counter, message);
try { try {
log.debug("acking message = id = {}, counter = {}", message.getMessageID(), message.getIntProperty("counter")); logger.debug("acking message = id = {}, counter = {}", message.getMessageID(), message.getIntProperty("counter"));
message.acknowledge(); message.acknowledge();
} catch (ActiveMQException e) { } catch (ActiveMQException e) {
e.printStackTrace(); e.printStackTrace();
continue; continue;
} }
log.debug("Acked counter = {}", counter); logger.debug("Acked counter = {}", counter);
if (counter.equals(10)) { if (counter.equals(10)) {
latch.countDown(); latch.countDown();
} }
@ -340,7 +340,7 @@ public class FailoverTest extends FailoverTestBase {
try { try {
ClientMessage msg = consumer.receive(20000); ClientMessage msg = consumer.receive(20000);
if (msg == null) { if (msg == null) {
log.debug("Returning null message on consuming"); logger.debug("Returning null message on consuming");
} }
return msg; return msg;
} catch (ActiveMQObjectClosedException oce) { } catch (ActiveMQObjectClosedException oce) {
@ -354,7 +354,7 @@ public class FailoverTest extends FailoverTestBase {
}; };
t.start(); t.start();
latch.await(10, TimeUnit.SECONDS); latch.await(10, TimeUnit.SECONDS);
log.debug("crashing session"); logger.debug("crashing session");
crash(session); crash(session);
endLatch.await(60, TimeUnit.SECONDS); endLatch.await(60, TimeUnit.SECONDS);
t.join(); t.join();
@ -549,7 +549,7 @@ public class FailoverTest extends FailoverTestBase {
//there is still an edge condition that we must deal with //there is still an edge condition that we must deal with
session.rollback(xid); session.rollback(xid);
} catch (Exception ignored) { } catch (Exception ignored) {
log.trace(ignored.getMessage(), ignored); logger.trace(ignored.getMessage(), ignored);
} }
} }
@ -699,14 +699,14 @@ public class FailoverTest extends FailoverTestBase {
TransportConfiguration initialLive = getFieldFromSF(sf, "currentConnectorConfig"); TransportConfiguration initialLive = getFieldFromSF(sf, "currentConnectorConfig");
TransportConfiguration initialBackup = getFieldFromSF(sf, "backupConnectorConfig"); TransportConfiguration initialBackup = getFieldFromSF(sf, "backupConnectorConfig");
instanceLog.debug("initlive: {}", initialLive); logger.debug("initlive: {}", initialLive);
instanceLog.debug("initback: {}", initialBackup); logger.debug("initback: {}", initialBackup);
TransportConfiguration last = getFieldFromSF(sf, "connectorConfig"); TransportConfiguration last = getFieldFromSF(sf, "connectorConfig");
TransportConfiguration current = getFieldFromSF(sf, "currentConnectorConfig"); TransportConfiguration current = getFieldFromSF(sf, "currentConnectorConfig");
instanceLog.debug("now last: {}", last); logger.debug("now last: {}", last);
instanceLog.debug("now current: {}", current); logger.debug("now current: {}", current);
assertTrue(current.equals(initialLive)); assertTrue(current.equals(initialLive));
ClientSession session = createSession(sf, true, true); ClientSession session = createSession(sf, true, true);
@ -722,8 +722,8 @@ public class FailoverTest extends FailoverTestBase {
last = getFieldFromSF(sf, "connectorConfig"); last = getFieldFromSF(sf, "connectorConfig");
current = getFieldFromSF(sf, "currentConnectorConfig"); current = getFieldFromSF(sf, "currentConnectorConfig");
instanceLog.debug("now after live crashed last: {}", last); logger.debug("now after live crashed last: {}", last);
instanceLog.debug("now current: {}", current); logger.debug("now current: {}", current);
assertTrue(current.equals(initialBackup)); assertTrue(current.equals(initialBackup));
@ -743,8 +743,8 @@ public class FailoverTest extends FailoverTestBase {
last = getFieldFromSF(sf, "connectorConfig"); last = getFieldFromSF(sf, "connectorConfig");
current = getFieldFromSF(sf, "currentConnectorConfig"); current = getFieldFromSF(sf, "currentConnectorConfig");
instanceLog.debug("now after live back again last: {}", last); logger.debug("now after live back again last: {}", last);
instanceLog.debug("now current: {}", current); logger.debug("now current: {}", current);
//cannot use equals here because the config's name (uuid) changes //cannot use equals here because the config's name (uuid) changes
//after failover //after failover

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.failover; package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.lang.invoke.MethodHandles;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -36,9 +37,13 @@ import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class MultipleBackupsFailoverTestBase extends ActiveMQTestBase { public abstract class MultipleBackupsFailoverTestBase extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected abstract boolean isNetty(); protected abstract boolean isNetty();
protected int waitForNewLive(long seconds, protected int waitForNewLive(long seconds,
@ -137,7 +142,7 @@ public abstract class MultipleBackupsFailoverTestBase extends ActiveMQTestBase {
locator.removeClusterTopologyListener(topListener); locator.removeClusterTopologyListener(topListener);
if (!ok) { if (!ok) {
if (server != null) { if (server != null) {
instanceLog.warn("failed topology, Topology on server = " + server.getClusterManager().describe()); logger.warn("failed topology, Topology on server = " + server.getClusterManager().describe());
} }
} }
Assert.assertTrue("expected " + topologyMembers + " members", ok); Assert.assertTrue("expected " + topologyMembers + " members", ok);

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.failover; package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.lang.invoke.MethodHandles;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -34,11 +35,15 @@ import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer; import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
*/ */
public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase { public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected Map<Integer, TestableServer> servers = new HashMap<>(); protected Map<Integer, TestableServer> servers = new HashMap<>();
private ServerLocator locator2; private ServerLocator locator2;
private ServerLocator locator; private ServerLocator locator;
@ -78,7 +83,7 @@ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFai
ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 4, servers.get(0).getServer()); ClientSessionFactoryInternal sf = createSessionFactoryAndWaitForTopology(locator, 4, servers.get(0).getServer());
ClientSession session = sendAndConsume(sf, true); ClientSession session = sendAndConsume(sf, true);
instanceLog.debug(((ServerLocatorInternal) locator).getTopology().describe()); logger.debug(((ServerLocatorInternal) locator).getTopology().describe());
Thread.sleep(500); Thread.sleep(500);
servers.get(0).crash(session); servers.get(0).crash(session);

View File

@ -13,6 +13,7 @@
package org.apache.activemq.artemis.tests.integration.cluster.failover; package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -51,6 +52,8 @@ import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* This test will simulate a failure where the network card is gone. * This test will simulate a failure where the network card is gone.
@ -60,6 +63,8 @@ import org.junit.Test;
*/ */
public class NetworkFailureFailoverTest extends FailoverTestBase { public class NetworkFailureFailoverTest extends FailoverTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Rule @Rule
public NetUtilResource netUtilResource = new NetUtilResource(); public NetUtilResource netUtilResource = new NetUtilResource();
@ -163,13 +168,13 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
liveServer.addInterceptor(new Interceptor() { liveServer.addInterceptor(new Interceptor() {
@Override @Override
public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException { public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException {
//instanceLog.debug("Received " + packet); //logger.debug("Received " + packet);
if (packet instanceof SessionSendMessage) { if (packet instanceof SessionSendMessage) {
if (countSent.incrementAndGet() == 500) { if (countSent.incrementAndGet() == 500) {
try { try {
NetUtil.netDown(LIVE_IP); NetUtil.netDown(LIVE_IP);
instanceLog.debug("Blocking traffic"); logger.debug("Blocking traffic");
// Thread.sleep(3000); // this is important to let stuff to block // Thread.sleep(3000); // this is important to let stuff to block
liveServer.crash(true, false); liveServer.crash(true, false);
} catch (Exception e) { } catch (Exception e) {
@ -248,11 +253,11 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
latchReceived.countDown(); latchReceived.countDown();
msgReceived.acknowledge(); msgReceived.acknowledge();
if (received++ % 100 == 0) { if (received++ % 100 == 0) {
instanceLog.debug("Received " + received); logger.debug("Received " + received);
sessionConsumer.commit(); sessionConsumer.commit();
} }
} else { } else {
instanceLog.debug("Null"); logger.debug("Null");
} }
} catch (Throwable e) { } catch (Throwable e) {
errors++; errors++;
@ -271,7 +276,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
do { do {
try { try {
if (sentMessages.get() % 100 == 0) { if (sentMessages.get() % 100 == 0) {
instanceLog.debug("Sent " + sentMessages.get()); logger.debug("Sent " + sentMessages.get());
} }
producer.send(createMessage(sessionProducer, sentMessages.get(), true)); producer.send(createMessage(sessionProducer, sentMessages.get(), true));
break; break;
@ -382,15 +387,15 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
if (++received % 100 == 0) { if (++received % 100 == 0) {
if (received == 300) { if (received == 300) {
instanceLog.debug("Shutting down IP"); logger.debug("Shutting down IP");
NetUtil.netDown(LIVE_IP); NetUtil.netDown(LIVE_IP);
liveServer.crash(true, false); liveServer.crash(true, false);
} }
instanceLog.debug("Received " + received); logger.debug("Received " + received);
sessionConsumer.commit(); sessionConsumer.commit();
} }
} else { } else {
instanceLog.debug("Null"); logger.debug("Null");
} }
} catch (Throwable e) { } catch (Throwable e) {
errors++; errors++;
@ -408,7 +413,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
do { do {
try { try {
if (sentMessages.get() % 100 == 0) { if (sentMessages.get() % 100 == 0) {
instanceLog.debug("Sent " + sentMessages.get()); logger.debug("Sent " + sentMessages.get());
} }
producer.send(createMessage(sessionProducer, sentMessages.get(), true)); producer.send(createMessage(sessionProducer, sentMessages.get(), true));
break; break;
@ -454,13 +459,13 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
liveServer.addInterceptor(new Interceptor() { liveServer.addInterceptor(new Interceptor() {
@Override @Override
public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException { public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException {
//instanceLog.debug("Received " + packet); //logger.debug("Received " + packet);
if (packet instanceof CreateSessionMessage) { if (packet instanceof CreateSessionMessage) {
if (countSent.incrementAndGet() == 50) { if (countSent.incrementAndGet() == 50) {
try { try {
NetUtil.netDown(LIVE_IP); NetUtil.netDown(LIVE_IP);
instanceLog.debug("Blocking traffic"); logger.debug("Blocking traffic");
blockedAt.set(sentMessages.get()); blockedAt.set(sentMessages.get());
latchDown.countDown(); latchDown.countDown();
} catch (Exception e) { } catch (Exception e) {
@ -517,7 +522,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
while (running.get() && received < numSessions) { while (running.get() && received < numSessions) {
try { try {
ClientSession session = sessionFactory.createSession(); ClientSession session = sessionFactory.createSession();
instanceLog.debug("Creating session, currentLatch = " + latchCreated.getCount()); logger.debug("Creating session, currentLatch = " + latchCreated.getCount());
session.close(); session.close();
latchCreated.countDown(); latchCreated.countDown();
} catch (Throwable e) { } catch (Throwable e) {
@ -534,7 +539,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
Thread.sleep(1000); Thread.sleep(1000);
instanceLog.debug("Server crashed now!!!"); logger.debug("Server crashed now!!!");
liveServer.crash(true, false); liveServer.crash(true, false);
@ -565,13 +570,13 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
liveServer.addInterceptor(new Interceptor() { liveServer.addInterceptor(new Interceptor() {
@Override @Override
public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException { public boolean intercept(Packet packet, RemotingConnection connection) throws ActiveMQException {
//instanceLog.debug("Received " + packet); //logger.debug("Received " + packet);
if (packet instanceof SessionSendMessage) { if (packet instanceof SessionSendMessage) {
if (countSent.incrementAndGet() == 50) { if (countSent.incrementAndGet() == 50) {
try { try {
NetUtil.netDown(LIVE_IP); NetUtil.netDown(LIVE_IP);
instanceLog.debug("Blocking traffic"); logger.debug("Blocking traffic");
Thread.sleep(3000); // this is important to let stuff to block Thread.sleep(3000); // this is important to let stuff to block
blockedAt.set(sentMessages.get()); blockedAt.set(sentMessages.get());
latchBlocked.countDown(); latchBlocked.countDown();
@ -650,7 +655,7 @@ public class NetworkFailureFailoverTest extends FailoverTestBase {
while (sentMessages.get() < numMessages && running.get()) { while (sentMessages.get() < numMessages && running.get()) {
try { try {
if (sentMessages.get() % 10 == 0) { if (sentMessages.get() % 10 == 0) {
instanceLog.debug("Sent " + sentMessages.get()); logger.debug("Sent " + sentMessages.get());
} }
producer.send(createMessage(sessionProducer, sentMessages.get(), true)); producer.send(createMessage(sessionProducer, sentMessages.get(), true));
sentMessages.incrementAndGet(); sentMessages.incrementAndGet();

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.failover; package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -35,9 +36,13 @@ import org.apache.activemq.artemis.tests.util.CountDownSessionFailureListener;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ReplicatedDistributionTest extends ClusterTestBase { public class ReplicatedDistributionTest extends ClusterTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final SimpleString ADDRESS = new SimpleString("test.SomeAddress"); private static final SimpleString ADDRESS = new SimpleString("test.SomeAddress");
private ClientSession sessionOne; private ClientSession sessionOne;
private ClientSession sessionThree; private ClientSession sessionThree;
@ -122,7 +127,7 @@ public class ReplicatedDistributionTest extends ClusterTestBase {
if (i != received) { if (i != received) {
// Shouldn't this be a failure? // Shouldn't this be a failure?
instanceLog.warn(i + "!=" + received); logger.warn(i + "!=" + received);
} }
msg.acknowledge(); msg.acknowledge();
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.failover; package org.apache.activemq.artemis.tests.integration.cluster.failover;
import java.lang.invoke.MethodHandles;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -33,11 +34,15 @@ import org.apache.activemq.artemis.core.server.impl.InVMNodeManager;
import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer; import org.apache.activemq.artemis.tests.integration.cluster.util.SameProcessActiveMQServer;
import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer; import org.apache.activemq.artemis.tests.integration.cluster.util.TestableServer;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
*/ */
public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase { public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected Map<Integer, TestableServer> servers = new HashMap<>(); protected Map<Integer, TestableServer> servers = new HashMap<>();
protected ServerLocatorImpl locator; protected ServerLocatorImpl locator;
private NodeManager nodeManager; private NodeManager nodeManager;
@ -75,31 +80,31 @@ public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailov
int backupNode; int backupNode;
ClientSession session = sendAndConsume(sf, true); ClientSession session = sendAndConsume(sf, true);
instanceLog.debug("failing node 0"); logger.debug("failing node 0");
servers.get(0).crash(session); servers.get(0).crash(session);
session.close(); session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5); backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false); session = sendAndConsume(sf, false);
instanceLog.debug("failing node " + backupNode); logger.debug("failing node " + backupNode);
servers.get(backupNode).crash(session); servers.get(backupNode).crash(session);
session.close(); session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5); backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false); session = sendAndConsume(sf, false);
instanceLog.debug("failing node " + backupNode); logger.debug("failing node " + backupNode);
servers.get(backupNode).crash(session); servers.get(backupNode).crash(session);
session.close(); session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5); backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false); session = sendAndConsume(sf, false);
instanceLog.debug("failing node " + backupNode); logger.debug("failing node " + backupNode);
servers.get(backupNode).crash(session); servers.get(backupNode).crash(session);
session.close(); session.close();
backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5); backupNode = waitForNewLive(5, true, servers, 1, 2, 3, 4, 5);
session = sendAndConsume(sf, false); session = sendAndConsume(sf, false);
instanceLog.debug("failing node " + backupNode); logger.debug("failing node " + backupNode);
servers.get(backupNode).crash(session); servers.get(backupNode).crash(session);
session.close(); session.close();

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.reattach; package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import java.lang.invoke.MethodHandles;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -39,9 +40,13 @@ import org.apache.activemq.artemis.jms.client.ActiveMQTextMessage;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class OrderReattachTest extends ActiveMQTestBase { public class OrderReattachTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
final SimpleString ADDRESS = new SimpleString("address"); final SimpleString ADDRESS = new SimpleString("address");
private ActiveMQServer server; private ActiveMQServer server;
@ -195,7 +200,7 @@ public class OrderReattachTest extends ActiveMQTestBase {
if (message.getIntProperty("count") != count) { if (message.getIntProperty("count") != count) {
failure = new Exception("counter " + count + " was not as expected (" + message.getIntProperty("count") + ")"); failure = new Exception("counter " + count + " was not as expected (" + message.getIntProperty("count") + ")");
instanceLog.warn("Failure on receiving message ", failure); logger.warn("Failure on receiving message ", failure);
failure.printStackTrace(); failure.printStackTrace();
latch.countDown(); latch.countDown();
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.reattach; package org.apache.activemq.artemis.tests.integration.cluster.reattach;
import java.lang.invoke.MethodHandles;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.Timer; import java.util.Timer;
@ -51,9 +52,13 @@ import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ReattachTest extends ActiveMQTestBase { public class ReattachTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress"); private static final SimpleString ADDRESS = new SimpleString("FailoverTestAddress");
private ActiveMQServer server; private ActiveMQServer server;
private ServerLocator locator; private ServerLocator locator;
@ -562,7 +567,7 @@ public class ReattachTest extends ActiveMQTestBase {
try { try {
connFailure.fail(new ActiveMQNotConnectedException()); connFailure.fail(new ActiveMQNotConnectedException());
} catch (Exception e) { } catch (Exception e) {
instanceLog.warn("Error on the timer " + e); logger.warn("Error on the timer " + e);
} }
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.restart; package org.apache.activemq.artemis.tests.integration.cluster.restart;
import java.lang.invoke.MethodHandles;
import java.util.Collection; import java.util.Collection;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
@ -23,9 +24,13 @@ import org.apache.activemq.artemis.core.postoffice.Binding;
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase; import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClusterRestartTest extends ClusterTestBase { public class ClusterRestartTest extends ClusterTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test @Test
public void testRestartWithQueuesCreateInDiffOrder() throws Exception { public void testRestartWithQueuesCreateInDiffOrder() throws Exception {
setupServer(0, isFileStorage(), isNetty()); setupServer(0, isFileStorage(), isNetty());
@ -37,8 +42,8 @@ public class ClusterRestartTest extends ClusterTestBase {
startServers(0, 1); startServers(0, 1);
instanceLog.debug("server 0 = " + getServer(0).getNodeID()); log.debug("server 0 = " + getServer(0).getNodeID());
instanceLog.debug("server 1 = " + getServer(1).getNodeID()); log.debug("server 1 = " + getServer(1).getNodeID());
setupSessionFactory(0, isNetty(), 15); setupSessionFactory(0, isNetty(), 15);
setupSessionFactory(1, isNetty()); setupSessionFactory(1, isNetty());
@ -86,7 +91,7 @@ public class ClusterRestartTest extends ClusterTestBase {
sendInRange(1, "queues.testaddress", 10, 20, false, null); sendInRange(1, "queues.testaddress", 10, 20, false, null);
verifyReceiveAllInRange(0, 20, 0); verifyReceiveAllInRange(0, 20, 0);
instanceLog.debug("*****************************************************************************"); log.debug("*****************************************************************************");
} }
@Test @Test
@ -100,8 +105,8 @@ public class ClusterRestartTest extends ClusterTestBase {
startServers(0, 1); startServers(0, 1);
instanceLog.debug("server 0 = " + getServer(0).getNodeID()); log.debug("server 0 = " + getServer(0).getNodeID());
instanceLog.debug("server 1 = " + getServer(1).getNodeID()); log.debug("server 1 = " + getServer(1).getNodeID());
setupSessionFactory(0, isNetty(), 15); setupSessionFactory(0, isNetty(), 15);
setupSessionFactory(1, isNetty()); setupSessionFactory(1, isNetty());
@ -129,11 +134,11 @@ public class ClusterRestartTest extends ClusterTestBase {
sendInRange(1, "queues.testaddress", 0, 10, true, null); sendInRange(1, "queues.testaddress", 0, 10, true, null);
instanceLog.debug("stopping******************************************************"); log.debug("stopping******************************************************");
stopServers(0); stopServers(0);
sendInRange(1, "queues.testaddress", 10, 20, true, null); sendInRange(1, "queues.testaddress", 10, 20, true, null);
instanceLog.debug("stopped******************************************************"); log.debug("stopped******************************************************");
startServers(0); startServers(0);
waitForBindings(0, "queues.testaddress", 1, 0, true); waitForBindings(0, "queues.testaddress", 1, 0, true);
@ -146,14 +151,14 @@ public class ClusterRestartTest extends ClusterTestBase {
addConsumer(1, 0, "queue10", null); addConsumer(1, 0, "queue10", null);
verifyReceiveRoundRobin(0, 20, 0, 1); verifyReceiveRoundRobin(0, 20, 0, 1);
instanceLog.debug("*****************************************************************************"); log.debug("*****************************************************************************");
} }
private void printBindings(final int num) throws Exception { private void printBindings(final int num) throws Exception {
for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
Collection<Binding> bindings0 = getServer(i).getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")).getBindings(); Collection<Binding> bindings0 = getServer(i).getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")).getBindings();
for (Binding binding : bindings0) { for (Binding binding : bindings0) {
instanceLog.debug(binding + " on node " + i + " at " + binding.getID()); log.debug(binding + " on node " + i + " at " + binding.getID());
} }
} }
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.cluster.topology; package org.apache.activemq.artemis.tests.integration.cluster.topology;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -45,11 +46,15 @@ import org.apache.activemq.artemis.utils.RandomUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.concurrent.TimeUnit.SECONDS;
public abstract class TopologyClusterTestBase extends ClusterTestBase { public abstract class TopologyClusterTestBase extends ClusterTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final class LatchListener implements ClusterTopologyListener { private static final class LatchListener implements ClusterTopologyListener {
private final CountDownLatch upLatch; private final CountDownLatch upLatch;
@ -192,7 +197,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase {
} }
while (System.currentTimeMillis() - start < ActiveMQTestBase.WAIT_TIMEOUT); while (System.currentTimeMillis() - start < ActiveMQTestBase.WAIT_TIMEOUT);
instanceLog.error(clusterDescription(servers[node])); logger.error(clusterDescription(servers[node]));
Assert.assertEquals("Timed out waiting for cluster connections for server " + node, expected, nodesCount); Assert.assertEquals("Timed out waiting for cluster connections for server " + node, expected, nodesCount);
} }
@ -395,7 +400,7 @@ public abstract class TopologyClusterTestBase extends ClusterTestBase {
boolean ok = downLatch.await(10, SECONDS); boolean ok = downLatch.await(10, SECONDS);
if (!ok) { if (!ok) {
instanceLog.warn("TopologyClusterTestBase.testMultipleClientSessionFactories will fail"); logger.warn("TopologyClusterTestBase.testMultipleClientSessionFactories will fail");
} }
Assert.assertTrue("Was not notified that all servers are Down", ok); Assert.assertTrue("Was not notified that all servers are Down", ok);
checkContains(new int[]{0}, nodeIDs, nodes); checkContains(new int[]{0}, nodeIDs, nodes);

View File

@ -27,6 +27,8 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.ConnectionFactory; import javax.jms.ConnectionFactory;
@ -36,6 +38,7 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Queue; import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import static org.apache.activemq.artemis.tests.util.CFUtil.createConnectionFactory; import static org.apache.activemq.artemis.tests.util.CFUtil.createConnectionFactory;
@ -43,6 +46,8 @@ import static org.apache.activemq.artemis.tests.util.CFUtil.createConnectionFact
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class MessageIDMultiProtocolTest extends OpenWireTestBase { public class MessageIDMultiProtocolTest extends OpenWireTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
String protocolSender; String protocolSender;
String protocolConsumer; String protocolConsumer;
ConnectionFactory senderCF; ConnectionFactory senderCF;
@ -115,8 +120,8 @@ public class MessageIDMultiProtocolTest extends OpenWireTestBase {
Assert.assertTrue(messageId.startsWith("ID:")); Assert.assertTrue(messageId.startsWith("ID:"));
instanceLog.debug("[" + protocolSender + "][" + protocolConsumer + "] " + messageId); logger.debug("[" + protocolSender + "][" + protocolConsumer + "] " + messageId);
instanceLog.debug("[" + protocolSender + "][" + protocolConsumer + "] " + sentMid); logger.debug("[" + protocolSender + "][" + protocolConsumer + "] " + sentMid);
if (protocolConsumer.equals(protocolSender)) { if (protocolConsumer.equals(protocolSender)) {
//only same protocol we guarantee the same JMSMessageID //only same protocol we guarantee the same JMSMessageID

View File

@ -28,6 +28,7 @@ import javax.jms.TemporaryQueue;
import javax.jms.TemporaryTopic; import javax.jms.TemporaryTopic;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -43,12 +44,16 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.activemq.artemis.tests.util.CFUtil.createConnectionFactory; import static org.apache.activemq.artemis.tests.util.CFUtil.createConnectionFactory;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class RequestReplyMultiProtocolTest extends OpenWireTestBase { public class RequestReplyMultiProtocolTest extends OpenWireTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
String protocolSender; String protocolSender;
String protocolConsumer; String protocolConsumer;
ConnectionFactory senderCF; ConnectionFactory senderCF;
@ -156,7 +161,7 @@ public class RequestReplyMultiProtocolTest extends OpenWireTestBase {
TextMessage received = (TextMessage)consumer.receive(5000); TextMessage received = (TextMessage)consumer.receive(5000);
Assert.assertNotNull(received); Assert.assertNotNull(received);
instanceLog.debug("Destination::" + received.getJMSDestination()); logger.debug("Destination::" + received.getJMSDestination());
if (useTopic) { if (useTopic) {
Assert.assertTrue("JMSDestination type is " + received.getJMSDestination().getClass(), received.getJMSDestination() instanceof Topic); Assert.assertTrue("JMSDestination type is " + received.getJMSDestination().getClass(), received.getJMSDestination() instanceof Topic);
@ -167,7 +172,7 @@ public class RequestReplyMultiProtocolTest extends OpenWireTestBase {
Assert.assertNotNull(received.getJMSReplyTo()); Assert.assertNotNull(received.getJMSReplyTo());
Assert.assertEquals("hello " + (i++), received.getText()); Assert.assertEquals("hello " + (i++), received.getText());
instanceLog.debug("received " + received.getText() + " and " + received.getJMSReplyTo()); logger.debug("received " + received.getText() + " and " + received.getJMSReplyTo());
if (destination instanceof Queue) { if (destination instanceof Queue) {
Assert.assertTrue("Type is " + received.getJMSReplyTo().getClass().toString(), received.getJMSReplyTo() instanceof Queue); Assert.assertTrue("Type is " + received.getJMSReplyTo().getClass().toString(), received.getJMSReplyTo() instanceof Queue);

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.tests.integration.discovery; package org.apache.activemq.artemis.tests.integration.discovery;
import java.io.File; import java.io.File;
import java.lang.invoke.MethodHandles;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.util.Arrays; import java.util.Arrays;
@ -44,6 +45,8 @@ import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* This will test Discovery test on JGroups and UDP. * This will test Discovery test on JGroups and UDP.
@ -66,6 +69,8 @@ import org.junit.Test;
*/ */
public class DiscoveryTest extends DiscoveryBaseTest { public class DiscoveryTest extends DiscoveryBaseTest {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String TEST_JGROUPS_CONF_FILE = "test-jgroups-file_ping.xml"; private static final String TEST_JGROUPS_CONF_FILE = "test-jgroups-file_ping.xml";
BroadcastGroup bg = null, bg1 = null, bg2 = null, bg3 = null; BroadcastGroup bg = null, bg1 = null, bg2 = null, bg3 = null;
@ -354,7 +359,7 @@ public class DiscoveryTest extends DiscoveryBaseTest {
byte[] btreceived = client.receiveBroadcast(5, TimeUnit.SECONDS); byte[] btreceived = client.receiveBroadcast(5, TimeUnit.SECONDS);
instanceLog.debug("BTReceived = " + Arrays.toString(btreceived)); logger.debug("BTReceived = " + Arrays.toString(btreceived));
assertNotNull(btreceived); assertNotNull(btreceived);
@ -392,7 +397,7 @@ public class DiscoveryTest extends DiscoveryBaseTest {
InetAddress localAddress = InetAddress.getLoopbackAddress(); InetAddress localAddress = InetAddress.getLoopbackAddress();
instanceLog.debug("Local address is " + localAddress); logger.debug("Local address is " + localAddress);
bg = newBroadcast(nodeID, RandomUtil.randomString(), localAddress, -1, groupAddress, groupPort); bg = newBroadcast(nodeID, RandomUtil.randomString(), localAddress, -1, groupAddress, groupPort);

View File

@ -25,6 +25,7 @@ import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import javax.jms.TopicSubscriber; import javax.jms.TopicSubscriber;
import java.lang.invoke.MethodHandles;
import java.util.Collection; import java.util.Collection;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -60,9 +61,13 @@ import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.command.ActiveMQTopic; import org.apache.activemq.command.ActiveMQTopic;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DivertTest extends ActiveMQTestBase { public class DivertTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final int TIMEOUT = 3000; private static final int TIMEOUT = 3000;
@Test @Test
@ -504,7 +509,7 @@ public class DivertTest extends ActiveMQTestBase {
for (int i = 0; i < numMessages * 2; i++) { for (int i = 0; i < numMessages * 2; i++) {
ClientMessage message = consumerExpiry.receive(5000); ClientMessage message = consumerExpiry.receive(5000);
instanceLog.debug("Received message " + message); logger.debug("Received message " + message);
assertNotNull(message); assertNotNull(message);
if (message.getStringProperty(Message.HDR_ORIGINAL_QUEUE).equals("queue1")) { if (message.getStringProperty(Message.HDR_ORIGINAL_QUEUE).equals("queue1")) {
@ -512,7 +517,7 @@ public class DivertTest extends ActiveMQTestBase {
} else if (message.getStringProperty(Message.HDR_ORIGINAL_QUEUE).equals("queue2")) { } else if (message.getStringProperty(Message.HDR_ORIGINAL_QUEUE).equals("queue2")) {
countOriginal2++; countOriginal2++;
} else { } else {
instanceLog.debug("message not part of any expired queue" + message); logger.debug("message not part of any expired queue" + message);
} }
} }

View File

@ -25,6 +25,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQExceptionType; import org.apache.activemq.artemis.api.core.ActiveMQExceptionType;
@ -59,9 +60,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class InterceptorTest extends ActiveMQTestBase { public class InterceptorTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ActiveMQServer server; private ActiveMQServer server;
private final SimpleString QUEUE = new SimpleString("InterceptorTestQueue"); private final SimpleString QUEUE = new SimpleString("InterceptorTestQueue");
@ -108,13 +113,13 @@ public class InterceptorTest extends ActiveMQTestBase {
CreateQueueMessage createQueue = (CreateQueueMessage) packet; CreateQueueMessage createQueue = (CreateQueueMessage) packet;
createQueue.setFilterString(new SimpleString("userName='" + userName + "'")); createQueue.setFilterString(new SimpleString("userName='" + userName + "'"));
instanceLog.debug("userName on createQueue = " + userName); logger.debug("userName on createQueue = " + userName);
} else if (packet.getType() == PacketImpl.SESS_SEND) { } else if (packet.getType() == PacketImpl.SESS_SEND) {
String userName = getUsername(packet, connection); String userName = getUsername(packet, connection);
MessagePacket msgPacket = (MessagePacket) packet; MessagePacket msgPacket = (MessagePacket) packet;
msgPacket.getMessage().putStringProperty("userName", userName); msgPacket.getMessage().putStringProperty("userName", userName);
instanceLog.debug("userName on send = " + userName); logger.debug("userName on send = " + userName);
} }
return true; return true;
@ -138,13 +143,13 @@ public class InterceptorTest extends ActiveMQTestBase {
SessionCreateConsumerMessage createQueue = (SessionCreateConsumerMessage) packet; SessionCreateConsumerMessage createQueue = (SessionCreateConsumerMessage) packet;
createQueue.setFilterString(new SimpleString("userName='" + userName + "'")); createQueue.setFilterString(new SimpleString("userName='" + userName + "'"));
instanceLog.debug("userName = " + userName); logger.debug("userName = " + userName);
} else if (packet.getType() == PacketImpl.SESS_SEND) { } else if (packet.getType() == PacketImpl.SESS_SEND) {
String userName = getUsername(packet, connection); String userName = getUsername(packet, connection);
MessagePacket msgPacket = (MessagePacket) packet; MessagePacket msgPacket = (MessagePacket) packet;
msgPacket.getMessage().putStringProperty("userName", userName); msgPacket.getMessage().putStringProperty("userName", userName);
instanceLog.debug("userName on send = " + userName); logger.debug("userName on send = " + userName);
} }
return true; return true;
@ -1058,7 +1063,7 @@ public class InterceptorTest extends ActiveMQTestBase {
String uri = "tcp://localhost:61616?incomingInterceptorList=" + Incoming.class.getCanonicalName() + "&outgoingInterceptorList=" + Outgoing.class.getName(); String uri = "tcp://localhost:61616?incomingInterceptorList=" + Incoming.class.getCanonicalName() + "&outgoingInterceptorList=" + Outgoing.class.getName();
instanceLog.debug(uri); logger.debug(uri);
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(uri); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(uri);

View File

@ -27,6 +27,7 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Queue; import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -42,12 +43,14 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.util.concurrent.TimeUnit.SECONDS; import static java.util.concurrent.TimeUnit.SECONDS;
public class ManualReconnectionToSingleServerTest extends ActiveMQTestBase { public class ManualReconnectionToSingleServerTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final String BROKER_URL = "tcp://localhost:61616?minLargeMessageSize=10000&HA=true&retryInterval=100&reconnectAttempts=20&producerWindowSize=10000"; public static final String BROKER_URL = "tcp://localhost:61616?minLargeMessageSize=10000&HA=true&retryInterval=100&reconnectAttempts=20&producerWindowSize=10000";
@ -148,20 +151,20 @@ public class ManualReconnectionToSingleServerTest extends ActiveMQTestBase {
protected void disconnect() { protected void disconnect() {
instanceLog.debug("calling disconnect"); logger.debug("calling disconnect");
if (connection == null) { if (connection == null) {
instanceLog.debug("connection is null"); logger.debug("connection is null");
return; return;
} }
try { try {
connection.setExceptionListener(null); connection.setExceptionListener(null);
instanceLog.debug("closing the connection"); logger.debug("closing the connection");
connection.close(); connection.close();
connection = null; connection = null;
instanceLog.debug("connection closed"); logger.debug("connection closed");
} catch (Exception e) { } catch (Exception e) {
instanceLog.debug("** got exception"); logger.debug("** got exception");
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -22,12 +22,16 @@ import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.Topic; import javax.jms.Topic;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CreateQueueTest extends JMSTestBase { public class CreateQueueTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test @Test
public void testCreateQueueTempQueue() throws Exception { public void testCreateQueueTempQueue() throws Exception {
@ -63,7 +67,7 @@ public class CreateQueueTest extends JMSTestBase {
String queueName = queue.getQueueName(); String queueName = queue.getQueueName();
instanceLog.debug("queue name is " + queueName); logger.debug("queue name is " + queueName);
// assertFalse(queueName.startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX)); // assertFalse(queueName.startsWith(ActiveMQDestination.JMS_QUEUE_ADDRESS_PREFIX));

View File

@ -25,14 +25,19 @@ import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.StreamMessage; import javax.jms.StreamMessage;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient; import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.reader.MessageUtil; import org.apache.activemq.artemis.reader.MessageUtil;
import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MessageTest extends JMSTestBase { public class MessageTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final long TIMEOUT = 1000; private static final long TIMEOUT = 1000;
@ -214,35 +219,35 @@ public class MessageTest extends JMSTestBase {
Assert.assertNull(message.getObjectProperty(MessageTest.propName3)); Assert.assertNull(message.getObjectProperty(MessageTest.propName3));
try { try {
instanceLog.debug("{}", message.getIntProperty(MessageTest.propName1)); logger.debug("{}", message.getIntProperty(MessageTest.propName1));
Assert.fail("Should throw exception"); Assert.fail("Should throw exception");
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// Ok // Ok
} }
try { try {
instanceLog.debug("{}", message.getShortProperty(MessageTest.propName1)); logger.debug("{}", message.getShortProperty(MessageTest.propName1));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// Ok // Ok
} }
try { try {
instanceLog.debug("{}", message.getByteProperty(MessageTest.propName1)); logger.debug("{}", message.getByteProperty(MessageTest.propName1));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// Ok // Ok
} }
Assert.assertEquals(false, message.getBooleanProperty(MessageTest.propName1)); Assert.assertEquals(false, message.getBooleanProperty(MessageTest.propName1));
try { try {
instanceLog.debug("{}", message.getLongProperty(MessageTest.propName1)); logger.debug("{}", message.getLongProperty(MessageTest.propName1));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
// Ok // Ok
} }
try { try {
instanceLog.debug("{}", message.getFloatProperty(MessageTest.propName1)); logger.debug("{}", message.getFloatProperty(MessageTest.propName1));
} catch (NullPointerException e) { } catch (NullPointerException e) {
// Ok // Ok
} }
try { try {
instanceLog.debug("{}", message.getDoubleProperty(MessageTest.propName1)); logger.debug("{}", message.getDoubleProperty(MessageTest.propName1));
} catch (NullPointerException e) { } catch (NullPointerException e) {
// Ok // Ok
} }

View File

@ -29,11 +29,17 @@ import javax.jms.QueueSession;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class NewQueueRequestorTest extends JMSTestBase { public class NewQueueRequestorTest extends JMSTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Test @Test
public void testQueueRequestor() throws Exception { public void testQueueRequestor() throws Exception {
QueueConnection conn1 = null, conn2 = null; QueueConnection conn1 = null, conn2 = null;
@ -84,7 +90,7 @@ public class NewQueueRequestorTest extends JMSTestBase {
Message m2 = sess.createTextMessage("This is the response"); Message m2 = sess.createTextMessage("This is the response");
sender.send(queue, m2); sender.send(queue, m2);
} catch (JMSException e) { } catch (JMSException e) {
instanceLog.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} }
} }

View File

@ -24,6 +24,7 @@ import javax.jms.MessageProducer;
import javax.jms.Queue; import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -56,6 +57,8 @@ import org.apache.activemq.artemis.utils.RandomUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* A JMSFailoverTest * A JMSFailoverTest
@ -64,6 +67,7 @@ import org.junit.Test;
*/ */
public class JMSFailoverListenerTest extends ActiveMQTestBase { public class JMSFailoverListenerTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
protected Configuration backupConf; protected Configuration backupConf;
@ -142,13 +146,13 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
conn.start(); conn.start();
instanceLog.debug("sent messages and started connection"); logger.debug("sent messages and started connection");
JMSUtil.crash(liveServer, ((ActiveMQSession) sess).getCoreSession()); JMSUtil.crash(liveServer, ((ActiveMQSession) sess).getCoreSession());
Wait.assertTrue(() -> FailoverEventType.FAILURE_DETECTED == listener.get(0)); Wait.assertTrue(() -> FailoverEventType.FAILURE_DETECTED == listener.get(0));
for (int i = 0; i < numMessages; i++) { for (int i = 0; i < numMessages; i++) {
instanceLog.debug("got message " + i); logger.debug("got message " + i);
BytesMessage bm = (BytesMessage) consumer.receive(1000); BytesMessage bm = (BytesMessage) consumer.receive(1000);
@ -267,7 +271,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
backupServer = addServer(new InVMNodeManagerServer(backupConf, nodeManager)); backupServer = addServer(new InVMNodeManagerServer(backupConf, nodeManager));
backupServer.setIdentity("JMSBackup"); backupServer.setIdentity("JMSBackup");
instanceLog.debug("Starting backup"); logger.debug("Starting backup");
backupServer.start(); backupServer.start();
liveConf = createBasicConfig().setJournalDirectory(getJournalDir()).setBindingsDirectory(getBindingsDir()).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(livetc.getName())); liveConf = createBasicConfig().setJournalDirectory(getJournalDir()).setBindingsDirectory(getBindingsDir()).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(livetc.getName()));
@ -276,7 +280,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase {
liveServer = addServer(new InVMNodeManagerServer(liveConf, nodeManager)); liveServer = addServer(new InVMNodeManagerServer(liveConf, nodeManager));
liveServer.setIdentity("JMSLive"); liveServer.setIdentity("JMSLive");
instanceLog.debug("Starting life"); logger.debug("Starting life");
liveServer.start(); liveServer.start();

View File

@ -85,7 +85,7 @@ import java.lang.invoke.MethodHandles;
*/ */
public class JMSFailoverTest extends ActiveMQTestBase { public class JMSFailoverTest extends ActiveMQTestBase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@ -223,14 +223,14 @@ public class JMSFailoverTest extends ActiveMQTestBase {
conn.start(); conn.start();
instanceLog.debug("sent messages and started connection"); logger.debug("sent messages and started connection");
Thread.sleep(2000); Thread.sleep(2000);
JMSUtil.crash(liveServer, ((ActiveMQSession) sess).getCoreSession()); JMSUtil.crash(liveServer, ((ActiveMQSession) sess).getCoreSession());
for (int i = 0; i < numMessages; i++) { for (int i = 0; i < numMessages; i++) {
log.debug("got message {}", i); logger.debug("got message {}", i);
BytesMessage bm = (BytesMessage) consumer.receive(1000); BytesMessage bm = (BytesMessage) consumer.receive(1000);
@ -543,7 +543,7 @@ public class JMSFailoverTest extends ActiveMQTestBase {
backupJMSServer.setRegistry(new JndiBindingRegistry(ctx2)); backupJMSServer.setRegistry(new JndiBindingRegistry(ctx2));
backupJMSServer.getActiveMQServer().setIdentity("JMSBackup"); backupJMSServer.getActiveMQServer().setIdentity("JMSBackup");
log.debug("Starting backup"); logger.debug("Starting backup");
backupJMSServer.start(); backupJMSServer.start();
liveConf = createBasicConfig().setJournalDirectory(getJournalDir()).setBindingsDirectory(getBindingsDir()).setSecurityEnabled(false).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(livetc.getName())); liveConf = createBasicConfig().setJournalDirectory(getJournalDir()).setBindingsDirectory(getBindingsDir()).setSecurityEnabled(false).addAcceptorConfiguration(liveAcceptortc).setJournalType(getDefaultJournalType()).setBindingsDirectory(getBindingsDir()).setJournalMinFiles(2).setJournalDirectory(getJournalDir()).setPagingDirectory(getPageDir()).setLargeMessagesDirectory(getLargeMessagesDir()).addConnectorConfiguration(livetc.getName(), livetc).setPersistenceEnabled(true).setHAPolicyConfiguration(sharedStore ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()).addClusterConfiguration(basicClusterConnectionConfig(livetc.getName()));
@ -555,7 +555,7 @@ public class JMSFailoverTest extends ActiveMQTestBase {
liveJMSServer.setRegistry(new JndiBindingRegistry(ctx1)); liveJMSServer.setRegistry(new JndiBindingRegistry(ctx1));
liveJMSServer.getActiveMQServer().setIdentity("JMSLive"); liveJMSServer.getActiveMQServer().setIdentity("JMSLive");
log.debug("Starting live"); logger.debug("Starting live");
liveJMSServer.start(); liveJMSServer.start();

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.tests.integration.jms.cluster;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.Session; import javax.jms.Session;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import org.apache.activemq.artemis.api.core.TransportConfiguration; import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -26,9 +27,13 @@ import org.apache.activemq.artemis.api.jms.JMSFactoryType;
import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory; import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory;
import org.apache.activemq.artemis.tests.util.JMSClusteredTestBase; import org.apache.activemq.artemis.tests.util.JMSClusteredTestBase;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MultipleThreadsOpeningTest extends JMSClusteredTestBase { public class MultipleThreadsOpeningTest extends JMSClusteredTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
/** /**
* created for https://issues.apache.org/jira/browse/ARTEMIS-385 * created for https://issues.apache.org/jira/browse/ARTEMIS-385
*/ */
@ -39,7 +44,7 @@ public class MultipleThreadsOpeningTest extends JMSClusteredTestBase {
final int ITERATIONS = 50; final int ITERATIONS = 50;
for (int i = 0; i < ITERATIONS; i++) { for (int i = 0; i < ITERATIONS; i++) {
instanceLog.info("#test " + i); logger.info("#test " + i);
internalMultipleOpen(200, 1); internalMultipleOpen(200, 1);
tearDown(); tearDown();
setUp(); setUp();
@ -75,7 +80,7 @@ public class MultipleThreadsOpeningTest extends JMSClusteredTestBase {
for (int i = 0; i < numberOfOpens; i++) { for (int i = 0; i < numberOfOpens; i++) {
if (i > 0 && i % 100 == 0) if (i > 0 && i % 100 == 0)
instanceLog.debug("connections created on Thread " + Thread.currentThread() + " " + i); logger.debug("connections created on Thread " + Thread.currentThread() + " " + i);
Connection conn = cf1.createConnection(); Connection conn = cf1.createConnection();
Session sess = conn.createSession(true, Session.AUTO_ACKNOWLEDGE); Session sess = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
sess.close(); sess.close();

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.jms.consumer; package org.apache.activemq.artemis.tests.integration.jms.consumer;
import java.lang.invoke.MethodHandles;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -49,9 +50,13 @@ import org.apache.activemq.artemis.utils.ReusableLatch;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JmsConsumerTest extends JMSTestBase { public class JmsConsumerTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String Q_NAME = "ConsumerTestQueue"; private static final String Q_NAME = "ConsumerTestQueue";
private static final String T_NAME = "ConsumerTestTopic"; private static final String T_NAME = "ConsumerTestTopic";
@ -110,9 +115,9 @@ public class JmsConsumerTest extends JMSTestBase {
TextMessage m3 = (TextMessage) cons.receive(2000); TextMessage m3 = (TextMessage) cons.receive(2000);
Assert.assertNull("m3 should be null", m3); Assert.assertNull("m3 should be null", m3);
instanceLog.debug("received m1: " + m1.getText()); logger.debug("received m1: " + m1.getText());
instanceLog.debug("received m2: " + m2.getText()); logger.debug("received m2: " + m2.getText());
instanceLog.debug("received m3: " + m3); logger.debug("received m3: " + m3);
sess.commit(); sess.commit();
} }

View File

@ -26,6 +26,7 @@ import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
@ -36,15 +37,16 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JMSLargeMessageTest extends JMSTestBase { public class JMSLargeMessageTest extends JMSTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
Queue queue1; Queue queue1;
@Override @Override
protected boolean usePersistence() { protected boolean usePersistence() {
return true; return true;
@ -170,7 +172,7 @@ public class JMSLargeMessageTest extends JMSTestBase {
rm.setObjectProperty("JMS_AMQ_OutputStream", new OutputStream() { rm.setObjectProperty("JMS_AMQ_OutputStream", new OutputStream() {
@Override @Override
public void write(final int b) throws IOException { public void write(final int b) throws IOException {
instanceLog.debug("b = " + b); logger.debug("b = " + b);
} }
}); });
@ -225,7 +227,7 @@ public class JMSLargeMessageTest extends JMSTestBase {
public void write(final int b) throws IOException { public void write(final int b) throws IOException {
numberOfBytes.incrementAndGet(); numberOfBytes.incrementAndGet();
if (ActiveMQTestBase.getSamplebyte(position++) != b) { if (ActiveMQTestBase.getSamplebyte(position++) != b) {
instanceLog.warn("Wrong byte at position " + position); logger.warn("Wrong byte at position " + position);
numberOfErrors.incrementAndGet(); numberOfErrors.incrementAndGet();
} }
} }

View File

@ -22,6 +22,7 @@ import javax.jms.MessageProducer;
import javax.jms.Queue; import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.lang.invoke.MethodHandles;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -40,9 +41,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JMSServerStartStopTest extends ActiveMQTestBase { public class JMSServerStartStopTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private ActiveMQServer server; private ActiveMQServer server;
private Connection conn; private Connection conn;
@ -69,7 +74,7 @@ public class JMSServerStartStopTest extends ActiveMQTestBase {
final int numMessages = 5; final int numMessages = 5;
for (int j = 0; j < numMessages; j++) { for (int j = 0; j < numMessages; j++) {
instanceLog.debug("Iteration " + j); logger.debug("Iteration " + j);
server.start(); server.start();

View File

@ -33,6 +33,7 @@ import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.TabularDataSupport; import javax.management.openmbean.TabularDataSupport;
import javax.transaction.xa.XAResource; import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid; import javax.transaction.xa.Xid;
import java.lang.invoke.MethodHandles;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Arrays; import java.util.Arrays;
@ -93,12 +94,17 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.activemq.artemis.core.message.openmbean.CompositeDataConstants.BODY; import static org.apache.activemq.artemis.core.message.openmbean.CompositeDataConstants.BODY;
import static org.apache.activemq.artemis.core.message.openmbean.CompositeDataConstants.STRING_PROPERTIES; import static org.apache.activemq.artemis.core.message.openmbean.CompositeDataConstants.STRING_PROPERTIES;
@RunWith(value = Parameterized.class) @RunWith(value = Parameterized.class)
public class QueueControlTest extends ManagementTestBase { public class QueueControlTest extends ManagementTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String NULL_DATE = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(0)); private static final String NULL_DATE = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM).format(new Date(0));
@Rule @Rule
@ -3760,7 +3766,7 @@ public class QueueControlTest extends ManagementTestBase {
consumer.setMessageHandler(new MessageHandler() { consumer.setMessageHandler(new MessageHandler() {
@Override @Override
public void onMessage(ClientMessage message) { public void onMessage(ClientMessage message) {
instanceLog.debug("{}", message); logger.debug("{}", message);
} }
}); });
session.start(); session.start();

View File

@ -27,6 +27,7 @@ import javax.jms.Queue;
import javax.jms.Session; import javax.jms.Session;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.jms.Topic; import javax.jms.Topic;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -46,6 +47,8 @@ import org.apache.activemq.artemis.utils.CompositeAddress;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Verify FQQN queues work with openwire/artemis JMS API * Verify FQQN queues work with openwire/artemis JMS API
@ -53,6 +56,8 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class FQQNOpenWireTest extends OpenWireTestBase { public class FQQNOpenWireTest extends OpenWireTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> params() { public static Collection<Object[]> params() {
return Arrays.asList(new Object[][]{{"OpenWire"}, {"Artemis"}}); return Arrays.asList(new Object[][]{{"OpenWire"}, {"Artemis"}});
@ -107,7 +112,7 @@ public class FQQNOpenWireTest extends OpenWireTestBase {
Bindings bindings = server.getPostOffice().getBindingsForAddress(multicastAddress); Bindings bindings = server.getPostOffice().getBindingsForAddress(multicastAddress);
for (Binding b : bindings.getBindings()) { for (Binding b : bindings.getBindings()) {
instanceLog.debug("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages()); logger.debug("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages());
SimpleString qName = b.getUniqueName(); SimpleString qName = b.getUniqueName();
//do FQQN query //do FQQN query
QueueQueryResult result = server.queueQuery(CompositeAddress.toFullyQualified(multicastAddress, qName)); QueueQueryResult result = server.queueQuery(CompositeAddress.toFullyQualified(multicastAddress, qName));

View File

@ -47,6 +47,7 @@ import javax.jms.XASession;
import javax.transaction.xa.XAException; import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource; import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid; import javax.transaction.xa.Xid;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -84,9 +85,13 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SimpleOpenWireTest extends BasicOpenWireTest { public class SimpleOpenWireTest extends BasicOpenWireTest {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final String testString = "simple test string"; private final String testString = "simple test string";
private final String testProp = "BASE_DATE"; private final String testProp = "BASE_DATE";
private final String propValue = "2017-11-01"; private final String propValue = "2017-11-01";
@ -1515,7 +1520,7 @@ public class SimpleOpenWireTest extends BasicOpenWireTest {
break; break;
} else { } else {
duplicatedMessages = true; duplicatedMessages = true;
instanceLog.warn("received in duplicate:{}", txt.getText()); logger.warn("received in duplicate:{}", txt.getText());
} }
} }

View File

@ -2198,7 +2198,7 @@ public class PagingTest extends ActiveMQTestBase {
if (!deletedQueueReferences.isEmpty()) { if (!deletedQueueReferences.isEmpty()) {
for (Long value : deletedQueueReferences) { for (Long value : deletedQueueReferences) {
instanceLog.warn("Deleted Queue still has a reference:" + value); log.warn("Deleted Queue still has a reference:" + value);
} }
fail("Deleted queue still have references"); fail("Deleted queue still have references");

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.paging; package org.apache.activemq.artemis.tests.integration.paging;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.QueueConfiguration;
@ -32,9 +33,13 @@ import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.After; import org.junit.After;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase { public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
Process liveProcess; Process liveProcess;
Process backupProcess; Process backupProcess;
@ -206,10 +211,10 @@ public class PagingWithFailoverAndCountersTest extends ActiveMQTestBase {
} }
if (msgcount % 100 == 0) { if (msgcount % 100 == 0) {
instanceLog.debug("received " + msgcount + " on " + queueName); logger.debug("received " + msgcount + " on " + queueName);
} }
} catch (Throwable e) { } catch (Throwable e) {
instanceLog.warn("=====> expected Error at " + currentMsg + " with lastCommit=" + lastCommit); logger.warn("=====> expected Error at " + currentMsg + " with lastCommit=" + lastCommit);
} }
} }

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.tests.integration.persistence; package org.apache.activemq.artemis.tests.integration.persistence;
import java.io.File; import java.io.File;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
@ -33,10 +34,12 @@ import org.apache.activemq.artemis.utils.ExecutorFactory;
import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer; import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RestartSMTest extends ActiveMQTestBase { public class RestartSMTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
ExecutorService executor; ExecutorService executor;
@ -90,7 +93,7 @@ public class RestartSMTest extends ActiveMQTestBase {
try { try {
journal.stop(); journal.stop();
} catch (Exception ex) { } catch (Exception ex) {
instanceLog.warn(ex.getMessage(), ex); logger.warn(ex.getMessage(), ex);
} }
} }
} }

View File

@ -26,6 +26,7 @@ import javax.jms.Session;
import javax.resource.ResourceException; import javax.resource.ResourceException;
import javax.resource.spi.InvalidPropertyException; import javax.resource.spi.InvalidPropertyException;
import java.io.Serializable; import java.io.Serializable;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -46,9 +47,13 @@ import org.apache.activemq.artemis.ra.ActiveMQResourceAdapter;
import org.apache.activemq.artemis.ra.inflow.ActiveMQActivation; import org.apache.activemq.artemis.ra.inflow.ActiveMQActivation;
import org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec; import org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase { public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Override @Override
public boolean useSecurity() { public boolean useSecurity() {
return false; return false;
@ -1020,7 +1025,7 @@ public class ActiveMQMessageHandlerTest extends ActiveMQRATestBase {
latch.countDown(); latch.countDown();
if (pause && messages.getAndIncrement() % 2 == 0) { if (pause && messages.getAndIncrement() % 2 == 0) {
try { try {
instanceLog.debug("pausing for 2 secs"); logger.debug("pausing for 2 secs");
Thread.sleep(2000); Thread.sleep(2000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
interrupted.incrementAndGet(); interrupted.incrementAndGet();

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.server; package org.apache.activemq.artemis.tests.integration.server;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -32,9 +33,13 @@ import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FileLockTimeoutTest extends ActiveMQTestBase { public class FileLockTimeoutTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@BeforeClass @BeforeClass
public static void prepareLogger() { public static void prepareLogger() {
AssertionLoggerHandler.startCapture(); AssertionLoggerHandler.startCapture();
@ -85,7 +90,7 @@ public class FileLockTimeoutTest extends ActiveMQTestBase {
try { try {
f.get(15, TimeUnit.SECONDS); f.get(15, TimeUnit.SECONDS);
} catch (Exception e) { } catch (Exception e) {
instanceLog.warn("aborting test because server is taking too long to start"); logger.warn("aborting test because server is taking too long to start");
} }
service.shutdown(); service.shutdown();

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.server; package org.apache.activemq.artemis.tests.integration.server;
import java.lang.invoke.MethodHandles;
import java.util.ConcurrentModificationException; import java.util.ConcurrentModificationException;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@ -45,9 +46,13 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LVQTest extends ActiveMQTestBase { public class LVQTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Rule @Rule
public RetryRule retryRule = new RetryRule(2); public RetryRule retryRule = new RetryRule(2);
@ -182,7 +187,7 @@ public class LVQTest extends ActiveMQTestBase {
producer.send(m1); producer.send(m1);
clientSessionTxReceives.start(); clientSessionTxReceives.start();
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
instanceLog.debug("#Deliver " + i); logger.debug("#Deliver " + i);
ClientMessage m = consumer.receive(5000); ClientMessage m = consumer.receive(5000);
Assert.assertNotNull(m); Assert.assertNotNull(m);
m.acknowledge(); m.acknowledge();

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.server; package org.apache.activemq.artemis.tests.integration.server;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -37,9 +38,13 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PredefinedQueueTest extends ActiveMQTestBase { public class PredefinedQueueTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private Configuration configuration = null; private Configuration configuration = null;
@Override @Override
@ -301,7 +306,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase {
final int numMessages = 1; final int numMessages = 1;
instanceLog.debug("sending messages"); logger.debug("sending messages");
for (int i = 0; i < numMessages; i++) { for (int i = 0; i < numMessages; i++) {
ClientMessage message = session.createMessage(true); ClientMessage message = session.createMessage(true);
@ -313,7 +318,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase {
session.close(); session.close();
instanceLog.debug("stopping"); logger.debug("stopping");
sf.close(); sf.close();
@ -374,7 +379,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase {
final int numMessages = 1; final int numMessages = 1;
instanceLog.debug("sending messages"); logger.debug("sending messages");
for (int i = 0; i < numMessages; i++) { for (int i = 0; i < numMessages; i++) {
ClientMessage message = session.createMessage(true); ClientMessage message = session.createMessage(true);

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.activemq.artemis.tests.integration.server; package org.apache.activemq.artemis.tests.integration.server;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.apache.activemq.artemis.core.config.ScaleDownConfiguration; import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
@ -31,10 +33,13 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ScaleDownRemoveSFTest extends ClusterTestBase { public class ScaleDownRemoveSFTest extends ClusterTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Rule @Rule
public RetryRule retryRule = new RetryRule(3); public RetryRule retryRule = new RetryRule(3);
@ -102,7 +107,7 @@ public class ScaleDownRemoveSFTest extends ClusterTestBase {
ClusterConnectionImpl clusterconn1 = (ClusterConnectionImpl) servers[1].getClusterManager().getClusterConnection("cluster0"); ClusterConnectionImpl clusterconn1 = (ClusterConnectionImpl) servers[1].getClusterManager().getClusterConnection("cluster0");
SimpleString sfQueueName = clusterconn1.getSfQueueName(servers[0].getNodeID().toString()); SimpleString sfQueueName = clusterconn1.getSfQueueName(servers[0].getNodeID().toString());
instanceLog.debug("[sf queue on server 1]: " + sfQueueName); logger.debug("[sf queue on server 1]: " + sfQueueName);
Assert.assertTrue(servers[1].queueQuery(sfQueueName).isExists()); Assert.assertTrue(servers[1].queueQuery(sfQueueName).isExists());

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.stomp; package org.apache.activemq.artemis.tests.integration.stomp;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -35,10 +36,14 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class FQQNStompTest extends StompTestBase { public class FQQNStompTest extends StompTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private StompClientConnection conn; private StompClientConnection conn;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
@ -83,7 +88,7 @@ public class FQQNStompTest extends StompTestBase {
ClientStompFrame frame = conn.receiveFrame(2000); ClientStompFrame frame = conn.receiveFrame(2000);
assertNotNull(frame); assertNotNull(frame);
assertEquals("Hello World!", frame.getBody()); assertEquals("Hello World!", frame.getBody());
instanceLog.debug("frame: " + frame); logger.debug("frame: " + frame);
unsubscribe(conn, "sub-01"); unsubscribe(conn, "sub-01");
} }
@ -184,7 +189,7 @@ public class FQQNStompTest extends StompTestBase {
ClientStompFrame frame = conn.receiveFrame(2000); ClientStompFrame frame = conn.receiveFrame(2000);
assertNotNull(frame); assertNotNull(frame);
assertEquals("Hello World!", frame.getBody()); assertEquals("Hello World!", frame.getBody());
instanceLog.debug("frame: " + frame); logger.debug("frame: " + frame);
unsubscribe(conn, "sub-01"); unsubscribe(conn, "sub-01");
//queue:: //queue::

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.stomp; package org.apache.activemq.artemis.tests.integration.stomp;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,11 +34,15 @@ import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Ignore @Ignore
public class StompWithLargeMessagesTest extends StompTestBase { public class StompWithLargeMessagesTest extends StompTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
// Web Socket has max frame size of 64kb. Large message tests only available over TCP. // Web Socket has max frame size of 64kb. Large message tests only available over TCP.
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> data() { public static Collection<Object[]> data() {
@ -444,8 +449,8 @@ public class StompWithLargeMessagesTest extends StompTestBase {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
ClientStompFrame frame = conn.receiveFrame(60000); ClientStompFrame frame = conn.receiveFrame(60000);
Assert.assertNotNull(frame); Assert.assertNotNull(frame);
instanceLog.debug(frame.toString()); logger.debug(frame.toString());
instanceLog.debug("part of frame: " + frame.getBody().substring(0, 250)); logger.debug("part of frame: " + frame.getBody().substring(0, 250));
Assert.assertTrue(frame.getCommand().equals("MESSAGE")); Assert.assertTrue(frame.getCommand().equals("MESSAGE"));
Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName())); Assert.assertTrue(frame.getHeader("destination").equals(getQueuePrefix() + getQueueName()));
int index = frame.getBody().toString().indexOf(leadingPart); int index = frame.getBody().toString().indexOf(leadingPart);

View File

@ -16,6 +16,7 @@
*/ */
package org.apache.activemq.artemis.tests.integration.stomp.v11; package org.apache.activemq.artemis.tests.integration.stomp.v11;
import java.lang.invoke.MethodHandles;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
@ -31,6 +32,8 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/* /*
* Some Stomp tests against server with persistence enabled are put here. * Some Stomp tests against server with persistence enabled are put here.
@ -38,6 +41,8 @@ import org.junit.runners.Parameterized;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class ExtraStompTest extends StompTestBase { public class ExtraStompTest extends StompTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private StompClientConnection connV10; private StompClientConnection connV10;
private StompClientConnection connV11; private StompClientConnection connV11;
@ -198,10 +203,10 @@ public class ExtraStompTest extends StompTestBase {
// receive but don't ack // receive but don't ack
frame = conn.receiveFrame(10000); frame = conn.receiveFrame(10000);
instanceLog.debug("{}", frame); logger.debug("{}", frame);
frame = conn.receiveFrame(10000); frame = conn.receiveFrame(10000);
instanceLog.debug("{}", frame); logger.debug("{}", frame);
unsubscribe(conn, "a-sub"); unsubscribe(conn, "a-sub");

View File

@ -23,6 +23,7 @@ import javax.jms.MessageListener;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import java.io.IOException; import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.net.URI; import java.net.URI;
import java.nio.channels.ClosedChannelException; import java.nio.channels.ClosedChannelException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@ -53,12 +54,17 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/* /*
* *
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class StompV11Test extends StompTestBase { public class StompV11Test extends StompTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static final String CLIENT_ID = "myclientid"; public static final String CLIENT_ID = "myclientid";
private StompClientConnection conn; private StompClientConnection conn;
@ -230,7 +236,7 @@ public class StompV11Test extends StompTestBase {
assertEquals(Stomp.Responses.ERROR, reply.getCommand()); assertEquals(Stomp.Responses.ERROR, reply.getCommand());
instanceLog.debug("Got error frame " + reply); logger.debug("Got error frame " + reply);
} }
@ -281,7 +287,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame frame = newConn.receiveFrame(); ClientStompFrame frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); logger.debug("received " + frame);
assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
@ -295,7 +301,7 @@ public class StompV11Test extends StompTestBase {
frame = newConn.receiveFrame(); frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); logger.debug("received " + frame);
unsubscribe(newConn, "a-sub"); unsubscribe(newConn, "a-sub");
@ -315,7 +321,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame frame = newConn.receiveFrame(); ClientStompFrame frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); logger.debug("received " + frame);
assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
@ -350,7 +356,7 @@ public class StompV11Test extends StompTestBase {
frame = newConn.receiveFrame(); frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); logger.debug("received " + frame);
assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
@ -377,7 +383,7 @@ public class StompV11Test extends StompTestBase {
.addHeader(Stomp.Headers.CONTENT_LENGTH, cLen) .addHeader(Stomp.Headers.CONTENT_LENGTH, cLen)
.addHeader(hKey, hVal); .addHeader(hKey, hVal);
instanceLog.debug("key: |" + hKey + "| val: |" + hVal + "|"); logger.debug("key: |" + hKey + "| val: |" + hVal + "|");
frame.setBody(body); frame.setBody(body);
@ -391,7 +397,7 @@ public class StompV11Test extends StompTestBase {
frame = newConn.receiveFrame(); frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); logger.debug("received " + frame);
assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
@ -424,7 +430,7 @@ public class StompV11Test extends StompTestBase {
String hVal = "is\\ttab"; String hVal = "is\\ttab";
frame.addHeader(hKey, hVal); frame.addHeader(hKey, hVal);
instanceLog.debug("key: |" + hKey + "| val: |" + hVal + "|"); logger.debug("key: |" + hKey + "| val: |" + hVal + "|");
frame.setBody(body); frame.setBody(body);
@ -432,7 +438,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("received " + error); logger.debug("received " + error);
String desc = "Should have received an ERROR for undefined escape sequence"; String desc = "Should have received an ERROR for undefined escape sequence";
Assert.assertNotNull(desc, error); Assert.assertNotNull(desc, error);
@ -519,7 +525,7 @@ public class StompV11Test extends StompTestBase {
assertEquals("0,500", reply.getHeader(Stomp.Headers.Connect.HEART_BEAT)); assertEquals("0,500", reply.getHeader(Stomp.Headers.Connect.HEART_BEAT));
instanceLog.debug("========== start pinger!"); logger.debug("========== start pinger!");
conn.startPinger(500); conn.startPinger(500);
@ -568,7 +574,7 @@ public class StompV11Test extends StompTestBase {
assertEquals("1000,500", reply.getHeader(Stomp.Headers.Connect.HEART_BEAT)); assertEquals("1000,500", reply.getHeader(Stomp.Headers.Connect.HEART_BEAT));
instanceLog.debug("========== start pinger!"); logger.debug("========== start pinger!");
conn.startPinger(500); conn.startPinger(500);
@ -577,7 +583,7 @@ public class StompV11Test extends StompTestBase {
//now check the frame size //now check the frame size
int size = conn.getServerPingNumber(); int size = conn.getServerPingNumber();
instanceLog.debug("ping received: " + size); logger.debug("ping received: " + size);
assertTrue(size > 5); assertTrue(size > 5);
@ -784,7 +790,7 @@ public class StompV11Test extends StompTestBase {
reply = connection.sendFrame(frame); reply = connection.sendFrame(frame);
instanceLog.debug("Reply: " + reply); logger.debug("Reply: " + reply);
assertEquals(Stomp.Responses.CONNECTED, reply.getCommand()); assertEquals(Stomp.Responses.CONNECTED, reply.getCommand());
@ -846,7 +852,7 @@ public class StompV11Test extends StompTestBase {
assertEquals("0,2500", reply.getHeader(Stomp.Headers.Connect.HEART_BEAT)); assertEquals("0,2500", reply.getHeader(Stomp.Headers.Connect.HEART_BEAT));
instanceLog.debug("========== start pinger!"); logger.debug("========== start pinger!");
connection.startPinger(2500); connection.startPinger(2500);
@ -981,7 +987,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("Receiver error: " + error); logger.debug("Receiver error: " + error);
unsubscribe(conn, "sub1"); unsubscribe(conn, "sub1");
@ -1009,7 +1015,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("Receiver error: " + error); logger.debug("Receiver error: " + error);
unsubscribe(conn, "sub1"); unsubscribe(conn, "sub1");
@ -1061,7 +1067,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("Receiver error: " + error); logger.debug("Receiver error: " + error);
unsubscribe(conn, "sub1"); unsubscribe(conn, "sub1");
@ -1089,7 +1095,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("Receiver error: " + error); logger.debug("Receiver error: " + error);
unsubscribe(conn, "sub1"); unsubscribe(conn, "sub1");
@ -1121,7 +1127,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame error = conn.sendFrame(ackFrame); ClientStompFrame error = conn.sendFrame(ackFrame);
instanceLog.debug("Receiver error: " + error); logger.debug("Receiver error: " + error);
assertEquals(Stomp.Responses.ERROR, error.getCommand()); assertEquals(Stomp.Responses.ERROR, error.getCommand());
@ -1157,7 +1163,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame error = conn.sendFrame(ackFrame); ClientStompFrame error = conn.sendFrame(ackFrame);
instanceLog.debug("Receiver error: " + error); logger.debug("Receiver error: " + error);
assertEquals(Stomp.Responses.ERROR, error.getCommand()); assertEquals(Stomp.Responses.ERROR, error.getCommand());
@ -1289,7 +1295,7 @@ public class StompV11Test extends StompTestBase {
frame = conn.receiveFrame(); frame = conn.receiveFrame();
assertNotNull(frame); assertNotNull(frame);
instanceLog.debug(i + " == received: " + frame); logger.debug(i + " == received: " + frame);
//ack on even numbers //ack on even numbers
if (i % 2 == 0) { if (i % 2 == 0) {
ack(conn, "sub1", frame); ack(conn, "sub1", frame);
@ -1307,7 +1313,7 @@ public class StompV11Test extends StompTestBase {
for (int i = 0; i < num / 2; i++) { for (int i = 0; i < num / 2; i++) {
message = (TextMessage) consumer.receive(1000); message = (TextMessage) consumer.receive(1000);
Assert.assertNotNull(message); Assert.assertNotNull(message);
instanceLog.debug("Legal: " + message.getText()); logger.debug("Legal: " + message.getText());
} }
message = (TextMessage) consumer.receive(100); message = (TextMessage) consumer.receive(100);
@ -1331,13 +1337,13 @@ public class StompV11Test extends StompTestBase {
// receive message from socket // receive message from socket
ClientStompFrame frame = conn.receiveFrame(5000); ClientStompFrame frame = conn.receiveFrame(5000);
instanceLog.debug("received frame : " + frame); logger.debug("received frame : " + frame);
assertEquals("Hello World", frame.getBody()); assertEquals("Hello World", frame.getBody());
assertEquals("sub1", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION)); assertEquals("sub1", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION));
frame = newConn.receiveFrame(5000); frame = newConn.receiveFrame(5000);
instanceLog.debug("received 2 frame : " + frame); logger.debug("received 2 frame : " + frame);
assertEquals("Hello World", frame.getBody()); assertEquals("Hello World", frame.getBody());
assertEquals("sub2", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION)); assertEquals("sub2", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION));
@ -1390,11 +1396,11 @@ public class StompV11Test extends StompTestBase {
subscribe(conn, getName(), Stomp.Headers.Subscribe.AckModeValues.AUTO); subscribe(conn, getName(), Stomp.Headers.Subscribe.AckModeValues.AUTO);
String text = "A" + "\u00ea" + "\u00f1" + "\u00fc" + "C"; String text = "A" + "\u00ea" + "\u00f1" + "\u00fc" + "C";
instanceLog.debug(text); logger.debug(text);
sendJmsMessage(text); sendJmsMessage(text);
ClientStompFrame frame = conn.receiveFrame(); ClientStompFrame frame = conn.receiveFrame();
instanceLog.debug("{}", frame); logger.debug("{}", frame);
Assert.assertTrue(frame.getCommand().equals(Stomp.Responses.MESSAGE)); Assert.assertTrue(frame.getCommand().equals(Stomp.Responses.MESSAGE));
Assert.assertNotNull(frame.getHeader(Stomp.Headers.Message.DESTINATION)); Assert.assertNotNull(frame.getHeader(Stomp.Headers.Message.DESTINATION));
Assert.assertTrue(frame.getBody().equals(text)); Assert.assertTrue(frame.getBody().equals(text));
@ -1959,7 +1965,7 @@ public class StompV11Test extends StompTestBase {
assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
instanceLog.debug("Message: " + frame); logger.debug("Message: " + frame);
assertEquals("5", frame.getHeader(Stomp.Headers.CONTENT_LENGTH)); assertEquals("5", frame.getHeader(Stomp.Headers.CONTENT_LENGTH));
@ -2203,7 +2209,7 @@ public class StompV11Test extends StompTestBase {
assertEquals("500,500", reply.getHeader("heart-beat")); assertEquals("500,500", reply.getHeader("heart-beat"));
instanceLog.debug("========== start pinger!"); logger.debug("========== start pinger!");
conn.startPinger(100); conn.startPinger(100);
@ -2236,7 +2242,7 @@ public class StompV11Test extends StompTestBase {
ClientStompFrame reply = conn.sendFrame(frame); ClientStompFrame reply = conn.sendFrame(frame);
instanceLog.debug("Reply: " + reply.toString()); logger.debug("Reply: " + reply.toString());
assertEquals("CONNECTED", reply.getCommand()); assertEquals("CONNECTED", reply.getCommand());
@ -2253,7 +2259,7 @@ public class StompV11Test extends StompTestBase {
StompFrameHandlerV11 stompFrameHandler = (StompFrameHandlerV11) stompConnection.getStompVersionHandler(); StompFrameHandlerV11 stompFrameHandler = (StompFrameHandlerV11) stompConnection.getStompVersionHandler();
instanceLog.debug("========== start pinger!"); logger.debug("========== start pinger!");
conn.startPinger(100); conn.startPinger(100);
@ -2268,7 +2274,7 @@ public class StompV11Test extends StompTestBase {
f = conn.sendFrame(subFrame); f = conn.sendFrame(subFrame);
f = conn.receiveFrame(1000); f = conn.receiveFrame(1000);
instanceLog.debug("Received " + f.toString()); logger.debug("Received " + f.toString());
Assert.assertTrue(f.getCommand().equals("ERROR")); Assert.assertTrue(f.getCommand().equals("ERROR"));
conn.stopPinger(); conn.stopPinger();
@ -2290,7 +2296,7 @@ public class StompV11Test extends StompTestBase {
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
instanceLog.info("Reconnecting!"); logger.info("Reconnecting!");
if (sendDisconnect) { if (sendDisconnect) {
conn.disconnect(); conn.disconnect();

View File

@ -266,7 +266,7 @@ public class StompV12Test extends StompTestBase {
conn.disconnect(); conn.disconnect();
instanceLog.debug("Got error frame " + reply); log.debug("Got error frame " + reply);
} }
@ -287,7 +287,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame frame = newConn.receiveFrame(); ClientStompFrame frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); log.debug("received " + frame);
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
@ -302,7 +302,7 @@ public class StompV12Test extends StompTestBase {
frame = newConn.receiveFrame(); frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); log.debug("received " + frame);
//unsub //unsub
unsubscribe(newConn, "a-sub"); unsubscribe(newConn, "a-sub");
@ -323,7 +323,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame frame = newConn.receiveFrame(); ClientStompFrame frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); log.debug("received " + frame);
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
@ -421,7 +421,7 @@ public class StompV12Test extends StompTestBase {
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
Assert.assertEquals(body, frame.getBody()); Assert.assertEquals(body, frame.getBody());
instanceLog.debug("received: " + frame); log.debug("received: " + frame);
Assert.assertEquals("value1", frame.getHeader("foo")); Assert.assertEquals("value1", frame.getHeader("foo"));
//unsub //unsub
@ -479,7 +479,7 @@ public class StompV12Test extends StompTestBase {
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
Assert.assertEquals(body, frame.getBody()); Assert.assertEquals(body, frame.getBody());
instanceLog.debug("received: " + frame); log.debug("received: " + frame);
Assert.assertEquals(null, frame.getHeader("header1")); Assert.assertEquals(null, frame.getHeader("header1"));
Assert.assertEquals("value1 ", frame.getHeader(" header1")); Assert.assertEquals("value1 ", frame.getHeader(" header1"));
Assert.assertEquals("value2 ", frame.getHeader(" header2")); Assert.assertEquals("value2 ", frame.getHeader(" header2"));
@ -512,7 +512,7 @@ public class StompV12Test extends StompTestBase {
.addHeader(hKey, hVal) .addHeader(hKey, hVal)
.setBody(body); .setBody(body);
instanceLog.debug("key: |" + hKey + "| val: |" + hVal + "|"); log.debug("key: |" + hKey + "| val: |" + hVal + "|");
conn.sendFrame(frame); conn.sendFrame(frame);
@ -524,7 +524,7 @@ public class StompV12Test extends StompTestBase {
frame = newConn.receiveFrame(); frame = newConn.receiveFrame();
instanceLog.debug("received " + frame); log.debug("received " + frame);
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
@ -556,7 +556,7 @@ public class StompV12Test extends StompTestBase {
String hVal = "is\\ttab"; String hVal = "is\\ttab";
frame.addHeader(hKey, hVal); frame.addHeader(hKey, hVal);
instanceLog.debug("key: |" + hKey + "| val: |" + hVal + "|"); log.debug("key: |" + hKey + "| val: |" + hVal + "|");
frame.setBody(body); frame.setBody(body);
@ -564,7 +564,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("received " + error); log.debug("received " + error);
String desc = "Should have received an ERROR for undefined escape sequence"; String desc = "Should have received an ERROR for undefined escape sequence";
Assert.assertNotNull(desc, error); Assert.assertNotNull(desc, error);
@ -707,7 +707,7 @@ public class StompV12Test extends StompTestBase {
//now check the frame size //now check the frame size
int size = conn.getServerPingNumber(); int size = conn.getServerPingNumber();
instanceLog.debug("ping received: " + size); log.debug("ping received: " + size);
Assert.assertTrue("size: " + size, size > 5); Assert.assertTrue("size: " + size, size > 5);
@ -936,7 +936,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("Receiver error: " + error); log.debug("Receiver error: " + error);
waitDisconnect(conn); waitDisconnect(conn);
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", conn.isConnected()); Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", conn.isConnected());
@ -1020,7 +1020,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame error = conn.receiveFrame(); ClientStompFrame error = conn.receiveFrame();
instanceLog.debug("Receiver error: " + error); log.debug("Receiver error: " + error);
waitDisconnect(conn); waitDisconnect(conn);
Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", conn.isConnected()); Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", conn.isConnected());
@ -1051,7 +1051,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame error = conn.sendFrame(ackFrame); ClientStompFrame error = conn.sendFrame(ackFrame);
instanceLog.debug("Receiver error: " + error); log.debug("Receiver error: " + error);
Assert.assertEquals(Stomp.Responses.ERROR, error.getCommand()); Assert.assertEquals(Stomp.Responses.ERROR, error.getCommand());
@ -1086,7 +1086,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame error = conn.sendFrame(ackFrame); ClientStompFrame error = conn.sendFrame(ackFrame);
instanceLog.debug("Receiver error: " + error); log.debug("Receiver error: " + error);
Assert.assertEquals(Stomp.Responses.ERROR, error.getCommand()); Assert.assertEquals(Stomp.Responses.ERROR, error.getCommand());
@ -1254,7 +1254,7 @@ public class StompV12Test extends StompTestBase {
frame = conn.receiveFrame(); frame = conn.receiveFrame();
Assert.assertNotNull(frame); Assert.assertNotNull(frame);
instanceLog.debug(i + " == received: " + frame); log.debug(i + " == received: " + frame);
//ack on even numbers //ack on even numbers
if (i % 2 == 0) { if (i % 2 == 0) {
ack(conn, frame); ack(conn, frame);
@ -1272,7 +1272,7 @@ public class StompV12Test extends StompTestBase {
for (int i = 0; i < num / 2; i++) { for (int i = 0; i < num / 2; i++) {
message = (TextMessage) consumer.receive(1000); message = (TextMessage) consumer.receive(1000);
Assert.assertNotNull(message); Assert.assertNotNull(message);
instanceLog.debug("Legal: " + message.getText()); log.debug("Legal: " + message.getText());
} }
message = (TextMessage) consumer.receiveNoWait(); message = (TextMessage) consumer.receiveNoWait();
@ -1296,13 +1296,13 @@ public class StompV12Test extends StompTestBase {
// receive message from socket // receive message from socket
ClientStompFrame frame = conn.receiveFrame(1000); ClientStompFrame frame = conn.receiveFrame(1000);
instanceLog.debug("received frame : " + frame); log.debug("received frame : " + frame);
Assert.assertEquals("Hello World", frame.getBody()); Assert.assertEquals("Hello World", frame.getBody());
Assert.assertEquals("sub1", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION)); Assert.assertEquals("sub1", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION));
frame = newConn.receiveFrame(1000); frame = newConn.receiveFrame(1000);
instanceLog.debug("received 2 frame : " + frame); log.debug("received 2 frame : " + frame);
Assert.assertEquals("Hello World", frame.getBody()); Assert.assertEquals("Hello World", frame.getBody());
Assert.assertEquals("sub2", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION)); Assert.assertEquals("sub2", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION));
@ -1355,11 +1355,11 @@ public class StompV12Test extends StompTestBase {
subscribe(conn, getName(), Stomp.Headers.Subscribe.AckModeValues.AUTO); subscribe(conn, getName(), Stomp.Headers.Subscribe.AckModeValues.AUTO);
String text = "A" + "\u00ea" + "\u00f1" + "\u00fc" + "C"; String text = "A" + "\u00ea" + "\u00f1" + "\u00fc" + "C";
instanceLog.debug(text); log.debug(text);
sendJmsMessage(text); sendJmsMessage(text);
ClientStompFrame frame = conn.receiveFrame(); ClientStompFrame frame = conn.receiveFrame();
instanceLog.debug("{}", frame); log.debug("{}", frame);
Assert.assertTrue(frame.getCommand().equals(Stomp.Responses.MESSAGE)); Assert.assertTrue(frame.getCommand().equals(Stomp.Responses.MESSAGE));
Assert.assertNotNull(frame.getHeader(Stomp.Headers.Subscribe.DESTINATION)); Assert.assertNotNull(frame.getHeader(Stomp.Headers.Subscribe.DESTINATION));
Assert.assertTrue(frame.getBody().equals(text)); Assert.assertTrue(frame.getBody().equals(text));
@ -1705,7 +1705,7 @@ public class StompV12Test extends StompTestBase {
TextMessage m = (TextMessage) arg0; TextMessage m = (TextMessage) arg0;
latch.countDown(); latch.countDown();
try { try {
instanceLog.debug("___> latch now: " + latch.getCount() + " m: " + m.getText()); log.debug("___> latch now: " + latch.getCount() + " m: " + m.getText());
} catch (JMSException e) { } catch (JMSException e) {
Assert.fail("here failed"); Assert.fail("here failed");
e.printStackTrace(); e.printStackTrace();
@ -1996,7 +1996,7 @@ public class StompV12Test extends StompTestBase {
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
instanceLog.debug("Message: " + frame); log.debug("Message: " + frame);
Assert.assertEquals("5", frame.getHeader(Stomp.Headers.CONTENT_LENGTH)); Assert.assertEquals("5", frame.getHeader(Stomp.Headers.CONTENT_LENGTH));
@ -2352,7 +2352,7 @@ public class StompV12Test extends StompTestBase {
ClientStompFrame frame = conn.receiveFrame(); ClientStompFrame frame = conn.receiveFrame();
instanceLog.debug("Received: " + frame); log.debug("Received: " + frame);
Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand()); Assert.assertEquals(Stomp.Responses.MESSAGE, frame.getCommand());
Assert.assertEquals("ID:MYMACHINE-50616-635482262727823605-1:1:1:1", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION)); Assert.assertEquals("ID:MYMACHINE-50616-635482262727823605-1:1:1:1", frame.getHeader(Stomp.Headers.Message.SUBSCRIPTION));

View File

@ -675,7 +675,7 @@ public class BasicXaTest extends ActiveMQTestBase {
String[] preparedTransactions = messagingService.getActiveMQServerControl().listPreparedTransactions(); String[] preparedTransactions = messagingService.getActiveMQServerControl().listPreparedTransactions();
Assert.assertEquals(1, preparedTransactions.length); Assert.assertEquals(1, preparedTransactions.length);
instanceLog.debug(preparedTransactions[0]); log.debug(preparedTransactions[0]);
Assert.assertTrue(messagingService.getActiveMQServerControl().commitPreparedTransaction(XidImpl.toBase64String(xid))); Assert.assertTrue(messagingService.getActiveMQServerControl().commitPreparedTransaction(XidImpl.toBase64String(xid)));
Assert.assertEquals(1, messagingService.getActiveMQServerControl().listHeuristicCommittedTransactions().length); Assert.assertEquals(1, messagingService.getActiveMQServerControl().listHeuristicCommittedTransactions().length);
@ -693,7 +693,7 @@ public class BasicXaTest extends ActiveMQTestBase {
String[] preparedTransactions = messagingService.getActiveMQServerControl().listPreparedTransactions(); String[] preparedTransactions = messagingService.getActiveMQServerControl().listPreparedTransactions();
Assert.assertEquals(1, preparedTransactions.length); Assert.assertEquals(1, preparedTransactions.length);
instanceLog.debug(preparedTransactions[0]); log.debug(preparedTransactions[0]);
Assert.assertTrue(messagingService.getActiveMQServerControl().rollbackPreparedTransaction(XidImpl.toBase64String(xid))); Assert.assertTrue(messagingService.getActiveMQServerControl().rollbackPreparedTransaction(XidImpl.toBase64String(xid)));
Assert.assertEquals(1, messagingService.getActiveMQServerControl().listHeuristicRolledBackTransactions().length); Assert.assertEquals(1, messagingService.getActiveMQServerControl().listHeuristicRolledBackTransactions().length);

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.xa;
import javax.transaction.xa.XAException; import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource; import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid; import javax.transaction.xa.Xid;
import java.lang.invoke.MethodHandles;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -58,10 +59,14 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class XaTimeoutTest extends ActiveMQTestBase { public class XaTimeoutTest extends ActiveMQTestBase {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private final Map<String, AddressSettings> addressSettings = new HashMap<>(); private final Map<String, AddressSettings> addressSettings = new HashMap<>();
private ActiveMQServer server; private ActiveMQServer server;
@ -421,7 +426,7 @@ public class XaTimeoutTest extends ActiveMQTestBase {
boolean rollback = false; boolean rollback = false;
if (msgCount.getAndIncrement() == 0) { if (msgCount.getAndIncrement() == 0) {
rollback = true; rollback = true;
instanceLog.debug("Forcing first message to time out"); logger.debug("Forcing first message to time out");
Thread.sleep(5000); Thread.sleep(5000);
} }