[TEST] fix apache ds cleanup issues
Original commit: elastic/x-pack-elasticsearch@235a5de900
This commit is contained in:
parent
d5d4be018d
commit
932cfd9a33
|
@ -8,6 +8,7 @@ package org.elasticsearch.shield.authc.ldap;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
@ -26,6 +27,12 @@ public class LdapConnectionTests extends ElasticsearchTestCase {
|
|||
@Rule
|
||||
public static ApacheDsRule apacheDsRule = new ApacheDsRule(temporaryFolder);
|
||||
|
||||
@AfterClass
|
||||
public static void cleanup() {
|
||||
temporaryFolder = null;
|
||||
apacheDsRule = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindWithTemplates() {
|
||||
String[] ldapUrls = new String[]{apacheDsRule.getUrl()};
|
||||
|
@ -45,7 +52,7 @@ public class LdapConnectionTests extends ElasticsearchTestCase {
|
|||
LdapConnection ldap = connectionFactory.bind(user, userPass);
|
||||
Map<String, String[]> attrs = ldap.getUserAttrs(ldap.getAuthenticatedUserDn());
|
||||
|
||||
assertThat( attrs, hasKey("uid"));
|
||||
assertThat(attrs, hasKey("uid"));
|
||||
assertThat( attrs.get("uid"), arrayContaining("hhornblo"));
|
||||
}
|
||||
@Test
|
||||
|
|
|
@ -14,10 +14,7 @@ import org.elasticsearch.shield.authc.support.UsernamePasswordToken;
|
|||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.watcher.ResourceWatcherService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.*;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
@ -47,6 +44,12 @@ public class LdapRealmTest extends ElasticsearchTestCase {
|
|||
@Rule
|
||||
public static ApacheDsRule apacheDsRule = new ApacheDsRule(temporaryFolder);
|
||||
|
||||
@AfterClass
|
||||
public static void cleanup() {
|
||||
temporaryFolder = null;
|
||||
apacheDsRule = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRestHeaderRegistration() {
|
||||
new LdapRealm(ImmutableSettings.EMPTY, mock(LdapConnectionFactory.class), mock(LdapGroupToRoleMapper.class), restController);
|
||||
|
|
Loading…
Reference in New Issue