NO-JIRA make TransferTest more robust, readable

This commit is contained in:
Justin Bertram 2021-05-27 13:01:16 -05:00
parent 8ec0e5193f
commit 3ca02955bf
1 changed files with 7 additions and 3 deletions

View File

@ -18,6 +18,8 @@
package org.apache.activemq.cli.test; package org.apache.activemq.cli.test;
import org.apache.activemq.artemis.api.core.Pair; import org.apache.activemq.artemis.api.core.Pair;
import org.apache.activemq.artemis.api.core.QueueConfiguration;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.cli.commands.messages.Transfer; import org.apache.activemq.artemis.cli.commands.messages.Transfer;
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.ActiveMQServer;
import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.Queue;
@ -69,14 +71,15 @@ public class TransferTest extends CliTestBase {
String sourceQueueName = "SOURCE_QUEUE"; String sourceQueueName = "SOURCE_QUEUE";
String targetQueueName = "TARGET_QUEUE"; String targetQueueName = "TARGET_QUEUE";
server.createQueue(new QueueConfiguration(sourceQueueName).setRoutingType(RoutingType.ANYCAST));
server.createQueue(new QueueConfiguration(targetQueueName).setRoutingType(RoutingType.ANYCAST));
Session session = createSession(connection); Session session = createSession(connection);
produceMessages(session, sourceQueueName, messages, false); produceMessages(session, sourceQueueName, messages, false);
Queue sourceQueue = server.locateQueue(sourceQueueName); Queue sourceQueue = server.locateQueue(sourceQueueName);
Wait.assertEquals(messages, sourceQueue::getMessageCount); Wait.assertEquals(messages, sourceQueue::getMessageCount);
Assert.assertEquals(messages, sourceQueue.getMessageCount());
Transfer transfer = new Transfer() Transfer transfer = new Transfer()
.setSourceUser("admin") .setSourceUser("admin")
@ -84,7 +87,8 @@ public class TransferTest extends CliTestBase {
.setSourceQueue(sourceQueueName) .setSourceQueue(sourceQueueName)
.setTargetUser("admin") .setTargetUser("admin")
.setTargetPassword("admin") .setTargetPassword("admin")
.setTargetQueue(targetQueueName).setReceiveTimeout(100); .setTargetQueue(targetQueueName)
.setReceiveTimeout(100);
if (limit > 0) { if (limit > 0) {
transfer.setMessageCount(limit); transfer.setMessageCount(limit);