From 06a8f00dbe842f0c2f3f3c179963913b060b293d Mon Sep 17 00:00:00 2001
From: Brian Major <brian.major@nrc-cnrc.gc.ca>
Date: Wed, 12 Nov 2014 11:04:59 -0800
Subject: [PATCH] nep110 - added logging to LdapDAO tests

---
 .../src/ca/nrc/cadc/ac/server/ldap/LdapConfig.java           | 3 ++-
 .../test/src/ca/nrc/cadc/ac/server/ldap/LdapDAOTest.java     | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapConfig.java b/projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapConfig.java
index 42995612..f7458949 100755
--- a/projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapConfig.java
+++ b/projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapConfig.java
@@ -126,11 +126,12 @@ public class LdapConfig
 
     public static LdapConfig getLdapConfig(final String ldapProperties)
     {
+        logger.debug("Reading LDAP properties from: " + ldapProperties);
         PropertiesReader pr = new PropertiesReader(ldapProperties);
         
         MultiValuedProperties config = pr.getAllProperties();
         
-        if (config.keySet() == null)
+        if (config == null || config.keySet() == null)
         {
             throw new RuntimeException("failed to read any LDAP property ");
         }
diff --git a/projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/ldap/LdapDAOTest.java b/projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/ldap/LdapDAOTest.java
index ecd65e94..05e33b33 100644
--- a/projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/ldap/LdapDAOTest.java
+++ b/projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/ldap/LdapDAOTest.java
@@ -76,9 +76,11 @@ import javax.security.auth.x500.X500Principal;
 
 import ca.nrc.cadc.auth.HttpPrincipal;
 import ca.nrc.cadc.auth.NumericPrincipal;
+import ca.nrc.cadc.util.Log4jInit;
 
 import com.unboundid.ldap.sdk.LDAPConnection;
 
+import org.apache.log4j.Level;
 import org.junit.Test;
 import org.junit.BeforeClass;
 import static org.junit.Assert.*;
@@ -91,8 +93,9 @@ public class LdapDAOTest extends AbstractLdapDAOTest
     @BeforeClass
     public static void setUpBeforeClass() throws Exception
     {
+        Log4jInit.setLevel("ca.nrc.cadc.ac", Level.INFO);
         // get the configuration of the development server from and config files...
-        config = getLdapConfig();
+        config = getLdapConfig();        
     }
     @Test
     public void testLdapBindConnection() throws Exception
-- 
GitLab