@Test public void testEndsWith_false() { DistinguishedName path1 = new DistinguishedName("uid=mtah.test, ou=people, ou=EU, o=example.com"); DistinguishedName ending1 = new DistinguishedName("ou=people"); DistinguishedName path2 = new DistinguishedName("uid=mtah.test, ou=people, ou=EU, o=example.com"); DistinguishedName ending2 = new DistinguishedName("ou=EU, o=example.com"); assertThat(path1.endsWith(ending1)).isFalse(); assertThat(path2.endsWith(ending2)).isFalse(); }
public boolean endsWith(Name name) { DistinguishedName path = null; if (name instanceof DistinguishedName) { path = (DistinguishedName) name; } else { return false; } List shortlist = path.getNames(); if (getNames().size() < shortlist.size()) { return false; } if (shortlist.size() == 0) { return false; } ListIterator longiter = getNames().listIterator(getNames().size()); ListIterator shortiter = shortlist.listIterator(shortlist.size()); while (shortiter.hasPrevious()) { LdapRdn longname = (LdapRdn) longiter.previous(); LdapRdn shortname = (LdapRdn) shortiter.previous(); if (!longname.equals(shortname)) return false; } return true; }
DistinguishedName implements Name { public boolean endsWith(Name name) { DistinguishedName path = null; if (name instanceof DistinguishedName) { path = (DistinguishedName) name; } else { return false; } List shortlist = path.getNames(); if (getNames().size() < shortlist.size()) { return false; } if (shortlist.size() == 0) { return false; } ListIterator longiter = getNames().listIterator(getNames().size()); ListIterator shortiter = shortlist.listIterator(shortlist.size()); while (shortiter.hasPrevious()) { LdapRdn longname = (LdapRdn) longiter.previous(); LdapRdn shortname = (LdapRdn) shortiter.previous(); if (!longname.equals(shortname)) return false; } return true; } }
DistinguishedName implements Name { public boolean endsWith(Name name) { DistinguishedName path = null; if (name instanceof DistinguishedName) { path = (DistinguishedName) name; } else { return false; } List shortlist = path.getNames(); if (getNames().size() < shortlist.size()) { return false; } if (shortlist.size() == 0) { return false; } ListIterator longiter = getNames().listIterator(getNames().size()); ListIterator shortiter = shortlist.listIterator(shortlist.size()); while (shortiter.hasPrevious()) { LdapRdn longname = (LdapRdn) longiter.previous(); LdapRdn shortname = (LdapRdn) shortiter.previous(); if (!longname.equals(shortname)) return false; } return true; } DistinguishedName();  DistinguishedName(String path);  DistinguishedName(List list);  DistinguishedName(Name name); }
DistinguishedName implements Name { public boolean endsWith(Name name) { DistinguishedName path = null; if (name instanceof DistinguishedName) { path = (DistinguishedName) name; } else { return false; } List shortlist = path.getNames(); if (getNames().size() < shortlist.size()) { return false; } if (shortlist.size() == 0) { return false; } ListIterator longiter = getNames().listIterator(getNames().size()); ListIterator shortiter = shortlist.listIterator(shortlist.size()); while (shortiter.hasPrevious()) { LdapRdn longname = (LdapRdn) longiter.previous(); LdapRdn shortname = (LdapRdn) shortiter.previous(); if (!longname.equals(shortname)) return false; } return true; } 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); }
DistinguishedName implements Name { public boolean endsWith(Name name) { DistinguishedName path = null; if (name instanceof DistinguishedName) { path = (DistinguishedName) name; } else { return false; } List shortlist = path.getNames(); if (getNames().size() < shortlist.size()) { return false; } if (shortlist.size() == 0) { return false; } ListIterator longiter = getNames().listIterator(getNames().size()); ListIterator shortiter = shortlist.listIterator(shortlist.size()); while (shortiter.hasPrevious()) { LdapRdn longname = (LdapRdn) longiter.previous(); LdapRdn shortname = (LdapRdn) shortiter.previous(); if (!longname.equals(shortname)) return false; } return true; } 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; }