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 2021/04/09 12:43:41 UTC

[activemq-artemis] branch master updated: artemis-3106 Refactoring SaslScramTest to use ActiveMQTestBase

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 5642356  artemis-3106 Refactoring SaslScramTest to use ActiveMQTestBase
5642356 is described below

commit 5642356c1370a8b675c730b91ce2c2e08a376056
Author: Clebert Suconic <cl...@apache.org>
AuthorDate: Fri Apr 9 08:42:08 2021 -0400

    artemis-3106 Refactoring SaslScramTest to use ActiveMQTestBase
    
    The main benefit on ActiveMQTestBase is to avoid thread leakaging between tests on this case
    that is, one test affecting the next and being difficult to find the cause.
---
 .../tests/integration/amqp/sasl/SaslScramTest.java | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/sasl/SaslScramTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/sasl/SaslScramTest.java
index 76b1d4f..699337e 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/sasl/SaslScramTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/sasl/SaslScramTest.java
@@ -16,9 +16,8 @@
  */
 package org.apache.activemq.artemis.tests.integration.amqp.sasl;
 
-import static org.junit.Assert.assertEquals;
-
 import java.io.File;
+import java.net.URL;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -31,32 +30,39 @@ import javax.jms.TextMessage;
 
 import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
 import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.qpid.jms.JmsConnectionFactory;
 import org.apache.qpid.jms.exceptions.JMSSecuritySaslException;
+import org.junit.After;
 import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
  * This test SASL-SCRAM Support
  */
-public class SaslScramTest {
+public class SaslScramTest extends ActiveMQTestBase {
 
-   private static EmbeddedActiveMQ BROKER;
+   private EmbeddedActiveMQ BROKER;
 
-   @BeforeClass
-   public static void startBroker() throws Exception {
+   @Before
+   public void startBroker() throws Exception {
       String loginConfPath = new File(SaslScramTest.class.getResource("/login.config").toURI()).getAbsolutePath();
       System.out.println(loginConfPath);
       System.setProperty("java.security.auth.login.config", loginConfPath);
       BROKER = new EmbeddedActiveMQ();
-      BROKER.setConfigResourcePath(SaslScramTest.class.getResource("/broker-saslscram.xml").toExternalForm());
+      URL urlScram = SaslScramTest.class.getResource("/broker-saslscram.xml");
+      Assert.assertNotNull(urlScram);
+      System.out.println("url::" + urlScram);
+      BROKER.setConfigResourcePath(urlScram.toExternalForm());
       BROKER.setSecurityManager(new ActiveMQJAASSecurityManager("artemis-sasl-scram"));
       BROKER.start();
    }
 
-   @AfterClass
-   public static void shutdownBroker() throws Exception {
+   @After
+   public void shutdownBroker() throws Exception {
       BROKER.stop();
    }