use of opengrok.auth.plugin.ldap.LdapServer in project OpenGrok by OpenGrok.
the class LdapServerTest method testEmptyAddressArray.
@Test
void testEmptyAddressArray() throws UnknownHostException {
LdapServer server = new LdapServer("ldaps://foo.bar.com");
LdapServer serverSpy = Mockito.spy(server);
doReturn(new InetAddress[] {}).when(serverSpy).getAddresses(any());
assertFalse(serverSpy.isReachable());
}
use of opengrok.auth.plugin.ldap.LdapServer in project OpenGrok by OpenGrok.
the class LdapServerTest method testSetGetUsername.
@Test
void testSetGetUsername() {
LdapServer server = new LdapServer();
assertNull(server.getUsername());
assertNull(server.getPassword());
final String testUsername = "foo";
server.setUsername(testUsername);
assertEquals(testUsername, server.getUsername());
final String testPassword = "bar";
server.setPassword(testPassword);
assertEquals(testPassword, server.getPassword());
}
use of opengrok.auth.plugin.ldap.LdapServer in project OpenGrok by OpenGrok.
the class LdapServerTest method testToString.
@Test
void testToString() {
LdapServer server = new LdapServer("ldaps://foo.bar.com", "foo", "bar");
server.setConnectTimeout(2000);
server.setReadTimeout(1000);
assertEquals("ldaps://foo.bar.com, connect timeout: 2000, read timeout: 1000, username: foo", server.toString());
}
use of opengrok.auth.plugin.ldap.LdapServer in project OpenGrok by OpenGrok.
the class LdapServerTest method testInvalidURI.
@Test
void testInvalidURI() {
LdapServer server = new LdapServer("foo:/\\/\\foo.bar");
assertFalse(server.isReachable());
}
use of opengrok.auth.plugin.ldap.LdapServer in project OpenGrok by OpenGrok.
the class LdapServerTest method testGetPort.
@Test
void testGetPort() throws URISyntaxException {
LdapServer server = new LdapServer("ldaps://foo.bar");
assertEquals(636, server.getPort());
server = new LdapServer("ldap://foo.bar");
assertEquals(389, server.getPort());
server = new LdapServer("crumble://foo.bar");
assertEquals(-1, server.getPort());
}
Aggregations