You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ro...@apache.org on 2022/09/30 14:33:20 UTC
[activemq-artemis] branch main updated (d2354ae470 -> c01833aa3f)
This is an automated email from the ASF dual-hosted git repository.
robbie pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
from d2354ae470 ARTEMIS-4020 Fixing logging on soak-tests
new 1ad1128db2 ARTEMIS-4020: have the concrete classes provide logger to the shared abstract impl instead of using getClass() in parent
new bd85a3eab7 ARTEMIS-4020: consolidate loggers in ActiveMQTestBase, use placeholders in messages
new c01833aa3f ARTEMIS-4020: stop CI jobs trying to activate tests-CI logging config profile, it no longer exists
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/build.yml | 2 +-
.travis.yml | 2 +-
.../amqp/sasl/scram/SCRAMServerSASLFactory.java | 7 ++-
.../sasl/scram/SHA256SCRAMServerSASLFactory.java | 10 ++++-
.../sasl/scram/SHA512SCRAMServerSASLFactory.java | 10 ++++-
.../jaas/AbstractPrincipalLoginModule.java | 7 ++-
.../spi/core/security/jaas/Krb5LoginModule.java | 9 ++++
.../spi/core/security/jaas/SCRAMLoginModule.java | 9 ++++
.../artemis/tests/util/ActiveMQTestBase.java | 51 ++++++++--------------
9 files changed, 62 insertions(+), 45 deletions(-)
[activemq-artemis] 02/03: ARTEMIS-4020: consolidate loggers in ActiveMQTestBase, use placeholders in messages
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit bd85a3eab75139c2079ffc6a3e2887d0af650329
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Fri Sep 30 11:41:33 2022 +0100
ARTEMIS-4020: consolidate loggers in ActiveMQTestBase, use placeholders in messages
---
.../artemis/tests/util/ActiveMQTestBase.java | 51 ++++++++--------------
1 file changed, 18 insertions(+), 33 deletions(-)
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
index b8894da6d0..9b18e29ed7 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java
@@ -173,14 +173,12 @@ import org.junit.runner.Description;
*/
public abstract class ActiveMQTestBase extends Assert {
- private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
static {
Env.setTestEnv(true);
}
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
/** This will make sure threads are not leaking between tests */
@ClassRule
public static ThreadLeakCheckRule leakCheckRule = new ThreadLeakCheckRule();
@@ -279,12 +277,12 @@ public abstract class ActiveMQTestBase extends Assert {
@Override
protected void starting(Description description) {
testClassName = description.getClassName();
- log.info(String.format("**** start #test %s() ***", description.getMethodName()));
+ logger.info("**** start #test {}() ***", description.getMethodName());
}
@Override
protected void finished(Description description) {
- log.info(String.format("**** end #test %s() ***", description.getMethodName()));
+ logger.info("**** end #test {}() ***", description.getMethodName());
}
};
@@ -314,7 +312,7 @@ public abstract class ActiveMQTestBase extends Assert {
}
protected <T> T serialClone(Object object) throws Exception {
- log.debug("object::" + object);
+ logger.debug("object::{}", object);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream obOut = new ObjectOutputStream(bout);
obOut.writeObject(object);
@@ -1149,16 +1147,16 @@ public abstract class ActiveMQTestBase extends Assert {
} else if (prop.getPropertyType() == Double.class || prop.getPropertyType() == Double.TYPE) {
value = RandomUtil.randomDouble();
} else {
- log.debug("Can't validate property of type " + prop.getPropertyType() + " on " + prop.getName());
+ logger.debug("Can't validate property of type {} on {}", prop.getPropertyType(), prop.getName());
value = null;
}
if (value != null && prop.getWriteMethod() != null && prop.getReadMethod() == null) {
- log.debug("WriteOnly property " + prop.getName() + " on " + pojo.getClass());
+ logger.debug("WriteOnly property {} on {}", prop.getName(), pojo.getClass());
} else if (value != null && prop.getWriteMethod() != null &&
prop.getReadMethod() != null &&
!ignoreSet.contains(prop.getName())) {
- log.debug("Validating " + prop.getName() + " type = " + prop.getPropertyType());
+ logger.debug("Validating {} type = {}", prop.getName(), prop.getPropertyType());
prop.getWriteMethod().invoke(pojo, value);
Assert.assertEquals("Property " + prop.getName(), value, prop.getReadMethod().invoke(pojo));
@@ -1196,7 +1194,7 @@ public abstract class ActiveMQTestBase extends Assert {
final int liveNodes,
final int backupNodes,
final long timeout) throws Exception {
- logger.debug("waiting for " + liveNodes + " on the topology for server = " + server);
+ logger.debug("waiting for {} on the topology for server = {}", liveNodes, server);
Set<ClusterConnection> ccs = server.getClusterManager().getClusterConnections();
@@ -1216,7 +1214,6 @@ public abstract class ActiveMQTestBase extends Assert {
final long start = System.currentTimeMillis();
int liveNodesCount = 0;
-
int backupNodesCount = 0;
do {
@@ -1255,12 +1252,11 @@ public abstract class ActiveMQTestBase extends Assert {
String clusterConnectionName,
final int nodes,
final long timeout) throws Exception {
- logger.debug("waiting for " + nodes + " on the topology for server = " + server);
+ logger.debug("waiting for {} on the topology for server = {}", nodes, server);
long start = System.currentTimeMillis();
ClusterConnection clusterConnection = server.getClusterManager().getClusterConnection(clusterConnectionName);
-
Topology topology = clusterConnection.getTopology();
do {
@@ -1368,7 +1364,7 @@ public abstract class ActiveMQTestBase extends Assert {
}
if (!server.isStarted()) {
- log.info(threadDump("Server didn't start"));
+ logger.info(threadDump("Server didn't start"));
fail("server didn't start: " + server);
}
@@ -1390,7 +1386,7 @@ public abstract class ActiveMQTestBase extends Assert {
}
if (server.isStarted()) {
- log.info(threadDump("Server didn't start"));
+ logger.info(threadDump("Server didn't start"));
fail("Server didn't start: " + server);
}
}
@@ -2020,12 +2016,10 @@ public abstract class ActiveMQTestBase extends Assert {
long start = System.currentTimeMillis();
int bindingCount = 0;
-
int totConsumers = 0;
do {
bindingCount = 0;
-
totConsumers = 0;
Bindings bindings = po.getBindingsForAddress(new SimpleString(address));
@@ -2048,18 +2042,9 @@ public abstract class ActiveMQTestBase extends Assert {
}
while (System.currentTimeMillis() - start < timeout);
- String msg = "Timed out waiting for bindings (bindingCount = " + bindingCount +
- " (expecting " +
- expectedBindingCount +
- ") " +
- ", totConsumers = " +
- totConsumers +
- " (expecting " +
- expectedConsumerCount +
- ")" +
- ")";
+ logger.error("Timed out waiting for bindings (bindingCount = {} (expecting {}) , totConsumers = {} (expecting {}))",
+ bindingCount, expectedBindingCount, totConsumers, expectedConsumerCount);
- log.error(msg);
return false;
}
@@ -2154,7 +2139,7 @@ public abstract class ActiveMQTestBase extends Assert {
long totalMaxIO = LibaioContext.getTotalMaxIO();
if (totalMaxIO != 0) {
- log.error("LibaioContext TotalMaxIO > 0 before beginning test class. Issue presumably arose in a preceding class (not possible to be sure of which here). TotalMaxIO = " + totalMaxIO);
+ logger.error("LibaioContext TotalMaxIO > 0 before beginning test class. Issue presumably arose in a preceding class (not possible to be sure of which here). TotalMaxIO = {}", totalMaxIO);
}
}
@@ -2173,7 +2158,7 @@ public abstract class ActiveMQTestBase extends Assert {
// Now fail this run
String message = String.format("LibaioContext TotalMaxIO > 0 leak detected after class %s(), TotalMaxIO=%s(). Check output to determine if occurred before/during.", testClassName, totalMaxIO);
- log.error(message);
+ logger.error(message);
Assert.fail(message);
}
}
@@ -2182,7 +2167,7 @@ public abstract class ActiveMQTestBase extends Assert {
int invmSize = InVMRegistry.instance.size();
if (invmSize > 0) {
InVMRegistry.instance.clear();
- log.info(threadDump("Thread dump"));
+ logger.info(threadDump("Thread dump"));
fail("invm registry still had acceptors registered");
}
}
@@ -2194,14 +2179,14 @@ public abstract class ActiveMQTestBase extends Assert {
try {
ServerLocatorImpl.clearThreadPools();
} catch (Throwable e) {
- log.info(threadDump(e.getMessage()));
+ logger.info(threadDump(e.getMessage()));
System.err.println(threadDump(e.getMessage()));
}
try {
NettyConnector.clearThreadPools();
} catch (Exception e) {
- log.info(threadDump(e.getMessage()));
+ logger.info(threadDump(e.getMessage()));
System.err.println(threadDump(e.getMessage()));
}
}
[activemq-artemis] 01/03: ARTEMIS-4020: have the concrete classes provide logger to the shared abstract impl instead of using getClass() in parent
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 1ad1128db254c64d4f7bf69b588b5f1a9da421e2
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Fri Sep 30 11:38:32 2022 +0100
ARTEMIS-4020: have the concrete classes provide logger to the shared abstract impl instead of using getClass() in parent
followup to 12cc70c5bf1020087a0bedc6a9f86cc2d78bf7d6 PR discussion
---
.../protocol/amqp/sasl/scram/SCRAMServerSASLFactory.java | 7 +++----
.../protocol/amqp/sasl/scram/SHA256SCRAMServerSASLFactory.java | 10 ++++++++--
.../protocol/amqp/sasl/scram/SHA512SCRAMServerSASLFactory.java | 10 ++++++++--
.../spi/core/security/jaas/AbstractPrincipalLoginModule.java | 7 +++++--
.../artemis/spi/core/security/jaas/Krb5LoginModule.java | 9 +++++++++
.../artemis/spi/core/security/jaas/SCRAMLoginModule.java | 9 +++++++++
6 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SCRAMServerSASLFactory.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SCRAMServerSASLFactory.java
index 76f1e24da8..644d2cebdb 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SCRAMServerSASLFactory.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SCRAMServerSASLFactory.java
@@ -43,7 +43,6 @@ import org.apache.activemq.artemis.spi.core.security.jaas.SCRAMMechanismCallback
import org.apache.activemq.artemis.spi.core.security.scram.SCRAM;
import org.apache.activemq.artemis.spi.core.security.scram.UserData;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* abstract class that implements the SASL-SCRAM authentication scheme, concrete implementations
@@ -51,12 +50,12 @@ import org.slf4j.LoggerFactory;
*/
public abstract class SCRAMServerSASLFactory implements ServerSASLFactory {
- private final Logger logger = LoggerFactory.getLogger(getClass());
-
+ private final Logger logger;
private final SCRAM scramType;
- public SCRAMServerSASLFactory(SCRAM scram) {
+ public SCRAMServerSASLFactory(SCRAM scram, Logger logger) {
this.scramType = scram;
+ this.logger = logger;
}
@Override
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA256SCRAMServerSASLFactory.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA256SCRAMServerSASLFactory.java
index f7a1308504..18edb19723 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA256SCRAMServerSASLFactory.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA256SCRAMServerSASLFactory.java
@@ -16,15 +16,21 @@
*/
package org.apache.activemq.artemis.protocol.amqp.sasl.scram;
+import java.lang.invoke.MethodHandles;
+
import org.apache.activemq.artemis.spi.core.security.scram.SCRAM;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
- * provides SASL SRAM-SHA256
+ * provides SASL SCRAM-SHA256
*/
public class SHA256SCRAMServerSASLFactory extends SCRAMServerSASLFactory {
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
public SHA256SCRAMServerSASLFactory() {
- super(SCRAM.SHA256);
+ super(SCRAM.SHA256, logger);
}
@Override
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA512SCRAMServerSASLFactory.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA512SCRAMServerSASLFactory.java
index 93c4008d70..e80866852a 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA512SCRAMServerSASLFactory.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/sasl/scram/SHA512SCRAMServerSASLFactory.java
@@ -16,15 +16,21 @@
*/
package org.apache.activemq.artemis.protocol.amqp.sasl.scram;
+import java.lang.invoke.MethodHandles;
+
import org.apache.activemq.artemis.spi.core.security.scram.SCRAM;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
- * provides SASL SRAM-SHA512
+ * provides SASL SCRAM-SHA512
*/
public class SHA512SCRAMServerSASLFactory extends SCRAMServerSASLFactory {
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
public SHA512SCRAMServerSASLFactory() {
- super(SCRAM.SHA512);
+ super(SCRAM.SHA512, logger);
}
@Override
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/AbstractPrincipalLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/AbstractPrincipalLoginModule.java
index 430076545c..e44a2848ab 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/AbstractPrincipalLoginModule.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/AbstractPrincipalLoginModule.java
@@ -30,13 +30,12 @@ import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginException;
import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Abstract login module that uses an external authenticated principal
*/
public abstract class AbstractPrincipalLoginModule implements AuditLoginModule {
- private final Logger logger = LoggerFactory.getLogger(getClass());
+ private final Logger logger;
private Subject subject;
private final List<Principal> authenticatedPrincipals = new LinkedList<>();
@@ -44,6 +43,10 @@ public abstract class AbstractPrincipalLoginModule implements AuditLoginModule {
private boolean loginSucceeded;
private Principal[] principals;
+ public AbstractPrincipalLoginModule(Logger logger) {
+ this.logger = logger;
+ }
+
@Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState,
Map<String, ?> options) {
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/Krb5LoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/Krb5LoginModule.java
index a3cecb1861..bdc1611e1b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/Krb5LoginModule.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/Krb5LoginModule.java
@@ -16,10 +16,19 @@
*/
package org.apache.activemq.artemis.spi.core.security.jaas;
+import java.lang.invoke.MethodHandles;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* populate a subject with kerberos credential from the handler
*/
public class Krb5LoginModule extends AbstractPrincipalLoginModule {
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ public Krb5LoginModule() {
+ super(logger);
+ }
}
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/SCRAMLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/SCRAMLoginModule.java
index e4b44f76d8..634cb3820f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/SCRAMLoginModule.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/SCRAMLoginModule.java
@@ -16,10 +16,19 @@
*/
package org.apache.activemq.artemis.spi.core.security.jaas;
+import java.lang.invoke.MethodHandles;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Handles the actual login after channel authentication has succeeded
*/
public class SCRAMLoginModule extends AbstractPrincipalLoginModule {
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ public SCRAMLoginModule() {
+ super(logger);
+ }
}
[activemq-artemis] 03/03: ARTEMIS-4020: stop CI jobs trying to activate tests-CI logging config profile, it no longer exists
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
robbie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit c01833aa3f02c18fee50034e8d89fbaf146093ee
Author: Robbie Gemmell <ro...@apache.org>
AuthorDate: Fri Sep 30 14:56:19 2022 +0100
ARTEMIS-4020: stop CI jobs trying to activate tests-CI logging config profile, it no longer exists
---
.github/workflows/build.yml | 2 +-
.travis.yml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8a5125c1d8..19c9b19daa 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -34,7 +34,7 @@ jobs:
# By setting anything to org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED we are disabling libaio loading on the testsuite
- name: Fast Tests
run: |
- mvn -s .github/maven-settings.xml -Dorg.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED=AnythingNotNull -Pfast-tests -Ptests-CI install
+ mvn -s .github/maven-settings.xml -Dorg.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED=AnythingNotNull -Pfast-tests install
- name: Clean Up Before Caching
run: |
diff --git a/.travis.yml b/.travis.yml
index 9f6965dda1..f84c184652 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@ before_install:
# By setting anything to org.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED we are disabling libaio loading on the testsuite
script:
- set -e
-- mvn -s .github/maven-settings.xml -ntp -Dorg.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED=AnythingNotNull -Dmaven.test.redirectTestOutputToFile=true -Derrorprone -Pdev -Pfast-tests -Ptests-CI -Pjmh -B install
+- mvn -s .github/maven-settings.xml -ntp -Dorg.apache.activemq.artemis.core.io.aio.AIOSequentialFileFactory.DISABLED=AnythingNotNull -Dmaven.test.redirectTestOutputToFile=true -Derrorprone -Pdev -Pfast-tests -Pjmh -B install
- cd examples
- mvn -s ../.github/maven-settings.xml verify -P${EXAMPLES_PROFILE} -B -q