| | |
| | | @SuppressWarnings("javadoc") |
| | | public final class TestSubtreeSpecification extends SubtreeSpecificationTestCase { |
| | | |
| | | /** Cached root DN. */ |
| | | private DN rootDN = DN.rootDN(); |
| | | |
| | | @DataProvider |
| | | public Object[][] valueOfData() { |
| | | return new Object[][] { |
| | |
| | | "{ base \"dc=sun,dc=com\" }" }, |
| | | { "{base \"dc=sun, dc=com\"}", |
| | | "{ base \"dc=sun,dc=com\" }" }, |
| | | { "{ base \"dc=sun, dc=com\", " + "specificationFilter item:ds-config-rootDN }", |
| | | "{ base \"dc=sun,dc=com\", " + "specificationFilter item:ds-config-rootDN }" }, |
| | | { "{ base \"dc=sun, dc=com\", specificationFilter item:ds-config-rootDN }", |
| | | "{ base \"dc=sun,dc=com\", specificationFilter item:ds-config-rootDN }" }, |
| | | { "{ base \"dc=sun, dc=com\", minimum 0 , maximum 10, " |
| | | + "specificExclusions {chopBefore:\"o=abc\", " |
| | | + "chopAfter:\"o=xyz\"} , specificationFilter not:not:item:foo }", |
| | |
| | | |
| | | @Test(dataProvider = "valueOfData") |
| | | public void testValueOf(String specification, String expected) throws Exception { |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, specification); |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(DN.rootDN(), specification); |
| | | assertEquals(ss.toString(), expected); |
| | | } |
| | | |
| | |
| | | @Test(dataProvider = "isWithinScopeData") |
| | | public void testIsWithinScope(String dnString, String value, boolean expected) throws Exception { |
| | | DN dn = DN.valueOf(dnString); |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, value); |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(DN.rootDN(), value); |
| | | assertEquals(ss.isWithinScope(createEntry(dn, getObjectClasses())), expected); |
| | | } |
| | | } |