File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed
main/java/org/zapodot/junit/ldap
test/java/org/zapodot/junit/ldap Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change 1+ package org .zapodot .junit .ldap ;
2+
3+ import com .unboundid .ldap .sdk .schema .Schema ;
4+ import org .junit .Rule ;
5+ import org .junit .Test ;
6+
7+ import static org .junit .Assert .assertTrue ;
8+
9+ public class EmbeddedLdapRuleCustomWithoutSchemaTest {
10+
11+ @ Rule
12+ public EmbeddedLdapRule embeddedLdapRule = EmbeddedLdapRuleBuilder .newInstance ()
13+ .withoutDefaultSchema ()
14+ .build ();
15+
16+ @ Test
17+ public void testEmptySchema () throws Exception {
18+ final Schema schema =
19+ embeddedLdapRule .ldapConnection ().getSchema ();
20+ assertTrue (schema .getAttributeTypes ().isEmpty ());
21+
22+ }
23+ }
You can’t perform that action at this time.
0 commit comments