This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ff71a9  ARTEMIS-2699 Avoid some journal exceptions on test
7ff71a9 is described below

commit 7ff71a97af2018bfd6c70e384393825ff2adad91
Author: Clebert Suconic <[email protected]>
AuthorDate: Wed Apr 8 14:56:06 2020 -0400

    ARTEMIS-2699 Avoid some journal exceptions on test
---
 .../tests/integration/persistence/SyncSendTest.java  | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java
index 95044f8..3729683 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/SyncSendTest.java
@@ -37,9 +37,12 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.JournalType;
-import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
+import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.nativo.jlibaio.LibaioContext;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
+import org.apache.activemq.artemis.utils.Wait;
 import org.apache.qpid.jms.JmsConnectionFactory;
 import org.junit.Assert;
 import org.junit.Test;
@@ -105,6 +108,8 @@ public class SyncSendTest extends ActiveMQTestBase {
          server.getConfiguration().setJournalType(JournalType.NIO);
       }
 
+      server.getAddressSettingsRepository().addMatch("#", new 
AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
+
       
server.getConfiguration().setJournalSyncTransactional(true).setJournalSyncNonTransactional(true).setJournalDatasync(true);
       server.start();
    }
@@ -161,6 +166,8 @@ public class SyncSendTest extends ActiveMQTestBase {
 
       long recordTime = getTimePerSync();
 
+      server.addAddressInfo(new 
AddressInfo(SimpleString.toSimpleString("queue"), RoutingType.ANYCAST));
+
       server.createQueue(SimpleString.toSimpleString("queue"), 
RoutingType.ANYCAST, SimpleString.toSimpleString("queue"), null, true, false);
 
       ConnectionFactory factory = newCF();
@@ -170,11 +177,7 @@ public class SyncSendTest extends ActiveMQTestBase {
          Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
 
          Queue queue;
-         if (protocol.equals("amqp")) {
-            queue = session.createQueue("jms.queue.queue");
-         } else {
-            queue = session.createQueue("queue");
-         }
+         queue = session.createQueue("queue");
          MessageProducer producer = session.createProducer(queue);
 
          long start = System.nanoTime();
@@ -215,10 +218,13 @@ public class SyncSendTest extends ActiveMQTestBase {
          if (!protocol.equals("amqp") && (end - start) < recordTime) {
             Assert.fail("Messages are being acked too fast! Faster than the 
disk would be able to sync!");
          }
+
+         org.apache.activemq.artemis.core.server.Queue serverQueue = 
server.locateQueue(SimpleString.toSimpleString("queue"));
+         Wait.assertEquals(0, serverQueue::getMessageCount);
+         Wait.assertEquals(0, serverQueue::getDeliveringCount);
       } finally {
          connection.close();
       }
-
    }
 
    // this will set ack as synchronous, to make sure we make proper measures 
against the sync on disk

Reply via email to