qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject [qpid-broker-j] branch master updated: NO-JIRA: Log enviornment and JVM settings in Kerberos tests for debug purposes
Date Wed, 15 Jan 2020 12:03:19 GMT
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git


The following commit(s) were added to refs/heads/master by this push:
     new dfad483  NO-JIRA: Log enviornment and JVM settings in Kerberos tests for debug purposes
dfad483 is described below

commit dfad483aad12d617b0b8e7d417814bade83abb52
Author: Alex Rudyy <orudyy@apache.org>
AuthorDate: Wed Jan 15 12:02:26 2020 +0000

    NO-JIRA: Log enviornment and JVM settings in Kerberos tests for debug purposes
---
 .../auth/manager/KerberosAuthenticationManagerTest.java      | 12 ++++++++----
 .../security/auth/manager/SpnegoAuthenticatorTest.java       |  4 ++++
 .../java/org/apache/qpid/server/test/KerberosUtilities.java  |  8 ++++++++
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerTest.java
b/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerTest.java
index eea1eef..6e89da7 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/KerberosAuthenticationManagerTest.java
@@ -120,7 +120,7 @@ public class KerberosAuthenticationManagerTest extends UnitTestBase
         when(_broker.getChildren(AuthenticationProvider.class))
                 .thenReturn(Collections.singleton(_kerberosAuthenticationProvider));
 
-        UTILS.debugConfig();
+        KerberosUtilities.debugConfig();
     }
 
     @Test
@@ -201,18 +201,22 @@ public class KerberosAuthenticationManagerTest extends UnitTestBase
         final LoginContext lc = UTILS.createKerberosKeyTabLoginContext(getTestName(),
                                                                        CLIENT_PRINCIPAL_FULL_NAME,
                                                                        _clientKeyTabFile);
+
+        Subject clientSubject = null;
         try
         {
             lc.login();
-
-            final Subject clientSubject = lc.getSubject();
+            clientSubject = lc.getSubject();
             debug("LoginContext subject {}", clientSubject);
             final SaslClient saslClient = createSaslClient(clientSubject);
             return performNegotiation(clientSubject, saslClient, negotiator);
         }
         finally
         {
-            lc.logout();
+            if (clientSubject != null)
+            {
+                lc.logout();
+            }
         }
     }
 
diff --git a/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SpnegoAuthenticatorTest.java
b/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SpnegoAuthenticatorTest.java
index d3f8342..7fadbf7 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SpnegoAuthenticatorTest.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SpnegoAuthenticatorTest.java
@@ -32,7 +32,9 @@ import java.net.URL;
 import java.net.URLDecoder;
 import java.security.Principal;
 import java.util.Base64;
+import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Properties;
 
 import org.ietf.jgss.GSSException;
 import org.junit.Before;
@@ -81,6 +83,8 @@ public class SpnegoAuthenticatorTest extends UnitTestBase
         assertNotNull(resource);
         SYSTEM_PROPERTY_SETTER.setSystemProperty("java.security.auth.login.config", URLDecoder.decode(resource.getPath(),
UTF_8));
         SYSTEM_PROPERTY_SETTER.setSystemProperty("javax.security.auth.useSubjectCredsOnly",
"false");
+
+        KerberosUtilities.debugConfig();
     }
 
     @Before
diff --git a/broker-core/src/test/java/org/apache/qpid/server/test/KerberosUtilities.java
b/broker-core/src/test/java/org/apache/qpid/server/test/KerberosUtilities.java
index 74cb2d2..0e65988 100644
--- a/broker-core/src/test/java/org/apache/qpid/server/test/KerberosUtilities.java
+++ b/broker-core/src/test/java/org/apache/qpid/server/test/KerberosUtilities.java
@@ -24,7 +24,9 @@ import static java.lang.Boolean.TRUE;
 import java.io.File;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.security.auth.DestroyFailedException;
 import javax.security.auth.Subject;
@@ -228,6 +230,12 @@ public class KerberosUtilities
             {
                 LOGGER.warn("JVM system property 'java.security.krb5.conf' is not set");
             }
+
+            Map<String, String> env = new LinkedHashMap<>(System.getenv());
+            env.forEach((k, v) -> debug("Environment setting: {}={}", k ,v));
+
+            Properties properties = new Properties(System.getProperties());
+            properties.forEach((k, v) -> debug("JVM setting: {}={}", k ,v));
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message