You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2022/07/21 00:06:19 UTC

[activemq-artemis] 15/26: fix various test failures due to unexpected message string; also make some tests indicate why they failed

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

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

commit 7d0a3617578d07b66fc3b207ed7307d8635461c8
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Thu Jul 14 17:04:45 2022 +0100

    fix various test failures due to unexpected message string; also make some tests indicate why they failed
---
 .../artemis/core/server/ActiveMQMessageBundle.java       |  4 ++--
 .../integration/security/BasicSecurityManagerTest.java   | 16 ++++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
index 8dd2f1fa82..5eb3b4d81e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java
@@ -166,7 +166,7 @@ public interface ActiveMQMessageBundle {
    @Message(id = 229031, value = "Unable to validate user from {}. Username: {}; SSL certificate subject DN: {}")
    ActiveMQSecurityException unableToValidateUser(String remoteAddress, String user, String certMessage);
 
-   @Message(id = 229032, value = "User: {} does not have permission=''{}'' on address {}")
+   @Message(id = 229032, value = "User: {} does not have permission='{}' on address {}")
    ActiveMQSecurityException userNoPermissions(String username, CheckType checkType, SimpleString address);
 
    @Message(id = 229033, value = "Server and client versions incompatible")
@@ -436,7 +436,7 @@ public interface ActiveMQMessageBundle {
    @Message(id = 229212, value = "Invalid deletion policy type {}")
    IllegalArgumentException invalidDeletionPolicyType(String val);
 
-   @Message(id = 229213, value = "User: {} does not have permission=''{}'' for queue {} on address {}")
+   @Message(id = 229213, value = "User: {} does not have permission='{}' for queue {} on address {}")
    ActiveMQSecurityException userNoPermissionsQueue(String username, CheckType checkType, SimpleString queue, SimpleString address);
 
    @Message(id = 229214, value = "{} must be a valid percentage value between 0 and 100 or -1 (actual value: {})")
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java
index e4ea01350f..6a15cebc40 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/BasicSecurityManagerTest.java
@@ -193,7 +193,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          session.createQueue(new QueueConfiguration(DURABLE_QUEUE).setAddress(ADDRESS));
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='CREATE_DURABLE_QUEUE' for queue durableQueue on address address"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='CREATE_DURABLE_QUEUE' for queue durableQueue on address address"));
       }
 
       // DELETE_DURABLE_QUEUE
@@ -201,7 +201,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          session.deleteQueue(DURABLE_QUEUE);
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='DELETE_DURABLE_QUEUE' for queue durableQueue on address address"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='DELETE_DURABLE_QUEUE' for queue durableQueue on address address"));
       }
 
       // CREATE_NON_DURABLE_QUEUE
@@ -209,7 +209,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          session.createQueue(new QueueConfiguration(NON_DURABLE_QUEUE).setAddress(ADDRESS).setDurable(false));
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='CREATE_NON_DURABLE_QUEUE' for queue nonDurableQueue on address address"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='CREATE_NON_DURABLE_QUEUE' for queue nonDurableQueue on address address"));
       }
 
       // DELETE_NON_DURABLE_QUEUE
@@ -217,7 +217,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          session.deleteQueue(NON_DURABLE_QUEUE);
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='DELETE_NON_DURABLE_QUEUE' for queue nonDurableQueue on address address"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='DELETE_NON_DURABLE_QUEUE' for queue nonDurableQueue on address address"));
       }
 
       // PRODUCE
@@ -226,7 +226,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          producer.send(session.createMessage(true));
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='SEND' on address address"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='SEND' on address address"));
       }
 
       // CONSUME
@@ -234,7 +234,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          ClientConsumer consumer = session.createConsumer(DURABLE_QUEUE);
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='CONSUME' for queue durableQueue on address address"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='CONSUME' for queue durableQueue on address address"));
       }
 
       // MANAGE
@@ -243,7 +243,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          producer.send(session.createMessage(true));
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='MANAGE' on address activemq.management"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='MANAGE' on address activemq.management"));
       }
 
       // BROWSE
@@ -251,7 +251,7 @@ public class BasicSecurityManagerTest extends ActiveMQTestBase {
          ClientConsumer browser = session.createConsumer(DURABLE_QUEUE, true);
          Assert.fail("should throw exception here");
       } catch (ActiveMQException e) {
-         assertTrue(e.getMessage().contains("User: first does not have permission='BROWSE' for queue durableQueue on address address"));
+         assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().contains("User: first does not have permission='BROWSE' for queue durableQueue on address address"));
       }
    }