OPENDJ-1342 Migrate AVA, RDN, and DN classes: Fix change in behaviour for DN.toString()
DN.toString() now returns the raw dn provided in DN.valueOf()
while it used to return a somewhat normalized view of the raw DN.
| | |
| | | // No differences expected. |
| | | assertThat(Entries.diffEntries(original, expectedEntry).getModifications()).isEmpty(); |
| | | |
| | | assertThat(srEntry.getName().toString()).isEqualTo("uid=user.1,o=test"); |
| | | assertThat((Object) srEntry.getName()).isEqualTo(DN.valueOf("uid=user.1,o=test")); |
| | | assertThat(srEntry.getAttributeCount()).isEqualTo(7); |
| | | assertThat(srEntry.getAttribute("description").firstValueAsString()).isEqualTo( |
| | | "This is the description for Aaren Atp."); |
| | |
| | | connection.searchSingleEntry(Requests.newSearchRequest( |
| | | "uid=user.1, o=test", SearchScope.BASE_OBJECT, "(uid=user.1)")); |
| | | assertThat(srEntry).isNotNull(); |
| | | assertThat(srEntry.getName().toString()).isEqualTo("uid=user.1,o=test"); |
| | | assertThat((Object) srEntry.getName()).isEqualTo(DN.valueOf("uid=user.1,o=test")); |
| | | |
| | | connection.close(); |
| | | } |
| | |
| | | assertThat(reader.isEntry()).isTrue(); |
| | | final SearchResultEntry entry = reader.readEntry(); |
| | | assertThat(entry).isNotNull(); |
| | | assertThat(entry.getName().toString()).isEqualTo("uid=user.1,o=test"); |
| | | assertThat((Object) entry.getName()).isEqualTo(DN.valueOf("uid=user.1,o=test")); |
| | | assertThat(reader.hasNext()).isFalse(); |
| | | } |
| | | |
| | |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | c.addExpectedAttribute("ds-cfg-attribute-type", "description"); |
| | | c.addExpectedAttribute("ds-cfg-rotation-policy", |
| | | "cn=LDAP Connection Handler,cn=connection handlers,cn=config"); |
| | | "cn=LDAP Connection Handler,cn=connection handlers, cn=config"); |
| | | |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | |
| | | "cn=test child 2,cn=test children,cn=test parent 1,cn=test parents,cn=config"); |
| | | c.importLDIF(TEST_LDIF); |
| | | c.addExpectedModification("ds-cfg-rotation-policy", |
| | | "cn=LDAPS Connection Handler,cn=connection handlers,cn=config", |
| | | "cn=JMX Connection Handler,cn=connection handlers,cn=config"); |
| | | "cn=LDAPS Connection Handler,cn=connection handlers, cn=config", |
| | | "cn=JMX Connection Handler,cn=connection handlers, cn=config"); |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.getTestChild("test child 2"); |
| | |
| | | @Test(dataProvider = "testDNs") |
| | | public void testToString(String rawDN, String unused, String stringDN) throws Exception { |
| | | DN dn = DN.valueOf(rawDN); |
| | | assertEquals(dn.toString(), stringDN); |
| | | assertEquals(dn.toString(), rawDN); |
| | | } |
| | | |
| | | |
| | |
| | | @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\"}", |
| | | "{ 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\" }" }, |
| | | { "{ 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 }", |
| | | "{ base \"dc=sun,dc=com\", " |
| | | "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopBefore:\"o=abc\", " |
| | | + "chopAfter:\"o=xyz\" }, maximum 10, specificationFilter " |
| | | + "not:not:item:foo }" }, |
| | |
| | | { "{ specificationFilter or:{item:top, item:foo, and:{item:one, item:two}} }", |
| | | "{ specificationFilter or:{item:top, item:foo, and:{item:one, item:two}} }" }, |
| | | { "{ base \"dc=sun, dc=com\", specificationFilter \"(objectClass=*)\" }", |
| | | "{ base \"dc=sun,dc=com\", specificationFilter \"(objectClass=*)\" }" }, |
| | | "{ base \"dc=sun, dc=com\", specificationFilter \"(objectClass=*)\" }" }, |
| | | }; |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | } |