@Test public void testRemoveFirstNoMatch() throws InvalidNameException { LdapName ldapName = new LdapName(EXPECTED_DN_STRING); LdapName result = LdapUtils.removeFirst(ldapName, new LdapName("OU=oooooo,OU=M")); assertThat(result).isNotSameAs(ldapName); assertThat(result).isEqualTo(ldapName); }
public static LdapName removeFirst(Name dn, Name pathToRemove) { Assert.notNull(dn, "dn must not be null"); Assert.notNull(pathToRemove, "pathToRemove must not be null"); LdapName result = newLdapName(dn); LdapName path = returnOrConstructLdapNameFromName(pathToRemove); if(path.size() == 0 || !dn.startsWith(path)) { return result; } for(int i = 0; i < path.size(); i++) { try { result.remove(0); } catch (InvalidNameException e) { throw convertLdapException(e); } } return result; }
LdapUtils { public static LdapName removeFirst(Name dn, Name pathToRemove) { Assert.notNull(dn, "dn must not be null"); Assert.notNull(pathToRemove, "pathToRemove must not be null"); LdapName result = newLdapName(dn); LdapName path = returnOrConstructLdapNameFromName(pathToRemove); if(path.size() == 0 || !dn.startsWith(path)) { return result; } for(int i = 0; i < path.size(); i++) { try { result.remove(0); } catch (InvalidNameException e) { throw convertLdapException(e); } } return result; } }
LdapUtils { public static LdapName removeFirst(Name dn, Name pathToRemove) { Assert.notNull(dn, "dn must not be null"); Assert.notNull(pathToRemove, "pathToRemove must not be null"); LdapName result = newLdapName(dn); LdapName path = returnOrConstructLdapNameFromName(pathToRemove); if(path.size() == 0 || !dn.startsWith(path)) { return result; } for(int i = 0; i < path.size(); i++) { try { result.remove(0); } catch (InvalidNameException e) { throw convertLdapException(e); } } return result; } private  LdapUtils(); }
LdapUtils { public static LdapName removeFirst(Name dn, Name pathToRemove) { Assert.notNull(dn, "dn must not be null"); Assert.notNull(pathToRemove, "pathToRemove must not be null"); LdapName result = newLdapName(dn); LdapName path = returnOrConstructLdapNameFromName(pathToRemove); if(path.size() == 0 || !dn.startsWith(path)) { return result; } for(int i = 0; i < path.size(); i++) { try { result.remove(0); } catch (InvalidNameException e) { throw convertLdapException(e); } } return result; } private  LdapUtils(); static void closeContext(DirContext context); static NamingException convertLdapException(javax.naming.NamingException ex); static Class getActualTargetClass(DirContext context); static void collectAttributeValues(Attributes attributes, String name, Collection<Object> collection); static void collectAttributeValues(
            Attributes attributes, String name, Collection<T> collection, Class<T> clazz); static void iterateAttributeValues(Attribute attribute, AttributeValueCallbackHandler callbackHandler); static String convertCompositeNameToString(
			CompositeName compositeName); static LdapName newLdapName(Name name); static LdapName newLdapName(String distinguishedName); static LdapName removeFirst(Name dn, Name pathToRemove); static LdapName prepend(Name dn, Name pathToPrepend); static LdapName emptyLdapName(); static Rdn getRdn(Name name, String key); static Object getValue(Name name, String key); static Object getValue(Name name, int index); static String getStringValue(Name name, int index); static String getStringValue(Name name, String key); static String convertBinarySidToString(byte[] sid); static byte[] convertStringSidToBinary(String string); }
LdapUtils { public static LdapName removeFirst(Name dn, Name pathToRemove) { Assert.notNull(dn, "dn must not be null"); Assert.notNull(pathToRemove, "pathToRemove must not be null"); LdapName result = newLdapName(dn); LdapName path = returnOrConstructLdapNameFromName(pathToRemove); if(path.size() == 0 || !dn.startsWith(path)) { return result; } for(int i = 0; i < path.size(); i++) { try { result.remove(0); } catch (InvalidNameException e) { throw convertLdapException(e); } } return result; } private  LdapUtils(); static void closeContext(DirContext context); static NamingException convertLdapException(javax.naming.NamingException ex); static Class getActualTargetClass(DirContext context); static void collectAttributeValues(Attributes attributes, String name, Collection<Object> collection); static void collectAttributeValues(
            Attributes attributes, String name, Collection<T> collection, Class<T> clazz); static void iterateAttributeValues(Attribute attribute, AttributeValueCallbackHandler callbackHandler); static String convertCompositeNameToString(
			CompositeName compositeName); static LdapName newLdapName(Name name); static LdapName newLdapName(String distinguishedName); static LdapName removeFirst(Name dn, Name pathToRemove); static LdapName prepend(Name dn, Name pathToPrepend); static LdapName emptyLdapName(); static Rdn getRdn(Name name, String key); static Object getValue(Name name, String key); static Object getValue(Name name, int index); static String getStringValue(Name name, int index); static String getStringValue(Name name, String key); static String convertBinarySidToString(byte[] sid); static byte[] convertStringSidToBinary(String string);  }