Make it possible to specify ldif file for LDAPEmbeddedServer
This commit is contained in:
parent
de6341bd87
commit
dca347398d
1 changed files with 7 additions and 1 deletions
|
@ -2,6 +2,7 @@ package org.keycloak.testsuite.ldap;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -148,7 +149,12 @@ public class LDAPEmbeddedServer {
|
|||
}
|
||||
|
||||
// For now, assume that LDIF file is on classpath
|
||||
InputStream is = getClass().getClassLoader().getResourceAsStream(ldifFile);
|
||||
InputStream is;
|
||||
if (ldifFile.startsWith("file:")) {
|
||||
is = new URL(ldifFile).openStream();
|
||||
} else {
|
||||
is = getClass().getClassLoader().getResourceAsStream(ldifFile);
|
||||
}
|
||||
if (is == null) {
|
||||
throw new IllegalStateException("LDIF file not found on classpath. Location was: " + ldifFile);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue