ARTEMIS-252 fixing tests

This commit is contained in:
Clebert Suconic 2015-10-12 17:21:36 -04:00
parent 2a81a5f146
commit a5fab2754d
2 changed files with 12 additions and 13 deletions

View File

@ -570,13 +570,11 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
} }
}; };
queue.retryMessages(singleMessageFilter); return queue.retryMessages(singleMessageFilter) > 0;
} }
finally { finally {
blockOnIO(); blockOnIO();
} }
return false;
} }
public int retryMessages() throws Exception { public int retryMessages() throws Exception {

View File

@ -16,6 +16,12 @@
*/ */
package org.apache.activemq.artemis.tests.integration.management; 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.ActiveMQException;
import org.apache.activemq.artemis.api.core.Message; import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.api.core.SimpleString; 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.integration.jms.server.management.JMSUtil;
import org.apache.activemq.artemis.tests.util.RandomUtil; import org.apache.activemq.artemis.tests.util.RandomUtil;
import org.apache.activemq.artemis.utils.json.JSONArray; import org.apache.activemq.artemis.utils.json.JSONArray;
import org.apache.activemq.artemis.utils.json.JSONObject;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import 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 { public class QueueControlTest extends ManagementTestBase {
private ActiveMQServer server; private ActiveMQServer server;
@ -796,7 +797,7 @@ public class QueueControlTest extends ManagementTestBase {
clientMessage.acknowledge(); clientMessage.acknowledge();
Assert.assertNotNull(clientMessage); Assert.assertNotNull(clientMessage);
Assert.assertEquals(clientMessage.getBodyBuffer().readString(), "Put me on DLQ!"); Assert.assertEquals(sampleText, clientMessage.getBodyBuffer().readString());
clientConsumer.close(); clientConsumer.close();
} }
@ -2044,8 +2045,8 @@ public class QueueControlTest extends ManagementTestBase {
} }
protected long getFirstMessageId(final QueueControl queueControl) throws Exception { protected long getFirstMessageId(final QueueControl queueControl) throws Exception {
Map<String, Object>[] messages = queueControl.listMessages(null); JSONArray array = new JSONArray(queueControl.getFirstMessageAsJSON());
long messageID = (Long) messages[0].get("messageID"); JSONObject object = (JSONObject)array.get(0);
return messageID; return object.getLong("messageID");
} }
} }