Skip to content

Commit bd09c0f

Browse files
committed
Allow running the server with no schema at all
1 parent c9b87bb commit bd09c0f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/org/zapodot/junit/ldap/EmbeddedLdapRuleBuilder.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ private InMemoryDirectoryServerConfig createInMemoryServerConfiguration() {
192192
bindPort,
193193
null);
194194
inMemoryDirectoryServerConfig.setListenerConfigs(listenerConfig);
195-
for (Schema s : customSchema().asSet()) {
196-
inMemoryDirectoryServerConfig.setSchema(s);
197-
}
195+
inMemoryDirectoryServerConfig.setSchema(customSchema());
198196
return inMemoryDirectoryServerConfig;
199197
} catch (LDAPException e) {
200198
throw new IllegalStateException(
@@ -211,7 +209,7 @@ private String[] domainDsnArray() {
211209
}
212210
}
213211

214-
private Optional<Schema> customSchema() {
212+
private Schema customSchema() {
215213
final List<File> schemaFiles = schemaFiles();
216214

217215
try {
@@ -220,9 +218,9 @@ private Optional<Schema> customSchema() {
220218
final Schema customSchema = initialSchema == null
221219
? Schema.getSchema(schemaFiles)
222220
: Schema.mergeSchemas(initialSchema, Schema.getSchema(schemaFiles));
223-
return Optional.fromNullable(customSchema);
221+
return customSchema;
224222
} else {
225-
return Optional.absent();
223+
return null;
226224
}
227225

228226
} catch (IOException | LDIFException | LDAPException e) {

0 commit comments

Comments
 (0)