Skip to content

Commit b362985

Browse files
committed
static means static stupid. Fix schema related bug introduced by the fix to issue #4 which resolve #5
1 parent 8702040 commit b362985

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ private Optional<Schema> customSchema() {
219219
if (!schemaFiles.isEmpty()) {
220220
final Schema customSchema = initialSchema == null
221221
? Schema.getSchema(schemaFiles)
222-
: initialSchema.mergeSchemas(Schema.getSchema(schemaFiles));
222+
: Schema.mergeSchemas(initialSchema, Schema.getSchema(schemaFiles));
223223
return Optional.fromNullable(customSchema);
224224
} else {
225225
return Optional.absent();
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.zapodot.junit.ldap;
2+
3+
import com.unboundid.ldap.sdk.schema.AttributeTypeDefinition;
4+
import com.unboundid.ldap.sdk.schema.Schema;
5+
import org.junit.Rule;
6+
import org.junit.Test;
7+
8+
import static org.junit.Assert.assertNotNull;
9+
10+
public class EmbeddedLdapRuleCustomStandardAndCustomSchemaTest {
11+
12+
@Rule
13+
public EmbeddedLdapRule embeddedLdapRule = EmbeddedLdapRuleBuilder.newInstance()
14+
.withSchema("custom-schema.ldif")
15+
.build();
16+
17+
@Test
18+
public void testFindCustomAttribute() throws Exception {
19+
final Schema currentSchema = embeddedLdapRule.ldapConnection().getSchema();
20+
final AttributeTypeDefinition changelogAttribute =
21+
currentSchema.getAttributeType("attribute");
22+
assertNotNull(changelogAttribute);
23+
assertNotNull(currentSchema.getObjectClass("type"));
24+
}
25+
}

src/test/java/org/zapodot/junit/ldap/EmbeddedLdapRuleCustomSchemaTest.java renamed to src/test/java/org/zapodot/junit/ldap/EmbeddedLdapRuleCustomWithoutStandardSchemaTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import static org.junit.Assert.assertNotNull;
88

9-
public class EmbeddedLdapRuleCustomSchemaTest {
9+
public class EmbeddedLdapRuleCustomWithoutStandardSchemaTest {
1010

1111
@Rule
1212
public EmbeddedLdapRule embeddedLdapRule = EmbeddedLdapRuleBuilder.newInstance()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dn: cn=custom-schema
2+
objectClass: top
3+
objectClass: ldapSubEntry
4+
objectClass: subschema
5+
cn: custom-schema
6+
attributeTypes: ( 1.3.6.1.4.1.41609.1.75 NAME 'attribute' DESC 'A simple attribute' SUP name SINGLE-VALUE )
7+
objectClasses: ( 1.3.6.1.4.1.41609.2.13 NAME 'type' DESC 'A simple objectClass' SUP top STRUCTURAL MUST ( cn $ attribute ) MAY ( description ) )

0 commit comments

Comments
 (0)