ARTEMIS-2732 Cleanup on testsuite logging

This commit is contained in:
Clebert Suconic 2020-04-21 17:24:14 -04:00
parent 101db39d46
commit 3541ebf218
363 changed files with 1677 additions and 2354 deletions

View File

@ -13,7 +13,7 @@ before_install:
# By setting anything to org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED we are disabling libaio loading on the testsuite
script:
- set -e
- mvn -Dorg.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED=AnythingNotNull -Pfast-tests -Pextra-tests -B install -q
- mvn -Dorg.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED=AnythingNotNull -Pfast-tests -Pextra-tests -Ptests-CI -B install -q
- cd examples
- mvn install -Prelease install -B -q

View File

@ -21,6 +21,7 @@ import java.nio.ReadOnlyBufferException;
import java.util.Arrays;
import io.netty.util.internal.PlatformDependent;
import org.jboss.logging.Logger;
import org.junit.Assert;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
@ -30,6 +31,8 @@ import org.junit.Test;
public class ByteUtilTest {
private static Logger log = Logger.getLogger(ByteUtilTest.class);
@Test
public void testBytesToString() {
byte[] byteArray = new byte[]{0, 1, 2, 3};
@ -43,14 +46,13 @@ public class ByteUtilTest {
public void testNonASCII() {
assertEquals("aA", ByteUtil.toSimpleString(new byte[]{97, 0, 65, 0}));
assertEquals(ByteUtil.NON_ASCII_STRING, ByteUtil.toSimpleString(new byte[]{0, 97, 0, 65}));
System.out.println(ByteUtil.toSimpleString(new byte[]{0, 97, 0, 65}));
log.debug(ByteUtil.toSimpleString(new byte[]{0, 97, 0, 65}));
}
@Test
public void testMaxString() {
byte[] byteArray = new byte[20 * 1024];
System.out.println(ByteUtil.maxString(ByteUtil.bytesToHex(byteArray, 2), 150));
log.debug(ByteUtil.maxString(ByteUtil.bytesToHex(byteArray, 2), 150));
}
void testEquals(String string1, String string2) {

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.utils;
import org.jboss.logging.Logger;
import org.junit.Test;
import java.util.HashMap;
@ -28,6 +29,8 @@ import static org.junit.Assert.fail;
public class DefaultSensitiveStringCodecTest {
private static final Logger log = Logger.getLogger(DefaultSensitiveStringCodecTest.class);
@Test
public void testDefaultAlgorithm() throws Exception {
SensitiveDataCodec<String> codec = PasswordMaskingUtil.getDefaultCodec();
@ -43,7 +46,7 @@ public class DefaultSensitiveStringCodecTest {
String plainText = "some_password";
String maskedText = codec.encode(plainText);
System.out.println("encoded value: " + maskedText);
log.debug("encoded value: " + maskedText);
//one way can't decode
try {
@ -67,10 +70,10 @@ public class DefaultSensitiveStringCodecTest {
String plainText = "some_password";
String maskedText = codec.encode(plainText);
System.out.println("encoded value: " + maskedText);
log.debug("encoded value: " + maskedText);
String decoded = codec.decode(maskedText);
System.out.println("encoded value: " + maskedText);
log.debug("encoded value: " + maskedText);
assertEquals("decoded result not match: " + decoded, decoded, plainText);
}

View File

@ -61,7 +61,6 @@ public class MaskPasswordResolvingTest {
@Test
public void testPasswordResolving() throws Exception {
String resolved = PasswordMaskingUtil.resolveMask(maskPassword, password, codec);
System.out.println("resolved: " + resolved);
checkResult(resolved);
}

View File

@ -152,7 +152,6 @@ public class NetworkHealthTest {
public void run() {
super.run();
latch.countDown();
System.out.println("Check");
}
});
check.addComponent(component);

View File

@ -79,10 +79,10 @@ public class RetryRule implements MethodRule {
currentException = null;
try {
base.evaluate();
logger.info("RETRY " + (retryNr + 1) + " of " + retries + " on " + target.getClass() + "::" + method.getName() + " succeeded");
logger.warn("RETRY " + (retryNr + 1) + " of " + retries + " on " + target.getClass() + "::" + method.getName() + " succeeded");
break;
} catch (Throwable t2) {
logger.info("RETRY " + (retryNr + 1) + " of " + retries + " on " + target.getClass() + "::" + method.getName() + " failed ", t2);
logger.warn("RETRY " + (retryNr + 1) + " of " + retries + " on " + target.getClass() + "::" + method.getName() + " failed ", t2);
currentException = t2;
}
}

View File

@ -94,7 +94,6 @@ public class URIParserTest {
FruitParser parser = new FruitParser();
Fruit fruit = (Fruit) parser.newObject(new URI("fruit://some:guy@port?color=green&fluentName=something"), null);
System.out.println("fruit:" + fruit);
Assert.assertEquals("fruit", fruit.getName());
Assert.assertEquals("green", fruit.getColor());
Assert.assertEquals("something", fruit.getFluentName());
@ -104,22 +103,18 @@ public class URIParserTest {
public void testQueryConversion() throws Exception {
Map<String, String> query = new HashMap<>();
String queryString = URISupport.createQueryString(query);
System.out.println("queryString1: " + queryString);
Assert.assertTrue(queryString.isEmpty());
query.put("key1", "value1");
queryString = URISupport.createQueryString(query);
System.out.println("queryString2: " + queryString);
Assert.assertEquals("key1=value1", queryString);
query.put("key3", "value3");
queryString = URISupport.createQueryString(query);
System.out.println("queryString3: " + queryString);
Assert.assertEquals("key1=value1&key3=value3", queryString);
query.put("key2", "value2");
queryString = URISupport.createQueryString(query);
System.out.println("queryString4: " + queryString);
Assert.assertEquals("key1=value1&key2=value2&key3=value3", queryString);
}

View File

@ -56,7 +56,6 @@ public class CriticalAnalyzerTest {
analyzer.start();
analyzer.addAction((CriticalComponent comp) -> {
System.out.println("component " + comp + " received");
latch.countDown();
});
@ -72,7 +71,6 @@ public class CriticalAnalyzerTest {
analyzer = new CriticalAnalyzerImpl().setTimeout(10, TimeUnit.MILLISECONDS).setCheckTime(5, TimeUnit.MILLISECONDS);
analyzer.addAction((CriticalComponent comp) -> {
System.out.println("component " + comp + " received");
latch.countDown();
});
@ -119,7 +117,6 @@ public class CriticalAnalyzerTest {
analyzer = new CriticalAnalyzerImpl().setTimeout(10, TimeUnit.MILLISECONDS).setCheckTime(5, TimeUnit.MILLISECONDS);
analyzer.addAction((CriticalComponent comp) -> {
System.out.println("component " + comp + " received");
latch.countDown();
});
@ -143,7 +140,6 @@ public class CriticalAnalyzerTest {
analyzer = new CriticalAnalyzerImpl().setTimeout(10, TimeUnit.MILLISECONDS).setCheckTime(5, TimeUnit.MILLISECONDS);
analyzer.addAction((CriticalComponent comp) -> {
System.out.println("component " + comp + " received");
latch.countDown();
});

View File

@ -41,13 +41,11 @@ public class TransportConfigurationTest {
HashMap<String, Object> configMap2 = new HashMap<>();
configMap2.put("host", "localhost");
System.out.println("Equals::" + configMap1.equals(configMap2));
configuration = new TransportConfiguration("SomeClass", configMap1, null);
configuration2 = new TransportConfiguration("SomeClass", configMap2, null);
Assert.assertEquals(configuration, configuration2);
Assert.assertEquals(configuration.hashCode(), configuration2.hashCode());
System.out.println("Equals::" + configMap1.equals(configMap2));
configuration = new TransportConfiguration("SomeClass", configMap1, "name1");
configuration2 = new TransportConfiguration("SomeClass", configMap2, "name2");
Assert.assertNotEquals(configuration, configuration2);

View File

@ -31,7 +31,6 @@ import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionRec
import org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendMessage;
import org.apache.activemq.artemis.reader.TextMessageUtil;
import org.apache.activemq.artemis.utils.Base64;
import org.apache.activemq.artemis.utils.ByteUtil;
import org.apache.activemq.artemis.utils.UUID;
import org.junit.Assert;
import org.junit.Before;
@ -104,7 +103,7 @@ public class CoreMessageTest {
ActiveMQBuffer buffer = sendMessage.encode(null);
byte[] byteArray = buffer.byteBuf().array();
System.out.println("Sending " + ByteUtil.bytesToHex(buffer.toByteBuffer().array(), 1) + ", bytes = " + byteArray.length);
//System.out.println("Sending " + ByteUtil.bytesToHex(buffer.toByteBuffer().array(), 1) + ", bytes = " + byteArray.length);
buffer.readerIndex(5);
@ -215,9 +214,7 @@ public class CoreMessageTest {
@Test
public void testSaveReceiveLimitedBytes() {
CoreMessage empty = new CoreMessage().initBuffer(100);
System.out.println("R " + empty.getBodyBuffer().readerIndex() + " W " + empty.getBodyBuffer().writerIndex());
empty.getBodyBuffer().writeByte((byte)7);
System.out.println("R " + empty.getBodyBuffer().readerIndex() + " W " + empty.getBodyBuffer().writerIndex());
ByteBuf buffer = Unpooled.buffer(200);
empty.sendBuffer(buffer, 0);
@ -227,8 +224,6 @@ public class CoreMessageTest {
Assert.assertEquals((byte)7, empty2.getBodyBuffer().readByte());
System.out.println("Readable :: " + empty2.getBodyBuffer().readerIndex() + " writer :" + empty2.getBodyBuffer().writerIndex());
try {
empty2.getBodyBuffer().readByte();
Assert.fail("should throw exception");

View File

@ -77,8 +77,6 @@ public class TimeAndCounterIDGeneratorTest extends Assert {
final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
System.out.println("Time = " + TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + ", " + seq);
final int NUMBER_OF_THREADS = 100;
final int NUMBER_OF_IDS = 10;
@ -143,8 +141,6 @@ public class TimeAndCounterIDGeneratorTest extends Assert {
public void testWrapID() throws Throwable {
TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();
System.out.println("Current Time = " + TimeAndCounterIDGeneratorTest.hex(System.currentTimeMillis()) + " " + seq);
seq.setInternalDate(System.currentTimeMillis() + 10000L); // 10 seconds in the future
seq.setInternalID(TimeAndCounterIDGenerator.ID_MASK); // 1 ID about to explode

View File

@ -42,7 +42,6 @@ public class FileIOUtilTest {
@Test
public void testCopy() throws Exception {
System.out.println("Data at " + temporaryFolder.getRoot());
SequentialFileFactory factory = new NIOSequentialFileFactory(temporaryFolder.getRoot(), 100);
SequentialFile file = factory.createSequentialFile("file1.bin");
file.open();
@ -78,8 +77,6 @@ public class FileIOUtilTest {
file.close();
file2.close();
System.out.println("Test result::");
}
}

View File

@ -31,6 +31,7 @@ import org.apache.activemq.artemis.rest.test.TransformTest;
import org.apache.activemq.artemis.rest.test.Util;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -43,6 +44,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class EmbeddedRestActiveMQJMSTest {
private static final Logger log = Logger.getLogger(EmbeddedRestActiveMQJMSTest.class);
private static EmbeddedRestActiveMQ server;
private static ConnectionFactory factory;
@ -67,12 +69,12 @@ public class EmbeddedRestActiveMQJMSTest {
response.releaseConnection();
assertEquals(200, response.getStatus());
Link sender = response.getLinkHeader().getLinkByTitle("create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = response.getLinkHeader().getLinkByTitle("pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
consumeNext = response.getLinkHeader().getLinkByTitle("consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
}
@AfterClass

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -26,6 +27,7 @@ import org.junit.Assert;
import org.junit.Test;
public class AutoAckQueueTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(AutoAckQueueTest.class);
@Test
public void testSuccessFirst() throws Exception {
@ -42,18 +44,18 @@ public class AutoAckQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
System.out.println("create-with-id: " + getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create-with-id"));
log.debug("pull: " + consumers);
log.debug("create-with-id: " + getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create-with-id"));
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println("create-next: " + getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "create-next"));
log.debug("create-next: " + getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "create-next"));
res = sender.request().body("text/plain", Integer.toString(2)).post();
res.releaseConnection();
@ -64,19 +66,19 @@ public class AutoAckQueueTest extends MessageTestBase {
Assert.assertEquals("1", res.getEntity(String.class));
res.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
System.out.println(consumeNext);
log.debug(consumeNext);
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals("2", res.getEntity(String.class));
res.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = session.request().delete();
res.releaseConnection();

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.topic.TopicDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -25,6 +26,7 @@ import org.junit.Assert;
import org.junit.Test;
public class AutoAckTopicTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(AutoAckTopicTest.class);
@Test
public void testSuccessFirst() throws Exception {
@ -50,7 +52,7 @@ public class AutoAckTopicTest extends MessageTestBase {
Assert.assertNotNull(sub1);
Link consumeNext1 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
Assert.assertNotNull(consumeNext1);
System.out.println("consumeNext1: " + consumeNext1);
log.debug("consumeNext1: " + consumeNext1);
res = subscriptions.request().post();
res.releaseConnection();
@ -59,7 +61,7 @@ public class AutoAckTopicTest extends MessageTestBase {
Assert.assertNotNull(sub2);
Link consumeNext2 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
Assert.assertNotNull(consumeNext2);
System.out.println("consumeNext2: " + consumeNext2);
log.debug("consumeNext2: " + consumeNext2);
res = sender.request().body("text/plain", "1").post();
res.releaseConnection();
@ -169,11 +171,11 @@ public class AutoAckTopicTest extends MessageTestBase {
ClientRequest request = new ClientRequest(url);
ClientResponse<?> response = request.post();
response.releaseConnection();
System.out.println("NPS response: " + response.getStatus());
log.debug("NPS response: " + response.getStatus());
Assert.assertEquals(201, response.getStatus());
isFinished = true;
} catch (Exception e) {
System.out.println("Exception " + e);
log.debug("Exception " + e);
failed = true;
}
}

View File

@ -20,6 +20,7 @@ import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.apache.activemq.artemis.rest.util.CustomHeaderLinkStrategy;
import org.apache.activemq.artemis.rest.util.LinkHeaderLinkStrategy;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -30,6 +31,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class ClientAckQueueTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(ClientAckQueueTest.class);
@BeforeClass
public static void setup() throws Exception {
@ -58,12 +60,12 @@ public class ClientAckQueueTest extends MessageTestBase {
ClientResponse<?> response = Util.head(request);
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
{
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
@ -74,12 +76,12 @@ public class ClientAckQueueTest extends MessageTestBase {
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
// test timeout
Thread.sleep(2000);
@ -87,25 +89,25 @@ public class ClientAckQueueTest extends MessageTestBase {
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(412, ackRes.getStatus());
System.out.println("**** Successfully failed ack");
log.debug("**** Successfully failed ack");
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
}
{
ClientResponse<?> res = consumeNext.request().header(Constants.WAIT_HEADER, "2").post(String.class);
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
if (ackRes.getStatus() != 204) {
System.out.println(ackRes.getEntity(String.class));
log.debug(ackRes.getEntity(String.class));
}
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -132,62 +134,62 @@ public class ClientAckQueueTest extends MessageTestBase {
ClientResponse<?> response = Util.head(request);
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull-consumers: " + consumers);
log.debug("pull-consumers: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("acknowledge-next: " + consumeNext);
log.debug("acknowledge-next: " + consumeNext);
String data = Integer.toString(start);
System.out.println("Sending: " + data);
log.debug("Sending: " + data);
ClientResponse<?> res = sender.request().body("text/plain", data).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println("call acknowledge-next");
log.debug("call acknowledge-next");
res = consumeNext.request().post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals(Integer.toString(start++), res.getEntity());
res.releaseConnection();
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("sending next...");
log.debug("sending next...");
String data2 = Integer.toString(start);
System.out.println("Sending: " + data2);
log.debug("Sending: " + data2);
res = sender.request().body("text/plain", data2).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println(consumeNext);
log.debug(consumeNext);
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals(Integer.toString(start++), res.getEntity());
res.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = consumeNext.request().post(String.class);
res.releaseConnection();
System.out.println(res.getStatus());
log.debug(res.getStatus());
Assert.assertEquals(204, session.request().delete().getStatus());
}
@ -210,18 +212,18 @@ public class ClientAckQueueTest extends MessageTestBase {
ClientResponse<?> response = Util.head(request);
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<String> res = consumeNext.request().post(String.class);
res.releaseConnection();
Assert.assertEquals(503, res.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println(consumeNext);
log.debug(consumeNext);
res = sender.request().body("text/plain", Integer.toString(start)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
@ -230,7 +232,7 @@ public class ClientAckQueueTest extends MessageTestBase {
Assert.assertEquals(Integer.toString(start++), res.getEntity());
res.releaseConnection();
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -249,7 +251,7 @@ public class ClientAckQueueTest extends MessageTestBase {
Assert.assertEquals(Integer.toString(start++), res.getEntity());
res.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -259,7 +261,7 @@ public class ClientAckQueueTest extends MessageTestBase {
Assert.assertEquals(Integer.toString(start++), res.getEntity());
res.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -268,7 +270,7 @@ public class ClientAckQueueTest extends MessageTestBase {
res = consumeNext.request().post();
res.releaseConnection();
Assert.assertEquals(503, res.getStatus());
System.out.println(session);
log.debug(session);
res = session.request().delete();
res.releaseConnection();
Assert.assertEquals(204, res.getStatus());
@ -292,12 +294,12 @@ public class ClientAckQueueTest extends MessageTestBase {
ClientResponse<?> response = Util.head(request);
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
@ -307,17 +309,17 @@ public class ClientAckQueueTest extends MessageTestBase {
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("before close session consumeNext: " + consumeNext);
log.debug("before close session consumeNext: " + consumeNext);
// test reconnect with a disconnected acknowledge-next
Assert.assertEquals(204, session.request().delete().getStatus());
@ -330,14 +332,14 @@ public class ClientAckQueueTest extends MessageTestBase {
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "consumer");
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("session: " + session);
log.debug("session: " + session);
// test reconnect with disconnected acknowledge
@ -348,7 +350,7 @@ public class ClientAckQueueTest extends MessageTestBase {
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Assert.assertEquals(204, session.request().delete().getStatus());
@ -361,7 +363,7 @@ public class ClientAckQueueTest extends MessageTestBase {
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();

View File

@ -20,6 +20,7 @@ import org.apache.activemq.artemis.rest.topic.TopicDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.apache.activemq.artemis.rest.util.CustomHeaderLinkStrategy;
import org.apache.activemq.artemis.rest.util.LinkHeaderLinkStrategy;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -30,6 +31,8 @@ import org.junit.Test;
public class ClientAckTopicTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(ClientAckTopicTest.class);
@BeforeClass
public static void setup() throws Exception {
TopicDeployment deployment1 = new TopicDeployment("testQueue", true);
@ -59,7 +62,7 @@ public class ClientAckTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link subscriptions = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "pull-subscriptions");
response = subscriptions.request().formParameter("autoAck", "false").formParameter("durable", "true").post();
response.releaseConnection();
@ -68,7 +71,7 @@ public class ClientAckTopicTest extends MessageTestBase {
Assert.assertNotNull(sub1);
Link consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
{
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
@ -79,39 +82,39 @@ public class ClientAckTopicTest extends MessageTestBase {
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
Link ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Link session = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
// test timeout
Thread.sleep(2000);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
if (ackRes.getStatus() == 500) {
System.out.println("Failure: " + ackRes.getEntity(String.class));
log.debug("Failure: " + ackRes.getEntity(String.class));
}
ackRes.releaseConnection();
Assert.assertEquals(412, ackRes.getStatus());
System.out.println("**** Successfully failed ack");
log.debug("**** Successfully failed ack");
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
}
{
ClientResponse<?> res = consumeNext.request().header(Constants.WAIT_HEADER, "2").post(String.class);
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
Link ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
if (ackRes.getStatus() != 204) {
System.out.println(ackRes.getEntity(String.class));
log.debug(ackRes.getEntity(String.class));
}
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -127,7 +130,7 @@ public class ClientAckTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link subscriptions = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "pull-subscriptions");
response = subscriptions.request().formParameter("autoAck", "false").formParameter("durable", "true").post();
@ -136,42 +139,42 @@ public class ClientAckTopicTest extends MessageTestBase {
Link sub1 = response.getLocationLink();
Assert.assertNotNull(sub1);
Link consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println("call ack next");
log.debug("call ack next");
res = consumeNext.request().post(String.class);
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
Link ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Link session = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("sending next...");
log.debug("sending next...");
res = sender.request().body("text/plain", Integer.toString(2)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println(consumeNext);
log.debug(consumeNext);
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -187,7 +190,7 @@ public class ClientAckTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link subscriptions = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "pull-subscriptions");
response = subscriptions.request().formParameter("autoAck", "false").formParameter("durable", "false").post();
@ -196,42 +199,42 @@ public class ClientAckTopicTest extends MessageTestBase {
Link sub1 = response.getLocationLink();
Assert.assertNotNull(sub1);
Link consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println("call ack next");
log.debug("call ack next");
res = consumeNext.request().post(String.class);
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
Link ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
Link session = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), ackRes, "acknowledge-next");
System.out.println("sending next...");
log.debug("sending next...");
res = sender.request().body("text/plain", Integer.toString(2)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println(consumeNext);
log.debug(consumeNext);
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
res.releaseConnection();
Assert.assertEquals(200, res.getStatus());
ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
Assert.assertNotNull(ack);
getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -247,7 +250,7 @@ public class ClientAckTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link subscriptions = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "pull-subscriptions");
response = subscriptions.request().formParameter("autoAck", "false").formParameter("durable", "true").post();
response.releaseConnection();
@ -255,13 +258,13 @@ public class ClientAckTopicTest extends MessageTestBase {
Link sub1 = response.getLocationLink();
Assert.assertNotNull(sub1);
Link consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<String> res = consumeNext.request().post(String.class);
res.releaseConnection();
Assert.assertEquals(503, res.getStatus());
consumeNext = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println(consumeNext);
log.debug(consumeNext);
res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
@ -270,7 +273,7 @@ public class ClientAckTopicTest extends MessageTestBase {
Assert.assertEquals(Integer.toString(1), res.getEntity());
res.releaseConnection();
Link ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -289,7 +292,7 @@ public class ClientAckTopicTest extends MessageTestBase {
Assert.assertEquals(Integer.toString(2), res.getEntity());
res.releaseConnection();
ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -299,7 +302,7 @@ public class ClientAckTopicTest extends MessageTestBase {
Assert.assertEquals(Integer.toString(3), res.getEntity());
res.releaseConnection();
ack = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
ackRes.releaseConnection();
Assert.assertEquals(204, ackRes.getStatus());
@ -307,7 +310,7 @@ public class ClientAckTopicTest extends MessageTestBase {
res = consumeNext.request().post();
res.releaseConnection();
Assert.assertEquals(503, res.getStatus());
System.out.println(sub1);
log.debug(sub1);
res = sub1.request().delete();
res.releaseConnection();
Assert.assertEquals(204, res.getStatus());

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -26,6 +27,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class CreateDestinationTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(CreateDestinationTest.class);
@BeforeClass
public static void reg() {
@ -39,19 +41,19 @@ public class CreateDestinationTest extends MessageTestBase {
ClientResponse cRes = create.body("application/activemq.jms.queue+xml", queueConfig).post();
cRes.releaseConnection();
Assert.assertEquals(201, cRes.getStatus());
System.out.println("Location: " + cRes.getLocationLink());
log.debug("Location: " + cRes.getLocationLink());
ClientRequest request = cRes.getLocationLink().request();
ClientResponse<?> response = request.head();
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
@ -62,23 +64,23 @@ public class CreateDestinationTest extends MessageTestBase {
Assert.assertEquals("1", res.getEntity(String.class));
res.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = sender.request().body("text/plain", Integer.toString(2)).post();
res.releaseConnection();
Assert.assertEquals(201, res.getStatus());
System.out.println(consumeNext);
log.debug(consumeNext);
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals("2", res.getEntity(String.class));
res.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = session.request().delete();
res.releaseConnection();
@ -108,7 +110,7 @@ public class CreateDestinationTest extends MessageTestBase {
Assert.assertNotNull(sub1);
Link consumeNext1 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
Assert.assertNotNull(consumeNext1);
System.out.println("consumeNext1: " + consumeNext1);
log.debug("consumeNext1: " + consumeNext1);
res = subscriptions.request().post();
res.releaseConnection();

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -27,6 +28,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class DupQueueTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(DupQueueTest.class);
@Test
public void testDup() throws Exception {
@ -42,18 +44,18 @@ public class DupQueueTest extends MessageTestBase {
ClientResponse<?> response = request.head();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
Assert.assertEquals(307, res.getStatus());
sender = res.getLocationLink();
res.releaseConnection();
System.out.println("create-next: " + sender);
log.debug("create-next: " + sender);
Assert.assertNotNull(sender);
res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
@ -71,17 +73,17 @@ public class DupQueueTest extends MessageTestBase {
Assert.assertEquals("1", res.getEntity(String.class));
res.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, res.getStatus());
res.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = consumeNext.request().post(String.class);
res.releaseConnection();
@ -105,12 +107,12 @@ public class DupQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create-with-id");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().pathParameter("id", "1").body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
@ -128,18 +130,18 @@ public class DupQueueTest extends MessageTestBase {
Assert.assertEquals("1", res.getEntity(String.class));
res.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals("2", res.getEntity(String.class));
res.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consume-next");
System.out.println("consumeNext: " + consumeNext);
log.debug("consumeNext: " + consumeNext);
res = consumeNext.request().post(String.class);
res.releaseConnection();
Assert.assertEquals(503, res.getStatus());

View File

@ -24,10 +24,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.rest.MessageServiceConfiguration;
import org.apache.activemq.artemis.rest.MessageServiceManager;
import org.jboss.logging.Logger;
import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer;
import org.jboss.resteasy.test.TestPortProvider;
public class Embedded {
private static final Logger log = Logger.getLogger(Embedded.class);
protected MessageServiceManager manager = new MessageServiceManager(null);
protected MessageServiceConfiguration config = new MessageServiceConfiguration();
@ -36,7 +38,7 @@ public class Embedded {
public Embedded() {
int port = TestPortProvider.getPort();
System.out.println("default port is: " + port);
log.debug("default port is: " + port);
tjws.setPort(port);
tjws.setRootResourcePath("");
tjws.setSecurityDomain(null);
@ -67,7 +69,7 @@ public class Embedded {
}
public void start() throws Exception {
System.out.println("\nStarting Embedded");
log.debug("\nStarting Embedded");
if (activeMQServer == null) {
Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
@ -83,7 +85,7 @@ public class Embedded {
}
public void stop() throws Exception {
System.out.println("\nStopping Embedded");
log.debug("\nStopping Embedded");
manager.stop();
tjws.stop();
activeMQServer.stop();

View File

@ -30,6 +30,7 @@ import org.apache.activemq.artemis.rest.HttpHeaderProperty;
import org.apache.activemq.artemis.rest.integration.EmbeddedRestActiveMQ;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -40,6 +41,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class EmbeddedTest {
private static final Logger log = Logger.getLogger(EmbeddedTest.class);
public static EmbeddedRestActiveMQ server;
@ -93,12 +95,12 @@ public class EmbeddedTest {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = response.getLinkHeader().getLinkByTitle("create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = response.getLinkHeader().getLinkByTitle("pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = response.getLinkHeader().getLinkByTitle("consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
// test that Accept header is used to set content-type
{

View File

@ -26,10 +26,12 @@ import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.rest.MessageServiceConfiguration;
import org.apache.activemq.artemis.rest.MessageServiceManager;
import org.jboss.logging.Logger;
import org.jboss.resteasy.plugins.server.tjws.TJWSEmbeddedJaxrsServer;
import org.jboss.resteasy.test.TestPortProvider;
class EmbeddedTestServer {
private static final Logger log = Logger.getLogger(EmbeddedTestServer.class);
protected MessageServiceManager manager = new MessageServiceManager(null);
protected MessageServiceConfiguration config = new MessageServiceConfiguration();
@ -38,7 +40,7 @@ class EmbeddedTestServer {
EmbeddedTestServer() {
int port = TestPortProvider.getPort();
System.out.println("default port is: " + port);
log.debug("default port is: " + port);
tjws.setPort(port);
tjws.setRootResourcePath("");
tjws.setSecurityDomain(null);
@ -65,7 +67,7 @@ class EmbeddedTestServer {
}
public void start() throws Exception {
System.out.println("\nStarting EmbeddedTestServer");
log.debug("\nStarting EmbeddedTestServer");
if (activeMQServer == null) {
Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setSecurityEnabled(false).addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
@ -84,7 +86,7 @@ class EmbeddedTestServer {
}
public void stop() throws Exception {
System.out.println("\nStopping EmbeddedTestServer");
log.debug("\nStopping EmbeddedTestServer");
manager.stop();
tjws.stop();
activeMQServer.stop();

View File

@ -20,6 +20,7 @@ import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -28,6 +29,7 @@ import org.junit.Assert;
import org.junit.Test;
public class FindDestinationTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(FindDestinationTest.class);
@Test
public void testFindQueue() throws Exception {
@ -41,12 +43,12 @@ public class FindDestinationTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
ClientResponse<?> res = sender.request().body("text/plain", Integer.toString(1)).post();
res.releaseConnection();
@ -57,7 +59,7 @@ public class FindDestinationTest extends MessageTestBase {
Assert.assertEquals("1", res.getEntity(String.class));
res.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), res, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Assert.assertEquals(204, session.request().delete().getStatus());
}
@ -82,7 +84,7 @@ public class FindDestinationTest extends MessageTestBase {
Assert.assertNotNull(sub1);
Link consumeNext1 = getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "consume-next");
Assert.assertNotNull(consumeNext1);
System.out.println("consumeNext1: " + consumeNext1);
log.debug("consumeNext1: " + consumeNext1);
res = subscriptions.request().post();
Assert.assertEquals(201, res.getStatus());

View File

@ -35,6 +35,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import org.apache.activemq.artemis.rest.HttpHeaderProperty;
import org.apache.activemq.artemis.rest.Jms;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -45,6 +46,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class JMSTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(JMSTest.class);
public static ConnectionFactory connectionFactory;
@ -107,7 +109,7 @@ public class JMSTest extends MessageTestBase {
public static Destination createDestination(String dest) {
ActiveMQDestination destination = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(dest);
System.out.println("SimpleAddress: " + destination.getSimpleAddress());
log.debug("SimpleAddress: " + destination.getSimpleAddress());
return destination;
}
@ -152,7 +154,7 @@ public class JMSTest extends MessageTestBase {
public void testJmsConsumer() throws Exception {
String queueName = "testQueue2";
String prefixedQueueName = ActiveMQDestination.createQueueAddressFromName(queueName).toString();
System.out.println("Queue name: " + prefixedQueueName);
log.debug("Queue name: " + prefixedQueueName);
QueueDeployment deployment = new QueueDeployment();
deployment.setDuplicatesAllowed(true);
deployment.setDurableSend(false);
@ -172,9 +174,9 @@ public class JMSTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
// test that Accept header is used to set content-type
{
@ -199,7 +201,7 @@ public class JMSTest extends MessageTestBase {
public void testJmsProducer() throws Exception {
String queueName = "testQueue";
String prefixedQueueName = ActiveMQDestination.createQueueAddressFromName(queueName).toString();
System.out.println("Queue name: " + prefixedQueueName);
log.debug("Queue name: " + prefixedQueueName);
QueueDeployment deployment = new QueueDeployment();
deployment.setDuplicatesAllowed(true);
deployment.setDurableSend(false);
@ -211,12 +213,12 @@ public class JMSTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
// test that Accept header is used to set content-type
{

View File

@ -22,6 +22,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.rest.HttpHeaderProperty;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -38,7 +39,7 @@ import static org.hamcrest.CoreMatchers.not;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class MessagePropertiesTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(MessagePropertiesTest.class);
public static class Listener implements MessageHandler {
@ -76,7 +77,7 @@ public class MessagePropertiesTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
{
response = sender.request().body("text/plain", "val")

View File

@ -65,7 +65,7 @@ public class MessageTestBase {
String href = (String) response.getHeaders().getFirst(headerName);
if (href == null)
return null;
//System.out.println(headerName + ": " + href);
//log.debug(headerName + ": " + href);
Link l = new Link(title, null, href, null, null);
try {
l.setExecutor((ClientExecutor) executorField.get(response));

View File

@ -26,6 +26,7 @@ import org.apache.activemq.artemis.rest.MessageServiceManager;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.apache.activemq.artemis.rest.queue.push.xml.PushRegistration;
import org.apache.activemq.artemis.rest.queue.push.xml.XmlLink;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -41,6 +42,8 @@ import static org.jboss.resteasy.test.TestPortProvider.generateURL;
*/
public class PersistentPushQueueConsumerTest {
private static final Logger log = Logger.getLogger(PersistentPushQueueConsumerTest.class);
public static MessageServiceManager manager;
protected static ResteasyDeployment deployment;
public static ActiveMQServer activeMQServer;
@ -81,19 +84,19 @@ public class PersistentPushQueueConsumerTest {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-consumers");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
request = new ClientRequest(generateURL("/queues/" + testName + "forwardQueue"));
response = request.head();
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("poller: " + consumeNext);
log.debug("poller: " + consumeNext);
PushRegistration reg = new PushRegistration();
reg.setDurable(true);
@ -161,9 +164,9 @@ public class PersistentPushQueueConsumerTest {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-consumers");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
PushRegistration reg = new PushRegistration();
reg.setDurable(true);

View File

@ -34,6 +34,7 @@ import org.apache.activemq.artemis.rest.MessageServiceManager;
import org.apache.activemq.artemis.rest.queue.push.xml.XmlLink;
import org.apache.activemq.artemis.rest.topic.PushTopicRegistration;
import org.apache.activemq.artemis.rest.topic.TopicDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -50,6 +51,7 @@ import static org.jboss.resteasy.test.TestPortProvider.generateURL;
* Test durable queue push consumers
*/
public class PersistentPushTopicConsumerTest {
private static final Logger log = Logger.getLogger(PersistentPushTopicConsumerTest.class);
public static ActiveMQServer server;
public static MessageServiceManager manager;
@ -100,9 +102,9 @@ public class PersistentPushTopicConsumerTest {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
PushTopicRegistration reg = new PushTopicRegistration();
reg.setDurable(true);
@ -156,9 +158,9 @@ public class PersistentPushTopicConsumerTest {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
String sub1 = generateURL("/subscribers/1");
String sub2 = generateURL("/subscribers/2");
@ -211,7 +213,7 @@ public class PersistentPushTopicConsumerTest {
@POST
@Consumes("text/plain")
public void postOne(String msg) {
System.out.println("in subscribers 1!!!!!!!!!! " + msg);
log.debug("in subscribers 1!!!!!!!!!! " + msg);
subscriber1 = msg;
latch.countDown();
}
@ -220,7 +222,7 @@ public class PersistentPushTopicConsumerTest {
@POST
@Consumes("text/plain")
public void postTwo(String msg) {
System.out.println("in subscribers 2!!!!!!!!!! " + msg);
log.debug("in subscribers 2!!!!!!!!!! " + msg);
subscriber2 = msg;
latch.countDown();
}

View File

@ -25,6 +25,7 @@ import org.apache.activemq.artemis.rest.queue.push.ActiveMQPushStrategy;
import org.apache.activemq.artemis.rest.queue.push.xml.PushRegistration;
import org.apache.activemq.artemis.rest.queue.push.xml.XmlLink;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -34,6 +35,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class PushQueueConsumerTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(PushQueueConsumerTest.class);
enum PushRegistrationType {
CLASS, BRIDGE, URI, TEMPLATE
@ -50,7 +52,7 @@ public class PushQueueConsumerTest extends MessageTestBase {
// The name of the queue used for the test should match the name of the test
String queue = "testBridge";
String queueToPushTo = "pushedFrom-" + queue;
System.out.println("\n" + queue);
log.debug("\n" + queue);
deployQueue(queue);
deployQueue(queueToPushTo);
@ -92,7 +94,7 @@ public class PushQueueConsumerTest extends MessageTestBase {
// The name of the queue used for the test should match the name of the test
String queue = "testClass";
String queueToPushTo = "pushedFrom-" + queue;
System.out.println("\n" + queue);
log.debug("\n" + queue);
deployQueue(queue);
deployQueue(queueToPushTo);
@ -127,7 +129,7 @@ public class PushQueueConsumerTest extends MessageTestBase {
// The name of the queue used for the test should match the name of the test
String queue = "testTemplate";
String queueToPushTo = "pushedFrom-" + queue;
System.out.println("\n" + queue);
log.debug("\n" + queue);
deployQueue(queue);
deployQueue(queueToPushTo);
@ -197,7 +199,7 @@ public class PushQueueConsumerTest extends MessageTestBase {
// The name of the queue used for the test should match the name of the test
String queue = "testUri";
String queueToPushTo = "pushedFrom-" + queue;
System.out.println("\n" + queue);
log.debug("\n" + queue);
deployQueue(queue);
deployQueue(queueToPushTo);
@ -229,7 +231,7 @@ public class PushQueueConsumerTest extends MessageTestBase {
// The name of the queue used for the test should match the name of the test
String queue = "testUriWithMultipleSessions";
String queueToPushTo = "pushedFrom-" + queue;
System.out.println("\n" + queue);
log.debug("\n" + queue);
deployQueue(queue);
deployQueue(queueToPushTo);

View File

@ -25,6 +25,7 @@ import org.apache.activemq.artemis.rest.queue.push.ActiveMQPushStrategy;
import org.apache.activemq.artemis.rest.queue.push.xml.XmlLink;
import org.apache.activemq.artemis.rest.topic.PushTopicRegistration;
import org.apache.activemq.artemis.rest.topic.TopicDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -36,6 +37,8 @@ import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class PushTopicConsumerTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(PushTopicConsumerTest.class);
@BeforeClass
public static void setup() throws Exception {
// TopicDeployment deployment = new TopicDeployment();
@ -69,9 +72,9 @@ public class PushTopicConsumerTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
request = new ClientRequest(generateURL("/queues/testBridgeForwardQueue"));
response = request.head();
@ -128,9 +131,9 @@ public class PushTopicConsumerTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
request = new ClientRequest(generateURL("/queues/testClassForwardQueue"));
response = request.head();
@ -187,9 +190,9 @@ public class PushTopicConsumerTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
request = new ClientRequest(generateURL("/queues/testTemplateForwardQueue"));
response = request.head();
@ -279,9 +282,9 @@ public class PushTopicConsumerTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
PushTopicRegistration reg = new PushTopicRegistration();
reg.setDurable(false);
@ -323,9 +326,9 @@ public class PushTopicConsumerTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link pushSubscriptions = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push subscriptions: " + pushSubscriptions);
log.debug("push subscriptions: " + pushSubscriptions);
PushTopicRegistration reg = new PushTopicRegistration();
reg.setDurable(false);

View File

@ -37,6 +37,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.ActiveMQServers;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.jboss.logging.Logger;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@ -46,6 +47,7 @@ import org.junit.Test;
* Play with ActiveMQ
*/
public class RawAckTest {
private static final Logger log = Logger.getLogger(RawAckTest.class);
protected static ActiveMQServer activeMQServer;
static ServerLocator serverLocator;
@ -99,7 +101,7 @@ public class RawAckTest {
byte[] bytes = new byte[size];
message.getBodyBuffer().readBytes(bytes);
String str = new String(bytes);
System.out.println(str);
log.debug(str);
message.acknowledge();
message = consumer.receive(1);
if (message != null) {

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -41,6 +42,7 @@ import static org.jboss.resteasy.test.TestPortProvider.generateURL;
* ack with an old ack link
*/
public class RepostingQueueTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(RepostingQueueTest.class);
@BeforeClass
public static void setup() throws Exception {
@ -56,12 +58,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -72,9 +74,9 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -98,9 +100,9 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -124,12 +126,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -140,10 +142,10 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
Link firstConsumeNext = consumeNext;
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -154,9 +156,9 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -168,7 +170,7 @@ public class RepostingQueueTest extends MessageTestBase {
response = firstConsumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
response = session.request().delete();
@ -184,12 +186,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -200,18 +202,18 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
// test timeout here
response = consumeNext.request().post(String.class);
response.releaseConnection();
Assert.assertEquals(503, response.getStatus());
session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -234,12 +236,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -250,9 +252,9 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -263,7 +265,7 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -286,7 +288,7 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -304,12 +306,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -320,9 +322,9 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "false").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -333,7 +335,7 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, response.getStatus());
@ -352,7 +354,7 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -370,12 +372,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -386,18 +388,18 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "false").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
response = ack.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, response.getStatus());
@ -416,7 +418,7 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -434,12 +436,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -450,18 +452,18 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
response = ack.request().formParameter("acknowledge", "false").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -484,7 +486,7 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -502,12 +504,12 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -518,15 +520,15 @@ public class RepostingQueueTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
Link oldAck = ack;
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -536,11 +538,11 @@ public class RepostingQueueTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
ack = MessageTestBase.getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = oldAck.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
response = ack.request().formParameter("acknowledge", "true").post();

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.topic.TopicDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -41,6 +42,7 @@ import static org.jboss.resteasy.test.TestPortProvider.generateURL;
* ack with an old ack link
*/
public class RepostingTopicTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(RepostingTopicTest.class);
@BeforeClass
public static void setup() throws Exception {
@ -56,9 +58,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
@ -74,7 +76,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = consumeNext.request().post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("1", response.getEntity(String.class));
@ -99,9 +101,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = consumers.request().formParameter("name", "bill").formParameter("durable", "true").post();
response.releaseConnection();
@ -119,7 +121,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = consumers.request().formParameter("name", "bill").formParameter("durable", "true").post();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = consumeNext.request().header("Accept-Wait", "2").post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("1", response.getEntity(String.class));
@ -144,9 +146,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
@ -164,7 +166,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = consumeNext.request().header("Accept-Wait", "2").post(String.class);
response.releaseConnection();
Assert.assertEquals(503, response.getStatus());
@ -183,12 +185,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -199,9 +201,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -225,9 +227,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -251,12 +253,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -267,10 +269,10 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
Link firstConsumeNext = consumeNext;
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -281,9 +283,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -295,7 +297,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = firstConsumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
response = session.request().delete();
@ -311,12 +313,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -327,18 +329,18 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
// test timeout here
response = consumeNext.request().post(String.class);
response.releaseConnection();
Assert.assertEquals(503, response.getStatus());
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -361,12 +363,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -377,9 +379,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -390,7 +392,7 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -413,7 +415,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -431,12 +433,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -447,9 +449,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "false").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -460,7 +462,7 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, response.getStatus());
@ -479,7 +481,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -497,12 +499,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -513,18 +515,18 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "false").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
response = ack.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, response.getStatus());
@ -543,7 +545,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -561,12 +563,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -577,18 +579,18 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
response = ack.request().formParameter("acknowledge", "false").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -611,7 +613,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -629,12 +631,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -645,15 +647,15 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
Link oldAck = ack;
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
Link firstConsumeNext = consumeNext;
response = sender.request().body("text/plain", Integer.toString(2)).post();
@ -664,11 +666,11 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = oldAck.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");

View File

@ -17,6 +17,7 @@
package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -26,6 +27,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class RoundtripTimeTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(RoundtripTimeTest.class);
@Test
public void testSuccessFirst() throws Exception {
@ -41,12 +43,12 @@ public class RoundtripTimeTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
long start = System.currentTimeMillis();
int num = 100;
@ -55,7 +57,7 @@ public class RoundtripTimeTest extends MessageTestBase {
response.releaseConnection();
}
long end = System.currentTimeMillis() - start;
System.out.println(num + " iterations took " + end + "ms");
log.debug(num + " iterations took " + end + "ms");
for (int i = 0; i < num; i++) {
response = consumeNext.request().post(String.class);

View File

@ -33,6 +33,7 @@ import org.apache.activemq.artemis.rest.HttpHeaderProperty;
import org.apache.activemq.artemis.rest.queue.push.xml.XmlLink;
import org.apache.activemq.artemis.rest.topic.PushTopicRegistration;
import org.apache.activemq.artemis.rest.topic.TopicDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -43,6 +44,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class SelectorTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(SelectorTest.class);
public static ConnectionFactory connectionFactory;
public static String topicName = "testTopic";
@ -51,7 +53,7 @@ public class SelectorTest extends MessageTestBase {
@BeforeClass
public static void setup() throws Exception {
connectionFactory = new ActiveMQJMSConnectionFactory(manager.getQueueManager().getServerLocator());
System.out.println("Queue name: " + prefixedTopicName);
log.debug("Queue name: " + prefixedTopicName);
TopicDeployment deployment = new TopicDeployment();
deployment.setDuplicatesAllowed(true);
deployment.setDurableSend(false);
@ -120,7 +122,7 @@ public class SelectorTest extends MessageTestBase {
public static Destination createDestination(String dest) {
ActiveMQDestination destination = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(dest);
System.out.println("SimpleAddress: " + destination.getSimpleAddress());
log.debug("SimpleAddress: " + destination.getSimpleAddress());
return destination;
}
@ -175,7 +177,7 @@ public class SelectorTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "push-subscriptions");
System.out.println("push: " + consumers);
log.debug("push: " + consumers);
PushTopicRegistration oneReg = new PushTopicRegistration();
oneReg.setDurable(false);
@ -247,16 +249,16 @@ public class SelectorTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = consumers.request().formParameter("autoAck", "true").formParameter("selector", "MyTag = '1'").post();
response.releaseConnection();
Link consumeOne = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consumeOne: " + consumeOne);
log.debug("consumeOne: " + consumeOne);
response = consumers.request().formParameter("autoAck", "true").formParameter("selector", "MyTag = '2'").post();
response.releaseConnection();
Link consumeTwo = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consumeTwo: " + consumeTwo);
log.debug("consumeTwo: " + consumeTwo);
// test that Accept header is used to set content-type
{

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.rest.test;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.apache.activemq.artemis.rest.topic.TopicDeployment;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -29,6 +30,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class SessionTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(SessionTest.class);
@BeforeClass
public static void setup() throws Exception {
@ -50,15 +52,15 @@ public class SessionTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link session = response.getLocationLink();
response = session.request().head();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -104,15 +106,15 @@ public class SessionTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link session = response.getLocationLink();
response = session.request().head();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -160,15 +162,15 @@ public class SessionTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link session = response.getLocationLink();
response = session.request().head();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
Link ack = null;
response = sender.request().body("text/plain", Integer.toString(1)).post();
@ -236,15 +238,15 @@ public class SessionTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link session = response.getLocationLink();
response = session.request().head();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
Link ack = null;
response = sender.request().body("text/plain", Integer.toString(1)).post();

View File

@ -28,6 +28,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
import org.apache.activemq.artemis.api.core.client.MessageHandler;
import org.apache.activemq.artemis.rest.ActiveMQ;
import org.apache.activemq.artemis.rest.queue.QueueDeployment;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -38,6 +39,7 @@ import org.junit.Test;
import static org.jboss.resteasy.test.TestPortProvider.generateURL;
public class TransformTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(TransformTest.class);
@BeforeClass
public static void setup() throws Exception {
@ -122,12 +124,12 @@ public class TransformTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
// test that Accept header is used to set content-type
{
@ -188,7 +190,7 @@ public class TransformTest extends MessageTestBase {
@Override
public void onMessage(ClientMessage clientMessage) {
System.out.println("onMessage!");
log.debug("onMessage!");
try {
order = ActiveMQ.getEntity(clientMessage, Order.class);
} catch (Exception e) {
@ -217,12 +219,12 @@ public class TransformTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-consumers");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("consume-next: " + consumeNext);
log.debug("consume-next: " + consumeNext);
// test that Accept header is used to set content-type
{

View File

@ -20,9 +20,11 @@ import javax.xml.bind.JAXBContext;
import java.io.StringReader;
import org.apache.activemq.artemis.rest.queue.push.xml.PushRegistration;
import org.jboss.logging.Logger;
import org.junit.Test;
public class XmlTest {
private static final Logger log = Logger.getLogger(XmlTest.class);
@Test
public void testPush() throws Exception {
@ -40,6 +42,6 @@ public class XmlTest {
JAXBContext ctx = JAXBContext.newInstance(PushRegistration.class);
PushRegistration reg = (PushRegistration) ctx.createUnmarshaller().unmarshal(new StringReader(xml));
System.out.println(reg);
log.debug(reg);
}
}

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.rest.topic;
import org.apache.activemq.artemis.rest.test.MessageTestBase;
import org.apache.activemq.artemis.rest.test.Util;
import org.apache.activemq.artemis.rest.util.Constants;
import org.jboss.logging.Logger;
import org.jboss.resteasy.client.ClientRequest;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.spi.Link;
@ -42,6 +43,7 @@ import static org.jboss.resteasy.test.TestPortProvider.generateURL;
* ack with an old ack link
*/
public class RepostingTopicTest extends MessageTestBase {
private static final Logger log = Logger.getLogger(RepostingTopicTest.class);
@BeforeClass
public static void setup() throws Exception {
@ -57,9 +59,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
@ -75,7 +77,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = consumeNext.request().post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("1", response.getEntity(String.class));
@ -100,9 +102,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = consumers.request().formParameter("name", "bill").formParameter("durable", "true").post();
response.releaseConnection();
@ -120,7 +122,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = consumers.request().formParameter("name", "bill").formParameter("durable", "true").post();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = consumeNext.request().header("Accept-Wait", "2").post(String.class);
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals("1", response.getEntity(String.class));
@ -145,9 +147,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
@ -165,7 +167,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = consumers.request().formParameter("name", "bill").post();
response.releaseConnection();
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = consumeNext.request().header("Accept-Wait", "2").post(String.class);
response.releaseConnection();
Assert.assertEquals(503, response.getStatus());
@ -184,12 +186,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -200,9 +202,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -226,9 +228,9 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -252,12 +254,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -268,10 +270,10 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
Link firstConsumeNext = consumeNext;
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -282,9 +284,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -296,7 +298,7 @@ public class RepostingTopicTest extends MessageTestBase {
response = firstConsumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
response = session.request().delete();
@ -312,12 +314,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, true);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("resource consume-next: " + consumeNext);
log.debug("resource consume-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -328,18 +330,18 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 1st consumeNext: " + consumeNext);
log.debug("session 1st consumeNext: " + consumeNext);
// test timeout here
response = consumeNext.request().post(String.class);
response.releaseConnection();
Assert.assertEquals(503, response.getStatus());
session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consume-next");
System.out.println("session 2nd consumeNext: " + consumeNext);
log.debug("session 2nd consumeNext: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(3)).post();
response.releaseConnection();
@ -362,12 +364,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -378,9 +380,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -391,7 +393,7 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -414,7 +416,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -432,12 +434,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -448,9 +450,9 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "false").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -461,7 +463,7 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, response.getStatus());
@ -480,7 +482,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -498,12 +500,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -514,18 +516,18 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "false").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
response = ack.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = consumeNext.request().header(Constants.WAIT_HEADER, "10").post(String.class);
Assert.assertEquals(200, response.getStatus());
@ -544,7 +546,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -562,12 +564,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -578,18 +580,18 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
response = ack.request().formParameter("acknowledge", "false").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(2)).post();
response.releaseConnection();
@ -612,7 +614,7 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("2", response.getEntity(String.class));
response.releaseConnection();
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
@ -630,12 +632,12 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
Link sender = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
log.debug("create: " + sender);
Link consumers = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "pull-subscriptions");
System.out.println("pull: " + consumers);
log.debug("pull: " + consumers);
response = Util.setAutoAck(consumers, false);
Link consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("resource acknowledge-next: " + consumeNext);
log.debug("resource acknowledge-next: " + consumeNext);
response = sender.request().body("text/plain", Integer.toString(1)).post();
response.releaseConnection();
@ -646,15 +648,15 @@ public class RepostingTopicTest extends MessageTestBase {
Assert.assertEquals("1", response.getEntity(String.class));
response.releaseConnection();
Link session = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "consumer");
System.out.println("session: " + session);
log.debug("session: " + session);
Link ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
Link oldAck = ack;
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = ack.request().formParameter("acknowledge", "true").post();
response.releaseConnection();
Assert.assertEquals(204, response.getStatus());
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("session 1st acknowledge-next: " + consumeNext);
log.debug("session 1st acknowledge-next: " + consumeNext);
Link firstConsumeNext = consumeNext;
response = sender.request().body("text/plain", Integer.toString(2)).post();
@ -665,11 +667,11 @@ public class RepostingTopicTest extends MessageTestBase {
response.releaseConnection();
Assert.assertEquals(200, response.getStatus());
ack = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledgement");
System.out.println("ack: " + ack);
log.debug("ack: " + ack);
response = oldAck.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(412, response.getStatus());
System.out.println(response.getEntity(String.class));
log.debug(response.getEntity(String.class));
response.releaseConnection();
consumeNext = getLinkByTitle(manager.getQueueManager().getLinkStrategy(), response, "acknowledge-next");

View File

@ -23,6 +23,7 @@ import org.apache.activemq.artemis.selector.filter.LogicExpression;
import org.apache.activemq.artemis.selector.filter.PropertyExpression;
import org.apache.activemq.artemis.selector.filter.XPathExpression;
import org.apache.activemq.artemis.selector.impl.SelectorParser;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
@ -31,8 +32,10 @@ import org.junit.Test;
*/
public class SelectorParserTest {
private static final Logger log = Logger.getLogger(SelectorParserTest.class);
public void info(String msg) {
System.out.println(msg);
log.debug(msg);
}
@Test

View File

@ -30,12 +30,15 @@ import org.apache.activemq.artemis.core.server.JournalType;
import org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class ConfigurationImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(ConfigurationImplTest.class);
protected Configuration conf;
@Test
@ -532,7 +535,7 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
tempFolder = new File(tempFolder.getAbsolutePath());
tempFolder.mkdirs();
System.out.println("TempFolder = " + tempFolder.getAbsolutePath());
log.debug("TempFolder = " + tempFolder.getAbsolutePath());
ConfigurationImpl configuration = new ConfigurationImpl();
configuration.setJournalDirectory(tempFolder.getAbsolutePath());
@ -550,7 +553,7 @@ public class ConfigurationImplTest extends ActiveMQTestBase {
tempFolder = new File(tempFolder.getAbsolutePath());
tempFolder.mkdirs();
System.out.println("TempFolder = " + tempFolder.getAbsolutePath());
log.debug("TempFolder = " + tempFolder.getAbsolutePath());
configuration.setNodeManagerLockDirectory(tempFolder.getAbsolutePath());
File lockLocation = configuration.getNodeManagerLockLocation();
Assert.assertTrue(lockLocation.exists());

View File

@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -17,59 +17,53 @@
package org.apache.activemq.artemis.core.reload;
import java.util.Collections;
import java.util.List;
import java.util.logging.LogManager;
import org.apache.activemq.artemis.core.server.LoggingConfigurationFileReloader;
import org.apache.activemq.artemis.utils.ClassloadingUtil;
import org.apache.activemq.artemis.utils.SpawnedVMSupport;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LoggingConfigurationFileReloaderTest {
private static final LogManager logManager = LogManager.getLogManager();
private static final Logger root = Logger.getLogger("");
private static final Logger test1 = Logger.getLogger("test1");
private static final Logger test2 = Logger.getLogger("test2");
private static final Logger test3 = Logger.getLogger("test3");
public static void main(String[] args) {
try {
LoggingConfigurationFileReloaderTest test = new LoggingConfigurationFileReloaderTest();
test.doTestA();
System.exit(0);
} catch (Throwable e) {
System.exit(1);
}
}
@Test
public void test() throws Exception {
LogManager logManager = LogManager.getLogManager();
public void testA() throws Exception {
Process p = SpawnedVMSupport.spawnVM(LoggingConfigurationFileReloaderTest.class.getName());
Assert.assertEquals(0, p.waitFor());
}
List loggerNames = Collections.list(logManager.getLoggerNames());
assertFalse(loggerNames.contains("test1"));
assertFalse(loggerNames.contains("test2"));
assertFalse(loggerNames.contains("test3"));
public void doTestA() throws Exception {
// everything defaults to INFO
final Logger root = Logger.getLogger("");
assertTrue(root.isEnabled(Logger.Level.ERROR));
assertTrue(root.isEnabled(Logger.Level.WARN));
assertTrue(root.isEnabled(Logger.Level.INFO));
assertFalse(root.isEnabled(Logger.Level.DEBUG));
assertFalse(root.isEnabled(Logger.Level.TRACE));
final Logger test1 = Logger.getLogger("test1");
assertTrue(test1.isEnabled(Logger.Level.ERROR));
assertTrue(test1.isEnabled(Logger.Level.WARN));
assertTrue(test1.isEnabled(Logger.Level.INFO));
assertFalse(test1.isEnabled(Logger.Level.DEBUG));
assertFalse(test1.isEnabled(Logger.Level.TRACE));
final Logger test2 = Logger.getLogger("test2");
assertTrue(test2.isEnabled(Logger.Level.ERROR));
assertTrue(test2.isEnabled(Logger.Level.WARN));
assertTrue(test2.isEnabled(Logger.Level.INFO));
assertFalse(test2.isEnabled(Logger.Level.DEBUG));
assertFalse(test2.isEnabled(Logger.Level.TRACE));
/** This is making sure we won't mess with the configuration for other tests */
validateInitialLoggers();
LoggingConfigurationFileReloader loggingConfigurationFileReloader = new LoggingConfigurationFileReloader();
loggingConfigurationFileReloader.reload(ClassloadingUtil.findResource("reload-logging-1.properties"));
loggerNames = Collections.list(logManager.getLoggerNames());
assertTrue(loggerNames.contains("test1"));
assertTrue(loggerNames.contains("test2"));
assertFalse(loggerNames.contains("test3"));
assertTrue(root.isEnabled(Logger.Level.ERROR));
assertTrue(root.isEnabled(Logger.Level.WARN));
assertFalse(root.isEnabled(Logger.Level.INFO));
@ -90,11 +84,6 @@ public class LoggingConfigurationFileReloaderTest {
loggingConfigurationFileReloader.reload(ClassloadingUtil.findResource("reload-logging-2.properties"));
loggerNames = Collections.list(logManager.getLoggerNames());
assertTrue(loggerNames.contains("test1"));
assertTrue(loggerNames.contains("test2"));
assertTrue(loggerNames.contains("test3"));
assertTrue(root.isEnabled(Logger.Level.ERROR));
assertFalse(root.isEnabled(Logger.Level.WARN));
assertFalse(root.isEnabled(Logger.Level.INFO));
@ -107,11 +96,33 @@ public class LoggingConfigurationFileReloaderTest {
assertFalse(test1.isEnabled(Logger.Level.DEBUG));
assertFalse(test1.isEnabled(Logger.Level.TRACE));
final Logger test3 = Logger.getLogger("test3");
assertTrue(test3.isEnabled(Logger.Level.ERROR));
assertTrue(test3.isEnabled(Logger.Level.WARN));
assertTrue(test3.isEnabled(Logger.Level.INFO));
assertTrue(test3.isEnabled(Logger.Level.DEBUG));
assertFalse(test3.isEnabled(Logger.Level.TRACE));
}
@Test
public void testB() {
validateInitialLoggers();
}
public void validateInitialLoggers() {
// everything defaults to INFO
assertTrue(root.isEnabled(Logger.Level.ERROR));
assertTrue(root.isEnabled(Logger.Level.WARN));
assertFalse(root.isEnabled(Logger.Level.DEBUG));
assertFalse(root.isEnabled(Logger.Level.TRACE));
assertTrue(test1.isEnabled(Logger.Level.ERROR));
assertTrue(test1.isEnabled(Logger.Level.WARN));
assertFalse(test1.isEnabled(Logger.Level.DEBUG));
assertFalse(test1.isEnabled(Logger.Level.TRACE));
assertTrue(test2.isEnabled(Logger.Level.ERROR));
assertTrue(test2.isEnabled(Logger.Level.WARN));
assertFalse(test2.isEnabled(Logger.Level.DEBUG));
assertFalse(test2.isEnabled(Logger.Level.TRACE));
}
}

View File

@ -19,6 +19,7 @@ package org.apache.activemq.artemis.core.security.jaas;
import org.apache.activemq.artemis.core.security.CheckType;
import org.apache.activemq.artemis.core.security.Role;
import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
import org.jboss.logging.Logger;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@ -40,6 +41,7 @@ import static org.junit.Assert.assertNotNull;
@RunWith(Parameterized.class)
public class JAASSecurityManagerTest {
private static final Logger log = Logger.getLogger(JAASSecurityManagerTest.class);
@Parameterized.Parameters(name = "newLoader=({0})")
public static Collection<Object[]> data() {
@ -70,7 +72,7 @@ public class JAASSecurityManagerTest {
@Test
public void testLoginClassloading() throws Exception {
ClassLoader existingLoader = Thread.currentThread().getContextClassLoader();
System.out.println("loader: " + existingLoader);
log.debug("loader: " + existingLoader);
try {
if (usingNewLoader) {
URLClassLoader simulatedLoader = new URLClassLoader(new URL[]{tmpDir.getRoot().toURI().toURL()}, null);

View File

@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.ReusableLatch;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -37,6 +38,8 @@ import org.junit.Test;
public class FileStoreMonitorTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(FileStoreMonitorTest.class);
private ScheduledExecutorService scheduledExecutorService;
private ExecutorService executorService;
@ -76,19 +79,19 @@ public class FileStoreMonitorTest extends ActiveMQTestBase {
@Override
public void tick(long usableSpace, long totalSpace) {
tick.incrementAndGet();
System.out.println("tick:: usableSpace: " + usableSpace + ", totalSpace:" + totalSpace);
log.debug("tick:: usableSpace: " + usableSpace + ", totalSpace:" + totalSpace);
}
@Override
public void over(long usableSpace, long totalSpace) {
over.incrementAndGet();
System.out.println("over:: usableSpace: " + usableSpace + ", totalSpace:" + totalSpace);
log.debug("over:: usableSpace: " + usableSpace + ", totalSpace:" + totalSpace);
}
@Override
public void under(long usableSpace, long totalSpace) {
under.incrementAndGet();
System.out.println("under:: usableSpace: " + usableSpace + ", totalSpace:" + totalSpace);
log.debug("under:: usableSpace: " + usableSpace + ", totalSpace:" + totalSpace);
}
};
FileStoreMonitor storeMonitor = new FileStoreMonitor(scheduledExecutorService, executorService, 100, TimeUnit.MILLISECONDS, 0.999, null);
@ -120,7 +123,7 @@ public class FileStoreMonitorTest extends ActiveMQTestBase {
storeMonitor.addCallback(new FileStoreMonitor.Callback() {
@Override
public void tick(long usableSpace, long totalSpace) {
System.out.println("Tick");
log.debug("Tick");
latch.countDown();
}

View File

@ -59,11 +59,14 @@ import org.apache.activemq.artemis.utils.UUID;
import org.apache.activemq.artemis.utils.collections.LinkedListIterator;
import org.apache.activemq.artemis.utils.critical.CriticalComponentImpl;
import org.apache.activemq.artemis.utils.critical.EmptyCriticalAnalyzer;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class ScheduledDeliveryHandlerTest extends Assert {
private static final Logger log = Logger.getLogger(ScheduledDeliveryHandlerTest.class);
@Test
public void testScheduleRandom() throws Exception {
ScheduledDeliveryHandlerImpl handler = new ScheduledDeliveryHandlerImpl(null, new FakeQueueForScheduleUnitTest(0));
@ -279,7 +282,7 @@ public class ScheduledDeliveryHandlerTest extends Assert {
assertTrue(ref.getScheduledDeliveryTime() >= lastTime);
} else {
if (ref.getScheduledDeliveryTime() < lastTime) {
System.out.println("^^^fail at " + ref.getScheduledDeliveryTime());
log.debug("^^^fail at " + ref.getScheduledDeliveryTime());
}
}
lastTime = ref.getScheduledDeliveryTime();

View File

@ -63,10 +63,12 @@ import org.apache.activemq.artemis.core.transaction.ResourceManager;
import org.apache.activemq.artemis.core.transaction.Transaction;
import org.apache.activemq.artemis.core.transaction.TransactionOperation;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class TransactionImplTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(TransactionImplTest.class);
@Test
public void testTimeoutAndThenCommitWithARollback() throws Exception {
@ -94,7 +96,7 @@ public class TransactionImplTest extends ActiveMQTestBase {
@Override
public void afterCommit(Transaction tx) {
System.out.println("commit...");
log.debug("commit...");
commit.incrementAndGet();
}
@ -105,7 +107,7 @@ public class TransactionImplTest extends ActiveMQTestBase {
@Override
public void afterRollback(Transaction tx) {
System.out.println("rollback...");
log.debug("rollback...");
rollback.incrementAndGet();
}
@ -162,7 +164,7 @@ public class TransactionImplTest extends ActiveMQTestBase {
@Override
public void afterCommit(Transaction tx) {
System.out.println("commit...");
log.debug("commit...");
commit.incrementAndGet();
}
@ -173,7 +175,7 @@ public class TransactionImplTest extends ActiveMQTestBase {
@Override
public void afterRollback(Transaction tx) {
System.out.println("rollback...");
log.debug("rollback...");
rollback.incrementAndGet();
}

View File

@ -164,6 +164,12 @@ import org.junit.runner.Description;
*/
public abstract class ActiveMQTestBase extends Assert {
private static final Logger log = Logger.getLogger(ActiveMQTestBase.class);
private static final Logger baseLog = Logger.getLogger(ActiveMQTestBase.class);
protected final Logger instanceLog = Logger.getLogger(this.getClass());
static {
Env.setTestEnv(true);
}
@ -206,7 +212,6 @@ public abstract class ActiveMQTestBase extends Assert {
private static final String SEND_CALL_NUMBER = "sendCallNumber";
private static final String OS_TYPE = System.getProperty("os.name").toLowerCase();
private static final int DEFAULT_UDP_PORT;
private static final ActiveMQServerLogger log = ActiveMQServerLogger.LOGGER;
protected static final long WAIT_TIMEOUT = 30000;
@ -240,12 +245,12 @@ public abstract class ActiveMQTestBase extends Assert {
public TestRule watcher = new TestWatcher() {
@Override
protected void starting(Description description) {
log.info(String.format("**** start #test %s() ***", description.getMethodName()));
baseLog.info(String.format("**** start #test %s() ***", description.getMethodName()));
}
@Override
protected void finished(Description description) {
log.info(String.format("**** end #test %s() ***", description.getMethodName()));
baseLog.info(String.format("**** end #test %s() ***", description.getMethodName()));
}
};
@ -271,7 +276,7 @@ public abstract class ActiveMQTestBase extends Assert {
}
protected <T> T serialClone(Object object) throws Exception {
System.out.println("object::" + object);
log.debug("object::" + object);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream obOut = new ObjectOutputStream(bout);
obOut.writeObject(object);
@ -1088,16 +1093,16 @@ public abstract class ActiveMQTestBase extends Assert {
} else if (prop.getPropertyType() == Double.class || prop.getPropertyType() == Double.TYPE) {
value = RandomUtil.randomDouble();
} else {
System.out.println("Can't validate property of type " + prop.getPropertyType() + " on " + prop.getName());
log.debug("Can't validate property of type " + prop.getPropertyType() + " on " + prop.getName());
value = null;
}
if (value != null && prop.getWriteMethod() != null && prop.getReadMethod() == null) {
System.out.println("WriteOnly property " + prop.getName() + " on " + pojo.getClass());
log.debug("WriteOnly property " + prop.getName() + " on " + pojo.getClass());
} else if (value != null && prop.getWriteMethod() != null &&
prop.getReadMethod() != null &&
!ignoreSet.contains(prop.getName())) {
System.out.println("Validating " + prop.getName() + " type = " + prop.getPropertyType());
log.debug("Validating " + prop.getName() + " type = " + prop.getPropertyType());
prop.getWriteMethod().invoke(pojo, value);
Assert.assertEquals("Property " + prop.getName(), value, prop.getReadMethod().invoke(pojo));
@ -1300,7 +1305,7 @@ public abstract class ActiveMQTestBase extends Assert {
}
if (!server.isStarted()) {
log.info(threadDump("Server didn't start"));
baseLog.info(threadDump("Server didn't start"));
fail("server didn't start: " + server);
}
@ -1322,7 +1327,7 @@ public abstract class ActiveMQTestBase extends Assert {
}
if (server.isStarted()) {
log.info(threadDump("Server didn't start"));
baseLog.info(threadDump("Server didn't start"));
fail("Server didn't start: " + server);
}
}
@ -1821,9 +1826,6 @@ public abstract class ActiveMQTestBase extends Assert {
}
AtomicInteger getType(byte key) {
if (key == 0) {
System.out.println("huh?");
}
Integer ikey = (int) key;
AtomicInteger value = recordsType.get(ikey);
if (value == null) {
@ -1939,7 +1941,7 @@ public abstract class ActiveMQTestBase extends Assert {
")" +
")";
log.error(msg);
baseLog.error(msg);
return false;
}
@ -2033,7 +2035,7 @@ public abstract class ActiveMQTestBase extends Assert {
int invmSize = InVMRegistry.instance.size();
if (invmSize > 0) {
InVMRegistry.instance.clear();
log.info(threadDump("Thread dump"));
baseLog.info(threadDump("Thread dump"));
fail("invm registry still had acceptors registered");
}
@ -2050,14 +2052,14 @@ public abstract class ActiveMQTestBase extends Assert {
try {
ServerLocatorImpl.clearThreadPools();
} catch (Throwable e) {
log.info(threadDump(e.getMessage()));
baseLog.info(threadDump(e.getMessage()));
System.err.println(threadDump(e.getMessage()));
}
try {
NettyConnector.clearThreadPools();
} catch (Exception e) {
log.info(threadDump(e.getMessage()));
baseLog.info(threadDump(e.getMessage()));
System.err.println(threadDump(e.getMessage()));
}
}

View File

@ -25,17 +25,19 @@ import org.apache.activemq.artemis.core.config.ConfigurationUtils;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor;
import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
import org.apache.activemq.artemis.utils.ConfigurationHelper;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class AcceptorParserTest {
private static final Logger log = Logger.getLogger(AcceptorParserTest.class);
@Test
public void testAcceptor() throws Exception {
List<TransportConfiguration> configs = ConfigurationUtils.parseAcceptorURI("test", "tcp://localhost:8080?tcpSendBufferSize=1048576&tcpReceiveBufferSize=1048576&protocols=openwire&banana=x");
for (TransportConfiguration config : configs) {
System.out.println("config:" + config);
log.debug("config:" + config);
Assert.assertTrue(config.getExtraParams().get("banana").equals("x"));
}
}
@ -60,8 +62,8 @@ public class AcceptorParserTest {
List<TransportConfiguration> configs = ConfigurationUtils.parseAcceptorURI("test", "tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;virtualTopicConsumerWildcards=Consumer.*.%3E%3B2");
for (TransportConfiguration config : configs) {
System.out.println("config:" + config);
System.out.println(config.getExtraParams().get("virtualTopicConsumerWildcards"));
log.debug("config:" + config);
log.debug(config.getExtraParams().get("virtualTopicConsumerWildcards"));
Assert.assertTrue(config.getExtraParams().get("virtualTopicConsumerWildcards").equals("Consumer.*.>;2"));
}
}

11
pom.xml
View File

@ -75,6 +75,7 @@
<staging.siteURL>scp://people.apache.org/x1/www/activemq.apache.org</staging.siteURL>
<retryTests>false</retryTests>
<logging.config>logging.properties</logging.config>
<activemq-artemis-native-version>1.0.1</activemq-artemis-native-version>
<karaf.version>4.0.6</karaf.version>
@ -175,7 +176,7 @@
-->
<activemq-surefire-argline>-Dorg.apache.activemq.artemis.utils.RetryRule.retry=${retryTests} -Dbrokerconfig.maxDiskUsage=100 -Dorg.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_QUIET_PERIOD=0 -Dorg.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_SHUTDOWN_TIMEOUT=0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Dlogging.configuration="file:${activemq.basedir}/tests/config/logging.properties"
-Dlogging.configuration="file:${activemq.basedir}/tests/config/${logging.config}"
-Djava.library.path="${activemq.basedir}/target/bin/lib/linux-x86_64:${activemq.basedir}/target/bin/lib/linux-i686" -Djgroups.bind_addr=localhost -Dorg.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory.localBindAddress=localhost
-Djava.net.preferIPv4Stack=true -Dbasedir=${basedir}
</activemq-surefire-argline>
@ -1023,6 +1024,14 @@
<retryTests>true</retryTests>
</properties>
</profile>
<profile>
<!-- this will activate the property required to limit logging on the testsuite -->
<id>tests-CI</id>
<properties>
<!-- notice I did not intend to use retryTests on this profile, as this will be optional depending on where you run the tests -->
<logging.config>logging-CI.properties</logging.config>
</properties>
</profile>
<profile>
<!-- tests is the profile we use to run the entire testsuite
Running this entire build could take up to 2 hours -->

View File

@ -45,8 +45,6 @@ Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
try {
latch.await(5, TimeUnit.SECONDS);
System.out.println("Count is " + latch.getCount());
System.out.println("Retrieved transport params: " + transportParams);
// cluster topology message should arrive immediately after connecting
GroovyRun.assertEquals(0, (int) latch.getCount());

View File

@ -65,7 +65,6 @@ for (int i = 0; i < consumers; i++) {
void run() {
try {
int threadid = running.incrementAndGet();
System.out.println("Running " + threadid)
Connection connection = cf.createConnection();
connection.setClientID(clientType + threadid)
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -100,6 +99,5 @@ if (!latchStarted.await(10, TimeUnit.SECONDS)) {
System.err.prntln("Could not start consumers")
errorsConsumer.incrementAndGet()
}
System.out.println("Running::" + clientType + "::" + running)
return running;

View File

@ -43,9 +43,6 @@ if (legacyOption) {
topicName = "topic";
}
System.out.println("topicName = " + topicName);
if (clientType.startsWith("ARTEMIS")) {
// Can't depend directly on artemis, otherwise it wouldn't compile in hornetq
GroovyRun.evaluate("clients/artemisClient.groovy", "serverArg", "ARTEMIS");

View File

@ -38,10 +38,8 @@ connection.start()
Message message = queueConsumer.receive(5000);
GroovyRun.assertNotNull(message)
session.commit();
System.out.println("Received " + message + " from: " + myQueue);
queueConsumer.close();
System.out.println("Sending message to: " + message.getJMSReplyTo());
MessageProducer producer = session.createProducer(message.getJMSReplyTo());
message = session.createMessage();
producer.send(message);

View File

@ -41,15 +41,12 @@ MessageProducer queueProducer = session.createProducer(myQueue)
queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
Message message = session.createMessage();
message.setJMSReplyTo(temporaryQueue);
System.out.println("Sending " + message + " to: " + myQueue);
queueProducer.send(message);
session.commit();
System.out.println("Receiving message from: " + temporaryQueue);
message = consumer.receive(10000);
GroovyRun.assertNotNull(message);
session.commit();
System.out.println("Received message: " + message);
connection.close();
senderLatch.countDown();

View File

@ -38,10 +38,8 @@ connection.start()
Message message = queueConsumer.receive(5000);
GroovyRun.assertNotNull(message)
session.commit();
System.out.println("Received " + message + " from: " + myQueue);
queueConsumer.close();
System.out.println("Sending message to: " + message.getJMSReplyTo());
MessageProducer producer = session.createProducer(message.getJMSReplyTo());
message = session.createMessage();
producer.send(message);

View File

@ -41,15 +41,12 @@ MessageProducer queueProducer = session.createProducer(myQueue)
queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
Message message = session.createMessage();
message.setJMSReplyTo(temporaryQueue);
System.out.println("Sending " + message + " to: " + myQueue);
queueProducer.send(message);
session.commit();
System.out.println("Receiving message from: " + temporaryQueue);
message = consumer.receive(10000);
GroovyRun.assertNotNull(message);
session.commit();
System.out.println("Received message: " + message);
connection.close();
senderLatch.countDown();

View File

@ -41,11 +41,9 @@ connection.start()
for (int i = 0; i < 5; i++) {
Message message = queueConsumer.receive(5000);
GroovyRun.assertNotNull(message)
System.out.println("Received " + message + " from: " + myQueue);
GroovyRun.assertEquals("myQueue", ((Queue)message.getJMSDestination()).getQueueName());
System.out.println("Sending message to: " + message.getJMSReplyTo());
MessageProducer producer = session.createProducer(message.getJMSReplyTo());
message = session.createMessage();
producer.send(message);

View File

@ -36,11 +36,9 @@ Queue myQueue = session.createQueue("myQueue");
GroovyRun.assertEquals("myQueue", myQueue.getQueueName());
System.out.println("myQueue::" + myQueue);
TemporaryTopic replyTopic = session.createTemporaryTopic();
MessageConsumer consumer = session.createConsumer(replyTopic);
System.out.println("Temporary Topic " + replyTopic);
MessageProducer queueProducer = session.createProducer(myQueue)
@ -53,14 +51,12 @@ sendMessage(session.createMessage(), replyTopic, myQueue, queueProducer);
session.commit();
System.out.println("Receiving message from: " + replyTopic);
for (int i = 0; i < 5; i++) {
message = consumer.receive(10000);
GroovyRun.assertNotNull(message);
}
GroovyRun.assertNull(consumer.receiveNoWait());
session.commit();
System.out.println("Received message: " + message);
connection.close();
senderLatch.countDown();
@ -68,6 +64,5 @@ senderLatch.countDown();
void sendMessage(Message message, TemporaryTopic replyTopic, Queue myQueue, MessageProducer queueProducer) {
message.setJMSReplyTo(replyTopic);
System.out.println("Sending " + message + " to: " + myQueue);
queueProducer.send(message);
}

View File

@ -38,10 +38,8 @@ connection.start()
Message message = queueConsumer.receive(5000);
GroovyRun.assertNotNull(message)
session.commit();
System.out.println("Received " + message + " from: " + myQueue);
queueConsumer.close();
System.out.println("Sending message to: " + message.getJMSReplyTo());
MessageProducer producer = session.createProducer(message.getJMSReplyTo());
message = session.createMessage();
producer.send(message);

View File

@ -41,15 +41,12 @@ MessageProducer queueProducer = session.createProducer(myQueue)
queueProducer.setDeliveryMode(DeliveryMode.PERSISTENT);
Message message = session.createMessage();
message.setJMSReplyTo(replyTopic);
System.out.println("Sending " + message + " to: " + myQueue);
queueProducer.send(message);
session.commit();
System.out.println("Receiving message from: " + replyTopic);
message = consumer.receive(10000);
GroovyRun.assertNotNull(message);
session.commit();
System.out.println("Received message: " + message);
connection.close();
senderLatch.countDown();

View File

@ -99,7 +99,6 @@ public class HornetQSoakTest extends ClasspathBase {
AtomicInteger runningConsumer1XArtemis = (AtomicInteger) evaluate(artemis1XClassLoader, "hqsoak/receiveMessages.groovy", "ARTEMIS1X", "" + numberOfConsumersArtemis, "" + totalMessagePerQueue);
AtomicInteger runningConsumerHornetQ = (AtomicInteger) evaluate(hornetqClassLoader, "hqsoak/receiveMessages.groovy", "HORNETQ", "" + numberOfConsumersHornetQ, "" + totalMessagePerQueue);
System.out.println("Running producers");
AtomicInteger ranArtemisProducer = (AtomicInteger) evaluate(artemisClassLoader, "hqsoak/sendMessages.groovy", "ARTEMIS", "" + threadsProducerArtemis, "" + numberOfMessagesArtemis);
AtomicInteger ranHornetQProducer = (AtomicInteger) evaluate(hornetqClassLoader, "hqsoak/sendMessages.groovy", "HORNETQ", "" + threadsProducerHornetQ, "" + numberOfMessagesHornetQ);

View File

@ -0,0 +1,72 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This is the logger used only on CI environments
# Additional logger names to configure (root logger is always configured)
# Root logger option
loggers=org.jboss.logging,org.apache.activemq.artemis.core.server,org.apache.activemq.artemis.utils,org.apache.activemq.artemis.journal,org.apache.activemq.artemis.jms,org.apache.activemq.artemis.ra,org.apache.activemq.artemis.tests.unit,org.apache.activemq.artemis.tests.integration,org.apache.activemq.artemis.jms.tests,org.apache.activemq.audit
# Root logger level
logger.level=WARN
# ActiveMQ Artemis logger levels
logger.org.apache.activemq.artemis.core.server.level=WARN
logger.org.apache.activemq.artemis.journal.level=WARN
logger.org.apache.activemq.artemis.utils.level=WARN
logger.org.apache.activemq.artemis.jms.level=WARN
logger.org.apache.activemq.artemis.ra.level=WARN
logger.org.apache.activemq.artemis.tests.integration.level=INFO
logger.org.apache.activemq.artemis.tests.level=INFO
logger.org.apache.activemq.artemis.tests.unit.level=INFO
logger.org.apache.activemq.artemis.jms.tests.level=INFO
# Root logger handlers
logger.handlers=CONSOLE,TEST
#logger.handlers=CONSOLE,FILE
# to enable audit change the level to INFO
logger.org.apache.activemq.audit.level=ERROR
logger.org.apache.activemq.audit.handlers=CONSOLE,FILE
logger.org.apache.activemq.audit.useParentHandlers=false
# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=FINE
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN
# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=FINE
handler.FILE.properties=autoFlush,fileName
handler.FILE.autoFlush=true
handler.FILE.fileName=target/activemq.log
handler.FILE.formatter=PATTERN
# Console handler configuration
handler.TEST=org.apache.activemq.artemis.logs.AssertionLoggerHandler
handler.TEST.level=TRACE
handler.TEST.formatter=PATTERN
# Formatter pattern configuration
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=[%t] %d{HH:mm:ss,SSS} %-5p [%c] %s%E%n

View File

@ -27,9 +27,12 @@ logger.org.apache.activemq.artemis.journal.level=INFO
logger.org.apache.activemq.artemis.utils.level=INFO
logger.org.apache.activemq.artemis.jms.level=INFO
logger.org.apache.activemq.artemis.ra.level=INFO
logger.org.apache.activemq.artemis.tests.unit.level=INFO
logger.org.apache.activemq.artemis.tests.integration.level=INFO
logger.org.apache.activemq.artemis.jms.tests.level=INFO
logger.org.apache.activemq.artemis.tests.integration.level=DEBUG
logger.org.apache.activemq.artemis.tests.level=DEBUG
logger.org.apache.activemq.artemis.tests.unit.level=DEBUG
logger.org.apache.activemq.artemis.jms.tests.level=DEBUG
# Root logger handlers
logger.handlers=CONSOLE,TEST
@ -37,7 +40,7 @@ logger.handlers=CONSOLE,TEST
# to enable audit change the level to INFO
logger.org.apache.activemq.audit.level=ERROR
logger.org.apache.activemq.audit.handlers=AUDIT_FILE
logger.org.apache.activemq.audit.handlers=CONSOLE,FILE
logger.org.apache.activemq.audit.useParentHandlers=false
# Console handler configuration
@ -64,17 +67,3 @@ handler.TEST.formatter=PATTERN
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=[%t] %d{HH:mm:ss,SSS} %-5p [%c] %s%E%n
#Audit logger
handler.AUDIT_FILE=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.AUDIT_FILE.level=INFO
handler.AUDIT_FILE.properties=suffix,append,autoFlush,fileName
handler.AUDIT_FILE.suffix=.yyyy-MM-dd
handler.AUDIT_FILE.append=true
handler.AUDIT_FILE.autoFlush=true
handler.AUDIT_FILE.fileName=target/audit.log
handler.AUDIT_FILE.formatter=AUDIT_PATTERN
formatter.AUDIT_PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.AUDIT_PATTERN.properties=pattern
formatter.AUDIT_PATTERN.pattern=%d [AUDIT](%t) %s%E%n

View File

@ -46,6 +46,7 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -53,6 +54,7 @@ import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class)
public class BMFailoverTest extends FailoverTestBase {
private static final Logger log = Logger.getLogger(BMFailoverTest.class);
private ServerLocator locator;
private ClientSessionFactoryInternal sf;
@ -198,7 +200,7 @@ public class BMFailoverTest extends FailoverTestBase {
assertNotNull(m);
System.out.println("********************" + m.getIntProperty("counter"));
log.debug("********************" + m.getIntProperty("counter"));
//the mdb would ack the message before calling onMessage()
m.acknowledge();
@ -232,7 +234,7 @@ public class BMFailoverTest extends FailoverTestBase {
//the mdb would ack the message before calling onMessage()
m.acknowledge();
System.out.println("********************" + m.getIntProperty("counter"));
log.debug("********************" + m.getIntProperty("counter"));
xaSessionRec.getXAResource().end(xidRec, XAResource.TMSUCCESS);
xaSessionRec.getXAResource().prepare(xidRec);

View File

@ -45,6 +45,7 @@ import org.apache.activemq.artemis.utils.ReusableLatch;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -54,6 +55,7 @@ import org.junit.runner.RunWith;
*/
@RunWith(BMUnitRunner.class)
public class ConcurrentDeliveryCancelTest extends JMSTestBase {
private static final Logger log = Logger.getLogger(ConcurrentDeliveryCancelTest.class);
// used to wait the thread to align at the same place and create the race
private static final ReusableLatch latchEnter = new ReusableLatch(2);
@ -89,7 +91,7 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
action = "org.apache.activemq.artemis.tests.extras.byteman.ConcurrentDeliveryCancelTest.enterCancel();")})
public void testConcurrentCancels() throws Exception {
System.out.println(server.getConfiguration().getJournalLocation().toString());
log.debug(server.getConfiguration().getJournalLocation().toString());
server.getAddressSettingsRepository().clear();
AddressSettings settings = new AddressSettings();
settings.setMaxDeliveryAttempts(-1);
@ -98,9 +100,9 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
cf.setReconnectAttempts(0);
cf.setRetryInterval(10);
System.out.println(".....");
log.debug(".....");
for (ServerSession srvSess : server.getSessions()) {
System.out.println(srvSess);
log.debug(srvSess);
}
String queueName = RandomUtil.randomString();
@ -142,14 +144,14 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
Assert.assertNotNull(consumer.receiveNoWait());
}
System.out.println(".....");
log.debug(".....");
final List<ServerSession> serverSessions = new LinkedList<>();
// We will force now the failure simultaneously from several places
for (ServerSession srvSess : server.getSessions()) {
if (srvSess.getMetaData("theSession") != null) {
System.out.println(srvSess);
log.debug(srvSess);
serverSessions.add(srvSess);
}
}
@ -166,9 +168,9 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
@Override
public void run() {
try {
System.out.println(Thread.currentThread().getName() + " closing consumer");
log.debug(Thread.currentThread().getName() + " closing consumer");
consumer.close();
System.out.println(Thread.currentThread().getName() + " closed consumer");
log.debug(Thread.currentThread().getName() + " closed consumer");
} catch (Exception e) {
e.printStackTrace();
}
@ -179,7 +181,7 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
@Override
public void run() {
for (ServerSession sess : serverSessions) {
System.out.println("Thread " + Thread.currentThread().getName() + " starting");
log.debug("Thread " + Thread.currentThread().getName() + " starting");
try {
// A session.close could sneak in through failover or some other scenarios.
// a call to RemotingConnection.fail wasn't replicating the issue.
@ -188,7 +190,7 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Thread " + Thread.currentThread().getName() + " done");
log.debug("Thread " + Thread.currentThread().getName() + " done");
}
}
});
@ -239,10 +241,10 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase {
for (int i = 0; i < numberOfMessages; i++) {
AtomicInteger count = mapCount.get(i);
if (count == null) {
System.out.println("Message " + i + " not received");
log.debug("Message " + i + " not received");
failed = true;
} else if (count.get() > 1) {
System.out.println("Message " + i + " received " + count.get() + " times");
log.debug("Message " + i + " received " + count.get() + " times");
failed = true;
}
}

View File

@ -24,12 +24,14 @@ import org.apache.activemq.artemis.core.server.impl.FileLockNodeManager;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class)
public class FileLockNodeManagerTest {
private static final Logger log = Logger.getLogger(FileLockNodeManagerTest.class);
private static final int TIMEOUT_TOLERANCE = 50;
@ -59,7 +61,7 @@ public class FileLockNodeManagerTest {
protected void assertMeasuredTimeoutFor(long lockAcquisitionTimeout) throws Exception {
long realTimeout = measureLockAcquisisionTimeout(lockAcquisitionTimeout);
System.out.println(String.format("lockAcquisisionTimeout: %d ms, measured timeout: %d ms", lockAcquisitionTimeout, realTimeout));
log.debug(String.format("lockAcquisisionTimeout: %d ms, measured timeout: %d ms", lockAcquisitionTimeout, realTimeout));
Assert.assertTrue(String.format("Timeout %d ms was larger than expected %d ms", realTimeout, lockAcquisitionTimeout + TIMEOUT_TOLERANCE),
lockAcquisitionTimeout + TIMEOUT_TOLERANCE >= realTimeout);
Assert.assertTrue(String.format("Timeout %d ms was lower than expected %d ms", realTimeout, lockAcquisitionTimeout),

View File

@ -32,6 +32,7 @@ import org.apache.activemq.artemis.tests.util.JMSTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -41,6 +42,7 @@ import org.junit.runner.RunWith;
*/
@RunWith(BMUnitRunner.class)
public class GroupingTest extends JMSTestBase {
private static final Logger log = Logger.getLogger(GroupingTest.class);
private Queue queue;
static boolean pause = false;
@ -149,12 +151,12 @@ public class GroupingTest extends JMSTestBase {
public static void pause() {
if (pause) {
try {
System.out.println("pausing after rollback");
log.debug("pausing after rollback");
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
System.out.println("finished pausing after rollback");
log.debug("finished pausing after rollback");
}
}
}

View File

@ -42,13 +42,14 @@ import org.apache.activemq.artemis.tests.integration.cluster.failover.FailoverTe
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class)
public class LargeMessageReplicationTest extends FailoverTestBase {
private static final Logger log = Logger.getLogger(LargeMessageReplicationTest.class);
private static final String DIVERT_ADDRESS = "jms.queue.testQueue";
private static final String DIVERT_FORWARD_ADDRESS = "jms.queue.divertedQueue";
@ -184,7 +185,7 @@ public class LargeMessageReplicationTest extends FailoverTestBase {
}
private static void copyThread() {
System.out.println("_************************ " + Thread.currentThread().getId());
log.debug("_************************ " + Thread.currentThread().getId());
copyThread.set(Thread.currentThread().getId());
}

View File

@ -40,7 +40,7 @@ public class LatencyTest extends ActiveMQTestBase {
targetClass = "org.jboss.netty.bootstrap.ClientBootstrap",
targetMethod = "connect",
targetLocation = "ENTRY",
action = "System.out.println(\"netty connecting\")"), @BMRule(
action = "log.debug(\"netty connecting\")"), @BMRule(
name = "sleep OioWorker.run",
targetClass = "org.jboss.netty.channel.socket.oio.OioWorker",
targetMethod = "run",

View File

@ -26,6 +26,7 @@ import org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServer
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -39,6 +40,7 @@ import org.junit.runner.RunWith;
*/
@RunWith(BMUnitRunner.class)
public class LoggingActiveMQServerPluginOpenWireTest extends LoggingActiveMQServerPluginTest {
private static final Logger log = Logger.getLogger(LoggingActiveMQServerPluginOpenWireTest.class);
/**
* Aim: test queue creation are logged when plugin configured with
@ -157,8 +159,8 @@ public class LoggingActiveMQServerPluginOpenWireTest extends LoggingActiveMQServ
Thread.sleep(500);
for (String log : unexpectedLogs) {
System.out.println(" others events logged >>>>" + log);
for (String logline : unexpectedLogs) {
log.debug(" others events logged >>>>" + logline);
}
assertEquals("created connections", 2, createdConnectionLogs.size());

View File

@ -30,6 +30,7 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@ -37,6 +38,7 @@ import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class)
public class ManagementExceptionHandlingTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(ManagementExceptionHandlingTest.class);
protected ActiveMQServer server = null;
@ -89,7 +91,7 @@ public class ManagementExceptionHandlingTest extends ActiveMQTestBase {
public void testAddressControl() throws Exception {
server.getActiveMQServerControl().createAddress("test.address", "ANYCAST");
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
System.out.println("server is " + mbs);
log.debug("server is " + mbs);
ObjectName objectName = new ObjectName("org.apache.activemq.artemis:broker=\"localhost\",component=addresses,address=\"test.address\"");
Object[] params = new Object[] {new HashMap(), 3, "aGVsbG8=", true, null, null};
String[] signature = new String[] {"java.util.Map", "int", "java.lang.String", "boolean", "java.lang.String", "java.lang.String"};

View File

@ -109,7 +109,7 @@ public class OrphanedConsumerTest extends ActiveMQTestBase {
targetMethod = "close",
targetLocation = "AT EXIT",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()",
action = "System.out.println(\"throwing stuff\");throw new InterruptedException()"), @BMRule(
action = "log.debug(\"throwing stuff\");throw new InterruptedException()"), @BMRule(
name = "closeEnter",
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl",
targetMethod = "close",
@ -136,7 +136,7 @@ public class OrphanedConsumerTest extends ActiveMQTestBase {
targetMethod = "close",
targetLocation = "AT EXIT",
condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()",
action = "System.out.println(\"throwing stuff\");throw new InterruptedException()"), @BMRule(
action = "log.debug(\"throwing stuff\");throw new InterruptedException()"), @BMRule(
name = "closeEnter",
targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl",
targetMethod = "close",

View File

@ -39,6 +39,7 @@ import org.apache.activemq.artemis.tests.util.Wait;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -46,6 +47,7 @@ import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class)
public class PagingLeakTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(PagingLeakTest.class);
private static final AtomicInteger pagePosInstances = new AtomicInteger(0);
@ -76,7 +78,7 @@ public class PagingLeakTest extends ActiveMQTestBase {
targetLocation = "ENTRY",
action = "org.apache.activemq.artemis.tests.extras.byteman.PagingLeakTest.deletePosition()")})
public void testValidateLeak() throws Throwable {
System.out.println("location::" + getBindingsDir());
log.debug("location::" + getBindingsDir());
List<PagePositionImpl> positions = new ArrayList<>();
@ -166,7 +168,7 @@ public class PagingLeakTest extends ActiveMQTestBase {
}
if (i % 1000 == 0) {
System.out.println("Consumed " + i + " events in " + (System.currentTimeMillis() - lastTime));
log.debug("Consumed " + i + " events in " + (System.currentTimeMillis() - lastTime));
lastTime = System.currentTimeMillis();
}
}
@ -194,7 +196,7 @@ public class PagingLeakTest extends ActiveMQTestBase {
producer.send(msg);
if (i == 100) {
System.out.println("Starting consumers!!!");
log.debug("Starting consumers!!!");
consumer1.start();
consumer2.start();
}
@ -205,7 +207,7 @@ public class PagingLeakTest extends ActiveMQTestBase {
}
System.out.println("Sent " + numberOfMessages);
log.debug("Sent " + numberOfMessages);
consumer1.join();
consumer2.join();

View File

@ -41,6 +41,7 @@ import org.apache.activemq.artemis.utils.ReusableLatch;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -53,6 +54,7 @@ import org.junit.runner.RunWith;
*/
@RunWith(BMUnitRunner.class)
public class RaceOnSyncLargeMessageOverReplication2Test extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(RaceOnSyncLargeMessageOverReplication2Test.class);
public static int messageChunkCount = 0;
@ -84,7 +86,7 @@ public class RaceOnSyncLargeMessageOverReplication2Test extends ActiveMQTestBase
public void setUp() throws Exception {
super.setUp();
System.out.println("Tmp::" + getTemporaryDir());
log.debug("Tmp::" + getTemporaryDir());
flagChunkEntered.setCount(1);
flagChunkWait.setCount(1);
@ -211,7 +213,7 @@ public class RaceOnSyncLargeMessageOverReplication2Test extends ActiveMQTestBase
t.join(5000);
System.out.println("Thread joined");
log.debug("Thread joined");
Assert.assertFalse(t.isAlive());

View File

@ -40,6 +40,7 @@ import org.apache.activemq.artemis.utils.ReusableLatch;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -51,6 +52,7 @@ import org.junit.runner.RunWith;
*/
@RunWith(BMUnitRunner.class)
public class RaceOnSyncLargeMessageOverReplicationTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(RaceOnSyncLargeMessageOverReplicationTest.class);
private static ActiveMQServer backupServer;
private static ActiveMQServer liveServer;
@ -75,7 +77,7 @@ public class RaceOnSyncLargeMessageOverReplicationTest extends ActiveMQTestBase
public void setUp() throws Exception {
super.setUp();
System.out.println("Tmp::" + getTemporaryDir());
log.debug("Tmp::" + getTemporaryDir());
flagArrived.setCount(1);
flagWait.setCount(1);
@ -196,7 +198,7 @@ public class RaceOnSyncLargeMessageOverReplicationTest extends ActiveMQTestBase
t.join(5000);
System.out.println("Thread joined");
log.debug("Thread joined");
Assert.assertFalse(t.isAlive());

View File

@ -26,6 +26,7 @@ import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancing
import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -33,6 +34,7 @@ import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class)
public class ScaleDownFailoverTest extends ClusterTestBase {
private static final Logger log = Logger.getLogger(ScaleDownFailoverTest.class);
protected static int stopCount = 0;
private static ActiveMQServer[] staticServers;
@ -159,7 +161,7 @@ public class ScaleDownFailoverTest extends ClusterTestBase {
if (transportConfiguration.getParams().get(TransportConstants.PORT_PROP_NAME).equals(tc.getParams().get(TransportConstants.PORT_PROP_NAME))) {
activeMQServer.stop();
stopCount++;
System.out.println("Stopping server listening at: " + tc.getParams().get(TransportConstants.PORT_PROP_NAME));
log.debug("Stopping server listening at: " + tc.getParams().get(TransportConstants.PORT_PROP_NAME));
}
}
}

View File

@ -31,6 +31,7 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -39,6 +40,7 @@ import org.junit.runner.RunWith;
*/
@RunWith(BMUnitRunner.class)
public class StartStopDeadlockTest extends ActiveMQTestBase {
private static final Logger log = Logger.getLogger(StartStopDeadlockTest.class);
/*
* simple test to make sure connect still works with some network latency built into netty
@ -52,7 +54,7 @@ public class StartStopDeadlockTest extends ActiveMQTestBase {
targetMethod = "initialisePart2",
targetLocation = "ENTRY",
condition = "incrementCounter(\"server-Init\") == 2",
action = "System.out.println(\"server backup init\"), waitFor(\"start-init\")"), @BMRule(
action = "log.debug(\"server backup init\"), waitFor(\"start-init\")"), @BMRule(
name = "JMSServer.stop wait-init",
targetClass = "org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl",
targetMethod = "stop",
@ -91,7 +93,7 @@ public class StartStopDeadlockTest extends ActiveMQTestBase {
try {
align.countDown();
startLatch.await();
System.out.println("Crashing....");
log.debug("Crashing....");
serverLive.fail(true);
} catch (Exception e) {
errors.incrementAndGet();

View File

@ -24,12 +24,14 @@ import javax.jms.Session;
import org.jboss.byteman.contrib.bmunit.BMRule;
import org.jboss.byteman.contrib.bmunit.BMRules;
import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(BMUnitRunner.class)
public class FileSystemSyncBlockedTest extends CriticalAnalyzerFaultInjectionTestBase {
private static final Logger log = Logger.getLogger(FileSystemSyncBlockedTest.class);
@BMRules(rules = {@BMRule(name = "Simulate Slow Disk Sync", targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile", targetMethod = "sync", targetLocation = "ENTRY", condition = "!flagged(\"testSlowDiskSync\")", // Once the server shutdowns we stop applying this rule.
action = "waitFor(\"testSlowDiskSync\")"), @BMRule(
@ -57,7 +59,7 @@ public class FileSystemSyncBlockedTest extends CriticalAnalyzerFaultInjectionTes
// if you have more than 100 components, then you have a leak!
Assert.assertTrue(server.getStorageManager().getJournalSequentialFileFactory().getCriticalAnalyzer().getNumberOfComponents() < 10);
System.out.println("Number of components:" + server.getStorageManager().getJournalSequentialFileFactory().getCriticalAnalyzer().getNumberOfComponents());
log.debug("Number of components:" + server.getStorageManager().getJournalSequentialFileFactory().getCriticalAnalyzer().getNumberOfComponents());
}
}

View File

@ -58,7 +58,6 @@ import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQMessage;
import org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.After;
import org.junit.Assert;
@ -66,8 +65,6 @@ import org.junit.Before;
public abstract class BridgeTestBase extends ActiveMQTestBase {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
protected ConnectionFactoryFactory cff0, cff1;
protected ConnectionFactoryFactory cff0xa, cff1xa;
@ -396,8 +393,6 @@ public abstract class BridgeTestBase extends ActiveMQTestBase {
// but you still might get some depending on how/where the crash occurred
}
BridgeTestBase.log.trace("Check complete");
} finally {
if (conn != null) {
conn.close();

View File

@ -31,12 +31,9 @@ import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
public class FailingTransactionManager implements TransactionManager {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
private final TransactionManager tm;
private int calls;
private final int limit;
@ -126,7 +123,6 @@ public class FailingTransactionManager implements TransactionManager {
} else {
int fails = failures.incrementAndGet();
RollbackException ex = new RollbackException("Expected rollback for test");
log.tracef(ex, "We are about to fail commit for %s th time", fails);
throw ex;
}
}

View File

@ -24,6 +24,7 @@ import org.apache.activemq.artemis.jms.bridge.ConnectionFactoryFactory;
import org.apache.activemq.artemis.jms.bridge.DestinationFactory;
import org.apache.activemq.artemis.jms.bridge.QualityOfServiceMode;
import org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl;
import org.jboss.logging.Logger;
import org.junit.Before;
import org.junit.Test;
@ -33,6 +34,7 @@ import org.junit.Test;
* Tests of jms bridge using HA connection factories.
*/
public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase {
private static final Logger log = Logger.getLogger(JMSBridgeClusteredTest.class);
private ServerGroup sourceServer;
private ServerGroup targetServer;
@ -103,7 +105,7 @@ public class JMSBridgeClusteredTest extends ClusteredBridgeTestBase {
//start the bridge
bridge.start();
System.out.println("started bridge");
log.debug("started bridge");
final int NUM_MESSAGES = batchSize / 2;

View File

@ -32,20 +32,16 @@ import org.apache.activemq.artemis.jms.bridge.ConnectionFactoryFactory;
import org.apache.activemq.artemis.jms.bridge.QualityOfServiceMode;
import org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl;
import org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.ra.DummyTransactionManager;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Test;
public class JMSBridgeReconnectionTest extends BridgeTestBase {
private static final Logger log = Logger.getLogger(JMSBridgeReconnectionTest.class);
/**
*
*/
private static final int TIME_WAIT = 5000;
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
// Crash and reconnect
// Once and only once
@ -185,17 +181,17 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
// Now crash the dest server
JMSBridgeReconnectionTest.log.info("About to crash server");
instanceLog.debug("About to crash server");
server1.stop();
// Wait a while before starting up to simulate the dest being down for a while
JMSBridgeReconnectionTest.log.info("Waiting 5 secs before bringing server back up");
instanceLog.debug("Waiting 5 secs before bringing server back up");
Thread.sleep(TIME_WAIT);
JMSBridgeReconnectionTest.log.info("Done wait");
instanceLog.debug("Done wait");
// Restart the server
JMSBridgeReconnectionTest.log.info("Restarting server");
instanceLog.debug("Restarting server");
server1.start();
// jmsServer1.createQueue(false, "targetQueue", null, true, "queue/targetQueue");
@ -206,17 +202,17 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
// Send some more messages
JMSBridgeReconnectionTest.log.info("Sending more messages");
instanceLog.debug("Sending more messages");
sendMessages(cf0, sourceQueue, NUM_MESSAGES / 2, NUM_MESSAGES / 2, persistent, largeMessage);
JMSBridgeReconnectionTest.log.info("Sent messages");
instanceLog.debug("Sent messages");
server1.stop();
bridge.stop();
System.out.println("JMSBridgeReconnectionTest.performCrashAndReconnectDestBasic");
log.debug("JMSBridgeReconnectionTest.performCrashAndReconnectDestBasic");
}
@Test
@ -246,14 +242,14 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
checkAllMessageReceivedInOrder(cf1, targetQueue, 0, 1, false);
JMSBridgeReconnectionTest.log.info("About to crash server");
instanceLog.debug("About to crash server");
server1.stop();
// Wait a while before starting up to simulate the dest being down for a while
JMSBridgeReconnectionTest.log.info("Waiting 5 secs before bringing server back up");
instanceLog.debug("Waiting 5 secs before bringing server back up");
Thread.sleep(TIME_WAIT);
JMSBridgeReconnectionTest.log.info("Done wait");
instanceLog.debug("Done wait");
bridge.stop();
@ -301,7 +297,7 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
// Now crash the dest server
JMSBridgeReconnectionTest.log.info("About to crash server");
instanceLog.debug("About to crash server");
server1.stop();
@ -309,9 +305,9 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
server1.start();
}
// Wait a while before starting up to simulate the dest being down for a while
JMSBridgeReconnectionTest.log.info("Waiting 5 secs before bringing server back up");
instanceLog.debug("Waiting 5 secs before bringing server back up");
Thread.sleep(TIME_WAIT);
JMSBridgeReconnectionTest.log.info("Done wait");
instanceLog.debug("Done wait");
bridge.stop();
@ -394,14 +390,14 @@ public class JMSBridgeReconnectionTest extends BridgeTestBase {
// Now crash the dest server
JMSBridgeReconnectionTest.log.info("About to crash server");
instanceLog.debug("About to crash server");
server1.stop();
// Wait a while before starting up to simulate the dest being down for a while
JMSBridgeReconnectionTest.log.info("Waiting 5 secs before bringing server back up");
instanceLog.debug("Waiting 5 secs before bringing server back up");
Thread.sleep(TIME_WAIT);
JMSBridgeReconnectionTest.log.info("Done wait");
instanceLog.debug("Done wait");
// Restart the server
server1.start();

View File

@ -49,9 +49,9 @@ import org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl;
import org.apache.activemq.artemis.jms.client.ActiveMQMessage;
import org.apache.activemq.artemis.jms.client.ActiveMQXAConnectionFactory;
import org.apache.activemq.artemis.service.extensions.ServiceUtils;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.integration.ra.DummyTransactionManager;
import org.apache.activemq.artemis.utils.DefaultSensitiveStringCodec;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
@ -59,7 +59,7 @@ import org.junit.rules.Timeout;
public class JMSBridgeTest extends BridgeTestBase {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
private static final Logger log = Logger.getLogger(JMSBridgeTest.class);
@Rule
public Timeout timeout = new Timeout(120000);
@ -390,7 +390,7 @@ public class JMSBridgeTest extends BridgeTestBase {
} finally {
if (bridge != null) {
JMSBridgeTest.log.info("Stopping bridge");
instanceLog.debug("Stopping bridge");
bridge.stop();
}
}
@ -815,7 +815,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try {
started.rollback();
} catch (Exception e) {
JMSBridgeTest.log.error("Failed to rollback", e);
log.error("Failed to rollback", e);
}
}
@ -823,7 +823,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try {
mgr.resume(toResume);
} catch (Exception e) {
JMSBridgeTest.log.error("Failed to resume", e);
log.error("Failed to resume", e);
}
}
if (bridge != null) {
@ -972,7 +972,7 @@ public class JMSBridgeTest extends BridgeTestBase {
connTarget = cf1.createConnection();
JMSBridgeTest.log.trace("Sending " + NUM_MESSAGES + " messages");
log.trace("Sending " + NUM_MESSAGES + " messages");
List<String> ids1 = new ArrayList<>();
@ -1007,7 +1007,7 @@ public class JMSBridgeTest extends BridgeTestBase {
ids1.add(tm.getJMSMessageID());
}
JMSBridgeTest.log.trace("Sent the first messages");
log.trace("Sent the first messages");
Session sessTarget = connTarget.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -1146,7 +1146,7 @@ public class JMSBridgeTest extends BridgeTestBase {
connTarget = cf1.createConnection();
JMSBridgeTest.log.trace("Sending " + NUM_MESSAGES + " messages");
log.trace("Sending " + NUM_MESSAGES + " messages");
Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -1293,7 +1293,7 @@ public class JMSBridgeTest extends BridgeTestBase {
connTarget = cf1.createConnection();
JMSBridgeTest.log.trace("Sending " + NUM_MESSAGES + " messages");
log.trace("Sending " + NUM_MESSAGES + " messages");
Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE);
@ -1375,13 +1375,13 @@ public class JMSBridgeTest extends BridgeTestBase {
// Now crash the dest server
JMSBridgeTest.log.info("About to crash server");
instanceLog.debug("About to crash server");
server1.stop();
// Now stop the bridge while the failover is happening
JMSBridgeTest.log.info("About to stop the bridge");
instanceLog.debug("About to stop the bridge");
bridge.stop();
@ -1450,7 +1450,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try {
connSource.close();
} catch (Exception e) {
JMSBridgeTest.log.error("Failed to close connection", e);
log.error("Failed to close connection", e);
}
}
@ -1518,7 +1518,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try {
connSource.close();
} catch (Exception e) {
JMSBridgeTest.log.error("Failed to close connection", e);
log.error("Failed to close connection", e);
}
}
@ -1584,7 +1584,7 @@ public class JMSBridgeTest extends BridgeTestBase {
try {
connSource.close();
} catch (Exception e) {
JMSBridgeTest.log.error("Failed to close connection", e);
log.error("Failed to close connection", e);
}
}
@ -1644,7 +1644,7 @@ public class JMSBridgeTest extends BridgeTestBase {
checkAllMessageReceivedInOrder(cf1, targetQueue, 0, NUM_MESSAGES - 1, false);
} finally {
if (bridge != null) {
JMSBridgeTest.log.info("Stopping bridge");
instanceLog.debug("Stopping bridge");
bridge.stop();
}
}
@ -1831,7 +1831,7 @@ public class JMSBridgeTest extends BridgeTestBase {
final List<TextMessage> sentMessages = new ArrayList<>();
final List<TextMessage> receivedMessages = new ArrayList<>();
log.info("Starting bridge " + bridge);
instanceLog.debug("Starting bridge " + bridge);
bridge.start();
waitForComponent(bridge, 15);
@ -1850,7 +1850,7 @@ public class JMSBridgeTest extends BridgeTestBase {
msg.setIntProperty("count", counter);
producer.send(msg);
sentMessages.add(msg);
log.info("Sent message with property counter: " + counter + ", messageId:" + msg.getJMSMessageID()
instanceLog.debug("Sent message with property counter: " + counter + ", messageId:" + msg.getJMSMessageID()
+ ((msg.getStringProperty("_AMQ_DUPL_ID") != null) ? ", _AMQ_DUPL_ID=" + msg.getStringProperty("_AMQ_DUPL_ID") : ""));
counter++;
Thread.sleep(200);
@ -1892,7 +1892,7 @@ public class JMSBridgeTest extends BridgeTestBase {
if (msg != null) {
msg.acknowledge();
receivedMessages.add(msg);
log.info("Received message with messageId: " + msg.getJMSMessageID() +
instanceLog.debug("Received message with messageId: " + msg.getJMSMessageID() +
" and property counter " + msg.getIntProperty("count"));
} else {
running = false;
@ -1916,16 +1916,16 @@ public class JMSBridgeTest extends BridgeTestBase {
}
});
log.info("Starting producer thread...");
instanceLog.debug("Starting producer thread...");
producerThread.start();
Assert.assertTrue(waitForMessages(server1, targetQueue.getQueueName(), NUM_MESSAGES / 100, 250000));
log.info("Stopping bridge " + bridge);
instanceLog.debug("Stopping bridge " + bridge);
bridge.stop();
Thread.sleep(5000);
log.info("Starting bridge " + bridge + " again");
instanceLog.debug("Starting bridge " + bridge + " again");
bridge.start();
waitForComponent(bridge, 15);
@ -1933,13 +1933,13 @@ public class JMSBridgeTest extends BridgeTestBase {
log.info("Starting consumer thread...");
instanceLog.debug("Starting consumer thread...");
consumerThread.start();
log.info("Waiting for the consumer thread to die...");
instanceLog.debug("Waiting for the consumer thread to die...");
consumerThread.join();
log.info("Waiting for the producer thread to die...");
instanceLog.debug("Waiting for the producer thread to die...");
producerThread.join();
bridge.stop();
@ -1977,7 +1977,7 @@ public class JMSBridgeTest extends BridgeTestBase {
}
}
}
log.info("Number of messages in queue " + queueName + " on server: " + server + " is: " + count);
log.debug("Number of messages in queue " + queueName + " on server: " + server + " is: " + count);
return count;
}
@ -1987,7 +1987,7 @@ public class JMSBridgeTest extends BridgeTestBase {
long count = 0;
while ((count = countMessagesInQueue(server, queueName)) < numberOfMessages) {
log.info("Total number of messages in queue: " + queueName + " on server " + server + " is " + count);
log.debug("Total number of messages in queue: " + queueName + " on server " + server + " is " + count);
Thread.sleep(5000);
if (System.currentTimeMillis() - startTime > timeout) {
log.warn(numberOfMessages + " not on server " + server + " in timeout " + timeout + "ms.");

View File

@ -58,6 +58,7 @@ import org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.tests.integration.ra.ActiveMQRATestBase;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.jboss.logging.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@ -67,6 +68,7 @@ import org.junit.Test;
* Simulates several messages being received over multiple instances with reconnects during the process.
*/
public class MDBMultipleHandlersServerDisconnectTest extends ActiveMQRATestBase {
private static final Logger log = Logger.getLogger(MDBMultipleHandlersServerDisconnectTest.class);
final ConcurrentHashMap<Integer, AtomicInteger> mapCounter = new ConcurrentHashMap<>();
@ -228,7 +230,7 @@ public class MDBMultipleHandlersServerDisconnectTest extends ActiveMQRATestBase
if (playServerClosingSession && serverSessions.size() > 0) {
int randomBother = RandomUtil.randomInterval(0, serverSessions.size() - 1);
System.out.println("bugging session " + randomBother);
log.debug("bugging session " + randomBother);
ServerSession serverSession = serverSessions.get(randomBother);
@ -278,19 +280,19 @@ public class MDBMultipleHandlersServerDisconnectTest extends ActiveMQRATestBase
}
if (i == NUMBER_OF_MESSAGES * 0.90) {
System.out.println("Disabled failures at " + i);
log.debug("Disabled failures at " + i);
playTXTimeouts = false;
playServerClosingSession = false;
playServerClosingConsumer = false;
}
System.out.println("Received " + i + " messages");
log.debug("Received " + i + " messages");
doReceiveMessage(message);
if (i % 200 == 0) {
System.out.println("received " + i);
log.debug("received " + i);
session.commit();
}
}
@ -303,7 +305,7 @@ public class MDBMultipleHandlersServerDisconnectTest extends ActiveMQRATestBase
break;
}
System.out.println("Received extra message " + message);
log.debug("Received extra message " + message);
doReceiveMessage(message);
}
@ -338,15 +340,12 @@ public class MDBMultipleHandlersServerDisconnectTest extends ActiveMQRATestBase
session.close();
if (failed) {
for (int i = 0; i < 10; i++) {
System.out.println("----------------------------------------------------");
}
System.out.println(writer.toString());
log.debug(writer.toString());
}
Assert.assertFalse(writer.toString(), failed);
System.out.println("Received " + NUMBER_OF_MESSAGES + " messages");
log.debug("Received " + NUMBER_OF_MESSAGES + " messages");
Assert.assertFalse("There was meta-data failures, some sessions didn't reconnect properly", metaDataFailed.get());

View File

@ -40,13 +40,14 @@ import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.transaction.impl.XidImpl;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.jboss.logging.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class DuplicateDetectionTest extends ActiveMQTestBase {
private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
private final Logger log = Logger.getLogger(this.getClass());
private ActiveMQServer server;
@ -390,7 +391,7 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
Assert.assertEquals(i, message.getObjectProperty(propKey));
}
DuplicateDetectionTest.log.info("Now sending more");
log.debug("Now sending more");
for (int i = 0; i < cacheSize; i++) {
SimpleString dupID = new SimpleString("dupID" + i);
@ -785,13 +786,13 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
message = consumer.receiveImmediate();
Assert.assertNull(message);
DuplicateDetectionTest.log.info("ending session");
log.debug("ending session");
session.end(xid3, XAResource.TMSUCCESS);
DuplicateDetectionTest.log.info("preparing session");
log.debug("preparing session");
session.prepare(xid3);
DuplicateDetectionTest.log.info("committing session");
log.debug("committing session");
session.commit(xid3, false);
}
@ -856,13 +857,13 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
message = consumer.receiveImmediate();
Assert.assertNull(message);
DuplicateDetectionTest.log.info("ending session");
log.debug("ending session");
session.end(xid3, XAResource.TMSUCCESS);
DuplicateDetectionTest.log.info("preparing session");
log.debug("preparing session");
session.prepare(xid3);
DuplicateDetectionTest.log.info("committing session");
log.debug("committing session");
session.commit(xid3, false);
}
@ -926,13 +927,13 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
message = consumer.receiveImmediate();
Assert.assertNull(message);
DuplicateDetectionTest.log.info("ending session");
log.debug("ending session");
session.end(xid3, XAResource.TMSUCCESS);
DuplicateDetectionTest.log.info("preparing session");
log.debug("preparing session");
session.prepare(xid3);
DuplicateDetectionTest.log.info("committing session");
log.debug("committing session");
session.commit(xid3, false);
}
@ -1143,13 +1144,13 @@ public class DuplicateDetectionTest extends ActiveMQTestBase {
message = consumer.receiveImmediate();
Assert.assertNull(message);
DuplicateDetectionTest.log.info("ending session");
log.debug("ending session");
session.end(xid3, XAResource.TMSUCCESS);
DuplicateDetectionTest.log.info("preparing session");
log.debug("preparing session");
session.prepare(xid3);
DuplicateDetectionTest.log.info("committing session");
log.debug("committing session");
session.commit(xid3, false);
}

View File

@ -1,30 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.integration;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.MessageLogger;
@MessageLogger(projectCode = "AMQTEST")
public interface IntegrationTestLogger extends BasicLogger {
/**
* The integration test logger.
*/
IntegrationTestLogger LOGGER = Logger.getMessageLogger(IntegrationTestLogger.class, IntegrationTestLogger.class.getPackage().getName());
}

View File

@ -74,7 +74,6 @@ public class SimpleNotificationService implements NotificationService {
@Override
public void onNotification(final Notification notification) {
System.out.println(">>>>>>>>" + notification);
notifications.add(notification);
}

View File

@ -98,7 +98,7 @@ public class AnycastTest extends ActiveMQTestBase {
for (int j = 0; j < num / 2; j++) {
ClientMessage m = consumers[i].receive(2000);
assertNotNull(m);
System.out.println("consumer" + i + " received: " + m.getBodyBuffer().readString());
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
}
assertNull(consumers[i].receive(200));
@ -157,7 +157,7 @@ public class AnycastTest extends ActiveMQTestBase {
for (int j = 0; j < num / 2; j++) {
ClientMessage m = consumers[i].receive(2000);
assertNotNull(m);
System.out.println("consumer" + i + " received: " + m.getBodyBuffer().readString());
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
}
assertNull(consumers[i].receive(200));
@ -173,7 +173,7 @@ public class AnycastTest extends ActiveMQTestBase {
for (int j = 0; j < num / 2; j++) {
ClientMessage m = consumers[i].receive(2000);
assertNotNull(m);
System.out.println("consumer" + i + " received: " + m.getBodyBuffer().readString());
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
}
assertNull(consumers[i].receive(200));

View File

@ -98,7 +98,7 @@ public class MulticastTest extends ActiveMQTestBase {
for (int j = 0; j < num; j++) {
ClientMessage m = consumers[i].receive(2000);
assertNotNull(m);
System.out.println("consumer" + i + " received: " + m.getBodyBuffer().readString());
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
}
assertNull(consumers[i].receive(200));
@ -157,7 +157,7 @@ public class MulticastTest extends ActiveMQTestBase {
for (int j = 0; j < num; j++) {
ClientMessage m = consumers[i].receive(2000);
assertNotNull(m);
System.out.println("consumer" + i + " received: " + m.getBodyBuffer().readString());
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
}
assertNull(consumers[i].receive(200));
@ -173,7 +173,7 @@ public class MulticastTest extends ActiveMQTestBase {
for (int j = 0; j < num; j++) {
ClientMessage m = consumers[i].receive(2000);
assertNotNull(m);
System.out.println("consumer" + i + " received: " + m.getBodyBuffer().readString());
instanceLog.debug("consumer" + i + " received: " + m.getBodyBuffer().readString());
}
assertNull(consumers[i].receive(200));

View File

@ -45,23 +45,23 @@ public class AmqpDLQReceiverTest extends AmqpClientTestSupport {
assertNotNull(queue);
receiver.flow(100);
for (int i = 0; i < 10; i++) {
System.out.println("i = " + i);
instanceLog.debug("i = " + i);
AmqpMessage receive = receiver.receive(5000, TimeUnit.MILLISECONDS);
receive.modified(true, false);
Queue queueView = getProxyToQueue(getQueueName());
System.out.println("receive = " + receive.getWrappedMessage().getDeliveryCount());
System.out.println("queueView.getMessageCount() = " + queueView.getMessageCount());
System.out.println("queueView.getDeliveringCount() = " + queueView.getDeliveringCount());
System.out.println("queueView.getPersistentSize() = " + queueView.getPersistentSize());
instanceLog.debug("receive = " + receive.getWrappedMessage().getDeliveryCount());
instanceLog.debug("queueView.getMessageCount() = " + queueView.getMessageCount());
instanceLog.debug("queueView.getDeliveringCount() = " + queueView.getDeliveringCount());
instanceLog.debug("queueView.getPersistentSize() = " + queueView.getPersistentSize());
}
receiver.close();
connection.close();
Thread.sleep(5000);
Queue queueView = getProxyToQueue(getQueueName());
System.out.println("queueView.getMessageCount() = " + queueView.getMessageCount());
System.out.println("queueView.getDeliveringCount() = " + queueView.getDeliveringCount());
System.out.println("queueView.getPersistentSize() = " + queueView.getPersistentSize());
instanceLog.debug("queueView.getMessageCount() = " + queueView.getMessageCount());
instanceLog.debug("queueView.getDeliveringCount() = " + queueView.getDeliveringCount());
instanceLog.debug("queueView.getPersistentSize() = " + queueView.getPersistentSize());
Assert.assertEquals(0, queueView.getMessageCount());
}

View File

@ -341,7 +341,7 @@ public class AmqpDurableReceiverTest extends AmqpClientTestSupport {
session.lookupSubscription(getSubscriptionName());
fail("Should throw an exception since there is not subscription");
} catch (Exception e) {
LOG.info("Error on lookup: {}", e.getMessage());
LOG.debug("Error on lookup: {}", e.getMessage());
}
connection.close();

View File

@ -254,7 +254,6 @@ public class AmqpFlowControlTest extends JMSClientTestSupport {
try {
for (int i = 0; i < maxMessages; i++) {
sender.send(message);
System.out.println("Sent " + i);
sentMessages.getAndIncrement();
}
timeout.countDown();

View File

@ -184,7 +184,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport {
Bindings bindings = server.getPostOffice().getBindingsForAddress(multicastAddress);
for (Binding b : bindings.getBindings()) {
System.out.println("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages());
instanceLog.debug("checking binidng " + b.getUniqueName() + " " + ((LocalQueueBinding)b).getQueue().getDeliveringMessages());
SimpleString qName = b.getUniqueName();
//do FQQN query
QueueQueryResult result = server.queueQuery(CompositeAddress.toFullyQualified(multicastAddress, qName));
@ -266,7 +266,7 @@ public class AmqpFullyQualifiedNameTest extends JMSClientTestSupport {
producer3.send(session.createMessage());
assertTrue(Wait.waitFor(() -> server.locateQueue(anycastQ3).getMessageCount() == 5, 2000, 200));
System.out.println("Queue is: " + q1);
instanceLog.debug("Queue is: " + q1);
MessageConsumer consumer1 = session.createConsumer(q1);
MessageConsumer consumer2 = session.createConsumer(q2);
MessageConsumer consumer3 = session.createConsumer(q3);

View File

@ -285,7 +285,7 @@ public class AmqpInboundConnectionTest extends AmqpClientTestSupport {
connection2.connect();
fail("Should not be able to connect with same container Id.");
} catch (Exception ex) {
LOG.info("Second connection with same container Id failed as expected.");
LOG.debug("Second connection with same container Id failed as expected.");
}
connection2.getStateInspector().assertValid();

View File

@ -236,7 +236,7 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
if (wrapped.getBody() instanceof Data) {
// converters can change this to AmqValue
Data data = (Data) wrapped.getBody();
System.out.println("received : message: " + data.getValue().getLength());
instanceLog.debug("received : message: " + data.getValue().getLength());
assertEquals(PAYLOAD, data.getValue().getLength());
}
message.accept();
@ -290,7 +290,7 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
MessageImpl wrapped = (MessageImpl) message.getWrappedMessage();
if (wrapped.getBody() instanceof Data) {
Data data = (Data) wrapped.getBody();
System.out.println("received : message: " + data.getValue().getLength());
instanceLog.debug("received : message: " + data.getValue().getLength());
assertEquals(PAYLOAD, data.getValue().getLength());
}
@ -397,7 +397,7 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
}
public void doTestSendLargeMessage(int expectedSize) throws Exception {
LOG.info("doTestSendLargeMessage called with expectedSize " + expectedSize);
LOG.debug("doTestSendLargeMessage called with expectedSize " + expectedSize);
byte[] payload = createLargePayload(expectedSize);
assertEquals(expectedSize, payload.length);
@ -417,12 +417,12 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
producer.send(message);
long endTime = System.currentTimeMillis();
LOG.info("Returned from send after {} ms", endTime - startTime);
LOG.debug("Returned from send after {} ms", endTime - startTime);
startTime = System.currentTimeMillis();
MessageConsumer consumer = session.createConsumer(queue);
connection.start();
LOG.info("Calling receive");
LOG.debug("Calling receive");
Message received = consumer.receive();
assertNotNull(received);
assertTrue(received instanceof BytesMessage);
@ -430,7 +430,7 @@ public class AmqpLargeMessageTest extends AmqpClientTestSupport {
assertNotNull(bytesMessage);
endTime = System.currentTimeMillis();
LOG.info("Returned from receive after {} ms", endTime - startTime);
LOG.debug("Returned from receive after {} ms", endTime - startTime);
byte[] bytesReceived = new byte[expectedSize];
assertEquals(expectedSize, bytesMessage.readBytes(bytesReceived, expectedSize));
assertTrue(Arrays.equals(payload, bytesReceived));

View File

@ -66,7 +66,7 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
receiver1.close();
receiver2.close();
System.out.println("Message Count after all consumed: " + queueView.getMessageCount());
instanceLog.debug("Message Count after all consumed: " + queueView.getMessageCount());
// Should be nothing left on the Queue
AmqpReceiver receiver3 = session.createReceiver(getQueueName());
@ -74,7 +74,7 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
AmqpMessage received = receiver3.receive(5, TimeUnit.SECONDS);
if (received != null) {
System.out.println("Message read: " + received.getMessageId());
instanceLog.debug("Message read: " + received.getMessageId());
}
assertNull(received);
@ -103,14 +103,14 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
}
receiver.close();
System.out.println("Message Count after all consumed: " + queueView.getMessageCount());
instanceLog.debug("Message Count after all consumed: " + queueView.getMessageCount());
// Open a new receiver and see if any message are left on the Queue
receiver = session.createReceiver(getQueueName());
receiver.flow(1);
AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS);
if (received != null) {
System.out.println("Message read: " + received.getMessageId());
instanceLog.debug("Message read: " + received.getMessageId());
}
assertNull(received);
@ -155,14 +155,14 @@ public class AmqpPresettledReceiverTest extends AmqpClientTestSupport {
receiver.close();
System.out.println("Message Count after all consumed: " + queueView.getMessageCount());
instanceLog.debug("Message Count after all consumed: " + queueView.getMessageCount());
// Open a new receiver and see if any message are left on the Queue
receiver = session.createReceiver(getQueueName());
receiver.flow(1);
AmqpMessage received = receiver.receive(5, TimeUnit.SECONDS);
if (received != null) {
System.out.println("Message read: " + received.getMessageId());
instanceLog.debug("Message read: " + received.getMessageId());
}
assertNull(received);

View File

@ -22,7 +22,6 @@ import java.io.OutputStream;
import java.net.Socket;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.Wait;
import org.fusesource.hawtbuf.Buffer;
import org.junit.Test;
@ -50,7 +49,6 @@ public class AmqpProtocolHeaderHandlingTest extends AmqpClientTestSupport {
AmqpHeader response = connection.readAmqpHeader();
assertNotNull(response);
assertEquals(3, response.getProtocolId());
IntegrationTestLogger.LOGGER.info("Broker responded with: " + response);
// pump some bytes down the wire until broker closes the connection
assertTrue("Broker should have closed client connection", Wait.waitFor(new Wait.Condition() {
@ -78,7 +76,6 @@ public class AmqpProtocolHeaderHandlingTest extends AmqpClientTestSupport {
}
public void send(AmqpHeader header) throws Exception {
IntegrationTestLogger.LOGGER.info("Client sending header: " + header);
OutputStream outputStream = clientSocket.getOutputStream();
header.getBuffer().writeTo(outputStream);
outputStream.flush();

View File

@ -19,7 +19,6 @@ package org.apache.activemq.artemis.tests.integration.amqp;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.activemq.transport.amqp.client.AmqpClient;
import org.apache.activemq.transport.amqp.client.AmqpConnection;
@ -70,7 +69,7 @@ public class AmqpReceiverDrainTest extends AmqpClientTestSupport {
for (int i = 0; i < MSG_COUNT; ++i) {
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
assertNotNull("Failed to read message: " + (i + 1), message);
IntegrationTestLogger.LOGGER.info("Read message: " + message.getMessageId());
instanceLog.info("Read message: " + message.getMessageId());
message.accept();
}
receiver.close();

View File

@ -31,7 +31,6 @@ import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.Queue;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.Wait;
import org.apache.activemq.transport.amqp.client.AmqpClient;
import org.apache.activemq.transport.amqp.client.AmqpConnection;
@ -365,7 +364,6 @@ public class AmqpReceiverTest extends AmqpClientTestSupport {
@Override
public void inspectClosedResource(Session session) {
IntegrationTestLogger.LOGGER.info("Session closed: " + session.getContext());
}
@Override
@ -375,7 +373,6 @@ public class AmqpReceiverTest extends AmqpClientTestSupport {
@Override
public void inspectClosedResource(Receiver receiver) {
IntegrationTestLogger.LOGGER.info("Receiver closed: " + receiver.getContext());
closed.set(true);
}
});

View File

@ -148,7 +148,7 @@ public class AmqpReceiverWithFiltersTest extends AmqpClientTestSupport {
for (int i = 0; i < NUM_MESSAGES / 2; ++i) {
AmqpMessage message = receiver.receive(5, TimeUnit.SECONDS);
Assert.assertNotNull(message);
System.out.println("Read message: " + message.getApplicationProperty("myNewID"));
instanceLog.debug("Read message: " + message.getApplicationProperty("myNewID"));
assertNotNull(message);
messages.add(message);
}

Some files were not shown because too many files have changed in this diff Show More