LdapAuth3: factor out configuration class
including the renaming of some configuration properties
Change-Id: I0268c88a0bb7a3255debf045beab3faa71e9dce2
diff --git a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java
index 30d585b..6f3edc4 100644
--- a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java
+++ b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java
@@ -138,4 +138,11 @@
assertEquals("peter@example.org", LdapAuth3.getEmail("testuser2", TEST_LDAPS_CONF));
assertEquals(null, LdapAuth3.getEmail("non-exsting", TEST_LDAPS_CONF));
}
+
+ @Test
+ public void canLoadLdapConfig() {
+ LDAPConfig ldapConfig = new LDAPConfig(TEST_LDAPS_CONF);
+ assertEquals(3269, ldapConfig.port);
+ assertEquals("localhost", ldapConfig.host);
+ }
}
diff --git a/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java b/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
index e5e5cb7..7783274 100644
--- a/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
@@ -7,6 +7,9 @@
import org.junit.AfterClass;
import org.junit.Test;
+import java.net.UnknownHostException;
+import java.security.GeneralSecurityException;
+
import static de.ids_mannheim.korap.authentication.LdapAuth3.LDAP_AUTH_RNAUTH;
import static de.ids_mannheim.korap.authentication.LdapAuth3.LDAP_AUTH_ROK;
import static org.junit.Assert.assertEquals;
@@ -44,12 +47,14 @@
}
@Test
- public void gettingMailForUser() throws LDAPException {
+ public void gettingMailForUser() throws LDAPException, UnknownHostException, GeneralSecurityException {
+ EmbeddedLdapServer.startIfNotRunning(EMBEDDED_LDAP_DEFAULT_CONF);
assertEquals("user2@example.com", LdapAuth3.getEmail("user2", EMBEDDED_LDAP_DEFAULT_CONF));
}
@Test
- public void gettingMailForUnknownUserIsNull() throws LDAPException {
+ public void gettingMailForUnknownUserIsNull() throws LDAPException, UnknownHostException, GeneralSecurityException {
+ EmbeddedLdapServer.startIfNotRunning(EMBEDDED_LDAP_DEFAULT_CONF);
assertEquals(null, LdapAuth3.getEmail("user1000", EMBEDDED_LDAP_DEFAULT_CONF));
}
}