use of org.apache.directory.api.ldap.model.subtree.SubtreeSpecification in project directory-ldap-api by apache.
the class SubtreeSpecificationParserTest method testEmptySpec.
/**
* Tests the parser with a valid empty specification.
*/
@Test
public void testEmptySpec() throws Exception {
SubtreeSpecification ss = parser.parse(EMPTY_SPEC);
assertNotNull(ss);
// try a second time
ss = parser.parse(EMPTY_SPEC);
assertNotNull(ss);
// try a third time
ss = parser.parse(EMPTY_SPEC);
assertNotNull(ss);
}
use of org.apache.directory.api.ldap.model.subtree.SubtreeSpecification in project directory-ldap-api by apache.
the class SubtreeSpecificationParserTest method testSpecWithBaseAndEmptyRefinement.
/**
* Tests the parser with a valid specification with base and empty
* refinement set.
*/
@Test
public void testSpecWithBaseAndEmptyRefinement() throws Exception {
SubtreeSpecification ss = parser.parse(SPEC_WITH_BASE_AND_EMPTY_REFINEMENT);
assertEquals("ou=system", ss.getBase().toString());
}
use of org.apache.directory.api.ldap.model.subtree.SubtreeSpecification in project directory-ldap-api by apache.
the class SubtreeSpecificationParserTest method testReusabiltiy.
/**
* Test reusability, especially if the state is resetted.
*/
@Test
public void testReusabiltiy() throws Exception {
Dn firstDn = new Dn(schemaManager, "cn=l");
String firstExclusion = "{ specificExclusions { chopAfter:\"cn=l\" } }";
SubtreeSpecification firstSpec = parser.parse(firstExclusion);
assertEquals(1, firstSpec.getChopAfterExclusions().size());
assertEquals(firstDn, firstSpec.getChopAfterExclusions().iterator().next());
Dn secondDn = new Dn(schemaManager, "l=y");
String secondExclusion = "{ specificExclusions { chopAfter:\"l=y\" } }";
SubtreeSpecification secondSpec = parser.parse(secondExclusion);
assertEquals(1, secondSpec.getChopAfterExclusions().size());
assertEquals(secondDn, secondSpec.getChopAfterExclusions().iterator().next());
}
use of org.apache.directory.api.ldap.model.subtree.SubtreeSpecification in project directory-ldap-api by apache.
the class SubtreeSpecificationParserTest method testSpecWithBaseAndSpecificExclusionsAndMinimumAndMaximum.
/**
* Tests the parser with a valid specification with base and specific
* exclusions and minimum and maximum set.
*/
@Test
public void testSpecWithBaseAndSpecificExclusionsAndMinimumAndMaximum() throws Exception {
SubtreeSpecification ss = parser.parse(SPEC_WITH_BASE_AND_SPECIFICEXCLUSIONS_AND_MINIMUM_AND_MAXIMUM);
assertNotNull(ss);
assertEquals("ou=people", ss.getBase().toString());
assertTrue(ss.getChopBeforeExclusions().contains(new Dn(schemaManager, "cn=y")));
assertTrue(ss.getChopBeforeExclusions().contains(new Dn(schemaManager, "c=z")));
assertTrue(ss.getChopAfterExclusions().contains(new Dn(schemaManager, "sn=l")));
assertTrue(ss.getChopAfterExclusions().contains(new Dn(schemaManager, "l=m")));
assertEquals(7, ss.getMinBaseDistance());
assertEquals(77, ss.getMaxBaseDistance());
}
use of org.apache.directory.api.ldap.model.subtree.SubtreeSpecification in project directory-ldap-api by apache.
the class SubtreeSpecificationParserTest method testSpecWithBase.
/**
* Tests the parser with a valid specification with base set.
*/
@Test
public void testSpecWithBase() throws Exception {
SubtreeSpecification ss = parser.parse(SPEC_WITH_BASE);
assertNotNull(ss);
assertEquals("ou=system", ss.getBase().toString());
}
Aggregations