DistinguishedName implements Name { public DistinguishedName() { names = new LinkedList(); } DistinguishedName();  DistinguishedName(String path);  DistinguishedName(List list);  DistinguishedName(Name name); LdapRdn getLdapRdn(int index); LdapRdn getLdapRdn(String key); String getValue(String key); List getNames(); String toString(); String toCompactString(); String encode(); String toUrl(); boolean contains(DistinguishedName path); DistinguishedName append(DistinguishedName path); DistinguishedName append(String key, String value); void prepend(DistinguishedName path); LdapRdn removeFirst(); void removeFirst(Name path); Object clone(); boolean equals(Object obj); int hashCode(); int compareTo(Object obj); int size(); boolean isEmpty(); Enumeration getAll(); String get(int index); Name getPrefix(int index); Name getSuffix(int index); boolean startsWith(Name name); boolean endsWith(Name name); Name addAll(Name name); Name addAll(int arg0, Name name); Name add(String string); Name add(int index, String string); Object remove(int arg0); LdapRdn removeLast(); void add(String key, String value); void add(LdapRdn rdn); void add(int idx, LdapRdn rdn); DistinguishedName immutableDistinguishedName(); static final DistinguishedName immutableDistinguishedName(String dnString); static final String SPACED_DN_FORMAT_PROPERTY; static final String KEY_CASE_FOLD_PROPERTY; static final String KEY_CASE_FOLD_LOWER; static final String KEY_CASE_FOLD_UPPER; static final String KEY_CASE_FOLD_NONE; static final DistinguishedName EMPTY_PATH; }
@Test public void testDistinguishedName() { String testPath = "cn=foo\\,bar,OU=FOO\\,bar , OU=foo\\;bar;OU=foo\\;bar" + " ; ou=foo\\,,ou=foo\\,;ou=foo\\;;ou=foo\\,;ou=bar\\,"; System.out.println(testPath); DistinguishedName path = new DistinguishedName(testPath); assertThat(path.getLdapRdn(8).getComponent().getKey()).isEqualTo("cn"); assertThat(path.getLdapRdn(8).getComponent().getValue()).isEqualTo("foo,bar"); assertThat(path.getLdapRdn(7).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(7).getComponent().getValue()).isEqualTo("FOO,bar"); assertThat(path.getLdapRdn(6).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(6).getComponent().getValue()).isEqualTo("foo;bar"); assertThat(path.getLdapRdn(5).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(5).getComponent().getValue()).isEqualTo("foo;bar"); assertThat(path.getLdapRdn(4).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(4).getComponent().getValue()).isEqualTo("foo,"); assertThat(path.getLdapRdn(3).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(3).getComponent().getValue()).isEqualTo("foo,"); assertThat(path.getLdapRdn(2).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(2).getComponent().getValue()).isEqualTo("foo;"); assertThat(path.getLdapRdn(1).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(1).getComponent().getValue()).isEqualTo("foo,"); assertThat(path.getLdapRdn(0).getComponent().getKey()).isEqualTo("ou"); assertThat(path.getLdapRdn(0).getComponent().getValue()).isEqualTo("bar,"); }