From a5fab2754dad1eeaa3ffcfe4017ca86038eae7d1 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Mon, 12 Oct 2015 17:21:36 -0400 Subject: [PATCH] ARTEMIS-252 fixing tests --- .../management/impl/QueueControlImpl.java | 4 +--- .../management/QueueControlTest.java | 21 ++++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java index cb362eca5a..9f6488e458 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java @@ -570,13 +570,11 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { } }; - queue.retryMessages(singleMessageFilter); + return queue.retryMessages(singleMessageFilter) > 0; } finally { blockOnIO(); } - - return false; } public int retryMessages() throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java index b968a03d52..135a60f77e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java @@ -16,6 +16,12 @@ */ package org.apache.activemq.artemis.tests.integration.management; +import javax.management.Notification; +import java.util.LinkedList; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + import org.apache.activemq.artemis.api.core.ActiveMQException; import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.SimpleString; @@ -42,16 +48,11 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings; import org.apache.activemq.artemis.tests.integration.jms.server.management.JMSUtil; import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.utils.json.JSONArray; +import org.apache.activemq.artemis.utils.json.JSONObject; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import javax.management.Notification; -import java.util.LinkedList; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - public class QueueControlTest extends ManagementTestBase { private ActiveMQServer server; @@ -796,7 +797,7 @@ public class QueueControlTest extends ManagementTestBase { clientMessage.acknowledge(); Assert.assertNotNull(clientMessage); - Assert.assertEquals(clientMessage.getBodyBuffer().readString(), "Put me on DLQ!"); + Assert.assertEquals(sampleText, clientMessage.getBodyBuffer().readString()); clientConsumer.close(); } @@ -2044,8 +2045,8 @@ public class QueueControlTest extends ManagementTestBase { } protected long getFirstMessageId(final QueueControl queueControl) throws Exception { - Map[] messages = queueControl.listMessages(null); - long messageID = (Long) messages[0].get("messageID"); - return messageID; + JSONArray array = new JSONArray(queueControl.getFirstMessageAsJSON()); + JSONObject object = (JSONObject)array.get(0); + return object.getLong("messageID"); } }