karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [2/2] karaf git commit: Suppress logging exception in test
Date Tue, 15 Aug 2017 13:39:57 GMT
Suppress logging exception in test


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/54974034
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/54974034
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/54974034

Branch: refs/heads/master
Commit: 549740347157bc15cf62de17018fe2c1818eb601
Parents: a75faba
Author: Christian Schneider <chris@die-schneider.net>
Authored: Tue Aug 15 15:39:48 2017 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Tue Aug 15 15:39:48 2017 +0200

----------------------------------------------------------------------
 .../apache/karaf/jaas/modules/ldap/LdapLoginModuleTest.java   | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/54974034/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapLoginModuleTest.java
b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapLoginModuleTest.java
index e2c374a..ea29eef 100644
--- a/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapLoginModuleTest.java
+++ b/jaas/modules/src/test/java/org/apache/karaf/jaas/modules/ldap/LdapLoginModuleTest.java
@@ -27,6 +27,7 @@ import org.apache.felix.utils.properties.Properties;
 import org.apache.karaf.jaas.boot.principal.RolePrincipal;
 import org.apache.karaf.jaas.boot.principal.UserPrincipal;
 import org.apache.karaf.jaas.modules.NamePasswordCallbackHandler;
+import org.apache.log4j.Level;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -202,12 +203,18 @@ public class LdapLoginModuleTest extends AbstractLdapTestUnit {
         module.initialize(subject, new NamePasswordCallbackHandler("admin", "blahblah"),
null, options);
 
         assertEquals("Precondition", 0, subject.getPrincipals().size());
+        org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(LDAPLoginModule.class);
+        Level oldLevel = logger.getLevel();
+        logger.setLevel(Level.OFF);
         try {
             module.login();
             fail("Should have thrown LoginException");
         } catch (LoginException e) {
             assertTrue(e.getMessage().startsWith("Authentication failed"));
+        } finally {
+            logger.setLevel(oldLevel);
         }
+        
     }
 
     @Test


Mime
View raw message