/** * {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DirContextAdapter that = (DirContextAdapter) o; if (updateMode != that.updateMode) return false; if (base != null ? !base.equals(that.base) : that.base != null) return false; if (dn != null ? !dn.equals(that.dn) : that.dn != null) return false; if (originalAttrs != null ? !originalAttrs.equals(that.originalAttrs) : that.originalAttrs != null) return false; if (referralUrl != null ? !referralUrl.equals(that.referralUrl) : that.referralUrl != null) return false; if (updatedAttrs != null ? !updatedAttrs.equals(that.updatedAttrs) : that.updatedAttrs != null) return false; return true; }
/** * {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DirContextAdapter that = (DirContextAdapter) o; if (updateMode != that.updateMode) return false; if (base != null ? !base.equals(that.base) : that.base != null) return false; if (dn != null ? !dn.equals(that.dn) : that.dn != null) return false; if (originalAttrs != null ? !originalAttrs.equals(that.originalAttrs) : that.originalAttrs != null) return false; if (referralUrl != null ? !referralUrl.equals(that.referralUrl) : that.referralUrl != null) return false; if (updatedAttrs != null ? !updatedAttrs.equals(that.updatedAttrs) : that.updatedAttrs != null) return false; return true; }
/** * {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DirContextAdapter that = (DirContextAdapter) o; if (updateMode != that.updateMode) return false; if (base != null ? !base.equals(that.base) : that.base != null) return false; if (dn != null ? !dn.equals(that.dn) : that.dn != null) return false; if (originalAttrs != null ? !originalAttrs.equals(that.originalAttrs) : that.originalAttrs != null) return false; if (referralUrl != null ? !referralUrl.equals(that.referralUrl) : that.referralUrl != null) return false; if (updatedAttrs != null ? !updatedAttrs.equals(that.updatedAttrs) : that.updatedAttrs != null) return false; return true; }
/** * {@inheritDoc} */ @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; DirContextAdapter that = (DirContextAdapter) o; if (updateMode != that.updateMode) return false; if (base != null ? !base.equals(that.base) : that.base != null) return false; if (dn != null ? !dn.equals(that.dn) : that.dn != null) return false; if (originalAttrs != null ? !originalAttrs.equals(that.originalAttrs) : that.originalAttrs != null) return false; if (referralUrl != null ? !referralUrl.equals(that.referralUrl) : that.referralUrl != null) return false; if (updatedAttrs != null ? !updatedAttrs.equals(that.updatedAttrs) : that.updatedAttrs != null) return false; return true; }
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(contextSource, "ContextSource must be specified"); Assert.notNull(resource, "Resource must be specified"); if(!LdapUtils.newLdapName(base).equals(LdapUtils.newLdapName(defaultBase))) { List<String> lines = IOUtils.readLines(resource.getInputStream()); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); for (String line : lines) { writer.println(StringUtils.replace(line, defaultBase, base)); } writer.flush(); resource = new ByteArrayResource(sw.toString().getBytes("UTF8")); } if(clean) { LdapTestUtils.clearSubContexts(contextSource, LdapUtils.emptyLdapName()); } LdapTestUtils.loadLdif(contextSource, resource); } }
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(contextSource, "ContextSource must be specified"); Assert.notNull(resource, "Resource must be specified"); if(!LdapUtils.newLdapName(base).equals(LdapUtils.newLdapName(defaultBase))) { List<String> lines = IOUtils.readLines(resource.getInputStream()); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); for (String line : lines) { writer.println(StringUtils.replace(line, defaultBase, base)); } writer.flush(); resource = new ByteArrayResource(sw.toString().getBytes("UTF8")); } if(clean) { LdapTestUtils.clearSubContexts(contextSource, LdapUtils.emptyLdapName()); } LdapTestUtils.loadLdif(contextSource, resource); } }
@Override public void afterPropertiesSet() throws Exception { Assert.notNull(contextSource, "ContextSource must be specified"); Assert.notNull(resource, "Resource must be specified"); if(!LdapUtils.newLdapName(base).equals(LdapUtils.newLdapName(defaultBase))) { List<String> lines = IOUtils.readLines(resource.getInputStream()); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); for (String line : lines) { writer.println(StringUtils.replace(line, defaultBase, base)); } writer.flush(); resource = new ByteArrayResource(sw.toString().getBytes("UTF8")); } if(clean) { LdapTestUtils.clearSubContexts(contextSource, LdapUtils.emptyLdapName()); } LdapTestUtils.loadLdif(contextSource, resource); } }
if(normalizedDn.equals(toLdapName((String) value)))
@Override public boolean match(String a, String b) throws SchemaException { if (StringUtils.isBlank(a) && StringUtils.isBlank(b)) { return true; } if (StringUtils.isBlank(a) || StringUtils.isBlank(b)) { return false; } LdapName dnA; try { dnA = new LdapName(a); } catch (InvalidNameException e) { throw new SchemaException("String '"+a+"' is not a DN: "+e.getMessage(), e); } LdapName dnB; try { dnB = new LdapName(b); } catch (InvalidNameException e) { throw new SchemaException("String '"+b+"' is not a DN: "+e.getMessage(), e); } return dnA.equals(dnB); }
attrValue = memberAttributeValuePrefix + attrValue + memberAttributeValueSuffix; if (userLdapDn.equals(new LdapName(attrValue))) { groupNames.add(groupName); String roleName = roleNameFor(groupName);
attrValue = memberAttributeValuePrefix + attrValue + memberAttributeValueSuffix; if (userLdapDn.equals(new LdapName(attrValue))) { groupNames.add(groupName); String roleName = roleNameFor(groupName);
private static void removeEmptyValue(String emptyValue, Attribute attr) { try { // we must compare parsed LdapName objects rather then strings here if (emptyValue != null && attr != null) { LdapName emptyDn = new LdapName(emptyValue); for (int i = 0; i < attr.size(); i++) { String value = (String) attr.get(i); LdapName dn = new LdapName(value); if (emptyDn.equals(dn)) { attr.remove(i); i--; } } } } catch (NamingException e) { throw new NucleusException(e.getMessage(), e); } }
@Before public void cleanAndSetup() throws NamingException, IOException { Resource ldifResource = getLdifFileResource(); if(!LdapUtils.newLdapName(base).equals(LdapUtils.newLdapName(DEFAULT_BASE))) { List<String> lines = IOUtils.readLines(ldifResource.getInputStream()); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); for (String line : lines) { writer.println(StringUtils.replace(line, DEFAULT_BASE, base)); } writer.flush(); ldifResource = new ByteArrayResource(sw.toString().getBytes("UTF8")); } LdapTestUtils.cleanAndSetup(contextSource, getRoot(), ldifResource); }
if (dn.equals(base))
if (newDn != null && !oldDn.equals(newDn))
if (locationInfo.dn == null || !locationInfo.dn.equals(parentDn))