diff --git a/.asf.yaml b/.asf.yaml index 8c334b1714..ff4712e1fa 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -29,12 +29,34 @@ github: - stomp - java - jms + enabled_merge_buttons: squash: true - merge: true - rebase: true + merge: false + rebase: false + + del_branch_on_merge: true + + protected_branches: + main: + required_pull_request_reviews: + require_code_owner_reviews: false + required_approving_review_count: 0 + required_linear_history: true + required_status_checks: + strict: false + contexts: + - build + - test + + features: + wiki: false + issues: false + projects: false + autolink_jira: - AMQ + notifications: commits: commits@activemq.apache.org issues: gitbox@activemq.apache.org diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..686695e99a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,36 @@ +# +# 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. +# + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 50 + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] diff --git a/.github/workflows/ci-nightly.yml b/.github/workflows/ci-nightly.yml new file mode 100644 index 0000000000..db29edce9e --- /dev/null +++ b/.github/workflows/ci-nightly.yml @@ -0,0 +1,69 @@ +# 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. + +name: CI Nightly + +on: + schedule: + - cron: '0 3 * * *' + +jobs: + build: + + permissions: + contents: read + + strategy: + matrix: + os: [ ubuntu-24.04, ubuntu-22.04, macos-26, macos-15, windows-2025, windows-2022 ] + java-version: [ 17, 21, 24 ] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java-version }} + distribution: temurin + - name: Build + run: mvn -U -B -e clean install -DskipTests + - name: Verify + run: mvn apache-rat:check + + test: + + permissions: + contents: read + + strategy: + matrix: + os: [ ubuntu-24.04, ubuntu-22.04, macos-26, macos-15, windows-2025, windows-2022 ] + java-version: [ 17, 21, 24 ] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java-version }} + distribution: temurin + - name: Test + run: mvn -B -e -fae test diff --git a/.github/workflows/ci-quick.yml b/.github/workflows/ci-quick.yml new file mode 100644 index 0000000000..4fbd7fdabe --- /dev/null +++ b/.github/workflows/ci-quick.yml @@ -0,0 +1,66 @@ +# 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. + +name: CI Quick + +on: + push: + branches: [ "main", "activemq-6.1.x", "activemq-5.19.x" ] + pull_request: + branches: [ "main", "activemq-6.1.x", "activemq-5.19.x" ] + +jobs: + build: + + permissions: + contents: read + + strategy: + matrix: + os: [ ubuntu-24.04, macos-26, windows-2025 ] + java-version: [ 17, 21 ] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java-version }} + distribution: temurin + - name: Build + run: mvn -U -B -e clean install -DskipTests + - name: Verify + run: mvn apache-rat:check + + test: + + permissions: + contents: read + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - name: Test + run: mvn -B -e -fae test diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..253277c6c9 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,42 @@ +# +# 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. +# + +name: Deploy + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + deploy: + + permissions: + contents: read + + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: temurin + - name: Deploy + run: mvn -B -e deploy -Pdeploy -DskipTests diff --git a/Jenkinsfile b/Jenkinsfile index 94a8c7a772..4022a4f5b5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,6 +27,10 @@ pipeline { } } + triggers { + cron('0 0 * * *') + } + tools { // ... tell Jenkins what java version, maven version or other tools are required ... maven 'maven_3_latest' @@ -42,7 +46,7 @@ pipeline { } parameters { - choice(name: 'nodeLabel', choices: ['ubuntu', 's390x', 'arm', 'Windows']) + choice(name: 'nodeLabel', choices: [ 's390x']) choice(name: 'jdkVersion', choices: ['jdk_17_latest', 'jdk_21_latest', 'jdk_24_latest', 'jdk_17_latest_windows', 'jdk_21_latest_windows', 'jdk_24_latest_windows']) booleanParam(name: 'deployEnabled', defaultValue: false) booleanParam(name: 'parallelTestsEnabled', defaultValue: true) diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java index b9830d3954..6b8754beea 100644 --- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java +++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/ConnectionPool.java @@ -125,6 +125,7 @@ public void start() throws JMSException { connection.start(); } catch (JMSException e) { started.set(false); + setHasExpired(true); if (isReconnectOnException()) { close(); } @@ -377,6 +378,7 @@ void setParentExceptionListener(ExceptionListener parentExceptionListener) { @Override public void onException(JMSException exception) { + setHasExpired(true); if (isReconnectOnException()) { close(); } diff --git a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java index 1b11531b45..d3a64e1934 100644 --- a/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java +++ b/activemq-jms-pool/src/main/java/org/apache/activemq/jms/pool/PooledConnectionFactory.java @@ -129,12 +129,7 @@ public void destroyObject(ConnectionKey connectionKey, PooledObject pooledObject) { ConnectionPool connection = pooledObject.getObject(); - if (connection == null || connection.getConnection() == null) { - LOG.trace("Connection has been closed and will be destroyed: {}", connection); - return false; - } - - if (connection.expiredCheck()) { + if (connection != null && connection.expiredCheck()) { LOG.trace("Connection has expired: {} and will be destroyed", connection); return false; } diff --git a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java index 445f40feb3..70809f754f 100644 --- a/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java +++ b/activemq-jms-pool/src/test/java/org/apache/activemq/jms/pool/PooledConnectionSecurityExceptionTest.java @@ -44,8 +44,11 @@ import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CountDownLatch; import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -65,47 +68,42 @@ public class PooledConnectionSecurityExceptionTest { @Test public void testFailedConnectThenSucceeds() throws JMSException { - Connection connection = pooledConnFact.createConnection("invalid", "credentials"); + try (final Connection connection1 = pooledConnFact.createConnection("invalid", "credentials")) { + assertThrows(JMSSecurityException.class, connection1::start); - try { - connection.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); - } - - connection = pooledConnFact.createConnection("system", "manager"); - connection.start(); + try (final Connection connection2 = pooledConnFact.createConnection("system", "manager")) { + connection2.start(); - LOG.info("Successfully create new connection."); + } catch (final JMSSecurityException ex) { + fail("Should have succeeded to connect on 2nd attempt"); + } - connection.close(); + } } @Test - public void testFailedConnectThenSucceedsWithListener() throws JMSException { - Connection connection = pooledConnFact.createConnection("invalid", "credentials"); - connection.setExceptionListener(new ExceptionListener() { + public void testFailedConnectThenSucceedsWithListener() throws JMSException, InterruptedException { + final CountDownLatch onExceptionCalled = new CountDownLatch(1); + try (final Connection connection1 = pooledConnFact.createConnection("invalid", "credentials")) { + connection1.setExceptionListener(new ExceptionListener() { + + @Override + public void onException(JMSException exception) { + LOG.warn("Connection get error: {}", exception.getMessage()); + onExceptionCalled.countDown(); + } + }); + assertThrows(JMSSecurityException.class, connection1::start); + + try (final Connection connection2 = pooledConnFact.createConnection("system", "manager")) { + connection2.start(); - @Override - public void onException(JMSException exception) { - LOG.warn("Connection get error: {}", exception.getMessage()); + } catch (final JMSSecurityException ex) { + fail("Should have succeeded to connect on 2nd attempt"); } - }); - try { - connection.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); } - - connection = pooledConnFact.createConnection("system", "manager"); - connection.start(); - - LOG.info("Successfully create new connection."); - - connection.close(); + assertTrue("onException called", onExceptionCalled.await(10, java.util.concurrent.TimeUnit.SECONDS)); } @Test @@ -119,65 +117,41 @@ public void testFailureGetsNewConnectionOnRetryLooped() throws Exception { public void testFailureGetsNewConnectionOnRetry() throws Exception { pooledConnFact.setMaxConnections(1); - final PooledConnection connection1 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials"); - - try { - connection1.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); - } - - // The pool should process the async error - assertTrue("Should get new connection", Wait.waitFor(new Wait.Condition() { - - @Override - public boolean isSatisified() throws Exception { - try (final PooledConnection newConnection = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials")) { - return connection1.getConnection() != newConnection.getConnection(); + try (final Connection connection1 = pooledConnFact.createConnection("invalid", "credentials")) { + assertThrows(JMSSecurityException.class, connection1::start); + + // The pool should process the async error + // we should eventually get a different connection instance from the pool regardless of the underlying connection + assertTrue("Should get new connection", Wait.waitFor(new Wait.Condition() { + @Override + public boolean isSatisified() throws Exception { + try (final PooledConnection newConnection = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials")) { + return connection1 != newConnection; + } catch (Exception e) { + return false; + } } + })); + + try (final PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials")) { + assertNotSame(connection1, connection2); } - })); - - final PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials"); - assertNotSame(connection1.getConnection(), connection2.getConnection()); - - try { - connection2.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); - } finally { - connection2.close(); - } - connection1.close(); + assertNull(((PooledConnection)connection1).getConnection()); // underlying connection should have been closed + } } - @Test public void testFailureGetsNewConnectionOnRetryBigPool() throws JMSException { pooledConnFact.setMaxConnections(10); - Connection connection1 = pooledConnFact.createConnection("invalid", "credentials"); - try { - connection1.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); - } - - Connection connection2 = pooledConnFact.createConnection("invalid", "credentials"); - try { - connection2.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); + try (final Connection connection1 = pooledConnFact.createConnection("invalid", "credentials")) { + assertThrows(JMSSecurityException.class, connection1::start); + try (final Connection connection2 = pooledConnFact.createConnection("invalid", "credentials")) { + assertThrows(JMSSecurityException.class, connection2::start); + assertNotSame(connection1, connection2); + } } - assertNotSame(connection1, connection2); - - connection1.close(); - connection2.close(); } @Test @@ -190,21 +164,14 @@ public void testFailoverWithInvalidCredentialsCanConnect() throws JMSException { pooledConnFact.setConnectionFactory(cf); pooledConnFact.setMaxConnections(1); - Connection connection = pooledConnFact.createConnection("invalid", "credentials"); + try (final Connection connection = pooledConnFact.createConnection("invalid", "credentials")) { + assertThrows(JMSSecurityException.class, connection::start); - try { - connection.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); + try (final Connection connection2 = pooledConnFact.createConnection("system", "manager")) { + connection2.start(); + LOG.info("Successfully create new connection."); + } } - - connection = pooledConnFact.createConnection("system", "manager"); - connection.start(); - - LOG.info("Successfully create new connection."); - - connection.close(); } @Test @@ -217,64 +184,46 @@ public void testFailoverWithInvalidCredentials() throws Exception { pooledConnFact.setConnectionFactory(cf); pooledConnFact.setMaxConnections(1); - final PooledConnection connection1 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials"); + try (final PooledConnection connection1 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials")) { + assertThrows(JMSSecurityException.class, connection1::start); - try { - connection1.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); - // Intentionally don't close here to see that async pool reconnect takes place. - } + // The pool should process the async error + assertTrue("Should get new connection", Wait.waitFor(new Wait.Condition() { - // The pool should process the async error - assertTrue("Should get new connection", Wait.waitFor(new Wait.Condition() { - - @Override - public boolean isSatisified() throws Exception { - try (final PooledConnection newConnection = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials")) { - return connection1.getConnection() != newConnection.getConnection(); + @Override + public boolean isSatisified() throws Exception { + try (final PooledConnection newConnection = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials")) { + return connection1 != newConnection; + } catch (Exception e) { + return false; + } } + })); + + try (final PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials")) { + assertNotSame(connection1.pool, connection2.pool); + assertThrows(JMSSecurityException.class, connection2::start); } - })); - - final PooledConnection connection2 = (PooledConnection) pooledConnFact.createConnection("invalid", "credentials"); - assertNotSame(connection1.getConnection(), connection2.getConnection()); - - try { - connection2.start(); - fail("Should fail to connect"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); - connection2.close(); - } finally { - connection2.close(); } - - connection1.close(); } @Test public void testFailedCreateConsumerConnectionStillWorks() throws JMSException { - Connection connection = pooledConnFact.createConnection("guest", "password"); - connection.start(); + try (final Connection connection = pooledConnFact.createConnection("guest", "password")) { + connection.start(); - Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - Queue queue = session.createQueue(name.getMethodName()); + try (final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE)) { + final Queue queue = session.createQueue(name.getMethodName()); - try { - session.createConsumer(queue); - fail("Should fail to create consumer"); - } catch (JMSSecurityException ex) { - LOG.info("Caught expected security error"); - } + assertThrows(JMSSecurityException.class, () -> session.createConsumer(queue)); - queue = session.createQueue("GUESTS." + name.getMethodName()); + final Queue guestsQueue = session.createQueue("GUESTS." + name.getMethodName()); - MessageProducer producer = session.createProducer(queue); - producer.close(); - - connection.close(); + try (final MessageProducer producer = session.createProducer(guestsQueue)) { + // We can still produce to the GUESTS queue. + } + } + } } public String getName() { @@ -410,4 +359,4 @@ protected BrokerPlugin configureAuthorization() throws Exception { return authorizationPlugin; } -} +} \ No newline at end of file diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java index a1a98780e2..b9cbf8c44d 100644 --- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java +++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/JournalCorruptionEofIndexRecoveryTest.java @@ -63,12 +63,12 @@ import org.apache.logging.log4j.core.layout.MessageLayout; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.event.LoggingEvent; - public class JournalCorruptionEofIndexRecoveryTest { private static final Logger LOG = LoggerFactory.getLogger(JournalCorruptionEofIndexRecoveryTest.class); diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/jms2/ActiveMQJMS2MessageListenerTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/jms2/ActiveMQJMS2MessageListenerTest.java index 873c45b207..2ca9209820 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/jms2/ActiveMQJMS2MessageListenerTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/jms2/ActiveMQJMS2MessageListenerTest.java @@ -91,8 +91,8 @@ public void testMessageListener() { jmsConsumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { - countDownLatch.countDown(); receivedMessageCount.incrementAndGet(); + countDownLatch.countDown(); try { switch(ackMode) { case Session.CLIENT_ACKNOWLEDGE: message.acknowledge(); break; diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkAdvancedStatisticsTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkAdvancedStatisticsTest.java index e18a66c3b0..c3cde8008e 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkAdvancedStatisticsTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/network/NetworkAdvancedStatisticsTest.java @@ -110,7 +110,7 @@ protected String getLocalBrokerURI() { } //Added for AMQ-9437 test advancedStatistics for networkEnqueue and networkDequeue - @Test(timeout = 60 * 1000) + @Test(timeout = 120 * 1000) public void testNetworkAdvancedStatistics() throws Exception { // create a remote durable consumer to create demand @@ -159,7 +159,7 @@ public boolean isSatisified() throws Exception { // The number of message that remain is due to the exclude queue return receivedMessages.size() == MESSAGE_COUNT; } - }, 10000, 500)); + }, 30000, 500)); assertTrue(receivedExceptions.isEmpty()); assertEquals(Integer.valueOf(MESSAGE_COUNT), Integer.valueOf(receivedMessages.size())); @@ -236,7 +236,7 @@ public boolean isSatisified() throws Exception { public boolean isSatisified() throws Exception { return localBroker.getSystemUsage().getMemoryUsage().getUsage() == 0; } - }, 10000, 500)); + }, 30000, 500)); } else { assertTrue(Wait.waitFor(new Condition() { @Override @@ -244,7 +244,7 @@ public boolean isSatisified() throws Exception { // The number of message that remain is due to the exclude queue return localBroker.getAdminView().getTotalMessageCount() == MESSAGE_COUNT; } - }, 10000, 500)); + }, 30000, 500)); } remoteConsumer.close(); } @@ -265,4 +265,4 @@ public boolean isSatisified() throws Exception { })); } -} +} \ No newline at end of file diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/UsageBlockedDispatchTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/UsageBlockedDispatchTest.java index d371076675..59c8b3934c 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/UsageBlockedDispatchTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/UsageBlockedDispatchTest.java @@ -26,6 +26,7 @@ import org.apache.activemq.command.ActiveMQQueue; import org.apache.activemq.usage.SystemUsage; import org.apache.activemq.util.DefaultTestAppender; +import org.apache.activemq.util.Wait; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.LogEvent; @@ -154,6 +155,8 @@ public void append(LogEvent event) { try { + assertTrue("Timed out waiting for cursor to block", Wait.waitFor(() -> gotExpectedLogEvent.get())); + MessageConsumer noDispatchConsumer = consumerSession.createConsumer(shouldBeStuckForDispatch); Message m = noDispatchConsumer.receive(messageReceiveTimeout); diff --git a/pom.xml b/pom.xml index 4bd1cd9ffd..d9c040457a 100644 --- a/pom.xml +++ b/pom.xml @@ -968,13 +968,12 @@ true 1 true - -enableassertions false true true - -Xmx512m + -enableassertions