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

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


The following commit(s) were added to refs/heads/main by this push:
     new 196e479ae8 NO-JIRA additional test for status json with and without 
server
196e479ae8 is described below

commit 196e479ae86e1a216a254d852861fd1f015de6e9
Author: Gary Tully <[email protected]>
AuthorDate: Wed Jul 5 18:15:03 2023 +0100

    NO-JIRA additional test for status json with and without server
---
 .../artemis/core/security/jaas/StatusTest.java     | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git 
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/StatusTest.java
 
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/StatusTest.java
index 873a410117..b84ed3ffa9 100644
--- 
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/StatusTest.java
+++ 
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/StatusTest.java
@@ -21,6 +21,7 @@ import java.io.File;
 import java.util.HashMap;
 
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl;
 import org.apache.activemq.artemis.core.server.impl.ServerStatus;
 import 
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoginModule;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
@@ -29,6 +30,7 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static 
org.apache.activemq.artemis.core.server.impl.ServerStatus.JAAS_COMPONENT;
 import static 
org.apache.activemq.artemis.spi.core.security.jaas.PropertiesLoader.LOGIN_CONFIG_SYS_PROP_NAME;
 
 public class StatusTest extends ActiveMQTestBase {
@@ -84,6 +86,41 @@ public class StatusTest extends ActiveMQTestBase {
       Wait.assertFalse(() -> 
ServerStatus.getInstance().asJson().contains(UNKNOWN));
    }
 
+   @Test
+   public void testStatusOfServerOrderServerFirst() throws Exception {
+      final String EARLY_BIRD = "early";
+      final String BIRD = "later";
+
+      ActiveMQServerImpl server = new ActiveMQServerImpl();
+      ServerStatus.getInstanceFor(server);
+
+      ServerStatus.getInstance().update(JAAS_COMPONENT + "/properties/" + 
EARLY_BIRD,  "{\"reloadTime\":\"2\"}");
+      assertTrue("contains", 
ServerStatus.getInstance().asJson().contains(EARLY_BIRD));
+
+      ServerStatus.getInstance().update(JAAS_COMPONENT + "/properties/" + 
BIRD,  "{\"reloadTime\":\"2\"}");
+
+      assertTrue("contains", 
ServerStatus.getInstance().asJson().contains(EARLY_BIRD));
+      assertTrue("contains", 
ServerStatus.getInstance().asJson().contains(BIRD));
+   }
+
+   @Test
+   public void testStatusOfServerOrderServerSecond() throws Exception {
+      final String EARLY_BIRD = "early";
+      final String BIRD = "later";
+
+      ServerStatus.getInstance().update(JAAS_COMPONENT + "/properties/" + 
EARLY_BIRD,  "{\"reloadTime\":\"2\"}");
+      assertTrue("contains", 
ServerStatus.getInstance().asJson().contains(EARLY_BIRD));
+
+      ServerStatus.getInstance().update(JAAS_COMPONENT + "/properties/" + 
BIRD,  "{\"reloadTime\":\"2\"}");
+
+      ActiveMQServerImpl server = new ActiveMQServerImpl();
+      ServerStatus.getInstanceFor(server);
+
+      assertTrue("contains", 
ServerStatus.getInstance().asJson().contains(EARLY_BIRD));
+      assertTrue("contains", 
ServerStatus.getInstance().asJson().contains(BIRD));
+      assertTrue("contains", 
ServerStatus.getInstance().asJson().contains("nodeId"));
+   }
+
    private static void setOrClearLoginConfigSystemProperty(String path) throws 
Exception {
       if (path != null) {
          System.setProperty(LOGIN_CONFIG_SYS_PROP_NAME, path);

Reply via email to