Align server types API with SDK types API
Align DN class : change method names
* getRDN() => rdn()
* getNumComponents => size()
* isNullDN() => isRootDN()
* getParent() => parent()
* concat(RDN rdn) => child(RDN rdn)
* concat(DN rdn) => child(DN rdn)
* DN.nullDN() => DN.rootDN()
* DN.decode(String dn) => DN.valueOf(String dn)
Add two scripts to automate changes
* replace.rb : replace code using regexes
* copyrigth.rb : update copyright year to 2014 for modified files
2 files added
370 files modified
| New file |
| | |
| | | #!/usr/bin/env ruby |
| | | |
| | | require 'fileutils' |
| | | |
| | | # Automate copyright update with year 2014, using 'svn status' to retrieve modified files. |
| | | # Only modified files (with 'M' mark) are updated. |
| | | # |
| | | class Copyright |
| | | |
| | | def updated_files |
| | | files = [] |
| | | puts "Get modified files from svn..." |
| | | lines = `svn st` |
| | | puts "There are #{lines.split("\n").size} files to update." |
| | | lines.split("\n").each { |line| |
| | | mod, file = line.split(" ") |
| | | if mod=="M" |
| | | files << file |
| | | end |
| | | } |
| | | files |
| | | end |
| | | |
| | | def process(file) |
| | | is_replaced = nil |
| | | File.open(file) { |source| |
| | | content = source.read |
| | | is_replaced = update_copyright(content) |
| | | if is_replaced |
| | | File.open(file + ".copy", "w+") { |f| f.write(content) } |
| | | #puts `head -n 27 #{file}` |
| | | #puts("content:\n" + content.split("\n")[20..27].join("\n")) |
| | | else |
| | | puts "WARN : no replacement" |
| | | end |
| | | } |
| | | if is_replaced |
| | | FileUtils.mv(file + ".copy", file, :verbose => false) |
| | | end |
| | | end |
| | | |
| | | |
| | | def update_copyright(content) |
| | | pattern = /(^\s+\*\s+)Portions Copyright (\d+)-(\d+) ForgeRock,? AS/i |
| | | replace = '\1Portions Copyright \2-2014 ForgeRock AS' |
| | | is_replaced = content.gsub!(pattern, replace) |
| | | |
| | | if is_replaced.nil? |
| | | pattern = /(^\s+\*\s+)Portions Copyright (\d+) ForgeRock,? AS/i |
| | | mdata = content.match(pattern) |
| | | if !mdata.nil? && mdata[2]!="2014" |
| | | replace = '\1Portions Copyright \2-2014 ForgeRock AS' |
| | | is_replaced = content.gsub!(pattern, replace) |
| | | end |
| | | if is_replaced.nil? |
| | | # No portions line, add it |
| | | pattern = /(^\s+\*)(\s+)Copyright (\d+-?\d*)\s(.*)$\n\s+\*\/$/i |
| | | replace = '\1\2Copyright \3 \4' + "\n\\1\\2Portions Copyright 2014 ForgeRock AS\n\\1/" |
| | | is_replaced = content.gsub!(pattern, replace) |
| | | end |
| | | end |
| | | is_replaced |
| | | end |
| | | |
| | | def run(args) |
| | | if args.size==0 |
| | | files = updated_files |
| | | else |
| | | files = argv |
| | | end |
| | | files.each { |file| |
| | | puts "Processing file #{file}" |
| | | process(file) |
| | | } |
| | | end |
| | | |
| | | end |
| | | |
| | | # Launch copyright update |
| | | Copyright.new.run(ARGV) |
| | | |
| New file |
| | |
| | | #!/usr/bin/env ruby |
| | | |
| | | require 'fileutils' |
| | | |
| | | # |
| | | # Automate code replacements using regular expressions |
| | | # |
| | | # To define a new replacement, add a new constant like VALIDATOR. |
| | | # |
| | | # It should be a ruby Hash with three mandatory keys and one optional key: |
| | | # |
| | | # :dirs => a list of directory to run replacements. All subdirs are processed. |
| | | # :extensions => a list of file extensions. Only file with these extensions are processed. |
| | | # :replacements => a list of replacements, lines are processed 2 by 2 |
| | | # - first line gives the pattern to replace, as a ruby regexp (see http://rubular.com/ for help and tool) |
| | | # - second line gives the replacement string, using \1, \2, ... to insert matching groups. This is a string, |
| | | # use simple quote if no special char is inserted, or use double quote if using special char like \n |
| | | # Don't forget to put a comma at end of each line, this is the array element separator. |
| | | # It is ok to leave a new line to separate each pair of line for readability. |
| | | # It is ok to use a comment in the array (use # as first non blank character of line). |
| | | # |
| | | # The optional key is :stopwords => a list of stopword. If any word in this list appears in a file name, the file |
| | | # is not processed. Use it to exclude some files or directory that must not be processed. |
| | | # |
| | | # Once you have define your replacement, add the constant in REPLACEMENTS array. it will be taken into account when |
| | | # running the program (run it at root of project) with command: ./replace.rb |
| | | # |
| | | class Replace |
| | | |
| | | # All directories that contains java code |
| | | JAVA_DIRS = ["src/server", "src/quicksetup", "src/ads", "src/guitools", "tests/unit-tests-testng/src"] |
| | | |
| | | # Replacement for Validator |
| | | # Modify 88 files, for a total of 227 replacements - leaves 21 compilation errors |
| | | VALIDATOR = { |
| | | :dirs => JAVA_DIRS, |
| | | :extensions => ["java"], |
| | | :replacements => |
| | | [ |
| | | /import org.opends.server.util.\*;/, |
| | | "import org.opends.server.util.*;\nimport org.forgerock.util.Reject;", |
| | | |
| | | /import static org.opends.server.util.Validator.ensureNotNull;/, |
| | | 'import static org.forgerock.util.Reject.ifNull;', |
| | | |
| | | /import static org.opends.server.util.Validator.ensureTrue;/, |
| | | 'import static org.forgerock.util.Reject.ifFalse;', |
| | | |
| | | /import static org.opends.server.util.Validator.\*;/, |
| | | 'import static org.forgerock.util.Reject.*;', |
| | | |
| | | /import org.opends.server.util.Validator;/, |
| | | 'import org.forgerock.util.Reject;', |
| | | |
| | | /(Validator\.| )ensureNotNull\((.*)$/, |
| | | '\1ifNull(\2', |
| | | |
| | | /(Validator\.| )ensureTrue\((.*)$/, |
| | | '\1ifFalse(\2', |
| | | |
| | | / Validator\./, |
| | | ' Reject.' |
| | | ] |
| | | } |
| | | |
| | | # Replacement for messages |
| | | # Modify 1052 files, for a total of 2366 replacements - leaves 10274 compilation errors mostly due to generated messages |
| | | MESSAGES = { |
| | | :dirs => JAVA_DIRS, |
| | | :extensions => ["java"], |
| | | :replacements => |
| | | [ |
| | | /import org.opends.messages.Message;/, |
| | | 'import org.forgerock.i18n.LocalizableMessage;', |
| | | |
| | | /([ <(])Message([ >)(.]|$)/, |
| | | '\1LocalizableMessage\2', |
| | | |
| | | /import org.opends.messages.MessageBuilder;/, |
| | | 'import org.forgerock.i18n.LocalizableMessageBuilder;', |
| | | |
| | | /([ <(])MessageBuilder([ >)(.]|$)/, |
| | | '\1LocalizableMessageBuilder\2' |
| | | ] |
| | | } |
| | | |
| | | # Replacement for types |
| | | # Modify 688 files, for a total of 783 replacements - leaves 7605 compilation errors |
| | | TYPES = { |
| | | :dirs => JAVA_DIRS, |
| | | :extensions => ["java"], |
| | | :replacements => |
| | | [ |
| | | /import org.opends.server.types.(DN|RDN|Attribute|ByteString|Entry|ResultCode);/, |
| | | 'import org.forgerock.opendj.ldap.\1;', |
| | | |
| | | /import org.opends.server.(types|api).(AttributeType|MatchingRule);/, |
| | | 'import org.forgerock.opendj.ldap.schema.\2;', |
| | | |
| | | ] |
| | | } |
| | | |
| | | # Replacement for exceptions |
| | | # Modify 36 files, for a total of 134 replacements - leaves 1277 compilation errors but mostly from generated config |
| | | EXCEPTIONS = { |
| | | :dirs => JAVA_DIRS, |
| | | :extensions => ["java"], |
| | | :replacements => |
| | | [ |
| | | /import org.opends.server.admin.client.AuthorizationException;/, |
| | | 'import org.forgerock.opendj.ldap.ErrorResultException;', |
| | | |
| | | /\bAuthorizationException\b/, |
| | | 'ErrorResultException', |
| | | |
| | | /import org.opends.server.admin.client.CommunicationException;\n/, |
| | | '', |
| | | |
| | | /throws CommunicationException\b, /, |
| | | 'throws ', |
| | | |
| | | /, CommunicationException\b(, )?/, |
| | | '\1', |
| | | |
| | | /\bCommunicationException\b/, |
| | | 'ErrorResultException', |
| | | ] |
| | | } |
| | | |
| | | # Replacement for loggers |
| | | # Modify 454 files, for a total of 2427 replacements - leaves 72 compilation errors |
| | | # TODO: add I18N loggers |
| | | LOGGERS = { |
| | | :dirs => JAVA_DIRS, |
| | | :stopwords => ['src/server/org/opends/server/loggers', 'DebugLogPublisher'], |
| | | :extensions => ["java"], |
| | | :replacements => |
| | | [ |
| | | /import org.opends.server.loggers.debug.DebugTracer;/, |
| | | "import org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;", |
| | | |
| | | /import java.util.logging.Logger;/, |
| | | "import org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;", |
| | | |
| | | /import java.util.logging.Level;\n/, |
| | | '', |
| | | |
| | | /import org.opends.server.types.DebugLogLevel;\n/, |
| | | '', |
| | | |
| | | /import (static )?org.opends.server.loggers.debug.DebugLogger.*;\n/, |
| | | '', |
| | | |
| | | /DebugTracer TRACER = (DebugLogger.)?getTracer\(\)/, |
| | | "Logger debugLogger = LoggerFactory.getLogger({CLASSNAME}.class)", |
| | | |
| | | /^\s*\/\*\*\n.*The tracer object for the debug logger.\n\s*\*\/$\n/, |
| | | '', |
| | | |
| | | /^\s*\/\/\s*The tracer object for the debug logger.$\n/, |
| | | '', |
| | | |
| | | /if \(debugEnabled\(\)\)\s*{\s* TRACER.debugCaught\(DebugLogLevel.ERROR, (\b.*\b)\);\s*\n\s*}$/, |
| | | 'debugLogger.trace("Error", \1);', |
| | | |
| | | /TRACER\.debugCaught\(DebugLogLevel.ERROR, (\b.*\b)\);/, |
| | | 'debugLogger.trace("Error", \1);', |
| | | |
| | | /TRACER.debug[^(]+\(/, |
| | | 'debugLogger.trace(', |
| | | |
| | | /debugLogger.trace\(DebugLogLevel.\b\w+\b, ?/, |
| | | 'debugLogger.trace(', |
| | | |
| | | /debugLogger.trace\(e\)/, |
| | | 'debugLogger.trace("Error", e)', |
| | | |
| | | /(DebugLogger\.|\b)debugEnabled\(\)/, |
| | | 'debugLogger.isTraceEnabled()', |
| | | |
| | | /(LOG|logger).log\((Level.)?WARNING, ?/, |
| | | '\1.warn(', |
| | | |
| | | /(LOG|logger).log\((Level.)?CONFIG, ?/, |
| | | '\1.info(', |
| | | |
| | | /(LOG|logger).log\((Level.)?INFO, ?/, |
| | | '\1.debug(', |
| | | |
| | | /(LOG|logger).log\((Level.)?SEVERE, ?/, |
| | | '\1.error(', |
| | | |
| | | /(LOG|logger).log\((Level.)?FINE, ?/, |
| | | '\1.trace(', |
| | | |
| | | /Logger.getLogger\((\n\s+)?(\b\w+\b).class.getName\(\)\);/, |
| | | 'LoggerFactory.getLogger(\2.class);', |
| | | ] |
| | | } |
| | | |
| | | I18N_LOGGERS = { |
| | | :dirs => JAVA_DIRS, |
| | | :extensions => ["java"], |
| | | :replacements => |
| | | [ |
| | | # Message message = ERR_REFINT_UNABLE_TO_EVALUATE_TARGET_CONDITION.get(mo |
| | | # .getManagedObjectDefinition().getUserFriendlyName(), String |
| | | # .valueOf(mo.getDN()), StaticUtils.getExceptionMessage(e)); |
| | | # ErrorLogger.logError(message); |
| | | /\bMessage\b \b(\w+)\b = (\w+\.)?\b(\w+)\b\s*.\s*get([^;]+);\n(\s+)ErrorLogger.logError\(\1\);/m, |
| | | " Message message = \\2.get\\4;\n" + |
| | | "LocalizedLogger logger = LocalizedLogger.getLocalizedLogger(\\3.resourceName());\n\\5logger.error(\\1);", |
| | | ] |
| | | } |
| | | |
| | | # List of replacements to run |
| | | REPLACEMENTS = [ I18N_LOGGERS ] |
| | | #REPLACEMENTS = [ VALIDATOR, MESSAGES, TYPES, EXCEPTIONS, LOGGERS ] |
| | | |
| | | # Run replacements |
| | | def run |
| | | REPLACEMENTS.each { |repl| |
| | | puts "Replacing " + Replace.constants.find{ |name| Replace.const_get(name)==repl }.to_s |
| | | stopwords = repl[:stopwords] || ["--nostopword--"] |
| | | replace_dirs(repl[:replacements], repl[:dirs], stopwords, repl[:extensions]) |
| | | } |
| | | end |
| | | |
| | | def replace_dirs(replacements, dirs, stopwords, extensions) |
| | | count_files = 0 |
| | | count_total = 0 |
| | | dirs.each { |directory| |
| | | files = files_under_directory(directory, extensions) |
| | | files.each { |file| |
| | | exclude_file = stopwords.any? { |stopword| file.include?(stopword) } |
| | | next if exclude_file |
| | | count = replace_file(file, replacements) |
| | | if count > 0 |
| | | count_files += 1 |
| | | count_total += count |
| | | end |
| | | } |
| | | } |
| | | puts "Replaced in #{count_files} files, for a total of #{count_total} replacements" |
| | | end |
| | | |
| | | def replace_file(file, replacements) |
| | | count = 0 |
| | | File.open(file) { |source| |
| | | contents = source.read |
| | | (0..replacements.size-1).step(2).each { |index| |
| | | pattern, replace = replacements[index], replacements[index+1] |
| | | replace = replace.gsub('{CLASSNAME}', classname(file)) |
| | | is_replaced = contents.gsub!(pattern, replace) |
| | | if is_replaced then count += 1 end |
| | | } |
| | | File.open(file + ".copy", "w+") { |f| f.write(contents) } |
| | | } |
| | | FileUtils.mv(file + ".copy", file, :verbose => false) |
| | | count |
| | | end |
| | | |
| | | def classname(file) |
| | | name = file.gsub(/.*\/(.*).java$/, '\1') |
| | | if name.nil? then '' else name end |
| | | end |
| | | |
| | | def files_under_directory(directory, extensions) |
| | | Dir[directory + '/**/*.{' + extensions.join(",") + '}'] |
| | | end |
| | | |
| | | end |
| | | |
| | | # Launch replacement |
| | | Replace.new.run |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | |
| | | if (suffixes != null) |
| | | { |
| | | if (suffixes.remove( |
| | | DN.decode(ADSContext.getAdministrationSuffixDN()))) |
| | | DN.valueOf(ADSContext.getAdministrationSuffixDN()))) |
| | | { |
| | | if (suffixes.size() > 0) |
| | | { |
| | |
| | | { |
| | | suffixes = new TreeSet<DN>(); |
| | | } |
| | | DN newDN = DN.decode(ADSContext.getAdministrationSuffixDN()); |
| | | DN newDN = DN.valueOf(ADSContext.getAdministrationSuffixDN()); |
| | | if (!suffixes.contains(newDN)) |
| | | { |
| | | suffixes.add(newDN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.browser; |
| | |
| | | int parentComponents; |
| | | try |
| | | { |
| | | DN dn = DN.decode(parentDn); |
| | | parentComponents = dn.getNumComponents(); |
| | | DN dn = DN.valueOf(parentDn); |
| | | parentComponents = dn.size(); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | DN dn = null; |
| | | try |
| | | { |
| | | dn = DN.decode(name); |
| | | add = dn.getNumComponents() == parentComponents + 1; |
| | | dn = DN.valueOf(name); |
| | | add = dn.size() == parentComponents + 1; |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | // if it is the case, do not add the parent. If is not the case, |
| | | // search for the parent and add it. |
| | | RDN[] rdns = new RDN[parentComponents + 1]; |
| | | int diff = dn.getNumComponents() - rdns.length; |
| | | int diff = dn.size() - rdns.length; |
| | | for (int i=0; i < rdns.length; i++) |
| | | { |
| | | rdns[i] = dn.getRDN(i + diff); |
| | |
| | | { |
| | | try |
| | | { |
| | | DN addedDN = DN.decode(addedEntry.getName()); |
| | | DN addedDN = DN.valueOf(addedEntry.getName()); |
| | | if (addedDN.equals(parentToAddDN)) |
| | | { |
| | | mustAddParent = false; |
| | |
| | | BasicNode node = (BasicNode)getNode().getChildAt(i); |
| | | try |
| | | { |
| | | DN dn = DN.decode(node.getDN()); |
| | | DN dn = DN.valueOf(node.getDN()); |
| | | if (dn.equals(parentToAddDN)) |
| | | { |
| | | resultValue[0] = false; |
| | |
| | | boolean checkSucceeded = true; |
| | | try |
| | | { |
| | | DN dn1 = DN.decode(getNode().getDN()); |
| | | DN dn1 = DN.valueOf(getNode().getDN()); |
| | | DN dn2 = url.getBaseDN(); |
| | | if (dn2.isAncestorOf(dn1)) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | */ |
| | | public Entry getEntry() throws OpenDsException |
| | | { |
| | | DN dn = DN.decode(this.getDN()); |
| | | DN dn = DN.valueOf(this.getDN()); |
| | | Map<ObjectClass,String> objectClasses = new HashMap<ObjectClass,String>(); |
| | | Map<AttributeType,List<org.opends.server.types.Attribute>> userAttributes = |
| | | new HashMap<AttributeType,List<org.opends.server.types.Attribute>>(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | |
| | | String dn = Utilities.getRDNString("ds-cfg-backend-id", backendName)+ |
| | | ",cn=Backends,cn=config"; |
| | | ConfigEntry configEntry = |
| | | DirectoryServer.getConfigHandler().getConfigEntry(DN.decode(dn)); |
| | | DirectoryServer.getConfigHandler().getConfigEntry(DN.valueOf(dn)); |
| | | |
| | | DNConfigAttribute baseDNAttr = |
| | | new DNConfigAttribute( |
| | |
| | | { |
| | | String dn = getDN(backend); |
| | | Utilities.deleteConfigSubtree( |
| | | DirectoryServer.getConfigHandler(), DN.decode(dn)); |
| | | DirectoryServer.getConfigHandler(), DN.valueOf(dn)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | try |
| | | { |
| | | DN dn = DN.decode(node.getDN()); |
| | | DN dn = DN.valueOf(node.getDN()); |
| | | entries.add(dn); |
| | | } |
| | | catch (DirectoryException de) |
| | |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | try |
| | | { |
| | | DN dn = DN.decode(node.getDN()); |
| | | DN dn = DN.valueOf(node.getDN()); |
| | | boolean isDnDeleted = false; |
| | | for (DN deletedDn : alreadyDeleted) |
| | | { |
| | |
| | | { |
| | | CustomSearchResult res = |
| | | new CustomSearchResult(sr, dnToRemove.toString()); |
| | | entryDNFound = DN.decode(res.getDN()); |
| | | entryDNFound = DN.valueOf(res.getDN()); |
| | | deleteSubtreeRecursively(ctx, entryDNFound, null, toNotify); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | |
| | | String dn = Utilities.getRDNString("ds-cfg-name", index.getName())+ |
| | | ",cn=VLV Index,"+Utilities.getRDNString("ds-cfg-backend-id", |
| | | index.getBackend().getBackendID())+",cn=Backends,cn=config"; |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.decode(dn), null); |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.valueOf(dn), null); |
| | | } |
| | | else |
| | | { |
| | | String dn = Utilities.getRDNString("ds-cfg-attribute", index.getName())+ |
| | | ",cn=Index,"+Utilities.getRDNString("ds-cfg-backend-id", |
| | | index.getBackend().getBackendID())+",cn=Backends,cn=config"; |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.decode(dn), null); |
| | | DirectoryServer.getConfigHandler().deleteEntry(DN.valueOf(dn), null); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | { |
| | | try |
| | | { |
| | | theDN = DN.decode(baseDN); |
| | | theDN = DN.valueOf(baseDN); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | DN newDn = newEntry.getDN(); |
| | | try |
| | | { |
| | | oldDn = DN.decode(oldEntry.getDN()); |
| | | oldDn = DN.valueOf(oldEntry.getDN()); |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | |
| | | final ArrayList<ModificationItem> originalMods) |
| | | throws CannotRenameException, NamingException |
| | | { |
| | | RDN oldRDN = oldDN.getRDN(); |
| | | RDN newRDN = newEntry.getDN().getRDN(); |
| | | RDN oldRDN = oldDN.rdn(); |
| | | RDN newRDN = newEntry.getDN().rdn(); |
| | | |
| | | boolean rdnTypeChanged = |
| | | newRDN.getNumValues() != oldRDN.getNumValues(); |
| | |
| | | |
| | | boolean isAttributeInNewRdn = false; |
| | | AttributeValue rdnValue = null; |
| | | RDN rdn = newEntry.getDN().getRDN(); |
| | | RDN rdn = newEntry.getDN().rdn(); |
| | | for (int i=0; i<rdn.getNumValues() && !isAttributeInNewRdn; i++) |
| | | { |
| | | isAttributeInNewRdn = |
| | |
| | | RDN oldRDN = null; |
| | | try |
| | | { |
| | | oldRDN = DN.decode(oldEntry.getDN()).getRDN(); |
| | | oldRDN = DN.valueOf(oldEntry.getDN()).rdn(); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | boolean isReallyParentNode = false; |
| | | try |
| | | { |
| | | DN parentDN = DN.decode(parentNode.getDN()); |
| | | DN parentDN = DN.valueOf(parentNode.getDN()); |
| | | isReallyParentNode = |
| | | parentDN.equals(newEntry.getDN().getParent()); |
| | | parentDN.equals(newEntry.getDN().parent()); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | (BasicNode)controller.getTreeModel().getChild(root, i); |
| | | try |
| | | { |
| | | DN nodeDN = DN.decode(node.getDN()); |
| | | DN nodeDN = DN.valueOf(node.getDN()); |
| | | if (dn.isDescendantOf(nodeDN)) |
| | | { |
| | | if (dn.getNumComponents() == nodeDN.getNumComponents() + 1) |
| | | if (dn.size() == nodeDN.size() + 1) |
| | | { |
| | | parentNode = node; |
| | | break; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | this.newPassword = pwd; |
| | | try |
| | | { |
| | | dn = DN.decode(node.getDN()); |
| | | dn = DN.valueOf(node.getDN()); |
| | | for (BackendDescriptor backend : info.getServerDescriptor().getBackends()) |
| | | { |
| | | for (BaseDNDescriptor baseDN : backend.getBaseDns()) |
| | |
| | | private boolean isBoundAs(DN dn, InitialLdapContext ctx) |
| | | { |
| | | boolean isBoundAs = false; |
| | | DN bindDN = DN.nullDN(); |
| | | DN bindDN = DN.rootDN(); |
| | | try |
| | | { |
| | | String b = ConnectionUtils.getBindDN(ctx); |
| | | bindDN = DN.decode(b); |
| | | bindDN = DN.valueOf(b); |
| | | isBoundAs = dn.equals(bindDN); |
| | | } |
| | | catch (Throwable t) |
| | |
| | | Set<String> dns = ConnectionUtils.getValues(sr, attrName); |
| | | for (String sDn : dns) |
| | | { |
| | | if (bindDN.equals(DN.decode(sDn))) |
| | | if (bindDN.equals(DN.valueOf(sDn))) |
| | | { |
| | | isBoundAs = true; |
| | | break; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | sb.append("dn: "+oldDN); |
| | | sb.append("<br>"); |
| | | sb.append("changetype: moddn<br>"); |
| | | sb.append("newrdn: "+newDN.getRDN()+"<br>"); |
| | | sb.append("newrdn: "+newDN.rdn()+"<br>"); |
| | | sb.append("deleteoldrdn: 1"); |
| | | sb.append("</b><br><br>"); |
| | | getProgressDialog().appendProgressHtml( |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | |
| | | try |
| | | { |
| | | DN dn = DN.decode(newBaseDn); |
| | | DN dn = DN.valueOf(newBaseDn); |
| | | newElement = new CategorizedComboBoxElement( |
| | | Utilities.unescapeUtf8(dn.toString()), |
| | | CategorizedComboBoxElement.Type.REGULAR); |
| | |
| | | { |
| | | try |
| | | { |
| | | theDN = DN.decode(s); |
| | | theDN = DN.valueOf(s); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | try |
| | | { |
| | | return theDN.equals( |
| | | DN.decode(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT)); |
| | | DN.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT)); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | theDN = DN.decode(s); |
| | | theDN = DN.valueOf(s); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | theDN = DN.decode(s); |
| | | theDN = DN.valueOf(s); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | DN.decode(baseDN); |
| | | DN.valueOf(baseDN); |
| | | } |
| | | catch (OpenDsException oe) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | try |
| | | { |
| | | DN.decode(groupDn); |
| | | DN.valueOf(groupDn); |
| | | if (!entryExists(groupDn)) |
| | | { |
| | | errors.add( |
| | |
| | | groupDn = groupDn.trim(); |
| | | if (groupDn.length() > 0) |
| | | { |
| | | groupDns.add(DN.decode(groupDn)); |
| | | groupDns.add(DN.valueOf(groupDn)); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | try |
| | | { |
| | | DN.decode(dn.getText()); |
| | | DN.valueOf(dn.getText()); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | BasicNode node = (BasicNode)path.getLastPathComponent(); |
| | | try |
| | | { |
| | | dns.add(DN.decode(node.getDN())); |
| | | dns.add(DN.valueOf(node.getDN())); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | String aRdn; |
| | | try |
| | | { |
| | | DN nodeDN = DN.decode(node.getDN()); |
| | | if (nodeDN.isNullDN()) |
| | | DN nodeDN = DN.valueOf(node.getDN()); |
| | | if (nodeDN.isRootDN()) |
| | | { |
| | | aParentDN = nodeDN; |
| | | aRdn = "(1)"; |
| | | } |
| | | else |
| | | { |
| | | aParentDN = nodeDN.getParent(); |
| | | aRdn = nodeDN.getRDN().getAttributeValue(0).toString()+"-1"; |
| | | aParentDN = nodeDN.parent(); |
| | | aRdn = nodeDN.rdn().getAttributeValue(0).toString()+"-1"; |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | |
| | | String newValue = null; |
| | | try |
| | | { |
| | | DN theDN = DN.decode(dn); |
| | | newValue = theDN.getRDN().getAttributeValue(0).toString(); |
| | | DN theDN = DN.valueOf(dn); |
| | | newValue = theDN.rdn().getAttributeValue(0).toString(); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | String oldValue = null; |
| | | try |
| | | { |
| | | DN oldDN = DN.decode(entryToDuplicate.getDN()); |
| | | oldValue = oldDN.getRDN().getAttributeValue(0).toString(); |
| | | DN oldDN = DN.valueOf(entryToDuplicate.getDN()); |
| | | oldValue = oldDN.rdn().getAttributeValue(0).toString(); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | entryToDuplicate = sr; |
| | | try |
| | | { |
| | | DN dn = DN.decode(sr.getDN()); |
| | | rdnAttribute = dn.getRDN().getAttributeType(0).getNameOrOID(); |
| | | DN dn = DN.valueOf(sr.getDN()); |
| | | rdnAttribute = dn.rdn().getAttributeType(0).getNameOrOID(); |
| | | |
| | | updateDNValue(); |
| | | Boolean hasPassword = !sr.getAttributeValues( |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | try |
| | | { |
| | | DN dn = DN.decode(dnArray[i]); |
| | | DN dn = DN.valueOf(dnArray[i]); |
| | | if (dn.isDescendantOf(baseDN.getDn())) |
| | | { |
| | | found = true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | try |
| | | { |
| | | parentReadOnly = new DN[] { |
| | | DN.decode(ConfigConstants.DN_TASK_ROOT), |
| | | DN.decode(ConfigConstants.DN_MONITOR_ROOT), |
| | | DN.decode(ConfigConstants.DN_BACKUP_ROOT), |
| | | DN.decode(Constants.REPLICATION_CHANGES_DN), |
| | | DN.decode(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT) |
| | | DN.valueOf(ConfigConstants.DN_TASK_ROOT), |
| | | DN.valueOf(ConfigConstants.DN_MONITOR_ROOT), |
| | | DN.valueOf(ConfigConstants.DN_BACKUP_ROOT), |
| | | DN.valueOf(Constants.REPLICATION_CHANGES_DN), |
| | | DN.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT) |
| | | }; |
| | | nonDeletable = new DN[] { |
| | | DN.decode(ConfigConstants.DN_CONFIG_ROOT), |
| | | DN.decode(ConfigConstants.DN_DEFAULT_SCHEMA_ROOT), |
| | | DN.decode(ConfigConstants.DN_TRUST_STORE_ROOT) |
| | | DN.valueOf(ConfigConstants.DN_CONFIG_ROOT), |
| | | DN.valueOf(ConfigConstants.DN_DEFAULT_SCHEMA_ROOT), |
| | | DN.valueOf(ConfigConstants.DN_TRUST_STORE_ROOT) |
| | | }; |
| | | } |
| | | catch (Throwable t) |
| | |
| | | boolean isReadOnly = false; |
| | | try |
| | | { |
| | | DN dn = DN.decode(sDn); |
| | | DN dn = DN.valueOf(sDn); |
| | | for (DN parentDN : parentReadOnly) |
| | | { |
| | | if (dn.isDescendantOf(parentDN)) |
| | |
| | | boolean canDelete = true; |
| | | try |
| | | { |
| | | DN dn = DN.decode(sDn); |
| | | DN dn = DN.valueOf(sDn); |
| | | for (DN parentDN : parentReadOnly) |
| | | { |
| | | if (dn.isDescendantOf(parentDN)) |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | */ |
| | | public static Entry getEntry(CustomSearchResult csr) throws OpenDsException |
| | | { |
| | | DN dn = DN.decode(csr.getDN()); |
| | | DN dn = DN.valueOf(csr.getDN()); |
| | | Map<ObjectClass,String> objectClasses = new HashMap<ObjectClass,String>(); |
| | | Map<AttributeType,List<Attribute>> userAttributes = |
| | | new HashMap<AttributeType,List<Attribute>>(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | try |
| | | { |
| | | DN theDN = DN.decode(dn); |
| | | DN theDN = DN.valueOf(dn); |
| | | // Check that the DN is not defined. |
| | | boolean baseDNAlreadyDefined = false; |
| | | for (BackendDescriptor backend : backendObjects) |
| | |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | |
| | | backendName, null); |
| | | backend.setEnabled(true); |
| | | Set<DN> baseDNs = new HashSet<DN>(); |
| | | baseDNs.add(DN.decode(baseDN)); |
| | | baseDNs.add(DN.valueOf(baseDN)); |
| | | backend.setBaseDN(baseDNs); |
| | | backend.setBackendId(backendName); |
| | | backend.setWritabilityMode(BackendCfgDefn.WritabilityMode.ENABLED); |
| | |
| | | break; |
| | | } |
| | | } |
| | | baseDNs.add(DN.decode(baseDN)); |
| | | baseDNs.add(DN.valueOf(baseDN)); |
| | | |
| | | String dn = Utilities.getRDNString("ds-cfg-backend-id", backendName)+ |
| | | ",cn=Backends,cn=config"; |
| | | ConfigEntry configEntry = |
| | | DirectoryServer.getConfigHandler().getConfigEntry(DN.decode(dn)); |
| | | DirectoryServer.getConfigHandler().getConfigEntry(DN.valueOf(dn)); |
| | | |
| | | DNConfigAttribute baseDNAttr = |
| | | new DNConfigAttribute( |
| | |
| | | (LocalDBBackendCfgClient)root.getBackend(backendName); |
| | | |
| | | Set<DN> baseDNs = backend.getBaseDN(); |
| | | DN dn = DN.decode(baseDN); |
| | | DN dn = DN.valueOf(baseDN); |
| | | baseDNs.add(dn); |
| | | backend.setBaseDN(baseDNs); |
| | | backend.commit(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | try |
| | | { |
| | | DN.decode(member); |
| | | DN.valueOf(member); |
| | | if (!entryExists(member)) |
| | | { |
| | | errorFound = true; |
| | |
| | | String ref = referenceGroup.getText().trim(); |
| | | try |
| | | { |
| | | DN.decode(ref); |
| | | DN.valueOf(ref); |
| | | if (!entryExists(ref)) |
| | | { |
| | | errorFound = true; |
| | |
| | | { |
| | | try |
| | | { |
| | | dns.add(DN.decode(member)); |
| | | dns.add(DN.valueOf(member)); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | |
| | | backendName.getText())+",cn=Backends,cn=config"; |
| | | boolean topEntryExists = |
| | | DirectoryServer.getConfigHandler().entryExists( |
| | | DN.decode(topEntryDN)); |
| | | DN.valueOf(topEntryDN)); |
| | | |
| | | if (!topEntryExists) |
| | | { |
| | |
| | | |
| | | index.setFilter(filter.getText().trim()); |
| | | index.setSortOrder(getSortOrderStringValue(getSortOrder())); |
| | | index.setBaseDN(DN.decode(getBaseDN())); |
| | | index.setBaseDN(DN.valueOf(getBaseDN())); |
| | | index.setScope(getScope()); |
| | | index.setMaxBlockSize(Integer.parseInt(maxBlockSize.getText().trim())); |
| | | index.commit(); |
| | |
| | | if (backend.getBackendID().equalsIgnoreCase(backendID)) |
| | | { |
| | | newIndex = new VLVIndexDescriptor( |
| | | indexName, backend, DN.decode(baseDN), |
| | | indexName, backend, DN.valueOf(baseDN), |
| | | scope, filterValue, sortOrder, maxBlock); |
| | | getInfo().registerModifiedIndex(newIndex); |
| | | notifyConfigurationElementCreated(newIndex); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | |
| | | try |
| | | { |
| | | DN.decode(getDisplayedDN()); |
| | | DN.valueOf(getDisplayedDN()); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | StringBuilder sb = new StringBuilder(); |
| | | try |
| | | { |
| | | DN oldDN = DN.decode(searchResult.getDN()); |
| | | if (oldDN.getNumComponents() > 0) |
| | | DN oldDN = DN.valueOf(searchResult.getDN()); |
| | | if (oldDN.size() > 0) |
| | | { |
| | | RDN rdn = oldDN.getRDN(); |
| | | RDN rdn = oldDN.rdn(); |
| | | List<AttributeType> attributeTypes = new ArrayList<AttributeType>(); |
| | | List<String> attributeNames = new ArrayList<String>(); |
| | | List<AttributeValue> attributeValues = new ArrayList<AttributeValue>(); |
| | |
| | | } |
| | | } |
| | | } |
| | | DN parent = oldDN.getParent(); |
| | | DN parent = oldDN.parent(); |
| | | if (attributeTypes.size() > 0) |
| | | { |
| | | DN newDN; |
| | |
| | | } |
| | | else |
| | | { |
| | | newDN = parent.concat(newRDN); |
| | | newDN = parent.child(newRDN); |
| | | } |
| | | sb.append(newDN.toString()); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | StringBuilder sb = new StringBuilder(); |
| | | try |
| | | { |
| | | DN oldDN = DN.decode(searchResult.getDN()); |
| | | if (oldDN.getNumComponents() > 0) |
| | | DN oldDN = DN.valueOf(searchResult.getDN()); |
| | | if (oldDN.size() > 0) |
| | | { |
| | | RDN rdn = oldDN.getRDN(); |
| | | RDN rdn = oldDN.rdn(); |
| | | List<AttributeType> attributeTypes = new ArrayList<AttributeType>(); |
| | | List<String> attributeNames = new ArrayList<String>(); |
| | | List<AttributeValue> attributeValues = new ArrayList<AttributeValue>(); |
| | |
| | | } |
| | | } |
| | | } |
| | | DN parent = oldDN.getParent(); |
| | | DN parent = oldDN.parent(); |
| | | if (attributeTypes.size() > 0) |
| | | { |
| | | DN newDN; |
| | |
| | | } |
| | | else |
| | | { |
| | | newDN = parent.concat(newRDN); |
| | | newDN = parent.child(newRDN); |
| | | } |
| | | sb.append(newDN.toString()); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | try |
| | | { |
| | | return !index.getBaseDN().equals(DN.decode(getBaseDN())) || |
| | | return !index.getBaseDN().equals(DN.valueOf(getBaseDN())) || |
| | | (getScope() != index.getScope()) || |
| | | !filter.getText().trim().equals(index.getFilter()) || |
| | | !getSortOrder().equals(index.getSortOrder()) || |
| | |
| | | getInfo().stopPooling(); |
| | | if (getInfo().mustDeregisterConfig()) |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("cn=config")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config")); |
| | | } |
| | | DirectoryServer.getInstance().initializeConfiguration( |
| | | org.opends.server.extensions.ConfigFileHandler.class.getName(), |
| | |
| | | LocalDBBackendCfgClient backend = |
| | | (LocalDBBackendCfgClient)root.getBackend(backendID); |
| | | LocalDBVLVIndexCfgClient index = backend.getLocalDBVLVIndex(indexName); |
| | | DN b = DN.decode(baseDN); |
| | | DN b = DN.valueOf(baseDN); |
| | | if (!indexToModify.getBaseDN().equals(b)) |
| | | { |
| | | index.setBaseDN(b); |
| | |
| | | { |
| | | updateConfiguration(); |
| | | modifiedIndex = new VLVIndexDescriptor( |
| | | indexName, indexToModify.getBackend(), DN.decode(baseDN), |
| | | indexName, indexToModify.getBackend(), DN.valueOf(baseDN), |
| | | scope, filterValue, sortOrder, maxBlock); |
| | | getInfo().registerModifiedIndex(modifiedIndex); |
| | | state = State.FINISHED_SUCCESSFULLY; |
| | |
| | | |
| | | try |
| | | { |
| | | DN b = DN.decode(baseDN); |
| | | DN b = DN.valueOf(baseDN); |
| | | if (!indexToModify.getBaseDN().equals(b)) |
| | | { |
| | | args.add("--set"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | protected void addValuesInRDN(Entry entry) |
| | | { |
| | | // Add the values in the RDN if they are not there |
| | | RDN rdn = entry.getDN().getRDN(); |
| | | RDN rdn = entry.getDN().rdn(); |
| | | for (int i=0; i<rdn.getNumValues(); i++) |
| | | { |
| | | String attrName = rdn.getAttributeName(i); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.nodes; |
| | |
| | | { |
| | | try |
| | | { |
| | | DN dnObj = DN.decode(dn); |
| | | if (dnObj.getNumComponents() >= 1) { |
| | | RDN rdn = dnObj.getRDN(); |
| | | DN dnObj = DN.valueOf(dn); |
| | | if (dnObj.size() >= 1) { |
| | | RDN rdn = dnObj.rdn(); |
| | | if (showAttributeName) |
| | | { |
| | | result = rdn.toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2011 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock, AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | /** |
| | | * The monitor root entry DN. |
| | | */ |
| | | protected DN monitorDN = DN.nullDN(); |
| | | protected DN monitorDN = DN.rootDN(); |
| | | /** |
| | | * The JVM memory usage monitoring entry DN. |
| | | */ |
| | | protected DN jvmMemoryUsageDN = DN.nullDN(); |
| | | protected DN jvmMemoryUsageDN = DN.rootDN(); |
| | | /** |
| | | * The system information monitoring entry DN. |
| | | */ |
| | | protected DN systemInformationDN = DN.nullDN(); |
| | | protected DN systemInformationDN = DN.rootDN(); |
| | | /** |
| | | * The entry cache monitoring entry DN. |
| | | */ |
| | | protected DN entryCachesDN = DN.nullDN(); |
| | | protected DN entryCachesDN = DN.rootDN(); |
| | | /** |
| | | * The work queue monitoring entry DN. |
| | | */ |
| | | protected DN workQueueDN = DN.nullDN(); |
| | | protected DN workQueueDN = DN.rootDN(); |
| | | /** |
| | | * The version monitoring entry DN. |
| | | */ |
| | | protected DN versionDN = DN.nullDN(); |
| | | protected DN versionDN = DN.rootDN(); |
| | | |
| | | { |
| | | try |
| | | { |
| | | monitorDN = DN.decode("cn=monitor"); |
| | | jvmMemoryUsageDN = DN.decode("cn=JVM Memory Usage,cn=monitor"); |
| | | systemInformationDN = DN.decode("cn=System Information,cn=monitor"); |
| | | entryCachesDN = DN.decode("cn=Entry Caches,cn=monitor"); |
| | | workQueueDN = DN.decode("cn=Work Queue,cn=monitor"); |
| | | versionDN = DN.decode("cn=Version,cn=monitor"); |
| | | monitorDN = DN.valueOf("cn=monitor"); |
| | | jvmMemoryUsageDN = DN.valueOf("cn=JVM Memory Usage,cn=monitor"); |
| | | systemInformationDN = DN.valueOf("cn=System Information,cn=monitor"); |
| | | entryCachesDN = DN.valueOf("cn=Entry Caches,cn=monitor"); |
| | | workQueueDN = DN.valueOf("cn=Work Queue,cn=monitor"); |
| | | versionDN = DN.valueOf("cn=Version,cn=monitor"); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | if (baseDN.getDn().equals(DN.decode(dn)) && |
| | | if (baseDN.getDn().equals(DN.valueOf(dn)) && |
| | | String.valueOf(baseDN.getReplicaID()).equals(replicaId)) |
| | | { |
| | | try |
| | |
| | | private boolean isRootMonitor(CustomSearchResult csr) |
| | | throws OpenDsException |
| | | { |
| | | return monitorDN.equals(DN.decode(csr.getDN())); |
| | | return monitorDN.equals(DN.valueOf(csr.getDN())); |
| | | } |
| | | |
| | | private boolean isVersionMonitor(CustomSearchResult csr) |
| | | throws OpenDsException |
| | | { |
| | | return versionDN.equals(DN.decode(csr.getDN())); |
| | | return versionDN.equals(DN.valueOf(csr.getDN())); |
| | | } |
| | | |
| | | private boolean isSystemInformation(CustomSearchResult csr) |
| | | throws OpenDsException |
| | | { |
| | | return systemInformationDN.equals(DN.decode(csr.getDN())); |
| | | return systemInformationDN.equals(DN.valueOf(csr.getDN())); |
| | | } |
| | | |
| | | private boolean isJvmMemoryUsage(CustomSearchResult csr) |
| | | throws OpenDsException |
| | | { |
| | | return jvmMemoryUsageDN.equals(DN.decode(csr.getDN())); |
| | | return jvmMemoryUsageDN.equals(DN.valueOf(csr.getDN())); |
| | | } |
| | | |
| | | private boolean isWorkQueue(CustomSearchResult csr) |
| | | throws OpenDsException |
| | | { |
| | | return workQueueDN.equals(DN.decode(csr.getDN())); |
| | | return workQueueDN.equals(DN.valueOf(csr.getDN())); |
| | | } |
| | | |
| | | private boolean isEntryCaches(CustomSearchResult csr) |
| | | throws OpenDsException |
| | | { |
| | | return entryCachesDN.equals(DN.decode(csr.getDN())); |
| | | return entryCachesDN.equals(DN.valueOf(csr.getDN())); |
| | | } |
| | | |
| | | private boolean isConnectionHandler(CustomSearchResult csr) |
| | | throws OpenDsException |
| | | { |
| | | boolean isConnectionHandler = false; |
| | | DN dn = DN.decode(csr.getDN()); |
| | | DN parent = dn.getParent(); |
| | | DN dn = DN.valueOf(csr.getDN()); |
| | | DN parent = dn.parent(); |
| | | if ((parent != null) && parent.equals(monitorDN)) |
| | | { |
| | | List<?> vs = csr.getAttributeValues("cn"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | { |
| | | try |
| | | { |
| | | if (dn.equals(DN.decode(parentUrl.getRawBaseDN()))) |
| | | if (dn.equals(DN.valueOf(parentUrl.getRawBaseDN()))) |
| | | { |
| | | containsChildren = true; |
| | | break; |
| | |
| | | { |
| | | try |
| | | { |
| | | if (dn.equals(DN.decode(url.getRawBaseDN()))) |
| | | if (dn.equals(DN.valueOf(url.getRawBaseDN()))) |
| | | { |
| | | contains = true; |
| | | break; |
| | |
| | | unreliableEntryList.clear(); |
| | | |
| | | for (DN subSuffixDN : subSuffixes) { |
| | | unreliableEntryList.add(subSuffixDN.getParent()); |
| | | unreliableEntryList.add(subSuffixDN.parent()); |
| | | } |
| | | isUnreliableEntryListEmpty = unreliableEntryList.isEmpty(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | if (entry != null) |
| | | { |
| | | DN entryDN = entry.getDN(); |
| | | DN parentDN = entryDN.getParent(); |
| | | DN parentDN = entryDN.parent(); |
| | | ConfigEntry parentEntry = null; |
| | | if (parentDN != null) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup.installer; |
| | |
| | | |
| | | LDIFWriter writer = new LDIFWriter(exportConfig); |
| | | |
| | | DN dn = DN.decode(baseDn); |
| | | DN dn = DN.valueOf(baseDn); |
| | | Entry entry = StaticUtils.createEntry(dn); |
| | | |
| | | writer.writeEntry(entry); |
| | |
| | | String dn = Utilities.getRDNString("ds-cfg-backend-id", |
| | | backendName)+",cn=Backends,cn=config"; |
| | | Utilities.deleteConfigSubtree( |
| | | DirectoryServer.getConfigHandler(), DN.decode(dn)); |
| | | DirectoryServer.getConfigHandler(), DN.valueOf(dn)); |
| | | } |
| | | catch (OpenDsException ode) |
| | | { |
| | |
| | | Set<DN> setBaseDNs = new HashSet<DN>(); |
| | | for (String baseDN : baseDNs) |
| | | { |
| | | setBaseDNs.add(DN.decode(baseDN)); |
| | | setBaseDNs.add(DN.valueOf(baseDN)); |
| | | } |
| | | backend.setBaseDN(setBaseDNs); |
| | | backend.setBackendId(backendName); |
| | |
| | | Set<DN> setBaseDNs = new HashSet<DN>(); |
| | | for (String baseDN : baseDNs) |
| | | { |
| | | setBaseDNs.add(DN.decode(baseDN)); |
| | | setBaseDNs.add(DN.valueOf(baseDN)); |
| | | } |
| | | backend.setBaseDN(setBaseDNs); |
| | | backend.commit(); |
| | |
| | | ReplicationDomainCfgDefn.getInstance(), domainName, |
| | | new ArrayList<DefaultBehaviorException>()); |
| | | domain.setServerId(domainId); |
| | | domain.setBaseDN(DN.decode(dn)); |
| | | domain.setBaseDN(DN.valueOf(dn)); |
| | | isCreated = true; |
| | | } |
| | | else |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | setBaseDN((DN) null); |
| | | } else { |
| | | try { |
| | | setBaseDN(DN.decode(baseDN)); |
| | | setBaseDN(DN.valueOf(baseDN)); |
| | | } catch (DirectoryException e) { |
| | | throw new IllegalArgumentException(e); |
| | | } |
| | |
| | | ensureNotNull(value); |
| | | |
| | | if (baseDN != null) { |
| | | DN parent = value.getParent(); |
| | | DN parent = value.parent(); |
| | | |
| | | if (parent == null) { |
| | | parent = DN.nullDN(); |
| | | parent = DN.rootDN(); |
| | | } |
| | | |
| | | if (!parent.equals(baseDN)) { |
| | |
| | | ensureNotNull(value); |
| | | |
| | | try { |
| | | DN dn = DN.decode(value); |
| | | DN dn = DN.valueOf(value); |
| | | validateValue(dn); |
| | | return dn; |
| | | } catch (DirectoryException e) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | |
| | | // Create a new DN builder. |
| | | private DNSerializer() { |
| | | this.dn = DN.nullDN(); |
| | | this.dn = DN.rootDN(); |
| | | this.profile = LDAPProfile.getInstance(); |
| | | } |
| | | |
| | |
| | | AttributeType atype = DirectoryServer.getAttributeType( |
| | | type.toLowerCase(), true); |
| | | AttributeValue avalue = AttributeValues.create(atype, name); |
| | | dn = dn.concat(RDN.create(atype, avalue)); |
| | | dn = dn.child(RDN.create(atype, avalue)); |
| | | } |
| | | |
| | | |
| | |
| | | AttributeType atype = DirectoryServer.getAttributeType( |
| | | type.toLowerCase(), true); |
| | | AttributeValue avalue = AttributeValues.create(atype, d.getName()); |
| | | dn = dn.concat(RDN.create(atype, avalue)); |
| | | dn = dn.child(RDN.create(atype, avalue)); |
| | | } |
| | | |
| | | |
| | |
| | | private void appendManagedObjectPathElement(RelationDefinition<?, ?> r) { |
| | | // Add the RDN sequence representing the relation. |
| | | try { |
| | | DN localName = DN.decode(profile.getRelationRDNSequence(r)); |
| | | dn = dn.concat(localName); |
| | | DN localName = DN.valueOf(profile.getRelationRDNSequence(r)); |
| | | dn = dn.child(localName); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin; |
| | | |
| | |
| | | |
| | | DN dn; |
| | | try { |
| | | dn = DN.decode(s); |
| | | dn = DN.valueOf(s); |
| | | } catch (DirectoryException e) { |
| | | throw new IllegalArgumentException("Unabled to decode the DN string: \"" |
| | | + s + "\""); |
| | | } |
| | | |
| | | RDN rdn = dn.getRDN(); |
| | | RDN rdn = dn.rdn(); |
| | | if (rdn == null) { |
| | | throw new IllegalArgumentException("Unabled to decode the DN string: \"" |
| | | + s + "\""); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | public boolean configAddIsAcceptable(ConfigEntry configEntry, |
| | | MessageBuilder unacceptableReason) { |
| | | DN dn = configEntry.getDN(); |
| | | AttributeValue av = dn.getRDN().getAttributeValue(0); |
| | | AttributeValue av = dn.rdn().getAttributeValue(0); |
| | | String name = av.getValue().toString().trim(); |
| | | |
| | | try { |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | |
| | | }; |
| | | |
| | | DN parent = dn.getParent(); |
| | | DN parent = dn.parent(); |
| | | if (parent != null) { |
| | | ConfigEntry configEntry = getConfigEntry(dn.getParent()); |
| | | ConfigEntry configEntry = getConfigEntry(dn.parent()); |
| | | if (configEntry != null) { |
| | | configEntry.registerDeleteListener(cleanerListener); |
| | | } |
| | |
| | | |
| | | // Now remove the cleaner listener as it will no longer be |
| | | // needed. |
| | | ConfigEntry parentConfigEntry = getConfigEntry(dn.getParent()); |
| | | ConfigEntry parentConfigEntry = getConfigEntry(dn.parent()); |
| | | if (parentConfigEntry != null) { |
| | | parentConfigEntry.deregisterDeleteListener(cleanerListener); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | public boolean configDeleteIsAcceptable(ConfigEntry configEntry, |
| | | MessageBuilder unacceptableReason) { |
| | | DN dn = configEntry.getDN(); |
| | | AttributeValue av = dn.getRDN().getAttributeValue(0); |
| | | AttributeValue av = dn.rdn().getAttributeValue(0); |
| | | String name = av.getValue().toString().trim(); |
| | | |
| | | try { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.server; |
| | |
| | | |
| | | try { |
| | | LDAPProfile profile = LDAPProfile.getInstance(); |
| | | DN localName = DN.decode(profile.getRelationRDNSequence(relation)); |
| | | return dn.concat(localName); |
| | | DN localName = DN.valueOf(profile.getRelationRDNSequence(relation)); |
| | | return dn.child(localName); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | * when it is added. |
| | | */ |
| | | public DelayedConfigAddListener(DN child, ConfigAddListener addListener) { |
| | | this.parent = child.getParent(); |
| | | this.parent = child.parent(); |
| | | this.child = child; |
| | | this.delayedAddListener = addListener; |
| | | this.delayedDeleteListener = null; |
| | |
| | | */ |
| | | public DelayedConfigAddListener(DN child, |
| | | ConfigDeleteListener deleteListener) { |
| | | this.parent = child.getParent(); |
| | | this.parent = child.parent(); |
| | | this.child = child; |
| | | this.delayedAddListener = null; |
| | | this.delayedDeleteListener = deleteListener; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.server; |
| | |
| | | throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | DN baseDN = DNBuilder.create(path, d).parent(); |
| | | deregisterAddListener(baseDN, listener); |
| | | } |
| | | |
| | |
| | | throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | DN baseDN = DNBuilder.create(path, d).parent(); |
| | | deregisterAddListener(baseDN, listener); |
| | | } |
| | | |
| | |
| | | ConfigurationDeleteListener<M> listener) throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | DN baseDN = DNBuilder.create(path, d).parent(); |
| | | deregisterDeleteListener(baseDN, listener); |
| | | } |
| | | |
| | |
| | | throws IllegalArgumentException { |
| | | validateRelationDefinition(d); |
| | | |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | DN baseDN = DNBuilder.create(path, d).parent(); |
| | | deregisterDeleteListener(baseDN, listener); |
| | | } |
| | | |
| | |
| | | if (configEntry != null) { |
| | | return configEntry.getDN(); |
| | | } else { |
| | | return DN.nullDN(); |
| | | return DN.rootDN(); |
| | | } |
| | | } |
| | | |
| | |
| | | ServerManagedObjectAddListener<M> listener) |
| | | throws IllegalArgumentException, ConfigException { |
| | | validateRelationDefinition(d); |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | DN baseDN = DNBuilder.create(path, d).parent(); |
| | | ConfigAddListener adaptor = new ConfigAddListenerAdaptor<M>(path, d, |
| | | listener); |
| | | registerAddListener(baseDN, adaptor); |
| | |
| | | ServerManagedObjectDeleteListener<M> listener) |
| | | throws IllegalArgumentException, ConfigException { |
| | | validateRelationDefinition(d); |
| | | DN baseDN = DNBuilder.create(path, d).getParent(); |
| | | DN baseDN = DNBuilder.create(path, d).parent(); |
| | | ConfigDeleteListener adaptor = new ConfigDeleteListenerAdaptor<M>(path, d, |
| | | listener); |
| | | registerDeleteListener(baseDN, adaptor); |
| | |
| | | // entry to the provided base DN. |
| | | private void registerDelayedListener(DN baseDN, |
| | | ConfigAddListener delayedListener) throws ConfigException { |
| | | DN parentDN = baseDN.getParent(); |
| | | DN parentDN = baseDN.parent(); |
| | | while (parentDN != null) { |
| | | ConfigEntry relationEntry = getListenerConfigEntry(parentDN); |
| | | if (relationEntry == null) { |
| | | delayedListener = new DelayedConfigAddListener(parentDN, |
| | | delayedListener); |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } else { |
| | | relationEntry.registerAddListener(delayedListener); |
| | | return; |
| | |
| | | // entry to the provided base DN. |
| | | private <M extends Configuration> void deregisterDelayedAddListener(DN baseDN, |
| | | ConfigurationAddListener<M> listener) throws ConfigException { |
| | | DN parentDN = baseDN.getParent(); |
| | | DN parentDN = baseDN.parent(); |
| | | int delayWrappers = 0; |
| | | while (parentDN != null) { |
| | | ConfigEntry relationEntry = getListenerConfigEntry(parentDN); |
| | | if (relationEntry == null) { |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | delayWrappers++; |
| | | } else { |
| | | for (ConfigAddListener l : relationEntry.getAddListeners()) { |
| | |
| | | private <M extends Configuration> void deregisterDelayedDeleteListener( |
| | | DN baseDN, ConfigurationDeleteListener<M> listener) |
| | | throws ConfigException { |
| | | DN parentDN = baseDN.getParent(); |
| | | DN parentDN = baseDN.parent(); |
| | | int delayWrappers = 0; |
| | | while (parentDN != null) { |
| | | ConfigEntry relationEntry = getListenerConfigEntry(parentDN); |
| | | if (relationEntry == null) { |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | delayWrappers++; |
| | | } else { |
| | | for (ConfigAddListener l : relationEntry.getAddListeners()) { |
| | |
| | | // entry to the provided base DN. |
| | | private <M extends Configuration> void deregisterDelayedAddListener(DN baseDN, |
| | | ServerManagedObjectAddListener<M> listener) throws ConfigException { |
| | | DN parentDN = baseDN.getParent(); |
| | | DN parentDN = baseDN.parent(); |
| | | int delayWrappers = 0; |
| | | while (parentDN != null) { |
| | | ConfigEntry relationEntry = getListenerConfigEntry(parentDN); |
| | | if (relationEntry == null) { |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | delayWrappers++; |
| | | } else { |
| | | for (ConfigAddListener l : relationEntry.getAddListeners()) { |
| | |
| | | private <M extends Configuration> void deregisterDelayedDeleteListener( |
| | | DN baseDN, ServerManagedObjectDeleteListener<M> listener) |
| | | throws ConfigException { |
| | | DN parentDN = baseDN.getParent(); |
| | | DN parentDN = baseDN.parent(); |
| | | int delayWrappers = 0; |
| | | while (parentDN != null) { |
| | | ConfigEntry relationEntry = getListenerConfigEntry(parentDN); |
| | | if (relationEntry == null) { |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | delayWrappers++; |
| | | } else { |
| | | for (ConfigAddListener l : relationEntry.getAddListeners()) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin.server; |
| | |
| | | ArrayList<String> names = new ArrayList<String>(children.size()); |
| | | for (DN child : children) { |
| | | // Assume that RDNs are single-valued and can be trimmed. |
| | | AttributeValue av = child.getRDN().getAttributeValue(0); |
| | | AttributeValue av = child.rdn().getAttributeValue(0); |
| | | names.add(av.getValue().toString().trim()); |
| | | } |
| | | |
| | |
| | | ArrayList<String> names = new ArrayList<String>(children.size()); |
| | | for (DN child : children) { |
| | | // Assume that RDNs are single-valued and can be trimmed. |
| | | AttributeValue av = child.getRDN().getAttributeValue(0); |
| | | AttributeValue av = child.rdn().getAttributeValue(0); |
| | | names.add(av.toString().trim()); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | |
| | | authzDN = operation.getAuthorizationDN(); |
| | | } |
| | | |
| | | if ((authzDN == null) || authzDN.isNullDN()) |
| | | if ((authzDN == null) || authzDN.isRootDN()) |
| | | { |
| | | return Collections.<Group<?>>emptySet(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.api; |
| | |
| | | size++; |
| | | |
| | | // Update parent hierarchy. |
| | | for (DN parentDN = key.getParent(); |
| | | for (DN parentDN = key.parent(); |
| | | parentDN != null; |
| | | parentDN = parentDN.getParent()) |
| | | parentDN = parentDN.parent()) |
| | | { |
| | | final Node<T> parentNode = ditCacheMap.get(parentDN); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | return this.authzid; |
| | | else if (this.authorizationEntry != null) |
| | | return this.authorizationEntry.getDN(); |
| | | return DN.nullDN(); |
| | | return DN.rootDN(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | } |
| | | //Actually build the string. |
| | | String user=anonymous; |
| | | if(!evalCtx.getClientDN().isNullDN()) |
| | | if(!evalCtx.getClientDN().isRootDN()) |
| | | user=evalCtx.getClientDN().toString(); |
| | | String right=evalCtx.rightToString(); |
| | | AttributeType aType=evalCtx.getCurrentAttributeType(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2013 Manuel Gaupp |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | |
| | | |
| | | try |
| | | { |
| | | debugSearchIndexDN = DN.decode("cn=debugsearch"); |
| | | debugSearchIndexDN = DN.valueOf("cn=debugsearch"); |
| | | } |
| | | catch (DirectoryException ex) |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | final RDN oldRDN = operation.getOriginalEntry().getDN().getRDN(); |
| | | final RDN oldRDN = operation.getOriginalEntry().getDN().rdn(); |
| | | final RDN newRDN = operation.getNewRDN(); |
| | | final DN newSuperiorDN = operation.getNewSuperior(); |
| | | |
| | |
| | | { |
| | | DNString = |
| | | container.getCurrentAttributeValue().getValue().toString(); |
| | | DN tmpDN = DN.decode(DNString); |
| | | DN tmpDN = DN.valueOf(DNString); |
| | | // Have a valid DN, compare to clientDN to see if the ACI_SELF |
| | | // right should be set. |
| | | if (tmpDN.equals(container.getClientDN())) |
| | |
| | | // modification. |
| | | if (modAttrType.equals(globalAciType)) |
| | | { |
| | | dn = DN.nullDN(); |
| | | dn = DN.rootDN(); |
| | | } |
| | | Aci.decode(v.getValue(), dn); |
| | | } |
| | |
| | | final SortedSet<Aci> globalAcis = configuration.getGlobalACI(); |
| | | if (globalAcis != null) |
| | | { |
| | | aciList.addAci(DN.nullDN(), globalAcis); |
| | | aciList.addAci(DN.rootDN(), globalAcis); |
| | | logError(INFO_ACI_ADD_LIST_GLOBAL_ACIS.get( |
| | | Integer.toString(globalAcis.size()))); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | List<Aci> acis = aciList.get(baseDN); |
| | | if (acis != null) { |
| | | //Check if there are global ACIs. Global ACI has a NULL DN. |
| | | if (baseDN.isNullDN()) { |
| | | if (baseDN.isRootDN()) { |
| | | for (Aci aci : acis) { |
| | | AciTargets targets = aci.getTargets(); |
| | | //If there is a target, evaluate it to see if this ACI should |
| | |
| | | candidates.addAll(acis); |
| | | } |
| | | } |
| | | if(baseDN.isNullDN()) { |
| | | if(baseDN.isRootDN()) { |
| | | break; |
| | | } |
| | | DN parentDN=baseDN.getParent(); |
| | | DN parentDN=baseDN.parent(); |
| | | if(parentDN == null) { |
| | | baseDN=DN.nullDN(); |
| | | baseDN=DN.rootDN(); |
| | | } else { |
| | | baseDN=parentDN; |
| | | } |
| | |
| | | //attributes are skipped. |
| | | if(hasGlobalAci && entry.getDN().equals(configDN)) { |
| | | List<Attribute> attributeList = entry.getAttribute(globalAciType); |
| | | validAcis = addAciAttributeList(aciList, DN.nullDN(), configDN, |
| | | validAcis = addAciAttributeList(aciList, DN.rootDN(), configDN, |
| | | attributeList, failedACIMsgs); |
| | | } |
| | | |
| | |
| | | validAcis++; |
| | | } catch (AciException ex) { |
| | | DN msgDN=dn; |
| | | if(dn == DN.nullDN()) { |
| | | if(dn == DN.rootDN()) { |
| | | msgDN=configDN; |
| | | } |
| | | Message message = WARN_ACI_ADD_LIST_FAILED_DECODE.get( |
| | |
| | | //DN is checked to verify it is equal to the config DN. If not those |
| | | //attributes are skipped. |
| | | if(hasGlobalAci && oldEntry.getDN().equals(configDN)) { |
| | | aciList.remove(DN.nullDN()); |
| | | aciList.remove(DN.rootDN()); |
| | | List<Attribute> attributeList = |
| | | newEntry.getAttribute(globalAciType); |
| | | addAciAttributeList(aciList, DN.nullDN(), configDN, |
| | | addAciAttributeList(aciList, DN.rootDN(), configDN, |
| | | attributeList, failedACIMsgs); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | if (hasGlobalAci && entryDN.equals(configDN) && |
| | | aciList.remove(DN.nullDN()) == null) |
| | | aciList.remove(DN.rootDN()) == null) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | public void renameAci(DN oldDN, DN newDN ) { |
| | | |
| | | int oldRDNCount=oldDN.getNumComponents(); |
| | | int newRDNCount=newDN.getNumComponents(); |
| | | int oldRDNCount=oldDN.size(); |
| | | int newRDNCount=newDN.size(); |
| | | |
| | | lock.writeLock().lock(); |
| | | try |
| | |
| | | while (iterator.hasNext()) { |
| | | Map.Entry<DN,List<Aci>> hashEntry = iterator.next(); |
| | | if(hashEntry.getKey().isDescendantOf(oldDN)) { |
| | | int keyRDNCount=hashEntry.getKey().getNumComponents(); |
| | | int keyRDNCount=hashEntry.getKey().size(); |
| | | int keepRDNCount=keyRDNCount - oldRDNCount; |
| | | RDN[] newRDNs = new RDN[keepRDNCount + newRDNCount]; |
| | | for (int i=0; i < keepRDNCount; i++) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | * Sun CR 6535035 has been raised on DSEE: |
| | | * Non-standard interpretation of onelevel in ACI targetScope. |
| | | */ |
| | | if(!targetDN.equals(entryDN.getParent())) |
| | | if(!targetDN.equals(entryDN.parent())) |
| | | return false; |
| | | break; |
| | | case WHOLE_SUBTREE: |
| | |
| | | return false; |
| | | break; |
| | | case SUBORDINATE_SUBTREE: |
| | | if ((entryDN.getNumComponents() <= targetDN.getNumComponents()) || |
| | | if ((entryDN.size() <= targetDN.size()) || |
| | | !entryDN.isDescendantOf(targetDN)) { |
| | | return false; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | List<Attribute> attrs = e.getAttribute(attributeType); |
| | | for(AttributeValue v : attrs.get(0)) { |
| | | try { |
| | | DN groupDN=DN.decode(v.getValue().toString()); |
| | | DN groupDN=DN.valueOf(v.getValue().toString()); |
| | | if(suffixDN != null && |
| | | !groupDN.isDescendantOf(suffixDN)) |
| | | continue; |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.authorization.dseecompat; |
| | |
| | | throw new AciException(message); |
| | | } |
| | | baseDN=url.getBaseDN(); |
| | | if(baseDN.isNullDN()){ |
| | | if(baseDN.isRootDN()){ |
| | | Message message = |
| | | WARN_ACI_SYNTAX_INVALID_USERATTR_BASEDN_URL.get(pattern); |
| | | throw new AciException(message); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.authorization.dseecompat; |
| | |
| | | if (equality != null) |
| | | { |
| | | // There are no Multiple-Whole-RDN wildcards in the pattern. |
| | | if (equality.length != dn.getNumComponents()) |
| | | if (equality.length != dn.size()) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | for (int i = 0; i < dn.getNumComponents(); i++) |
| | | for (int i = 0; i < dn.size(); i++) |
| | | { |
| | | if (!equality[i].matchesRDN(dn.getRDN(i))) |
| | | { |
| | |
| | | else |
| | | { |
| | | // There are Multiple-Whole-RDN wildcards in the pattern. |
| | | int valueLength = dn.getNumComponents(); |
| | | int valueLength = dn.size(); |
| | | |
| | | int pos = 0; |
| | | if (subInitial != null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | AttributeValue value, |
| | | SearchFilter filter) { |
| | | Attribute attr = Attributes.create(attrType, value); |
| | | Entry e = new Entry(DN.nullDN(), null, null, null); |
| | | Entry e = new Entry(DN.rootDN(), null, null, null); |
| | | e.addAttribute(attr, new ArrayList<AttributeValue>()); |
| | | try { |
| | | return filter.matchesEntry(e); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | * than the rdn count. |
| | | */ |
| | | private DN getDNParentLevel(int l, DN dn) { |
| | | int rdns=dn.getNumComponents(); |
| | | int rdns=dn.size(); |
| | | if(l > rdns) |
| | | return null; |
| | | DN theDN=dn; |
| | | for(int i=0; i < l;i++) { |
| | | theDN=theDN.getParent(); |
| | | theDN=theDN.parent(); |
| | | } |
| | | return theDN; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | } |
| | | case PARENT: |
| | | { |
| | | DN parentDN = resDN.getParent(); |
| | | DN parentDN = resDN.parent(); |
| | | if ((parentDN != null) && |
| | | (parentDN.equals(clientDN))) |
| | | matched = EnumEvalResult.TRUE; |
| | |
| | | if(!evalCtx.getClientDN().isDescendantOf(urlDN)) |
| | | return EnumEvalResult.FALSE; |
| | | } else if(scope == SearchScope.SINGLE_LEVEL) { |
| | | DN parent=evalCtx.getClientDN().getParent(); |
| | | DN parent=evalCtx.getClientDN().parent(); |
| | | if((parent != null) && !parent.equals(urlDN)) |
| | | return EnumEvalResult.FALSE; |
| | | } else if(scope == SearchScope.SUBORDINATE_SUBTREE) { |
| | | DN userDN = evalCtx.getClientDN(); |
| | | if ((userDN.getNumComponents() <= urlDN.getNumComponents()) || |
| | | if ((userDN.size() <= urlDN.size()) || |
| | | !userDN.isDescendantOf(urlDN)) { |
| | | return EnumEvalResult.FALSE; |
| | | } |
| | |
| | | List<Attribute> attrs = e.getAttribute(attrType); |
| | | for(AttributeValue v : attrs.get(0)) { |
| | | try { |
| | | DN dn=DN.decode(v.getValue().toString()); |
| | | DN dn=DN.valueOf(v.getValue().toString()); |
| | | if(dn.equals(clientDN)) { |
| | | matched=EnumEvalResult.TRUE; |
| | | break; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | // the DN of the base backup entry. |
| | | try |
| | | { |
| | | backupBaseDN = DN.decode(DN_BACKUP_ROOT); |
| | | backupBaseDN = DN.valueOf(DN_BACKUP_ROOT); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(1); |
| | | |
| | | RDN rdn = backupBaseDN.getRDN(); |
| | | RDN rdn = backupBaseDN.rdn(); |
| | | int numAVAs = rdn.getNumValues(); |
| | | for (int i=0; i < numAVAs; i++) |
| | | { |
| | |
| | | // Make sure that the DN specifies a backup directory. |
| | | AttributeType t = |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true); |
| | | AttributeValue v = entryDN.getRDN().getAttributeValue(t); |
| | | AttributeValue v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | | Message message = |
| | |
| | | // First, get the backup ID from the entry DN. |
| | | AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID, |
| | | true); |
| | | AttributeValue idValue = entryDN.getRDN().getAttributeValue(idType); |
| | | AttributeValue idValue = entryDN.rdn().getAttributeValue(idType); |
| | | if (idValue == null) { |
| | | Message message = ERR_BACKUP_NO_BACKUP_ID_IN_DN.get(String |
| | | .valueOf(entryDN)); |
| | |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType( |
| | | ATTR_BACKUP_DIRECTORY_PATH, true); |
| | | AttributeValue v = parentDN.getRDN().getAttributeValue(t); |
| | | AttributeValue v = parentDN.rdn().getAttributeValue(t); |
| | | if (v == null) { |
| | | Message message = ERR_BACKUP_NO_BACKUP_DIR_IN_DN.get(String |
| | | .valueOf(entryDN)); |
| | |
| | | { |
| | | AttributeValue attrValue = |
| | | AttributeValues.create(rdnAttrType, rdnStringValue); |
| | | return parentDN.concat(RDN.create(rdnAttrType, attrValue)); |
| | | return parentDN.child(RDN.create(rdnAttrType, attrValue)); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | private void subtreeRename(DN entryDN, DN newParentDN) |
| | | { |
| | | Set<DN> childDNSet = childDNs.remove(entryDN); |
| | | DN newEntryDN = new DN(entryDN.getRDN(), newParentDN); |
| | | DN newEntryDN = new DN(entryDN.rdn(), newParentDN); |
| | | |
| | | Entry oldEntry = entryMap.remove(entryDN); |
| | | if (oldEntry == null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | // the DN of the base monitor entry. |
| | | try |
| | | { |
| | | baseMonitorDN = DN.decode(DN_MONITOR_ROOT); |
| | | baseMonitorDN = DN.valueOf(DN_MONITOR_ROOT); |
| | | } |
| | | catch (final Exception e) |
| | | { |
| | |
| | | else |
| | | { |
| | | long count = 0; |
| | | final int childDNSize = entryDN.getNumComponents() + 1; |
| | | final int childDNSize = entryDN.size() + 1; |
| | | for (final DN dn : dit.tailMap(entryDN, false).navigableKeySet()) |
| | | { |
| | | if (!dn.isDescendantOf(entryDN)) |
| | | { |
| | | break; |
| | | } |
| | | else if (subtree || dn.getNumComponents() == childDNSize) |
| | | else if (subtree || dn.size() == childDNSize) |
| | | { |
| | | count++; |
| | | } |
| | |
| | | if (!dit.containsKey(baseDN)) |
| | | { |
| | | // Not found, so find the nearest match. |
| | | DN matchedDN = baseDN.getParent(); |
| | | DN matchedDN = baseDN.parent(); |
| | | while (matchedDN != null) |
| | | { |
| | | if (dit.containsKey(matchedDN)) |
| | | { |
| | | break; |
| | | } |
| | | matchedDN = matchedDN.getParent(); |
| | | matchedDN = matchedDN.parent(); |
| | | } |
| | | final Message message = ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(String |
| | | .valueOf(baseDN)); |
| | |
| | | final HashMap<AttributeType, List<Attribute>> monitorUserAttrs = |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(); |
| | | |
| | | final RDN rdn = dn.getRDN(); |
| | | final RDN rdn = dn.rdn(); |
| | | if (rdn != null) |
| | | { |
| | | // Add the RDN values |
| | |
| | | dit.put(dn, monitorProvider); |
| | | |
| | | // Added glue records. |
| | | for (dn = dn.getParent(); dn != null; dn = dn.getParent()) |
| | | for (dn = dn.parent(); dn != null; dn = dn.parent()) |
| | | { |
| | | if (dit.containsKey(dn)) |
| | | { |
| | |
| | | monitorAttrs.size() + 1); |
| | | |
| | | // Make sure to include the RDN attribute. |
| | | final RDN entryRDN = entryDN.getRDN(); |
| | | final RDN entryRDN = entryDN.rdn(); |
| | | final AttributeType rdnType = entryRDN.getAttributeType(0); |
| | | final AttributeValue rdnValue = entryRDN.getAttributeValue(0); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | |
| | | // Create the set of base DNs that we will handle. In this case, it's just |
| | | // the root DSE. |
| | | rootDSEDN = DN.nullDN(); |
| | | rootDSEDN = DN.rootDN(); |
| | | this.baseDNs = new DN[] { rootDSEDN }; |
| | | |
| | | |
| | |
| | | public long numSubordinates(DN entryDN, boolean subtree) |
| | | throws DirectoryException |
| | | { |
| | | if (entryDN == null || ! entryDN.isNullDN()) |
| | | if (entryDN == null || ! entryDN.isRootDN()) |
| | | { |
| | | return -1; |
| | | } |
| | |
| | | throws DirectoryException |
| | | { |
| | | // If the requested entry was the root DSE, then create and return it. |
| | | if ((entryDN == null) || entryDN.isNullDN()) |
| | | if ((entryDN == null) || entryDN.isRootDN()) |
| | | { |
| | | return getRootDSE(); |
| | | } |
| | |
| | | throws DirectoryException |
| | | { |
| | | // If the specified DN was the null DN, then it exists. |
| | | if (entryDN.isNullDN()) |
| | | if (entryDN.isRootDN()) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | public void search(SearchOperation searchOperation) |
| | | throws DirectoryException, CanceledOperationException { |
| | | DN baseDN = searchOperation.getBaseDN(); |
| | | if (! baseDN.isNullDN()) |
| | | if (! baseDN.isRootDN()) |
| | | { |
| | | Message message = ERR_ROOTDSE_INVALID_SEARCH_BASE. |
| | | get(searchOperation.getConnectionID(), |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(); |
| | | |
| | | // Add the RDN attribute(s) for the provided entry. |
| | | RDN rdn = entryDN.getRDN(); |
| | | RDN rdn = entryDN.rdn(); |
| | | if (rdn != null) |
| | | { |
| | | int numAVAs = rdn.getNumValues(); |
| | |
| | | DN authzDN = modifyOperation.getAuthorizationDN(); |
| | | if (authzDN == null) |
| | | { |
| | | authzDN = DN.nullDN(); |
| | | authzDN = DN.rootDN(); |
| | | } |
| | | |
| | | modifiersName = AttributeValues.create( |
| | |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | |
| | | DN dn = DirectoryServer.getSchemaDN(); |
| | | RDN rdn = dn.getRDN(); |
| | | RDN rdn = dn.rdn(); |
| | | for (int i=0; i < rdn.getNumValues(); i++) |
| | | { |
| | | AttributeType type = rdn.getAttributeType(i); |
| | |
| | | newBaseDNs = new HashSet<DN>(backendCfg.getSchemaEntryDN()); |
| | | if (newBaseDNs.isEmpty()) |
| | | { |
| | | newBaseDNs.add(DN.decode(DN_DEFAULT_SCHEMA_ROOT)); |
| | | newBaseDNs.add(DN.valueOf(DN_DEFAULT_SCHEMA_ROOT)); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(1); |
| | | |
| | | RDN rdn = baseDN.getRDN(); |
| | | RDN rdn = baseDN.rdn(); |
| | | int numAVAs = rdn.getNumValues(); |
| | | for (int i=0; i < numAVAs; i++) |
| | | { |
| | |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = |
| | | DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID, true); |
| | | AttributeValue v = entryDN.getRDN().getAttributeValue(t); |
| | | AttributeValue v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | | Message message = ERR_TRUSTSTORE_DN_DOES_NOT_SPECIFY_CERTIFICATE. |
| | |
| | | { |
| | | AttributeValue attrValue = |
| | | AttributeValues.create(rdnAttrType, rdnStringValue); |
| | | return parentDN.concat(RDN.create(rdnAttrType, attrValue)); |
| | | return parentDN.child(RDN.create(rdnAttrType, attrValue)); |
| | | } |
| | | |
| | | |
| | |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = |
| | | DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID, true); |
| | | AttributeValue v = entryDN.getRDN().getAttributeValue(t); |
| | | AttributeValue v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | | Message message = ERR_TRUSTSTORE_DN_DOES_NOT_SPECIFY_CERTIFICATE.get( |
| | |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = |
| | | DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID, true); |
| | | AttributeValue v = entryDN.getRDN().getAttributeValue(t); |
| | | AttributeValue v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | | Message message = ERR_TRUSTSTORE_DN_DOES_NOT_SPECIFY_CERTIFICATE.get( |
| | |
| | | |
| | | Message message = |
| | | INFO_ERGONOMIC_SIZING_OF_JE_CLEANER_THREADS.get(String |
| | | .valueOf(cfg.dn().getRDN().getAttributeValue(0)), |
| | | .valueOf(cfg.dn().rdn().getAttributeValue(0)), |
| | | (Number) value); |
| | | logError(message); |
| | | } |
| | |
| | | |
| | | Message message = |
| | | INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES.get(String |
| | | .valueOf(cfg.dn().getRDN().getAttributeValue(0)), |
| | | .valueOf(cfg.dn().rdn().getAttributeValue(0)), |
| | | (Number) value); |
| | | logError(message); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | super(name, env, entryContainer); |
| | | |
| | | comparator = new AttributeIndex.KeyComparator(); |
| | | prefixRDNComponents = entryContainer.getBaseDN().getNumComponents(); |
| | | prefixRDNComponents = entryContainer.getBaseDN().size(); |
| | | DatabaseConfig dn2idConfig = new DatabaseConfig(); |
| | | |
| | | if(env.getConfig().getReadOnly()) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | super(name, env, entryContainer); |
| | | |
| | | dn2uriComparator = new AttributeIndex.KeyComparator(); |
| | | prefixRDNComponents = entryContainer.getBaseDN().getNumComponents(); |
| | | prefixRDNComponents = entryContainer.getBaseDN().size(); |
| | | DatabaseConfig dn2uriConfig = new DatabaseConfig(); |
| | | |
| | | if(env.getConfig().getReadOnly()) |
| | |
| | | { |
| | | urlBaseDN = |
| | | EntryContainer.modDN(targetDN, |
| | | referralDN.getNumComponents(), |
| | | referralDN.size(), |
| | | ldapurl.getBaseDN()); |
| | | } |
| | | ldapurl.setBaseDN(urlBaseDN); |
| | |
| | | |
| | | if (ldapurl.getScheme().equalsIgnoreCase("ldap")) |
| | | { |
| | | if (ldapurl.getBaseDN().isNullDN()) |
| | | if (ldapurl.getBaseDN().isRootDN()) |
| | | { |
| | | |
| | | ldapurl.setBaseDN(dn); |
| | |
| | | debugBuffer.toString()); |
| | | |
| | | Entry debugEntry = |
| | | new Entry(DN.decode("cn=debugsearch"), null, null, null); |
| | | new Entry(DN.valueOf("cn=debugsearch"), null, null, null); |
| | | debugEntry.addAttribute(attr, new ArrayList<AttributeValue>()); |
| | | |
| | | searchOperation.returnEntry(debugEntry, null); |
| | |
| | | * "ou=people,dc=example,dc=com". |
| | | */ |
| | | byte[] baseDNKey = JebFormat.dnToDNKey(aBaseDN, |
| | | this.baseDN.getNumComponents()); |
| | | this.baseDN.size()); |
| | | byte[] suffix = Arrays.copyOf(baseDNKey, baseDNKey.length+1); |
| | | suffix[suffix.length-1] = 0x00; |
| | | |
| | |
| | | else if (searchScope == SearchScope.SINGLE_LEVEL) |
| | | { |
| | | // Check if this entry is an immediate child. |
| | | if ((entryDN.getNumComponents() == |
| | | aBaseDN.getNumComponents() + 1) && |
| | | if ((entryDN.size() == |
| | | aBaseDN.size() + 1) && |
| | | entryDN.isDescendantOf(aBaseDN)) |
| | | { |
| | | isInScope = true; |
| | |
| | | } |
| | | else if (searchScope == SearchScope.SUBORDINATE_SUBTREE) |
| | | { |
| | | if ((entryDN.getNumComponents() > |
| | | aBaseDN.getNumComponents()) && |
| | | if ((entryDN.size() > |
| | | aBaseDN.size()) && |
| | | entryDN.isDescendantOf(aBaseDN)) |
| | | { |
| | | isInScope = true; |
| | |
| | | * downwards. |
| | | */ |
| | | byte[] entryDNKey = JebFormat.dnToDNKey(entryDN, |
| | | this.baseDN.getNumComponents()); |
| | | this.baseDN.size()); |
| | | byte[] suffix = Arrays.copyOf(entryDNKey, entryDNKey.length+1); |
| | | suffix[suffix.length-1] = 0x00; |
| | | |
| | |
| | | { |
| | | leafDNKey = |
| | | new DatabaseEntry(JebFormat.dnToDNKey( |
| | | targetDN, this.baseDN.getNumComponents())); |
| | | targetDN, this.baseDN.size())); |
| | | } |
| | | DatabaseEntry value = new DatabaseEntry(); |
| | | OperationStatus status; |
| | |
| | | * downwards. |
| | | */ |
| | | byte[] currentDNKey = JebFormat.dnToDNKey(currentDN, |
| | | this.baseDN.getNumComponents()); |
| | | this.baseDN.size()); |
| | | byte[] suffix = Arrays.copyOf(currentDNKey, currentDNKey.length+1); |
| | | suffix[suffix.length-1] = 0x00; |
| | | |
| | |
| | | |
| | | // Construct the new DN of the entry. |
| | | DN newDN = modDN(oldEntry.getDN(), |
| | | currentDN.getNumComponents(), |
| | | currentDN.size(), |
| | | entry.getDN()); |
| | | |
| | | // Assign a new entry ID if we are renumbering. |
| | |
| | | */ |
| | | public static DN modDN(DN oldDN, int oldSuffixLen, DN newSuffixDN) |
| | | { |
| | | int oldDNNumComponents = oldDN.getNumComponents(); |
| | | int oldDNNumComponents = oldDN.size(); |
| | | int oldDNKeepComponents = oldDNNumComponents - oldSuffixLen; |
| | | int newSuffixDNComponents = newSuffixDN.getNumComponents(); |
| | | int newSuffixDNComponents = newSuffixDN.size(); |
| | | |
| | | RDN[] newDNComponents = new RDN[oldDNKeepComponents+newSuffixDNComponents]; |
| | | for (int i=0; i < oldDNKeepComponents; i++) |
| | |
| | | { |
| | | return null; |
| | | } |
| | | return dn.getParent(); |
| | | return dn.parent(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | { |
| | | if(buffer.length() > 0) |
| | | { |
| | | dn = dn.concat(RDN.decode(buffer.toString())); |
| | | dn = dn.child(RDN.decode(buffer.toString())); |
| | | buffer.clear(); |
| | | } |
| | | } |
| | |
| | | |
| | | if(buffer.length() > 0) |
| | | { |
| | | dn = dn.concat(RDN.decode(buffer.toString())); |
| | | dn = dn.child(RDN.decode(buffer.toString())); |
| | | } |
| | | |
| | | return dn; |
| | |
| | | public static byte[] dnToDNKey(DN dn, int prefixRDNs) |
| | | { |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (int i = dn.getNumComponents() - prefixRDNs - 1; i >= 0; i--) |
| | | for (int i = dn.size() - prefixRDNs - 1; i >= 0; i--) |
| | | { |
| | | buffer.append('\u0000'); |
| | | formatRDNKey(dn.getRDN(i), buffer); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | import com.sleepycat.je.*; |
| | |
| | | else |
| | | { |
| | | if (!Arrays.equals(JebFormat.dnToDNKey( |
| | | entry.getDN(), verifyConfig.getBaseDN().getNumComponents()), |
| | | entry.getDN(), verifyConfig.getBaseDN().size()), |
| | | key.getData())) |
| | | { |
| | | errorCount++; |
| | |
| | | } |
| | | |
| | | if (!childEntry.getDN().isDescendantOf(entry.getDN()) || |
| | | childEntry.getDN().getNumComponents() != |
| | | entry.getDN().getNumComponents() + 1) |
| | | childEntry.getDN().size() != |
| | | entry.getDN().size() + 1) |
| | | { |
| | | errorCount++; |
| | | if (debugEnabled()) |
| | |
| | | { |
| | | byte[] bytes = |
| | | JebFormat.dnToDNKey(excludedDN, suffix.getBaseDN() |
| | | .getNumComponents()); |
| | | .size()); |
| | | key.setData(bytes); |
| | | status = cursor.getSearchKeyRange(key, data, lockMode); |
| | | if (status == OperationStatus.SUCCESS |
| | |
| | | if (includeBranch.isDescendantOf(suffix.getBaseDN())) |
| | | { |
| | | includeBranches.add(JebFormat.dnToDNKey(includeBranch, suffix |
| | | .getBaseDN().getNumComponents())); |
| | | .getBaseDN().size())); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | DN2ID dn2id = suffix.getDN2ID(); |
| | | byte[] dnBytes = |
| | | JebFormat.dnToDNKey(dn, suffix.getBaseDN().getNumComponents()); |
| | | JebFormat.dnToDNKey(dn, suffix.getBaseDN().size()); |
| | | int id = |
| | | processKey(dn2id, dnBytes, entryID, indexComparator, new IndexKey( |
| | | dnType, ImportIndexType.DN, 1), true); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.task; |
| | | |
| | |
| | | taskRootDN.toString(); |
| | | try |
| | | { |
| | | recurringTaskParentDN = DN.decode(recurringTaskBaseString); |
| | | recurringTaskParentDN = DN.valueOf(recurringTaskBaseString); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | taskRootDN.toString(); |
| | | try |
| | | { |
| | | scheduledTaskParentDN = DN.decode(scheduledTaskBaseString); |
| | | scheduledTaskParentDN = DN.valueOf(scheduledTaskBaseString); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.config; |
| | | import org.opends.messages.Message; |
| | |
| | | // Make sure that it can be parsed as a DN. |
| | | try |
| | | { |
| | | DN.decode(value.getValue().toString()); |
| | | DN.valueOf(value.getValue().toString()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode(valueString); |
| | | dn = DN.valueOf(valueString); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode(v.getValue().toString()); |
| | | dn = DN.valueOf(v.getValue().toString()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode(v.getValue().toString()); |
| | | dn = DN.valueOf(v.getValue().toString()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode((String) value); |
| | | dn = DN.valueOf((String) value); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode(valueStr); |
| | | dn = DN.valueOf(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | import org.opends.messages.Message; |
| | |
| | | ResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | |
| | | previousDN = DN.decode(reader.readOctetStringAsString()); |
| | | previousDN = DN.valueOf(reader.readOctetStringAsString()); |
| | | } |
| | | if(reader.hasNextElement() && |
| | | reader.peekType() == UNIVERSAL_INTEGER_TYPE) |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.controls; |
| | |
| | | String lowerAuthzIDString = authzIDString.toLowerCase(); |
| | | //Make sure authzId starts with "dn:" and is a valid DN. |
| | | if (lowerAuthzIDString.startsWith("dn:")) |
| | | authzDN = DN.decode(authzIDString.substring(3)); |
| | | authzDN = DN.valueOf(authzIDString.substring(3)); |
| | | else { |
| | | Message message = INFO_GETEFFECTIVERIGHTS_INVALID_AUTHZID.get( |
| | | lowerAuthzIDString); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | throws DirectoryException |
| | | { |
| | | DN authzDN = getAuthorizationDN(); |
| | | if (authzDN.isNullDN()) |
| | | if (authzDN.isRootDN()) |
| | | { |
| | | return null; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | { |
| | | // It's a DN, so decode it and see if it exists. If it's the null DN, |
| | | // then just assume that it does. |
| | | DN authzDN = DN.decode(lowerAuthzID.substring(3)); |
| | | if (authzDN.isNullDN()) |
| | | DN authzDN = DN.valueOf(lowerAuthzID.substring(3)); |
| | | if (authzDN.isRootDN()) |
| | | { |
| | | return null; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | // This is fine. This entry is one of the configured suffixes. |
| | | return; |
| | | } |
| | | if (entryDN.isNullDN()) |
| | | if (entryDN.isRootDN()) |
| | | { |
| | | // This is not fine. The root DSE cannot be added. |
| | | setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import java.util.HashSet; |
| | |
| | | builder.replace(oldDNIndex, builder.length(), |
| | | newDNString); |
| | | String newAuthNDNString = builder.toString(); |
| | | newAuthNDN = DN.decode(newAuthNDNString); |
| | | newAuthNDN = DN.valueOf(newAuthNDNString); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | builder.replace(oldDNIndex, builder.length(), |
| | | newDNString); |
| | | String newAuthZDNString = builder.toString(); |
| | | newAuthZDN = DN.decode(newAuthZDNString); |
| | | newAuthZDN = DN.valueOf(newAuthZDNString); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | ConfigEntry backendRoot; |
| | | try |
| | | { |
| | | DN configEntryDN = DN.decode(ConfigConstants.DN_BACKEND_BASE); |
| | | DN configEntryDN = DN.valueOf(ConfigConstants.DN_BACKEND_BASE); |
| | | backendRoot = DirectoryServer.getConfigEntry(configEntryDN); |
| | | } |
| | | catch (Exception e) |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.core; |
| | |
| | | // backend must also be subordinate to the same base DN. |
| | | Backend superiorBackend = null; |
| | | DN superiorBaseDN ; |
| | | DN parentDN = baseDN.getParent(); |
| | | DN parentDN = baseDN.parent(); |
| | | while (parentDN != null) |
| | | { |
| | | if (baseDNs.containsKey(parentDN)) |
| | |
| | | break; |
| | | } |
| | | |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } |
| | | |
| | | if (superiorBackend == null) |
| | |
| | | for (DN dn : baseDNs.keySet()) |
| | | { |
| | | Backend b = baseDNs.get(dn); |
| | | parentDN = dn.getParent(); |
| | | parentDN = dn.parent(); |
| | | while (parentDN != null) |
| | | { |
| | | if (parentDN.equals(baseDN)) |
| | |
| | | break; |
| | | } |
| | | |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | // Issue #3502 has been logged to track this request. |
| | | boolean isInConfig; |
| | | try { |
| | | isInConfig = bindDN.isDescendantOf(DN.decode(DN_CONFIG_ROOT)); |
| | | isInConfig = bindDN.isDescendantOf(DN.valueOf(DN_CONFIG_ROOT)); |
| | | } catch (DirectoryException ex) { |
| | | // can not happen |
| | | isInConfig = false; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2013 ForgeRock AS. |
| | | * Portions Copyright 2010-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | DN dn = DN.decode(dnStr); |
| | | DN dn = DN.valueOf(dnStr); |
| | | for (ConfigAddListener listener : addListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(dn).registerAddListener(listener); |
| | |
| | | { |
| | | try |
| | | { |
| | | DN dn = DN.decode(dnStr); |
| | | DN dn = DN.valueOf(dnStr); |
| | | for (ConfigDeleteListener listener : deleteListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(dn).registerDeleteListener(listener); |
| | |
| | | { |
| | | try |
| | | { |
| | | DN dn = DN.decode(dnStr); |
| | | DN dn = DN.valueOf(dnStr); |
| | | for (ConfigChangeListener listener : changeListeners.get(dnStr)) |
| | | { |
| | | configHandler.getConfigEntry(dn).registerChangeListener(listener); |
| | |
| | | registerWorkflowWithInternalNetworkGroup(workflowImpl); |
| | | // Special case for cn=config |
| | | // it must not be added to the default ng except in auto mode |
| | | if (!curBaseDN.equals(DN.decode(DN_CONFIG_ROOT)) |
| | | if (!curBaseDN.equals(DN.valueOf(DN_CONFIG_ROOT)) |
| | | || workflowConfigurationModeIsAuto()) { |
| | | registerWorkflowWithDefaultNetworkGroup(workflowImpl); |
| | | } |
| | |
| | | */ |
| | | public static Backend getBackend(DN entryDN) |
| | | { |
| | | if (entryDN.isNullDN()) |
| | | if (entryDN.isRootDN()) |
| | | { |
| | | return directoryServer.rootDSEBackend; |
| | | } |
| | |
| | | Backend b = baseDNs.get(entryDN); |
| | | while (b == null) |
| | | { |
| | | entryDN = entryDN.getParent(); |
| | | entryDN = entryDN.parent(); |
| | | if (entryDN == null) |
| | | { |
| | | return null; |
| | |
| | | // the workflow in manual mode because in that case the workflows |
| | | // are created explicitly. |
| | | if (workflowConfigurationModeIsAuto() |
| | | && !baseDN.equals(DN.decode("cn=config"))) |
| | | && !baseDN.equals(DN.valueOf("cn=config"))) |
| | | { |
| | | // Now create a workflow for the registered baseDN and register |
| | | // the workflow with the default network group, but don't register |
| | |
| | | throws DirectoryException |
| | | { |
| | | // If the entry is the root DSE, then get and return that. |
| | | if (entryDN.isNullDN()) |
| | | if (entryDN.isRootDN()) |
| | | { |
| | | return directoryServer.rootDSEBackend.getRootDSE(); |
| | | } |
| | |
| | | throws DirectoryException |
| | | { |
| | | // If the entry is the root DSE, then it will always exist. |
| | | if (entryDN.isNullDN()) |
| | | if (entryDN.isRootDN()) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | { |
| | | // The config handler hasn't been initialized yet. Just return the DN |
| | | // of the root DSE. |
| | | return DN.nullDN(); |
| | | return DN.rootDN(); |
| | | } |
| | | |
| | | return configHandler.getConfigRootEntry().getDN(); |
| | |
| | | |
| | | // This could theoretically happen if an alert needs to be sent before the |
| | | // configuration is initialized. In that case, just return an empty DN. |
| | | return DN.nullDN(); |
| | | return DN.rootDN(); |
| | | } |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | // Get a complete DN which could be a tree naming schema |
| | | return DN.decode("cn="+monitorName+","+DN_MONITOR_ROOT); |
| | | return DN.valueOf("cn="+monitorName+","+DN_MONITOR_ROOT); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | import org.opends.messages.Message; |
| | |
| | | // Get the base entry cache configuration entry. |
| | | ConfigEntry entryCacheBase; |
| | | try { |
| | | DN configEntryDN = DN.decode(ConfigConstants.DN_ENTRY_CACHE_BASE); |
| | | DN configEntryDN = DN.valueOf(ConfigConstants.DN_ENTRY_CACHE_BASE); |
| | | entryCacheBase = DirectoryServer.getConfigEntry(configEntryDN); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) |
| | |
| | | // Install and register the monitor for this cache. |
| | | EntryCacheMonitorProvider monitor = |
| | | new EntryCacheMonitorProvider(configuration.dn(). |
| | | getRDN().getAttributeValue(0).toString(), entryCache); |
| | | rdn().getAttributeValue(0).toString(), entryCache); |
| | | try { |
| | | monitor.initializeMonitorProvider((EntryCacheMonitorProviderCfg) |
| | | rootConfiguration.getMonitorProvider( |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | */ |
| | | public GroupManager() throws DirectoryException |
| | | { |
| | | super(DN.decode(CONFIG_DN), EnumSet.of( |
| | | super(DN.valueOf(CONFIG_DN), EnumSet.of( |
| | | PluginType.POST_OPERATION_ADD, |
| | | PluginType.POST_OPERATION_DELETE, |
| | | PluginType.POST_OPERATION_MODIFY, |
| | |
| | | DN groupDN; |
| | | try |
| | | { |
| | | groupDN = DN.decode(groupDNString); |
| | | groupDN = DN.valueOf(groupDNString); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | parentDN = newSuperior; |
| | | } |
| | | |
| | | if ((parentDN == null) || parentDN.isNullDN()) |
| | | if ((parentDN == null) || parentDN.isRootDN()) |
| | | { |
| | | setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | appendErrorMessage(ERR_MODDN_NO_PARENT.get(String.valueOf(entryDN))); |
| | | } |
| | | newDN = parentDN.concat(getNewRDN()); |
| | | newDN = parentDN.child(getNewRDN()); |
| | | } |
| | | return newDN; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | } |
| | | break; |
| | | case SINGLE_LEVEL: |
| | | if (!baseDN.equals(oldEntry.getDN().getParent())) |
| | | if (!baseDN.equals(oldEntry.getDN().parent())) |
| | | { |
| | | return; |
| | | } |
| | |
| | | |
| | | break; |
| | | case SINGLE_LEVEL: |
| | | oldMatches = baseDN.equals(oldDN.getParent()); |
| | | newMatches = baseDN.equals(entry.getDN().getParent()); |
| | | oldMatches = baseDN.equals(oldDN.parent()); |
| | | newMatches = baseDN.equals(entry.getDN().parent()); |
| | | |
| | | if (!(oldMatches || newMatches)) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | { |
| | | DN dn = p.getPluginEntryDN(); |
| | | String lowerName = |
| | | toLowerCase(dn.getRDN().getAttributeValue(0).getValue().toString()); |
| | | toLowerCase(dn.rdn().getAttributeValue(0).getValue().toString()); |
| | | if (initialPluginNames.contains(lowerName)) |
| | | { |
| | | initialPlugins.put(lowerName, p); |
| | |
| | | // the correct category. |
| | | DN dn = plugin.getPluginEntryDN(); |
| | | String lowerName = |
| | | toLowerCase(dn.getRDN().getAttributeValue(0).getValue().toString()); |
| | | toLowerCase(dn.rdn().getAttributeValue(0).getValue().toString()); |
| | | if (initialPluginNames.contains(lowerName)) |
| | | { |
| | | initialPlugins.put(lowerName, plugin); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | */ |
| | | public SubentryManager() throws DirectoryException |
| | | { |
| | | super(DN.decode(CONFIG_DN), EnumSet.of( |
| | | super(DN.valueOf(CONFIG_DN), EnumSet.of( |
| | | PluginType.PRE_OPERATION_ADD, |
| | | PluginType.PRE_OPERATION_DELETE, |
| | | PluginType.PRE_OPERATION_MODIFY, |
| | |
| | | try |
| | | { |
| | | for (DN subDN = dn; subDN != null; |
| | | subDN = subDN.getParent()) |
| | | subDN = subDN.parent()) |
| | | { |
| | | List<SubEntry> subList = dn2SubEntry.get(subDN); |
| | | if (subList != null) |
| | |
| | | try |
| | | { |
| | | for (DN subDN = entry.getDN(); subDN != null; |
| | | subDN = subDN.getParent()) |
| | | subDN = subDN.parent()) |
| | | { |
| | | List<SubEntry> subList = dn2SubEntry.get(subDN); |
| | | if (subList != null) |
| | |
| | | try |
| | | { |
| | | for (DN subDN = dn; subDN != null; |
| | | subDN = subDN.getParent()) |
| | | subDN = subDN.parent()) |
| | | { |
| | | List<SubEntry> subList = dn2CollectiveSubEntry.get(subDN); |
| | | if (subList != null) |
| | |
| | | try |
| | | { |
| | | for (DN subDN = entry.getDN(); subDN != null; |
| | | subDN = subDN.getParent()) |
| | | subDN = subDN.parent()) |
| | | { |
| | | List<SubEntry> subList = dn2CollectiveSubEntry.get(subDN); |
| | | if (subList != null) |
| | |
| | | newDNString); |
| | | String subentryDNString = builder.toString(); |
| | | newEntry = subentry.getEntry().duplicate(false); |
| | | newEntry.setDN(DN.decode(subentryDNString)); |
| | | newEntry.setDN(DN.valueOf(subentryDNString)); |
| | | addSubEntry(newEntry); |
| | | } |
| | | catch (Exception e) |
| | |
| | | newDNString); |
| | | String subentryDNString = builder.toString(); |
| | | newEntry = subentry.getEntry().duplicate(false); |
| | | newEntry.setDN(DN.decode(subentryDNString)); |
| | | newEntry.setDN(DN.valueOf(subentryDNString)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | try |
| | | { |
| | | String name = rule.getAttributeType().getNameOrOID(); |
| | | return DN.decode("cn=" + name + ",cn=Virtual Attributes,cn=config"); |
| | | return DN.valueOf("cn=" + name + ",cn=Virtual Attributes,cn=config"); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | { |
| | | // The ID of the workflow to create |
| | | String workflowId = |
| | | workflowCfg.dn().getRDN().getAttributeValue(0).toString(); |
| | | workflowCfg.dn().rdn().getAttributeValue(0).toString(); |
| | | |
| | | // Create the root workflow element to associate with the workflow |
| | | String rootWorkflowElementID = workflowCfg.getWorkflowElement(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | // If the new search scope is 'base' and the search base DN does not |
| | | // map the subordinate workflow then skip the subordinate workflow. |
| | | if ((newScope == SearchScope.BASE_OBJECT) |
| | | && !subordinateDN.getParent().equals(originalBaseDN)) |
| | | && !subordinateDN.parent().equals(originalBaseDN)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | String workflowID = this.getWorkflowImpl().getWorkflowId(); |
| | | sb.append(leftMargin + "Workflow ID = " + workflowID + "\n"); |
| | | sb.append(leftMargin + " baseDN:["); |
| | | if (baseDN.isNullDN()) |
| | | if (baseDN.isRootDN()) |
| | | { |
| | | sb.append(" \"\""); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | private static String getNameFromConfiguration(NetworkGroupCfg configuration) |
| | | { |
| | | DN dn = configuration.dn(); |
| | | return dn.getRDN().getAttributeValue(0).toString(); |
| | | return dn.rdn().getAttributeValue(0).toString(); |
| | | } |
| | | |
| | | |
| | |
| | | return workflow; |
| | | } |
| | | |
| | | if (baseDN.isNullDN()) |
| | | if (baseDN.isRootDN()) |
| | | { |
| | | // deregister the rootDSE |
| | | deregisterWorkflow(rootDSEWorkflowNode); |
| | |
| | | Workflow workflowCandidate = null; |
| | | |
| | | // get the list of workflow candidates |
| | | if (baseDN.isNullDN()) |
| | | if (baseDN.isRootDN()) |
| | | { |
| | | // The rootDSE workflow is the candidate. |
| | | workflowCandidate = rootDSEWorkflowNode; |
| | |
| | | { |
| | | // Is it the rootDSE workflow? |
| | | DN baseDN = workflow.getBaseDN(); |
| | | if (baseDN.isNullDN()) |
| | | if (baseDN.isRootDN()) |
| | | { |
| | | // NOTE - The rootDSE workflow is stored with the |
| | | // registeredWorkflows. |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2009 Parametric Technology Corporation (PTC) |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.crypto; |
| | | |
| | |
| | | |
| | | try { |
| | | localTruststoreDN |
| | | = DN.decode(ConfigConstants.DN_TRUST_STORE_ROOT); |
| | | DN adminSuffixDN = DN.decode( |
| | | = DN.valueOf(ConfigConstants.DN_TRUST_STORE_ROOT); |
| | | DN adminSuffixDN = DN.valueOf( |
| | | ADSContext.getAdministrationSuffixDN()); |
| | | instanceKeysDN = adminSuffixDN.concat( |
| | | DN.decode("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.concat( |
| | | DN.decode("cn=secret keys")); |
| | | serversDN = adminSuffixDN.concat( |
| | | DN.decode("cn=Servers")); |
| | | instanceKeysDN = adminSuffixDN.child( |
| | | DN.valueOf("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.child( |
| | | DN.valueOf("cn=secret keys")); |
| | | serversDN = adminSuffixDN.child( |
| | | DN.valueOf("cn=Servers")); |
| | | } |
| | | catch (DirectoryException ex) { |
| | | if (debugEnabled()) { |
| | |
| | | // Construct the key entry DN. |
| | | final AttributeValue distinguishedValue = AttributeValues.create( |
| | | attrKeyID, ConfigConstants.ADS_CERTIFICATE_ALIAS); |
| | | final DN entryDN = localTruststoreDN.concat( |
| | | final DN entryDN = localTruststoreDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | // Construct the search filter. |
| | | final String FILTER_OC_INSTANCE_KEY = |
| | |
| | | // Construct the key entry DN. |
| | | final AttributeValue distinguishedValue = |
| | | AttributeValues.create(attrKeyID, instanceKeyID); |
| | | final DN entryDN = instanceKeysDN.concat( |
| | | final DN entryDN = instanceKeysDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | // Construct the search filter. |
| | | final String FILTER_OC_INSTANCE_KEY = |
| | |
| | | AttributeValue distinguishedValue = |
| | | AttributeValues.create(attrKeyID, |
| | | keyEntry.getKeyID().getStringValue()); |
| | | DN entryDN = secretKeysDN.concat( |
| | | DN entryDN = secretKeysDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | |
| | | // Set the entry object classes. |
| | |
| | | AttributeValue distinguishedValue = |
| | | AttributeValues.create(attrKeyID, |
| | | keyEntry.getKeyID().getStringValue()); |
| | | DN entryDN = secretKeysDN.concat( |
| | | DN entryDN = secretKeysDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | |
| | | // Set the entry object classes. |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.crypto; |
| | |
| | | |
| | | try |
| | | { |
| | | adminSuffixDN = DN.decode(ADSContext.getAdministrationSuffixDN()); |
| | | instanceKeysDN = adminSuffixDN.concat(DN.decode("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.concat(DN.decode("cn=secret keys")); |
| | | trustStoreRootDN = DN.decode(ConfigConstants.DN_TRUST_STORE_ROOT); |
| | | adminSuffixDN = DN.valueOf(ADSContext.getAdministrationSuffixDN()); |
| | | instanceKeysDN = adminSuffixDN.child(DN.valueOf("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.child(DN.valueOf("cn=secret keys")); |
| | | trustStoreRootDN = DN.valueOf(ConfigConstants.DN_TRUST_STORE_ROOT); |
| | | keySearchFilter = |
| | | SearchFilter.createFilterFromString("(|" + |
| | | "(objectclass=" + OC_CRYPTO_INSTANCE_KEY + ")" + |
| | |
| | | private void handleInstanceKeySearchEntry(SearchResultEntry searchEntry) |
| | | throws DirectoryException |
| | | { |
| | | RDN srcRDN = searchEntry.getDN().getRDN(); |
| | | RDN srcRDN = searchEntry.getDN().rdn(); |
| | | |
| | | // Only process the entry if it has the expected form of RDN. |
| | | if (!srcRDN.isMultiValued() && |
| | | srcRDN.getAttributeType(0).equals(attrAlias)) |
| | | { |
| | | DN dstDN = trustStoreRootDN.concat(srcRDN); |
| | | DN dstDN = trustStoreRootDN.child(srcRDN); |
| | | |
| | | // Extract any change notification control. |
| | | EntryChangeNotificationControl ecn = null; |
| | |
| | | |
| | | private void handleInstanceKeyAddOperation(Entry entry) |
| | | { |
| | | RDN srcRDN = entry.getDN().getRDN(); |
| | | RDN srcRDN = entry.getDN().rdn(); |
| | | |
| | | // Only process the entry if it has the expected form of RDN. |
| | | if (!srcRDN.isMultiValued() && |
| | | srcRDN.getAttributeType(0).equals(attrAlias)) |
| | | { |
| | | DN dstDN = trustStoreRootDN.concat(srcRDN); |
| | | DN dstDN = trustStoreRootDN.child(srcRDN); |
| | | |
| | | if (!entry.hasAttribute(attrCompromisedTime)) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | RDN srcRDN = entry.getDN().getRDN(); |
| | | RDN srcRDN = entry.getDN().rdn(); |
| | | |
| | | // Only process the entry if it has the expected form of RDN. |
| | | // FIXME: Technically it is possible to perform a subtree in |
| | |
| | | if (!srcRDN.isMultiValued() && |
| | | srcRDN.getAttributeType(0).equals(attrAlias)) |
| | | { |
| | | DN dstDN = trustStoreRootDN.concat(srcRDN); |
| | | DN dstDN = trustStoreRootDN.child(srcRDN); |
| | | |
| | | deleteEntry(dstDN); |
| | | } |
| | |
| | | |
| | | private void handleInstanceKeyModifyOperation(Entry newEntry) |
| | | { |
| | | RDN srcRDN = newEntry.getDN().getRDN(); |
| | | RDN srcRDN = newEntry.getDN().rdn(); |
| | | |
| | | // Only process the entry if it has the expected form of RDN. |
| | | if (!srcRDN.isMultiValued() && |
| | | srcRDN.getAttributeType(0).equals(attrAlias)) |
| | | { |
| | | DN dstDN = trustStoreRootDN.concat(srcRDN); |
| | | DN dstDN = trustStoreRootDN.child(srcRDN); |
| | | |
| | | // Get any existing local trust store entry. |
| | | Entry dstEntry = null; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | DN userDN; |
| | | try |
| | | { |
| | | userDN = DN.decode(userName.substring(3)); |
| | | userDN = DN.valueOf(userName.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (userDN.isNullDN()) |
| | | if (userDN.isRootDN()) |
| | | { |
| | | bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | // Make sure that the DN of this entry is equal to the config root DN. |
| | | try |
| | | { |
| | | DN configRootDN = DN.decode(DN_CONFIG_ROOT); |
| | | DN configRootDN = DN.valueOf(DN_CONFIG_ROOT); |
| | | if (! entry.getDN().equals(configRootDN)) |
| | | { |
| | | Message message = ERR_CONFIG_FILE_INVALID_BASE_DN.get( |
| | |
| | | |
| | | |
| | | // Make sure that the parent DN of the entry read does exist. |
| | | DN parentDN = entryDN.getParent(); |
| | | DN parentDN = entryDN.parent(); |
| | | if (parentDN == null) |
| | | { |
| | | close(reader); |
| | |
| | | |
| | | |
| | | // Make sure that the entry's parent exists. If it does not, then fail. |
| | | DN parentDN = entryDN.getParent(); |
| | | DN parentDN = entryDN.parent(); |
| | | if (parentDN == null) |
| | | { |
| | | // The entry DN doesn't have a parent. This is not allowed. |
| | |
| | | |
| | | // Get the matched DN, if possible. |
| | | DN matchedDN = null; |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | while (parentDN != null) |
| | | { |
| | | if (configEntries.containsKey(parentDN)) |
| | |
| | | break; |
| | | } |
| | | |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } |
| | | |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message, |
| | |
| | | DN matchedDN = null; |
| | | if (entryDN.isDescendantOf(configRootEntry.getDN())) |
| | | { |
| | | DN parentDN = entryDN.getParent(); |
| | | DN parentDN = entryDN.parent(); |
| | | while (parentDN != null) |
| | | { |
| | | if (configEntries.containsKey(parentDN)) |
| | |
| | | break; |
| | | } |
| | | |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } |
| | | } |
| | | |
| | |
| | | DN matchedDN = null; |
| | | if (entryDN.isDescendantOf(configRootEntry.getDN())) |
| | | { |
| | | DN parentDN = entryDN.getParent(); |
| | | DN parentDN = entryDN.parent(); |
| | | while (parentDN != null) |
| | | { |
| | | if (configEntries.containsKey(parentDN)) |
| | |
| | | break; |
| | | } |
| | | |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } |
| | | } |
| | | |
| | |
| | | DN matchedDN = null; |
| | | if (baseDN.isDescendantOf(configRootEntry.getDN())) |
| | | { |
| | | DN parentDN = baseDN.getParent(); |
| | | DN parentDN = baseDN.parent(); |
| | | while (parentDN != null) |
| | | { |
| | | if (configEntries.containsKey(parentDN)) |
| | |
| | | break; |
| | | } |
| | | |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | // Get the entry DN from the map by its ID. If it isn't present, |
| | | // then return null. |
| | | entryDN = DN.decode(map.get(entryID)); |
| | | entryDN = DN.valueOf(map.get(entryID)); |
| | | } |
| | | } catch (Exception e) { |
| | | // Ignore. |
| | |
| | | backendEntriesMap.keySet().iterator(); |
| | | while (backendEntriesIterator.hasNext()) { |
| | | Long entryID = backendEntriesIterator.next(); |
| | | DN entryDN = DN.decode(backendEntriesMap.get(entryID)); |
| | | DN entryDN = DN.valueOf(backendEntriesMap.get(entryID)); |
| | | entryCacheDB.delete(null, new DatabaseEntry( |
| | | entryDN.toNormalizedString().getBytes("UTF-8"))); |
| | | backendEntriesIterator.remove(); |
| | |
| | | while (iterator.hasNext()) |
| | | { |
| | | try { |
| | | DN entryDN = DN.decode(iterator.next()); |
| | | DN entryDN = DN.valueOf(iterator.next()); |
| | | if (entryDN.isDescendantOf(baseDN)) { |
| | | iterator.remove(); |
| | | entryCacheIndex.dnMap.remove(entryDN.toNormalizedString()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | import org.opends.server.types.ByteString; |
| | |
| | | break; |
| | | |
| | | case SINGLE_LEVEL: |
| | | if (! baseDN.equals(nextDN.getParent())) |
| | | if (! baseDN.equals(nextDN.parent())) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | AcceptRejectWarn structuralPolicy, |
| | | Entry entry) |
| | | { |
| | | RDN rdn = entry.getDN().getRDN(); |
| | | RDN rdn = entry.getDN().rdn(); |
| | | if (rdn != null) |
| | | { |
| | | // Make sure that all the required attributes are present. |
| | |
| | | * |
| | | * |
| | | * Copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public Connection getConnection() throws DirectoryException |
| | | { |
| | | final Connection connection = factory.getConnection(); |
| | | if (username != null && !username.isNullDN() && password != null |
| | | if (username != null && !username.isRootDN() && password != null |
| | | && password.length() > 0) |
| | | { |
| | | try |
| | |
| | | final String mappedSearchPassword; |
| | | if (cfg.getMappingPolicy() == MappingPolicy.MAPPED_SEARCH |
| | | && cfg.getMappedSearchBindDN() != null |
| | | && !cfg.getMappedSearchBindDN().isNullDN()) |
| | | && !cfg.getMappedSearchBindDN().isRootDN()) |
| | | { |
| | | mappedSearchPassword = getMappedSearchBindPassword(cfg, |
| | | new LinkedList<Message>()); |
| | |
| | | // Ensure that the search bind password is defined somewhere. |
| | | if (cfg.getMappingPolicy() == MappingPolicy.MAPPED_SEARCH |
| | | && cfg.getMappedSearchBindDN() != null |
| | | && !cfg.getMappedSearchBindDN().isNullDN()) |
| | | && !cfg.getMappedSearchBindDN().isRootDN()) |
| | | { |
| | | if (getMappedSearchBindPassword(cfg, unacceptableReasons) == null) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | userDN = DN.decode(authzIDStr.substring(3)); |
| | | userDN = DN.valueOf(authzIDStr.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | userDN = DN.decode(authzIDStr); |
| | | userDN = DN.valueOf(authzIDStr); |
| | | } |
| | | catch (DirectoryException ignored) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (userDN != null && !userDN.isNullDN()) { |
| | | if (userDN != null && !userDN.isRootDN()) { |
| | | // If the provided DN is an alternate DN for a root user, |
| | | // then replace it with the actual root DN. |
| | | DN actualRootDN = DirectoryServer.getActualRootBindDN(userDN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | DN userDN; |
| | | try |
| | | { |
| | | userDN = DN.decode(authcID.substring(3)); |
| | | userDN = DN.valueOf(authcID.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (userDN.isNullDN()) |
| | | if (userDN.isRootDN()) |
| | | { |
| | | bindOperation.setResultCode(ResultCode.INVALID_CREDENTIALS); |
| | | |
| | |
| | | DN authzDN; |
| | | try |
| | | { |
| | | authzDN = DN.decode(authzID.substring(3)); |
| | | authzDN = DN.valueOf(authzID.substring(3)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (authzDN.isNullDN()) |
| | | if (authzDN.isRootDN()) |
| | | { |
| | | authZEntry = null; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | authzDN = DN.decode(responseAuthzID.substring(3)); |
| | | authzDN = DN.valueOf(responseAuthzID.substring(3)); |
| | | } |
| | | catch (final DirectoryException e) |
| | | { |
| | |
| | | |
| | | if (!authzDN.equals(authEntry.getDN())) |
| | | { |
| | | if (authzDN.isNullDN()) |
| | | if (authzDN.isRootDN()) |
| | | { |
| | | authzEntry = null; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | e = DirectoryServer.getEntry(DN.nullDN()); |
| | | e = DirectoryServer.getEntry(DN.rootDN()); |
| | | } |
| | | catch (final DirectoryException ex) |
| | | { |
| | |
| | | DN userDN; |
| | | try |
| | | { |
| | | userDN = DN.decode(userName.substring(3)); |
| | | userDN = DN.valueOf(userName.substring(3)); |
| | | } |
| | | catch (final DirectoryException e) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | if (userDN.isNullDN()) |
| | | if (userDN.isRootDN()) |
| | | { |
| | | setCallbackMsg(ERR_SASL_USERNAME_IS_NULL_DN.get(mechanism)); |
| | | return; |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | * Portions Copyright 2013 Manuel Gaupp |
| | | */ |
| | | package org.opends.server.extensions; |
| | |
| | | String peerName = peerPrincipal.getName(X500Principal.RFC2253); |
| | | try |
| | | { |
| | | peerDN = DN.decode(peerName); |
| | | peerDN = DN.valueOf(peerName); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | } |
| | | |
| | | LinkedList<SearchFilter> filterComps = new LinkedList<SearchFilter>(); |
| | | for (int i=0; i < peerDN.getNumComponents(); i++) |
| | | for (int i=0; i < peerDN.size(); i++) |
| | | { |
| | | RDN rdn = peerDN.getRDN(i); |
| | | for (int j=0; j < rdn.getNumValues(); j++) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | DN subjectDN; |
| | | try |
| | | { |
| | | subjectDN = DN.decode(peerPrincipal.getName(X500Principal.RFC2253)); |
| | | subjectDN = DN.valueOf(peerPrincipal.getName(X500Principal.RFC2253)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | * Portions copyright 2011 profiq s.r.o. |
| | | */ |
| | | package org.opends.server.plugins; |
| | |
| | | while((line=reader.readLine()) != null) { |
| | | try { |
| | | String[] a=line.split("[\t]"); |
| | | DN origDn = DN.decode(a[0]); |
| | | DN origDn = DN.valueOf(a[0]); |
| | | //If there is only a single DN string than it must be a delete. |
| | | if(a.length == 1) { |
| | | processDelete(Collections.singleton(origDn), false); |
| | | } else { |
| | | DN movedDN=DN.decode(a[1]); |
| | | DN movedDN=DN.valueOf(a[1]); |
| | | processModifyDN(origDn, movedDN); |
| | | } |
| | | } catch (DirectoryException ex) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2011-2012 profiq s.r.o. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | */ |
| | | final DN authDN = extendedOperation.getAuthorizationDN(); |
| | | final DN sambaAdminDN = config.getSambaAdministratorDN(); |
| | | if (sambaAdminDN != null && !sambaAdminDN.isNullDN()) |
| | | if (sambaAdminDN != null && !sambaAdminDN.isRootDN()) |
| | | { |
| | | if (authDN.equals(sambaAdminDN)) |
| | | { |
| | |
| | | */ |
| | | final DN authDN = modifyOperation.getAuthorizationDN(); |
| | | final DN sambaAdminDN = config.getSambaAdministratorDN(); |
| | | if (sambaAdminDN != null && !sambaAdminDN.isNullDN()) |
| | | if (sambaAdminDN != null && !sambaAdminDN.isRootDN()) |
| | | { |
| | | if (authDN.equals(sambaAdminDN)) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.http; |
| | | |
| | |
| | | { |
| | | if (friendlyName == null) |
| | | { |
| | | friendlyName = config.dn().getRDN().getAttributeValue(0).toString(); |
| | | friendlyName = config.dn().rdn().getAttributeValue(0).toString(); |
| | | } |
| | | |
| | | int listenPort = config.getListenPort(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | operationalAttrs.put(privType, attrList); |
| | | |
| | | |
| | | DN internalUserDN = DN.decode(fullDNString); |
| | | DN internalUserDN = DN.valueOf(fullDNString); |
| | | Entry internalUserEntry = |
| | | new Entry(internalUserDN, objectClasses, userAttrs, |
| | | operationalAttrs); |
| | |
| | | private static AuthenticationInfo getAuthInfoForDN(DN userDN) |
| | | throws DirectoryException |
| | | { |
| | | if ((userDN == null) || userDN.isNullDN()) |
| | | if ((userDN == null) || userDN.isRootDN()) |
| | | { |
| | | return new AuthenticationInfo(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | conn = new InternalClientConnection(DN.nullDN()); |
| | | conn = new InternalClientConnection(DN.rootDN()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | import org.opends.messages.Message; |
| | |
| | | DN bindDN; |
| | | try |
| | | { |
| | | bindDN = DN.decode(authcID); |
| | | bindDN = DN.valueOf(authcID); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | { |
| | | if (friendlyName == null) |
| | | { |
| | | friendlyName = config.dn().getRDN().getAttributeValue(0).toString(); |
| | | friendlyName = config.dn().rdn().getAttributeValue(0).toString(); |
| | | } |
| | | |
| | | // Open the selector. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | else |
| | | { |
| | | matchedDN = DN.decode(dnString); |
| | | matchedDN = DN.valueOf(dnString); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode(reader.readOctetStringAsString()); |
| | | dn = DN.valueOf(reader.readOctetStringAsString()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.common; |
| | | |
| | |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | // There's only a value for the rootDSE, i.e. the Null DN. |
| | | return entry.getDN().isNullDN(); |
| | | return entry.getDN().isRootDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.common; |
| | | |
| | |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | // There's only a value for the rootDSE, i.e. the Null DN. |
| | | return entry.getDN().isNullDN(); |
| | | return entry.getDN().isRootDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.common; |
| | | |
| | |
| | | public boolean hasValue(Entry entry, VirtualAttributeRule rule) |
| | | { |
| | | // There's only a value for the rootDSE, i.e. the Null DN. |
| | | return entry.getDN().isNullDN(); |
| | | return entry.getDN().isRootDN(); |
| | | |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.common; |
| | | |
| | |
| | | serverStateByDomain.update(csn); |
| | | } |
| | | } |
| | | startStates.put(DN.decode(domainBaseDN), serverStateByDomain); |
| | | startStates.put(DN.valueOf(domainBaseDN), serverStateByDomain); |
| | | } |
| | | } |
| | | catch (DirectoryException de) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | if (domain==null) |
| | | { |
| | | DN rdns = DN.decode( |
| | | configuration.dn().getParent().getRDN().getAttributeValue(0). |
| | | configuration.dn().parent().rdn().getAttributeValue(0). |
| | | getNormalizedValue()); |
| | | domain = MultimasterReplication.findDomain(rdns, null); |
| | | } |
| | |
| | | if (domain==null) |
| | | { |
| | | DN rdns = DN.decode( |
| | | configuration.dn().getParent().getRDN().getAttributeValue(0). |
| | | configuration.dn().parent().rdn().getAttributeValue(0). |
| | | getNormalizedValue()); |
| | | domain = MultimasterReplication.findDomain(rdns, null); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | DN dn = entry.getDN(); |
| | | return new ModifyDNMsg(dn, getCSN(), |
| | | EntryHistorical.getEntryUUID(entry), |
| | | LDAPReplicationDomain.findEntryUUID(dn.getParent()), |
| | | false, dn.getParent().toString(), dn.getRDN().toString()); |
| | | LDAPReplicationDomain.findEntryUUID(dn.parent()), |
| | | false, dn.parent().toString(), dn.rdn().toString()); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | // If we get here, local domain fractional configuration is enabled. |
| | | // Now filter for potential attributes to be removed. |
| | | LDAPReplicationDomain.fractionalRemoveAttributesFromEntry( |
| | | localFractionalConfig, entry.getDN().getRDN(), |
| | | localFractionalConfig, entry.getDN().rdn(), |
| | | entry.getObjectClasses(), entry.getUserAttributes(), true); |
| | | |
| | | return PluginResult.ImportLDIF.continueEntryProcessing(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | PreOperationAddOperation addOperation, boolean performFiltering) |
| | | { |
| | | return fractionalRemoveAttributesFromEntry(fractionalConfig, |
| | | addOperation.getEntryDN().getRDN(), addOperation.getObjectClasses(), |
| | | addOperation.getEntryDN().rdn(), addOperation.getObjectClasses(), |
| | | addOperation.getUserAttributes(), performFiltering); |
| | | } |
| | | |
| | |
| | | */ |
| | | |
| | | boolean inconsistentOperation = false; |
| | | RDN rdn = modifyDNOperation.getEntryDN().getRDN(); |
| | | RDN rdn = modifyDNOperation.getEntryDN().rdn(); |
| | | RDN newRdn = modifyDNOperation.getNewRDN(); |
| | | |
| | | // Go through each attribute of the old RDN |
| | |
| | | { |
| | | DN entryDN = entryToRename.getDN(); |
| | | ModifyDNOperation newOp = renameEntry( |
| | | entryDN, freedDN.getRDN(), freedDN.getParent(), false); |
| | | entryDN, freedDN.rdn(), freedDN.parent(), false); |
| | | |
| | | ResultCode res = newOp.getResultCode(); |
| | | if (res != ResultCode.SUCCESS) |
| | |
| | | RDN currentRDN; |
| | | if (currentDN != null) |
| | | { |
| | | currentRDN = currentDN.getRDN(); |
| | | currentRDN = currentDN.rdn(); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | newSuperior = entryDN.getParent(); |
| | | newSuperior = entryDN.parent(); |
| | | } |
| | | |
| | | //If we could not find the new parent entry, we missed this entry |
| | |
| | | // stop the processing. |
| | | if (newSuperior == null) |
| | | { |
| | | markConflictEntry(op, currentDN, currentDN.getParent().concat(newRDN)); |
| | | markConflictEntry(op, currentDN, currentDN.parent().child(newRDN)); |
| | | numUnresolvedNamingConflicts.incrementAndGet(); |
| | | return true; |
| | | } |
| | | |
| | | DN newDN = newSuperior.concat(newRDN); |
| | | DN newDN = newSuperior.child(newRDN); |
| | | |
| | | if (currentDN == null) |
| | | { |
| | |
| | | addConflict(msg); |
| | | |
| | | String conflictRDN = |
| | | generateConflictRDN(entryUUID, op.getEntryDN().getRDN().toString()); |
| | | msg.setDN(DN.decode(conflictRDN + "," + getBaseDNString())); |
| | | generateConflictRDN(entryUUID, op.getEntryDN().rdn().toString()); |
| | | msg.setDN(DN.valueOf(conflictRDN + "," + getBaseDNString())); |
| | | // reset the parent entryUUID so that the check done is the |
| | | // handleConflict phase does not fail. |
| | | msg.setParentEntryUUID(null); |
| | |
| | | } |
| | | else |
| | | { |
| | | msg.setDN(DN.decode(msg.getDN().getRDN() + "," + parentDn)); |
| | | msg.setDN(DN.valueOf(msg.getDN().rdn() + "," + parentDn)); |
| | | numResolvedNamingConflicts.incrementAndGet(); |
| | | } |
| | | return false; |
| | |
| | | addConflict(msg); |
| | | String conflictRDN = |
| | | generateConflictRDN(entryUUID, msg.getDN().toNormalizedString()); |
| | | msg.setDN(DN.decode(conflictRDN)); |
| | | msg.setDN(DN.valueOf(conflictRDN)); |
| | | numUnresolvedNamingConflicts.incrementAndGet(); |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | private RDN generateDeleteConflictDn(String entryUUID, DN dn) |
| | | { |
| | | String newRDN = "entryuuid=" + entryUUID + "+" + dn.getRDN(); |
| | | String newRDN = "entryuuid=" + entryUUID + "+" + dn.rdn(); |
| | | try |
| | | { |
| | | return RDN.decode(newRDN); |
| | |
| | | { |
| | | try |
| | | { |
| | | DN eclConfigEntryDN = DN.decode("cn=external changeLog," + config.dn()); |
| | | DN eclConfigEntryDN = DN.valueOf("cn=external changeLog," + config.dn()); |
| | | if (DirectoryServer.getConfigHandler().entryExists(eclConfigEntryDN)) |
| | | { |
| | | DirectoryServer.getConfigHandler().deleteEntry(eclConfigEntryDN, null); |
| | |
| | | { |
| | | // no ECL config provided hence create a default one |
| | | // create the default one |
| | | DN eclConfigEntryDN = DN.decode("cn=external changelog," + configDn); |
| | | DN eclConfigEntryDN = DN.valueOf("cn=external changelog," + configDn); |
| | | if (!DirectoryServer.getConfigHandler().entryExists(eclConfigEntryDN)) |
| | | { |
| | | // no entry exist yet for the ECL config for this domain |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(1); |
| | | attributes.add(REPLICATION_STATE); |
| | | InternalSearchOperation op = |
| | | conn.processSearch(DN.decode("cn=config"), |
| | | conn.processSearch(DN.valueOf("cn=config"), |
| | | SearchScope.SUBORDINATE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 1, 0, false, filter, attributes); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | |
| | | // Decode the baseDN |
| | | length = getNextLength(in, pos); |
| | | this.baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | this.baseDN = DN.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length + 1; |
| | | |
| | | // Decode the changeNumber |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | |
| | | // baseDN |
| | | int length = getNextLength(in, pos); |
| | | baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | baseDN = DN.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | // sender |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | |
| | | // baseDN |
| | | length = getNextLength(in, pos); |
| | | baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | baseDN = DN.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | // sender |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | |
| | | // Read the dn |
| | | length = getNextLength(encodedMsg, pos); |
| | | dn = DN.decode(new String(encodedMsg, pos, length, "UTF-8")); |
| | | dn = DN.valueOf(new String(encodedMsg, pos, length, "UTF-8")); |
| | | pos += length + 1; |
| | | |
| | | // Read the entryuuid |
| | |
| | | |
| | | // read the dn |
| | | length = getNextLength(encodedMsg, pos); |
| | | dn = DN.decode(new String(encodedMsg, pos, length, "UTF-8")); |
| | | dn = DN.valueOf(new String(encodedMsg, pos, length, "UTF-8")); |
| | | pos += length + 1; |
| | | |
| | | // read the entryuuid |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | { |
| | | if (newSuperior == null) |
| | | { |
| | | DN parentDn = getDN().getParent(); |
| | | return parentDn.concat(RDN.decode(newRDN)); |
| | | DN parentDn = getDN().parent(); |
| | | return parentDn.child(RDN.decode(newRDN)); |
| | | } |
| | | else |
| | | { |
| | | String newStringDN = newRDN + "," + newSuperior; |
| | | return DN.decode(newStringDN); |
| | | return DN.valueOf(newStringDN); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | DN newSuperiorDN = DN.decode(newSuperior); |
| | | DN newSuperiorDN = DN.valueOf(newSuperior); |
| | | return newSuperiorDN.equals(targetDN); |
| | | } catch (DirectoryException e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | * first calculate the length then construct the string |
| | | */ |
| | | int length = getNextLength(in, pos); |
| | | baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | baseDN = DN.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | /* |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | * first calculate the length then construct the string |
| | | */ |
| | | int length = getNextLength(in, pos); |
| | | baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | baseDN = DN.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | /* |
| | |
| | | * first calculate the length then construct the string |
| | | */ |
| | | int length = getNextLength(in, pos); |
| | | baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | baseDN = DN.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | /* |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | * first calculate the length then construct the string |
| | | */ |
| | | int length = getNextLength(in, pos); |
| | | baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | baseDN = DN.valueOf(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | /* |
| | |
| | | super(session, queueSize, replicationServer, rcvWindowSize); |
| | | try |
| | | { |
| | | DN baseDN = DN.decode(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT); |
| | | DN baseDN = DN.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT); |
| | | setBaseDNAndDomain(baseDN, true); |
| | | } |
| | | catch(DirectoryException de) |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | |
| | | for (ReplicationServerDomain domain : domains) |
| | | { |
| | | DN baseDN = DN.decode(domain.getBaseDN() + "," + BASE_DN); |
| | | DN baseDN = DN.valueOf(domain.getBaseDN() + "," + BASE_DN); |
| | | for (DN includeBranch : includeBranches) |
| | | { |
| | | if (includeBranch.isDescendantOf(baseDN) |
| | |
| | | try |
| | | { |
| | | ChangeRecordEntry changeRecord = |
| | | new AddChangeRecordEntry(DN.decode(BASE_DN), attrs); |
| | | new AddChangeRecordEntry(DN.valueOf(BASE_DN), attrs); |
| | | ldifWriter.writeChangeRecord(changeRecord); |
| | | } |
| | | catch (Exception e) { /* do nothing */ } |
| | |
| | | final String dnString = domain.getBaseDN() + "," + BASE_DN; |
| | | try |
| | | { |
| | | DN dn = DN.decode(dnString); |
| | | DN dn = DN.valueOf(dnString); |
| | | ldifWriter.writeChangeRecord(new AddChangeRecordEntry(dn, attrs)); |
| | | } |
| | | catch (Exception e) |
| | |
| | | AddMsg addMsg = (AddMsg)msg; |
| | | AddOperation addOperation = (AddOperation)msg.createOperation(conn); |
| | | |
| | | dn = DN.decode("puid=" + addMsg.getParentEntryUUID() + "+" + |
| | | dn = DN.valueOf("puid=" + addMsg.getParentEntryUUID() + "+" + |
| | | CHANGE_NUMBER + "=" + msg.getCSN() + "+" + |
| | | msg.getDN() + "," + BASE_DN); |
| | | |
| | |
| | | |
| | | private DN computeDN(LDAPUpdateMsg msg) throws DirectoryException |
| | | { |
| | | return DN.decode("uuid=" + msg.getEntryUUID() + "," + CHANGE_NUMBER + "=" |
| | | return DN.valueOf("uuid=" + msg.getEntryUUID() + "," + CHANGE_NUMBER + "=" |
| | | + msg.getCSN() + "," + msg.getDN() + "," + BASE_DN); |
| | | } |
| | | |
| | |
| | | // don't do anything if the search is a base search on the backend suffix. |
| | | try |
| | | { |
| | | DN backendBaseDN = DN.decode(BASE_DN); |
| | | DN backendBaseDN = DN.valueOf(BASE_DN); |
| | | if ( searchOperation.getScope().equals(SearchScope.BASE_OBJECT) && |
| | | backendBaseDN.equals(searchOperation.getBaseDN()) ) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | configuration.addChangeListener(this); |
| | | try |
| | | { |
| | | backendConfigEntryDN = |
| | | DN.decode("ds-cfg-backend-id=" + backendId + ",cn=Backends,cn=config"); |
| | | backendConfigEntryDN = DN.valueOf("ds-cfg-backend-id=" + |
| | | backendId + ",cn=Backends,cn=config"); |
| | | } catch (DirectoryException e) { /* do nothing */ } |
| | | |
| | | // Creates the backend associated to this ReplicationServer |
| | |
| | | |
| | | // Create the workflow for the base DN |
| | | // and register the workflow with the server. |
| | | final DN dn = DN.decode(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT); |
| | | final DN dn = DN.valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT); |
| | | final WorkflowImpl workflowImpl = new WorkflowImpl(eclWorkflowID, dn, |
| | | eclwe.getWorkflowElementID(), eclwe); |
| | | if (!eclWorkflowImpl.compareAndSet(null, workflowImpl)) |
| | |
| | | |
| | | try |
| | | { |
| | | Set<DN> baseDNs = Collections.singleton(DN.decode("")); |
| | | Set<DN> baseDNs = Collections.singleton(DN.valueOf("")); |
| | | Set<DN> groupDNs = Collections.emptySet(); |
| | | Set<SearchFilter> filters = Collections.singleton( |
| | | SearchFilter.createFilterFromString("(objectclass=*)")); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2013 ForgeRock AS. |
| | | * Portions Copyright 2010-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.server.changelog.je; |
| | | |
| | |
| | | { |
| | | String stringData = new String(data, "UTF-8"); |
| | | String[] str = stringData.split(FIELD_SEPARATOR, 3); |
| | | final DN baseDN = DN.decode(str[1]); |
| | | final DN baseDN = DN.valueOf(str[1]); |
| | | final CSN csn = new CSN(str[2]); |
| | | return new ChangeNumberIndexRecord(changeNumber, str[0], baseDN, csn); |
| | | } |
| | |
| | | if (str[0].equals(GENERATION_ID_TAG)) |
| | | { |
| | | long generationId = toLong(str[1]); |
| | | DN baseDN = DN.decode(str[2]); |
| | | DN baseDN = DN.valueOf(str[2]); |
| | | |
| | | if (debugEnabled()) |
| | | debug("has read baseDN=" + baseDN + " generationId=" +generationId); |
| | |
| | | else |
| | | { |
| | | int serverId = toInt(str[0]); |
| | | DN baseDN = DN.decode(str[1]); |
| | | DN baseDN = DN.valueOf(str[1]); |
| | | |
| | | if (debugEnabled()) |
| | | debug("has read: baseDN=" + baseDN + " serverId=" + serverId); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | Aci.decode(value, DN.nullDN()); |
| | | Aci.decode(value, DN.rootDN()); |
| | | } |
| | | catch (AciException e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode(value.toString()); |
| | | dn = DN.valueOf(value.toString()); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | */ |
| | | public DN decode(AttributeValue value) throws DirectoryException |
| | | { |
| | | return DN.decode(value.getValue().toString()); |
| | | return DN.valueOf(value.getValue().toString()); |
| | | } |
| | | }; |
| | | |
| | |
| | | // Use the DN code to make this determination. |
| | | try |
| | | { |
| | | DN.decode(value.toString()); |
| | | DN.valueOf(value.toString()); |
| | | |
| | | return true; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | // Take the DN portion of the string and try to normalize it. |
| | | try |
| | | { |
| | | DN.decode(valueString.substring(0, dnEndPos)); |
| | | DN.valueOf(valueString.substring(0, dnEndPos)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | |
| | | // Use the subtree specification code to make this determination. |
| | | try { |
| | | SubtreeSpecification.valueOf(DN.nullDN(), value.toString()); |
| | | SubtreeSpecification.valueOf(DN.rootDN(), value.toString()); |
| | | |
| | | return true; |
| | | } catch (DirectoryException e) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | StringBuilder valueBuffer = new StringBuilder(valueLength); |
| | | try |
| | | { |
| | | DN dn = DN.decode(valueString.substring(0, dnEndPos)); |
| | | DN dn = DN.valueOf(valueString.substring(0, dnEndPos)); |
| | | dn.toNormalizedString(valueBuffer); |
| | | } |
| | | catch (Exception e) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | import org.opends.messages.Message; |
| | |
| | | { |
| | | Message message = ERR_BACKUPDB_CANNOT_BACKUP_IN_DIRECTORY.get( |
| | | b.getBackendID(),backupLocation.getPath(), |
| | | backupDir.getConfigEntryDN().getRDN(). |
| | | backupDir.getConfigEntryDN().rdn(). |
| | | getAttributeValue(0).toString()); |
| | | logError(message); |
| | | return false ; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | import org.opends.messages.Message; |
| | |
| | | DN excludeBranch; |
| | | try |
| | | { |
| | | excludeBranch = DN.decode(s); |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN includeBranch; |
| | | try |
| | | { |
| | | includeBranch = DN.decode(s); |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | import org.opends.messages.Message; |
| | |
| | | DN includeBranch; |
| | | try |
| | | { |
| | | includeBranch = DN.decode(s); |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN excludeBranch; |
| | | try |
| | | { |
| | | excludeBranch = DN.decode(s); |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN includeBranch; |
| | | try |
| | | { |
| | | includeBranch = DN.decode(s); |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN excludeBranch; |
| | | try |
| | | { |
| | | excludeBranch = DN.decode(s); |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | DN dn = DN.decode(domainString); |
| | | DN dn = DN.valueOf(domainString); |
| | | // We can assume that this is an LDAP replication domain |
| | | domain = LDAPReplicationDomain.retrievesReplicationDomain(dn); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | DN dn = DN.decode(domainString); |
| | | DN dn = DN.valueOf(domainString); |
| | | // We can assume that this is an LDAP replication domain |
| | | domain = LDAPReplicationDomain.retrievesReplicationDomain(dn); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | DN dn = DN.decode(domainString); |
| | | DN dn = DN.valueOf(domainString); |
| | | // We can assume that this is an LDAP replication domain |
| | | domain = LDAPReplicationDomain.retrievesReplicationDomain(dn); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | rebuildConfig.setBaseDN(DN.decode(baseDN)); |
| | | rebuildConfig.setBaseDN(DN.valueOf(baseDN)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | DN dn = DN.decode(domainString); |
| | | DN dn = DN.valueOf(domainString); |
| | | domain = LDAPReplicationDomain.retrievesReplicationDomain(dn); |
| | | } |
| | | catch(DirectoryException e) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | DN backendBaseDN; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | backendBaseDN = DN.valueOf(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | DN backendBaseDN; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | backendBaseDN = DN.valueOf(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | baseDNs.add(DN.decode(dnString)); |
| | | baseDNs.add(DN.valueOf(dnString)); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | rootDN = DN.decode(rootDNString.getValue()); |
| | | rootDN = DN.valueOf(rootDNString.getValue()); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN JCEKSProviderDN = null; |
| | | try |
| | | { |
| | | dn = DN.decode(keyManagerProviderDN.getValue()); |
| | | dn = DN.valueOf(keyManagerProviderDN.getValue()); |
| | | JCEKSProviderDN = |
| | | DN.decode("cn=JCEKS,cn=Key Manager Providers,cn=config"); |
| | | DN.valueOf("cn=JCEKS,cn=Key Manager Providers,cn=config"); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN JCEKSTrustManagerDN = null; |
| | | try |
| | | { |
| | | dn = DN.decode(trustManagerProviderDN.getValue()); |
| | | dn = DN.valueOf(trustManagerProviderDN.getValue()); |
| | | JCEKSTrustManagerDN = |
| | | DN.decode("cn=JCEKS,cn=Trust Manager Providers,cn=config"); |
| | | DN.valueOf("cn=JCEKS,cn=Trust Manager Providers,cn=config"); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | DN jeBackendDN = DN.decode(DN_JE_BACKEND); |
| | | DN jeBackendDN = DN.valueOf(DN_JE_BACKEND); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(jeBackendDN); |
| | | |
| | | DNConfigAttribute baseDNAttr = |
| | |
| | | { |
| | | try |
| | | { |
| | | DN ldapListenerDN = DN.decode(DN_LDAP_CONNECTION_HANDLER); |
| | | DN ldapListenerDN = DN.valueOf(DN_LDAP_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | DN adminConnectorDN = DN.decode(DN_ADMIN_CONNECTOR); |
| | | DN adminConnectorDN = DN.valueOf(DN_ADMIN_CONNECTOR); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(adminConnectorDN); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | DN ldapListenerDN = DN.decode(DN_LDAPS_CONNECTION_HANDLER); |
| | | DN ldapListenerDN = DN.valueOf(DN_LDAPS_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | DN jmxListenerDN = DN.decode(DN_JMX_CONNECTION_HANDLER); |
| | | DN jmxListenerDN = DN.valueOf(DN_JMX_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(jmxListenerDN); |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | DN ldapListenerDN = DN.decode(DN_LDAP_CONNECTION_HANDLER); |
| | | DN ldapListenerDN = DN.valueOf(DN_LDAP_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | |
| | | try |
| | | { |
| | | // Enable the key manager |
| | | DN dn = DN.decode(keyManagerProviderDN.getValue()); |
| | | DN dn = DN.valueOf(keyManagerProviderDN.getValue()); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(dn); |
| | | |
| | | BooleanConfigAttribute enableAttr = |
| | |
| | | if (enableStartTLS.isPresent()) |
| | | { |
| | | // Use the key manager specified for the LDAP connection handler. |
| | | DN ldapListenerDN = DN.decode(DN_LDAP_CONNECTION_HANDLER); |
| | | DN ldapListenerDN = DN.valueOf(DN_LDAP_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | |
| | | if (ldapsPort.isPresent()) |
| | | { |
| | | // Use the key manager specified for the LDAPS connection handler. |
| | | DN ldapsListenerDN = DN.decode(DN_LDAPS_CONNECTION_HANDLER); |
| | | DN ldapsListenerDN = DN.valueOf(DN_LDAPS_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapsListenerDN); |
| | | |
| | |
| | | try |
| | | { |
| | | // Enable the key manager |
| | | DN dn = DN.decode(keyManagerProviderDN.getValue()); |
| | | DN dn = DN.valueOf(keyManagerProviderDN.getValue()); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(dn); |
| | | |
| | | StringConfigAttribute pathAttr = |
| | |
| | | // Enable the trust manager |
| | | try |
| | | { |
| | | DN dn = DN.decode(trustManagerProviderDN.getValue()); |
| | | DN dn = DN.valueOf(trustManagerProviderDN.getValue()); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(dn); |
| | | |
| | | BooleanConfigAttribute enableAttr = |
| | |
| | | if (enableStartTLS.isPresent()) |
| | | { |
| | | // Use the trust manager specified for the LDAP connection handler. |
| | | DN ldapListenerDN = DN.decode(DN_LDAP_CONNECTION_HANDLER); |
| | | DN ldapListenerDN = DN.valueOf(DN_LDAP_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | |
| | | if (ldapsPort.isPresent()) |
| | | { |
| | | // Use the trust manager specified for the LDAPS connection handler. |
| | | DN ldapsListenerDN = DN.decode(DN_LDAPS_CONNECTION_HANDLER); |
| | | DN ldapsListenerDN = DN.valueOf(DN_LDAPS_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapsListenerDN); |
| | | |
| | |
| | | INFO_LDAP_CONNHANDLER_DESCRIPTION_SSL_CERT_NICKNAME.get(), |
| | | false, false, true, certNickName.getValue()); |
| | | |
| | | DN ldapListenerDN = DN.decode(DN_LDAP_CONNECTION_HANDLER); |
| | | DN ldapListenerDN = DN.valueOf(DN_LDAP_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | if (ldapPort.isPresent()) |
| | |
| | | } |
| | | |
| | | // Use the key manager specified for the LDAPS connection handler. |
| | | DN ldapsListenerDN = DN.decode(DN_LDAPS_CONNECTION_HANDLER); |
| | | DN ldapsListenerDN = DN.valueOf(DN_LDAPS_CONNECTION_HANDLER); |
| | | configEntry = configHandler.getConfigEntry(ldapsListenerDN); |
| | | if (ldapsPort.isPresent()) |
| | | { |
| | |
| | | false, false, true, certNickName.getValue()); |
| | | |
| | | // Use the key manager specified for the JMX connection handler. |
| | | DN jmxListenerDN = DN.decode(DN_JMX_CONNECTION_HANDLER); |
| | | DN jmxListenerDN = DN.valueOf(DN_JMX_CONNECTION_HANDLER); |
| | | configEntry = configHandler.getConfigEntry(jmxListenerDN); |
| | | if (jmxPort.isPresent()) |
| | | { |
| | |
| | | try |
| | | { |
| | | // Use the key manager specified for the LDAP connection handler. |
| | | DN ldapListenerDN = DN.decode(DN_LDAP_CONNECTION_HANDLER); |
| | | DN ldapListenerDN = DN.valueOf(DN_LDAP_CONNECTION_HANDLER); |
| | | ConfigEntry configEntry = |
| | | configHandler.getConfigEntry(ldapListenerDN); |
| | | |
| | |
| | | ATTR_SSL_CERT_NICKNAME.toLowerCase()); |
| | | |
| | | // Use the key manager specified for the LDAPS connection handler. |
| | | DN ldapsListenerDN = DN.decode(DN_LDAPS_CONNECTION_HANDLER); |
| | | DN ldapsListenerDN = DN.valueOf(DN_LDAPS_CONNECTION_HANDLER); |
| | | configEntry = configHandler.getConfigEntry(ldapsListenerDN); |
| | | |
| | | configEntry.removeConfigAttribute( |
| | | ATTR_SSL_CERT_NICKNAME.toLowerCase()); |
| | | |
| | | // Use the key manager specified for the JMX connection handler. |
| | | DN jmxListenerDN = DN.decode(DN_JMX_CONNECTION_HANDLER); |
| | | DN jmxListenerDN = DN.valueOf(DN_JMX_CONNECTION_HANDLER); |
| | | configEntry = configHandler.getConfigEntry(jmxListenerDN); |
| | | |
| | | configEntry.removeConfigAttribute( |
| | |
| | | { |
| | | try |
| | | { |
| | | DN rootUserDN = DN.decode(DN_ROOT_USER); |
| | | DN rootUserDN = DN.valueOf(DN_ROOT_USER); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(rootUserDN); |
| | | |
| | | DNConfigAttribute bindDNAttr = |
| | |
| | | // Set the FQDN for the DIGEST-MD5 SASL mechanism. |
| | | try |
| | | { |
| | | DN digestMD5DN = DN.decode(DN_DIGEST_MD5_SASL_MECHANISM); |
| | | DN digestMD5DN = DN.valueOf(DN_DIGEST_MD5_SASL_MECHANISM); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(digestMD5DN); |
| | | StringConfigAttribute fqdnAttr = new StringConfigAttribute( |
| | | "ds-cfg-server-fqdn", Message.EMPTY, false, false, false, |
| | |
| | | { |
| | | try |
| | | { |
| | | DN cipherDN = DN.decode(DN_CRYPTO_MANAGER); |
| | | DN cipherDN = DN.valueOf(DN_CRYPTO_MANAGER); |
| | | ConfigEntry configEntry = configHandler.getConfigEntry(cipherDN); |
| | | |
| | | // Set the alternative cipher |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | base = DN.decode(baseDN.getValue()); |
| | | base = DN.valueOf(baseDN.getValue()); |
| | | } |
| | | catch(DirectoryException de) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | base = DN.decode(baseDN.getValue()); |
| | | base = DN.valueOf(baseDN.getValue()); |
| | | } |
| | | catch(DirectoryException de) |
| | | { |
| | |
| | | |
| | | try |
| | | { |
| | | base = DN.decode(baseDN.getValue()); |
| | | base = DN.valueOf(baseDN.getValue()); |
| | | } |
| | | catch(DirectoryException de) |
| | | { |
| | |
| | | { |
| | | // Encode the value as a DN |
| | | start = StaticUtils.getBytes( |
| | | DN.decode(minKeyValue.getValue()).toNormalizedString()); |
| | | DN.valueOf(minKeyValue.getValue()).toNormalizedString()); |
| | | } |
| | | else if(databaseContainer instanceof ID2Entry) |
| | | { |
| | |
| | | { |
| | | // Encode the value as a DN |
| | | end = StaticUtils.getBytes( |
| | | DN.decode(maxKeyValue.getValue()).toNormalizedString()); |
| | | DN.valueOf(maxKeyValue.getValue()).toNormalizedString()); |
| | | } |
| | | else if(databaseContainer instanceof ID2Entry) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | RootCfg root = context.getRootConfiguration(); |
| | | ConfigEntry backendRoot; |
| | | try { |
| | | DN configEntryDN = DN.decode(ConfigConstants.DN_BACKEND_BASE); |
| | | DN configEntryDN = DN.valueOf(ConfigConstants.DN_BACKEND_BASE); |
| | | backendRoot = DirectoryServer.getConfigEntry(configEntryDN); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | DN excludeBranch; |
| | | try |
| | | { |
| | | excludeBranch = DN.decode(s); |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN includeBranch; |
| | | try |
| | | { |
| | | includeBranch = DN.decode(s); |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | DN includeBranch; |
| | | try |
| | | { |
| | | includeBranch = DN.decode(s); |
| | | includeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | DN excludeBranch; |
| | | try |
| | | { |
| | | excludeBranch = DN.decode(s); |
| | | excludeBranch = DN.valueOf(s); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | import java.io.BufferedReader; |
| | |
| | | { |
| | | try |
| | | { |
| | | DN dn = DN.decode(line); |
| | | DN dn = DN.valueOf(line); |
| | | ignoreEntries.add(dn); |
| | | } |
| | | catch (DirectoryException e) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | import java.io.BufferedReader; |
| | |
| | | { |
| | | try |
| | | { |
| | | baseDNs.add(DN.decode(dnString)); |
| | | baseDNs.add(DN.valueOf(dnString)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | baseDNs.add(DN.nullDN()); |
| | | baseDNs.add(DN.rootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | import org.opends.messages.Message; |
| | |
| | | DN dn; |
| | | try |
| | | { |
| | | dn = DN.decode(dnStr); |
| | | dn = DN.valueOf(dnStr); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | dn.toString()); |
| | | out.println(message); |
| | | |
| | | DN parentDN = dn.getParent(); |
| | | DN parentDN = dn.parent(); |
| | | while (true) |
| | | { |
| | | if (parentDN == null) |
| | |
| | | } |
| | | } |
| | | |
| | | parentDN = parentDN.getParent(); |
| | | parentDN = parentDN.parent(); |
| | | } |
| | | } |
| | | else |
| | |
| | | { |
| | | isFirst = false; |
| | | } |
| | | if (dn.getNumComponents() > 1) |
| | | if (dn.size() > 1) |
| | | { |
| | | buf.append("\""+dn.toString()+"\""); |
| | | } |
| | |
| | | DN backendBaseDN = null; |
| | | try |
| | | { |
| | | backendBaseDN = DN.decode(DN_BACKEND_BASE); |
| | | backendBaseDN = DN.valueOf(DN_BACKEND_BASE); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | DN rebuildBaseDN = null; |
| | | try |
| | | { |
| | | rebuildBaseDN = DN.decode(dn); |
| | | rebuildBaseDN = DN.valueOf(dn); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | DN verifyBaseDN ; |
| | | try |
| | | { |
| | | verifyBaseDN = DN.decode(baseDNString.getValue()); |
| | | verifyBaseDN = DN.valueOf(baseDNString.getValue()); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.dsreplication; |
| | | |
| | |
| | | // launch the job |
| | | for (String baseDN : uData.getBaseDNs()) |
| | | { |
| | | DN dn = DN.decode(baseDN); |
| | | DN dn = DN.valueOf(baseDN); |
| | | // We can assume that this is an LDAP replication domain |
| | | LDAPReplicationDomain domain = |
| | | LDAPReplicationDomain.retrievesReplicationDomain(dn); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2012 profiq s.r.o. |
| | | */ |
| | | |
| | |
| | | ReplicationDomainCfgDefn.getInstance(), domainName, |
| | | new ArrayList<DefaultBehaviorException>()); |
| | | domain.setServerId(domainId); |
| | | domain.setBaseDN(DN.decode(baseDN)); |
| | | domain.setBaseDN(DN.valueOf(baseDN)); |
| | | domain.setReplicationServer(replicationServers); |
| | | mustCommit = true; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | */ |
| | | public boolean hasAttribute(AttributeType attributeType) |
| | | { |
| | | if (branchDN.getRDN().hasAttributeType(attributeType)) |
| | | if (branchDN.rdn().hasAttributeType(attributeType)) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | TemplateValue templateValue) |
| | | { |
| | | DN dn = templateEntry.getDN(); |
| | | if ((dn == null) || dn.isNullDN()) |
| | | if ((dn == null) || dn.isRootDN()) |
| | | { |
| | | return TagResult.SUCCESS_RESULT; |
| | | } |
| | |
| | | } |
| | | else if (numComponents > 0) |
| | | { |
| | | int count = Math.min(numComponents, dn.getNumComponents()); |
| | | int count = Math.min(numComponents, dn.size()); |
| | | |
| | | dn.getRDN(0).toString(templateValue.getValue()); |
| | | for (int i = 1; i < count; i++) |
| | |
| | | } |
| | | else |
| | | { |
| | | int sz = dn.getNumComponents(); |
| | | int sz = dn.size(); |
| | | int count = Math.min(Math.abs(numComponents), sz); |
| | | |
| | | dn.getRDN(sz - count).toString(templateValue.getValue()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | TemplateValue templateValue) |
| | | { |
| | | DN parentDN = templateEntry.getParentDN(); |
| | | if ((parentDN == null) || parentDN.isNullDN()) |
| | | if ((parentDN == null) || parentDN.isRootDN()) |
| | | { |
| | | return TagResult.SUCCESS_RESULT; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | TemplateValue templateValue) |
| | | { |
| | | DN dn = templateEntry.getDN(); |
| | | if ((dn == null) || dn.isNullDN()) |
| | | if ((dn == null) || dn.isRootDN()) |
| | | { |
| | | return TagResult.SUCCESS_RESULT; |
| | | } |
| | | else |
| | | { |
| | | dn.getRDN().toString(templateValue.getValue()); |
| | | dn.rdn().toString(templateValue.getValue()); |
| | | return TagResult.SUCCESS_RESULT; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | |
| | |
| | | rdn = new RDN(rdnAttrs, names, values); |
| | | } |
| | | |
| | | dn = parentDN.concat(rdn); |
| | | dn = parentDN.child(rdn); |
| | | } |
| | | |
| | | return dn; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | DN branchDN; |
| | | try |
| | | { |
| | | branchDN = DN.decode(dnString); |
| | | branchDN = DN.valueOf(dnString); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | TemplateValue templateValue) |
| | | { |
| | | DN dn = templateEntry.getDN(); |
| | | if ((dn == null) || dn.isNullDN()) |
| | | if ((dn == null) || dn.isRootDN()) |
| | | { |
| | | return TagResult.SUCCESS_RESULT; |
| | | } |
| | |
| | | if (numComponents == 0) |
| | | { |
| | | dn.getRDN(0).toString(templateValue.getValue()); |
| | | for (int i=1; i < dn.getNumComponents(); i++) |
| | | for (int i=1; i < dn.size(); i++) |
| | | { |
| | | templateValue.append("_"); |
| | | dn.getRDN(i).toString(templateValue.getValue()); |
| | |
| | | } |
| | | else if (numComponents > 0) |
| | | { |
| | | int count = Math.min(numComponents, dn.getNumComponents()); |
| | | int count = Math.min(numComponents, dn.size()); |
| | | |
| | | dn.getRDN(0).toString(templateValue.getValue()); |
| | | for (int i = 1; i < count; i++) |
| | |
| | | } |
| | | else |
| | | { |
| | | int sz = dn.getNumComponents(); |
| | | int sz = dn.size(); |
| | | int count = Math.min(Math.abs(numComponents), sz); |
| | | |
| | | dn.getRDN(sz - count).toString(templateValue.getValue()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.opends.messages.Message; |
| | |
| | | TemplateValue templateValue) |
| | | { |
| | | DN parentDN = templateEntry.getParentDN(); |
| | | if ((parentDN == null) || parentDN.isNullDN()) |
| | | if ((parentDN == null) || parentDN.isRootDN()) |
| | | { |
| | | return TagResult.SUCCESS_RESULT; |
| | | } |
| | | |
| | | parentDN.getRDN(0).toString(templateValue.getValue()); |
| | | for (int i=1; i < parentDN.getNumComponents(); i++) |
| | | for (int i=1; i < parentDN.size(); i++) |
| | | { |
| | | templateValue.append("_"); |
| | | parentDN.getRDN(i).toString(templateValue.getValue()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | { |
| | | return authorizationEntry.getDN(); |
| | | } |
| | | return DN.nullDN(); |
| | | return DN.rootDN(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | import org.opends.messages.Message; |
| | |
| | | DN configEntryDN; |
| | | try |
| | | { |
| | | configEntryDN = DN.decode(dnString); |
| | | configEntryDN = DN.valueOf(dnString); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | public DN(RDN rdn, DN parentDN) |
| | | { |
| | | ensureNotNull(rdn, parentDN); |
| | | if (parentDN.isNullDN()) |
| | | if (parentDN.isRootDN()) |
| | | { |
| | | rdnComponents = new RDN[] { rdn }; |
| | | } |
| | |
| | | * |
| | | * @return A singleton instance of the null DN. |
| | | */ |
| | | public static DN nullDN() |
| | | public static DN rootDN() |
| | | { |
| | | return NULL_DN; |
| | | } |
| | |
| | | * @return <CODE>true</CODE> if this does represent a null DN, or |
| | | * <CODE>false</CODE> if it does not. |
| | | */ |
| | | public boolean isNullDN() |
| | | public boolean isRootDN() |
| | | { |
| | | return (numComponents == 0); |
| | | } |
| | |
| | | * |
| | | * @return The number of RDN components for this DN. |
| | | */ |
| | | public int getNumComponents() |
| | | public int size() |
| | | { |
| | | return numComponents; |
| | | } |
| | |
| | | * <CODE>null</CODE> if there are no RDN components in the |
| | | * DN. |
| | | */ |
| | | public RDN getRDN() |
| | | public RDN rdn() |
| | | { |
| | | if (numComponents == 0) |
| | | { |
| | |
| | | * this entry, or <CODE>null</CODE> if the entry with this |
| | | * DN does not have a parent. |
| | | */ |
| | | public DN getParent() |
| | | public DN parent() |
| | | { |
| | | if (numComponents <= 1) |
| | | { |
| | |
| | | * @return A new DN that is a child of this DN, using the specified |
| | | * RDN. |
| | | */ |
| | | public DN concat(RDN rdn) |
| | | public DN child(RDN rdn) |
| | | { |
| | | RDN[] newComponents = new RDN[rdnComponents.length+1]; |
| | | newComponents[0] = rdn; |
| | |
| | | * @return A new DN that is a descendant of this DN, using the |
| | | * specified DN as a relative base DN. |
| | | */ |
| | | public DN concat(DN relativeBaseDN) |
| | | public DN child(DN relativeBaseDN) |
| | | { |
| | | RDN[] newComponents = |
| | | new RDN[rdnComponents.length+ |
| | |
| | | |
| | | case SINGLE_LEVEL: |
| | | // The parent DN must equal the base DN. |
| | | return baseDN.equals(getParent()); |
| | | return baseDN.equals(parent()); |
| | | |
| | | case WHOLE_SUBTREE: |
| | | // This DN must be a descendant of the provided base DN. |
| | |
| | | b = dnString.byteAt(i); |
| | | if (((b & 0x7F) != b) || (b == '\\')) |
| | | { |
| | | return decode(dnString.toString()); |
| | | return valueOf(dnString.toString()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @throws DirectoryException If a problem occurs while trying to |
| | | * decode the provided string as a DN. |
| | | */ |
| | | public static DN decode(String dnString) |
| | | public static DN valueOf(String dnString) |
| | | throws DirectoryException |
| | | { |
| | | // A null or empty DN is acceptable. |
| | |
| | | { |
| | | return 0; |
| | | } |
| | | else if (isNullDN()) |
| | | else if (isRootDN()) |
| | | { |
| | | return -1; |
| | | } |
| | | else if (dn.isNullDN()) |
| | | else if (dn.isRootDN()) |
| | | { |
| | | return 1; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | { |
| | | if (dn == null) |
| | | { |
| | | this.dn = DN.nullDN(); |
| | | this.dn = DN.rootDN(); |
| | | } |
| | | else |
| | | { |
| | |
| | | AcceptRejectWarn structuralPolicy, |
| | | MessageBuilder invalidReason) |
| | | { |
| | | RDN rdn = dn.getRDN(); |
| | | RDN rdn = dn.rdn(); |
| | | if (rdn != null) |
| | | { |
| | | // Make sure that all the required attributes are present. |
| | |
| | | Attribute aliasAttr = aliasAttrs.get(0); |
| | | if (!aliasAttr.isEmpty()) |
| | | { |
| | | return DN.decode(aliasAttr.iterator().next().getValue().toString()); |
| | | return DN.valueOf(aliasAttr.iterator().next().getValue().toString()); |
| | | } |
| | | } |
| | | return null; |
| | |
| | | inheritFromDN = DN.decode(value.getNormalizedValue()); |
| | | // Respect subentry root scope. |
| | | if (!inheritFromDN.isDescendantOf( |
| | | subEntry.getDN().getParent())) |
| | | subEntry.getDN().parent())) |
| | | { |
| | | inheritFromDN = null; |
| | | } |
| | |
| | | inheritFromDN = subEntry.getInheritFromBaseDN(); |
| | | for (AttributeValue value : attr) |
| | | { |
| | | inheritFromDN = inheritFromDN.concat( |
| | | inheritFromDN = inheritFromDN.child( |
| | | RDN.create(subEntry.getInheritFromRDNType(), |
| | | value)); |
| | | break; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | import java.util.Iterator; |
| | |
| | | /** |
| | | * The default base DN that will be used if none is provided. |
| | | */ |
| | | public static final DN DEFAULT_BASE_DN = DN.nullDN(); |
| | | public static final DN DEFAULT_BASE_DN = DN.rootDN(); |
| | | |
| | | |
| | | |
| | |
| | | DN baseDN; |
| | | if (fullyDecode) |
| | | { |
| | | baseDN = DN.decode(baseDNString); |
| | | baseDN = DN.valueOf(baseDNString); |
| | | } |
| | | else |
| | | { |
| | |
| | | return DEFAULT_BASE_DN; |
| | | } |
| | | |
| | | baseDN = DN.decode(rawBaseDN); |
| | | baseDN = DN.valueOf(rawBaseDN); |
| | | } |
| | | |
| | | return baseDN; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | import org.opends.messages.Message; |
| | |
| | | if (dnAttributes) |
| | | { |
| | | DN entryDN = entry.getDN(); |
| | | int count = entryDN.getNumComponents(); |
| | | int count = entryDN.size(); |
| | | for (int rdnIndex = 0; rdnIndex < count; rdnIndex++) |
| | | { |
| | | RDN rdn = entryDN.getRDN(rdnIndex); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.types; |
| | |
| | | try |
| | | { |
| | | this.subTreeSpec = SubtreeSpecification.valueOf( |
| | | entry.getDN().getParent(), specString); |
| | | entry.getDN().parent(), specString); |
| | | isValidSpec = true; |
| | | } |
| | | catch (DirectoryException de) |
| | |
| | | { |
| | | // There is none for some reason eg this could be |
| | | // old Draft based ldapSubEntry so create a dummy. |
| | | this.subTreeSpec = new SubtreeSpecification(entry.getDN().getParent(), |
| | | this.subTreeSpec = new SubtreeSpecification(entry.getDN().parent(), |
| | | null, -1, -1, null, null, null); |
| | | } |
| | | |
| | |
| | | // Has to have a parent since subentry itself |
| | | // cannot be a suffix entry within the server. |
| | | this.inheritFromBaseDN = |
| | | getDN().getParent().concat( |
| | | getDN().parent().child( |
| | | inheritFromBaseDN); |
| | | break; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | skipColon(); |
| | | if (type.equals("chopbefore")) |
| | | { |
| | | chopBefore.add(DN.decode(nextStringValue())); |
| | | chopBefore.add(DN.valueOf(nextStringValue())); |
| | | } |
| | | else if (type.equals("chopafter")) |
| | | { |
| | | chopAfter.add(DN.decode(nextStringValue())); |
| | | chopAfter.add(DN.valueOf(nextStringValue())); |
| | | } |
| | | else |
| | | { |
| | |
| | | // Relative base DN specified more than once. |
| | | throw new InputMismatchException(); |
| | | } |
| | | relativeBaseDN = DN.decode(parser.nextStringValue()); |
| | | relativeBaseDN = DN.valueOf(parser.nextStringValue()); |
| | | } |
| | | else if (key.equals("minimum")) |
| | | { |
| | |
| | | final Iterable<DN> chopAfter, final Refinement refinements) |
| | | { |
| | | this.baseDN = relativeBaseDN == null ? rootDN : rootDN |
| | | .concat(relativeBaseDN); |
| | | .child(relativeBaseDN); |
| | | this.minimumDepth = minimumDepth; |
| | | this.maximumDepth = maximumDepth; |
| | | |
| | |
| | | final TreeMap<DN, DN> map = new TreeMap<DN, DN>(); |
| | | for (final DN localName : chopBefore) |
| | | { |
| | | map.put(baseDN.concat(localName), localName); |
| | | map.put(baseDN.child(localName), localName); |
| | | } |
| | | this.chopBefore = Collections.unmodifiableMap(map); |
| | | } |
| | |
| | | final TreeMap<DN, DN> map = new TreeMap<DN, DN>(); |
| | | for (final DN localName : chopAfter) |
| | | { |
| | | map.put(baseDN.concat(localName), localName); |
| | | map.put(baseDN.child(localName), localName); |
| | | } |
| | | this.chopAfter = Collections.unmodifiableMap(map); |
| | | } |
| | |
| | | } |
| | | |
| | | // Check minimum and maximum depths. |
| | | final int baseRDNCount = baseDN.getNumComponents(); |
| | | final int baseRDNCount = baseDN.size(); |
| | | |
| | | if (minimumDepth > 0) |
| | | { |
| | | final int entryRDNCount = dn.getNumComponents(); |
| | | final int entryRDNCount = dn.size(); |
| | | |
| | | if (entryRDNCount - baseRDNCount < minimumDepth) |
| | | { |
| | |
| | | |
| | | if (maximumDepth >= 0) |
| | | { |
| | | final int entryRDNCount = dn.getNumComponents(); |
| | | final int entryRDNCount = dn.size(); |
| | | |
| | | if (entryRDNCount - baseRDNCount > maximumDepth) |
| | | { |
| | |
| | | |
| | | // Output the optional base DN. |
| | | builder.append("{"); |
| | | if (relativeBaseDN != null && !relativeBaseDN.isNullDN()) |
| | | if (relativeBaseDN != null && !relativeBaseDN.isRootDN()) |
| | | { |
| | | builder.append(" base "); |
| | | StaticUtils.toRFC3641StringValue(builder, |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | // base64-encoded. Otherwise, it may be one or more spaces. |
| | | if (colonPos == line.length() - 1) |
| | | { |
| | | return DN.nullDN(); |
| | | return DN.rootDN(); |
| | | } |
| | | |
| | | if (line.charAt(colonPos+1) == ':') |
| | |
| | | { |
| | | try |
| | | { |
| | | return DN.decode(dnString); |
| | | return DN.valueOf(dnString); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | entryDN, "newsuperior"); |
| | | try |
| | | { |
| | | newSuperiorDN = DN.decode(dnStr); |
| | | newSuperiorDN = DN.valueOf(dnStr); |
| | | } catch (DirectoryException de) |
| | | { |
| | | if (debugEnabled()) |
| | |
| | | Map<AttributeType,List<Attribute>>userAttributes, |
| | | Map<AttributeType,List<Attribute>> operationalAttributes) |
| | | { |
| | | RDN rdn = entryDN.getRDN(); |
| | | RDN rdn = entryDN.rdn(); |
| | | int numAVAs = rdn.getNumValues(); |
| | | for (int i=0; i < numAVAs; i++) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | { |
| | | // If the provided DN was null or empty, then return null because we don't |
| | | // support it. |
| | | if ((dn == null) || dn.isNullDN()) |
| | | if ((dn == null) || dn.isRootDN()) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | // Get the information about the RDN attributes. |
| | | RDN rdn = dn.getRDN(); |
| | | RDN rdn = dn.rdn(); |
| | | int numAVAs = rdn.getNumValues(); |
| | | |
| | | // If there is only one RDN attribute, then see which objectclass we should |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement; |
| | | |
| | |
| | | |
| | | WorkflowElement<?> workflowElement = |
| | | DirectoryServer.getWorkflowElement( |
| | | configuration.dn().getRDN().getAttributeValue(0).toString()); |
| | | configuration.dn().rdn().getAttributeValue(0).toString()); |
| | | if (workflowElement != null) |
| | | { |
| | | // Notify to observers that the workflow element is now disabled |
| | |
| | | // Get the existing workflow element if it's already enabled. |
| | | WorkflowElement<?> existingWorkflowElement = |
| | | DirectoryServer.getWorkflowElement( |
| | | configuration.dn().getRDN().getAttributeValue(0).toString()); |
| | | configuration.dn().rdn().getAttributeValue(0).toString()); |
| | | |
| | | // If the new configuration has the workflow element disabled, |
| | | // then disable it if it is enabled, or do nothing if it's already disabled. |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2013 ForgeRock AS |
| | | * Portions Copyright 2010-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.externalchangelog; |
| | | |
| | |
| | | try |
| | | { |
| | | CHANGELOG_ROOT_DN = DN |
| | | .decode(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT); |
| | | .valueOf(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | |
| | | // at the end build the CL entry to be returned |
| | | return new Entry(DN.decode(dnString), CHANGELOG_ENTRY_OBJECT_CLASSES, |
| | | return new Entry(DN.valueOf(dnString), CHANGELOG_ENTRY_OBJECT_CLASSES, |
| | | uAttrs, operationalAttrs); |
| | | } |
| | | |
| | |
| | | DN baseDN, SearchFilter sf) throws DirectoryException |
| | | { |
| | | // Select whether to use the DN or the filter. |
| | | switch (baseDN.getNumComponents()) |
| | | switch (baseDN.size()) |
| | | { |
| | | case 1: |
| | | // cn=changelog - use user provided search filter. |
| | |
| | | |
| | | // The DN could also be a new ECL <service-id>,cn=changelog so be sure it |
| | | // is draft ECL. |
| | | RDN rdn = baseDN.getRDN(); |
| | | RDN rdn = baseDN.rdn(); |
| | | |
| | | AttributeType at = DirectoryServer.getAttributeType("changenumber"); |
| | | if (at == null) |
| | |
| | | default: |
| | | // replicationCSN=xxx,<service-id>,cn=changelog - new ECL - use faked up |
| | | // equality filter. |
| | | rdn = baseDN.getRDN(); |
| | | rdn = baseDN.rdn(); |
| | | |
| | | at = DirectoryServer.getAttributeType("replicationcsn"); |
| | | if (at == null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | // This is fine. This entry is one of the configured suffixes. |
| | | return null; |
| | | } |
| | | else if (entryDN.isNullDN()) |
| | | else if (entryDN.isRootDN()) |
| | | { |
| | | // This is not fine. The root DSE cannot be added. |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | |
| | | */ |
| | | private void addRDNAttributesIfNecessary() throws DirectoryException |
| | | { |
| | | RDN rdn = entryDN.getRDN(); |
| | | RDN rdn = entryDN.rdn(); |
| | | int numAVAs = rdn.getNumValues(); |
| | | for (int i=0; i < numAVAs; i++) |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | |
| | | // If there is a bind DN, then see whether that is acceptable. |
| | | if (DirectoryServer.bindWithDNRequiresPassword() |
| | | && bindDN != null && !bindDN.isNullDN()) |
| | | && bindDN != null && !bindDN.isRootDN()) |
| | | { |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | | ERR_BIND_DN_BUT_NO_PASSWORD.get()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | parentDN = newSuperior; |
| | | } |
| | | |
| | | if (parentDN == null || parentDN.isNullDN()) |
| | | if (parentDN == null || parentDN.isRootDN()) |
| | | { |
| | | setResultCode(ResultCode.UNWILLING_TO_PERFORM); |
| | | appendErrorMessage(ERR_MODDN_NO_PARENT.get(String.valueOf(entryDN))); |
| | | return; |
| | | } |
| | | |
| | | DN newDN = parentDN.concat(newRDN); |
| | | DN newDN = parentDN.child(newRDN); |
| | | |
| | | // Get the backend for the current entry, and the backend for the new |
| | | // entry. If either is null, or if they are different, then fail. |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | // If we should delete the old RDN values from the entry, then do so. |
| | | if (deleteOldRDN()) |
| | | { |
| | | RDN currentRDN = entryDN.getRDN(); |
| | | RDN currentRDN = entryDN.rdn(); |
| | | int numValues = currentRDN.getNumValues(); |
| | | for (int i=0; i < numValues; i++) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2011 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | AttributeType t = attr.getAttributeType(); |
| | | |
| | | RDN rdn = modifiedEntry.getDN().getRDN(); |
| | | RDN rdn = modifiedEntry.getDN().rdn(); |
| | | if ((rdn != null) && rdn.hasAttributeType(t) && |
| | | (! modifiedEntry.hasValue(t, attr.getOptions(), |
| | | rdn.getAttributeValue(t)))) |
| | |
| | | |
| | | // Make sure that the RDN attribute value(s) has not been removed. |
| | | AttributeType t = attr.getAttributeType(); |
| | | RDN rdn = modifiedEntry.getDN().getRDN(); |
| | | RDN rdn = modifiedEntry.getDN().rdn(); |
| | | if ((rdn != null) |
| | | && rdn.hasAttributeType(t) |
| | | && (!modifiedEntry.hasValue(t, attr.getOptions(), rdn |
| | |
| | | { |
| | | // The specified attribute type must not be an RDN attribute. |
| | | AttributeType t = attr.getAttributeType(); |
| | | RDN rdn = modifiedEntry.getDN().getRDN(); |
| | | RDN rdn = modifiedEntry.getDN().rdn(); |
| | | if ((rdn != null) && rdn.hasAttributeType(t)) |
| | | { |
| | | throw newDirectoryException(modifiedEntry, ResultCode.NOT_ALLOWED_ON_RDN, |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | setAuthorizationEntry(authorizationEntry); |
| | | if (authorizationEntry == null) |
| | | { |
| | | setProxiedAuthorizationDN(DN.nullDN()); |
| | | setProxiedAuthorizationDN(DN.rootDN()); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | RootCfg root = context.getRootConfiguration(); |
| | | try { |
| | | BackendCfg backendCfg = root.getBackend(newBackendID); |
| | | if (backendCfg.getBaseDN().contains(DN.decode(DN_CONFIG_ROOT))) { |
| | | if (backendCfg.getBaseDN().contains(DN.valueOf(DN_CONFIG_ROOT))) { |
| | | newBackend = DirectoryServer.getConfigHandler(); |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | if (applyChanges) |
| | | { |
| | | super.initialize( |
| | | configuration.dn().getRDN().getAttributeValue(0).toString(), |
| | | configuration.dn().rdn().getAttributeValue(0).toString(), |
| | | BACKEND_WORKFLOW_ELEMENT); |
| | | backend = newBackend; |
| | | if (backend != null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2013 Manuel Gaupp |
| | | */ |
| | | package org.opends.server; |
| | |
| | | { |
| | | startServer(); |
| | | |
| | | DN baseDN = DN.decode(namingContext); |
| | | DN baseDN = DN.valueOf(namingContext); |
| | | |
| | | // Retrieve backend. Warning: it is important to perform this each time, |
| | | // because a test may have disabled then enabled the backend (i.e a test |
| | |
| | | |
| | | if (createBaseEntry) |
| | | { |
| | | DN baseDN = DN.decode(dn); |
| | | DN baseDN = DN.valueOf(dn); |
| | | Entry e = createEntry(baseDN); |
| | | backend = (BackendImpl)DirectoryServer.getBackend(beID); |
| | | backend.addEntry(e, null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | AggregationPropertyDefinition<?, ?> pd = d |
| | | .getAggregationPropertyPropertyDefinition(); |
| | | DN expected = DN |
| | | .decode("cn=ldap connection handler, cn=connection handlers, cn=config"); |
| | | .valueOf("cn=ldap connection handler, cn=connection handlers, cn=config"); |
| | | DN actual = pd.getChildDN(" LDAP connection handler "); |
| | | Assert.assertEquals(actual, expected); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | |
| | | DN actual = pd.getBaseDN(); |
| | | DN expected = baseDN == null ? null : DN.decode(baseDN); |
| | | DN expected = baseDN == null ? null : DN.valueOf(baseDN); |
| | | |
| | | assertEquals(actual, expected); |
| | | } |
| | |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | pd.validateValue(DN.decode(value)); |
| | | pd.validateValue(DN.valueOf(value)); |
| | | } |
| | | |
| | | |
| | |
| | | .createBuilder(RootCfgDefn.getInstance(), "test-property"); |
| | | localBuilder.setBaseDN(baseDN); |
| | | DNPropertyDefinition pd = localBuilder.getInstance(); |
| | | pd.validateValue(DN.decode(value)); |
| | | pd.validateValue(DN.valueOf(value)); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | LDAPConnectionHandlerCfgDefn.getInstance(), |
| | | "Another LDAP connection handler"); |
| | | |
| | | DN expectedEmpty = DN.nullDN(); |
| | | DN expectedChild1 = DN.decode("cn=LDAP connection handler,cn=connection handlers,cn=config"); |
| | | DN expectedChild2 = DN.decode("cn=LDAP connection handler,cn=connection handlers,cn=config"); |
| | | DN expectedChild3 = DN.decode("cn=Another LDAP connection handler,cn=connection handlers,cn=config"); |
| | | DN expectedEmpty = DN.rootDN(); |
| | | DN expectedChild1 = DN.valueOf("cn=LDAP connection handler,cn=connection handlers,cn=config"); |
| | | DN expectedChild2 = DN.valueOf("cn=LDAP connection handler,cn=connection handlers,cn=config"); |
| | | DN expectedChild3 = DN.valueOf("cn=Another LDAP connection handler,cn=connection handlers,cn=config"); |
| | | |
| | | assertEquals(path.toDN(), expectedEmpty); |
| | | assertEquals(child1.toDN(), expectedChild1); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | parent.setMandatoryBooleanProperty(false); |
| | | parent.setOptionalMultiValuedDNProperty(Arrays.asList(DN |
| | | .decode("dc=mod1,dc=com"), DN.decode("dc=mod2,dc=com"))); |
| | | .valueOf("dc=mod1,dc=com"), DN.valueOf("dc=mod2,dc=com"))); |
| | | parent.commit(); |
| | | Assert.assertTrue(c.isEntryModified()); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | |
| | | * Creates a new mock LDAP connection. |
| | | */ |
| | | public MockLDAPConnection() { |
| | | this.rootEntry = new MockEntry(DN.nullDN(), new BasicAttributes()); |
| | | this.rootEntry = new MockEntry(DN.rootDN(), new BasicAttributes()); |
| | | this.entries = new HashMap<DN, MockEntry>(); |
| | | this.entries.put(DN.nullDN(), this.rootEntry); |
| | | this.entries.put(DN.rootDN(), this.rootEntry); |
| | | } |
| | | |
| | | |
| | |
| | | DN entryDN = entry.getDN(); |
| | | |
| | | // Create required glue entries. |
| | | for (int i = 0; i < entryDN.getNumComponents() - 1; i++) { |
| | | RDN rdn = entryDN.getRDN(entryDN.getNumComponents() - i - 1); |
| | | DN dn = parent.getDN().concat(rdn); |
| | | for (int i = 0; i < entryDN.size() - 1; i++) { |
| | | RDN rdn = entryDN.getRDN(entryDN.size() - i - 1); |
| | | DN dn = parent.getDN().child(rdn); |
| | | |
| | | if (!entries.containsKey(dn)) { |
| | | MockEntry glue = new MockEntry(dn, new BasicAttributes()); |
| | |
| | | private MockEntry getEntry(LdapName dn) { |
| | | DN name; |
| | | try { |
| | | name = DN.decode(dn.toString()); |
| | | name = DN.valueOf(dn.toString()); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | // Now serialize it. |
| | | DN actual = DNBuilder.create(path); |
| | | DN expected = DN |
| | | .decode("cn=test-child-1,cn=test children,cn=test-parent-1,cn=test parents,cn=config"); |
| | | .valueOf("cn=test-child-1,cn=test children,cn=test-parent-1,cn=test parents,cn=config"); |
| | | |
| | | assertEquals(actual, expected); |
| | | } |
| | |
| | | try { |
| | | DN actual = DNBuilder.create(path); |
| | | DN expected = DN |
| | | .decode("cn=singleton-test-child,cn=test-parent-1,cn=test parents,cn=config"); |
| | | .valueOf("cn=singleton-test-child,cn=test-parent-1,cn=test parents,cn=config"); |
| | | |
| | | assertEquals(actual, expected); |
| | | } finally { |
| | |
| | | // Now serialize it. |
| | | DN actual = DNBuilder.create(path); |
| | | DN expected = DN |
| | | .decode("cn=optional test child,cn=test-parent-1,cn=test parents,cn=config"); |
| | | .valueOf("cn=optional test child,cn=test-parent-1,cn=test parents,cn=config"); |
| | | |
| | | assertEquals(actual, expected); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | */ |
| | | public TestChildCfg getChild(String expectedName) { |
| | | Assert.assertNotNull(child); |
| | | Assert.assertEquals(child.dn().getRDN().getAttributeValue(0) |
| | | Assert.assertEquals(child.dn().rdn().getAttributeValue(0) |
| | | .getValue().toString(), expectedName); |
| | | return child; |
| | | } |
| | |
| | | */ |
| | | public TestChildCfg getChild(String expectedName) { |
| | | Assert.assertNotNull(child); |
| | | Assert.assertEquals(child.dn().getRDN().getAttributeValue(0) |
| | | Assert.assertEquals(child.dn().rdn().getAttributeValue(0) |
| | | .getValue().toString(), expectedName); |
| | | return child; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.admin.server; |
| | | |
| | |
| | | root.registerAddListener(TestCfg.getTestOneToManyParentRelationDefinition(), listener); |
| | | |
| | | // Make sure that the relation entry does not exist. |
| | | DN relationDN = DN.decode("cn=test parents,cn=config"); |
| | | DN relationDN = DN.valueOf("cn=test parents,cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(relationDN); |
| | | assertNull(configEntry, "Relation entry " + relationDN + " already exists"); |
| | | |
| | | // Make sure that the listener was delayed and registered against |
| | | // the parent. |
| | | DN parentDN = DN.decode("cn=config"); |
| | | DN parentDN = DN.valueOf("cn=config"); |
| | | configEntry = DirectoryServer.getConfigEntry(parentDN); |
| | | assertNotNull(configEntry, "Relation parent entry " + parentDN |
| | | + " does not exist"); |
| | |
| | | TestCaseUtils.addEntry(entry); |
| | | |
| | | // Make sure that the relation entry exist. |
| | | DN relationDN = DN.decode("cn=test parents,cn=config"); |
| | | DN relationDN = DN.valueOf("cn=test parents,cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(relationDN); |
| | | assertNotNull(configEntry, "Relation entry " + relationDN |
| | | + " does not exist"); |
| | |
| | | listener); |
| | | |
| | | // Make sure that the relation entry exists. |
| | | DN relationDN = DN.decode("cn=config"); |
| | | DN relationDN = DN.valueOf("cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(relationDN); |
| | | assertNotNull(configEntry, "Relation entry " + relationDN |
| | | + " does not exist"); |
| | |
| | | root.registerDeleteListener(TestCfg.getTestOneToManyParentRelationDefinition(), listener); |
| | | |
| | | // Make sure that the relation entry does not exist. |
| | | DN relationDN = DN.decode("cn=test parents,cn=config"); |
| | | DN relationDN = DN.valueOf("cn=test parents,cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(relationDN); |
| | | assertNull(configEntry, "Relation entry " + relationDN + " already exists"); |
| | | |
| | | // Make sure that the listener was delayed and registered against |
| | | // the parent. |
| | | DN parentDN = DN.decode("cn=config"); |
| | | DN parentDN = DN.valueOf("cn=config"); |
| | | configEntry = DirectoryServer.getConfigEntry(parentDN); |
| | | assertNotNull(configEntry, "Relation parent entry " + parentDN |
| | | + " does not exist"); |
| | |
| | | TestCaseUtils.addEntry(entry); |
| | | |
| | | // Make sure that the relation entry exist. |
| | | DN relationDN = DN.decode("cn=test parents,cn=config"); |
| | | DN relationDN = DN.valueOf("cn=test parents,cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(relationDN); |
| | | assertNotNull(configEntry, "Relation entry " + relationDN |
| | | + " does not exist"); |
| | |
| | | listener); |
| | | |
| | | // Make sure that the relation entry exists. |
| | | DN relationDN = DN.decode("cn=config"); |
| | | DN relationDN = DN.valueOf("cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(relationDN); |
| | | assertNotNull(configEntry, "Relation entry " + relationDN |
| | | + " does not exist"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | return DN.decode("cn=Alert Handler Test Case,cn=config"); |
| | | return DN.valueOf("cn=Alert Handler Test Case,cn=config"); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return DN.nullDN(); |
| | | return DN.rootDN(); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2011 ForgeRock AS. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | policyDN = DN.decode(policyDNString); |
| | | policyDN = DN.valueOf(policyDNString); |
| | | } |
| | | |
| | | |
| | |
| | | credentials.append((byte) 0); |
| | | credentials.append("password"); |
| | | |
| | | BindOperation bind = conn.processSASLBind(DN.nullDN(), "PLAIN", |
| | | BindOperation bind = conn.processSASLBind(DN.rootDN(), "PLAIN", |
| | | credentials.toByteString()); |
| | | |
| | | // Check authentication result. |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.api; |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | dn0 = DN.decode(dn0String); |
| | | dn1 = DN.decode(dn1String); |
| | | dn2 = DN.decode(dn2String); |
| | | dn3 = DN.decode(dn3String); |
| | | dn4 = DN.decode(dn4String); |
| | | dn5 = DN.decode(dn5String); |
| | | dn6 = DN.decode(dn6String); |
| | | dn7 = DN.decode(dn7String); |
| | | dn8 = DN.decode(dn8String); |
| | | dn9 = DN.decode(dn9String); |
| | | dn0 = DN.valueOf(dn0String); |
| | | dn1 = DN.valueOf(dn1String); |
| | | dn2 = DN.valueOf(dn2String); |
| | | dn3 = DN.valueOf(dn3String); |
| | | dn4 = DN.valueOf(dn4String); |
| | | dn5 = DN.valueOf(dn5String); |
| | | dn6 = DN.valueOf(dn6String); |
| | | dn7 = DN.valueOf(dn7String); |
| | | dn8 = DN.valueOf(dn8String); |
| | | dn9 = DN.valueOf(dn9String); |
| | | } |
| | | |
| | | @Test() |
| | |
| | | assertTrue(ditMap.containsKey(dn8)); |
| | | assertTrue(ditMap.containsKey(dn9)); |
| | | |
| | | assertFalse(ditMap.containsKey(DN.decode( |
| | | assertFalse(ditMap.containsKey(DN.valueOf( |
| | | "ou=No,ou=More,ou=Objects,dc=example,dc=com"))); |
| | | assertFalse(ditMap.containsKey(DN.decode( |
| | | assertFalse(ditMap.containsKey(DN.valueOf( |
| | | "ou=More,ou=Objects,dc=example,dc=com"))); |
| | | assertFalse(ditMap.containsKey(DN.decode( |
| | | assertFalse(ditMap.containsKey(DN.valueOf( |
| | | "ou=Objects,dc=example,dc=com"))); |
| | | assertFalse(ditMap.containsKey(DN.decode( |
| | | assertFalse(ditMap.containsKey(DN.valueOf( |
| | | "ou=Classes,dc=example,dc=com"))); |
| | | assertFalse(ditMap.containsKey(DN.decode( |
| | | assertFalse(ditMap.containsKey(DN.valueOf( |
| | | "dc=example,dc=com"))); |
| | | assertFalse(ditMap.containsKey(DN.decode( |
| | | assertFalse(ditMap.containsKey(DN.valueOf( |
| | | "dc=com"))); |
| | | |
| | | assertTrue(ditMap.containsValue(dn0String)); |
| | |
| | | assertEquals(ditMap.get(dn8), dn8String); |
| | | assertEquals(ditMap.get(dn9), dn9String); |
| | | |
| | | assertNull(ditMap.get(DN.decode( |
| | | assertNull(ditMap.get(DN.valueOf( |
| | | "ou=No,ou=More,ou=Objects,dc=example,dc=com"))); |
| | | assertNull(ditMap.get(DN.decode( |
| | | assertNull(ditMap.get(DN.valueOf( |
| | | "ou=More,ou=Objects,dc=example,dc=com"))); |
| | | assertNull(ditMap.get(DN.decode( |
| | | assertNull(ditMap.get(DN.valueOf( |
| | | "ou=Objects,dc=example,dc=com"))); |
| | | assertNull(ditMap.get(DN.decode( |
| | | assertNull(ditMap.get(DN.valueOf( |
| | | "ou=Classes,dc=example,dc=com"))); |
| | | assertNull(ditMap.get(DN.decode( |
| | | assertNull(ditMap.get(DN.valueOf( |
| | | "dc=example,dc=com"))); |
| | | assertNull(ditMap.get(DN.decode( |
| | | assertNull(ditMap.get(DN.valueOf( |
| | | "dc=com"))); |
| | | } |
| | | |
| | |
| | | putAllAndVerify(); |
| | | |
| | | Collection<String> subtreeSet = ditMap.getSubtree( |
| | | DN.decode("dc=example,dc=com")); |
| | | DN.valueOf("dc=example,dc=com")); |
| | | assertFalse(subtreeSet.isEmpty()); |
| | | assertEquals(subtreeSet.size(), 10); |
| | | assertTrue(subtreeSet.contains(dn0String)); |
| | |
| | | assertTrue(subtreeSet.contains(dn9String)); |
| | | |
| | | subtreeSet = ditMap.getSubtree( |
| | | DN.decode("ou=Objects,dc=example,dc=com")); |
| | | DN.valueOf("ou=Objects,dc=example,dc=com")); |
| | | assertFalse(subtreeSet.isEmpty()); |
| | | assertEquals(subtreeSet.size(), 7); |
| | | assertTrue(subtreeSet.contains(dn1String)); |
| | |
| | | |
| | | |
| | | subtreeSet = ditMap.getSubtree( |
| | | DN.decode("ou=Classes,dc=example,dc=com")); |
| | | DN.valueOf("ou=Classes,dc=example,dc=com")); |
| | | assertFalse(subtreeSet.isEmpty()); |
| | | assertEquals(subtreeSet.size(), 2); |
| | | assertTrue(subtreeSet.contains(dn4String)); |
| | | assertTrue(subtreeSet.contains(dn5String)); |
| | | |
| | | subtreeSet = ditMap.getSubtree( |
| | | DN.decode("ou=More,ou=Objects,dc=example,dc=com")); |
| | | DN.valueOf("ou=More,ou=Objects,dc=example,dc=com")); |
| | | assertFalse(subtreeSet.isEmpty()); |
| | | assertEquals(subtreeSet.size(), 4); |
| | | assertTrue(subtreeSet.contains(dn6String)); |
| | |
| | | assertTrue(subtreeSet.contains(dn9String)); |
| | | |
| | | subtreeSet = ditMap.getSubtree( |
| | | DN.decode("ou=No,ou=More,ou=Objects,dc=example,dc=com")); |
| | | DN.valueOf("ou=No,ou=More,ou=Objects,dc=example,dc=com")); |
| | | assertFalse(subtreeSet.isEmpty()); |
| | | assertEquals(subtreeSet.size(), 1); |
| | | assertTrue(subtreeSet.contains(dn9String)); |
| | |
| | | putAllAndVerify(); |
| | | |
| | | Set<String> removeSet = new HashSet<String>(); |
| | | assertTrue(ditMap.removeSubtree(DN.decode( |
| | | assertTrue(ditMap.removeSubtree(DN.valueOf( |
| | | "dc=example,dc=com"), |
| | | removeSet)); |
| | | assertFalse(removeSet.isEmpty()); |
| | |
| | | putAllAndVerify(); |
| | | |
| | | removeSet.clear(); |
| | | assertTrue(ditMap.removeSubtree(DN.decode( |
| | | assertTrue(ditMap.removeSubtree(DN.valueOf( |
| | | "ou=Objects,dc=example,dc=com"), |
| | | removeSet)); |
| | | assertFalse(removeSet.isEmpty()); |
| | |
| | | putAllAndVerify(); |
| | | |
| | | removeSet.clear(); |
| | | assertTrue(ditMap.removeSubtree(DN.decode( |
| | | assertTrue(ditMap.removeSubtree(DN.valueOf( |
| | | "ou=Classes,dc=example,dc=com"), |
| | | removeSet)); |
| | | assertFalse(removeSet.isEmpty()); |
| | |
| | | putAllAndVerify(); |
| | | |
| | | removeSet.clear(); |
| | | assertTrue(ditMap.removeSubtree(DN.decode( |
| | | assertTrue(ditMap.removeSubtree(DN.valueOf( |
| | | "ou=More,ou=Objects,dc=example,dc=com"), |
| | | removeSet)); |
| | | assertFalse(removeSet.isEmpty()); |
| | |
| | | putAllAndVerify(); |
| | | |
| | | removeSet.clear(); |
| | | assertTrue(ditMap.removeSubtree(DN.decode( |
| | | assertTrue(ditMap.removeSubtree(DN.valueOf( |
| | | "ou=No,ou=More,ou=Objects,dc=example,dc=com"), |
| | | removeSet)); |
| | | assertFalse(removeSet.isEmpty()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | |
| | | |
| | | |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | DN pluginEntryDN = DN.decode("cn=Null Plugin,cn=Plugins,cn=config"); |
| | | DN pluginEntryDN = DN.valueOf("cn=Null Plugin,cn=Plugins,cn=config"); |
| | | |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(); |
| | | for (PluginType t : PluginType.values()) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | // Save Global ACI. |
| | | Entry e = DirectoryServer.getEntry(DN.decode(ACCESS_HANDLER_DN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf(ACCESS_HANDLER_DN)); |
| | | List<Attribute> attrs = |
| | | e.getAttribute(ConfigConstants.ATTR_AUTHZ_GLOBAL_ACI); |
| | | if (attrs != null && !attrs.isEmpty()) |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | ResultCode rc = |
| | | conn.processModify(DN.decode(ACCESS_HANDLER_DN), |
| | | conn.processModify(DN.valueOf(ACCESS_HANDLER_DN), |
| | | modifications).getResultCode(); |
| | | Assert.assertEquals(rc, ResultCode.SUCCESS, |
| | | "Unable to restore global ACI"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.authorization.dseecompat; |
| | |
| | | throws Exception |
| | | { |
| | | PatternDN patternDN = PatternDN.decode(pattern); |
| | | boolean match = patternDN.matchesDN(DN.decode(entryDN)); |
| | | boolean match = patternDN.matchesDN(DN.valueOf(entryDN)); |
| | | assertTrue(match, pattern + " did not match " + entryDN); |
| | | } |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | PatternDN patternDN = PatternDN.decode(pattern); |
| | | boolean match = patternDN.matchesDN(DN.decode(entryDN)); |
| | | boolean match = patternDN.matchesDN(DN.valueOf(entryDN)); |
| | | assertTrue(!match, pattern + " should not have matched " + entryDN); |
| | | } |
| | | |
| | |
| | | public void applicableTargets(String aciDN, String aciString, String entryDN) |
| | | throws Exception |
| | | { |
| | | Aci aci = Aci.decode(ByteString.valueOf(aciString), DN.decode(aciDN)); |
| | | Aci aci = Aci.decode(ByteString.valueOf(aciString), DN.valueOf(aciDN)); |
| | | boolean match = AciTargets.isTargetApplicable(aci, |
| | | aci.getTargets(), |
| | | DN.decode(entryDN)); |
| | | DN.valueOf(entryDN)); |
| | | assertTrue(match, aciString + " in entry " + aciDN + |
| | | " did not apply to " + entryDN); |
| | | } |
| | |
| | | String entryDN) |
| | | throws Exception |
| | | { |
| | | Aci aci = Aci.decode(ByteString.valueOf(aciString), DN.decode(aciDN)); |
| | | Aci aci = Aci.decode(ByteString.valueOf(aciString), DN.valueOf(aciDN)); |
| | | boolean match = AciTargets.isTargetApplicable(aci, |
| | | aci.getTargets(), |
| | | DN.decode(entryDN)); |
| | | DN.valueOf(entryDN)); |
| | | assertTrue(!match, aciString + " in entry " + aciDN + |
| | | " incorrectly applied to " + entryDN); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | for (DN baseDN : b.getBaseDNs()) |
| | | { |
| | | assertTrue(b.handlesEntry(baseDN)); |
| | | assertTrue(b.handlesEntry(DN.decode("cn=child," + baseDN.toString()))); |
| | | assertTrue(b.handlesEntry(DN.valueOf("cn=child," + baseDN.toString()))); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | "ds-task-import-backend-id: ldifRoot", |
| | | "ds-task-import-ldif-file: " + ldifFile.getAbsolutePath()); |
| | | |
| | | Task t = TasksTestCase.getCompletedTask(DN.decode(taskDN)); |
| | | Task t = TasksTestCase.getCompletedTask(DN.valueOf(taskDN)); |
| | | assertNotNull(t); |
| | | assertEquals(t.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY); |
| | | } |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.NO_SUCH_OBJECT); |
| | | assertEquals(addOperation.getMatchedDN(), DN.decode("o=ldif")); |
| | | assertEquals(addOperation.getMatchedDN(), DN.valueOf("o=ldif")); |
| | | } |
| | | |
| | | |
| | |
| | | public void testAddBaseEntry() |
| | | throws Exception |
| | | { |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=ldif"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=ldif"))); |
| | | assertTrue(DirectoryServer.entryExists( |
| | | DN.decode("uid=user.1,ou=People,o=ldif"))); |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"))); |
| | | |
| | | String path = TestCaseUtils.createTempFile( |
| | | "dn: o=ldif", |
| | |
| | | "-f", path |
| | | }; |
| | | assertEquals(LDAPModify.mainModify(args, false, System.out, System.err), 0); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("o=ldif"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("o=ldif"))); |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.decode("uid=user.1,ou=People,o=ldif"))); |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"))); |
| | | |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | "dn: o=ldif", |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = conn.processAdd(e); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=ldif"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=ldif"))); |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.decode("uid=user.1,ou=People,o=ldif"))); |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"))); |
| | | |
| | | setUp(); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=ldif"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=ldif"))); |
| | | assertTrue(DirectoryServer.entryExists( |
| | | DN.decode("uid=user.1,ou=People,o=ldif"))); |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"))); |
| | | } |
| | | |
| | | |
| | |
| | | "objectClass: organizationalUnit", |
| | | "ou: leaf before"); |
| | | |
| | | DN beforeDN = DN.decode("ou=leaf before,o=ldif"); |
| | | DN afterDN = DN.decode("ou=leaf after,o=ldif"); |
| | | DN beforeDN = DN.valueOf("ou=leaf before,o=ldif"); |
| | | DN afterDN = DN.valueOf("ou=leaf after,o=ldif"); |
| | | |
| | | assertTrue(DirectoryServer.entryExists(beforeDN)); |
| | | assertFalse(DirectoryServer.entryExists(afterDN)); |
| | |
| | | "objectClass: top", |
| | | "objectClass: organizationalUnit", |
| | | "ou: new entry"); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("ou=new entry,o=ldif"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("ou=new entry,o=ldif"))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | conn.processModifyDN("ou=new entry,o=ldif", "ou=People", true); |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.ENTRY_ALREADY_EXISTS); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("ou=new entry,o=ldif"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("ou=new entry,o=ldif"))); |
| | | |
| | | DeleteOperation deleteOperation = conn.processDelete("ou=new entry,o=ldif"); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("ou=new entry,o=ldif"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("ou=new entry,o=ldif"))); |
| | | } |
| | | |
| | | |
| | |
| | | "objectClass: organizationalUnit", |
| | | "ou: leaf before"); |
| | | |
| | | DN beforeDN = DN.decode("ou=leaf before,o=ldif"); |
| | | DN afterDN = DN.decode("ou=leaf after,ou=People,o=ldif"); |
| | | DN beforeDN = DN.valueOf("ou=leaf before,o=ldif"); |
| | | DN afterDN = DN.valueOf("ou=leaf after,ou=People,o=ldif"); |
| | | |
| | | assertTrue(DirectoryServer.entryExists(beforeDN)); |
| | | assertFalse(DirectoryServer.entryExists(afterDN)); |
| | |
| | | public void testModifyDNSubtreeRename() |
| | | throws Exception |
| | | { |
| | | DN beforeDN = DN.decode("ou=People,o=ldif"); |
| | | DN afterDN = DN.decode("ou=Users,o=ldif"); |
| | | DN childBeforeDN = DN.decode("uid=user.1,ou=People,o=ldif"); |
| | | DN childAfterDN = DN.decode("uid=user.1,ou=Users,o=ldif"); |
| | | DN beforeDN = DN.valueOf("ou=People,o=ldif"); |
| | | DN afterDN = DN.valueOf("ou=Users,o=ldif"); |
| | | DN childBeforeDN = DN.valueOf("uid=user.1,ou=People,o=ldif"); |
| | | DN childAfterDN = DN.valueOf("uid=user.1,ou=Users,o=ldif"); |
| | | |
| | | assertTrue(DirectoryServer.entryExists(beforeDN)); |
| | | assertFalse(DirectoryServer.entryExists(afterDN)); |
| | |
| | | conn.processSearch("o=nonexistent2,o=nonexistent1,o=ldif", |
| | | SearchScope.BASE_OBJECT, "(objectClass=*)"); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.NO_SUCH_OBJECT); |
| | | assertEquals(searchOperation.getMatchedDN(), DN.decode("o=ldif")); |
| | | assertEquals(searchOperation.getMatchedDN(), DN.valueOf("o=ldif")); |
| | | } |
| | | |
| | | |
| | |
| | | assertNotNull(b); |
| | | assertTrue(b instanceof LDIFBackend); |
| | | |
| | | assertEquals(b.hasSubordinates(DN.decode("o=ldif")), ConditionResult.TRUE); |
| | | assertEquals(b.hasSubordinates(DN.decode("uid=user.1,ou=People,o=ldif")), |
| | | assertEquals(b.hasSubordinates(DN.valueOf("o=ldif")), ConditionResult.TRUE); |
| | | assertEquals(b.hasSubordinates(DN.valueOf("uid=user.1,ou=People,o=ldif")), |
| | | ConditionResult.FALSE); |
| | | |
| | | try |
| | | { |
| | | b.hasSubordinates(DN.decode("ou=nonexistent,o=ldif")); |
| | | b.hasSubordinates(DN.valueOf("ou=nonexistent,o=ldif")); |
| | | fail("Expected an exception when calling hasSubordinates on a " + |
| | | "non-existent entry"); |
| | | } |
| | |
| | | assertNotNull(b); |
| | | assertTrue(b instanceof LDIFBackend); |
| | | |
| | | assertEquals(b.numSubordinates(DN.decode("o=ldif"), false), 1); |
| | | assertEquals(b.numSubordinates(DN.decode("o=ldif"), true), 26); |
| | | assertEquals(b.numSubordinates(DN.valueOf("o=ldif"), false), 1); |
| | | assertEquals(b.numSubordinates(DN.valueOf("o=ldif"), true), 26); |
| | | assertEquals(b.numSubordinates( |
| | | DN.decode("uid=user.1,ou=People,o=ldif"), false), 0); |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"), false), 0); |
| | | assertEquals(b.numSubordinates( |
| | | DN.decode("uid=user.1,ou=People,o=ldif"), true), 0); |
| | | DN.valueOf("uid=user.1,ou=People,o=ldif"), true), 0); |
| | | |
| | | try |
| | | { |
| | | b.numSubordinates(DN.decode("ou=nonexistent,o=ldif"), false); |
| | | b.numSubordinates(DN.valueOf("ou=nonexistent,o=ldif"), false); |
| | | fail("Expected an exception when calling numSubordinates on a " + |
| | | "non-existent entry"); |
| | | } |
| | |
| | | "ds-task-export-backend-id: ldifRoot", |
| | | "ds-task-export-ldif-file: " + tempFilePath); |
| | | |
| | | Task t = TasksTestCase.getCompletedTask(DN.decode(taskDN)); |
| | | Task t = TasksTestCase.getCompletedTask(DN.valueOf(taskDN)); |
| | | assertNotNull(t); |
| | | assertEquals(t.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | |
| | | public void testGetValidEntry() |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.decode("cn=schema"); |
| | | DN schemaDN = DN.valueOf("cn=schema"); |
| | | Entry schemaEntry = schemaBackend.getEntry(schemaDN); |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getDN(), schemaDN); |
| | |
| | | public void testGetInvalidEntry() |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.decode("cn=notschema"); |
| | | DN schemaDN = DN.valueOf("cn=notschema"); |
| | | Entry schemaEntry = schemaBackend.getEntry(schemaDN); |
| | | assertNull(schemaEntry); |
| | | |
| | | schemaDN = DN.decode("cn=child,cn=schema"); |
| | | schemaDN = DN.valueOf("cn=child,cn=schema"); |
| | | schemaEntry = schemaBackend.getEntry(schemaDN); |
| | | assertNull(schemaEntry); |
| | | } |
| | |
| | | public void testGetSchemaEntry() |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.decode("cn=schema"); |
| | | DN schemaDN = DN.valueOf("cn=schema"); |
| | | Entry schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false); |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getDN(), schemaDN); |
| | |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | |
| | | schemaDN = DN.decode("cn=subschema"); |
| | | schemaDN = DN.valueOf("cn=subschema"); |
| | | schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false); |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getDN(), schemaDN); |
| | |
| | | public void testEntryExistsValidDN() |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.decode("cn=schema"); |
| | | DN schemaDN = DN.valueOf("cn=schema"); |
| | | assertTrue(schemaBackend.entryExists(schemaDN)); |
| | | } |
| | | |
| | |
| | | public void testEntryExistsInvalidDN() |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.decode("cn=notschema"); |
| | | DN schemaDN = DN.valueOf("cn=notschema"); |
| | | assertFalse(schemaBackend.entryExists(schemaDN)); |
| | | } |
| | | |
| | |
| | | @Test(expectedExceptions = { DirectoryException.class }) |
| | | public void testAddEntry() throws Exception |
| | | { |
| | | Entry entry = createEntry(DN.decode("cn=schema")); |
| | | Entry entry = createEntry(DN.valueOf("cn=schema")); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | schemaBackend.addEntry(entry, addOperation); |
| | | } |
| | |
| | | public void testDeleteEntry() |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.decode("cn=schema"); |
| | | DN schemaDN = DN.valueOf("cn=schema"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | public void testRenameEntry() |
| | | throws Exception |
| | | { |
| | | DN currentSchemaDN = DN.decode("cn=schema"); |
| | | DN newSchemaDN = DN.decode("cn=newschema"); |
| | | DN currentSchemaDN = DN.valueOf("cn=schema"); |
| | | DN newSchemaDN = DN.valueOf("cn=newschema"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyDNOperationBasis modifyDNOperation = |
| | | new ModifyDNOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, |
| | | currentSchemaDN, newSchemaDN.getRDN(), |
| | | currentSchemaDN, newSchemaDN.rdn(), |
| | | true, null); |
| | | |
| | | schemaBackend.renameEntry(currentSchemaDN, |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("cn=schema"), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.valueOf("cn=schema"), SearchScope.BASE_OBJECT, |
| | | SearchFilter.createFilterFromString(filterString)); |
| | | assertNotNull(searchOperation); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("cn=schema"), SearchScope.SINGLE_LEVEL, |
| | | conn.processSearch(DN.valueOf("cn=schema"), SearchScope.SINGLE_LEVEL, |
| | | SearchFilter.createFilterFromString(filterString)); |
| | | assertNotNull(searchOperation); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("cn=schema"), SearchScope.WHOLE_SUBTREE, |
| | | conn.processSearch(DN.valueOf("cn=schema"), SearchScope.WHOLE_SUBTREE, |
| | | SearchFilter.createFilterFromString(filterString)); |
| | | assertNotNull(searchOperation); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("cn=schema"), |
| | | conn.processSearch(DN.valueOf("cn=schema"), |
| | | SearchScope.SUBORDINATE_SUBTREE, |
| | | SearchFilter.createFilterFromString(filterString)); |
| | | assertNotNull(searchOperation); |
| | |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DN baseDN = DN.decode("o=bogus,cn=schema"); |
| | | DN baseDN = DN.valueOf("o=bogus,cn=schema"); |
| | | SearchFilter filter = |
| | | SearchFilter.createFilterFromString("(objectClass=*)"); |
| | | |
| | |
| | | public void testTreatAsUserAttrs() |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.decode("cn=schema"); |
| | | DN schemaDN = DN.valueOf("cn=schema"); |
| | | AttributeType a = DirectoryServer.getAttributeType("attributetypes"); |
| | | AttributeType o = DirectoryServer.getAttributeType("objectclasses"); |
| | | AttributeType m = DirectoryServer.getAttributeType("matchingrules"); |
| | |
| | | public void testLastModAttributes() |
| | | throws Exception |
| | | { |
| | | Entry schemaEntry = DirectoryServer.getEntry(DN.decode("cn=schema")); |
| | | Entry schemaEntry = DirectoryServer.getEntry(DN.valueOf("cn=schema")); |
| | | assertNotNull(schemaEntry); |
| | | |
| | | AttributeType cnType = |
| | |
| | | Thread.sleep(6000); |
| | | assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0); |
| | | |
| | | schemaEntry = DirectoryServer.getEntry(DN.decode("cn=schema")); |
| | | schemaEntry = DirectoryServer.getEntry(DN.valueOf("cn=schema")); |
| | | assertNotNull(schemaEntry); |
| | | assertTrue(schemaEntry.hasAttribute(cnType)); |
| | | assertTrue(schemaEntry.hasAttribute(ctType)); |
| | |
| | | throws Exception |
| | | { |
| | | DN configEntryDN = |
| | | DN.decode("ds-cfg-backend-id=schema,cn=Backends,cn=config"); |
| | | DN.valueOf("ds-cfg-backend-id=schema,cn=Backends,cn=config"); |
| | | assertEquals(schemaBackend.getComponentEntryDN(), configEntryDN); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | InternalSearchOperation search = |
| | | conn.processSearch(DN.decode("dc=test,dc=com"), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.valueOf("dc=test,dc=com"), SearchScope.BASE_OBJECT, |
| | | LDAPFilter.decode("(objectClass=*)").toSearchFilter()); |
| | | List<SearchResultEntry> result = search.getSearchEntries(); |
| | | |
| | | assertEquals(result.size(), 1); |
| | | assertEquals(result.get(0).getDN().toString(), "dc=test,dc=com"); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.BASE_OBJECT, LDAPFilter.decode("(ou=People)").toSearchFilter()); |
| | | result = search.getSearchEntries(); |
| | | |
| | | assertEquals(result.size(), 0); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.SINGLE_LEVEL, |
| | | LDAPFilter.decode("(objectClass=*)").toSearchFilter()); |
| | | result = search.getSearchEntries(); |
| | |
| | | assertEquals(result.get(0).getDN().toString(), |
| | | "ou=People,dc=test,dc=com"); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.SUBORDINATE_SUBTREE, |
| | | LDAPFilter.decode("(objectClass=*)").toSearchFilter()); |
| | | result = search.getSearchEntries(); |
| | |
| | | assertThat(entry.getDN().toString()).isNotEqualTo("dc=test,dc=com"); |
| | | } |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("(objectClass=*)").toSearchFilter()); |
| | | result = search.getSearchEntries(); |
| | |
| | | @Test(dependsOnMethods = "testAdd") |
| | | public void testNumSubordinates() throws Exception |
| | | { |
| | | DN dn = DN.decode("dc=test,dc=com"); |
| | | DN dn = DN.valueOf("dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 1); |
| | | assertEquals(backend.numSubordinates(dn, true), 13); |
| | | dn = DN.decode("ou=People,dc=test,dc=com"); |
| | | dn = DN.valueOf("ou=People,dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 12); |
| | | assertEquals(backend.numSubordinates(dn, true), 12); |
| | | dn = DN.decode("dc=com"); |
| | | dn = DN.valueOf("dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), -1); |
| | | assertEquals(backend.numSubordinates(dn, true), -1); |
| | | dn = DN.decode("dc=test1,dc=com"); |
| | | dn = DN.valueOf("dc=test1,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 2); |
| | | assertEquals(backend.numSubordinates(dn, true), 2); |
| | | dn = DN.decode("uid=user.10,ou=People,dc=test,dc=com"); |
| | | dn = DN.valueOf("uid=user.10,ou=People,dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 0); |
| | | assertEquals(backend.numSubordinates(dn, true), 0); |
| | | dn = DN.decode("uid=does not exist,ou=People,dc=test,dc=com"); |
| | | dn = DN.valueOf("uid=does not exist,ou=People,dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), -1); |
| | | assertEquals(backend.numSubordinates(dn, true), -1); |
| | | } |
| | |
| | | int finalCount; |
| | | |
| | | InternalSearchOperation search = |
| | | conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | |
| | | |
| | | attribs.add(ATTR_DEBUG_SEARCH_INDEX); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | |
| | | finalEndPos)); |
| | | assertEquals(finalCount, 1); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | |
| | | finalEndPos)); |
| | | assertEquals(finalCount, 2); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | |
| | | finalEndPos)); |
| | | assertEquals(finalCount, 12); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | |
| | | finalEndPos)); |
| | | assertEquals(finalCount, 11); |
| | | |
| | | search = conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | search = conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | |
| | | InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | deleteSubTreeControl, |
| | | DN.decode("dc=test1,dc=com")); |
| | | DN.valueOf("dc=test1,dc=com")); |
| | | |
| | | backend.deleteEntry(DN.decode("dc=test1,dc=com"), delete); |
| | | backend.deleteEntry(DN.valueOf("dc=test1,dc=com"), delete); |
| | | |
| | | EntryContainer ec = |
| | | backend.getRootContainer().getEntryContainer(DN.decode("dc=test1,dc=com")); |
| | | backend.getRootContainer().getEntryContainer(DN.valueOf("dc=test1,dc=com")); |
| | | ec.sharedLock.lock(); |
| | | try |
| | | { |
| | | assertFalse(ec.entryExists(DN.decode("dc=test1,dc=com"))); |
| | | assertFalse(ec.entryExists(DN.decode("uid=user.362,dc=test1,dc=com"))); |
| | | assertFalse(ec.entryExists(DN.valueOf("dc=test1,dc=com"))); |
| | | assertFalse(ec.entryExists(DN.valueOf("uid=user.362,dc=test1,dc=com"))); |
| | | } |
| | | finally |
| | | { |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | EntryContainer ec = |
| | | backend.getRootContainer().getEntryContainer(DN.decode("ou=People,dc=test,dc=com")); |
| | | backend.getRootContainer().getEntryContainer(DN.valueOf("ou=People,dc=test,dc=com")); |
| | | |
| | | ec.sharedLock.lock(); |
| | | try |
| | | { |
| | | Entry entry = |
| | | ec.getEntry(DN.decode("uid=user.539,ou=People,dc=test,dc=com")); |
| | | ec.getEntry(DN.valueOf("uid=user.539,ou=People,dc=test,dc=com")); |
| | | EntryID entryID = ec.getDN2ID().get(null, |
| | | DN.decode("uid=user.539,ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | DN.valueOf("uid=user.539,ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | |
| | | DeleteOperationBasis delete = new DeleteOperationBasis(conn, |
| | | InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | noControls, |
| | | |
| | | DN.decode("uid=user.539,ou=People,dc=test,dc=com")); |
| | | DN.valueOf("uid=user.539,ou=People,dc=test,dc=com")); |
| | | |
| | | |
| | | backend.deleteEntry(DN.decode("uid=user.539,ou=People,dc=test,dc=com"), |
| | | backend.deleteEntry(DN.valueOf("uid=user.539,ou=People,dc=test,dc=com"), |
| | | delete); |
| | | |
| | | |
| | | assertFalse(ec.entryExists(DN.decode("uid=user.539,ou=People,dc=test,dc=com"))); |
| | | assertFalse(ec.entryExists(DN.valueOf("uid=user.539,ou=People,dc=test,dc=com"))); |
| | | assertNull(ec.getDN2ID().get(null, |
| | | DN.decode("uid=user.539,ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | DN.valueOf("uid=user.539,ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | assertFalse(ec.getDN2URI().delete(null, |
| | | DN.decode("uid=user.539,ou=People,dc=test,dc=com"))); |
| | | DN.valueOf("uid=user.539,ou=People,dc=test,dc=com"))); |
| | | |
| | | AttributeType attribute = |
| | | entries.get(0).getAttribute("cn").get(0).getAttributeType(); |
| | |
| | | backend.replaceEntry(oldEntry, replaceEntry, null); |
| | | |
| | | EntryContainer ec = |
| | | backend.getRootContainer().getEntryContainer(DN.decode("dc=test,dc=com")); |
| | | backend.getRootContainer().getEntryContainer(DN.valueOf("dc=test,dc=com")); |
| | | ec.sharedLock.lock(); |
| | | try |
| | | { |
| | | Entry entry = |
| | | ec.getEntry(DN.decode("uid=user.0,ou=People,dc=test,dc=com")); |
| | | ec.getEntry(DN.valueOf("uid=user.0,ou=People,dc=test,dc=com")); |
| | | EntryID entryID = ec.getDN2ID().get(null, |
| | | DN.decode("uid=user.0,ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | DN.valueOf("uid=user.0,ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | |
| | | assertNotNull(entry); |
| | | for (AttributeValue value : entry.getAttribute("cn").get(0)) { |
| | |
| | | OrderingIndexer orderingIndexer; |
| | | |
| | | EntryContainer ec = backend.getRootContainer().getEntryContainer( |
| | | DN.decode("dc=test,dc=com")); |
| | | DN.valueOf("dc=test,dc=com")); |
| | | ec.sharedLock.lock(); |
| | | try |
| | | { |
| | |
| | | |
| | | newEntry = entries.get(1); |
| | | newEntry.applyModifications(modifications); |
| | | entry = ec.getEntry(DN.decode("uid=user.1,ou=People,dc=test,dc=com")); |
| | | entry = ec.getEntry(DN.valueOf("uid=user.1,ou=People,dc=test,dc=com")); |
| | | entryID = ec.getDN2ID().get(null, |
| | | DN.decode("uid=user.1,ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | DN.valueOf("uid=user.1,ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | |
| | | assertNotNull(entryID); |
| | | |
| | |
| | | |
| | | ModifyOperationBasis modifyOp = new ModifyOperationBasis(conn, InternalClientConnection |
| | | .nextOperationID(), InternalClientConnection.nextMessageID(), noControls, DN |
| | | .decode("uid=user.1,ou=People,dc=test,dc=com"), modifications); |
| | | .valueOf("uid=user.1,ou=People,dc=test,dc=com"), modifications); |
| | | |
| | | backend.replaceEntry(entry, newEntry, modifyOp); |
| | | |
| | | entry = ec.getEntry(DN.decode("uid=user.1,ou=People,dc=test,dc=com")); |
| | | entry = ec.getEntry(DN.valueOf("uid=user.1,ou=People,dc=test,dc=com")); |
| | | |
| | | assertTrue(entry.getAttribute("title").contains( |
| | | Attributes.create("title", "debugger"))); |
| | |
| | | "testMatchedDN"}) |
| | | public void testModifyDN() throws Exception { |
| | | EntryContainer ec = |
| | | backend.getRootContainer().getEntryContainer(DN.decode("dc=test,dc=com")); |
| | | backend.getRootContainer().getEntryContainer(DN.valueOf("dc=test,dc=com")); |
| | | ec.sharedLock.lock(); |
| | | try |
| | | { |
| | | Entry entry = |
| | | ec.getEntry(DN.decode("uid=user.2,ou=People,dc=test,dc=com")); |
| | | entry.setDN(DN.decode("cn=Abbey Abbie,ou=People,dc=test,dc=com")); |
| | | ec.getEntry(DN.valueOf("uid=user.2,ou=People,dc=test,dc=com")); |
| | | entry.setDN(DN.valueOf("cn=Abbey Abbie,ou=People,dc=test,dc=com")); |
| | | |
| | | |
| | | backend.renameEntry(DN.decode("uid=user.2,ou=People,dc=test,dc=com"), |
| | | backend.renameEntry(DN.valueOf("uid=user.2,ou=People,dc=test,dc=com"), |
| | | entry, null); |
| | | |
| | | assertNotNull(backend.getEntry(DN.decode("cn=Abbey Abbie,ou=People,dc=test,dc=com"))); |
| | | assertNotNull(ec.getDN2ID().get(null, DN.decode("cn=Abbey Abbie,ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | assertNotNull(backend.getEntry(DN.valueOf("cn=Abbey Abbie,ou=People,dc=test,dc=com"))); |
| | | assertNotNull(ec.getDN2ID().get(null, DN.valueOf("cn=Abbey Abbie,ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | |
| | | |
| | | assertNull(backend.getEntry(DN.decode("uid=user.2,ou=People,dc=test,dc=com"))); |
| | | assertNull(backend.getEntry(DN.valueOf("uid=user.2,ou=People,dc=test,dc=com"))); |
| | | assertNull(ec.getDN2ID().get(null, |
| | | DN.decode("uid=user.2,ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | DN.valueOf("uid=user.2,ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | } |
| | | finally |
| | | { |
| | |
| | | backend.addEntry(newTop, null); |
| | | |
| | | EntryContainer ec = |
| | | backend.getRootContainer().getEntryContainer(DN.decode("dc=test,dc=com")); |
| | | backend.getRootContainer().getEntryContainer(DN.valueOf("dc=test,dc=com")); |
| | | ec.sharedLock.lock(); |
| | | try |
| | | { |
| | | EntryID newSuperiorID = ec.getDN2ID().get(null, DN.decode("ou=JEB Testers,dc=test,dc=com"), LockMode.DEFAULT); |
| | | EntryID newSuperiorID = ec.getDN2ID().get(null, DN.valueOf("ou=JEB Testers,dc=test,dc=com"), LockMode.DEFAULT); |
| | | EntryID oldID = ec.getDN2ID().get(null, |
| | | DN.decode("ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | DN.valueOf("ou=People,dc=test,dc=com"), LockMode.DEFAULT); |
| | | assertTrue(newSuperiorID.compareTo(oldID) > 0); |
| | | |
| | | List<Control> noControls = new ArrayList<Control>(0); |
| | |
| | | InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | noControls, |
| | | DN.decode("ou=People,dc=test,dc=com"), |
| | | DN.valueOf("ou=People,dc=test,dc=com"), |
| | | RDN.decode("ou=Good People"), |
| | | false, |
| | | DN.decode("ou=JEB Testers,dc=test,dc=com")); |
| | | DN.valueOf("ou=JEB Testers,dc=test,dc=com")); |
| | | |
| | | modifyDN.run(); |
| | | |
| | | assertNotNull(backend.getEntry(DN.decode("ou=Good People,ou=JEB Testers,dc=test,dc=com"))); |
| | | EntryID newID = ec.getDN2ID().get(null, DN.decode("ou=Good People,ou=JEB Testers,dc=test,dc=com"), LockMode.DEFAULT); |
| | | assertNotNull(backend.getEntry(DN.valueOf("ou=Good People,ou=JEB Testers,dc=test,dc=com"))); |
| | | EntryID newID = ec.getDN2ID().get(null, DN.valueOf("ou=Good People,ou=JEB Testers,dc=test,dc=com"), LockMode.DEFAULT); |
| | | assertNotNull(newID); |
| | | assertTrue(newID.compareTo(newSuperiorID) > 0); |
| | | DN subDN = DN.decode("uid=user.0,ou=Good People,ou=JEB Testers,dc=test,dc=com"); |
| | | DN subDN = DN.valueOf("uid=user.0,ou=Good People,ou=JEB Testers,dc=test,dc=com"); |
| | | Entry subEntry = backend.getEntry(subDN); |
| | | assertNotNull(subEntry); |
| | | assertEquals(subDN, subEntry.getDN()); |
| | | EntryID newSubordinateID = ec.getDN2ID().get(null, subDN, LockMode.DEFAULT); |
| | | assertTrue(newSubordinateID.compareTo(newID) > 0); |
| | | |
| | | assertNull(backend.getEntry(DN.decode("ou=People,dc=test,dc=com"))); |
| | | assertNull(backend.getEntry(DN.valueOf("ou=People,dc=test,dc=com"))); |
| | | assertNull(ec.getDN2ID().get(null, |
| | | DN.decode("ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | DN.valueOf("ou=People,dc=test,dc=com"), LockMode.DEFAULT)); |
| | | } |
| | | finally |
| | | { |
| | |
| | | |
| | | RootContainer rootContainer = backend.getRootContainer(); |
| | | |
| | | assertNull(rootContainer.getEntryContainer(DN.decode("dc=test1,dc=com"))); |
| | | assertNull(rootContainer.getEntryContainer(DN.valueOf("dc=test1,dc=com"))); |
| | | |
| | | assertNotNull(rootContainer.getEntryContainer(DN.decode("dc=newsuffix,dc=com"))); |
| | | assertNotNull(rootContainer.getEntryContainer(DN.valueOf("dc=newsuffix,dc=com"))); |
| | | } |
| | | |
| | | @Test(dependsOnMethods = {"testModifyDN", |
| | |
| | | assertEquals(resultCode, 0); |
| | | |
| | | RootContainer rootContainer = backend.getRootContainer(); |
| | | EntryContainer ec = rootContainer.getEntryContainer(DN.decode("dc=test,dc=com")); |
| | | EntryContainer ec = rootContainer.getEntryContainer(DN.valueOf("dc=test,dc=com")); |
| | | |
| | | AttributeIndex index = |
| | | ec.getAttributeIndex(DirectoryServer.getAttributeType("givenname")); |
| | |
| | | attribs.add(ATTR_DEBUG_SEARCH_INDEX); |
| | | |
| | | InternalSearchOperation search = |
| | | conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | |
| | | SearchScope.SUBORDINATE_SUBTREE, |
| | | |
| | |
| | | attribs.add(ATTR_DEBUG_SEARCH_INDEX); |
| | | |
| | | InternalSearchOperation search = |
| | | conn.processSearch(DN.decode("dc=test,dc=com"), |
| | | conn.processSearch(DN.valueOf("dc=test,dc=com"), |
| | | SearchScope.SUBORDINATE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, |
| | | 0, |
| | |
| | | @Test(dependsOnMethods = "testSearchNotIndexed") |
| | | public void testNumSubordinatesIndexEntryLimitExceeded() throws Exception |
| | | { |
| | | DN dn = DN.decode("dc=test,dc=com"); |
| | | DN dn = DN.valueOf("dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 1); |
| | | assertEquals(backend.numSubordinates(dn, true), 14); |
| | | |
| | | // 1 entry was deleted and 2 added for a total of 13 |
| | | dn = DN.decode("ou=People,dc=test,dc=com"); |
| | | dn = DN.valueOf("ou=People,dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 13); |
| | | assertEquals(backend.numSubordinates(dn, true), 13); |
| | | dn = DN.decode("dc=com"); |
| | | dn = DN.valueOf("dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), -1); |
| | | assertEquals(backend.numSubordinates(dn, true), -1); |
| | | dn = DN.decode("dc=test1,dc=com"); |
| | | dn = DN.valueOf("dc=test1,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 2); |
| | | assertEquals(backend.numSubordinates(dn, true), 2); |
| | | dn = DN.decode("uid=user.10,ou=People,dc=test,dc=com"); |
| | | dn = DN.valueOf("uid=user.10,ou=People,dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), 0); |
| | | assertEquals(backend.numSubordinates(dn, true), 0); |
| | | dn = DN.decode("uid=does not exist,ou=People,dc=test,dc=com"); |
| | | dn = DN.valueOf("uid=does not exist,ou=People,dc=test,dc=com"); |
| | | assertEquals(backend.numSubordinates(dn, false), -1); |
| | | assertEquals(backend.numSubordinates(dn, true), -1); |
| | | } |
| | |
| | | ResultCode success = ResultCode.SUCCESS; |
| | | ResultCode noSuchObject = ResultCode.NO_SUCH_OBJECT; |
| | | |
| | | DN testComDN = DN.decode( "dc=test,dc=com"); |
| | | DN dummyTestComDN = DN.decode( "cn=dummy,dc=test,dc=com"); |
| | | DN peopleTestComDN = DN.decode( "ou=people,dc=test,dc=com"); |
| | | DN dummyPeopleTestComDN = DN.decode("cn=dummy,ou=people,dc=test,dc=com"); |
| | | DN testComDN = DN.valueOf( "dc=test,dc=com"); |
| | | DN dummyTestComDN = DN.valueOf( "cn=dummy,dc=test,dc=com"); |
| | | DN peopleTestComDN = DN.valueOf( "ou=people,dc=test,dc=com"); |
| | | DN dummyPeopleTestComDN = DN.valueOf("cn=dummy,ou=people,dc=test,dc=com"); |
| | | |
| | | // Sets of DNs |
| | | return new Object[][] { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | RootContainer rootContainer = be.getRootContainer(); |
| | | EntryContainer entryContainer = |
| | | rootContainer.getEntryContainer(DN.decode("dc=example,dc=com")); |
| | | rootContainer.getEntryContainer(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | entryContainer.sharedLock.lock(); |
| | | try |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | writer.close(); |
| | | ldifFile.close(); |
| | | |
| | | baseDNs = new DN[] { DN.decode("dc=importtest,dc=com"), |
| | | DN.decode("dc=importtest1,dc=com") }; |
| | | baseDNs = new DN[] { DN.valueOf("dc=importtest,dc=com"), |
| | | DN.valueOf("dc=importtest1,dc=com") }; |
| | | |
| | | } |
| | | |
| | |
| | | assertEquals(entryContainer.getEntryCount(), 5); |
| | | assertTrue(entryContainer.entryExists(baseDN)); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("ou=Others,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("ou=Others,ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.0,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("uid=user.0,ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.539,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("uid=user.539,ou=People,dc=importtest,dc=com"))); |
| | | |
| | | VerifyConfig verifyConfig = new VerifyConfig(); |
| | | verifyConfig.setBaseDN(baseDN); |
| | |
| | | assertEquals(entryContainer.getEntryCount(), 3); |
| | | assertTrue(entryContainer.entryExists(baseDN)); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.446,dc=importtest1,dc=com"))); |
| | | .valueOf("uid=user.446,dc=importtest1,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.362,dc=importtest1,dc=com"))); |
| | | .valueOf("uid=user.362,dc=importtest1,dc=com"))); |
| | | |
| | | VerifyConfig verifyConfig = new VerifyConfig(); |
| | | verifyConfig.setBaseDN(baseDN); |
| | |
| | | fileList.add(homeDirName + File.separator + "entries1.ldif"); |
| | | |
| | | ArrayList<DN> includeBranches = new ArrayList<DN>(); |
| | | includeBranches.add(DN.decode("ou=People,dc=importtest,dc=com")); |
| | | includeBranches.add(DN.valueOf("ou=People,dc=importtest,dc=com")); |
| | | ArrayList<DN> excludeBranches = new ArrayList<DN>(); |
| | | excludeBranches.add(DN.decode("ou=Others,ou=People,dc=importtest,dc=com")); |
| | | excludeBranches.add(DN.valueOf("ou=Others,ou=People,dc=importtest,dc=com")); |
| | | |
| | | ByteArrayOutputStream rejectedEntries = new ByteArrayOutputStream(); |
| | | ByteArrayOutputStream skippedEntries = new ByteArrayOutputStream(); |
| | |
| | | assertEquals(entryContainer.getEntryCount(), 5); |
| | | assertTrue(entryContainer.entryExists(baseDN)); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("ou=Others,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("ou=Others,ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.0,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("uid=user.0,ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.539,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("uid=user.539,ou=People,dc=importtest,dc=com"))); |
| | | |
| | | VerifyConfig verifyConfig = new VerifyConfig(); |
| | | verifyConfig.setBaseDN(baseDN); |
| | |
| | | assertEquals(entryContainer.getEntryCount(), 3); |
| | | assertTrue(entryContainer.entryExists(baseDN)); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.446,dc=importtest1,dc=com"))); |
| | | .valueOf("uid=user.446,dc=importtest1,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.362,dc=importtest1,dc=com"))); |
| | | .valueOf("uid=user.362,dc=importtest1,dc=com"))); |
| | | |
| | | VerifyConfig verifyConfig = new VerifyConfig(); |
| | | verifyConfig.setBaseDN(baseDN); |
| | |
| | | EntryContainer entryContainer; |
| | | |
| | | entryContainer = rootContainer.getEntryContainer(DN |
| | | .decode("dc=importtest1,dc=com")); |
| | | .valueOf("dc=importtest1,dc=com")); |
| | | assertNotNull(entryContainer); |
| | | |
| | | entryContainer.sharedLock.lock(); |
| | |
| | | { |
| | | assertTrue(rejectedEntries.size() <= 0); |
| | | Entry entry = entryContainer.getEntry(DN |
| | | .decode("uid=user.446,dc=importtest1,dc=com")); |
| | | .valueOf("uid=user.446,dc=importtest1,dc=com")); |
| | | assertNotNull(entry); |
| | | |
| | | AttributeType attribute = entry.getAttribute("cn").get(0) |
| | |
| | | AttributeValues.create(attribute, "Annalee Bogard"))); |
| | | |
| | | VerifyConfig verifyConfig = new VerifyConfig(); |
| | | verifyConfig.setBaseDN(DN.decode("dc=importtest1,dc=com")); |
| | | verifyConfig.setBaseDN(DN.valueOf("dc=importtest1,dc=com")); |
| | | |
| | | Entry statEntry = bldStatEntry(""); |
| | | be = (BackendImpl) DirectoryServer.getBackend(beID); |
| | |
| | | assertEquals(entryContainer.getEntryCount(), 5); |
| | | assertTrue(entryContainer.entryExists(baseDN)); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.0,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("uid=user.0,ou=People,dc=importtest,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.539,ou=People,dc=importtest,dc=com"))); |
| | | .valueOf("uid=user.539,ou=People,dc=importtest,dc=com"))); |
| | | } |
| | | else if (baseDN.toString().equals("dc=importtest1,dc=com")) |
| | | { |
| | | assertEquals(entryContainer.getEntryCount(), 3); |
| | | assertTrue(entryContainer.entryExists(baseDN)); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.446,dc=importtest1,dc=com"))); |
| | | .valueOf("uid=user.446,dc=importtest1,dc=com"))); |
| | | assertTrue(entryContainer.entryExists(DN |
| | | .decode("uid=user.362,dc=importtest1,dc=com"))); |
| | | .valueOf("uid=user.362,dc=importtest1,dc=com"))); |
| | | } |
| | | } |
| | | finally |
| | |
| | | public void testImportSkip() throws Exception |
| | | { |
| | | ArrayList<DN> excludeBranches = new ArrayList<DN>(); |
| | | excludeBranches.add(DN.decode("dc=skipped,dc=importtest1,dc=com")); |
| | | excludeBranches.add(DN.valueOf("dc=skipped,dc=importtest1,dc=com")); |
| | | ByteArrayOutputStream skippedEntries = new ByteArrayOutputStream(); |
| | | LDIFImportConfig importConfig = new LDIFImportConfig(homeDirName |
| | | + File.separator + "skipped.ldif"); |
| | |
| | | */ |
| | | private Entry bldStatEntry(String dn) throws DirectoryException |
| | | { |
| | | DN entryDN = DN.decode(dn); |
| | | DN entryDN = DN.valueOf(dn); |
| | | HashMap<ObjectClass, String> ocs = new HashMap<ObjectClass, String>(2); |
| | | ObjectClass topOC = DirectoryServer.getObjectClass(OC_TOP); |
| | | if (topOC == null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.enableBackend(beID); |
| | | baseDNs = new DN[] { |
| | | DN.decode(suffix) |
| | | DN.valueOf(suffix) |
| | | }; |
| | | } |
| | | |
| | |
| | | * @throws DirectoryException if the cannot be created. |
| | | */ |
| | | private Entry bldStatEntry(String dn) throws DirectoryException { |
| | | DN entryDN = DN.decode(dn); |
| | | DN entryDN = DN.valueOf(dn); |
| | | HashMap<ObjectClass, String> ocs = new HashMap<ObjectClass, String>(2); |
| | | ObjectClass topOC = DirectoryServer.getObjectClass(OC_TOP); |
| | | if (topOC == null) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | DirectoryServer.getAttributeType("uid"), true); |
| | | sortOrder = new SortOrder(sortKeys); |
| | | |
| | | aaccfJohnsonDN = DN.decode("uid=aaccf.johnson,dc=vlvtest,dc=com"); |
| | | aaronZimmermanDN = DN.decode("uid=aaron.zimmerman,dc=vlvtest,dc=com"); |
| | | albertSmithDN = DN.decode("uid=albert.smith,dc=vlvtest,dc=com"); |
| | | albertZimmermanDN = DN.decode("uid=albert.zimmerman,dc=vlvtest,dc=com"); |
| | | lowercaseMcGeeDN = DN.decode("uid=lowercase.mcgee,dc=vlvtest,dc=com"); |
| | | margaretJonesDN = DN.decode("uid=margaret.jones,dc=vlvtest,dc=com"); |
| | | maryJonesDN = DN.decode("uid=mary.jones,dc=vlvtest,dc=com"); |
| | | samZweckDN = DN.decode("uid=sam.zweck,dc=vlvtest,dc=com"); |
| | | zorroDN = DN.decode("uid=zorro,dc=vlvtest,dc=com"); |
| | | suffixDN = DN.decode("dc=vlvtest,dc=com"); |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=vlvtest,dc=com"); |
| | | aaronZimmermanDN = DN.valueOf("uid=aaron.zimmerman,dc=vlvtest,dc=com"); |
| | | albertSmithDN = DN.valueOf("uid=albert.smith,dc=vlvtest,dc=com"); |
| | | albertZimmermanDN = DN.valueOf("uid=albert.zimmerman,dc=vlvtest,dc=com"); |
| | | lowercaseMcGeeDN = DN.valueOf("uid=lowercase.mcgee,dc=vlvtest,dc=com"); |
| | | margaretJonesDN = DN.valueOf("uid=margaret.jones,dc=vlvtest,dc=com"); |
| | | maryJonesDN = DN.valueOf("uid=mary.jones,dc=vlvtest,dc=com"); |
| | | samZweckDN = DN.valueOf("uid=sam.zweck,dc=vlvtest,dc=com"); |
| | | zorroDN = DN.valueOf("uid=zorro,dc=vlvtest,dc=com"); |
| | | suffixDN = DN.valueOf("dc=vlvtest,dc=com"); |
| | | |
| | | expectedSortedValues = new TreeSet<SortValues>(); |
| | | |
| | |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | RootContainer rootContainer = be.getRootContainer(); |
| | | EntryContainer entryContainer = |
| | | rootContainer.getEntryContainer(DN.decode("dc=vlvtest,dc=com")); |
| | | rootContainer.getEntryContainer(DN.valueOf("dc=vlvtest,dc=com")); |
| | | |
| | | for(VLVIndex vlvIndex : entryContainer.getVLVIndexes()) |
| | | { |
| | |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | RootContainer rootContainer = be.getRootContainer(); |
| | | EntryContainer entryContainer = |
| | | rootContainer.getEntryContainer(DN.decode("dc=vlvtest,dc=com")); |
| | | rootContainer.getEntryContainer(DN.valueOf("dc=vlvtest,dc=com")); |
| | | |
| | | for(VLVIndex vlvIndex : entryContainer.getVLVIndexes()) |
| | | { |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=vlvtest,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | null, null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.enableBackend(beID); |
| | | baseDNs = new DN[] { |
| | | DN.decode(suffix) |
| | | DN.valueOf(suffix) |
| | | }; |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | //Add a junk DN and non-existent entry id to DN2ID index |
| | | DN testDN=DN.decode(junkDN); |
| | | DN testDN=DN.valueOf(junkDN); |
| | | EntryID id=new EntryID(45); |
| | | assertTrue(dn2id.insert(txn, testDN, id)); |
| | | //Make two DN keys point at same entry. |
| | | testDN=DN.decode(junkDN1); |
| | | testDN=DN.valueOf(junkDN1); |
| | | id=new EntryID(3); |
| | | assertTrue(dn2id.insert(txn, testDN, id)); |
| | | //Add badDN key with bad entry id |
| | |
| | | //Try to break JebFormat version |
| | | addID2EntryReturnKey(junkDN3, 20, true); |
| | | id=new EntryID(20); |
| | | assertTrue(dn2id.insert(txn, DN.decode(junkDN3), id)); |
| | | assertTrue(dn2id.insert(txn, DN.valueOf(junkDN3), id)); |
| | | performBECleanVerify("dn2id", 5); |
| | | } |
| | | finally |
| | |
| | | //entry has dn2id key but its entryID -- don't need key |
| | | addID2EntryReturnKey(junkDN1, 11, false); |
| | | //insert key with bad entry id (45 instead of 10) |
| | | DN testDN=DN.decode(junkDN1); |
| | | DN testDN=DN.valueOf(junkDN1); |
| | | EntryID id=new EntryID(45); |
| | | assertTrue(dn2id.insert(txn, testDN, id)); |
| | | //entry has no parent in dn2id |
| | | addID2EntryReturnKey(noParentDN, 12, false); |
| | | //add the key/id |
| | | testDN=DN.decode(noParentDN); |
| | | testDN=DN.valueOf(noParentDN); |
| | | id=new EntryID(12); |
| | | assertTrue(dn2id.insert(txn, testDN, id)); |
| | | performBECompleteVerify("dn2id", 3); |
| | |
| | | cleanAndLoad(numEntries); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | RootContainer rContainer = be.getRootContainer(); |
| | | eContainer= rContainer.getEntryContainer(DN.decode(suffix)); |
| | | eContainer= rContainer.getEntryContainer(DN.valueOf(suffix)); |
| | | id2child=eContainer.getID2Children(); |
| | | id2entry=eContainer.getID2Entry(); |
| | | id2subtree=eContainer.getID2Subtree(); |
| | |
| | | * @throws DirectoryException if the cannot be created. |
| | | */ |
| | | private Entry bldStatEntry(String dn) throws DirectoryException { |
| | | DN entryDN = DN.decode(dn); |
| | | DN entryDN = DN.valueOf(dn); |
| | | HashMap<ObjectClass, String> ocs = new HashMap<ObjectClass, String>(2); |
| | | ObjectClass topOC = DirectoryServer.getObjectClass(OC_TOP); |
| | | if (topOC == null) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.task; |
| | | |
| | |
| | | "ds-task-class-name: org.opends.server.tasks.DummyTask", |
| | | "ds-task-scheduled-start-time: " + startTimeStr, |
| | | "ds-task-dummy-sleep-time: 30000"); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | |
| | | Task task = TasksTestCase.getTask(DN.decode(taskDN)); |
| | | Task task = TasksTestCase.getTask(DN.valueOf(taskDN)); |
| | | assertTrue(TaskState.isPending(task.getTaskState())); |
| | | |
| | | // Perform a modification to delete that task. |
| | |
| | | "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertEquals(resultCode, 0); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | } |
| | | |
| | | |
| | |
| | | "ds-task-id: " + taskID, |
| | | "ds-task-class-name: org.opends.server.tasks.DummyTask", |
| | | "ds-task-dummy-sleep-time: 300000"); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | |
| | | |
| | | // Wait until we're sure that the task has started running. |
| | | long startTime = System.currentTimeMillis(); |
| | | Task task = TasksTestCase.getTask(DN.decode(taskDN)); |
| | | Task task = TasksTestCase.getTask(DN.valueOf(taskDN)); |
| | | while (TaskState.isPending(task.getTaskState())) |
| | | { |
| | | Thread.sleep(10); |
| | |
| | | "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertFalse(resultCode == 0); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | } |
| | | |
| | | |
| | |
| | | "objectClass: extensibleObject", |
| | | "ds-task-id: " + taskID, |
| | | "ds-task-class-name: org.opends.server.tasks.DummyTask"); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | |
| | | |
| | | // Wait until the task has completed. |
| | | Task task = TasksTestCase.getCompletedTask(DN.decode(taskDN)); |
| | | Task task = TasksTestCase.getCompletedTask(DN.valueOf(taskDN)); |
| | | assertTrue(TaskState.isDone(task.getTaskState())); |
| | | |
| | | |
| | |
| | | "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertEquals(resultCode, 0); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | } |
| | | |
| | | |
| | |
| | | "ds-task-class-name: org.opends.server.tasks.DummyTask", |
| | | "ds-task-scheduled-start-time: " + startTimeStr, |
| | | "ds-task-dummy-sleep-time: 30000"); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | |
| | | Task task = TasksTestCase.getTask(DN.decode(taskDN)); |
| | | Task task = TasksTestCase.getTask(DN.valueOf(taskDN)); |
| | | assertTrue(TaskState.isPending(task.getTaskState())); |
| | | |
| | | // Perform a modification to update a non-state attribute. |
| | |
| | | resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | } |
| | | |
| | | |
| | |
| | | "ds-task-id: " + taskID, |
| | | "ds-task-class-name: org.opends.server.tasks.DummyTask", |
| | | "ds-task-dummy-sleep-time: 300000"); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | |
| | | |
| | | // Wait until we're sure that the task has started running. |
| | | long startTime = System.currentTimeMillis(); |
| | | Task task = TasksTestCase.getTask(DN.decode(taskDN)); |
| | | Task task = TasksTestCase.getTask(DN.valueOf(taskDN)); |
| | | while (TaskState.isPending(task.getTaskState())) |
| | | { |
| | | Thread.sleep(10); |
| | |
| | | |
| | | // We may have to wait for the task to register as done, but it should |
| | | // definitely be done before it would have stopped normally. |
| | | task = TasksTestCase.getCompletedTask(DN.decode(taskDN)); |
| | | task = TasksTestCase.getCompletedTask(DN.valueOf(taskDN)); |
| | | assertTrue((System.currentTimeMillis() - startTime) < 300000L); |
| | | assertTrue(TaskState.isDone(task.getTaskState())); |
| | | |
| | |
| | | resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | } |
| | | |
| | | |
| | |
| | | "objectClass: extensibleObject", |
| | | "ds-task-id: " + taskID, |
| | | "ds-task-class-name: org.opends.server.tasks.DummyTask"); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | |
| | | |
| | | // Wait until the task has completed. |
| | | Task task = TasksTestCase.getCompletedTask(DN.decode(taskDN)); |
| | | Task task = TasksTestCase.getCompletedTask(DN.valueOf(taskDN)); |
| | | assertTrue(TaskState.isDone(task.getTaskState())); |
| | | |
| | | |
| | |
| | | "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertEquals(resultCode, 0); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | } |
| | | |
| | | |
| | |
| | | Integer.toString(scheduledMonth) + " *"; |
| | | |
| | | TaskBackend taskBackend = |
| | | (TaskBackend) DirectoryServer.getBackend(DN.decode("cn=tasks")); |
| | | long tasksCountBefore = taskBackend.numSubordinates(DN.decode( |
| | | (TaskBackend) DirectoryServer.getBackend(DN.valueOf("cn=tasks")); |
| | | long tasksCountBefore = taskBackend.numSubordinates(DN.valueOf( |
| | | "cn=Scheduled Tasks,cn=tasks"), true); |
| | | |
| | | assertTrue(addRecurringTask(taskID, taskSchedule)); |
| | | |
| | | // Make sure recurring task iteration got scheduled. |
| | | long tasksCountAfter = taskBackend.numSubordinates(DN.decode( |
| | | long tasksCountAfter = taskBackend.numSubordinates(DN.valueOf( |
| | | "cn=Scheduled Tasks,cn=tasks"), true); |
| | | assertTrue(tasksCountAfter == (tasksCountBefore + 1)); |
| | | |
| | |
| | | TestCaseUtils.applyModifications(true, "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertEquals(resultCode, 0); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | |
| | | // Make sure recurring task iteration got canceled and removed. |
| | | tasksCountAfter = taskBackend.numSubordinates(DN.decode( |
| | | tasksCountAfter = taskBackend.numSubordinates(DN.valueOf( |
| | | "cn=Scheduled Tasks,cn=tasks"), true); |
| | | assertTrue(tasksCountAfter == tasksCountBefore); |
| | | } |
| | |
| | | TestCaseUtils.applyModifications(true, "dn: " + taskDN, |
| | | "changetype: delete"); |
| | | assertEquals(resultCode, 0); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode(taskDN))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf(taskDN))); |
| | | } |
| | | } |
| | | finally |
| | |
| | | return false; |
| | | } |
| | | |
| | | return DirectoryServer.entryExists(DN.decode(taskDN)); |
| | | return DirectoryServer.entryExists(DN.valueOf(taskDN)); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | // Test constructor EntryChangeNotificationControl |
| | | // (PersistentSearchChangeType changeType, DN previousDN, long |
| | | // changeNumber) |
| | | DN dn = DN.decode(dnString); |
| | | DN dn = DN.valueOf(dnString); |
| | | for (PersistentSearchChangeType type : types) |
| | | { |
| | | ecnc = new EntryChangeNotificationControl(type, dn, changeNumber); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | proxyControl = new ProxiedAuthV1Control(ByteString.valueOf("")); |
| | | assertTrue(proxyControl.getOID().equals(OID_PROXIED_AUTH_V1)); |
| | | assertTrue(proxyControl.isCritical()); |
| | | assertTrue(proxyControl.getAuthorizationDN().isNullDN()); |
| | | assertTrue(proxyControl.getAuthorizationDN().isRootDN()); |
| | | |
| | | |
| | | // Try a valid DN, which is acceptable. |
| | |
| | | assertTrue(proxyControl.getOID().equals(OID_PROXIED_AUTH_V1)); |
| | | assertTrue(proxyControl.isCritical()); |
| | | assertEquals(proxyControl.getAuthorizationDN(), |
| | | DN.decode("uid=test,o=test")); |
| | | DN.valueOf("uid=test,o=test")); |
| | | |
| | | |
| | | // Try an invalid DN, which will be initally accepted but will fail when |
| | |
| | | |
| | | |
| | | // Try an empty DN, which is acceptable. |
| | | proxyControl = new ProxiedAuthV1Control(DN.nullDN()); |
| | | proxyControl = new ProxiedAuthV1Control(DN.rootDN()); |
| | | assertTrue(proxyControl.getOID().equals(OID_PROXIED_AUTH_V1)); |
| | | assertTrue(proxyControl.isCritical()); |
| | | assertTrue(proxyControl.getAuthorizationDN().isNullDN()); |
| | | assertTrue(proxyControl.getAuthorizationDN().isRootDN()); |
| | | |
| | | |
| | | // Try a valid DN, which is acceptable. |
| | | proxyControl = |
| | | new ProxiedAuthV1Control(DN.decode("uid=test,o=test")); |
| | | new ProxiedAuthV1Control(DN.valueOf("uid=test,o=test")); |
| | | assertTrue(proxyControl.getOID().equals(OID_PROXIED_AUTH_V1)); |
| | | assertTrue(proxyControl.isCritical()); |
| | | assertEquals(proxyControl.getAuthorizationDN(), |
| | | DN.decode("uid=test,o=test")); |
| | | DN.valueOf("uid=test,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | new LDAPControl(OID_PROXIED_AUTH_V1, true, bsb.toByteString()); |
| | | |
| | | ProxiedAuthV1Control proxyControl = ProxiedAuthV1Control.DECODER.decode(c.isCritical(), c.getValue()); |
| | | assertTrue(proxyControl.getAuthorizationDN().isNullDN()); |
| | | assertTrue(proxyControl.getAuthorizationDN().isRootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | ProxiedAuthV1Control proxyControl = ProxiedAuthV1Control.DECODER.decode(c.isCritical(), c.getValue()); |
| | | assertEquals(proxyControl.getAuthorizationDN(), |
| | | DN.decode("uid=test,o=test")); |
| | | DN.valueOf("uid=test,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | ProxiedAuthV1Control proxyControl = |
| | | new ProxiedAuthV1Control(DN.nullDN()); |
| | | new ProxiedAuthV1Control(DN.rootDN()); |
| | | assertEquals(proxyControl.getRawAuthorizationDN(), ByteString.valueOf("")); |
| | | assertEquals(proxyControl.getAuthorizationDN(), DN.nullDN()); |
| | | assertEquals(proxyControl.getAuthorizationDN(), DN.rootDN()); |
| | | |
| | | proxyControl = |
| | | new ProxiedAuthV1Control(DN.decode("uid=test,o=test")); |
| | | new ProxiedAuthV1Control(DN.valueOf("uid=test,o=test")); |
| | | assertEquals(proxyControl.getRawAuthorizationDN(), |
| | | ByteString.valueOf("uid=test,o=test")); |
| | | assertEquals(proxyControl.getAuthorizationDN(), |
| | | DN.decode("uid=test,o=test")); |
| | | DN.valueOf("uid=test,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | ProxiedAuthV1Control proxyControl = |
| | | new ProxiedAuthV1Control(DN.nullDN()); |
| | | new ProxiedAuthV1Control(DN.rootDN()); |
| | | |
| | | assertNull(proxyControl.getAuthorizationEntry()); |
| | | } |
| | |
| | | "cn: Test User"); |
| | | |
| | | ProxiedAuthV1Control proxyControl = |
| | | new ProxiedAuthV1Control(DN.decode("uid=test,o=test")); |
| | | new ProxiedAuthV1Control(DN.valueOf("uid=test,o=test")); |
| | | |
| | | assertEquals(proxyControl.getAuthorizationEntry().getDN(), |
| | | DN.decode("uid=test,o=test")); |
| | | DN.valueOf("uid=test,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | ProxiedAuthV1Control proxyControl = |
| | | new ProxiedAuthV1Control(DN.decode("uid=test,o=test")); |
| | | new ProxiedAuthV1Control(DN.valueOf("uid=test,o=test")); |
| | | |
| | | proxyControl.getAuthorizationEntry(); |
| | | } |
| | |
| | | "ds-pwp-account-disabled: true"); |
| | | |
| | | ProxiedAuthV1Control proxyControl = |
| | | new ProxiedAuthV1Control(DN.decode("uid=test,o=test")); |
| | | new ProxiedAuthV1Control(DN.valueOf("uid=test,o=test")); |
| | | |
| | | proxyControl.getAuthorizationEntry(); |
| | | } |
| | |
| | | new ProxiedAuthV1Control(ByteString.valueOf("uid=test,o=test")); |
| | | proxyControl.toString(); |
| | | |
| | | proxyControl = new ProxiedAuthV1Control(DN.decode("uid=test,o=test")); |
| | | proxyControl = new ProxiedAuthV1Control(DN.valueOf("uid=test,o=test")); |
| | | proxyControl.toString(); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | ProxiedAuthV2Control proxyControl = |
| | | new ProxiedAuthV2Control(ByteString.valueOf("dn:uid=test,o=test")); |
| | | assertEquals(proxyControl.getAuthorizationEntry().getDN(), |
| | | DN.decode("uid=test,o=test")); |
| | | DN.valueOf("uid=test,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | ProxiedAuthV2Control proxyControl = |
| | | new ProxiedAuthV2Control(ByteString.valueOf("u:test")); |
| | | assertEquals(proxyControl.getAuthorizationEntry().getDN(), |
| | | DN.decode("uid=test,o=test")); |
| | | DN.valueOf("uid=test,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | snType = DirectoryServer.getAttributeType("sn", false); |
| | | assertNotNull(snType); |
| | | |
| | | aaccfJohnsonDN = DN.decode("uid=aaccf.johnson,dc=example,dc=com"); |
| | | aaronZimmermanDN = DN.decode("uid=aaron.zimmerman,dc=example,dc=com"); |
| | | albertSmithDN = DN.decode("uid=albert.smith,dc=example,dc=com"); |
| | | albertZimmermanDN = DN.decode("uid=albert.zimmerman,dc=example,dc=com"); |
| | | lowercaseMcGeeDN = DN.decode("uid=lowercase.mcgee,dc=example,dc=com"); |
| | | margaretJonesDN = DN.decode("uid=margaret.jones,dc=example,dc=com"); |
| | | maryJonesDN = DN.decode("uid=mary.jones,dc=example,dc=com"); |
| | | samZweckDN = DN.decode("uid=sam.zweck,dc=example,dc=com"); |
| | | zorroDN = DN.decode("uid=zorro,dc=example,dc=com"); |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com"); |
| | | aaronZimmermanDN = DN.valueOf("uid=aaron.zimmerman,dc=example,dc=com"); |
| | | albertSmithDN = DN.valueOf("uid=albert.smith,dc=example,dc=com"); |
| | | albertZimmermanDN = DN.valueOf("uid=albert.zimmerman,dc=example,dc=com"); |
| | | lowercaseMcGeeDN = DN.valueOf("uid=lowercase.mcgee,dc=example,dc=com"); |
| | | margaretJonesDN = DN.valueOf("uid=margaret.jones,dc=example,dc=com"); |
| | | maryJonesDN = DN.valueOf("uid=mary.jones,dc=example,dc=com"); |
| | | samZweckDN = DN.valueOf("uid=sam.zweck,dc=example,dc=com"); |
| | | zorroDN = DN.valueOf("uid=zorro,dc=example,dc=com"); |
| | | } |
| | | |
| | | |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | snType = DirectoryServer.getAttributeType("sn", false); |
| | | assertNotNull(snType); |
| | | |
| | | aaccfJohnsonDN = DN.decode("uid=aaccf.johnson,dc=example,dc=com"); |
| | | aaronZimmermanDN = DN.decode("uid=aaron.zimmerman,dc=example,dc=com"); |
| | | albertSmithDN = DN.decode("uid=albert.smith,dc=example,dc=com"); |
| | | albertZimmermanDN = DN.decode("uid=albert.zimmerman,dc=example,dc=com"); |
| | | lowercaseMcGeeDN = DN.decode("uid=lowercase.mcgee,dc=example,dc=com"); |
| | | margaretJonesDN = DN.decode("uid=margaret.jones,dc=example,dc=com"); |
| | | maryJonesDN = DN.decode("uid=mary.jones,dc=example,dc=com"); |
| | | samZweckDN = DN.decode("uid=sam.zweck,dc=example,dc=com"); |
| | | zorroDN = DN.decode("uid=zorro,dc=example,dc=com"); |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com"); |
| | | aaronZimmermanDN = DN.valueOf("uid=aaron.zimmerman,dc=example,dc=com"); |
| | | albertSmithDN = DN.valueOf("uid=albert.smith,dc=example,dc=com"); |
| | | albertZimmermanDN = DN.valueOf("uid=albert.zimmerman,dc=example,dc=com"); |
| | | lowercaseMcGeeDN = DN.valueOf("uid=lowercase.mcgee,dc=example,dc=com"); |
| | | margaretJonesDN = DN.valueOf("uid=margaret.jones,dc=example,dc=com"); |
| | | maryJonesDN = DN.valueOf("uid=mary.jones,dc=example,dc=com"); |
| | | samZweckDN = DN.valueOf("uid=sam.zweck,dc=example,dc=com"); |
| | | zorroDN = DN.valueOf("uid=zorro,dc=example,dc=com"); |
| | | } |
| | | |
| | | |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=person)"), |
| | | null, null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | /** Some of the tests disable the backends, so we reenable them here. */ |
| | | @AfterMethod(alwaysRun=true) |
| | | public void reenableBackend() throws DirectoryException { |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | |
| | |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("ou=People,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | assertTrue(e.hasObjectClass(oc)); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("ou=People,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | assertFalse(e.hasObjectClass(oc)); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("ou=People,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | List<Attribute> attrList = e.getAttribute(a.getAttributeType()); |
| | | assertNotNull(attrList); |
| | | assertFalse(attrList.isEmpty()); |
| | |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("ou=People,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | List<Attribute> attrList = e.getAttribute(a.getAttributeType()); |
| | | assertNotNull(attrList); |
| | | assertFalse(attrList.isEmpty()); |
| | |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("ou=People,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | assertNull(attrList); |
| | | |
| | |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("ou=People,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("ou"); |
| | | assertNotNull(attrList); |
| | | } |
| | |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("uid=test.user,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,o=test")); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getObjectClassAttributeType()); |
| | | assertNotNull(attrList); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | AddOperation addOperation = |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | AddOperation addOperation = |
| | |
| | | values.add(ByteString.valueOf("People")); |
| | | attrs.add(new LDAPAttribute("ou", values)); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | long addRequests = ldapStatistics.getAddRequests(); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Lock entryLock = LockManager.lockRead(DN.decode("ou=People,o=test")); |
| | | Lock entryLock = LockManager.lockRead(DN.valueOf("ou=People,o=test")); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | LockManager.unlock(DN.decode("ou=People,o=test"), entryLock); |
| | | LockManager.unlock(DN.valueOf("ou=People,o=test"), entryLock); |
| | | } |
| | | } |
| | | |
| | |
| | | controls, ByteString.valueOf("o=test"), rawAttrs); |
| | | addOperation.run(); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | |
| | | DN baseDN = DN.decode("o=test"); |
| | | DN baseDN = DN.valueOf("o=test"); |
| | | String backendID = createBackendID(baseDN); |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | |
| | | public void testDeregisterNonExistentBaseDN() |
| | | throws Exception |
| | | { |
| | | DirectoryServer.deregisterBaseDN(DN.decode("o=unregistered")); |
| | | DirectoryServer.deregisterBaseDN(DN.valueOf("o=unregistered")); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | |
| | | DN baseDN = DN.decode("o=test"); |
| | | DN baseDN = DN.valueOf("o=test"); |
| | | String backendID = "test"; |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | |
| | | public void testAddAndRemoveDisabledBackend() |
| | | throws Exception |
| | | { |
| | | DN baseDN = DN.decode("o=bcmtest"); |
| | | DN baseDN = DN.valueOf("o=bcmtest"); |
| | | String backendID = createBackendID(baseDN); |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | |
| | | public void testAddAndRemoveEnabledBackend() |
| | | throws Exception |
| | | { |
| | | DN baseDN = DN.decode("o=bcmtest"); |
| | | DN baseDN = DN.valueOf("o=bcmtest"); |
| | | String backendID = createBackendID(baseDN); |
| | | Entry backendEntry = createBackendEntry(backendID, true, baseDN); |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | // Create the backend and make it disabled. |
| | | DN baseDN = DN.decode("o=bcmtest"); |
| | | DN baseDN = DN.valueOf("o=bcmtest"); |
| | | String backendID = createBackendID(baseDN); |
| | | Entry backendEntry = createBackendEntry(backendID, false, baseDN); |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | // Create the parent backend and the corresponding base entry. |
| | | DN parentBaseDN = DN.decode("o=parent"); |
| | | DN parentBaseDN = DN.valueOf("o=parent"); |
| | | String parentBackendID = createBackendID(parentBaseDN); |
| | | Entry parentBackendEntry = createBackendEntry(parentBackendID, true, |
| | | parentBaseDN); |
| | |
| | | |
| | | |
| | | // Create the child backend and the corresponding base entry. |
| | | DN childBaseDN = DN.decode("ou=child,o=parent"); |
| | | DN childBaseDN = DN.valueOf("ou=child,o=parent"); |
| | | String childBackendID = createBackendID(childBaseDN); |
| | | Entry childBackendEntry = createBackendEntry(childBackendID, true, |
| | | childBaseDN); |
| | |
| | | { |
| | | // Create the child backend and the corresponding base entry (at the time |
| | | // of the creation, it will be a naming context). |
| | | DN childBaseDN = DN.decode("ou=child,o=parent"); |
| | | DN childBaseDN = DN.valueOf("ou=child,o=parent"); |
| | | String childBackendID = createBackendID(childBaseDN); |
| | | Entry childBackendEntry = createBackendEntry(childBackendID, true, |
| | | childBaseDN); |
| | |
| | | |
| | | // Create the parent backend and the corresponding entry (and verify that |
| | | // its DN is now a naming context and the child's is not). |
| | | DN parentBaseDN = DN.decode("o=parent"); |
| | | DN parentBaseDN = DN.valueOf("o=parent"); |
| | | String parentBackendID = createBackendID(parentBaseDN); |
| | | Entry parentBackendEntry = createBackendEntry(parentBackendID, true, |
| | | parentBaseDN); |
| | |
| | | throws Exception |
| | | { |
| | | // Add the parent backend to the server and its corresponding base entry. |
| | | DN parentBaseDN = DN.decode("o=parent"); |
| | | DN parentBaseDN = DN.valueOf("o=parent"); |
| | | String parentBackendID = createBackendID(parentBaseDN); |
| | | Entry parentBackendEntry = createBackendEntry(parentBackendID, true, |
| | | parentBaseDN); |
| | |
| | | |
| | | |
| | | // Add the grandchild backend to the server. |
| | | DN grandchildBaseDN = DN.decode("ou=grandchild,ou=child,o=parent"); |
| | | DN grandchildBaseDN = DN.valueOf("ou=grandchild,ou=child,o=parent"); |
| | | String grandchildBackendID = createBackendID(grandchildBaseDN); |
| | | Entry grandchildBackendEntry = createBackendEntry(grandchildBackendID, true, |
| | | grandchildBaseDN); |
| | |
| | | |
| | | |
| | | // Add the child backend to the server and create its base entry. |
| | | DN childBaseDN = DN.decode("ou=child,o=parent"); |
| | | DN childBaseDN = DN.valueOf("ou=child,o=parent"); |
| | | String childBackendID = createBackendID(childBaseDN); |
| | | Entry childBackendEntry = createBackendEntry(childBackendID, true, |
| | | childBaseDN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | ByteString.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("password")), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", DN.nullDN(), ByteString.empty()), |
| | | null, "3", DN.rootDN(), ByteString.empty()), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", DN.nullDN(), ByteString.empty()), |
| | | noControls, "3", DN.rootDN(), ByteString.empty()), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", nullDN, ByteString.empty()), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", nullDN, ByteString.empty()), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", DN.nullDN(), nullOS), |
| | | null, "3", DN.rootDN(), nullOS), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", DN.nullDN(), nullOS), |
| | | noControls, "3", DN.rootDN(), nullOS), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", nullDN, nullOS), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", nullDN, nullOS), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", DN.decode("cn=Directory Manager"), |
| | | noControls, "3", DN.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("password")) |
| | | }; |
| | | |
| | |
| | | noControls, "3", nullOS, "PLAIN", |
| | | ByteString.valueOf("\u0000u:test.user\u0000password")), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", DN.nullDN(), "EXTERNAL", null), |
| | | null, "3", DN.rootDN(), "EXTERNAL", null), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", DN.nullDN(), "EXTERNAL", null), |
| | | noControls, "3", DN.rootDN(), "EXTERNAL", null), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", nullDN, "EXTERNAL", null), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", nullDN, "EXTERNAL", null), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", DN.nullDN(), "PLAIN", |
| | | null, "3", DN.rootDN(), "PLAIN", |
| | | ByteString.valueOf("\u0000u:test.user\u0000password")), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | noControls, "3", DN.nullDN(), "PLAIN", |
| | | noControls, "3", DN.rootDN(), "PLAIN", |
| | | ByteString.valueOf("\u0000u:test.user\u0000password")), |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | null, "3", nullDN, "PLAIN", |
| | |
| | | ByteString.valueOf("\u0000dn:cn=Directory Manager\u0000password"); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), "PLAIN", saslCreds); |
| | | conn.processSASLBind(DN.rootDN(), "PLAIN", saslCreds); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(bindOperation.getSASLAuthUserEntry()); |
| | | } |
| | |
| | | ByteString.valueOf("\u0000dn:cn=Directory Manager\u0000password"); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), "PLAIN", saslCreds); |
| | | conn.processSASLBind(DN.rootDN(), "PLAIN", saslCreds); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNotNull(bindOperation.getUserEntryDN()); |
| | | } |
| | |
| | | ByteString.valueOf("\u0000dn:cn=Directory Manager\u0000password"); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), "PLAIN", saslCreds); |
| | | conn.processSASLBind(DN.rootDN(), "PLAIN", saslCreds); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(bindOperation.getProcessingStartTime() > 0); |
| | | assertTrue(bindOperation.getProcessingStopTime() >= |
| | |
| | | ByteString.valueOf("\u0000dn:cn=Directory Manager\u0000password"); |
| | | |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), "PLAIN", saslCreds); |
| | | conn.processSASLBind(DN.rootDN(), "PLAIN", saslCreds); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // assertTrue(InvocationCounterPlugin.getPreParseCount() > 0); |
| | |
| | | |
| | | BindOperationBasis bindOperation = |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | requestControls, "3", DN.nullDN(), |
| | | requestControls, "3", DN.rootDN(), |
| | | ByteString.empty()); |
| | | bindOperation.run(); |
| | | assertEquals(bindOperation.getResultCode(), |
| | |
| | | |
| | | BindOperationBasis bindOperation = |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | requestControls, "3", DN.nullDN(), "PLAIN", |
| | | requestControls, "3", DN.rootDN(), "PLAIN", |
| | | saslCreds); |
| | | bindOperation.run(); |
| | | assertEquals(bindOperation.getResultCode(), |
| | |
| | | |
| | | BindOperationBasis bindOperation = |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | requestControls, "3", DN.nullDN(), |
| | | requestControls, "3", DN.rootDN(), |
| | | ByteString.empty()); |
| | | |
| | | bindOperation.run(); |
| | |
| | | |
| | | BindOperationBasis bindOperation = |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | requestControls, "3", DN.nullDN(), "PLAIN", |
| | | requestControls, "3", DN.rootDN(), "PLAIN", |
| | | saslCreds); |
| | | bindOperation.run(); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=config"), mods); |
| | | conn.processModify(DN.valueOf("cn=config"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | BindOperation bindOperation = |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | modifyOperation = conn.processModify(DN.decode("cn=config"), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf("cn=config"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "cn: Rebind Test", |
| | | "userPassword: password"); |
| | | String dnString = "uid=rebind.test,o=test"; |
| | | DN userDN = DN.decode(dnString); |
| | | DN userDN = DN.valueOf(dnString); |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | TestCaseUtils.configureSocket(s); |
| | |
| | | "userPassword: password"); |
| | | |
| | | String dnString = "uid=test,ou=people,dc=example,dc=com"; |
| | | DN userDN = DN.decode(dnString); |
| | | DN userDN = DN.valueOf(dnString); |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | TestCaseUtils.configureSocket(s); |
| | |
| | | "userPassword: password"); |
| | | |
| | | String dnString = "uid=test,ou=people,dc=example,dc=com"; |
| | | DN userDN = DN.decode(dnString); |
| | | DN userDN = DN.valueOf(dnString); |
| | | |
| | | Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort()); |
| | | TestCaseUtils.configureSocket(s); |
| | |
| | | assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0); |
| | | |
| | | String newDNString = "uid=test,ou=users,dc=example,dc=com"; |
| | | DN newUserDN = DN.decode(newDNString); |
| | | DN newUserDN = DN.valueOf(newDNString); |
| | | |
| | | assertNotNull(DirectoryServer.getAuthenticatedUsers().get( |
| | | newUserDN)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.core; |
| | |
| | | "ds-privilege-name: proxied-auth"); |
| | | |
| | | proxyUserConn = |
| | | new InternalClientConnection(DN.decode("uid=proxy.user,o=test")); |
| | | new InternalClientConnection(DN.valueOf("uid=proxy.user,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | /** Some of the tests disable the backends, so we reenable them here. */ |
| | | @AfterMethod(alwaysRun=true) |
| | | public void reenableBackend() throws DirectoryException { |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | |
| | |
| | | newDeleteOperation(null, ByteString.empty()), |
| | | newDeleteOperation(noControls, ByteString.valueOf("o=test")), |
| | | newDeleteOperation(null, ByteString.valueOf("o=test")), |
| | | newDeleteOperation(noControls, DN.nullDN()), |
| | | newDeleteOperation(null, DN.nullDN()), |
| | | newDeleteOperation(noControls, DN.decode("o=test")), |
| | | newDeleteOperation(null, DN.decode("o=test")) |
| | | newDeleteOperation(noControls, DN.rootDN()), |
| | | newDeleteOperation(null, DN.rootDN()), |
| | | newDeleteOperation(noControls, DN.valueOf("o=test")), |
| | | newDeleteOperation(null, DN.valueOf("o=test")) |
| | | }; |
| | | } |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | newDeleteOperation(null, DN.decode("o=test")); |
| | | newDeleteOperation(null, DN.valueOf("o=test")); |
| | | assertNotNull(deleteOperation.getEntryDN()); |
| | | } |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | newDeleteOperation(null, DN.decode("o=test")); |
| | | newDeleteOperation(null, DN.valueOf("o=test")); |
| | | assertNotNull(deleteOperation.getEntryDN()); |
| | | |
| | | deleteOperation.setRawEntryDN(ByteString.valueOf("dc=example,dc=com")); |
| | |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | return conn.processDelete(DN.decode(entryDN)); |
| | | return conn.processDelete(DN.valueOf(entryDN)); |
| | | } |
| | | |
| | | private void processAdd(String... entryLines) throws Exception |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Backend backend = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Backend backend = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | DeleteOperation deleteOperation = processDeleteRaw("o=test"); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Backend backend = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend backend = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | backend.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | String[] args = getArgs("o=test"); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | Lock entryLock = LockManager.lockRead(DN.decode("o=test")); |
| | | Lock entryLock = LockManager.lockRead(DN.valueOf("o=test")); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | LockManager.unlock(DN.decode("o=test"), entryLock); |
| | | LockManager.unlock(DN.valueOf("o=test"), entryLock); |
| | | } |
| | | } |
| | | |
| | |
| | | newDeleteOperation(controls, ByteString.valueOf("o=test")); |
| | | deleteOperation.run(); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | | addNestedGroupTestEntries(); |
| | | DN group1DN = DN.decode("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.decode("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.decode("cn=group 3,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.decode("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.decode("uid=user.5,ou=People,o=test"); |
| | | DN group1DN = DN.valueOf("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.valueOf("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.valueOf("cn=group 3,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.valueOf("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.valueOf("uid=user.5,ou=People,o=test"); |
| | | Entry user1Entry = DirectoryServer.getEntry(user1DN); |
| | | Entry user2Entry = DirectoryServer.getEntry(user2DN); |
| | | Entry user3Entry = DirectoryServer.getEntry(user3DN); |
| | |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | | addNestedGroupTestEntries(); |
| | | DN group1DN = DN.decode("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.decode("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.decode("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.decode("cn=group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.decode("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.decode("uid=user.5,ou=People,o=test"); |
| | | DN group1DN = DN.valueOf("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.valueOf("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.valueOf("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.valueOf("cn=group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.valueOf("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.valueOf("uid=user.5,ou=People,o=test"); |
| | | Entry user1Entry = DirectoryServer.getEntry(user1DN); |
| | | Entry user2Entry = DirectoryServer.getEntry(user2DN); |
| | | Entry user3Entry = DirectoryServer.getEntry(user3DN); |
| | |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | | addNestedGroupTestEntries(); |
| | | DN group1DN = DN.decode("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.decode("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.decode("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.decode("cn=group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.decode("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.decode("uid=user.5,ou=People,o=test"); |
| | | DN group1DN = DN.valueOf("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.valueOf("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.valueOf("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.valueOf("cn=group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.valueOf("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.valueOf("uid=user.5,ou=People,o=test"); |
| | | Entry user1Entry = DirectoryServer.getEntry(user1DN); |
| | | Entry user2Entry = DirectoryServer.getEntry(user2DN); |
| | | Entry user3Entry = DirectoryServer.getEntry(user3DN); |
| | |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | | addNestedGroupTestEntries(); |
| | | DN group1DN = DN.decode("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.decode("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.decode("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.decode("cn=group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN group1DN = DN.valueOf("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.valueOf("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.valueOf("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.valueOf("cn=group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | Entry user1Entry = DirectoryServer.getEntry(user1DN); |
| | | Group<? extends GroupImplementationCfg> group1Instance = |
| | | (Group<? extends GroupImplementationCfg>) |
| | |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | groupManager.deregisterAllGroups(); |
| | | addNestedGroupTestEntries(); |
| | | DN group1DN = DN.decode("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.decode("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.decode("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.decode("cn=group 4,ou=Groups,o=test"); |
| | | DN bogusGroup = DN.decode("cn=bogus group,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.decode("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.decode("uid=user.5,ou=People,o=test"); |
| | | DN group1DN = DN.valueOf("cn=group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.valueOf("cn=group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.valueOf("cn=group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.valueOf("cn=group 4,ou=Groups,o=test"); |
| | | DN bogusGroup = DN.valueOf("cn=bogus group,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | DN user4DN = DN.valueOf("uid=user.4,ou=People,o=test"); |
| | | DN user5DN = DN.valueOf("uid=user.5,ou=People,o=test"); |
| | | Entry user1Entry = DirectoryServer.getEntry(user1DN); |
| | | Entry user2Entry = DirectoryServer.getEntry(user2DN); |
| | | Entry user3Entry = DirectoryServer.getEntry(user3DN); |
| | |
| | | "member: uid=user.1,ou=People,o=test", |
| | | "member: uid=user.2,ou=People,o=test"); |
| | | |
| | | DN groupDN = DN.decode("cn=Test Group of Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | |
| | | try |
| | | { |
| | | groupInstance.addNestedGroup(DN.decode("uid=test,ou=People,o=test")); |
| | | groupInstance.addNestedGroup(DN.valueOf("uid=test,ou=People,o=test")); |
| | | } catch (DirectoryException ex) { |
| | | throw new AssertionError("Expected addNestedGroup to succeed but" + |
| | | " it didn't"); |
| | |
| | | try |
| | | { |
| | | groupInstance.removeNestedGroup( |
| | | DN.decode("uid=test,ou=People,o=test")); |
| | | DN.valueOf("uid=test,ou=People,o=test")); |
| | | } catch (DirectoryException ex) { |
| | | throw new AssertionError("Expected removeNestedGroup to succeed " + |
| | | "but it didn't"); |
| | |
| | | |
| | | |
| | | // Perform a basic set of validation on the group itself. |
| | | DN groupDN = DN.decode("cn=Test Group of Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | } |
| | | |
| | | SearchFilter filter = SearchFilter.createFilterFromString("(uid=user.1)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertTrue(memberList.hasMoreMembers()); |
| | | DN memberDN = memberList.nextMemberDN(); |
| | |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | filter = SearchFilter.createFilterFromString("(uid=user.3)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | |
| | | |
| | | |
| | | // Make sure that the group exists but doesn't have any members. |
| | | DN groupDN = DN.decode("cn=Test Group of Names,ou=Groups,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Names,ou=Groups,o=test"); |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | | assertEquals(groupInstance.getGroupDN(), groupDN); |
| | |
| | | |
| | | |
| | | // Perform a basic set of validation on the group itself. |
| | | DN groupDN = DN.decode("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | } |
| | | |
| | | SearchFilter filter = SearchFilter.createFilterFromString("(uid=user.1)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertTrue(memberList.hasMoreMembers()); |
| | | DN memberDN = memberList.nextMemberDN(); |
| | |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | filter = SearchFilter.createFilterFromString("(uid=user.3)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | |
| | | |
| | | |
| | | // Make sure that the group exists but doesn't have any members. |
| | | DN groupDN = DN.decode("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | | assertEquals(groupInstance.getGroupDN(), groupDN); |
| | |
| | | |
| | | |
| | | // Perform a basic set of validation on the group itself. |
| | | DN groupDN = DN.decode("cn=Test Group of Entries,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Entries,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | } |
| | | |
| | | SearchFilter filter = SearchFilter.createFilterFromString("(uid=user.1)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertTrue(memberList.hasMoreMembers()); |
| | | DN memberDN = memberList.nextMemberDN(); |
| | |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | filter = SearchFilter.createFilterFromString("(uid=user.3)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | |
| | | |
| | | |
| | | // Make sure that the group exists but doesn't have any members. |
| | | DN groupDN = DN.decode("cn=Test Group of Entries,ou=Groups,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Entries,ou=Groups,o=test"); |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | | assertEquals(groupInstance.getGroupDN(), groupDN); |
| | |
| | | |
| | | |
| | | // Perform a basic set of validation on the group itself. |
| | | DN groupDN = DN.decode("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | // Rename the group and make sure the old one no longer exists but the new |
| | | // one does. |
| | | RDN newRDN = RDN.decode("cn=Renamed Group"); |
| | | DN newDN = DN.decode("cn=Renamed Group,ou=Groups,o=test"); |
| | | DN newDN = DN.valueOf("cn=Renamed Group,ou=Groups,o=test"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | |
| | | |
| | | // Perform basic validation on the groups. |
| | | DN group1DN = DN.decode("cn=Group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.decode("cn=Group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.decode("cn=Group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.decode("cn=Group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN group1DN = DN.valueOf("cn=Group 1,ou=Groups,o=test"); |
| | | DN group2DN = DN.valueOf("cn=Group 2,ou=Groups,o=test"); |
| | | DN group3DN = DN.valueOf("cn=Group 3,ou=Groups,o=test"); |
| | | DN group4DN = DN.valueOf("cn=Group 4,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | |
| | | Group group1 = groupManager.getGroupInstance(group1DN); |
| | | Group group2 = groupManager.getGroupInstance(group2DN); |
| | |
| | | |
| | | // Get a client connection authenticated as user1 and make sure it handles |
| | | // group operations correctly. |
| | | InternalClientConnection conn0 = new InternalClientConnection(DN.nullDN()); |
| | | InternalClientConnection conn0 = new InternalClientConnection(DN.rootDN()); |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn0, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | |
| | | InternalClientConnection conn1 = new InternalClientConnection(user1DN); |
| | | searchOperation = |
| | | new InternalSearchOperation(conn1, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | |
| | | InternalClientConnection conn2 = new InternalClientConnection(user2DN); |
| | | searchOperation = |
| | | new InternalSearchOperation(conn2, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | |
| | | InternalClientConnection conn3 = new InternalClientConnection(user3DN); |
| | | searchOperation = |
| | | new InternalSearchOperation(conn3, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | |
| | | |
| | | |
| | | // Get the group instance. |
| | | DN groupDN = DN.decode("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of Unique Names,ou=Groups,o=test"); |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | | assertEquals(groupInstance.getGroupDN(), groupDN); |
| | |
| | | // Perform a filtered iteration across the member DNs. |
| | | SearchFilter filter = |
| | | SearchFilter.createFilterFromString("(objectClass=*)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | while (memberList.hasMoreMembers()) |
| | | { |
| | |
| | | |
| | | // Perform a filtered iteration across the member entries. |
| | | filter = SearchFilter.createFilterFromString("(objectClass=*)"); |
| | | memberList = groupInstance.getMembers(DN.decode("o=test"), |
| | | memberList = groupInstance.getMembers(DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, filter); |
| | | while (memberList.hasMoreMembers()) |
| | | { |
| | |
| | | "cn: Test Group of URLs", |
| | | "memberURL: ldap:///o=test??sub?(sn<=2)"); |
| | | |
| | | DN groupDN = DN.decode("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.decode("uid=user.3,ou=People,o=test"); |
| | | DN bogusDN = DN.decode("uid=bogus,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | DN user3DN = DN.valueOf("uid=user.3,ou=People,o=test"); |
| | | DN bogusDN = DN.valueOf("uid=bogus,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | |
| | | try |
| | | { |
| | | groupInstance.addNestedGroup(DN.decode("uid=test,ou=People,o=test")); |
| | | groupInstance.addNestedGroup(DN.valueOf("uid=test,ou=People,o=test")); |
| | | throw new AssertionError("Expected addNestedGroup to fail but it " + |
| | | "didn't"); |
| | | } catch (UnsupportedOperationException uoe) {} |
| | |
| | | try |
| | | { |
| | | groupInstance.removeNestedGroup( |
| | | DN.decode("uid=test,ou=People,o=test")); |
| | | DN.valueOf("uid=test,ou=People,o=test")); |
| | | throw new AssertionError("Expected removeNestedGroup to fail but " + |
| | | "it didn't"); |
| | | } catch (UnsupportedOperationException uoe) {} |
| | |
| | | "cn: Test Malformed URL", |
| | | "memberURL: ldap:///o=test??sub?(malformed)"); |
| | | |
| | | DN groupDN = DN.decode("cn=Test Malformed URL,ou=Groups,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Malformed URL,ou=Groups,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | "cn: Test Group of URLs", |
| | | "memberURL: ldap:///o=test??sub?(sn<=2)"); |
| | | |
| | | DN groupDN = DN.decode("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | "cn: Test Group of URLs", |
| | | "memberURL: ldap:///o=test??sub?(sn<=2)"); |
| | | |
| | | DN groupDN = DN.decode("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | memberSet.add(user1DN); |
| | | |
| | | MemberList memberList = groupInstance.getMembers( |
| | | DN.decode("ou=people,o=test"), |
| | | DN.valueOf("ou=people,o=test"), |
| | | SearchScope.SINGLE_LEVEL, |
| | | SearchFilter.createFilterFromString("(sn=1)")); |
| | | assertNotNull(memberList); |
| | |
| | | "memberURL: ldap:///o=test??sub?(sn=1)", |
| | | "memberURL: ldap:///o=test??sub?(sn=2)"); |
| | | |
| | | DN groupDN = DN.decode("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | "memberURL: ldap:///o=test??sub?(sn=1)", |
| | | "memberURL: ldap:///ou=People,o=test??subordinate?(!(sn=3))"); |
| | | |
| | | DN groupDN = DN.decode("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.decode("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.decode("uid=user.2,ou=People,o=test"); |
| | | DN groupDN = DN.valueOf("cn=Test Group of URLs,ou=Groups,o=test"); |
| | | DN user1DN = DN.valueOf("uid=user.1,ou=People,o=test"); |
| | | DN user2DN = DN.valueOf("uid=user.2,ou=People,o=test"); |
| | | |
| | | Group groupInstance = groupManager.getGroupInstance(groupDN); |
| | | assertNotNull(groupInstance); |
| | |
| | | memberSet.add(user2DN); |
| | | |
| | | MemberList memberList = |
| | | groupInstance.getMembers(DN.nullDN(), SearchScope.WHOLE_SUBTREE, |
| | | groupInstance.getMembers(DN.rootDN(), SearchScope.WHOLE_SUBTREE, |
| | | SearchFilter.createFilterFromString("(objectClass=*)")); |
| | | assertNotNull(memberList); |
| | | while (memberList.hasMoreMembers()) |
| | |
| | | addSubtreeGroupTestEntries(); |
| | | |
| | | Group group1 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | assertNotNull(group1); |
| | | Group group2 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=groups,dc=example,dc=com")); |
| | | assertNotNull(group2); |
| | | Group group3 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group2,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group2,ou=groups,dc=example,dc=com")); |
| | | assertNotNull(group3); |
| | | |
| | | // Get a client connection authenticated as user1 and make sure it handles |
| | | // group operations correctly. |
| | | DN userDN = DN.decode("uid=test1,ou=people,dc=example,dc=com"); |
| | | DN userDN = DN.valueOf("uid=test1,ou=people,dc=example,dc=com"); |
| | | InternalClientConnection conn = new InternalClientConnection(userDN); |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | |
| | | new InternalClientConnection(userDN); |
| | | searchOperation = |
| | | new InternalSearchOperation(conn1, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | | null); |
| | | |
| | | group1 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | assertNotNull(group1); |
| | | assertTrue(conn1.isMemberOf(group1, null)); |
| | | group2 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=groups,dc=example,dc=com")); |
| | | assertNull(group2); |
| | | group3 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group2,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group2,ou=groups,dc=example,dc=com")); |
| | | assertNull(group3); |
| | | |
| | | // Cleanup. |
| | |
| | | addSubtreeGroupTestEntries(); |
| | | |
| | | Group group1 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | assertNotNull(group1); |
| | | Group group2 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=groups,dc=example,dc=com")); |
| | | assertNotNull(group2); |
| | | Group group3 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group2,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group2,ou=groups,dc=example,dc=com")); |
| | | assertNotNull(group3); |
| | | |
| | | // Get a client connection authenticated as user1 and make sure it handles |
| | | // group operations correctly. |
| | | DN userDN = DN.decode("uid=test1,ou=people,dc=example,dc=com"); |
| | | DN userDN = DN.valueOf("uid=test1,ou=people,dc=example,dc=com"); |
| | | InternalClientConnection conn = new InternalClientConnection(userDN); |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | |
| | | new InternalClientConnection(userDN); |
| | | searchOperation = |
| | | new InternalSearchOperation(conn1, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.nullDN(), |
| | | InternalClientConnection.nextMessageID(), null, DN.rootDN(), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), null, |
| | | null); |
| | | |
| | | group1 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=moregroups,dc=example,dc=com")); |
| | | assertNotNull(group1); |
| | | assertTrue(conn1.isMemberOf(group1, null)); |
| | | group2 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=groups,dc=example,dc=com")); |
| | | assertNull(group2); |
| | | group3 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group2,ou=groups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group2,ou=groups,dc=example,dc=com")); |
| | | assertNull(group3); |
| | | Group newGroup2 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group1,ou=newgroups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group1,ou=newgroups,dc=example,dc=com")); |
| | | assertNotNull(newGroup2); |
| | | assertTrue(conn.isMemberOf(newGroup2, null)); |
| | | Group newGroup3 = groupManager.getGroupInstance( |
| | | DN.decode("cn=group2,ou=newgroups,dc=example,dc=com")); |
| | | DN.valueOf("cn=group2,ou=newgroups,dc=example,dc=com")); |
| | | assertNotNull(newGroup3); |
| | | assertTrue(conn.isMemberOf(newGroup3, null)); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2011 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | for (Object[] backendBaseDN2 : backendBaseDNs) |
| | | { |
| | | String backendBaseDN = backendBaseDN2[0].toString(); |
| | | Backend b = DirectoryServer.getBackend(DN.decode(backendBaseDN)); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf(backendBaseDN)); |
| | | b.setWritabilityMode(WritabilityMode.ENABLED); |
| | | } |
| | | } |
| | |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | | opList.add(newModifyOperation(null, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(null, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.valueOf("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.valueOf("o=test"), mods)); |
| | | |
| | | mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | | opList.add(newModifyOperation(null, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(null, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.valueOf("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.valueOf("o=test"), mods)); |
| | | |
| | | mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | | opList.add(newModifyOperation(null, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(null, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.valueOf("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.valueOf("o=test"), mods)); |
| | | |
| | | mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("description", "bar"))); |
| | | |
| | | opList.add(newModifyOperation(null, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(null, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.valueOf("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.valueOf("o=test"), mods)); |
| | | |
| | | mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("cn", "bar"))); |
| | | |
| | | opList.add(newModifyOperation(null, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.nullDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.decode("o=test"), mods)); |
| | | opList.add(newModifyOperation(null, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.rootDN(), mods)); |
| | | opList.add(newModifyOperation(null, DN.valueOf("o=test"), mods)); |
| | | opList.add(newModifyOperation(noControls, DN.valueOf("o=test"), mods)); |
| | | |
| | | |
| | | |
| | |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | ModifyOperation modifyOperation = newModifyOperation(null, DN.nullDN(), mods); |
| | | ModifyOperation modifyOperation = newModifyOperation(null, DN.rootDN(), mods); |
| | | assertNotNull(modifyOperation.getEntryDN()); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | ModifyOperation modifyOperation = |
| | | newModifyOperation(null, DN.nullDN(), mods); |
| | | newModifyOperation(null, DN.rootDN(), mods); |
| | | assertNotNull(modifyOperation.getEntryDN()); |
| | | |
| | | modifyOperation.setRawEntryDN(ByteString.valueOf("ou=Users,o=test")); |
| | |
| | | public void testGetAndAddModifications() |
| | | throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.decode("o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertNull(e.getAttribute(DirectoryServer.getAttributeType("description", true))); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | |
| | | Attributes.create("l", "Austin"))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("o=test"), mods); |
| | | conn.processModify(DN.valueOf("o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.decode("o=test")); |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertNotNull(e.getAttribute(DirectoryServer.getAttributeType("description", true))); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | |
| | | public void testSuccessAddAttribute() |
| | | throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.decode("o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertNull(e.getAttribute(DirectoryServer.getAttributeType("description", true))); |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("description", "foo"); |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.decode("o=test")); |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertNotNull(e.getAttribute(DirectoryServer.getAttributeType("description", true))); |
| | | } |
| | | |
| | |
| | | public void testSuccessAddAttributeValue() |
| | | throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.decode("o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("o", true)); |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.decode("o=test")); |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeType("o", true)); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | |
| | | public void testSuccessAddAttributeWithOptions(String baseDN) |
| | | throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.decode(baseDN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("o", true)); |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.decode(baseDN)); |
| | | e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeType("o", true)); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("uid=test.user," + baseDN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber", true)); |
| | | assertNotNull(attrList); |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("uid=test.user," + baseDN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber", true)); |
| | | assertNotNull(attrList); |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("uid=test.user," + baseDN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber", true)); |
| | | assertNotNull(attrList); |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("uid=test.user," + baseDN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | assertFalse(e.hasObjectClass( |
| | | DirectoryServer.getObjectClass("extensibleobject", true))); |
| | | } |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("uid=test.user," + baseDN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | assertTrue(e.hasObjectClass(DirectoryServer.getObjectClass("extensibleobject", true))); |
| | | assertTrue(e.hasObjectClass(DirectoryServer.getObjectClass("inetOrgPerson", true))); |
| | | assertTrue(e.hasObjectClass(DirectoryServer.getObjectClass("organizationalPerson", true))); |
| | |
| | | "mail: foo", |
| | | "employeeNumber: 1"); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode(baseDN)); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | b.setWritabilityMode(WritabilityMode.DISABLED); |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "extensibleObject"); |
| | |
| | | "mail: foo", |
| | | "employeeNumber: 1"); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode(baseDN)); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("objectClass", "extensibleObject"); |
| | |
| | | "mail: foo", |
| | | "employeeNumber: 1"); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode(baseDN)); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf(baseDN)); |
| | | b.setWritabilityMode(WritabilityMode.INTERNAL_ONLY); |
| | | |
| | | |
| | |
| | | public void testCannotLockEntry(String baseDN) |
| | | throws Exception |
| | | { |
| | | Lock entryLock = LockManager.lockRead(DN.decode(baseDN)); |
| | | Lock entryLock = LockManager.lockRead(DN.valueOf(baseDN)); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | finally |
| | | { |
| | | LockManager.unlock(DN.decode(baseDN), entryLock); |
| | | LockManager.unlock(DN.valueOf(baseDN), entryLock); |
| | | } |
| | | } |
| | | |
| | |
| | | newModifyOperation(controls, ByteString.valueOf("o=test"), mods); |
| | | modifyOperation.run(); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertFalse(DirectoryServer.getEntry(DN.decode("o=test")).hasAttribute( |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | assertFalse(DirectoryServer.getEntry(DN.valueOf("o=test")).hasAttribute( |
| | | DirectoryServer.getAttributeType("description", true))); |
| | | } |
| | | |
| | |
| | | "userPassword: password"); |
| | | |
| | | Entry e = DirectoryServer.getEntry( |
| | | DN.decode("uid=testPassword03.user," + baseDN)); |
| | | DN.valueOf("uid=testPassword03.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("userpassword", true)); |
| | | assertNotNull(attrList); |
| | |
| | | ), 0); |
| | | // @formatter:on |
| | | |
| | | e = DirectoryServer.getEntry(DN.decode("cn=Test User,o=test")); |
| | | e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | assertNotNull(attrList); |
| | | assertEquals(attrList.size(), 1); |
| | |
| | | ), 0); |
| | | // @formatter:on |
| | | |
| | | e = DirectoryServer.getEntry(DN.decode("cn=Test User,o=test")); |
| | | e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | assertNotNull(attrList); |
| | | assertEquals(attrList.size(), 1); |
| | |
| | | ), 19); |
| | | // @formatter:on |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("cn=Test User,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | assertNotNull(attrList); |
| | | assertEquals(attrList.size(), 1); |
| | |
| | | ), 19); |
| | | // @formatter:on |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("cn=Test User,o=test")); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | assertNotNull(attrList); |
| | | assertEquals(attrList.size(), 1); |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.decode("uid=test.user," + baseDN)); |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("usercertificate", true)); |
| | | assertNotNull(attrList); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | public void testInvalidConstructor(Entry e) |
| | | throws Exception |
| | | { |
| | | DN parentDN = DN.decode("cn=Password Policies,cn=config"); |
| | | DN parentDN = DN.valueOf("cn=Password Policies,cn=config"); |
| | | ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN); |
| | | ConfigEntry configEntry = new ConfigEntry(e, parentEntry); |
| | | |
| | |
| | | public void testGetPasswordAttributeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | AttributeType t = p.getPasswordAttribute(); |
| | |
| | | public void testUsesAuthPasswordSyntaxAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertTrue(p.isAuthPasswordSyntax()); |
| | |
| | | public void testGetDefaultStorageSchemesAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | List<PasswordStorageScheme<?>> defaultSchemes = |
| | |
| | | public void testIsDefaultStorageSchemeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertTrue(p.isDefaultPasswordStorageScheme("SHA1")); |
| | |
| | | public void testGetDeprecatedStorageSchemesAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | Set<String> deprecatedSchemes = |
| | |
| | | public void testIsDeprecatedStorageSchemeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isDeprecatedPasswordStorageScheme("MD5")); |
| | |
| | | public void testGetPasswordValidatorsAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNotNull(p.getPasswordValidators()); |
| | |
| | | public void testGetAccountStatusNotificationHandlersAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNotNull(p.getAccountStatusNotificationHandlers()); |
| | |
| | | public void testAllowUserPasswordChangesAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertTrue(p.isAllowUserPasswordChanges()); |
| | |
| | | public void testRequireCurrentPasswordAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isPasswordChangeRequiresCurrentPassword()); |
| | |
| | | public void testForceChangeOnAddAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isPasswordChangeRequiresCurrentPassword()); |
| | |
| | | public void testForceChangeOnResetAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isPasswordChangeRequiresCurrentPassword()); |
| | |
| | | public void testSkipValidationForAdministratorsAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isSkipValidationForAdministrators()); |
| | |
| | | public void testGetPasswordGeneratorDNAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNotNull(p.getPasswordGenerator()); |
| | |
| | | public void testGetPasswordGeneratorAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNotNull(p.getPasswordGenerator()); |
| | |
| | | public void testRequireSecureAuthenticationAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isRequireSecureAuthentication()); |
| | |
| | | public void testRequireSecurePasswordChangesAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isRequireSecurePasswordChanges()); |
| | |
| | | public void testAllowMultiplePasswordValuesAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isAllowMultiplePasswordValues()); |
| | |
| | | public void testAllowPreEncodedPasswordsAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isAllowPreEncodedPasswords()); |
| | |
| | | public void testGetMinimumPasswordAgeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getMinPasswordAge(), 0); |
| | |
| | | public void testGetMaximumPasswordAgeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getMaxPasswordAge(), 0); |
| | |
| | | public void testGetMaximumPasswordResetAgeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getMaxPasswordResetAge(), 0); |
| | |
| | | public void testGetWarningIntervalAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getPasswordExpirationWarningInterval(), (5*60*60*24)); |
| | |
| | | public void testExpirePasswordsWithoutWarningAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isExpirePasswordsWithoutWarning()); |
| | |
| | | public void testAllowExpiredPasswordChangesAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertFalse(p.isAllowExpiredPasswordChanges()); |
| | |
| | | public void testGetGraceLoginCountAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getGraceLoginCount(), 0); |
| | |
| | | public void testGetLockoutFailureCountAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getLockoutFailureCount(), 0); |
| | |
| | | public void testGetLockoutDurationAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getLockoutDuration(), 0); |
| | |
| | | public void testGetLockoutFailureExpirationIntervalAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getLockoutFailureExpirationInterval(), 0); |
| | |
| | | public void testGetRequireChangeByTimeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getRequireChangeByTime(), 0); |
| | |
| | | public void testGetLastLoginTimeAttributeAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNull(p.getLastLoginTimeAttribute()); |
| | |
| | | public void testGetLastLoginTimeFormatAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNull(p.getLastLoginTimeFormat()); |
| | |
| | | public void testGetPreviousLastLoginTimeFormatsAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNotNull(p.getPreviousLastLoginTimeFormats()); |
| | |
| | | public void testGetIdleLockoutIntervalAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertEquals(p.getIdleLockoutInterval(), 0); |
| | |
| | | public void testToStringAuth() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | DN dn = DN.valueOf("cn=SHA1 AuthPassword Policy,cn=Password Policies," + |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | assertNotNull(p.toString()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | String pluginBase = ",cn=Plugins,cn=config"; |
| | | |
| | | ArrayList<DN> dnList = new ArrayList<DN>(); |
| | | dnList.add(DN.decode("cn=" + PLUGIN_NAME_DELAY + pluginBase)); |
| | | dnList.add(DN.decode("cn=" + PLUGIN_NAME_DISCONNECT + pluginBase)); |
| | | dnList.add(DN.decode("cn=" + PLUGIN_NAME_INVOCATION_COUNTER + pluginBase)); |
| | | dnList.add(DN.decode("cn=" + PLUGIN_NAME_SHORT_CIRCUIT + pluginBase)); |
| | | dnList.add(DN.decode("cn=" + PLUGIN_NAME_UPDATE + pluginBase)); |
| | | dnList.add(DN.valueOf("cn=" + PLUGIN_NAME_DELAY + pluginBase)); |
| | | dnList.add(DN.valueOf("cn=" + PLUGIN_NAME_DISCONNECT + pluginBase)); |
| | | dnList.add(DN.valueOf("cn=" + PLUGIN_NAME_INVOCATION_COUNTER + pluginBase)); |
| | | dnList.add(DN.valueOf("cn=" + PLUGIN_NAME_SHORT_CIRCUIT + pluginBase)); |
| | | dnList.add(DN.valueOf("cn=" + PLUGIN_NAME_UPDATE + pluginBase)); |
| | | |
| | | ArrayList<DirectoryServerPlugin> pluginList = |
| | | new ArrayList<DirectoryServerPlugin>(dnList.size()); |
| | |
| | | |
| | | DN dn = pluginArray[i].getPluginEntryDN(); |
| | | String name = |
| | | dn.getRDN().getAttributeValue(0).getValue().toString().toLowerCase(); |
| | | dn.rdn().getAttributeValue(0).getValue().toString().toLowerCase(); |
| | | actualOrder.append(name); |
| | | |
| | | if (! name.equals(expectedNameOrder[i])) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection( |
| | | new AuthenticationInfo()); |
| | | BindOperation bindOperation = conn.processSimpleBind(DN.nullDN(), null); |
| | | BindOperation bindOperation = conn.processSimpleBind(DN.rootDN(), null); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | ByteString user = ByteString.valueOf("cn=Directory Manager"); |
| | | ByteString password = ByteString.valueOf("password"); |
| | | // Unauthenticated BIND request. |
| | | BindOperation bindOperation = conn.processSimpleBind(DN.nullDN(), null); |
| | | BindOperation bindOperation = conn.processSimpleBind(DN.rootDN(), null); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | // Authenticated BIND request. |
| | | bindOperation = conn.processSimpleBind(user, password); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | // Add the suffix entry. |
| | | DN suffixDN = DN.decode(SUFFIX); |
| | | DN suffixDN = DN.valueOf(SUFFIX); |
| | | if (DirectoryServer.getEntry(suffixDN) == null) |
| | | { |
| | | Entry suffixEntry = StaticUtils.createEntry(suffixDN); |
| | |
| | | } |
| | | |
| | | // Add a search base entry. |
| | | DN baseDN = DN.decode(BASE); |
| | | DN baseDN = DN.valueOf(BASE); |
| | | if (DirectoryServer.getEntry(baseDN) == null) |
| | | { |
| | | Entry baseEntry = StaticUtils.createEntry(baseDN); |
| | |
| | | "subschemasubentry", "entrydn", "ismemberof"); |
| | | |
| | | String userDNString = "uid=test.user,o=test"; |
| | | DN userDN = DN.decode(userDNString); |
| | | DN userDN = DN.valueOf(userDNString); |
| | | |
| | | TestCaseUtils.addEntry("dn: " + userDNString, |
| | | "objectClass: top", |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | String userDNString = "uid=test.user,o=test"; |
| | | DN userDN = DN.decode(userDNString); |
| | | DN userDN = DN.valueOf(userDNString); |
| | | |
| | | TestCaseUtils.addEntry("dn: " + userDNString, |
| | | "objectClass: top", |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | String userDNString = "uid=test.user,o=test"; |
| | | DN userDN = DN.decode(userDNString); |
| | | DN userDN = DN.valueOf(userDNString); |
| | | |
| | | TestCaseUtils.addEntry("dn: " + userDNString, |
| | | "objectClass: top", |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.core; |
| | |
| | | assertEquals(subentryList.size(), 1); |
| | | assertEquals(subentryList.get(0).getEntry(), collectiveSubentry); |
| | | subentryList.clear(); |
| | | subentryList = manager.getSubentries(legacyLdapSubentry.getDN().getParent()); |
| | | subentryList = manager.getSubentries(legacyLdapSubentry.getDN().parent()); |
| | | assertNotNull(subentryList); |
| | | assertEquals(subentryList.size(), 1); |
| | | assertEquals(subentryList.get(0).getEntry(), legacyLdapSubentry); |
| | | subentryList.clear(); |
| | | subentryList = manager.getSubentries(legacyLdapSubentry.getDN().getParent().getParent()); |
| | | subentryList = manager.getSubentries(legacyLdapSubentry.getDN().parent().parent()); |
| | | assertNotNull(subentryList); |
| | | assertEquals(subentryList.size(), 0); |
| | | } |
| | |
| | | { |
| | | // Normal user will not inherit the collective description attribute. |
| | | Entry e = DirectoryServer.getEntry(DN |
| | | .decode("uid=normal user,ou=people,o=test")); |
| | | .valueOf("uid=normal user,ou=people,o=test")); |
| | | assertNotNull(e); |
| | | |
| | | List<Attribute> description = e.getAttribute("description"); |
| | |
| | | |
| | | // Collective user will inherit the collective description attribute. |
| | | e = DirectoryServer.getEntry(DN |
| | | .decode("uid=collective user,ou=people,o=test")); |
| | | .valueOf("uid=collective user,ou=people,o=test")); |
| | | assertNotNull(e); |
| | | |
| | | description = e.getAttribute("description"); |
| | |
| | | finally |
| | | { |
| | | // Clear sub-entry and groups from test backend. |
| | | TestCaseUtils.deleteEntry(DN.decode("cn=description collective attribute,ou=people,o=test")); |
| | | TestCaseUtils.deleteEntry(DN.decode("cn=collective users,ou=people,o=test")); |
| | | TestCaseUtils.deleteEntry(DN.valueOf("cn=description collective attribute,ou=people,o=test")); |
| | | TestCaseUtils.deleteEntry(DN.valueOf("cn=collective users,ou=people,o=test")); |
| | | } |
| | | } |
| | | |
| | |
| | | assertEquals(LDAPDelete.mainDelete(args, false, null, System.err), 0); |
| | | |
| | | assertTrue(DirectoryServer.getSubentryManager().getCollectiveSubentries( |
| | | DN.decode("uid=rogasawara," + BASE)).isEmpty()); |
| | | DN.valueOf("uid=rogasawara," + BASE)).isEmpty()); |
| | | |
| | | assertTrue(DirectoryServer.getSubentryManager().getSubentries( |
| | | DN.decode("uid=rogasawara," + BASE)).isEmpty()); |
| | | DN.valueOf("uid=rogasawara," + BASE)).isEmpty()); |
| | | |
| | | // Re-add entries. |
| | | addTestEntries(); |
| | |
| | | }; |
| | | assertEquals(LDAPModify.mainModify(newArgs, false, null, System.err), 0); |
| | | |
| | | assertNotNull(DirectoryServer.getEntry(DN.decode( |
| | | assertNotNull(DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + NEWBASE + "," + SUFFIX))); |
| | | assertTrue(DirectoryServer.getSubentryManager().getCollectiveSubentries( |
| | | DN.decode("uid=rogasawara," + NEWBASE + "," + SUFFIX)).isEmpty()); |
| | | DN.valueOf("uid=rogasawara," + NEWBASE + "," + SUFFIX)).isEmpty()); |
| | | |
| | | // The legacyLdapSubentry should still apply. |
| | | assertEquals(DirectoryServer.getSubentryManager().getSubentries( |
| | | DN.decode("uid=rogasawara," + NEWBASE + "," + SUFFIX)).size(), 1); |
| | | DN.valueOf("uid=rogasawara," + NEWBASE + "," + SUFFIX)).size(), 1); |
| | | |
| | | // Move it back. |
| | | String oldPath = TestCaseUtils.createTempFile( |
| | |
| | | }; |
| | | assertEquals(LDAPModify.mainModify(oldArgs, false, null, System.err), 0); |
| | | |
| | | assertNotNull(DirectoryServer.getEntry(DN.decode( |
| | | assertNotNull(DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + OLDBASE + "," + SUFFIX))); |
| | | assertFalse(DirectoryServer.getSubentryManager().getCollectiveSubentries( |
| | | DN.decode("uid=rogasawara," + OLDBASE + "," + SUFFIX)).isEmpty()); |
| | | DN.valueOf("uid=rogasawara," + OLDBASE + "," + SUFFIX)).isEmpty()); |
| | | assertFalse(DirectoryServer.getSubentryManager().getSubentries( |
| | | DN.decode("uid=rogasawara," + OLDBASE + "," + SUFFIX)).isEmpty()); |
| | | DN.valueOf("uid=rogasawara," + OLDBASE + "," + SUFFIX)).isEmpty()); |
| | | } |
| | | |
| | | @Test |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | // Add suffix entry. |
| | | DN suffixDN = DN.decode(SUFFIX); |
| | | DN suffixDN = DN.valueOf(SUFFIX); |
| | | if (DirectoryServer.getEntry(suffixDN) == null) |
| | | { |
| | | Entry suffixEntry = StaticUtils.createEntry(suffixDN); |
| | |
| | | } |
| | | |
| | | // Add base entry. |
| | | DN baseDN = DN.decode(BASE); |
| | | DN baseDN = DN.valueOf(BASE); |
| | | if (DirectoryServer.getEntry(baseDN) == null) |
| | | { |
| | | Entry baseEntry = StaticUtils.createEntry(baseDN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | // Add suffix entry. |
| | | DN suffixDN = DN.decode(SUFFIX); |
| | | DN suffixDN = DN.valueOf(SUFFIX); |
| | | if (DirectoryServer.getEntry(suffixDN) == null) |
| | | { |
| | | Entry suffixEntry = StaticUtils.createEntry(suffixDN); |
| | |
| | | } |
| | | |
| | | // Add base entry. |
| | | DN baseDN = DN.decode(BASE); |
| | | DN baseDN = DN.valueOf(BASE); |
| | | if (DirectoryServer.getEntry(baseDN) == null) |
| | | { |
| | | Entry baseEntry = StaticUtils.createEntry(baseDN); |
| | |
| | | assertNotNull(DirectoryServer.getEntry(policyEntry.getDN())); |
| | | |
| | | PasswordPolicy policy = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy( |
| | | DN.decode("cn=Temp Policy," + SUFFIX)); |
| | | DN.valueOf("cn=Temp Policy," + SUFFIX)); |
| | | assertNotNull(policy); |
| | | |
| | | // Check all pwp attributes for correct values. |
| | |
| | | // Make sure this policy applies to the test entry |
| | | // its supposed to target and that its the same |
| | | // policy object as previously tested. |
| | | Entry testEntry = DirectoryServer.getEntry(DN.decode( |
| | | Entry testEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | |
| | | DirectoryServer.getDefaultPasswordPolicy(); |
| | | assertNotNull(defaultPolicy); |
| | | |
| | | Entry testEntry = DirectoryServer.getEntry(DN.decode( |
| | | Entry testEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | |
| | | assertNotNull(DirectoryServer.getEntry(policyEntry.getDN())); |
| | | |
| | | // Make sure just added policy is in effect. |
| | | testEntry = DirectoryServer.getEntry(DN.decode( |
| | | testEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | |
| | | // default policy is in effect again. |
| | | TestCaseUtils.deleteEntry(policyEntry.getDN()); |
| | | |
| | | testEntry = DirectoryServer.getEntry(DN.decode( |
| | | testEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | * Portions copyright 2013 Manuel Gaupp |
| | | */ |
| | | package org.opends.server.core; |
| | |
| | | "ds-privilege-name: proxied-auth"); |
| | | |
| | | proxyUserConn = |
| | | new InternalClientConnection(DN.decode("uid=proxy.user,o=test")); |
| | | new InternalClientConnection(DN.valueOf("uid=proxy.user,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | newModifyDNOperation( ByteString.valueOf("cn=test,ou=test"), |
| | | ByteString.valueOf("cn=test2"), true, |
| | | ByteString.valueOf("dc=example,dc=com")), |
| | | newModifyDNOperation( DN.decode("cn=test,ou=test"), |
| | | newModifyDNOperation( DN.valueOf("cn=test,ou=test"), |
| | | RDN.decode("cn=test2"), true, |
| | | DN.decode("dc=example,dc=com")) |
| | | DN.valueOf("dc=example,dc=com")) |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | assertEquals(modifyDNOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertEquals(modifyDNOperation.getErrorMessage().length(), 0); |
| | | final Entry newEntry = DirectoryServer.getEntry(DN.decode(entryDN)); |
| | | final Entry newEntry = DirectoryServer.getEntry(DN.valueOf(entryDN)); |
| | | assertNotNull(newEntry); |
| | | |
| | | final RDN rdn = newEntry.getDN().getRDN(); |
| | | final RDN rdn = newEntry.getDN().rdn(); |
| | | for (int i = 0; i < rdn.getNumValues(); i++) |
| | | { |
| | | AttributeType attribute = rdn.getAttributeType(i); |
| | |
| | | { |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), false, |
| | | null); |
| | | modifyDNOperation.run(); |
| | |
| | | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.0"), true, |
| | | null); |
| | | modifyDNOperation.run(); |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=USER.0"), true, |
| | | null); |
| | | |
| | |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | assertEquals(modifyDNOperation.getErrorMessage().length(), 0); |
| | | Entry newEntry = DirectoryServer.getEntry(DN.decode( |
| | | Entry newEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=user.0,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | |
| | |
| | | |
| | | // Because deleteOldRDN is true, the values from RDN and the entry have to be identical |
| | | ByteString valueFromEntry = attrList.get(0).iterator().next().getValue(); |
| | | ByteString valueFromRDN = newEntry.getDN().getRDN().getAttributeValue(at).getValue(); |
| | | ByteString valueFromRDN = newEntry.getDN().rdn().getAttributeValue(at).getValue(); |
| | | assertEquals(valueFromEntry,valueFromRDN); |
| | | |
| | | examineCompletedOperation(modifyDNOperation); |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=USER.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=USER.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.0"), true, |
| | | null); |
| | | |
| | |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | assertEquals(modifyDNOperation.getErrorMessage().length(), 0); |
| | | newEntry = DirectoryServer.getEntry(DN.decode( |
| | | newEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=user.0,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=userid.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=userid.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=UserID.0+cn=Test"), false, |
| | | null); |
| | | |
| | |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | assertEquals(modifyDNOperation.getErrorMessage().length(), 0); |
| | | Entry newEntry = DirectoryServer.getEntry(DN.decode( |
| | | Entry newEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=userid.0+cn=test,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | |
| | |
| | | |
| | | // Even though the value of the RDN changed, the representation of the entry's value should be preserved |
| | | ByteString valueFromEntry = attrList.get(0).iterator().next().getValue(); |
| | | ByteString valueFromRDN = newEntry.getDN().getRDN().getAttributeValue(at).getValue(); |
| | | ByteString valueFromRDN = newEntry.getDN().rdn().getAttributeValue(at).getValue(); |
| | | assertEquals(valueFromEntry,ByteString.valueOf("userid.0")); |
| | | |
| | | examineCompletedOperation(modifyDNOperation); |
| | | TestCaseUtils.deleteEntry(DN.decode("uid=UserID.0+cn=Test,ou=People,dc=example,dc=com")); |
| | | TestCaseUtils.deleteEntry(DN.valueOf("uid=UserID.0+cn=Test,ou=People,dc=example,dc=com")); |
| | | } |
| | | |
| | | /** |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=userid.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=userid.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=userid.0+sn=JENSEN"), false, |
| | | null); |
| | | |
| | |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | assertEquals(modifyDNOperation.getErrorMessage().length(), 0); |
| | | Entry newEntry = DirectoryServer.getEntry(DN.decode( |
| | | Entry newEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=userid.0+sn=jensen,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | |
| | |
| | | // Even though the representation of the sn value differs in the RDN, |
| | | // the representation of the entry's value should be preserved |
| | | ByteString valueFromEntry = attrList.get(0).iterator().next().getValue(); |
| | | ByteString valueFromRDN = newEntry.getDN().getRDN().getAttributeValue(at).getValue(); |
| | | ByteString valueFromRDN = newEntry.getDN().rdn().getAttributeValue(at).getValue(); |
| | | assertEquals(valueFromEntry,ByteString.valueOf("Jensen")); |
| | | |
| | | examineCompletedOperation(modifyDNOperation); |
| | | TestCaseUtils.deleteEntry(DN.decode("uid=userid.0+sn=Jensen,ou=People,dc=example,dc=com")); |
| | | TestCaseUtils.deleteEntry(DN.valueOf("uid=userid.0+sn=Jensen,ou=People,dc=example,dc=com")); |
| | | } |
| | | |
| | | @Test |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), true, |
| | | null); |
| | | |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.0"), true, |
| | | null); |
| | | |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), true, |
| | | DN.decode("dc=example,dc=com")); |
| | | DN.valueOf("dc=example,dc=com")); |
| | | |
| | | modifyDNOperation.run(); |
| | | assertSuccessAndEntryExists(modifyDNOperation, |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.test0,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.test0,dc=example,dc=com"), |
| | | RDN.decode("uid=user.0"), true, |
| | | DN.decode("ou=People,dc=example,dc=com")); |
| | | DN.valueOf("ou=People,dc=example,dc=com")); |
| | | |
| | | modifyDNOperation.run(); |
| | | assertSuccessAndEntryExists(modifyDNOperation, |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("cn=Aaccf Amar Test"), true, |
| | | DN.decode("dc=example,dc=com")); |
| | | DN.valueOf("dc=example,dc=com")); |
| | | |
| | | modifyDNOperation.run(); |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | assertEquals(modifyDNOperation.getErrorMessage().length(), 0); |
| | | Entry newEntry = DirectoryServer.getEntry(DN.decode( |
| | | Entry newEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "cn=Aaccf Amar Test,dc=example,dc=com")); |
| | | assertNotNull(newEntry); |
| | | assertNull(DirectoryServer.getEntry(DN.decode("uid=user.0,ou=People,dc=example,dc=com"))); |
| | | assertNull(DirectoryServer.getEntry(DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"))); |
| | | assertNull(newEntry.getAttribute("uid")); |
| | | |
| | | for(Attribute attribute : newEntry.getAttribute("cn")) |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("cn=Aaccf Amar Test,dc=example,dc=com"), |
| | | DN.valueOf("cn=Aaccf Amar Test,dc=example,dc=com"), |
| | | RDN.decode("uid=user.0"), false, |
| | | DN.decode("ou=People,dc=example,dc=com")); |
| | | DN.valueOf("ou=People,dc=example,dc=com")); |
| | | |
| | | modifyDNOperation.run(); |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | | assertEquals(modifyDNOperation.getErrorMessage().length(), 0); |
| | | Entry newOldEntry = DirectoryServer.getEntry(DN.decode( |
| | | Entry newOldEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=user.0,ou=People,dc=example,dc=com")); |
| | | assertNotNull(newOldEntry); |
| | | assertNull(DirectoryServer.getEntry(DN.decode("cn=Aaccf Amar Test,dc=example,dc=com"))); |
| | | assertNull(DirectoryServer.getEntry(DN.valueOf("cn=Aaccf Amar Test,dc=example,dc=com"))); |
| | | for(Attribute attribute : newOldEntry.getAttribute("cn")) |
| | | { |
| | | assertTrue(attribute.contains(AttributeValues.create(attribute.getAttributeType(), "Aaccf Amar Test"))); |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.invalid,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.invalid,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), true, |
| | | DN.decode("dc=example,dc=com")); |
| | | DN.valueOf("dc=example,dc=com")); |
| | | |
| | | modifyDNOperation.run(); |
| | | examineIncompleteOperation(modifyDNOperation, ResultCode.NO_SUCH_OBJECT); |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("invalid=invalid"), true, |
| | | DN.decode("dc=example,dc=com")); |
| | | DN.valueOf("dc=example,dc=com")); |
| | | |
| | | modifyDNOperation.run(); |
| | | examineIncompleteOperation(modifyDNOperation, |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), true, |
| | | DN.decode("dc=invalid,dc=com")); |
| | | DN.valueOf("dc=invalid,dc=com")); |
| | | |
| | | modifyDNOperation.run(); |
| | | examineIncompleteOperation(modifyDNOperation, ResultCode.NO_SUCH_OBJECT); |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("dc=example,dc=com"), |
| | | DN.valueOf("dc=example,dc=com"), |
| | | RDN.decode("dc=exampletest"), true, |
| | | null); |
| | | |
| | |
| | | ModifyDNOperation modifyDNOperation = |
| | | new ModifyDNOperationBasis(proxyUserConn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), controls, |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), false, |
| | | null); |
| | | |
| | |
| | | new ModifyDNOperationBasis(proxyUserConn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | controls, |
| | | DN.decode("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.0"), true, |
| | | null); |
| | | |
| | |
| | | ModifyDNOperation modifyDNOperation = |
| | | new ModifyDNOperationBasis(proxyUserConn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), controls, |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), false, |
| | | null); |
| | | |
| | |
| | | ModifyDNOperation modifyDNOperation = |
| | | new ModifyDNOperationBasis(proxyUserConn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), controls, |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), false, |
| | | null); |
| | | |
| | |
| | | modifyDNOperation = |
| | | new ModifyDNOperationBasis(proxyUserConn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), controls, |
| | | DN.decode("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.test0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.0"), true, |
| | | null); |
| | | |
| | |
| | | ModifyDNOperation modifyDNOperation = |
| | | new ModifyDNOperationBasis(proxyUserConn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), controls, |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), false, |
| | | null); |
| | | |
| | |
| | | ModifyDNOperation modifyDNOperation = |
| | | new ModifyDNOperationBasis(proxyUserConn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), controls, |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), false, |
| | | null); |
| | | |
| | |
| | | ModifyDNOperation modifyDNOperation = |
| | | new ModifyDNOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | controls, |
| | | DN.decode("uid=user.0,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), false, |
| | | null); |
| | | |
| | |
| | | "userPassword: Password"); |
| | | |
| | | assertTrue(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=People,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=People,dc=example,dc=com"))); |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=Users,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=Users,dc=example,dc=com"))); |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | |
| | | |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=People,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=People,dc=example,dc=com"))); |
| | | assertTrue(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=Users,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=Users,dc=example,dc=com"))); |
| | | } |
| | | finally |
| | | { |
| | |
| | | "userPassword: Password"); |
| | | |
| | | assertTrue(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=Org 1.1,ou=Org 1,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=Org 1.1,ou=Org 1,dc=example,dc=com"))); |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=Org 2.1,ou=Org 2,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=Org 2.1,ou=Org 2,dc=example,dc=com"))); |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | |
| | | |
| | | assertFalse(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=Org 1.1,ou=Org 1,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=Org 1.1,ou=Org 1,dc=example,dc=com"))); |
| | | assertTrue(DirectoryServer.entryExists( |
| | | DN.decode("uid=first.test,ou=Org 2.1,ou=Org 2,dc=example,dc=com"))); |
| | | DN.valueOf("uid=first.test,ou=Org 2.1,ou=Org 2,dc=example,dc=com"))); |
| | | } |
| | | finally |
| | | { |
| | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | |
| | | ModifyDNOperation modifyDNOperation = newModifyDNOperation( |
| | | DN.decode("uid=user.invalid,ou=People,dc=example,dc=com"), |
| | | DN.valueOf("uid=user.invalid,ou=People,dc=example,dc=com"), |
| | | RDN.decode("uid=user.test0"), true, |
| | | DN.decode("dc=example,dc=com")); |
| | | DN.valueOf("dc=example,dc=com")); |
| | | |
| | | CancelRequest cancelRequest = new CancelRequest(false, |
| | | Message.raw("testCancelBeforeStartup")); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | // Create a workflow and register it with the server |
| | | String workflowID = baseDN + "#" + backendID; |
| | | WorkflowImpl workflowImpl = new WorkflowImpl( |
| | | workflowID, DN.decode(baseDN), workflowElementID, workflowElement); |
| | | workflowID, DN.valueOf(baseDN), workflowElementID, workflowElement); |
| | | workflowImpl.register(); |
| | | |
| | | // Register the workflow with the internal network group |
| | |
| | | private void createBaseEntry(String baseDN, String backendID) |
| | | throws Exception |
| | | { |
| | | Entry entry = StaticUtils.createEntry(DN.decode(baseDN)); |
| | | Entry entry = StaticUtils.createEntry(DN.valueOf(baseDN)); |
| | | |
| | | AddOperationBasis addOperation = new AddOperationBasis( |
| | | InternalClientConnection.getRootConnection(), |
| | |
| | | Backend backend = DirectoryServer.getBackend(backendID); |
| | | if (createBaseEntry) |
| | | { |
| | | Entry e = createEntry(DN.decode(baseDN)); |
| | | Entry e = createEntry(DN.valueOf(baseDN)); |
| | | backend.addEntry(e, null); |
| | | } |
| | | return backend; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | public Object[][] initDNSet_1() |
| | | throws Exception |
| | | { |
| | | DN dnNull = DN.decode (""); |
| | | DN baseDN1 = DN.decode ("o=test"); |
| | | DN subordinateDN1 = DN.decode ("ou=subtest,o=test"); |
| | | DN unrelatedDN = DN.decode ("o=dummy"); |
| | | DN dnNull = DN.valueOf (""); |
| | | DN baseDN1 = DN.valueOf ("o=test"); |
| | | DN subordinateDN1 = DN.valueOf ("ou=subtest,o=test"); |
| | | DN unrelatedDN = DN.valueOf ("o=dummy"); |
| | | |
| | | // Sets of DNs |
| | | Object[][] myData = |
| | |
| | | String subordinateDN3 = "ou=subordinate3," + baseDN3; |
| | | |
| | | int i = 0; |
| | | baseDNs[i] = DN.decode (baseDN1); |
| | | subordinateDNs[i] = DN.decode (subordinateDN1); |
| | | baseDNs[i] = DN.valueOf (baseDN1); |
| | | subordinateDNs[i] = DN.valueOf (subordinateDN1); |
| | | i++; |
| | | baseDNs[i] = DN.decode (baseDN2); |
| | | subordinateDNs[i] = DN.decode (subordinateDN2); |
| | | baseDNs[i] = DN.valueOf (baseDN2); |
| | | subordinateDNs[i] = DN.valueOf (subordinateDN2); |
| | | i++; |
| | | baseDNs[i] = DN.decode (baseDN3); |
| | | subordinateDNs[i] = DN.decode (subordinateDN3); |
| | | baseDNs[i] = DN.valueOf (baseDN3); |
| | | subordinateDNs[i] = DN.valueOf (subordinateDN3); |
| | | |
| | | unrelatedDN = DN.decode ("o=dummy"); |
| | | rootDSE = DN.decode (""); |
| | | unrelatedDN = DN.valueOf ("o=dummy"); |
| | | rootDSE = DN.valueOf (""); |
| | | } |
| | | |
| | | // Sets of DNs |
| | |
| | | String subordinateDN3 = "ou=subordinate3," + baseDN3; |
| | | |
| | | int i = 0; |
| | | baseDNs[i] = DN.decode (baseDN1); |
| | | subordinateDNs[i] = DN.decode (subordinateDN1); |
| | | baseDNs[i] = DN.valueOf (baseDN1); |
| | | subordinateDNs[i] = DN.valueOf (subordinateDN1); |
| | | i++; |
| | | baseDNs[i] = DN.decode (baseDN2); |
| | | subordinateDNs[i] = DN.decode (subordinateDN2); |
| | | baseDNs[i] = DN.valueOf (baseDN2); |
| | | subordinateDNs[i] = DN.valueOf (subordinateDN2); |
| | | i++; |
| | | baseDNs[i] = DN.decode (baseDN3); |
| | | subordinateDNs[i] = DN.decode (subordinateDN3); |
| | | baseDNs[i] = DN.valueOf (baseDN3); |
| | | subordinateDNs[i] = DN.valueOf (subordinateDN3); |
| | | |
| | | unrelatedDN = DN.decode ("o=dummy"); |
| | | rootDSE = DN.decode (""); |
| | | unrelatedDN = DN.valueOf ("o=dummy"); |
| | | rootDSE = DN.valueOf (""); |
| | | } |
| | | |
| | | // Sets of DNs |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | |
| | | if (clientAuthMethod == AllowedAuthMethod.ANONYMOUS) |
| | | { |
| | | bindDN = DN.nullDN(); |
| | | bindDN = DN.rootDN(); |
| | | } |
| | | else |
| | | { |
| | | bindDN = |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | DN.valueOf("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | } |
| | | |
| | | ClientConnection client = |
| | |
| | | boolean expectedResult) throws Exception |
| | | { |
| | | ClientConnection client = |
| | | new MockClientConnection(12345, false, DN.nullDN(), |
| | | new MockClientConnection(12345, false, DN.rootDN(), |
| | | AllowedAuthMethod.ANONYMOUS); |
| | | |
| | | AuthenticationType authType; |
| | |
| | | { |
| | | case ANONYMOUS: |
| | | authType = null; |
| | | bindDN = DN.nullDN(); |
| | | bindDN = DN.rootDN(); |
| | | break; |
| | | case SIMPLE: |
| | | authType = AuthenticationType.SIMPLE; |
| | | bindDN = |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | DN.valueOf("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | break; |
| | | default: // SASL |
| | | authType = AuthenticationType.SASL; |
| | | bindDN = |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | DN.valueOf("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | break; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | @DataProvider(name = "testData") |
| | | public Object[][] createTestData() throws Exception |
| | | { |
| | | DN anonymousUser = DN.nullDN(); |
| | | DN anonymousUser = DN.rootDN(); |
| | | DN rootUser = |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | DN.valueOf("cn=Directory Manager, cn=Root DNs, cn=config"); |
| | | PatternDN rootMatch = PatternDN.decode("*, cn=Root DNs, cn=config"); |
| | | PatternDN rootNoMatch = |
| | | PatternDN.decode("cn=Dirx*, cn=Root DNs, cn=config"); |
| | |
| | | throws Exception |
| | | { |
| | | ClientConnection client = |
| | | new MockClientConnection(12345, false, DN.nullDN(), |
| | | new MockClientConnection(12345, false, DN.rootDN(), |
| | | AllowedAuthMethod.ANONYMOUS); |
| | | |
| | | BindDNConnectionCriteria criteria = |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | AddressMask matchAnything = AddressMask.decode("*.*.*.*"); |
| | | AddressMask matchNothing = AddressMask.decode("0.0.0.0"); |
| | | ClientConnection client = |
| | | new MockClientConnection(12345, false, DN.nullDN(), |
| | | new MockClientConnection(12345, false, DN.rootDN(), |
| | | AllowedAuthMethod.ANONYMOUS); |
| | | |
| | | Collection<AddressMask> emptyMasks = Collections.emptySet(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | String networkGroupID2 = "networkGroup2"; |
| | | |
| | | // Workflow base DNs |
| | | DN dn1 = DN.decode("o=test1"); |
| | | DN dn2 = DN.decode("o=test2"); |
| | | DN dn1 = DN.valueOf("o=test1"); |
| | | DN dn2 = DN.valueOf("o=test2"); |
| | | |
| | | // Network group info |
| | | return new Object[][] { |
| | |
| | | @DataProvider(name = "DNSet_1") |
| | | public Object[][] initDNSet_1() throws Exception |
| | | { |
| | | DN dnRootDSE = DN.decode(""); |
| | | DN dnConfig = DN.decode("cn=config"); |
| | | DN dnMonitor = DN.decode("cn=monitor"); |
| | | DN dnSchema = DN.decode("cn=schema"); |
| | | DN dnTasks = DN.decode("cn=tasks"); |
| | | DN dnBackups = DN.decode("cn=backups"); |
| | | DN dnDummy = DN.decode("o=dummy_suffix"); |
| | | DN dnRootDSE = DN.valueOf(""); |
| | | DN dnConfig = DN.valueOf("cn=config"); |
| | | DN dnMonitor = DN.valueOf("cn=monitor"); |
| | | DN dnSchema = DN.valueOf("cn=schema"); |
| | | DN dnTasks = DN.valueOf("cn=tasks"); |
| | | DN dnBackups = DN.valueOf("cn=backups"); |
| | | DN dnDummy = DN.valueOf("o=dummy_suffix"); |
| | | |
| | | DN dnSubordinateConfig = DN.decode("cn=Work Queue,cn=config"); |
| | | DN dnSubordinateMonitor = DN.decode("cn=schema Backend,cn=monitor"); |
| | | DN dnSubordinateTasks = DN.decode("cn=Scheduled Tasks,cn=tasks"); |
| | | DN dnSubordinateConfig = DN.valueOf("cn=Work Queue,cn=config"); |
| | | DN dnSubordinateMonitor = DN.valueOf("cn=schema Backend,cn=monitor"); |
| | | DN dnSubordinateTasks = DN.valueOf("cn=Scheduled Tasks,cn=tasks"); |
| | | // No DN subordinate for schema because the schema backend is |
| | | // currently empty. |
| | | // No DN subordinate for cn=backups because by default there is no |
| | |
| | | public Object[][] initDNSet_2() throws Exception |
| | | { |
| | | // Network group definition |
| | | DN dn1 = DN.decode("o=test1"); |
| | | DN dn2 = DN.decode("o=test2"); |
| | | DN dn3 = DN.decode("o=test3"); |
| | | DN subordinate1 = DN.decode("ou=subtest1,o=test1"); |
| | | DN subordinate2 = DN.decode("ou=subtest2,o=test2"); |
| | | DN subordinate3 = DN.decode("ou=subtest3,o=test3"); |
| | | DN unrelatedDN = DN.decode("o=dummy"); |
| | | DN dn1 = DN.valueOf("o=test1"); |
| | | DN dn2 = DN.valueOf("o=test2"); |
| | | DN dn3 = DN.valueOf("o=test3"); |
| | | DN subordinate1 = DN.valueOf("ou=subtest1,o=test1"); |
| | | DN subordinate2 = DN.valueOf("ou=subtest2,o=test2"); |
| | | DN subordinate3 = DN.valueOf("ou=subtest3,o=test3"); |
| | | DN unrelatedDN = DN.valueOf("o=dummy"); |
| | | |
| | | // Network group info |
| | | return new Object[][] { |
| | |
| | | { |
| | | // Network group definition |
| | | String networkGroupID = "networkGroup1"; |
| | | DN dn = DN.decode("o=test1"); |
| | | DN dn = DN.valueOf("o=test1"); |
| | | int prio = 1; |
| | | |
| | | // Resource limits |
| | |
| | | { |
| | | String networkGroupID1 = "group1"; |
| | | String networkGroupID2 = "group2"; |
| | | DN dn1 = DN.decode("o=test1"); |
| | | DN dn2 = DN.decode("o=test2"); |
| | | DN dn1 = DN.valueOf("o=test1"); |
| | | DN dn2 = DN.valueOf("o=test2"); |
| | | |
| | | return new Object[][] { |
| | | { |
| | |
| | | |
| | | // Use simple bind on this connection |
| | | Entry userEntry = DirectoryServer.getEntry( |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config")); |
| | | DN.valueOf("cn=Directory Manager, cn=Root DNs, cn=config")); |
| | | ClientConnection connection2 = new InternalClientConnection( |
| | | new AuthenticationInfo(userEntry, userEntry.getDN(), true)); |
| | | ng = NetworkGroup.findMatchingNetworkGroup(connection2); |
| | |
| | | |
| | | // Use simple bind on this connection |
| | | Entry userEntry = DirectoryServer.getEntry( |
| | | DN.decode("cn=Directory Manager, cn=Root DNs, cn=config")); |
| | | DN.valueOf("cn=Directory Manager, cn=Root DNs, cn=config")); |
| | | ClientConnection connection2 = new InternalClientConnection( |
| | | new AuthenticationInfo(userEntry, userEntry.getDN(), true)); |
| | | ng = NetworkGroup.findMatchingNetworkGroup(connection2); |
| | |
| | | ) throws Exception |
| | | { |
| | | SearchOperation search = connection.processSearch( |
| | | DN.decode(""), |
| | | DN.valueOf(""), |
| | | SearchScope.SINGLE_LEVEL, |
| | | LDAPFilter.decode("(objectClass=*)").toSearchFilter()); |
| | | |
| | |
| | | ) throws Exception |
| | | { |
| | | SearchOperation search = connection.processSearch( |
| | | DN.decode(baseDN), |
| | | DN.valueOf(baseDN), |
| | | SearchScope.BASE_OBJECT, |
| | | LDAPFilter.decode("(objectClass=*)").toSearchFilter()); |
| | | |
| | |
| | | Attributes.create(attributeName, attributeValue); |
| | | mods.add(new Modification(modType, attributeToModify)); |
| | | ModifyOperation modifyOperation = connection.processModify( |
| | | DN.decode(baseDN), mods); |
| | | DN.valueOf(baseDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | throws DirectoryException |
| | | { |
| | | TreeSet<DN> subtrees1 = new TreeSet<DN>(); |
| | | subtrees1.add(DN.decode("ou=people,dc=example,dc=com")); |
| | | subtrees1.add(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees2 = new TreeSet<DN>(); |
| | | subtrees2.add(DN.decode("ou=test,dc=example,dc=com")); |
| | | subtrees2.add(DN.valueOf("ou=test,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees3 = new TreeSet<DN>(); |
| | | subtrees3.add(DN.decode("dc=example,dc=com")); |
| | | subtrees3.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees4 = new TreeSet<DN>(); |
| | | subtrees4.add(DN.decode("dc=example,dc=com")); |
| | | subtrees4.add(DN.decode("dc=test,dc=com")); |
| | | subtrees4.add(DN.valueOf("dc=example,dc=com")); |
| | | subtrees4.add(DN.valueOf("dc=test,dc=com")); |
| | | |
| | | Object[][] myData = { |
| | | // allowed subtrees, subtree to test, success |
| | |
| | | public Object[][] initProhibitedSubtreesSet() throws DirectoryException |
| | | { |
| | | TreeSet<DN> subtrees1 = new TreeSet<DN>(); |
| | | subtrees1.add(DN.decode("ou=people,dc=example,dc=com")); |
| | | subtrees1.add(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees2 = new TreeSet<DN>(); |
| | | subtrees2.add(DN.decode("ou=test,dc=example,dc=com")); |
| | | subtrees2.add(DN.valueOf("ou=test,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees3 = new TreeSet<DN>(); |
| | | subtrees3.add(DN.decode("dc=example,dc=com")); |
| | | subtrees3.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees4 = new TreeSet<DN>(); |
| | | subtrees4.add(DN.decode("dc=example,dc=com")); |
| | | subtrees4.add(DN.decode("dc=test,dc=com")); |
| | | subtrees4.add(DN.valueOf("dc=example,dc=com")); |
| | | subtrees4.add(DN.valueOf("dc=test,dc=com")); |
| | | |
| | | Object[][] myData = { |
| | | // prohibited subtrees, subtree to test, success |
| | |
| | | TreeSet<DN> subtrees_empty = new TreeSet<DN>(); |
| | | |
| | | TreeSet<DN> subtrees_root = new TreeSet<DN>(); |
| | | subtrees_root.add(DN.decode("dc=example,dc=com")); |
| | | subtrees_root.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees_people = new TreeSet<DN>(); |
| | | subtrees_people.add(DN.decode("ou=people,dc=example,dc=com")); |
| | | subtrees_people.add(DN.valueOf("ou=people,dc=example,dc=com")); |
| | | |
| | | TreeSet<DN> subtrees_entry = new TreeSet<DN>(); |
| | | subtrees_entry.add(DN.decode("uid=user.1,ou=people,dc=example,dc=com")); |
| | | subtrees_entry.add(DN.valueOf("uid=user.1,ou=people,dc=example,dc=com")); |
| | | |
| | | Object[][] myData = { |
| | | // allowed subtree, prohibited subtree, subtree to test, success |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.decode("dc=example,dc=com"), |
| | | DN.valueOf("dc=example,dc=com"), |
| | | SearchScope.BASE_OBJECT, |
| | | LDAPFilter.decode(searchFilter).toSearchFilter()); |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.decode("dc=example,dc=com"), |
| | | DN.valueOf("dc=example,dc=com"), |
| | | SearchScope.BASE_OBJECT, |
| | | LDAPFilter.decode(searchFilter).toSearchFilter()); |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.decode("dc=example,dc=com"), |
| | | DN.valueOf("dc=example,dc=com"), |
| | | searchScope, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.decode(searchSubtree), |
| | | DN.valueOf(searchSubtree), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.decode(searchSubtree), |
| | | DN.valueOf(searchSubtree), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | InternalSearchOperation search = conn.processSearch( |
| | | DN.decode(searchSubtree), |
| | | DN.valueOf(searchSubtree), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("objectclass=*").toSearchFilter()); |
| | | |
| | |
| | | Attribute attributeToModify = Attributes.create("attr", "newVal"); |
| | | mods.add(new Modification(ModificationType.ADD, attributeToModify)); |
| | | op = (PreParseModifyOperation) conn.processModify( |
| | | DN.decode("uid=user.1,ou=people,dc=example,dc=com"), mods); |
| | | DN.valueOf("uid=user.1,ou=people,dc=example,dc=com"), mods); |
| | | break; |
| | | case MODIFY_DN: |
| | | op = (PreParseModifyDNOperation) conn.processModifyDN( |
| | |
| | | "uid=usr.1,ou=people,dc=example,dc=com", true); |
| | | break; |
| | | case SEARCH: |
| | | op = conn.processSearch(DN.decode("dc=example,dc=com"), |
| | | op = conn.processSearch(DN.valueOf("dc=example,dc=com"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | LDAPFilter.decode("uid>=user.1").toSearchFilter()); |
| | | break; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | limits.addConnection(conn1); |
| | | |
| | | InternalSearchOperation search = conn1.processSearch( |
| | | DN.decode("dc=example,dc=com"), |
| | | DN.valueOf("dc=example,dc=com"), |
| | | SearchScope.BASE_OBJECT, |
| | | LDAPFilter.decode(searchFilter).toSearchFilter()); |
| | | |
| | |
| | | InternalClientConnection conn = new InternalClientConnection(DN.NULL_DN); |
| | | limits.addConnection(conn); |
| | | |
| | | final DN dn = DN.decode("dc=example,dc=com"); |
| | | final DN dn = DN.valueOf("dc=example,dc=com"); |
| | | final SearchFilter all = SearchFilter.createFilterFromString("(objectclass=*)"); |
| | | |
| | | // First operation is allowed |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core.networkgroups; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | ClientConnection client = |
| | | new MockClientConnection(12345, isSecure, DN.nullDN(), |
| | | new MockClientConnection(12345, isSecure, DN.rootDN(), |
| | | AllowedAuthMethod.ANONYMOUS); |
| | | |
| | | Assert.assertEquals(criteria.matches(client), expectedResult); |
| | |
| | | throws Exception |
| | | { |
| | | ClientConnection client = |
| | | new MockClientConnection(12345, false, DN.nullDN(), |
| | | new MockClientConnection(12345, false, DN.rootDN(), |
| | | AllowedAuthMethod.ANONYMOUS); |
| | | |
| | | Assert.assertEquals(criteria.willMatchAfterBind(client, |
| | | DN.nullDN(), AuthenticationType.SIMPLE, isSecure), |
| | | DN.rootDN(), AuthenticationType.SIMPLE, isSecure), |
| | | expectedResult); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.crypto; |
| | | |
| | |
| | | // specified transformation and key length. Mark each entry compromised. |
| | | final String baseDNStr // TODO: is this DN defined elsewhere as a constant? |
| | | = "cn=secret keys," + ADSContext.getAdministrationSuffixDN(); |
| | | final DN baseDN = DN.decode(baseDNStr); |
| | | final DN baseDN = DN.valueOf(baseDNStr); |
| | | final String FILTER_OC_INSTANCE_KEY |
| | | = new StringBuilder("(objectclass=") |
| | | .append(ConfigConstants.OC_CRYPTO_CIPHER_KEY) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.crypto; |
| | |
| | | // specified transformation and key length. |
| | | final String baseDNStr // TODO: is this DN defined elsewhere as a constant? |
| | | = "cn=secret keys," + ADSContext.getAdministrationSuffixDN(); |
| | | final DN baseDN = DN.decode(baseDNStr); |
| | | final DN baseDN = DN.valueOf(baseDNStr); |
| | | final String FILTER_OC_INSTANCE_KEY |
| | | = new StringBuilder("(objectclass=") |
| | | .append(ConfigConstants.OC_CRYPTO_CIPHER_KEY) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | BindOperationBasis bindOperation = |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), "3", DN.nullDN(), |
| | | new ArrayList<Control>(), "3", DN.rootDN(), |
| | | SASL_MECHANISM_ANONYMOUS, null); |
| | | handler.processSASLBind(bindOperation); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | BindOperationBasis bindOperation = |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), "3", DN.nullDN(), |
| | | new ArrayList<Control>(), "3", DN.rootDN(), |
| | | SASL_MECHANISM_ANONYMOUS, ByteString.empty()); |
| | | handler.processSASLBind(bindOperation); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | BindOperationBasis bindOperation = |
| | | new BindOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), "3", DN.nullDN(), |
| | | new ArrayList<Control>(), "3", DN.rootDN(), |
| | | SASL_MECHANISM_ANONYMOUS, |
| | | ByteString.valueOf("Internal Trace String")); |
| | | handler.processSASLBind(bindOperation); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2013 ForgeRock, AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | ModifyOperationBasis modifyOperation = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertEquals(validator.passwordIsAcceptable(pwOS, |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, |
| | | ByteString.valueOf("invalid")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, null); |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, null); |
| | | assertEquals(bindOperation.getResultCode(), |
| | | ResultCode.SASL_BIND_IN_PROGRESS); |
| | | |
| | | bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, |
| | | ByteString.valueOf("malformed")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, null); |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, null); |
| | | assertEquals(bindOperation.getResultCode(), |
| | | ResultCode.SASL_BIND_IN_PROGRESS); |
| | | |
| | | ByteString creds = |
| | | ByteString.valueOf("dn:cn=Directory Manager malformeddigest"); |
| | | bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, creds); |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, creds); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, null); |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, null); |
| | | assertEquals(bindOperation.getResultCode(), |
| | | ResultCode.SASL_BIND_IN_PROGRESS); |
| | | |
| | |
| | | ByteString.valueOf("dn:cn=Directory Manager " + |
| | | "malformedcredswiththerightlength"); |
| | | bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, creds); |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_CRAM_MD5, creds); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | ModifyOperationBasis modifyOperation = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertEquals(validator.passwordIsAcceptable(pwOS, |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | assertFalse(cache.containsEntry(testEntriesList.get(0).getDN()), |
| | | "Not expected to find " + testEntriesList.get(0).getDN().toString() + |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | assertNull(cache.getEntry(testEntriesList.get(0).getDN()), |
| | | "Not expected to find " + testEntriesList.get(0).getDN().toString() + |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | assertNull(cache.getEntry(testEntriesList.get(0).getDN()), |
| | | "Not expected to find " + testEntriesList.get(0).getDN().toString() + |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | assertNull(cache.getEntry(b, -1), |
| | | "Not expected to find entry id " + Integer.toString(-1) + |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | assertEquals(cache.getEntryID(testEntriesList.get(0).getDN()), -1, |
| | | "Not expected to find " + testEntriesList.get(0).getDN().toString() + |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | cache.putEntry(testEntriesList.get(0), b, 1); |
| | | |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | assertTrue(cache.putEntryIfAbsent(testEntriesList.get(0), b, 1), |
| | | "Not expected to find " + testEntriesList.get(0).getDN().toString() + |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | cache.removeEntry(testEntriesList.get(0).getDN()); |
| | | cache.putEntry(testEntriesList.get(0), b, 1); |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | cache.clear(); |
| | | cache.putEntry(testEntriesList.get(0), b, 1); |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend c = DirectoryServer.getBackend(DN.decode("cn=config")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | Backend c = DirectoryServer.getBackend(DN.valueOf("cn=config")); |
| | | |
| | | cache.clearBackend(b); |
| | | cache.putEntry(testEntriesList.get(0), b, 1); |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend c = DirectoryServer.getBackend(DN.decode("cn=config")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | Backend c = DirectoryServer.getBackend(DN.valueOf("cn=config")); |
| | | |
| | | cache.putEntry(testEntriesList.get(0), b, 1); |
| | | Entry testEntry = testEntriesList.get(1); |
| | | testEntry.getDN(); |
| | | testEntry.setDN(DN.decode( |
| | | testEntry.getDN().getRDN() + ",cn=config")); |
| | | testEntry.setDN(DN.valueOf( |
| | | testEntry.getDN().rdn() + ",cn=config")); |
| | | cache.putEntry(testEntry, c, 1); |
| | | cache.clearSubtree(DN.decode("o=test")); |
| | | cache.clearSubtree(DN.valueOf("o=test")); |
| | | |
| | | assertNull(cache.getEntry(testEntriesList.get(0).getDN()), |
| | | "Not expected to find " + testEntriesList.get(0).getDN().toString() + |
| | |
| | | public void testCacheConcurrency() |
| | | throws Exception |
| | | { |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | for(int loops = 0; loops < CONCURRENCYLOOPS; loops++) { |
| | | for(int i = 0; i < NUMTESTENTRIES; i++) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2013 ForgeRock AS. |
| | | * Portions Copyright 2010-2014 ForgeRock AS. |
| | | * Portions Copyright 2012 Dariusz Janny <dariusz.janny@gmail.com> |
| | | */ |
| | | package org.opends.server.extensions; |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | configEntry = DirectoryServer.getConfigEntry(DN.decode(configDNString)); |
| | | configEntry = DirectoryServer.getConfigEntry(DN.valueOf(configDNString)); |
| | | } |
| | | |
| | | |
| | |
| | | // PasswordPolicyTestCase.testAllowPreEncodedPasswordsAuth |
| | | boolean previousValue = false; |
| | | try { |
| | | DN dn = DN.decode("cn=Default Password Policy,cn=Password Policies,cn=config"); |
| | | DN dn = DN.valueOf("cn=Default Password Policy,cn=Password Policies,cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | previousValue = p.isAllowPreEncodedPasswords(); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | // Spread test entries among all cache levels via default cache. |
| | | for (int i = 0; i < NUMTESTENTRIES; i++) { |
| | |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 profiq, s.r.o. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | |
| | | /** |
| | | * The Dictionary can take up a lot of memory, so we restart the server to |
| | | * implicitly unregister the validator and free the memory. |
| | | * implicitly unregister the validator and free the memory. |
| | | */ |
| | | @AfterClass |
| | | public void freeDictionaryMemory() throws Exception |
| | |
| | | "dRoWsSaP", |
| | | true |
| | | }, |
| | | |
| | | |
| | | // Substrings checking configuration with a word in the dictionary, |
| | | // case-sensitive matching enabled |
| | | new Object[] |
| | |
| | | "oldpassword", |
| | | false |
| | | }, |
| | | |
| | | |
| | | // Substrings checking configuration with a word in the dictionary, |
| | | // case-sensitive matching disabled |
| | | new Object[] |
| | |
| | | "NewPassword", |
| | | false |
| | | }, |
| | | |
| | | |
| | | // Substrings checking configuration with a word in the dictionary, |
| | | // case-sensitive matching enabled (dictionary word is lower case) |
| | | new Object[] |
| | |
| | | "NewPassword", |
| | | true |
| | | }, |
| | | |
| | | |
| | | // Substrings checking configuration with a word in the dictionary, |
| | | // case-sensitive matching disabled, and minimal substring length |
| | | // of 5 while the password is only 3 characters |
| | |
| | | "god", |
| | | false |
| | | }, |
| | | |
| | | |
| | | // Substrings checking configuration with a word in the dictionary, |
| | | // case-sensitive matching disabled, and minimal substring length |
| | | // of 5 while the word in the dictionary is only 3 characters |
| | |
| | | "godblessus", |
| | | true |
| | | }, |
| | | |
| | | // Substring checking configuration with a reverse of a word in the |
| | | // dictionary, reversed matching enabled and case-insensitive |
| | | |
| | | // Substring checking configuration with a reverse of a word in the |
| | | // dictionary, reversed matching enabled and case-insensitive |
| | | // matching enabled |
| | | new Object[] |
| | | { |
| | |
| | | ModifyOperationBasis modifyOperation = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertEquals(validator.passwordIsAcceptable(pwOS, |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_DIGEST_MD5, |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_DIGEST_MD5, |
| | | ByteString.valueOf("invalid")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_DIGEST_MD5, null); |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_DIGEST_MD5, null); |
| | | assertEquals(bindOperation.getResultCode(), |
| | | ResultCode.SASL_BIND_IN_PROGRESS); |
| | | |
| | | bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_DIGEST_MD5, |
| | | conn.processSASLBind(DN.rootDN(), SASL_MECHANISM_DIGEST_MD5, |
| | | ByteString.valueOf("malformed")); |
| | | assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { DN.decode("") }, |
| | | new Object[] { DN.decode("o=test") }, |
| | | new Object[] { DN.decode("dc=example,dc=com") }, |
| | | new Object[] { DN.decode("cn=config") }, |
| | | new Object[] { DN.decode("cn=schema") }, |
| | | new Object[] { DN.decode("cn=tasks") }, |
| | | new Object[] { DN.decode("cn=monitor") }, |
| | | new Object[] { DN.decode("cn=backups") } |
| | | new Object[] { DN.valueOf("") }, |
| | | new Object[] { DN.valueOf("o=test") }, |
| | | new Object[] { DN.valueOf("dc=example,dc=com") }, |
| | | new Object[] { DN.valueOf("cn=config") }, |
| | | new Object[] { DN.valueOf("cn=schema") }, |
| | | new Object[] { DN.valueOf("cn=tasks") }, |
| | | new Object[] { DN.valueOf("cn=monitor") }, |
| | | new Object[] { DN.valueOf("cn=backups") } |
| | | }; |
| | | } |
| | | |
| | |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, |
| | | DN.decode("o=test"), |
| | | DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, |
| | | 0, false, filter, null, null); |
| | |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, |
| | | DN.decode("o=test"), |
| | | DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, |
| | | 0, false, filter, null, null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { DN.decode("") }, |
| | | new Object[] { DN.decode("cn=config") }, |
| | | new Object[] { DN.decode("cn=schema") }, |
| | | new Object[] { DN.decode("cn=tasks") }, |
| | | new Object[] { DN.decode("cn=monitor") }, |
| | | new Object[] { DN.decode("cn=backups") } |
| | | new Object[] { DN.valueOf("") }, |
| | | new Object[] { DN.valueOf("cn=config") }, |
| | | new Object[] { DN.valueOf("cn=schema") }, |
| | | new Object[] { DN.valueOf("cn=tasks") }, |
| | | new Object[] { DN.valueOf("cn=monitor") }, |
| | | new Object[] { DN.valueOf("cn=backups") } |
| | | }; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | DN parentDN = |
| | | DN.decode("cn=Account Status Notification Handlers,cn=config"); |
| | | DN.valueOf("cn=Account Status Notification Handlers,cn=config"); |
| | | ConfigEntry parentEntry = DirectoryServer.getConfigEntry(parentDN); |
| | | ConfigEntry configEntry = new ConfigEntry(e, parentEntry); |
| | | |
| | |
| | | { |
| | | String dnStr = "cn=Error Log Handler,cn=Account Status Notification " + |
| | | "Handlers,cn=config"; |
| | | DN handlerDN = DN.decode(dnStr); |
| | | DN handlerDN = DN.valueOf(dnStr); |
| | | AccountStatusNotificationHandler<?> handler = |
| | | DirectoryServer.getAccountStatusNotificationHandler(handlerDN); |
| | | assertNotNull(handler); |
| | |
| | | |
| | | String dnStr = "cn=Error Log Handler,cn=Account Status Notification " + |
| | | "Handlers,cn=config"; |
| | | DN handlerDN = DN.decode(dnStr); |
| | | DN handlerDN = DN.valueOf(dnStr); |
| | | AccountStatusNotificationHandler<?> handler = |
| | | DirectoryServer.getAccountStatusNotificationHandler(handlerDN); |
| | | assertNotNull(handler); |
| | | |
| | | Entry userEntry = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,o=test")); |
| | | |
| | | PasswordPolicy policy = (PasswordPolicy) AuthenticationPolicy.forUser( |
| | | userEntry, false); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public void testMapperEnabled() |
| | | throws Exception |
| | | { |
| | | DN mapperDN = DN.decode("cn=Exact Match,cn=Identity Mappers,cn=config"); |
| | | DN mapperDN = DN.valueOf("cn=Exact Match,cn=Identity Mappers,cn=config"); |
| | | IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | assertNotNull(mapper); |
| | | assertTrue(mapper instanceof ExactMatchIdentityMapper); |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("foo"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=foo,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=foo,o=test")); |
| | | |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("bar"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=foo,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=foo,o=test")); |
| | | |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | |
| | | throws Exception |
| | | { |
| | | String mapperDNString = "cn=Exact Match,cn=Identity Mappers,cn=config"; |
| | | DN mapperDN = DN.decode(mapperDNString); |
| | | DN mapperDN = DN.valueOf(mapperDNString); |
| | | IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | assertNotNull(mapper); |
| | | assertTrue(mapper instanceof ExactMatchIdentityMapper); |
| | |
| | | // does not. |
| | | Entry mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mappedEntry = mapper.getEntryForID("test user"); |
| | | assertNull(mappedEntry); |
| | |
| | | |
| | | mappedEntry = mapper.getEntryForID("test user"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | |
| | | // Change the configuration back to the way it was. |
| | |
| | | // Verify that the original matching pattern is back. |
| | | mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mappedEntry = mapper.getEntryForID("test user"); |
| | | assertNull(mappedEntry); |
| | |
| | | throws Exception |
| | | { |
| | | String mapperDNString = "cn=Exact Match,cn=Identity Mappers,cn=config"; |
| | | DN mapperDN = DN.decode(mapperDNString); |
| | | DN mapperDN = DN.valueOf(mapperDNString); |
| | | IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | assertNotNull(mapper); |
| | | assertTrue(mapper instanceof ExactMatchIdentityMapper); |
| | |
| | | // Verify that we can retrieve the user. |
| | | Entry mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | |
| | | // Create a modification to set the map base DN to "dc=example,dc=com". |
| | |
| | | // Verify that we can retrieve the user again. |
| | | mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | |
| | | // Change the configuration back to its original setting. |
| | |
| | | // Verify that we can still retrieve the user. |
| | | mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Forgerock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "always"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "ifpresent"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "always"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "ifpresent"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "always"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "ifpresent"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL + |
| | | cache.toVerboseString()); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | super.cache.putEntry(super.testEntriesList.get(i), b, i); |
| | |
| | | "Expected empty cache. " + "Cache contents:" + ServerConstants.EOL + |
| | | cache.toVerboseString()); |
| | | |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | super.cache.putEntry(super.testEntriesList.get(i), b, i); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | cache.toVerboseString()); |
| | | |
| | | // Put some test entries in the cache. |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | super.cache.putEntry(super.testEntriesList.get(i), b, i); |
| | | } |
| | |
| | | setupLRUCache(); |
| | | |
| | | // Put some test entries in the cache. |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=test")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=test")); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++) { |
| | | super.cache.putEntry(super.testEntriesList.get(i), b, i); |
| | | // Sacrifice one cache entry to support rotation. |
| | |
| | | persistentCacheSetup(); |
| | | |
| | | // Put some test entries in the cache. |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=cachetest")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=cachetest")); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++) { |
| | | super.cache.putEntry(super.testEntriesList.get(i), b, i); |
| | | } |
| | |
| | | persistentCacheSetup(); |
| | | |
| | | // Put some test entries in the cache. |
| | | Backend b = DirectoryServer.getBackend(DN.decode("o=cachetest")); |
| | | Backend b = DirectoryServer.getBackend(DN.valueOf("o=cachetest")); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++) { |
| | | super.cache.putEntry(super.testEntriesList.get(i), b, i); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(externalDN), mods); |
| | | conn.processModify(DN.valueOf(externalDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(externalDN), mods); |
| | | conn.processModify(DN.valueOf(externalDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { DN.decode("o=test") }, |
| | | new Object[] { DN.decode("dc=example,dc=com") } |
| | | new Object[] { DN.valueOf("o=test") }, |
| | | new Object[] { DN.valueOf("dc=example,dc=com") } |
| | | }; |
| | | } |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | return new Object[][] { |
| | | {DN.decode("o=test"), "22"}, |
| | | {DN.decode("dc=example,dc=com"), "21"}, |
| | | {DN.valueOf("o=test"), "22"}, |
| | | {DN.valueOf("dc=example,dc=com"), "21"}, |
| | | }; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { DN.decode("dc=example,dc=com"), true }, |
| | | new Object[] { DN.decode("ou=People,dc=example,dc=com"), true }, |
| | | new Object[] { DN.decode("ou=Employees,ou=People,dc=example,dc=com"), true }, |
| | | new Object[] { DN.decode("ou=Buildings,dc=example,dc=com"), false }, |
| | | new Object[] { DN.decode("uid=user.0,ou=People,dc=example,dc=com"), false }, |
| | | new Object[] { DN.decode("uid=user.1,ou=People,dc=example,dc=com"), false }, |
| | | new Object[] { DN.decode("uid=user.2,ou=Employees,ou=People" + |
| | | new Object[] { DN.valueOf("dc=example,dc=com"), true }, |
| | | new Object[] { DN.valueOf("ou=People,dc=example,dc=com"), true }, |
| | | new Object[] { DN.valueOf("ou=Employees,ou=People,dc=example,dc=com"), true }, |
| | | new Object[] { DN.valueOf("ou=Buildings,dc=example,dc=com"), false }, |
| | | new Object[] { DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), false }, |
| | | new Object[] { DN.valueOf("uid=user.1,ou=People,dc=example,dc=com"), false }, |
| | | new Object[] { DN.valueOf("uid=user.2,ou=Employees,ou=People" + |
| | | ",dc=example,dc=com"), false }, |
| | | new Object[] { DN.decode("cn=monitor"), true }, |
| | | new Object[] { DN.decode("cn=Backends,cn=config"), true }, |
| | | new Object[] { DN.decode("cn=Work Queue,cn=config"), false }, |
| | | new Object[] { DN.decode("cn=tasks"), true }, |
| | | new Object[] { DN.decode("cn=Recurring Tasks,cn=tasks"), false }, |
| | | new Object[] { DN.decode("cn=backups"), false } |
| | | new Object[] { DN.valueOf("cn=monitor"), true }, |
| | | new Object[] { DN.valueOf("cn=Backends,cn=config"), true }, |
| | | new Object[] { DN.valueOf("cn=Work Queue,cn=config"), false }, |
| | | new Object[] { DN.valueOf("cn=tasks"), true }, |
| | | new Object[] { DN.valueOf("cn=Recurring Tasks,cn=tasks"), false }, |
| | | new Object[] { DN.valueOf("cn=backups"), false } |
| | | }; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | "member: uid=test.user,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test static group,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test static group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "uniqueMember: uid=test.user,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test static group,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test static group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "memberURL: ldap:///ou=People,o=test??sub?(sn=user)"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete( |
| | | DN.decode("cn=test dynamic group,ou=groups,o=test")); |
| | | DN.valueOf("cn=test dynamic group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "member: uid=test.user2,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 1,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 1,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 2,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 2,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 3,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 3,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "memberURL: ldap:///o=test??sub?(givenName=test)"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 1,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 1,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 2,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 2,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 3,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 3,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 4,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 4,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 5,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 5,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 6,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 6,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "member: uid=test.user,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | |
| | | IsMemberOfVirtualAttributeProvider provider = |
| | | new IsMemberOfVirtualAttributeProvider(); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test static group,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test static group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "member: uid=test.user,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | |
| | | IsMemberOfVirtualAttributeProvider provider = |
| | | new IsMemberOfVirtualAttributeProvider(); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test static group,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test static group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "member: uid=test.user,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | |
| | | IsMemberOfVirtualAttributeProvider provider = |
| | | new IsMemberOfVirtualAttributeProvider(); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test static group,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test static group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "member: uid=test.user,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | |
| | | IsMemberOfVirtualAttributeProvider provider = |
| | | new IsMemberOfVirtualAttributeProvider(); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test static group,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test static group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | "member: uid=test.user,ou=People,o=test"); |
| | | |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | |
| | | IsMemberOfVirtualAttributeProvider provider = |
| | | new IsMemberOfVirtualAttributeProvider(); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test static group,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test static group,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | null, |
| | | DN.decode("o=test"), |
| | | DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, |
| | | 0, false, filter, null, null); |
| | |
| | | "member: uid=test.user3,ou=People,o=test"); |
| | | |
| | | Entry userEntry = |
| | | DirectoryServer.getEntry(DN.decode("uid=test.user,ou=People,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(userEntry); |
| | | |
| | | IsMemberOfVirtualAttributeProvider provider = |
| | |
| | | InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | null, |
| | | DN.decode("o=test"), |
| | | DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, |
| | | 0, false, filter, null, null); |
| | |
| | | assertEquals(matchFound, shouldMatch); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 1,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 1,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 2,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 2,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 3,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 3,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test group 4,ou=groups,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test group 4,ou=groups,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | TestCaseUtils.addEntries(builder.toString()); |
| | | //Verify the entry. |
| | | Entry e = |
| | | DirectoryServer.getEntry(DN.decode("cn=user.0,ou=People"+SUFFIX)); |
| | | DirectoryServer.getEntry(DN.valueOf("cn=user.0,ou=People"+SUFFIX)); |
| | | assertNotNull(e); |
| | | //Do an ldapsearch. |
| | | InternalClientConnection conn = |
| | |
| | | * |
| | | * |
| | | * Copyright 2011-2013 ForgeRock AS. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | baseDNs.add(DN.decode(baseDN)); |
| | | baseDNs.add(DN.valueOf(baseDN)); |
| | | } |
| | | catch (final DirectoryException e) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | return DN.decode("cn=Salted SHA-1,cn=Password Storage Schemes,cn=config"); |
| | | return DN.valueOf("cn=Salted SHA-1,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | policyDN = DN.decode(policyDNString); |
| | | trustManagerDN = DN.decode(trustManagerDNString); |
| | | searchBindDN = DN.decode(searchBindDNString); |
| | | policyDN = DN.valueOf(policyDNString); |
| | | trustManagerDN = DN.valueOf(trustManagerDNString); |
| | | searchBindDN = DN.valueOf(searchBindDNString); |
| | | userEntry = TestCaseUtils.makeEntry( |
| | | /* @formatter:off */ |
| | | "dn: " + opendjDNString, |
| | |
| | | |
| | | // Check that the password has been cached if needed. |
| | | Entry updatedTestUser = DirectoryServer.getEntry(DN |
| | | .decode("cn=test user,o=test")); |
| | | .valueOf("cn=test user,o=test")); |
| | | |
| | | String newCachedPassword = updatedTestUser.getAttributeValue( |
| | | DirectoryServer.getAttributeType("ds-pta-cached-password"), |
| | |
| | | SearchResultEntryProtocolOp newSearchEntry(final String dn) |
| | | throws DirectoryException |
| | | { |
| | | return new SearchResultEntryProtocolOp(DN.decode(dn)); |
| | | return new SearchResultEntryProtocolOp(DN.valueOf(dn)); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | ModifyOperationBasis op = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.decode("cn=uid=test.user,o=test"), mods); |
| | | DN.valueOf("cn=uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | ModifyOperationBasis op = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.decode("cn=uid=test.user,o=test"), mods); |
| | | DN.valueOf("cn=uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertEquals((buffer.length() >= 10), |
| | |
| | | ModifyOperationBasis op = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.decode("cn=uid=test.user,o=test"), mods); |
| | | DN.valueOf("cn=uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertEquals((buffer.length() <= 10), |
| | |
| | | ModifyOperationBasis op = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.decode("cn=uid=test.user,o=test"), mods); |
| | | DN.valueOf("cn=uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertEquals(((buffer.length() >= 6) && (buffer.length() <= 10)), |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { DN.decode("dc=example,dc=com"), 2 }, |
| | | new Object[] { DN.decode("ou=People,dc=example,dc=com"), 3 }, |
| | | new Object[] { DN.decode("ou=Employees,ou=People,dc=example,dc=com"), 1 }, |
| | | new Object[] { DN.decode("ou=Buildings,dc=example,dc=com"), 0 }, |
| | | new Object[] { DN.decode("uid=user.0,ou=People,dc=example,dc=com"), 0 }, |
| | | new Object[] { DN.decode("uid=user.1,ou=People,dc=example,dc=com"), 0 }, |
| | | new Object[] { DN.decode("uid=user.2,ou=Employees,ou=People" + |
| | | new Object[] { DN.valueOf("dc=example,dc=com"), 2 }, |
| | | new Object[] { DN.valueOf("ou=People,dc=example,dc=com"), 3 }, |
| | | new Object[] { DN.valueOf("ou=Employees,ou=People,dc=example,dc=com"), 1 }, |
| | | new Object[] { DN.valueOf("ou=Buildings,dc=example,dc=com"), 0 }, |
| | | new Object[] { DN.valueOf("uid=user.0,ou=People,dc=example,dc=com"), 0 }, |
| | | new Object[] { DN.valueOf("uid=user.1,ou=People,dc=example,dc=com"), 0 }, |
| | | new Object[] { DN.valueOf("uid=user.2,ou=Employees,ou=People" + |
| | | ",dc=example,dc=com"), 0 }, |
| | | // new Object[] { DN.decode("cn=monitor"), |
| | | // DirectoryServer.getMonitorProviders().size() }, |
| | | // Disable test on # of backends. Some might be disabled, falsing count. |
| | | // new Object[] { DN.decode("cn=Backends,cn=config"), |
| | | // DirectoryServer.getBackends().size() }, |
| | | new Object[] { DN.decode("cn=Work Queue,cn=config"), 0 }, |
| | | new Object[] { DN.decode("cn=tasks"), 2 }, |
| | | new Object[] { DN.decode("cn=backups"), 0 } |
| | | new Object[] { DN.valueOf("cn=Work Queue,cn=config"), 0 }, |
| | | new Object[] { DN.valueOf("cn=tasks"), 2 }, |
| | | new Object[] { DN.valueOf("cn=backups"), 0 } |
| | | }; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSimpleBind(DN.decode("cn=Directory Manager"), |
| | | conn.processSimpleBind(DN.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("newPassword")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSimpleBind(DN.decode("cn=Directory Manager"), |
| | | conn.processSimpleBind(DN.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("newPassword")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | BindOperation bindOperation = |
| | | conn.processSimpleBind(DN.decode("cn=Directory Manager"), |
| | | conn.processSimpleBind(DN.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("newPassword")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | String[] args = |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "24 hours"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "0 seconds"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "24 hours"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "0 seconds"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr2, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | Attributes.create(attr1, "0 seconds"))); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr2, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr3, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | Attributes.create(attr2, "false"))); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr3, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.empty(DirectoryServer.getAttributeType(attr)))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | "cn=Random Password Generator,cn=Password Generators,cn=config"; |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, genDN))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.empty(DirectoryServer.getAttributeType(attr)))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | "cn=Random Password Generator,cn=Password Generators,cn=config"; |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, genDN))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, valDN))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.empty(DirectoryServer.getAttributeType(attr)))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, valDN))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.empty(DirectoryServer.getAttributeType(attr)))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "true"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(dnStr), mods); |
| | | conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.clear(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | modifyOperation = conn.processModify(DN.decode(dnStr), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf(dnStr), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | DirectoryServer.getAttributeType("ds-pwp-last-login-time", false); |
| | | assertNotNull(lastLoginTimeAttr); |
| | | |
| | | DN userDN = DN.decode("uid=test.user,o=test"); |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | | Entry userEntry = DirectoryServer.getEntry(userDN); |
| | | assertNotNull(userEntry); |
| | | assertFalse(userEntry.hasAttribute(lastLoginTimeAttr)); |
| | |
| | | DirectoryServer.getAttributeType("pwdfailuretime", false); |
| | | assertNotNull(authFailureTimesAttr); |
| | | |
| | | DN userDN = DN.decode("uid=test.user,o=test"); |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | | Entry userEntry = DirectoryServer.getEntry(userDN); |
| | | assertNotNull(userEntry); |
| | | assertFalse(userEntry.hasAttribute(authFailureTimesAttr)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2011 ForgeRock AS. |
| | | * Portions Copyright 2010-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | |
| | | if (configDNString != null) |
| | | { |
| | | configEntry = DirectoryServer.getConfigEntry(DN.decode(configDNString)); |
| | | configEntry = DirectoryServer.getConfigEntry(DN.valueOf(configDNString)); |
| | | } |
| | | } |
| | | |
| | |
| | | // PasswordPolicyTestCase.testAllowPreEncodedPasswordsAuth |
| | | boolean previousValue = false; |
| | | try { |
| | | DN dn = DN.decode("cn=Default Password Policy,cn=Password Policies,cn=config"); |
| | | DN dn = DN.valueOf("cn=Default Password Policy,cn=Password Policies,cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | previousValue = p.isAllowPreEncodedPasswords(); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public void testDefaultConfiguration() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=Random Password Generator,cn=Password Generators," + |
| | | DN dn = DN.valueOf("cn=Random Password Generator,cn=Password Generators," + |
| | | "cn=config"); |
| | | ConfigEntry configEntry = DirectoryServer.getConfigEntry(dn); |
| | | assertNotNull(configEntry); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | DN mapperDN = |
| | | DN.decode("cn=Regular Expression,cn=Identity Mappers,cn=config"); |
| | | DN.valueOf("cn=Regular Expression,cn=Identity Mappers,cn=config"); |
| | | IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | assertNotNull(mapper); |
| | | assertTrue(mapper instanceof RegularExpressionIdentityMapper); |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test@example.com"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test@example.com"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test@example.com"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test@example.com"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test@example.com"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test,o=test")); |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | |
| | | // successfully. |
| | | Entry mappedEntry = mapper.getEntryForID("test"); |
| | | assertNotNull(mappedEntry); |
| | | assertEquals(mappedEntry.getDN(), DN.decode("uid=test@example.com,o=test")); |
| | | assertEquals(mappedEntry.getDN(), DN.valueOf("uid=test@example.com,o=test")); |
| | | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertFalse(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertFalse(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | ModifyOperationBasis op = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.decode("cn=uid=test.user,o=test"), mods); |
| | | DN.valueOf("cn=uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | ModifyOperationBasis op = |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.decode("cn=uid=test.user,o=test"), mods); |
| | | DN.valueOf("cn=uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertEquals((buffer.length() >= 6), |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { DN.decode("") }, |
| | | new Object[] { DN.decode("o=test") }, |
| | | new Object[] { DN.decode("dc=example,dc=com") }, |
| | | new Object[] { DN.decode("cn=config") }, |
| | | new Object[] { DN.decode("cn=schema") }, |
| | | new Object[] { DN.decode("cn=tasks") }, |
| | | new Object[] { DN.decode("cn=monitor") }, |
| | | new Object[] { DN.decode("cn=backups") } |
| | | new Object[] { DN.valueOf("") }, |
| | | new Object[] { DN.valueOf("o=test") }, |
| | | new Object[] { DN.valueOf("dc=example,dc=com") }, |
| | | new Object[] { DN.valueOf("cn=config") }, |
| | | new Object[] { DN.valueOf("cn=schema") }, |
| | | new Object[] { DN.valueOf("cn=tasks") }, |
| | | new Object[] { DN.valueOf("cn=monitor") }, |
| | | new Object[] { DN.valueOf("cn=backups") } |
| | | }; |
| | | } |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | return new Object[][] { |
| | | {DN.decode("o=test"), "structuralObjectClass=organization"}, |
| | | {DN.decode("dc=example,dc=com"), "structuralObjectClass=domain"}, |
| | | {DN.valueOf("o=test"), "structuralObjectClass=organization"}, |
| | | {DN.valueOf("dc=example,dc=com"), "structuralObjectClass=domain"}, |
| | | }; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | * Portions Copyright 2013 Manuel Gaupp |
| | | */ |
| | | package org.opends.server.extensions; |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(externalDN), mods); |
| | | conn.processModify(DN.valueOf(externalDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(externalDN), mods); |
| | | conn.processModify(DN.valueOf(externalDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertFalse(modifyOperation.getResultCode() == ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(externalDN), mods); |
| | | conn.processModify(DN.valueOf(externalDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(externalDN), mods); |
| | | conn.processModify(DN.valueOf(externalDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode(mapperDN), mods); |
| | | conn.processModify(DN.valueOf(mapperDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | return new Object[][] |
| | | { |
| | | new Object[] { DN.decode("") }, |
| | | new Object[] { DN.decode("o=test") }, |
| | | new Object[] { DN.decode("dc=example,dc=com") }, |
| | | new Object[] { DN.decode("cn=config") }, |
| | | new Object[] { DN.decode("cn=schema") }, |
| | | new Object[] { DN.decode("cn=tasks") }, |
| | | new Object[] { DN.decode("cn=monitor") }, |
| | | new Object[] { DN.decode("cn=backups") } |
| | | new Object[] { DN.valueOf("") }, |
| | | new Object[] { DN.valueOf("o=test") }, |
| | | new Object[] { DN.valueOf("dc=example,dc=com") }, |
| | | new Object[] { DN.valueOf("cn=config") }, |
| | | new Object[] { DN.valueOf("cn=schema") }, |
| | | new Object[] { DN.valueOf("cn=tasks") }, |
| | | new Object[] { DN.valueOf("cn=monitor") }, |
| | | new Object[] { DN.valueOf("cn=backups") } |
| | | }; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public TestAlertGenerator() |
| | | throws Exception |
| | | { |
| | | configEntryDN = DN.decode("cn=Test Alert Generator,cn=config"); |
| | | configEntryDN = DN.valueOf("cn=Test Alert Generator,cn=config"); |
| | | alertType = "org.opends.server.TestAlert"; |
| | | alertDescription = "This is a test alert."; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public void testChangingNumWorkerThreads() |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode("cn=Work Queue,cn=config"); |
| | | DN dn = DN.valueOf("cn=Work Queue,cn=config"); |
| | | String attr = "ds-cfg-num-worker-threads"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(),requestControls, |
| | | DN.decode("o=test"), |
| | | DN.valueOf("o=test"), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, |
| | | 0, false, filter, attrs, null); |
| | |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("o=test"), |
| | | DN.valueOf("o=test"), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, |
| | | 0, false, filter, attrs, null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertFalse(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertFalse(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | new ModifyOperationBasis(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN.decode("uid=test.user,o=test"), mods); |
| | | DN.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | MessageBuilder invalidReason = new MessageBuilder(); |
| | | assertTrue(validator.passwordIsAcceptable(password, |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection |
| | | .nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, DN.decode(ruleDN), |
| | | .nextMessageID(), null, DN.valueOf(ruleDN), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection |
| | | .nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, DN.decode(ruleDN), |
| | | .nextMessageID(), null, DN.valueOf(ruleDN), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode(userDN), |
| | | conn.processSearch(DN.valueOf(userDN), |
| | | SearchScope.BASE_OBJECT, SearchFilter |
| | | .createFilterFromString("(objectClass=*)")); |
| | | |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode(userDN), |
| | | conn.processSearch(DN.valueOf(userDN), |
| | | SearchScope.BASE_OBJECT, SearchFilter |
| | | .createFilterFromString("(objectClass=*)")); |
| | | |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode(userDN), |
| | | conn.processSearch(DN.valueOf(userDN), |
| | | SearchScope.BASE_OBJECT, SearchFilter |
| | | .createFilterFromString("(objectClass=*)")); |
| | | |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode(userDN), |
| | | conn.processSearch(DN.valueOf(userDN), |
| | | SearchScope.BASE_OBJECT, SearchFilter |
| | | .createFilterFromString("(objectClass=*)")); |
| | | |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | try |
| | | { |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode(userDN), |
| | | conn.processSearch(DN.valueOf(userDN), |
| | | SearchScope.BASE_OBJECT, SearchFilter |
| | | .createFilterFromString("(objectClass=*)")); |
| | | |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | attributes.add("description"); |
| | | |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode(userDN), |
| | | conn.processSearch(DN.valueOf(userDN), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | |
| | | finally |
| | | { |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN.decode(policyDN)); |
| | | deleteOperation = conn.processDelete(DN.valueOf(policyDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode(ruleDN)); |
| | | conn.processDelete(DN.valueOf(ruleDN)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | |
| | | groupManager = DirectoryServer.getGroupManager(); |
| | | |
| | | u1 = DN.decode("uid=test.1,ou=People,o=test"); |
| | | u2 = DN.decode("uid=test.2,ou=People,o=test"); |
| | | u3 = DN.decode("uid=test.3,ou=People,o=test"); |
| | | u4 = DN.decode("uid=test.4,ou=People,o=test"); |
| | | da = DN.decode("cn=Dynamic All Users,ou=Groups,o=test"); |
| | | d1 = DN.decode("cn=Dynamic One User,ou=Groups,o=test"); |
| | | sm = DN.decode("cn=Static member List,ou=Groups,o=test"); |
| | | su = DN.decode("cn=Static uniqueMember List,ou=Groups,o=test"); |
| | | vmda = DN.decode("cn=Virtual member All Users,ou=Groups,o=test"); |
| | | vuda = DN.decode("cn=Virtual uniqueMember All Users,ou=Groups,o=test"); |
| | | vmd1 = DN.decode("cn=Virtual member One User,ou=Groups,o=test"); |
| | | vud1 = DN.decode("cn=Virtual uniqueMember One User,ou=Groups,o=test"); |
| | | vsm = DN.decode("cn=Virtual Static member List,ou=Groups,o=test"); |
| | | vsu = DN.decode("cn=Virtual Static uniqueMember List,ou=Groups,o=test"); |
| | | vcm = DN.decode("cn=Crossover member Static Group,ou=Groups,o=test"); |
| | | vcu = DN.decode("cn=Crossover uniqueMember Static Group,ou=Groups,o=test"); |
| | | vn = DN.decode("cn=Virtual Nonexistent,ou=Groups,o=test"); |
| | | ne = DN.decode("cn=Nonexistent,ou=Groups,o=test"); |
| | | u1 = DN.valueOf("uid=test.1,ou=People,o=test"); |
| | | u2 = DN.valueOf("uid=test.2,ou=People,o=test"); |
| | | u3 = DN.valueOf("uid=test.3,ou=People,o=test"); |
| | | u4 = DN.valueOf("uid=test.4,ou=People,o=test"); |
| | | da = DN.valueOf("cn=Dynamic All Users,ou=Groups,o=test"); |
| | | d1 = DN.valueOf("cn=Dynamic One User,ou=Groups,o=test"); |
| | | sm = DN.valueOf("cn=Static member List,ou=Groups,o=test"); |
| | | su = DN.valueOf("cn=Static uniqueMember List,ou=Groups,o=test"); |
| | | vmda = DN.valueOf("cn=Virtual member All Users,ou=Groups,o=test"); |
| | | vuda = DN.valueOf("cn=Virtual uniqueMember All Users,ou=Groups,o=test"); |
| | | vmd1 = DN.valueOf("cn=Virtual member One User,ou=Groups,o=test"); |
| | | vud1 = DN.valueOf("cn=Virtual uniqueMember One User,ou=Groups,o=test"); |
| | | vsm = DN.valueOf("cn=Virtual Static member List,ou=Groups,o=test"); |
| | | vsu = DN.valueOf("cn=Virtual Static uniqueMember List,ou=Groups,o=test"); |
| | | vcm = DN.valueOf("cn=Crossover member Static Group,ou=Groups,o=test"); |
| | | vcu = DN.valueOf("cn=Crossover uniqueMember Static Group,ou=Groups,o=test"); |
| | | vn = DN.valueOf("cn=Virtual Nonexistent,ou=Groups,o=test"); |
| | | ne = DN.valueOf("cn=Nonexistent,ou=Groups,o=test"); |
| | | } |
| | | |
| | | |
| | |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | SearchFilter filter = SearchFilter.createFilterFromString("(sn=1)"); |
| | | memberList = g.getMembers(DN.decode("o=test"), SearchScope.WHOLE_SUBTREE, |
| | | memberList = g.getMembers(DN.valueOf("o=test"), SearchScope.WHOLE_SUBTREE, |
| | | filter); |
| | | assertTrue(memberList.hasMoreMembers()); |
| | | assertNotNull(memberList.nextMemberDN()); |
| | |
| | | try |
| | | { |
| | | SearchFilter filter = SearchFilter.createFilterFromString("(sn=1)"); |
| | | g.getMembers(DN.decode("o=test"), SearchScope.WHOLE_SUBTREE, filter); |
| | | g.getMembers(DN.valueOf("o=test"), SearchScope.WHOLE_SUBTREE, filter); |
| | | fail("Expected an exception from getMembers(base, scope, filter)"); |
| | | } catch (Exception e) {} |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.decode("o=test"), |
| | | InternalClientConnection.nextMessageID(), null, DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString( |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), null, DN.decode("o=test"), |
| | | InternalClientConnection.nextMessageID(), null, DN.valueOf("o=test"), |
| | | SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString( |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-allow-retrieving-membership", "false"))); |
| | | DN definitionDN = |
| | | DN.decode("cn=Virtual Static member,cn=Virtual Attributes,cn=config"); |
| | | DN.valueOf("cn=Virtual Static member,cn=Virtual Attributes,cn=config"); |
| | | ModifyOperation modifyOperation = conn.processModify(definitionDN, mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("ou=Groups,dc=example,dc=com"), |
| | | conn.processSearch(DN.valueOf("ou=Groups,dc=example,dc=com"), |
| | | SearchScope.SINGLE_LEVEL, |
| | | SearchFilter.createFilterFromString("(objectClass=*)")); |
| | | for (Entry e : searchOperation.getSearchEntries()) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | public void testAsInternalAnonymous() |
| | | throws Exception |
| | | { |
| | | InternalClientConnection conn = new InternalClientConnection(DN.nullDN()); |
| | | InternalClientConnection conn = new InternalClientConnection(DN.rootDN()); |
| | | ExtendedOperation extOp = |
| | | conn.processExtendedOperation(OID_WHO_AM_I_REQUEST, null); |
| | | assertEquals(extOp.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.monitors; |
| | | |
| | |
| | | |
| | | if (dnString != null) |
| | | { |
| | | DN dn = DN.decode(dnString); |
| | | DN dn = DN.valueOf(dnString); |
| | | configEntry = DirectoryServer.getConfigEntry(dn); |
| | | assertNotNull(configEntry); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.monitors; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("cn=monitor"), SearchScope.WHOLE_SUBTREE, |
| | | conn.processSearch(DN.valueOf("cn=monitor"), SearchScope.WHOLE_SUBTREE, |
| | | SearchFilter.createFilterFromString("(objectClass=*)")); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | |
| | | throws Exception |
| | | { |
| | | // could be more than one level |
| | | DN monitorDN = DN.decode("cn="+monitorName+",cn=monitor"); |
| | | DN monitorDN = DN.valueOf("cn="+monitorName+",cn=monitor"); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("cn=monitor"), SearchScope.WHOLE_SUBTREE, |
| | | conn.processSearch(DN.valueOf("cn=monitor"), SearchScope.WHOLE_SUBTREE, |
| | | SearchFilter.createFilterFromString("(objectClass=*)")); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | new ByteArrayInputStream(ldifString.getBytes("UTF-8")); |
| | | LDIFImportConfig importConfig = new LDIFImportConfig(bais); |
| | | |
| | | DN dn = DN.decode("cn=Entry UUID,cn=plugins,cn=config"); |
| | | DN dn = DN.valueOf("cn=Entry UUID,cn=plugins,cn=config"); |
| | | EntryUUIDPlugin plugin = |
| | | (EntryUUIDPlugin) |
| | | DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn); |
| | |
| | | new ByteArrayInputStream(ldifString.getBytes("UTF-8")); |
| | | LDIFImportConfig importConfig = new LDIFImportConfig(bais); |
| | | |
| | | DN dn = DN.decode("cn=Entry UUID,cn=plugins,cn=config"); |
| | | DN dn = DN.valueOf("cn=Entry UUID,cn=plugins,cn=config"); |
| | | EntryUUIDPlugin plugin = |
| | | (EntryUUIDPlugin) |
| | | DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.valueOf("o=test"), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), attrList); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.valueOf("o=test"), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), attrList); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.valueOf("o=test"), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), attrList); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.decode("o=test"), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.valueOf("o=test"), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), attrList); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("o=test"), mods); |
| | | conn.processModify(DN.valueOf("o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | Entry e = DirectoryConfig.getEntry(DN.decode("o=test")); |
| | | Entry e = DirectoryConfig.getEntry(DN.valueOf("o=test")); |
| | | assertNotNull(e); |
| | | assertNotNull(e.getAttribute("modifiersname")); |
| | | assertNotNull(e.getAttribute("modifytimestamp")); |
| | |
| | | conn.processModifyDN(e.getDN(), RDN.decode("cn=test2"), false); |
| | | assertEquals(modifyDNOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | e = DirectoryConfig.getEntry(DN.decode("cn=test2,o=test")); |
| | | e = DirectoryConfig.getEntry(DN.valueOf("cn=test2,o=test")); |
| | | assertNotNull(e); |
| | | assertNotNull(e.getAttribute("modifiersname")); |
| | | assertNotNull(e.getAttribute("modifytimestamp")); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | DN dn = DN.decode("cn=Password Policy Import,cn=plugins,cn=config"); |
| | | DN dn = DN.valueOf("cn=Password Policy Import,cn=plugins,cn=config"); |
| | | PasswordPolicyImportPlugin plugin = |
| | | (PasswordPolicyImportPlugin) |
| | | DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn); |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 profiq s.r.o. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.server.plugins; |
| | |
| | | replaceAttrEntry(configDN, dsConfigBaseDN, testSuffix); |
| | | addAttrEntry(configDN, dsConfigBaseDN, ugroup); |
| | | //Add DNs to groups and special entries |
| | | addAttrEntry(DN.decode(tgroup), "member", user1, user2, user3); |
| | | addAttrEntry(DN.decode(tugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.decode(ugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.decode(spPerson), "seealso", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(tgroup), "member", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(tugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(ugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(spPerson), "seealso", user1, user2, user3); |
| | | //Perform the move. |
| | | doModDN(oldSuperior, newRdn, newSuperior); |
| | | //This group under the suffix all DNs should be moved. |
| | |
| | | addAttrEntry(configDN, dsConfigBaseDN, ugroup); |
| | | |
| | | // Add DNs to groups and special entries |
| | | addAttrEntry(DN.decode(tgroup), "member", user1, user2, user3); |
| | | addAttrEntry(DN.decode(tugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.decode(ugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.decode(spPerson), "seealso", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(tgroup), "member", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(tugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(ugroup), "uniquemember", user1, user2, user3); |
| | | addAttrEntry(DN.valueOf(spPerson), "seealso", user1, user2, user3); |
| | | |
| | | // Check group membership before delete. |
| | | isMember(tgroup, true, user1, user2, user3); |
| | |
| | | replaceAttrEntry(configDN, dsConfigBaseDN, exSuffix); |
| | | addAttrEntry(configDN, dsConfigBaseDN, tugroup); |
| | | //Add DNs to groups and special entry |
| | | addAttrEntry(DN.decode(group), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(ugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(tugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(tspPerson), "seealso", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(group), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(ugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tspPerson), "seealso", tuser1, tuser2, tuser3); |
| | | //Perform rename. |
| | | doModDN(tuser1,tuser1_rdn, null); |
| | | //Verify that the changes were made. |
| | |
| | | @Test() |
| | | public void testReferentialDelete() throws Exception { |
| | | replaceAttrEntry(configDN, dsConfigAttrType,"member"); |
| | | addAttrEntry(DN.decode(tgroup), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tgroup), "member", tuser1, tuser2, tuser3); |
| | | deleteEntries(tuser1, tuser2, tuser3); |
| | | isMember(tgroup, false, tuser1, tuser2, tuser3); |
| | | } |
| | |
| | | //Set interval to 1 second, this should start the background thread |
| | | //and put the plugin in background mode. |
| | | replaceAttrEntry(configDN, dsConfigUpdateInterval,"1 seconds"); |
| | | addAttrEntry(DN.decode(tgroup), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tgroup), "member", tuser1, tuser2, tuser3); |
| | | deleteEntries(tuser1, tuser2, tuser3); |
| | | //Wait two seconds and then check the group. |
| | | Thread.sleep(2000); |
| | |
| | | //thread. |
| | | replaceAttrEntry(configDN, dsConfigUpdateInterval,"0 seconds"); |
| | | addEntries(tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(tgroup), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tgroup), "member", tuser1, tuser2, tuser3); |
| | | deleteEntries(tuser1, tuser2, tuser3); |
| | | //Don't wait, the changes should be there. |
| | | isMember(tgroup, false, tuser1, tuser2, tuser3); |
| | |
| | | public void testReferentialDeleteAttrs() throws Exception { |
| | | replaceAttrEntry(configDN, dsConfigAttrType,"member"); |
| | | addAttrEntry(configDN, dsConfigAttrType,"uniquemember", "seealso"); |
| | | addAttrEntry(DN.decode(tgroup), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(tugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(tspPerson), "seealso", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tgroup), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tspPerson), "seealso", tuser1, tuser2, tuser3); |
| | | deleteEntries(tuser1, tuser2, tuser3); |
| | | isMember(tgroup, false, tuser1, tuser2, tuser3); |
| | | isAttributeValueEntry(tugroup, false, "uniquemember", |
| | |
| | | addAttrEntry(configDN, dsConfigAttrType,"uniquemember", "seealso"); |
| | | replaceAttrEntry(configDN, dsConfigBaseDN, exSuffix); |
| | | addAttrEntry(configDN, dsConfigBaseDN, tugroup); |
| | | addAttrEntry(DN.decode(group), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(ugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(tugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.decode(tspPerson), "seealso", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(group), "member", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(ugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tugroup), "uniquemember", tuser1, tuser2, tuser3); |
| | | addAttrEntry(DN.valueOf(tspPerson), "seealso", tuser1, tuser2, tuser3); |
| | | deleteEntries(tuser1, tuser2, tuser3); |
| | | isMember(group, false, tuser1, tuser2, tuser3); |
| | | isAttributeValueEntry(ugroup, true, "uniquemember", |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | configDN= DN.decode("cn=Referential Integrity ,cn=Plugins,cn=config"); |
| | | configDN= DN.valueOf("cn=Referential Integrity ,cn=Plugins,cn=config"); |
| | | } |
| | | |
| | | /** |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | for(String dn : dns) { |
| | | DeleteOperation op=conn.processDelete(DN.decode(dn)); |
| | | DeleteOperation op=conn.processDelete(DN.valueOf(dn)); |
| | | assertEquals(op.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | |
| | | for (String dn : dns) |
| | | { |
| | | DeleteOperation op = conn.processDelete(DN.decode(dn), controls); |
| | | DeleteOperation op = conn.processDelete(DN.valueOf(dn), controls); |
| | | assertEquals(op.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | private void isMember(String group, boolean expected, String... dns) |
| | | throws Exception { |
| | | GroupManager groupManager=DirectoryServer.getGroupManager(); |
| | | Group<?> instance=groupManager.getGroupInstance(DN.decode(group)); |
| | | Group<?> instance=groupManager.getGroupInstance(DN.valueOf(group)); |
| | | for(String dn : dns) |
| | | assertEquals(instance.isMember(DN.decode(dn)), expected); |
| | | assertEquals(instance.isMember(DN.valueOf(dn)), expected); |
| | | } |
| | | |
| | | private void isAttributeValueEntry(String entryDN, boolean expected, |
| | |
| | | String filterStr="(" + attr + "=*)"; |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation operation = conn.processSearch(DN.decode(entryDN), |
| | | InternalSearchOperation operation = conn.processSearch(DN.valueOf(entryDN), |
| | | SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString(filterStr), |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyDNOperation modDNop; |
| | | if(newSuperior != null) |
| | | modDNop = conn.processModifyDN(DN.decode(dn), RDN.decode(rdn), true, |
| | | DN.decode(newSuperior)); |
| | | modDNop = conn.processModifyDN(DN.valueOf(dn), RDN.decode(rdn), true, |
| | | DN.valueOf(newSuperior)); |
| | | else |
| | | modDNop = conn.processModifyDN(DN.decode(dn), RDN.decode(rdn), |
| | | modDNop = conn.processModifyDN(DN.valueOf(dn), RDN.decode(rdn), |
| | | false, null); |
| | | assertEquals(modDNop.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | |
| | | |
| | | Entry entry = null; |
| | | AddOperation addOperation = null; |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | |
| | | |
| | | Entry entry = null; |
| | | AddOperation addOperation = null; |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | |
| | | ); |
| | | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), |
| | | assertEquals(addOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | |
| | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(user1), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | assertEquals(modOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(user1), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | assertEquals(modOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | modOperation = replaceAttrEntry(DN.decode(user1), |
| | | modOperation = replaceAttrEntry(DN.valueOf(user1), |
| | | "manager", user2); |
| | | assertEquals(modOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(user1), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | assertEquals(modOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | AddOperation addOperation = conn.processAdd(entry); |
| | | assertEquals(addOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(user1), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,o=test"); |
| | | assertEquals(modOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | |
| | | "manager:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(user1), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(user1), |
| | | "manager", "uid=manager,ou=people,ou=dept,dc=example,dc=com"); |
| | | assertEquals(modOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(group), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(group), |
| | | "member", |
| | | user1); |
| | | assertEquals(modOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(group), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(group), |
| | | "member", "uid=user.100,ou=people,ou=dept,dc=example,dc=com"); |
| | | assertEquals(modOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | "member:(objectclass=posixaccount)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(group), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(group), |
| | | "member", "uid=user.100,ou=people,ou=dept,dc=example,dc=com"); |
| | | assertEquals(modOperation.getResultCode(), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | "subordinatedelete", |
| | | "preoperationadd", |
| | | "preoperationmodify"); |
| | | addAttrEntry(configDN, dsConfigBaseDN, |
| | | addAttrEntry(configDN, dsConfigBaseDN, |
| | | "dc=example,dc=com", |
| | | "o=test"); |
| | | replaceAttrEntry(configDN, dsConfigEnforceIntegrity, "true"); |
| | |
| | | "member:(objectclass=person)"); |
| | | replaceAttrEntry(configDN, "ds-cfg-enabled", "true"); |
| | | |
| | | ModifyOperation modOperation = addAttrEntry(DN.decode(group), |
| | | ModifyOperation modOperation = addAttrEntry(DN.valueOf(group), |
| | | "member", "uid=user.1,ou=people,ou=dept,o=test"); |
| | | assertEquals(modOperation.getResultCode(), |
| | | ResultCode.SUCCESS); |
| | |
| | | * |
| | | * |
| | | * Copyright 2011-2012 profiq s.r.o. |
| | | * Portions copyright 2011 ForgeRock AS. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.plugins; |
| | |
| | | public void afterClass() throws Exception |
| | | { |
| | | TestCaseUtils.deleteEntry(DN |
| | | .decode("cn=samba password,cn=Plugins,cn=config")); |
| | | .valueOf("cn=samba password,cn=Plugins,cn=config")); |
| | | } |
| | | |
| | | |
| | |
| | | + "(version 3.0; acl \"Samba admin\"; allow (all) " |
| | | + "userdn=\"ldap:///cn=samba admin,o=test\";)"))); |
| | | |
| | | ModifyOperation modOp = conn.processModify(DN.decode("o=test"), mods); |
| | | ModifyOperation modOp = conn.processModify(DN.valueOf("o=test"), mods); |
| | | |
| | | assertEquals(modOp.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | |
| | | { |
| | | SambaPasswordPlugin plugin = (SambaPasswordPlugin) |
| | | DirectoryServer.getPluginConfigManager().getRegisteredPlugin( |
| | | DN.decode("cn=samba password,cn=Plugins,cn=config")); |
| | | DN.valueOf("cn=samba password,cn=Plugins,cn=config")); |
| | | |
| | | TimeStampProvider testTimeStampProvider = new TimeStampProvider() |
| | | { |
| | |
| | | { |
| | | SambaPasswordPlugin plugin = (SambaPasswordPlugin) |
| | | DirectoryServer.getPluginConfigManager().getRegisteredPlugin( |
| | | DN.decode("cn=samba password,cn=Plugins,cn=config")); |
| | | DN.valueOf("cn=samba password,cn=Plugins,cn=config")); |
| | | |
| | | TimeStampProvider testTimeStampProvider = new TimeStampProvider() |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | |
| | |
| | | addTestEntries("o=test", 't'); |
| | | TestCaseUtils.clearJEBackend(true,"userRoot", "dc=example,dc=com"); |
| | | addTestEntries("dc=example,dc=com", 'x'); |
| | | uidConfigDN=DN.decode("cn=UID Unique Attribute ,cn=Plugins,cn=config"); |
| | | testConfigDN=DN.decode("cn=Test Unique Attribute,cn=Plugins,cn=config"); |
| | | uidConfigDN=DN.valueOf("cn=UID Unique Attribute ,cn=Plugins,cn=config"); |
| | | testConfigDN=DN.valueOf("cn=Test Unique Attribute,cn=Plugins,cn=config"); |
| | | } |
| | | |
| | | |
| | |
| | | replaceAttrInEntry(uidConfigDN,dsConfigAttrType,"uid"); |
| | | //Rename with new rdn, should fail, there is an entry already with that |
| | | //uid value. |
| | | doModDN(DN.decode("uid=3user.3, ou=people, o=test"), RDN.decode("uid=4"), |
| | | doModDN(DN.valueOf("uid=3user.3, ou=people, o=test"), RDN.decode("uid=4"), |
| | | false, null, ResultCode.CONSTRAINT_VIOLATION); |
| | | //Rename with multi-valued RDN, should fail there is an entry already with |
| | | //that uid value. |
| | | doModDN(DN.decode("uid=3user.3, ou=people, o=test"), |
| | | doModDN(DN.valueOf("uid=3user.3, ou=people, o=test"), |
| | | RDN.decode("sn=xx+uid=4"), |
| | | false, null, ResultCode.CONSTRAINT_VIOLATION); |
| | | //Now add a base dn to be unique under, so new superior move can be tested. |
| | |
| | | //Try to move the entry to a new superior. |
| | | //Should fail, there is an entry under the new superior already with |
| | | //that uid value. |
| | | doModDN(DN.decode("uid=3user.3, ou=people, o=test"), |
| | | doModDN(DN.valueOf("uid=3user.3, ou=people, o=test"), |
| | | RDN.decode("uid=3user.3"), false, |
| | | DN.decode("ou=new people, o=test"), |
| | | DN.valueOf("ou=new people, o=test"), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | //Test again with different superior, should succeed, new superior DN is |
| | | //not in base DN scope. |
| | | doModDN(DN.decode("uid=3user.3, ou=people, o=test"), |
| | | doModDN(DN.valueOf("uid=3user.3, ou=people, o=test"), |
| | | RDN.decode("uid=3user.3"), false, |
| | | DN.decode("ou=new people1, o=test"), |
| | | DN.valueOf("ou=new people1, o=test"), |
| | | ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | addMods(mods,"mail",ModificationType.REPLACE,"userx@test","userxx@test", |
| | | "user1t@test"); |
| | | //Fail because user1t@test already exists under "o=people,o=test". |
| | | doMods(mods, DN.decode("uid=5user.5,ou=People,o=test"), |
| | | doMods(mods, DN.valueOf("uid=5user.5,ou=People,o=test"), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | mods.clear(); |
| | | addMods(mods,"pager",ModificationType.ADD,"2-999-1234","1-999-5678"); |
| | | addMods(mods,"mail",ModificationType.ADD,"userx@test","userxx@test", |
| | | "user1t@test"); |
| | | //Fail because user1t@test already exists under "o=people,o=test". |
| | | doMods(mods, DN.decode("uid=5user.5,ou=People,o=test"), |
| | | doMods(mods, DN.valueOf("uid=5user.5,ou=People,o=test"), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | mods.clear(); |
| | | addMods(mods,"pager",ModificationType.ADD,"2-999-1234","1-999-5678"); |
| | |
| | | "user1t@test"); |
| | | //Ok because adding mail value user1t@test to entry that already |
| | | //contains mail value user1t@test. |
| | | doMods(mods, DN.decode("uid=1user.1,ou=People,o=test"), |
| | | doMods(mods, DN.valueOf("uid=1user.1,ou=People,o=test"), |
| | | ResultCode.SUCCESS); |
| | | mods.clear(); |
| | | //Replace employeenumber as the unique attribute. |
| | |
| | | addMods(mods,"employeenumber",ModificationType.INCREMENT,"1"); |
| | | //Test modify increment extension. |
| | | //Fail because incremented value of employeenumber (2) already exists. |
| | | doMods(mods, DN.decode("uid=1user.1,ou=People,o=test"), |
| | | doMods(mods, DN.valueOf("uid=1user.1,ou=People,o=test"), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | } |
| | | |
| | |
| | | "pager","telephonenumber"); |
| | | addAttribute(e, "mobile", "1-999-1234","1-999-5678","1-444-9012"); |
| | | addEntry(e, ResultCode.CONSTRAINT_VIOLATION); |
| | | e.setDN(DN.decode("cn=test user, ou=People,o=test")); |
| | | e.setDN(DN.valueOf("cn=test user, ou=People,o=test")); |
| | | //Fail because "2-333-9012" already exists in "ou=people,o=test" in |
| | | //telephonenumber attribute. |
| | | addEntry(e, ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | //Fail because "2-777-9012" is a telephone value under the |
| | | //"dc=example,dc=com" naming context. |
| | | addEntry(e, ResultCode.CONSTRAINT_VIOLATION); |
| | | e.setDN(DN.decode("cn=test user, ou=People,o=test")); |
| | | e.setDN(DN.valueOf("cn=test user, ou=People,o=test")); |
| | | addEntry(e, ResultCode.CONSTRAINT_VIOLATION); |
| | | delAttribute(e, "mobile"); |
| | | addAttribute(e, "pager", "2-777-1234","1-999-5678","1-999-9012"); |
| | |
| | | |
| | | private void clearAcis(String suffix) throws Exception |
| | | { |
| | | deleteAttrsFromEntry(DN.decode("ou=People," + suffix), "aci"); |
| | | deleteAttrsFromEntry(DN.decode("ou=People1," + suffix), "aci"); |
| | | deleteAttrsFromEntry(DN.valueOf("ou=People," + suffix), "aci"); |
| | | deleteAttrsFromEntry(DN.valueOf("ou=People1," + suffix), "aci"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | public Object[][] getInternalConnections() |
| | | throws Exception |
| | | { |
| | | DN dmDN = DN.decode("cn=Directory Manager,cn=Root DNs,cn=config"); |
| | | DN dmDN = DN.valueOf("cn=Directory Manager,cn=Root DNs,cn=config"); |
| | | Entry dmEntry = DirectoryServer.getEntry(dmDN); |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | |
| | | new Object[] { new InternalClientConnection( |
| | | new AuthenticationInfo(userEntry, false)) }, |
| | | new Object[] { new InternalClientConnection(dmDN) }, |
| | | new Object[] { new InternalClientConnection(DN.nullDN()) }, |
| | | new Object[] { new InternalClientConnection(DN.rootDN()) }, |
| | | new Object[] { new InternalClientConnection((DN) null) } |
| | | }; |
| | | } |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | BindOperation bindOperation = |
| | | conn.processSimpleBind(DN.decode("cn=Directory Manager"), |
| | | conn.processSimpleBind(DN.valueOf("cn=Directory Manager"), |
| | | ByteString.valueOf("password")); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | BindOperation bindOperation = |
| | | conn.processSASLBind(DN.nullDN(), "PLAIN", creds); |
| | | conn.processSASLBind(DN.rootDN(), "PLAIN", creds); |
| | | assertEquals(bindOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | CompareOperation compareOperation = |
| | | conn.processCompare(DN.decode("cn=test,o=test"), |
| | | conn.processCompare(DN.valueOf("cn=test,o=test"), |
| | | DirectoryServer.getAttributeType("cn", true), |
| | | ByteString.valueOf("test")); |
| | | assertEquals(compareOperation.getResultCode(), ResultCode.COMPARE_TRUE); |
| | |
| | | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete(DN.decode("cn=test,o=test")); |
| | | conn.processDelete(DN.valueOf("cn=test,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | Attributes.create("description", "This is a test"))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=test,o=test"), mods); |
| | | conn.processModify(DN.valueOf("cn=test,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(DN.decode("cn=test,o=test"), |
| | | conn.processModifyDN(DN.valueOf("cn=test,o=test"), |
| | | RDN.decode("cn=test2"), true); |
| | | assertEquals(modifyDNOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | |
| | | |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(DN.decode("cn=test,o=test"), |
| | | conn.processModifyDN(DN.valueOf("cn=test,o=test"), |
| | | RDN.decode("cn=test2"), true, |
| | | DN.decode("dc=example,dc=com")); |
| | | DN.valueOf("dc=example,dc=com")); |
| | | assertEquals(modifyDNOperation.getResultCode(), |
| | | ResultCode.UNWILLING_TO_PERFORM); |
| | | } |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.nullDN(), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.rootDN(), SearchScope.BASE_OBJECT, |
| | | SearchFilter.createFilterFromString("(objectClass=*)")); |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertFalse(searchOperation.getSearchEntries().isEmpty()); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.nullDN(), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.rootDN(), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | new LinkedHashSet<String>()); |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | InternalSearchOperation searchOperation = |
| | | conn.processSearch(DN.nullDN(), SearchScope.BASE_OBJECT, |
| | | conn.processSearch(DN.rootDN(), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString("(objectClass=*)"), |
| | | new LinkedHashSet<String>(), searchListener); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | InternalLDAPSocket socket = new InternalLDAPSocket(); |
| | | LDAPReader reader = new LDAPReader(socket); |
| | |
| | | assertNotNull(message); |
| | | assertEquals(message.getAddResponseProtocolOp().getResultCode(), |
| | | LDAPResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | reader.close(); |
| | | writer.close(); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(false); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | |
| | | attributes.put(o); |
| | | |
| | | context.createSubcontext("o=test", attributes); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | context.close(); |
| | | } |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | InternalLDAPSocket socket = new InternalLDAPSocket(); |
| | | LDAPReader reader = new LDAPReader(socket); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | InternalLDAPSocket socket = new InternalLDAPSocket(); |
| | | LDAPReader reader = new LDAPReader(socket); |
| | |
| | | assertNotNull(message); |
| | | assertEquals(message.getDeleteResponseProtocolOp().getResultCode(), |
| | | LDAPResultCode.SUCCESS); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | reader.close(); |
| | | writer.close(); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | |
| | | DirContext context = new InitialDirContext(env); |
| | | |
| | | context.destroySubcontext("o=test"); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | context.close(); |
| | | } |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | InternalLDAPSocket socket = new InternalLDAPSocket(); |
| | | LDAPReader reader = new LDAPReader(socket); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("ou=People,o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("ou=Users,o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("ou=People,o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("ou=Users,o=test"))); |
| | | |
| | | InternalLDAPSocket socket = new InternalLDAPSocket(); |
| | | LDAPReader reader = new LDAPReader(socket); |
| | |
| | | assertEquals(message.getModifyDNResponseProtocolOp().getResultCode(), |
| | | LDAPResultCode.SUCCESS); |
| | | |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("ou=People,o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("ou=Users,o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("ou=People,o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("ou=Users,o=test"))); |
| | | |
| | | reader.close(); |
| | | writer.close(); |
| | |
| | | "objectClass: organizationalUnit", |
| | | "ou: People"); |
| | | |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("ou=People,o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("ou=Users,o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("ou=People,o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("ou=Users,o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | |
| | | |
| | | context.rename("ou=People,o=test", "ou=Users,o=test"); |
| | | |
| | | assertFalse(DirectoryServer.entryExists(DN.decode("ou=People,o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("ou=Users,o=test"))); |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("ou=People,o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("ou=Users,o=test"))); |
| | | |
| | | context.close(); |
| | | } |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | InternalLDAPSocket socket = new InternalLDAPSocket(); |
| | | LDAPReader reader = new LDAPReader(socket); |
| | |
| | | message = reader.readMessage(); |
| | | assertNotNull(message); |
| | | assertEquals(message.getSearchResultEntryProtocolOp().getDN(), |
| | | DN.decode("o=test")); |
| | | DN.valueOf("o=test")); |
| | | |
| | | message = reader.readMessage(); |
| | | assertNotNull(message); |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | assertTrue(DirectoryServer.entryExists(DN.decode("o=test"))); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.nullDN(), SearchScope.BASE_OBJECT, |
| | | DN.rootDN(), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, |
| | | false, searchFilter, |
| | | new LinkedHashSet<String>(), null); |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), new ArrayList<Control>(), |
| | | DN.nullDN(), SearchScope.BASE_OBJECT, |
| | | DN.rootDN(), SearchScope.BASE_OBJECT, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, |
| | | false, searchFilter, |
| | | new LinkedHashSet<String>(), |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | .getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = conn.processDelete(DN |
| | | .decode("cn=Privileged User,o=test")); |
| | | .valueOf("cn=Privileged User,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=Unprivileged JMX User,o=test")); |
| | | .valueOf("cn=Unprivileged JMX User,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | */ |
| | | private Object jmxGet(String dn, String attributeName, |
| | | MBeanServerConnection mbsc) throws Exception { |
| | | String jmxName = JMXMBean.getJmxName(DN.decode(dn)); |
| | | String jmxName = JMXMBean.getJmxName(DN.valueOf(dn)); |
| | | ObjectName name = ObjectName.getInstance(jmxName); |
| | | |
| | | try |
| | |
| | | */ |
| | | private void jmxSet(String dn, String attributeName, Object value, |
| | | MBeanServerConnection mbsc) throws Exception { |
| | | String jmxName = JMXMBean.getJmxName(DN.decode(dn)); |
| | | String jmxName = JMXMBean.getJmxName(DN.valueOf(dn)); |
| | | ObjectName name = ObjectName.getInstance(jmxName); |
| | | Attribute attr = new Attribute(attributeName, value); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | successList.add(false); |
| | | |
| | | userDN = "cn=Unprivileged Root,cn=Root DNs,cn=config"; |
| | | userEntry = DirectoryServer.getEntry(DN.decode(userDN)); |
| | | userEntry = DirectoryServer.getEntry(DN.valueOf(userDN)); |
| | | authInfo = new AuthenticationInfo(userEntry, true); |
| | | connList.add(new JmxClientConnection(jmxCtx,authInfo)); |
| | | successList.add(false); |
| | | |
| | | userDN = "cn=Proxy Root,cn=Root DNs,cn=config"; |
| | | userEntry = DirectoryServer.getEntry(DN.decode(userDN)); |
| | | userEntry = DirectoryServer.getEntry(DN.valueOf(userDN)); |
| | | authInfo = new AuthenticationInfo(userEntry, true); |
| | | connList.add(new JmxClientConnection(jmxCtx,authInfo)); |
| | | successList.add(true); |
| | | |
| | | userDN = "cn=Unprivileged User,o=test"; |
| | | userEntry = DirectoryServer.getEntry(DN.decode(userDN)); |
| | | userEntry = DirectoryServer.getEntry(DN.valueOf(userDN)); |
| | | authInfo = new AuthenticationInfo(userEntry, false); |
| | | connList.add(new JmxClientConnection(jmxCtx,authInfo)); |
| | | successList.add(false); |
| | | |
| | | userDN = "cn=Privileged User,o=test"; |
| | | userEntry = DirectoryServer.getEntry(DN.decode(userDN)); |
| | | userEntry = DirectoryServer.getEntry(DN.valueOf(userDN)); |
| | | authInfo = new AuthenticationInfo(userEntry, false); |
| | | connList.add(new JmxClientConnection(jmxCtx,authInfo)); |
| | | successList.add(true); |
| | |
| | | .getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = conn.processDelete(DN |
| | | .decode("cn=Unprivileged Root,cn=Root DNs,cn=config")); |
| | | .valueOf("cn=Unprivileged Root,cn=Root DNs,cn=config")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=Unprivileged JMX Root,cn=Root DNs,cn=config")); |
| | | .valueOf("cn=Unprivileged JMX Root,cn=Root DNs,cn=config")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=Proxy Root,cn=Root DNs,cn=config")); |
| | | .valueOf("cn=Proxy Root,cn=Root DNs,cn=config")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=Privileged User,o=test")); |
| | | .valueOf("cn=Privileged User,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=UnPrivileged User,o=test")); |
| | | .valueOf("cn=UnPrivileged User,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=PWReset Target,o=test")); |
| | | .valueOf("cn=PWReset Target,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=test1 user,dc=unindexed,dc=jeb")); |
| | | .valueOf("cn=test1 user,dc=unindexed,dc=jeb")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("cn=test2 user,dc=unindexed,dc=jeb")); |
| | | .valueOf("cn=test2 user,dc=unindexed,dc=jeb")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | deleteOperation = conn.processDelete(DN |
| | | .decode("dc=unindexed,dc=jeb")); |
| | | .valueOf("dc=unindexed,dc=jeb")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | for (int i = 0; (connections != null) && (i < connections.length); i++) |
| | |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create( |
| | | "ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode(user), mods); |
| | | rootConnection.processModify(DN.valueOf(user), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Try connection withoutJMX_READ privilege |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | modifyOperation = |
| | | rootConnection.processModify(DN.decode(user), mods); |
| | | rootConnection.processModify(DN.valueOf(user), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Try connection withoutJMX_READ privilege |
| | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | conn.processDelete( |
| | | DN.decode("cn=Telex Number,cn=Syntaxes,cn=config")); |
| | | DN.valueOf("cn=Telex Number,cn=Syntaxes,cn=config")); |
| | | assertEquals(deleteOperation.getResultCode(), |
| | | ResultCode.INSUFFICIENT_ACCESS_RIGHTS); |
| | | } |
| | |
| | | Attributes.create("ds-cfg-size-limit", "2000"))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=config"), mods); |
| | | conn.processModify(DN.valueOf("cn=config"), mods); |
| | | if (hasPrivilege) |
| | | { |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-size-limit", "1000"))); |
| | | |
| | | modifyOperation = conn.processModify(DN.decode("cn=config"), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf("cn=config"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | else |
| | |
| | | assertEquals(conn.hasPrivilege(Privilege.JMX_WRITE, null), hasPrivilege); |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(DN.decode("cn=Work Queue,cn=config"), |
| | | conn.processModifyDN(DN.valueOf("cn=Work Queue,cn=config"), |
| | | RDN.decode("cn=New RDN for Work Queue"), true, |
| | | null); |
| | | if (hasPrivilege) |
| | |
| | | Attributes.create("attributetypes", attrDefinition))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=schema"), mods); |
| | | conn.processModify(DN.valueOf("cn=schema"), mods); |
| | | if (hasPrivilege) |
| | | { |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("attributetypes", attrDefinition))); |
| | | |
| | | modifyOperation = conn.processModify(DN.decode("cn=schema"), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf("cn=schema"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | else |
| | |
| | | |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | controls.add(new ProxiedAuthV1Control( |
| | | DN.decode("cn=PWReset Target,o=test"))); |
| | | DN.valueOf("cn=PWReset Target,o=test"))); |
| | | |
| | | |
| | | // Try to add the entry. If this fails with the proxy control, then add it |
| | |
| | | // privileges the user actually has. |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.decode("cn=PWReset Target,o=test"); |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | controls.add(new ProxiedAuthV1Control(targetDN)); |
| | | |
| | |
| | | // privileges the user actually has. |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.decode("cn=PWReset Target,o=test"); |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | controls.add(new ProxiedAuthV2Control( |
| | | ByteString.valueOf("dn:" + targetDN.toString()))); |
| | |
| | | |
| | | |
| | | Entry testEntry = |
| | | DirectoryServer.getEntry(DN.decode("cn=Test User,o=test")); |
| | | DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | AuthenticationInfo authInfo = new AuthenticationInfo(testEntry, false); |
| | | JmxConnectionHandler jmxCtx = getJmxConnectionHandler(); |
| | | JmxClientConnection testConnection = |
| | |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode("cn=Test User,o=test"), mods); |
| | | rootConnection.processModify(DN.valueOf("cn=Test User,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(testConnection.hasPrivilege(Privilege.JMX_READ, null)); |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | modifyOperation = |
| | | rootConnection.processModify(DN.decode("cn=Test User,o=test"), mods); |
| | | rootConnection.processModify(DN.valueOf("cn=Test User,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertFalse(testConnection.hasPrivilege(Privilege.JMX_READ, null)); |
| | | |
| | | |
| | | DeleteOperation deleteOperation = |
| | | rootConnection.processDelete(DN.decode("cn=Test User,o=test")); |
| | | rootConnection.processDelete(DN.valueOf("cn=Test User,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | { |
| | | // Make sure that a root connection doesn't have the proxied auth |
| | | // privilege. |
| | | DN unprivRootDN = DN.decode("cn=Unprivileged Root,cn=Root DNs,cn=config"); |
| | | DN unprivRootDN = DN.valueOf("cn=Unprivileged Root,cn=Root DNs,cn=config"); |
| | | Entry unprivRootEntry = DirectoryServer.getEntry(unprivRootDN); |
| | | AuthenticationInfo authInfo = new AuthenticationInfo(unprivRootEntry, true); |
| | | JmxConnectionHandler jmxCtx = getJmxConnectionHandler(); |
| | |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | | ModifyOperation modifyOperation = |
| | | internalRootConn.processModify(DN.decode("cn=Root DNs,cn=config"), |
| | | internalRootConn.processModify(DN.valueOf("cn=Root DNs,cn=config"), |
| | | mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | | modifyOperation = |
| | | internalRootConn.processModify(DN.decode("cn=Root DNs,cn=config"), |
| | | internalRootConn.processModify(DN.valueOf("cn=Root DNs,cn=config"), |
| | | mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TaskBackend taskBackend = |
| | | (TaskBackend) DirectoryServer.getBackend(DN.decode("cn=tasks")); |
| | | (TaskBackend) DirectoryServer.getBackend(DN.valueOf("cn=tasks")); |
| | | Task task = taskBackend.getScheduledTask(taskEntryDN); |
| | | if (task == null) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | InternalClientConnection.nextMessageID(), |
| | | new ArrayList<Control>(), |
| | | DN |
| | | .decode("cn=JMX Connection Handler,cn=Connection Handlers,cn=config"), |
| | | .valueOf("cn=JMX Connection Handler,cn=Connection Handlers,cn=config"), |
| | | mods); |
| | | op.run(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | .getRootConnection(); |
| | | |
| | | DeleteOperation deleteOperation = conn.processDelete(DN |
| | | .decode("cn=Privileged User,o=test")); |
| | | .valueOf("cn=Privileged User,o=test")); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | |
| | | |
| | | //Test case for a full encode decode operation with an empty DN params. |
| | | addEncoded = new AddResponseProtocolOp(resultCode, resultMsg, DN.nullDN(), |
| | | addEncoded = new AddResponseProtocolOp(resultCode, resultMsg, DN.rootDN(), |
| | | referralURLs); |
| | | builder.clear(); |
| | | addEncoded.write(writer); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | { |
| | | List<String> referralURLs=new ArrayList<String>(); |
| | | referralURLs.add(url); |
| | | DN responseDn = DN.decode(dn); |
| | | DN responseDn = DN.valueOf(dn); |
| | | ByteString serverSASLCredentials = |
| | | ByteString.valueOf(saslCreds); |
| | | BindResponseProtocolOp r = |
| | |
| | | */ |
| | | @Test |
| | | public void testBindResponseTooMany() throws Exception { |
| | | DN responseDn = DN.decode(dn); |
| | | DN responseDn = DN.valueOf(dn); |
| | | |
| | | ByteStringBuilder bsb = new ByteStringBuilder(); |
| | | ASN1Writer writer = ASN1.getWriter(bsb); |
| | |
| | | */ |
| | | @Test |
| | | public void testBindResponseBadReferral() throws Exception { |
| | | DN responseDn = DN.decode(dn); |
| | | DN responseDn = DN.valueOf(dn); |
| | | ByteString serverSASLCredentials = |
| | | ByteString.valueOf(saslCreds); |
| | | |
| | |
| | | public void testBindResponseEncodeDecode() throws Exception { |
| | | List<String> referralURLs=new ArrayList<String>(); |
| | | referralURLs.add(url); |
| | | DN responseDn = DN.decode(dn); |
| | | DN responseDn = DN.valueOf(dn); |
| | | ByteString serverSASLCredentials = |
| | | ByteString.valueOf(saslCreds); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | |
| | | |
| | | //Test case for a full encode decode operation with an empty DN params. |
| | | deleteEncoded = new CompareResponseProtocolOp(resultCode, resultMsg, DN.nullDN(), |
| | | deleteEncoded = new CompareResponseProtocolOp(resultCode, resultMsg, DN.rootDN(), |
| | | referralURLs); |
| | | builder.clear(); |
| | | deleteEncoded.write(writer); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | |
| | | |
| | | //Test case for a full encode decode operation with an empty DN params. |
| | | deleteEncoded = new DeleteResponseProtocolOp(resultCode, resultMsg, DN.nullDN(), |
| | | deleteEncoded = new DeleteResponseProtocolOp(resultCode, resultMsg, DN.rootDN(), |
| | | referralURLs); |
| | | builder.clear(); |
| | | deleteEncoded.write(writer); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | |
| | | |
| | | //Test case for a full encode decode operation with an empty DN params. |
| | | deleteEncoded = new ModifyDNResponseProtocolOp(resultCode, resultMsg, DN.nullDN(), |
| | | deleteEncoded = new ModifyDNResponseProtocolOp(resultCode, resultMsg, DN.rootDN(), |
| | | referralURLs); |
| | | builder.clear(); |
| | | deleteEncoded.write(writer); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | |
| | | |
| | | //Test case for a full encode decode operation with an empty DN params. |
| | | modifyEncoded = new ModifyResponseProtocolOp(resultCode, resultMsg, DN.nullDN(), |
| | | modifyEncoded = new ModifyResponseProtocolOp(resultCode, resultMsg, DN.rootDN(), |
| | | referralURLs); |
| | | builder.clear(); |
| | | modifyEncoded.write(writer); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | public void setUp() throws Exception { |
| | | super.setUp(); |
| | | |
| | | baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | replServerPort = TestCaseUtils.findFreePort(); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | @BeforeClass |
| | | public void setup() throws Exception |
| | | { |
| | | TEST_ROOT_DN = DN.decode(TEST_ROOT_DN_STRING); |
| | | TEST_ROOT_DN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | } |
| | | |
| | | /** |
| | |
| | | entry.removeAttribute(uidType); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<AttributeValue>()); |
| | | addDN = DN.decode("dc=dependency" + sequence + "," + addDN); |
| | | addDN = DN.valueOf("dc=dependency" + sequence + "," + addDN); |
| | | AddMsg addMsg = |
| | | new AddMsg(gen.newCSN(), addDN, stringUID(sequence+1), |
| | | stringUID(sequence), |
| | |
| | | addDN = TEST_ROOT_DN; |
| | | for (sequence = 1; sequence<=AddSequenceLength; sequence ++) |
| | | { |
| | | addDN = DN.decode("dc=dependency" + sequence + "," + addDN); |
| | | addDN = DN.valueOf("dc=dependency" + sequence + "," + addDN); |
| | | |
| | | boolean found = checkEntryHasAttribute(addDN, "description", "test", 10000, true); |
| | | assertTrue(found, "The modification was not replayed on entry " + addDN); |
| | |
| | | { |
| | | DeleteMsg delMsg = new DeleteMsg(deleteDN, gen.newCSN(), stringUID(sequence + 1)); |
| | | broker.publish(delMsg); |
| | | deleteDN = deleteDN.getParent(); |
| | | deleteDN = deleteDN.parent(); |
| | | } |
| | | |
| | | domain.enable(); |
| | |
| | | // check that entry just below the base entry was deleted. |
| | | // (we can't delete the base entry because some other tests might |
| | | // have added other children) |
| | | DN node1 = DN.decode("dc=dependency1," + TEST_ROOT_DN_STRING); |
| | | DN node1 = DN.valueOf("dc=dependency1," + TEST_ROOT_DN_STRING); |
| | | Entry baseEntry = getEntry(node1, 30000, false); |
| | | assertNull(baseEntry, |
| | | "The last entry of the DEL sequence was not deleted."); |
| | |
| | | entry.addAttribute(Attributes.create("entryuuid", |
| | | stringUID(renamedEntryUuid)), |
| | | new LinkedList<AttributeValue>()); |
| | | DN addDN = DN.decode("dc=moddndel" + "," + TEST_ROOT_DN_STRING); |
| | | DN addDN = DN.valueOf("dc=moddndel" + "," + TEST_ROOT_DN_STRING); |
| | | AddMsg addMsg = |
| | | new AddMsg(gen.newCSN(), addDN, stringUID(renamedEntryUuid), |
| | | stringUID(1), |
| | |
| | | stringUID(1), true, null, "dc=new_name"); |
| | | broker.publish(moddnMsg); |
| | | DeleteMsg delMsg = |
| | | new DeleteMsg(DN.decode("dc=new_name" + "," + TEST_ROOT_DN_STRING), |
| | | new DeleteMsg(DN.valueOf("dc=new_name" + "," + TEST_ROOT_DN_STRING), |
| | | gen.newCSN(), stringUID(renamedEntryUuid)); |
| | | broker.publish(delMsg); |
| | | |
| | |
| | | |
| | | // check that entry does not exist anymore. |
| | | Thread.sleep(10000); |
| | | found = checkEntryHasAttribute(DN.decode("dc=new_name" + "," + TEST_ROOT_DN_STRING), |
| | | found = checkEntryHasAttribute(DN.valueOf("dc=new_name" + "," + TEST_ROOT_DN_STRING), |
| | | "entryuuid", |
| | | stringUID(renamedEntryUuid), |
| | | 30000, false); |
| | |
| | | entry.removeAttribute(uidType); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<AttributeValue>()); |
| | | DN addDN = DN.decode("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | DN addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | AddMsg addMsg = |
| | | new AddMsg(gen.newCSN(), addDN, stringUID(sequence+1), |
| | | stringUID(1), |
| | |
| | | String addDn = "dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING; |
| | | |
| | | boolean found = |
| | | checkEntryHasAttribute(DN.decode(addDn), "entryuuid", |
| | | checkEntryHasAttribute(DN.valueOf(addDn), "entryuuid", |
| | | stringUID(sequence+1025), |
| | | 30000, true); |
| | | if (!found) |
| | |
| | | |
| | | for (sequence = 1; sequence<=AddSequenceLength; sequence ++) |
| | | { |
| | | DN deleteDN = DN.decode("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | DN deleteDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | DeleteMsg delMsg = new DeleteMsg(deleteDN, |
| | | gen.newCSN(), |
| | | stringUID(sequence + 1025)); |
| | |
| | | } |
| | | |
| | | // check that the database was cleaned successfully |
| | | DN node1 = DN.decode("dc=dependency1," + TEST_ROOT_DN_STRING); |
| | | DN node1 = DN.valueOf("dc=dependency1," + TEST_ROOT_DN_STRING); |
| | | Entry baseEntry = getEntry(node1, 30000, false); |
| | | assertNull(baseEntry, |
| | | "The entry were not removed succesfully after test completion."); |
| | |
| | | entry.removeAttribute(uidType); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<AttributeValue>()); |
| | | addDN = DN.decode("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | AddMsg addMsg = |
| | | new AddMsg(gen.newCSN(), addDN, stringUID(sequence+1), |
| | | stringUID(1), |
| | |
| | | // check that all entries have been renamed |
| | | for (sequence = 1; sequence<=AddSequenceLength; sequence ++) |
| | | { |
| | | addDN = DN.decode("dc=new_dep" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | addDN = DN.valueOf("dc=new_dep" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | Entry baseEntry = getEntry(addDN, 30000, true); |
| | | assertNotNull(baseEntry, |
| | | "The rename was not applied correctly on :" + addDN); |
| | |
| | | // delete the entries to clean the database. |
| | | for (sequence = 1; sequence<=AddSequenceLength; sequence ++) |
| | | { |
| | | addDN = DN.decode("dc=new_dep" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | addDN = DN.valueOf("dc=new_dep" + sequence + "," + TEST_ROOT_DN_STRING); |
| | | DeleteMsg delMsg = new DeleteMsg(addDN, gen.newCSN(), stringUID(sequence + 1)); |
| | | broker.publish(delMsg); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | super.setUp(); |
| | | |
| | | replServerPort = TestCaseUtils.findFreePorts(3); |
| | | baseDN = DN.decode(baseDnStr); |
| | | baseDN = DN.valueOf(baseDnStr); |
| | | |
| | | updatedEntries = newLDIFEntries(); |
| | | |
| | |
| | | |
| | | debugInfo("Search Entry: " + dn); |
| | | |
| | | DN entryDN = DN.decode(dn); |
| | | DN entryDN = DN.valueOf(dn); |
| | | |
| | | try |
| | | { |
| | |
| | | String synchroServerStringDN = "cn=" + testName + ", cn=domains," + SYNCHRO_PLUGIN_DN; |
| | | assertNotNull(synchroServerEntry); |
| | | |
| | | DN synchroServerDN = DN.decode(synchroServerStringDN); |
| | | DN synchroServerDN = DN.valueOf(synchroServerStringDN); |
| | | |
| | | Entry ecle = DirectoryServer.getConfigHandler().getEntry( |
| | | DN.decode("cn=external changelog," + synchroServerStringDN)); |
| | | DN.valueOf("cn=external changelog," + synchroServerStringDN)); |
| | | if (ecle!=null) |
| | | { |
| | | DirectoryServer.getConfigHandler().deleteEntry(ecle.getDN(), null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | log("Setup: debugEnabled:" + debugEnabled()); |
| | | |
| | | // This test suite depends on having the schema available. |
| | | baseDN = DN.decode(EXAMPLE_DN); |
| | | baseDN = DN.valueOf(EXAMPLE_DN); |
| | | |
| | | // This test uses import tasks which do not work with memory backend |
| | | // (like the test backend we use in every tests): backend is disabled then |
| | |
| | | |
| | | log("Search Entry: " + dn); |
| | | |
| | | DN entryDN = DN.decode(dn); |
| | | DN entryDN = DN.valueOf(dn); |
| | | |
| | | Entry resultEntry = getEntry(entryDN, 1000, true); |
| | | if (resultEntry == null) |
| | |
| | | // do not try to remove non-leaves |
| | | entriesToCleanup.removeAll(Arrays.asList( |
| | | baseDN, |
| | | DN.decode("ou=people," + EXAMPLE_DN))); |
| | | DN.valueOf("ou=people," + EXAMPLE_DN))); |
| | | super.cleanRealEntries(); |
| | | |
| | | remove(replServer1, replServer2, replServer3); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | // This test suite depends on having the schema available. |
| | | super.setUp(); |
| | | |
| | | baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | replServerPort = TestCaseUtils.findFreePort(); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | { |
| | | // Delete the entry we are going to use to make sure that |
| | | // we do test something. |
| | | DN entryDN = DN.decode("dc=fooUniqueName1," + EXAMPLE_DN); |
| | | DN entryDN = DN.valueOf("dc=fooUniqueName1," + EXAMPLE_DN); |
| | | connection.processDelete(entryDN); |
| | | |
| | | task("dn: ds-task-id=" + UUID.randomUUID() |
| | |
| | | { |
| | | // delete the entry we are going to use to make sure that |
| | | // we do test something. |
| | | DN entryDN = DN.decode("dc=fooUniqueName2," + EXAMPLE_DN); |
| | | DN entryDN = DN.valueOf("dc=fooUniqueName2," + EXAMPLE_DN); |
| | | connection.processDelete(entryDN); |
| | | |
| | | String path = reSyncTempDir.getAbsolutePath() + File.pathSeparator + "ReSynchTest"; |
| | |
| | | callParanoiaCheck = false; |
| | | |
| | | // Do not try to remove non leaves |
| | | entriesToCleanup.remove(DN.decode(EXAMPLE_DN)); |
| | | entriesToCleanup.remove(DN.valueOf(EXAMPLE_DN)); |
| | | super.classCleanUp(); |
| | | |
| | | TestCaseUtils.clearJEBackend(false, "userRoot", EXAMPLE_DN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | |
| | | protected void deleteEntry(DN dn) throws Exception |
| | | { |
| | | if (dn.getParent().getRDN().toString().equalsIgnoreCase("cn=domains")) |
| | | deleteEntry(DN.decode("cn=external changelog," + dn)); |
| | | if (dn.parent().rdn().toString().equalsIgnoreCase("cn=domains")) |
| | | deleteEntry(DN.valueOf("cn=external changelog," + dn)); |
| | | |
| | | DeleteOperation op = connection.processDelete(dn); |
| | | assertTrue(op.getResultCode() == SUCCESS || op.getResultCode() == NO_SUCH_OBJECT, |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | |
| | | cleanUpReplicationServersDB(); |
| | | |
| | | final DN baseDN = DN.decode("cn=schema"); |
| | | final DN baseDN = DN.valueOf("cn=schema"); |
| | | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDN, 2, 100, replServerPort, 5000); |
| | |
| | | |
| | | cleanUpReplicationServersDB(); |
| | | |
| | | final DN baseDN = DN.decode("cn=schema"); |
| | | final DN baseDN = DN.valueOf("cn=schema"); |
| | | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDN, 2, 100, replServerPort, 5000); |
| | |
| | | |
| | | cleanUpReplicationServersDB(); |
| | | |
| | | final DN baseDN = DN.decode("cn=schema"); |
| | | final DN baseDN = DN.valueOf("cn=schema"); |
| | | |
| | | ReplicationBroker broker = |
| | | openReplicationSession(baseDN, 3, 100, replServerPort, 5000); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock As. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | logError(Message.raw(Category.SYNC, Severity.NOTICE, |
| | | "Starting replication StressTest : fromServertoBroker")); |
| | | |
| | | final DN baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf("ou=People," + TEST_ROOT_DN_STRING); |
| | | final int TOTAL_MESSAGES = 1000; |
| | | |
| | | ReplicationBroker broker = |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication; |
| | | |
| | |
| | | { |
| | | super.setUp(); |
| | | |
| | | baseDN = DN.decode("ou=People," + TEST_ROOT_DN_STRING); |
| | | baseDN = DN.valueOf("ou=People," + TEST_ROOT_DN_STRING); |
| | | |
| | | // Create necessary backend top level entry |
| | | String topEntry = "dn: " + baseDN + "\n" |
| | |
| | | */ |
| | | user1entryUUID = "33333333-3333-3333-3333-333333333333"; |
| | | user1entrysecondUUID = "22222222-2222-2222-2222-222222222222"; |
| | | user1dn = DN.decode("uid=user1" + tc + "," + baseDN); |
| | | user1dn = DN.valueOf("uid=user1" + tc + "," + baseDN); |
| | | personWithUUIDEntry = TestCaseUtils.entryFromLdifString("dn: "+ user1dn + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | |
| | | + "entryUUID: "+ user1entrysecondUUID + "\n"); |
| | | |
| | | user3UUID = "44444444-4444-4444-4444-444444444444"; |
| | | user3dn = DN.decode("uid=user3" + tc + "," + baseDN); |
| | | user3dn = DN.valueOf("uid=user3" + tc + "," + baseDN); |
| | | user3Entry = TestCaseUtils.entryFromLdifString("dn: "+ user3dn + "\n" |
| | | + "objectClass: top\n" + "objectClass: person\n" |
| | | + "objectClass: organizationalPerson\n" |
| | |
| | | + "userPassword: password\n" + "initials: AA\n" |
| | | + "entryUUID: " + user3UUID + "\n"); |
| | | |
| | | domain1dn = DN.decode("dc=domain1," + baseDN); |
| | | domain2dn = DN.decode("dc=domain2,dc=domain1," + baseDN); |
| | | domain3dn = DN.decode("dc=domain3,dc=domain1," + baseDN); |
| | | domain1dn = DN.valueOf("dc=domain1," + baseDN); |
| | | domain2dn = DN.valueOf("dc=domain2,dc=domain1," + baseDN); |
| | | domain3dn = DN.valueOf("dc=domain3,dc=domain1," + baseDN); |
| | | domain1 = TestCaseUtils.entryFromLdifString( |
| | | "dn:" + domain1dn + "\n" |
| | | + "objectClass:domain\n" |
| | |
| | | public void modifyConflicts() throws Exception |
| | | { |
| | | testSetUp("modifyConflicts"); |
| | | final DN dn1 = DN.decode("cn=test1," + baseDN); |
| | | final DN dn1 = DN.valueOf("cn=test1," + baseDN); |
| | | final AttributeType attrType = |
| | | DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = |
| | |
| | | // send a modify operation with the correct unique ID but another DN |
| | | List<Modification> mods = generatemods("telephonenumber", "01 02 45"); |
| | | ModifyMsg modMsg = new ModifyMsg(gen.newCSN(), |
| | | DN.decode("cn=something," + baseDN), mods, user1entryUUID); |
| | | DN.valueOf("cn=something," + baseDN), mods, user1entryUUID); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | int alertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modMsg); |
| | |
| | | // used above |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | alertCount = DummyAlertHandler.getAlertCount(); |
| | | DN delDN = DN.decode("cn=anotherdn," + baseDN); |
| | | DN delDN = DN.valueOf("cn=anotherdn," + baseDN); |
| | | broker.publish(new DeleteMsg(delDN, gen.newCSN(), user1entryUUID)); |
| | | |
| | | // check that the delete operation has been applied |
| | |
| | | broker.publish(addMsg(gen, personWithSecondUniqueID, user1entrysecondUUID, baseUUID)); |
| | | |
| | | // Check that the entry has been renamed and created in the local DS. |
| | | DN dn2 = DN.decode("entryuuid=" + user1entrysecondUUID + " + " + user1dn); |
| | | DN dn2 = DN.valueOf("entryuuid=" + user1entrysecondUUID + " + " + user1dn); |
| | | final Entry entryAfterAdd = getEntry(dn2, 10000, true); |
| | | assertNotNull(entryAfterAdd, "The ADD replication message was not applied"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | |
| | | */ |
| | | String addDN = "uid=new person,o=nothere,o=below," + baseDN; |
| | | AddMsg addMsg = new AddMsg(gen.newCSN(), |
| | | DN.decode(addDN), |
| | | DN.valueOf(addDN), |
| | | user1entryUUID, |
| | | baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | |
| | | broker.publish(addMsg); |
| | | |
| | | // Check that the entry has been created in the local DS. |
| | | DN newPersonDN = DN.decode("uid=new person," + baseDN); |
| | | DN newPersonDN = DN.valueOf("uid=new person," + baseDN); |
| | | assertNotNull(getEntry(newPersonDN, 10000, true), |
| | | "The ADD replication message was not applied"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | |
| | | broker.publish(modDnMsg); |
| | | |
| | | // check that the operation has been correctly relayed |
| | | assertNotNull(getEntry(DN.decode("uid=newrdn," + baseDN), 10000, true), |
| | | assertNotNull(getEntry(DN.valueOf("uid=newrdn," + baseDN), 10000, true), |
| | | "The modify dn was not or badly replayed"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | assertConflictAutomaticallyResolved(alertCount); |
| | |
| | | /* |
| | | * same test but by giving a bad entry DN |
| | | */ |
| | | DN modDN = DN.decode("uid=wrong," + baseDN); |
| | | DN modDN = DN.valueOf("uid=wrong," + baseDN); |
| | | modDnMsg = new ModifyDNMsg(modDN, gen.newCSN(), |
| | | user1entryUUID, null, false, null, "uid=reallynewrdn"); |
| | | updateMonitorCount(baseDN, resolvedMonitorAttr); |
| | | alertCount = DummyAlertHandler.getAlertCount(); |
| | | broker.publish(modDnMsg); |
| | | |
| | | DN reallyNewDN = DN.decode("uid=reallynewrdn," + baseDN); |
| | | DN reallyNewDN = DN.valueOf("uid=reallynewrdn," + baseDN); |
| | | |
| | | // check that the operation has been correctly relayed |
| | | assertNotNull(getEntry(reallyNewDN, 10000, true), |
| | |
| | | broker.publish(modDnMsg); |
| | | |
| | | // check that the second entry has been renamed |
| | | DN dn = DN.decode("entryUUID = " + user1entrysecondUUID + "+uid=reallynewrdn," + baseDN); |
| | | DN dn = DN.valueOf("entryUUID = " + user1entrysecondUUID + "+uid=reallynewrdn," + baseDN); |
| | | final Entry entryAfterModDN = getEntry(dn, 10000, true); |
| | | assertNotNull(entryAfterModDN, "The modifyDN was not or incorrectly replayed"); |
| | | assertEquals(getMonitorDelta(), 1); |
| | |
| | | |
| | | |
| | | // delete the entries to clean the database |
| | | DN delDN2 = DN.decode( |
| | | "entryUUID = " + user1entrysecondUUID + "+" + user1dn.getRDN() + "," + baseDN); |
| | | DN delDN2 = DN.valueOf( |
| | | "entryUUID = " + user1entrysecondUUID + "+" + user1dn.rdn() + "," + baseDN); |
| | | broker.publish(new DeleteMsg(delDN2, gen.newCSN(), user1entrysecondUUID)); |
| | | assertNull(getEntry(delDN2, 10000, false), |
| | | "The DELETE replication message was not replayed"); |
| | |
| | | * - publish msg |
| | | * - check that the Dn has been changed to baseDn2 in the msg received |
| | | */ |
| | | DN baseDN1 = DN.decode("ou=baseDn1," + baseDN); |
| | | DN baseDN2 = DN.decode("ou=baseDn2," + baseDN); |
| | | DN baseDN1 = DN.valueOf("ou=baseDn1," + baseDN); |
| | | DN baseDN2 = DN.valueOf("ou=baseDn2," + baseDN); |
| | | |
| | | // - create parent entry 1 with baseDn1 |
| | | connection.processAdd(TestCaseUtils.entryFromLdifString( |
| | |
| | | "Entry not added: " + baseDN1); |
| | | |
| | | // - create Add Msg for user1 with parent entry 1 UUID |
| | | DN newPersonDN2 = DN.decode("uid=new person," + baseDN1); |
| | | DN newPersonDN2 = DN.valueOf("uid=new person," + baseDN1); |
| | | addMsg = new AddMsg(gen.newCSN(), |
| | | newPersonDN2, |
| | | user1entryUUID, |
| | |
| | | // - check that the DN has been changed to baseDn2 |
| | | assertNull(getEntry(newPersonDN2, 10000, false), |
| | | "The ADD replication message was applied under " + baseDN1); |
| | | assertNotNull(getEntry(DN.decode("uid=new person," + baseDN2), 10000, true), |
| | | assertNotNull(getEntry(DN.valueOf("uid=new person," + baseDN2), 10000, true), |
| | | "The ADD replication message was NOT applied under " + baseDN2); |
| | | assertEquals(getMonitorDelta(), 1); |
| | | assertConflictAutomaticallyResolved(alertCount); |
| | |
| | | domain2uid = getEntryUUID(domain2dn); |
| | | addEntry(domain3); |
| | | domain3uid = getEntryUUID(domain3dn); |
| | | DN conflictDomain2dn = DN.decode( |
| | | DN conflictDomain2dn = DN.valueOf( |
| | | "entryUUID = " + domain2uid + "+dc=domain2," + baseDN); |
| | | DN conflictDomain3dn = DN.decode( |
| | | DN conflictDomain3dn = DN.valueOf( |
| | | "entryUUID = " + domain3uid + "+dc=domain3," + baseDN); |
| | | |
| | | updateMonitorCount(baseDN, unresolvedMonitorAttr); |
| | |
| | | |
| | | // check that the entry have been correctly marked as conflicting. |
| | | assertTrue(checkEntryHasAttribute( |
| | | DN.decode("uid=new person," + baseDN2), |
| | | DN.valueOf("uid=new person," + baseDN2), |
| | | LDAPReplicationDomain.DS_SYNC_CONFLICT, |
| | | "uid=newrdn," + baseDN2, 1000, true)); |
| | | } |
| | |
| | | assertClientReceivesExpectedMsg(broker, ModifyMsg.class, personEntry.getDN()); |
| | | |
| | | // Modify the entry DN |
| | | DN newDN = DN.decode("uid= new person," + baseDN); |
| | | DN newDN = DN.valueOf("uid= new person," + baseDN); |
| | | connection.processModifyDN(personEntry.getDN(), |
| | | RDN.decode("uid=new person"), true, baseDN); |
| | | assertTrue(DirectoryServer.entryExists(newDN), |
| | |
| | | * |
| | | * |
| | | * Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.common; |
| | | |
| | |
| | | @Test |
| | | public void testUpdateCSN() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("o=test1"); |
| | | final DN dn2 = DN.decode("o=test2"); |
| | | final DN dn1 = DN.valueOf("o=test1"); |
| | | final DN dn2 = DN.valueOf("o=test2"); |
| | | |
| | | final MultiDomainServerState state = new MultiDomainServerState(); |
| | | assertTrue(state.update(dn1, csn1)); |
| | |
| | | @Test |
| | | public void testUpdateServerState() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("o=test1"); |
| | | final DN dn2 = DN.decode("o=test2"); |
| | | final DN dn1 = DN.valueOf("o=test1"); |
| | | final DN dn2 = DN.valueOf("o=test2"); |
| | | |
| | | final MultiDomainServerState state = new MultiDomainServerState(); |
| | | final ServerState ss1 = new ServerState(); |
| | |
| | | @Test |
| | | public void testUpdateMultiDomainServerState() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("o=test1"); |
| | | final DN dn2 = DN.decode("o=test2"); |
| | | final DN dn1 = DN.valueOf("o=test1"); |
| | | final DN dn2 = DN.valueOf("o=test2"); |
| | | |
| | | final MultiDomainServerState state1 = new MultiDomainServerState(); |
| | | state1.update(dn1, csn3); |
| | |
| | | @Test(dependsOnMethods = { "testUpdateCSN" }) |
| | | public void testEqualsTo() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("o=test1"); |
| | | final DN dn2 = DN.decode("o=test2"); |
| | | final DN dn1 = DN.valueOf("o=test1"); |
| | | final DN dn2 = DN.valueOf("o=test2"); |
| | | |
| | | final MultiDomainServerState state1 = new MultiDomainServerState(); |
| | | assertTrue(state1.update(dn1, csn3)); |
| | |
| | | @Test(dependsOnMethods = { "testUpdateCSN" }) |
| | | public void testIsEmpty() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("o=test1"); |
| | | final DN dn2 = DN.decode("o=test2"); |
| | | final DN dn1 = DN.valueOf("o=test1"); |
| | | final DN dn2 = DN.valueOf("o=test2"); |
| | | |
| | | final MultiDomainServerState state = new MultiDomainServerState(); |
| | | assertTrue(state.isEmpty()); |
| | |
| | | @Test(dependsOnMethods = { "testUpdateCSN" }) |
| | | public void testRemoveCSN() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("o=test1"); |
| | | final DN dn2 = DN.decode("o=test2"); |
| | | final DN dn3 = DN.decode("o=test3"); |
| | | final DN dn1 = DN.valueOf("o=test1"); |
| | | final DN dn2 = DN.valueOf("o=test2"); |
| | | final DN dn3 = DN.valueOf("o=test3"); |
| | | |
| | | final MultiDomainServerState state = new MultiDomainServerState(); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | |
| | | // Check monitoring values |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(SAFE_DATA_DN); |
| | | DN baseDN = DN.valueOf(SAFE_DATA_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sd-sent-updates", 1) |
| | | .assertValue("assured-sd-timeout-updates", 1) |
| | |
| | | // No error should be seen in monitoring and update should have not been |
| | | // sent in assured mode |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(NOT_ASSURED_DN); |
| | | DN baseDN = DN.valueOf(NOT_ASSURED_DN); |
| | | new MonitorAssertions(baseDN).assertRemainingValuesAreZero(); |
| | | assertNoServerErrors(baseDN); |
| | | } |
| | |
| | | |
| | | // Check monitoring values |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(SAFE_READ_DN); |
| | | DN baseDN = DN.valueOf(SAFE_READ_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sr-sent-updates", 1) |
| | | .assertValue("assured-sr-not-acknowledged-updates", 1) |
| | |
| | | // No error should be seen in monitoring and update should have not been |
| | | // sent in assured mode |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(NOT_ASSURED_DN); |
| | | DN baseDN = DN.valueOf(NOT_ASSURED_DN); |
| | | new MonitorAssertions(baseDN).assertRemainingValuesAreZero(); |
| | | assertNoServerErrors(baseDN); |
| | | } |
| | |
| | | |
| | | // Check monitoring values |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(SAFE_DATA_DN); |
| | | DN baseDN = DN.valueOf(SAFE_DATA_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sd-sent-updates", 1) |
| | | .assertValue("assured-sd-acknowledged-updates", 1) |
| | |
| | | |
| | | // Check monitoring values |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(SAFE_READ_DN); |
| | | DN baseDN = DN.valueOf(SAFE_READ_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sr-sent-updates", 1) |
| | | .assertValue("assured-sr-acknowledged-updates", 1) |
| | |
| | | "objectClass: top\n" + |
| | | "objectClass: organizationalUnit\n"; |
| | | Entry entry = TestCaseUtils.entryFromLdifString(entryStr); |
| | | String parentUid = getEntryUUID(DN.decode(SAFE_READ_DN)); |
| | | String parentUid = getEntryUUID(DN.valueOf(SAFE_READ_DN)); |
| | | |
| | | try { |
| | | AckMsg ackMsg = replicationServer.sendAssuredAddMsg(entry, parentUid); |
| | |
| | | assertEquals(ackMsg.getFailedServers().size(), 0); |
| | | |
| | | // Check for monitoring data |
| | | DN baseDN = DN.decode(SAFE_READ_DN); |
| | | DN baseDN = DN.valueOf(SAFE_READ_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sr-received-updates", 1) |
| | | .assertValue("assured-sr-received-updates-acked", 1) |
| | |
| | | "objectClass: top\n" + |
| | | "objectClass: organizationalUnit\n"; |
| | | Entry entry = TestCaseUtils.entryFromLdifString(entryStr); |
| | | String parentUid = getEntryUUID(DN.decode(SAFE_DATA_DN)); |
| | | String parentUid = getEntryUUID(DN.valueOf(SAFE_DATA_DN)); |
| | | |
| | | AckMsg ackMsg = replicationServer.sendAssuredAddMsg(entry, parentUid); |
| | | fail("DS should not reply an ack in safe data mode, however, it replied: " + ackMsg); |
| | |
| | | // - timeout error |
| | | // - server 10 error |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(SAFE_DATA_DN); |
| | | DN baseDN = DN.valueOf(SAFE_DATA_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sd-sent-updates", 1) |
| | | .assertValue("assured-sd-timeout-updates", 1) |
| | |
| | | // - timeout error |
| | | // - server 10 error, server 20 error |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | baseDN = DN.decode(SAFE_DATA_DN); |
| | | baseDN = DN.valueOf(SAFE_DATA_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sd-sent-updates", 2) |
| | | .assertValue("assured-sd-timeout-updates", 2) |
| | |
| | | // Check monitoring values |
| | | // No ack should have comen back, so timeout incremented (flag and error for rs) |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | baseDN = DN.decode(SAFE_DATA_DN); |
| | | baseDN = DN.valueOf(SAFE_DATA_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sd-sent-updates", 3) |
| | | .assertValue("assured-sd-timeout-updates", 3) |
| | |
| | | // - replay error |
| | | // - server 10 error, server 20 error |
| | | Thread.sleep(1000); // Sleep a while as counters are updated just after sending thread is unblocked |
| | | DN baseDN = DN.decode(SAFE_READ_DN); |
| | | DN baseDN = DN.valueOf(SAFE_READ_DN); |
| | | new MonitorAssertions(baseDN) |
| | | .assertValue("assured-sr-sent-updates", 1) |
| | | .assertValue("assured-sr-not-acknowledged-updates", 1) |
| | |
| | | */ |
| | | private void deleteEntry(String dn) throws Exception |
| | | { |
| | | DN realDN = DN.decode(dn); |
| | | DN realDN = DN.valueOf(dn); |
| | | DeleteOperation delOp = connection.processDelete(realDN); |
| | | waitOpResult(delOp, ResultCode.SUCCESS); |
| | | assertNull(DirectoryServer.getEntry(realDN)); |
| | |
| | | // Find monitoring entry for requested base DN |
| | | SearchFilter monitorFilter = SearchFilter.createFilterFromString( |
| | | "(&(cn=Directory server*)(domain-name=" + baseDN + "))"); |
| | | DN dn = DN.decode("cn=replication,cn=monitor"); |
| | | DN dn = DN.valueOf("cn=replication,cn=monitor"); |
| | | |
| | | InternalSearchOperation op; |
| | | int count = 0; |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | { |
| | | this.replicationServers = new TreeSet<String>(); |
| | | this.replicationServers.add(replServer); |
| | | this.baseDN = DN.decode(baseDN); |
| | | this.baseDN = DN.valueOf(baseDN); |
| | | this.serverId = serverId; |
| | | } |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | return DN.decode("cn=domain, cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config"); |
| | | return DN.valueOf("cn=domain, cn=domains,cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config"); |
| | | } catch (DirectoryException e) |
| | | { |
| | | return null; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | |
| | | // check that entry has been created and that it does not contain |
| | | // forbidden attributes |
| | | Entry newEntry = getEntry(DN.decode(ENTRY_DN), TIMEOUT, true); |
| | | Entry newEntry = getEntry(DN.valueOf(ENTRY_DN), TIMEOUT, true); |
| | | checkEntryFilteredAfterAdd(newEntry, EXCLUDE_FRAC_MODE, fractionalConf); |
| | | |
| | | // perform modify operation (modify forbidden attributes + |
| | |
| | | |
| | | // check that entry has been created and that it does not contain |
| | | // forbidden attributes |
| | | Entry newEntry = getEntry(DN.decode(ENTRY_DN), TIMEOUT, true); |
| | | Entry newEntry = getEntry(DN.valueOf(ENTRY_DN), TIMEOUT, true); |
| | | checkEntryFilteredAfterAdd(newEntry, INCLUDE_FRAC_MODE, fractionalConf); |
| | | |
| | | // perform modify operation (modify forbidden attributes + |
| | |
| | | { |
| | | SortedSet<String> replicationServers = newSortedSet("localhost:" + replServerPort); |
| | | |
| | | DN baseDN = DN.decode(firstBackend ? TEST_ROOT_DN_STRING : TEST2_ROOT_DN_STRING); |
| | | DN baseDN = DN.valueOf(firstBackend ? TEST_ROOT_DN_STRING : TEST2_ROOT_DN_STRING); |
| | | replicationDomain = new FakeReplicationDomain(baseDN, DS2_ID, replicationServers, 1000, generationId); |
| | | |
| | | // Test connection |
| | |
| | | |
| | | private long readGenIdFromSuffixRootEntry(String rootDn) throws Exception |
| | | { |
| | | DN baseDN = DN.decode(rootDn); |
| | | DN baseDN = DN.valueOf(rootDn); |
| | | Entry resultEntry = getEntry(baseDN, 1000, true); |
| | | if (resultEntry == null) |
| | | { |
| | |
| | | mod = new Modification(ModificationType.ADD, attr); |
| | | mods.add(mod); |
| | | |
| | | DN entryDn = DN.decode(firstBackend ? ENTRY_DN : ENTRY_DN2); |
| | | DN entryDn = DN.valueOf(firstBackend ? ENTRY_DN : ENTRY_DN2); |
| | | ModifyMsg modifyMsg = new ModifyMsg(gen.newCSN(), entryDn, mods, ENTRY_UUID); |
| | | replicationDomain.publish(modifyMsg); |
| | | } |
| | |
| | | // The domain should go in bad gen as backend is not initialized with |
| | | // fractional data |
| | | LDAPReplicationDomain fractionalReplicationDomain = |
| | | MultimasterReplication.findDomain(DN.decode(TEST2_ROOT_DN_STRING), null); |
| | | MultimasterReplication.findDomain(DN.valueOf(TEST2_ROOT_DN_STRING), null); |
| | | waitForDomainStatus(fractionalReplicationDomain, |
| | | ServerStatus.BAD_GEN_ID_STATUS, 5); |
| | | |
| | |
| | | |
| | | // check that entry has been created and that it does not contain |
| | | // forbidden attributes |
| | | Entry newEntry = getEntry(DN.decode(ENTRY_DN2), TIMEOUT, true); |
| | | Entry newEntry = getEntry(DN.valueOf(ENTRY_DN2), TIMEOUT, true); |
| | | checkEntryFilteredAfterAdd(newEntry, EXCLUDE_FRAC_MODE, fractionalConf); |
| | | |
| | | // perform modify operation (modify forbidden attributes + |
| | |
| | | throws Exception |
| | | { |
| | | AttributeType synchroAttrType = DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR.toLowerCase()); |
| | | DN dn = DN.decode(entryDN); |
| | | DN dn = DN.valueOf(entryDN); |
| | | |
| | | Entry entry = null; |
| | | boolean synchroAttrFound = false; |
| | |
| | | // The domain should go in bad gen as backend is not initialized with |
| | | // fractional data |
| | | LDAPReplicationDomain fractionalReplicationDomain = |
| | | MultimasterReplication.findDomain(DN.decode(TEST2_ROOT_DN_STRING), null); |
| | | MultimasterReplication.findDomain(DN.valueOf(TEST2_ROOT_DN_STRING), null); |
| | | waitForDomainStatus(fractionalReplicationDomain, |
| | | ServerStatus.BAD_GEN_ID_STATUS, 5); |
| | | |
| | |
| | | |
| | | // check that entry has been created and that it does not contain |
| | | // forbidden attributes |
| | | Entry newEntry = getEntry(DN.decode(ENTRY_DN2), TIMEOUT, true); |
| | | Entry newEntry = getEntry(DN.valueOf(ENTRY_DN2), TIMEOUT, true); |
| | | checkEntryFilteredAfterAdd(newEntry, INCLUDE_FRAC_MODE, fractionalConf); |
| | | |
| | | // perform modify operation (modify forbidden attributes + |
| | |
| | | * the forbidden attributes |
| | | */ |
| | | String newEntryName = "displayName=ValueToBeKept," + TEST_ROOT_DN_STRING ; |
| | | DN newEntryDn = DN.decode(newEntryName); |
| | | DN newEntryDn = DN.valueOf(newEntryName); |
| | | |
| | | // Create modify dn message to modify the entry. |
| | | ModifyDNMsg modDnMsg = new ModifyDNMsg(DN.decode(entryName), gen.newCSN(), |
| | | ModifyDNMsg modDnMsg = new ModifyDNMsg(DN.valueOf(entryName), gen.newCSN(), |
| | | ENTRY_UUID, ENTRY_UUID3, false, TEST_ROOT_DN_STRING, |
| | | "displayName=ValueToBeKept", null); |
| | | |
| | |
| | | * the forbidden attributes |
| | | */ |
| | | String newEntryName = "displayName=ValueToBeKept," + TEST_ROOT_DN_STRING ; |
| | | DN newEntryDn = DN.decode(newEntryName); |
| | | DN newEntryDn = DN.valueOf(newEntryName); |
| | | |
| | | // Create modify dn message to modify the entry. |
| | | ModifyDNMsg modDnMsg = new ModifyDNMsg(DN.decode(entryName), gen.newCSN(), |
| | | ModifyDNMsg modDnMsg = new ModifyDNMsg(DN.valueOf(entryName), gen.newCSN(), |
| | | ENTRY_UUID, ENTRY_UUID3, false, TEST_ROOT_DN_STRING, |
| | | "displayName=ValueToBeKept", null); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | } |
| | | |
| | | // Clear any reference to a domain in synchro plugin |
| | | MultimasterReplication.deleteDomain(DN.decode(TEST_ROOT_DN_STRING)); |
| | | MultimasterReplication.deleteDomain(DN.valueOf(TEST_ROOT_DN_STRING)); |
| | | remove(rs1, rs2, rs3); |
| | | rs1 = rs2 = rs3 = null; |
| | | rs1Port = rs2Port = rs3Port = -1; |
| | |
| | | int groupId, String testCase) throws Exception |
| | | { |
| | | SortedSet<String> replServers = createRSListForTestCase(testCase); |
| | | DN baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | DN baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | DomainFakeCfg domainConf = |
| | | new DomainFakeCfg(baseDn, serverId, replServers, groupId); |
| | | LDAPReplicationDomain replicationDomain = |
| | |
| | | * Change group id of DS1 and DS2 to 1 and see them reconnect to RS1 |
| | | */ |
| | | SortedSet<String> replServers = createRSListForTestCase(testCase); |
| | | DN baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | DN baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | DomainFakeCfg domainConfWithNewGid = new DomainFakeCfg(baseDn, DS1_ID, replServers, 1); |
| | | rd1.applyConfigurationChange(domainConfWithNewGid); |
| | | domainConfWithNewGid = new DomainFakeCfg(baseDn, DS2_ID, replServers, 1); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | public void buildAndPublishMissingChangesOneEntryTest() throws Exception |
| | | { |
| | | final int serverId = 123; |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | ReplicationServer rs = createReplicationServer(); |
| | | // Create Replication Server and Domain |
| | |
| | | try |
| | | { |
| | | long startTime = TimeThread.getTime(); |
| | | final DN dn1 = DN.decode("cn=test1," + baseDN); |
| | | final DN dn1 = DN.valueOf("cn=test1," + baseDN); |
| | | final AttributeType histType = |
| | | DirectoryServer.getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | |
| | | @Test() |
| | | public void buildAndPublishMissingChangesSeveralEntriesTest() throws Exception |
| | | { |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | ReplicationServer rs = createReplicationServer(); |
| | | // Create Replication Server and Domain |
| | |
| | | "Starting replication test : changesCmpTest")); |
| | | |
| | | // Add 3 entries. |
| | | DN dnTest1 = DN.decode("cn=test1," + baseDN); |
| | | DN dnTest2 = DN.decode("cn=test2," + baseDN); |
| | | DN dnTest3 = DN.decode("cn=test3," + baseDN); |
| | | DN dnTest1 = DN.valueOf("cn=test1," + baseDN); |
| | | DN dnTest2 = DN.valueOf("cn=test2," + baseDN); |
| | | DN dnTest3 = DN.valueOf("cn=test3," + baseDN); |
| | | TestCaseUtils.addEntry( |
| | | "dn: " + dnTest3, |
| | | "displayname: Test1", |
| | |
| | | private LDAPReplicationDomain createReplicationDomain(int dsId) |
| | | throws DirectoryException, ConfigException |
| | | { |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | final DomainFakeCfg domainConf = new DomainFakeCfg( |
| | | baseDN, dsId, replServers, AssuredType.NOT_ASSURED, 2, 1, 0, null); |
| | | LDAPReplicationDomain replicationDomain = MultimasterReplication.createNewDomain(domainConf); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0); |
| | | |
| | | // Read the entry back to get its history operational attribute. |
| | | DN dn = DN.decode("uid=user.1," + TEST_ROOT_DN_STRING); |
| | | DN dn = DN.valueOf("uid=user.1," + TEST_ROOT_DN_STRING); |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | |
| | | List<Attribute> attrs = EntryHistorical.getHistoricalAttr(entry); |
| | |
| | | @Test(enabled=true, groups="slow") |
| | | public void conflictSingleValue() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("cn=test1," + TEST_ROOT_DN_STRING); |
| | | final DN dn2 = DN.decode("cn=test2," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN dn1 = DN.valueOf("cn=test1," + TEST_ROOT_DN_STRING); |
| | | final DN dn2 = DN.valueOf("cn=test2," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | final AttributeType attrType = |
| | | DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = |
| | |
| | | @Test() |
| | | public void historicalAdd() throws Exception |
| | | { |
| | | final DN dn1 = DN.decode("cn=testHistoricalAdd,o=test"); |
| | | final DN dn1 = DN.valueOf("cn=testHistoricalAdd,o=test"); |
| | | |
| | | // Clear the backend. |
| | | TestCaseUtils.initializeTestBackend(true); |
| | |
| | | "deleteoldrdn: 1"); |
| | | |
| | | // Read the modified entry. |
| | | final DN dn2 = DN.decode("cn=test2,o=test"); |
| | | final DN dn2 = DN.valueOf("cn=test2,o=test"); |
| | | entry = DirectoryServer.getEntry(dn2); |
| | | |
| | | // use historical information to generate new list of operations |
| | |
| | | AddMsg addmsg = addOp.generateMessage(); |
| | | assertEquals(dn1, addmsg.getDN()); |
| | | assertEquals(addmsg.getEntryUUID(), EntryHistorical.getEntryUUID(entry)); |
| | | String parentId = LDAPReplicationDomain.findEntryUUID(dn1.getParent()); |
| | | String parentId = LDAPReplicationDomain.findEntryUUID(dn1.parent()); |
| | | assertEquals(addmsg.getParentEntryUUID(), parentId); |
| | | |
| | | addmsg.createOperation(InternalClientConnection.getRootConnection()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | public void noUpdateIsolationPolicyTest() throws Exception |
| | | { |
| | | LDAPReplicationDomain domain = null; |
| | | DN baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | DN baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | int serverId = 1; |
| | | |
| | | try |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | * resolution for the description attribute. Always use the same values |
| | | * for all these tests. |
| | | */ |
| | | DN dn = DN.decode(TEST_ROOT_DN_STRING); |
| | | DN dn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | Map<ObjectClass, String> objectClasses = new HashMap<ObjectClass, String>(); |
| | | ObjectClass org = DirectoryServer.getObjectClass(ORGANIZATION); |
| | | objectClasses.put(org, ORGANIZATION); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | TestSynchronousReplayQueue queue = new TestSynchronousReplayQueue(); |
| | | DomainFakeCfg conf = new DomainFakeCfg(baseDN, 1, new TreeSet<String>()); |
| | |
| | | */ |
| | | CSNGenerator gen = new CSNGenerator(201, 0); |
| | | |
| | | String parentUUID = getEntryUUID(DN.decode(TEST_ROOT_DN_STRING)); |
| | | String parentUUID = getEntryUUID(DN.valueOf(TEST_ROOT_DN_STRING)); |
| | | |
| | | Entry entry = TestCaseUtils.entryFromLdifString( |
| | | "dn: cn=simultaneousModrdnConflict, "+ TEST_ROOT_DN_STRING + "\n" |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | TestSynchronousReplayQueue queue = new TestSynchronousReplayQueue(); |
| | | DomainFakeCfg conf = new DomainFakeCfg(baseDN, 1, new TreeSet<String>()); |
| | |
| | | |
| | | // Add the first entry |
| | | TestCaseUtils.addEntry(entry); |
| | | String parentUUID = getEntryUUID(DN.decode(TEST_ROOT_DN_STRING)); |
| | | String parentUUID = getEntryUUID(DN.valueOf(TEST_ROOT_DN_STRING)); |
| | | |
| | | CSN csn1 = gen.newCSN(); |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | TestSynchronousReplayQueue queue = new TestSynchronousReplayQueue(); |
| | | DomainFakeCfg conf = new DomainFakeCfg(baseDN, 1, new TreeSet<String>()); |
| | |
| | | |
| | | // Add the first entry |
| | | TestCaseUtils.addEntry(entry); |
| | | String parentUUID = getEntryUUID(DN.decode(TEST_ROOT_DN_STRING)); |
| | | String parentUUID = getEntryUUID(DN.valueOf(TEST_ROOT_DN_STRING)); |
| | | |
| | | CSN csn1 = gen.newCSN(); |
| | | |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | TestSynchronousReplayQueue queue = new TestSynchronousReplayQueue(); |
| | | DomainFakeCfg conf = new DomainFakeCfg(baseDN, 1, new TreeSet<String>()); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | TestSynchronousReplayQueue queue = new TestSynchronousReplayQueue(); |
| | | DomainFakeCfg conf = new DomainFakeCfg(baseDN, 1, new TreeSet<String>()); |
| | |
| | | |
| | | // Expect the child entry to be moved as conflict entry under the root |
| | | // entry of the suffix |
| | | DN childDN = DN.decode("entryuuid="+childUUID+ |
| | | DN childDN = DN.valueOf("entryuuid="+childUUID+ |
| | | "+cn=child,o=test"); |
| | | assertTrue(DirectoryServer.entryExists(childDN), |
| | | "Child entry conflict exist with DN="+childDN); |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | final DN baseDN = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | |
| | | TestSynchronousReplayQueue queue = new TestSynchronousReplayQueue(); |
| | | DomainFakeCfg conf = new DomainFakeCfg(baseDN, 1, new TreeSet<String>()); |
| | |
| | | |
| | | // Expect the child entry to be moved as conflict entry under the root |
| | | // entry of the suffix |
| | | DN childDN = DN.decode("entryuuid="+childUUID+ |
| | | DN childDN = DN.valueOf("entryuuid="+childUUID+ |
| | | "+cn=child,o=test"); |
| | | assertTrue(DirectoryServer.entryExists(childDN), |
| | | "Child entry conflict exist with DN="+childDN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | * Then creates a new PersistentServerState and check that the |
| | | * 2 csns have been saved in this new PersistentServerState. |
| | | */ |
| | | DN baseDn = DN.decode(dn); |
| | | DN baseDn = DN.valueOf(dn); |
| | | ServerState origState = new ServerState(); |
| | | PersistentServerState state = |
| | | new PersistentServerState(baseDn, 1, origState); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | } |
| | | |
| | | // Clear any reference to a domain in synchro plugin |
| | | MultimasterReplication.deleteDomain(DN.decode(TEST_ROOT_DN_STRING)); |
| | | MultimasterReplication.deleteDomain(DN.valueOf(TEST_ROOT_DN_STRING)); |
| | | remove(rs1, rs2); |
| | | rs1 = rs2 = null; |
| | | rs1Port = rs2Port = -1; |
| | |
| | | rs2 = createReplicationServer(RS2_ID, testCase); |
| | | |
| | | // Start DS1 |
| | | DN baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | DN baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | rd1 = createReplicationDomain(baseDn, DS1_ID); |
| | | |
| | | // Wait a bit so that connections are performed |
| | |
| | | rs2 = createReplicationServer(RS2_ID, testCase); |
| | | |
| | | // Start DS1 |
| | | DN baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | DN baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | rd1 = createReplicationDomain(baseDn, DS1_ID); |
| | | // Start DS2 |
| | | rd2 = createReplicationDomain(baseDn, DS2_ID); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | } |
| | | |
| | | // Clear any reference to a domain in synchro plugin |
| | | MultimasterReplication.deleteDomain(DN.decode(TEST_ROOT_DN_STRING)); |
| | | MultimasterReplication.deleteDomain(DN.valueOf(TEST_ROOT_DN_STRING)); |
| | | remove(rs); |
| | | Arrays.fill(rs, null); |
| | | Arrays.fill(rsPort, -1); |
| | |
| | | String testCase) throws Exception |
| | | { |
| | | final SortedSet<String> replServers = createRSListForTestCase(testCase); |
| | | final DN baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | final DN baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | final DomainFakeCfg domainConf = |
| | | new DomainFakeCfg(baseDn, serverId + 1, replServers, 1); |
| | | final LDAPReplicationDomain rd = |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | public void setUp() throws Exception |
| | | { |
| | | super.setUp(); |
| | | EXAMPLE_DN_ = DN.decode(EXAMPLE_DN); |
| | | EXAMPLE_DN_ = DN.valueOf(EXAMPLE_DN); |
| | | |
| | | // Note: this test does not use the memory test backend as for having a DS |
| | | // going into degraded status, we need to send a lot of updates. This makes |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | } |
| | | |
| | | // Clear any reference to a domain in synchro plugin |
| | | MultimasterReplication.deleteDomain(DN.decode(TEST_ROOT_DN_STRING)); |
| | | MultimasterReplication.deleteDomain(DN.valueOf(TEST_ROOT_DN_STRING)); |
| | | remove(rs1, rs2, rs3); |
| | | rs1 = rs2 = rs3 = null; |
| | | rs1Port = rs2Port = rs3Port = -1; |
| | |
| | | fail("Unknown replication domain server id."); |
| | | } |
| | | |
| | | DN baseDn = DN.decode(TEST_ROOT_DN_STRING); |
| | | DN baseDn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | DomainFakeCfg domainConf = |
| | | new DomainFakeCfg(baseDn, dsId, replServers, assuredType, |
| | | assuredSdLevel, groupId, 0, refUrls); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | @DataProvider(name="createReplServerStartData") |
| | | public Object [][] createReplServerStartData() throws Exception |
| | | { |
| | | DN baseDN = DN.decode("o=test"); |
| | | DN baseDN = DN.valueOf("o=test"); |
| | | ServerState state = new ServerState(); |
| | | state.update(new CSN(0, 0,0)); |
| | | Object[] set1 = new Object[] {1, baseDN, 0, "localhost:8989", state, 0L, (byte)0, 0}; |
| | | |
| | | baseDN = DN.decode("dc=example,dc=com"); |
| | | baseDN = DN.valueOf("dc=example,dc=com"); |
| | | state = new ServerState(); |
| | | state.update(new CSN(75, 5,263)); |
| | | Object[] set2 = new Object[] {16, baseDN, 100, "anotherHost:1025", state, 1245L, (byte)25, 3456}; |
| | |
| | | byte safeDataLevel, List<Attribute> entryAttrList) |
| | | throws Exception |
| | | { |
| | | final DN dn = DN.decode(rawDN); |
| | | final DN dn = DN.valueOf(rawDN); |
| | | |
| | | // Create VLAST message |
| | | Attribute objectClass = Attributes.create(DirectoryServer |
| | |
| | | byte safeDataLevel, List<Attribute> entryAttrList) |
| | | throws Exception |
| | | { |
| | | final DN dn = DN.decode(rawDN); |
| | | final DN dn = DN.valueOf(rawDN); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | DeleteMsg msg = new DeleteMsg(dn, csn, "thisIsaUniqueID"); |
| | |
| | | throws Exception |
| | | { |
| | | // Create VLAST message |
| | | DN dn = DN.decode(rawdn); |
| | | DN dn = DN.valueOf(rawdn); |
| | | ModifyMsg origVlastMsg = new ModifyMsg(csn, dn, mods, "fakeuniqueid"); |
| | | |
| | | origVlastMsg.setAssured(isAssured); |
| | |
| | | List<Attribute> entryAttrList) |
| | | throws Exception |
| | | { |
| | | final DN dn = DN.decode(rawDN); |
| | | final DN dn = DN.valueOf(rawDN); |
| | | |
| | | // Create VLAST message |
| | | CSN csn = new CSN(TimeThread.getTime(), 596, 13); |
| | |
| | | { |
| | | LDAPUpdateMsg msg = (LDAPUpdateMsg) ReplicationMsg.generateMsg( |
| | | hexStringToByteArray(encodedString), ProtocolVersion.REPLICATION_PROTOCOL_V3); |
| | | assertEquals(msg.getDN(), DN.decode(dn)); |
| | | assertEquals(msg.getDN(), DN.valueOf(dn)); |
| | | assertEquals(msg.getCSN(), csn); |
| | | assertEquals(msg.getClass(), msgType); |
| | | BigInteger bi = new BigInteger(msg.getBytes(ProtocolVersion.REPLICATION_PROTOCOL_V3)); |
| | |
| | | // parameters |
| | | ServerStartMsg msg = new ServerStartMsg(hexStringToByteArray(oldPdu)); |
| | | assertEquals(msg.getServerId(), serverId); |
| | | assertEquals(msg.getBaseDN(), DN.decode(dn)); |
| | | assertEquals(msg.getBaseDN(), DN.valueOf(dn)); |
| | | assertEquals(msg.getGroupId(), groupId); |
| | | BigInteger bi = new BigInteger(msg.getBytes(getCurrentVersion())); |
| | | assertEquals(bi.toString(16), oldPdu); |
| | |
| | | // parameters. |
| | | ReplServerStartMsg msg = new ReplServerStartMsg(hexStringToByteArray(oldPdu)); |
| | | assertEquals(msg.getServerId(), serverId); |
| | | assertEquals(msg.getBaseDN(), DN.decode(dn)); |
| | | assertEquals(msg.getBaseDN(), DN.valueOf(dn)); |
| | | assertEquals(msg.getGroupId(), groupId); |
| | | BigInteger bi = new BigInteger(msg.getBytes(ProtocolVersion.REPLICATION_PROTOCOL_V3)); |
| | | assertEquals(bi.toString(16), oldPdu); |
| | |
| | | { |
| | | int sender = 1; |
| | | int dest = 2; |
| | | DN baseDN = DN.decode("dc=whatever"); |
| | | DN baseDN = DN.valueOf("dc=whatever"); |
| | | int initWindow = 22; |
| | | Object[] set1 = new Object[] { sender, dest, baseDN, initWindow }; |
| | | return new Object [][] { set1}; |
| | |
| | | int sender = 1; |
| | | int dest = 2; |
| | | int initiator = 3; |
| | | DN baseDN = DN.decode("dc=whatever"); |
| | | DN baseDN = DN.valueOf("dc=whatever"); |
| | | int entryCount = 56; |
| | | int initWindow = 22; |
| | | Object[] set1 = new Object[] {sender, dest, initiator, baseDN, entryCount, initWindow }; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | public void setUp() throws Exception |
| | | { |
| | | super.setUp(); |
| | | TEST_ROOT_DN = DN.decode(TEST_ROOT_DN_STRING); |
| | | TEST_ROOT_DN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<Attribute> entryAttrList) |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode(rawdn); |
| | | DN dn = DN.valueOf(rawdn); |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyMsg msg = new ModifyMsg(csn, dn, mods, "fakeuniqueid"); |
| | |
| | | List<Attribute> entryAttrList) |
| | | throws Exception |
| | | { |
| | | DN dn = DN.decode(rawdn); |
| | | DN dn = DN.valueOf(rawdn); |
| | | ModifyMsg msg = new ModifyMsg(csn, dn, mods, "fakeuniqueid"); |
| | | |
| | | // Check isAssured |
| | |
| | | // Check Get / Set DN |
| | | assertEquals(msg.getDN(), generatedMsg.getDN()); |
| | | |
| | | DN fakeDN = DN.decode("cn=fake cn"); |
| | | DN fakeDN = DN.valueOf("cn=fake cn"); |
| | | msg.setDN(fakeDN) ; |
| | | assertEquals(msg.getDN(), fakeDN) ; |
| | | |
| | |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOp = |
| | | new DeleteOperationBasis(connection, 1, 1,null, DN.decode(rawDN)); |
| | | new DeleteOperationBasis(connection, 1, 1,null, DN.valueOf(rawDN)); |
| | | if (subtree) |
| | | { |
| | | deleteOp.addRequestControl(new SubtreeDeleteControl(false)); |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | ModifyDNOperation op = |
| | | new ModifyDNOperationBasis(connection, 1, 1, null, |
| | | DN.decode(rawDN), RDN.decode(newRdn), deleteOldRdn, |
| | | (newSuperior.length() != 0 ? DN.decode(newSuperior) : null)); |
| | | DN.valueOf(rawDN), RDN.decode(newRdn), deleteOldRdn, |
| | | (newSuperior.length() != 0 ? DN.valueOf(newSuperior) : null)); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | op.setAttachment(SYNCHROCONTEXT, |
| | |
| | | byte safeDataLevel, List<Attribute> entryAttrList) |
| | | throws Exception |
| | | { |
| | | final DN dn = DN.decode(rawDN); |
| | | final DN dn = DN.valueOf(rawDN); |
| | | |
| | | Attribute objectClass = Attributes.create(DirectoryServer |
| | | .getObjectClassAttributeType(), "organization"); |
| | |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOp = |
| | | new DeleteOperationBasis(connection, 1, 1,null, DN.decode("cn=t1")); |
| | | new DeleteOperationBasis(connection, 1, 1,null, DN.valueOf("cn=t1")); |
| | | LocalBackendDeleteOperation op = new LocalBackendDeleteOperation(deleteOp); |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | op.setAttachment(SYNCHROCONTEXT, new DeleteContext(csn, "uniqueid")); |
| | | DeleteMsg delmsg = new DeleteMsg(op); |
| | | long changeNumber = 21; |
| | | |
| | | DN baseDN = DN.decode("dc=example,dc=com"); |
| | | DN baseDN = DN.valueOf("dc=example,dc=com"); |
| | | |
| | | // create a cookie |
| | | MultiDomainServerState cookie = |
| | |
| | | opList.put(attr.getAttributeType(), newList(attr)); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | DN dn = DN.decode(rawDN); |
| | | DN dn = DN.valueOf(rawDN); |
| | | |
| | | long createop = 0; |
| | | long createmsgfromop = 0; |
| | |
| | | List<Attribute> entryAttrList) throws Exception |
| | | { |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | DN dn = DN.decode(rawdn); |
| | | DN dn = DN.valueOf(rawdn); |
| | | |
| | | long createop = 0; |
| | | long createmsgfromop = 0; |
| | |
| | | |
| | | // create op |
| | | DeleteOperation deleteOp = |
| | | new DeleteOperationBasis(connection, 1, 1,null, DN.decode(rawDN)); |
| | | new DeleteOperationBasis(connection, 1, 1,null, DN.valueOf(rawDN)); |
| | | LocalBackendDeleteOperation op = |
| | | new LocalBackendDeleteOperation(deleteOp); |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | private DomainFakeCfg newFakeCfg(int serverId, int rsPort, int groupId) throws Exception |
| | | { |
| | | DomainFakeCfg fakeCfg = new DomainFakeCfg( |
| | | DN.decode(TEST_ROOT_DN_STRING), serverId, newSortedSet("localhost:" + rsPort), groupId); |
| | | DN.valueOf(TEST_ROOT_DN_STRING), serverId, newSortedSet("localhost:" + rsPort), groupId); |
| | | fakeCfg.setHeartbeatInterval(1000); |
| | | fakeCfg.setChangetimeHeartbeatInterval(500); |
| | | return fakeCfg; |
| | |
| | | |
| | | FakeReplicationServer fakeReplicationServer = new FakeReplicationServer( |
| | | rsPort, serverId, assured, assuredMode, (byte)safeDataLevel, (byte)groupId, |
| | | DN.decode(TEST_ROOT_DN_STRING), generationId); |
| | | DN.valueOf(TEST_ROOT_DN_STRING), generationId); |
| | | |
| | | // Connect fake RS to the real RS |
| | | fakeReplicationServer.connect(serverState); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | public void setUp() throws Exception |
| | | { |
| | | super.setUp(); |
| | | TEST_ROOT_DN = DN.decode(TEST_ROOT_DN_STRING); |
| | | TEST_ROOT_DN2 = DN.decode(TEST_ROOT_DN_STRING2); |
| | | TEST_ROOT_DN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | TEST_ROOT_DN2 = DN.valueOf(TEST_ROOT_DN_STRING2); |
| | | |
| | | // This test suite depends on having the schema available. |
| | | configure(); |
| | |
| | | try |
| | | { |
| | | // Create 3 ECL broker |
| | | final DN changelogDN = DN.decode("cn=changelog"); |
| | | final DN changelogDN = DN.valueOf("cn=changelog"); |
| | | brokers[0] = openReplicationSession( |
| | | changelogDN, 1111, 100, replicationServerPort, brokerSessionTimeout); |
| | | assertTrue(brokers[0].isConnected()); |
| | |
| | | |
| | | // open ECL broker |
| | | serverECL = openReplicationSession( |
| | | DN.decode("cn=changelog"), 10, 100, replicationServerPort, brokerSessionTimeout); |
| | | DN.valueOf("cn=changelog"), 10, 100, replicationServerPort, brokerSessionTimeout); |
| | | assertTrue(serverECL.isConnected()); |
| | | |
| | | // receive change 1 from suffix 1 |
| | |
| | | |
| | | // Use different values than other tests to avoid test interactions in concurrent test runs |
| | | final String backendId2 = tn + 2; |
| | | final DN baseDN2 = DN.decode("o=" + backendId2); |
| | | final DN baseDN2 = DN.valueOf("o=" + backendId2); |
| | | try |
| | | { |
| | | server01 = openReplicationSession(TEST_ROOT_DN, SERVER_ID_1, |
| | |
| | | |
| | | private DeleteMsg newDeleteMsg(String dn, CSN csn, String entryUUID) throws DirectoryException |
| | | { |
| | | return new DeleteMsg(DN.decode(dn), csn, entryUUID); |
| | | return new DeleteMsg(DN.valueOf(dn), csn, entryUUID); |
| | | } |
| | | |
| | | private InternalSearchOperation searchOnCookieChangelog(String filterString, |
| | |
| | | Entry entry = TestCaseUtils.entryFromLdifString(lentry); |
| | | AddMsg addMsg = new AddMsg( |
| | | csns[csnCounter], |
| | | DN.decode("uid="+tn+"2," + TEST_ROOT_DN_STRING), |
| | | DN.valueOf("uid="+tn+"2," + TEST_ROOT_DN_STRING), |
| | | user1entryUUID, |
| | | baseUUID, |
| | | entry.getObjectClassAttribute(), |
| | |
| | | |
| | | // Publish MOD |
| | | csnCounter++; |
| | | DN baseDN = DN.decode("uid=" + tn + "3," + TEST_ROOT_DN_STRING); |
| | | DN baseDN = DN.valueOf("uid=" + tn + "3," + TEST_ROOT_DN_STRING); |
| | | List<Modification> mods = createMods("description", "new value"); |
| | | ModifyMsg modMsg = new ModifyMsg(csns[csnCounter], baseDN, mods, tn + "uuid3"); |
| | | server01.publish(modMsg); |
| | |
| | | csnCounter++; |
| | | final DN newSuperior = TEST_ROOT_DN2; |
| | | ModifyDNOperation op = new ModifyDNOperationBasis(connection, 1, 1, null, |
| | | DN.decode("uid="+tn+"4," + TEST_ROOT_DN_STRING), // entryDN |
| | | DN.valueOf("uid="+tn+"4," + TEST_ROOT_DN_STRING), // entryDN |
| | | RDN.decode("uid="+tn+"new4"), // new rdn |
| | | true, // deleteoldrdn |
| | | newSuperior); |
| | |
| | | private static Backend initializeTestBackend(boolean createBaseEntry, |
| | | String backendId) throws Exception |
| | | { |
| | | DN baseDN = DN.decode("o=" + backendId); |
| | | DN baseDN = DN.valueOf("o=" + backendId); |
| | | |
| | | // Retrieve backend. Warning: it is important to perform this each time, |
| | | // because a test may have disabled then enabled the backend (i.e a test |
| | |
| | | debugInfo(tn, " publishes " + addMsg.getCSN()); |
| | | |
| | | // Publish MOD |
| | | DN baseDN = DN.decode("uid="+tn+"3," + TEST_ROOT_DN_STRING); |
| | | DN baseDN = DN.valueOf("uid="+tn+"3," + TEST_ROOT_DN_STRING); |
| | | List<Modification> mods = createMods("description", "new value"); |
| | | ModifyMsg modMsg = new ModifyMsg(csns[2], baseDN, mods, user1entryUUID); |
| | | server01.publish(modMsg); |
| | |
| | | |
| | | // Publish modDN |
| | | ModifyDNOperation op = new ModifyDNOperationBasis(connection, 1, 1, null, |
| | | DN.decode("uid="+tn+"4," + TEST_ROOT_DN_STRING), // entryDN |
| | | DN.valueOf("uid="+tn+"4," + TEST_ROOT_DN_STRING), // entryDN |
| | | RDN.decode("uid="+tn+"new4"), // new rdn |
| | | true, // deleteoldrdn |
| | | TEST_ROOT_DN2); // new superior |
| | |
| | | debugInfo(tn, "Starting test\n\n"); |
| | | |
| | | { |
| | | DN baseDN = DN.decode("cn=changelog"); |
| | | DN baseDN = DN.valueOf("cn=changelog"); |
| | | |
| | | evaluateSearchParameters(baseDN, -1, -1, "(objectclass=*)"); |
| | | evaluateSearchParameters(baseDN, 2, -1, "(changenumber>=2)"); |
| | |
| | | assertEquals(startCLmsg.getCSN(), csn); |
| | | |
| | | // Use change number as base object. |
| | | baseDN = DN.decode("changeNumber=8,cn=changelog"); |
| | | baseDN = DN.valueOf("changeNumber=8,cn=changelog"); |
| | | |
| | | // |
| | | evaluateSearchParameters(baseDN, 8, 8, "(objectclass=*)"); |
| | |
| | | debugInfo(tn, "Starting test\n\n"); |
| | | |
| | | final String backendId3 = "test3"; |
| | | final DN baseDN3 = DN.decode("o=" + backendId3); |
| | | final DN baseDN3 = DN.valueOf("o=" + backendId3); |
| | | Backend backend2 = null; |
| | | Backend backend3 = null; |
| | | LDAPReplicationDomain domain2 = null; |
| | |
| | | |
| | | // moddn robert (o=test3) to robert2 (o=test3) |
| | | ModifyDNOperation modDNOp = connection.processModifyDN( |
| | | DN.decode("cn=Robert Hue," + baseDN3), |
| | | DN.valueOf("cn=Robert Hue," + baseDN3), |
| | | RDN.decode("cn=Robert Hue2"), true, |
| | | baseDN3); |
| | | waitOpResult(modDNOp, ResultCode.SUCCESS); |
| | | |
| | | // del robert (o=test3) |
| | | final DeleteOperation delOp = connection.processDelete(DN.decode("cn=Robert Hue2," + baseDN3)); |
| | | final DeleteOperation delOp = connection.processDelete(DN.valueOf("cn=Robert Hue2," + baseDN3)); |
| | | waitOpResult(delOp, ResultCode.SUCCESS); |
| | | |
| | | // Search on ECL from start on all suffixes |
| | |
| | | } |
| | | finally |
| | | { |
| | | final DN fionaDN = DN.decode("cn=Fiona Jensen," + TEST_ROOT_DN_STRING2); |
| | | final DN fionaDN = DN.valueOf("cn=Fiona Jensen," + TEST_ROOT_DN_STRING2); |
| | | waitOpResult(connection.processDelete(fionaDN), ResultCode.SUCCESS); |
| | | waitOpResult(connection.processDelete(TEST_ROOT_DN2), ResultCode.SUCCESS); |
| | | waitOpResult(connection.processDelete(baseDN3), ResultCode.SUCCESS); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | { |
| | | super.setUp(); |
| | | |
| | | baseDN = DN.decode(baseDnStr); |
| | | baseDN = DN.valueOf(baseDnStr); |
| | | } |
| | | |
| | | /** |
| | |
| | | SYNCHRO_PLUGIN_DN; |
| | | // Must have called connectServer1ToChangelog previously |
| | | assertTrue(synchroServerEntry != null); |
| | | DN synchroServerDN = DN.decode(synchroServerStringDN); |
| | | DN synchroServerDN = DN.valueOf(synchroServerStringDN); |
| | | deleteEntry(synchroServerDN); |
| | | synchroServerEntry = null; |
| | | configEntriesToCleanup.remove(synchroServerDN); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | replicationServer.applyConfigurationChange(newconf); |
| | | |
| | | ReplicationBroker broker = openReplicationSession( |
| | | DN.decode(TEST_ROOT_DN_STRING), 1, 10, ports[1], 1000); |
| | | DN.valueOf(TEST_ROOT_DN_STRING), 1, 10, ports[1], 1000); |
| | | |
| | | // check that the sendWindow is not null to make sure that the |
| | | // broker did connect successfully. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | public void setUp() throws Exception |
| | | { |
| | | super.setUp(); |
| | | TEST_ROOT_DN = DN.decode(TEST_ROOT_DN_STRING); |
| | | EXAMPLE_DN = DN.decode("ou=example," + TEST_ROOT_DN_STRING); |
| | | TEST_ROOT_DN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | EXAMPLE_DN = DN.valueOf("ou=example," + TEST_ROOT_DN_STRING); |
| | | |
| | | // This test suite depends on having the schema available. |
| | | configure(); |
| | |
| | | |
| | | // - Delete |
| | | CSNGenerator csnGen = new CSNGenerator(brokerIds[0], TimeThread.getTime()); |
| | | DN dn = DN.decode("o=example" + 0 + "," + TEST_ROOT_DN_STRING); |
| | | DN dn = DN.valueOf("o=example" + 0 + "," + TEST_ROOT_DN_STRING); |
| | | DeleteMsg delMsg = new DeleteMsg(dn, csnGen.newCSN(), "uid"); |
| | | broker1.publish(delMsg); |
| | | |
| | |
| | | // - Delete |
| | | CSNGenerator csnGen = new CSNGenerator(brokerIds[0], TimeThread.getTime()); |
| | | |
| | | DN dn = DN.decode("o=example" + 1 + "," + TEST_ROOT_DN_STRING); |
| | | DN dn = DN.valueOf("o=example" + 1 + "," + TEST_ROOT_DN_STRING); |
| | | DeleteMsg delMsg = new DeleteMsg(dn, csnGen.newCSN(), "uid"); |
| | | broker1.publish(delMsg); |
| | | |
| | |
| | | |
| | | try |
| | | { |
| | | final DN baseDN2 = DN.decode("dc=domain2,dc=com"); |
| | | final DN baseDN2 = DN.valueOf("dc=domain2,dc=com"); |
| | | server1 = openReplicationSession(TEST_ROOT_DN, 1, 100, replicationServerPort, 1000); |
| | | server2 = openReplicationSession(baseDN2, 2, 100, replicationServerPort, 1000); |
| | | |
| | |
| | | + "objectClass: domain\n" |
| | | + "entryUUID: 11111111-1111-1111-1111-111111111111\n"); |
| | | CSNGenerator csnGen = new CSNGenerator(serverId, TimeThread.getTime()); |
| | | DN exampleSuffixDN = DN.decode("o=example," + suffix); |
| | | DN exampleSuffixDN = DN.valueOf("o=example," + suffix); |
| | | AddMsg addMsg = new AddMsg(csnGen.newCSN(), exampleSuffixDN, |
| | | user1entryUUID, baseUUID, entry.getObjectClassAttribute(), |
| | | entry.getAttributes(), new ArrayList<Attribute>()); |
| | |
| | | + "telephonenumber: +1 408 555 1212\n" |
| | | + "entryUUID: " + user1entryUUID +"\n" |
| | | + "userpassword: fjen$$en" + "\n"); |
| | | DN newPersonDN = DN.decode("uid=new person,ou=People,"+suffix); |
| | | DN newPersonDN = DN.valueOf("uid=new person,ou=People,"+suffix); |
| | | AddMsg addMsg2 = new AddMsg( |
| | | csnGen.newCSN(), |
| | | newPersonDN, |
| | |
| | | (ReplicationBackend)DirectoryServer.getBackend("replicationChanges"); |
| | | b.setServer(replicationServer); |
| | | assertEquals(b.getEntryCount(), msgs.size()); |
| | | assertTrue(b.entryExists(DN.decode("dc=replicationChanges"))); |
| | | assertTrue(b.entryExists(DN.valueOf("dc=replicationChanges"))); |
| | | SearchFilter filter=SearchFilter.createFilterFromString("(objectclass=*)"); |
| | | assertTrue(b.isIndexed(filter)); |
| | | |
| | | List<Control> requestControls = new LinkedList<Control>(); |
| | | requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false)); |
| | | DN baseDN=DN.decode("dc=replicationChanges"); |
| | | DN baseDN=DN.valueOf("dc=replicationChanges"); |
| | | //Test the group membership control causes search to be skipped. |
| | | InternalSearchOperation internalSearch = |
| | | connection.processSearch(baseDN, WHOLE_SUBTREE, |
| | |
| | | * |
| | | * |
| | | * Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server.changelog.je; |
| | | |
| | |
| | | public static void classSetup() throws Exception |
| | | { |
| | | TestCaseUtils.startFakeServer(); |
| | | BASE_DN = DN.decode("dc=example,dc=com"); |
| | | ADMIN_DATA_DN = DN.decode("cn=admin data"); |
| | | BASE_DN = DN.valueOf("dc=example,dc=com"); |
| | | ADMIN_DATA_DN = DN.valueOf("cn=admin data"); |
| | | } |
| | | |
| | | @AfterClass |
| | |
| | | cnIndexDB.setPurgeDelay(0); |
| | | |
| | | // Prepare data to be stored in the db |
| | | DN baseDN1 = DN.decode("o=baseDN1"); |
| | | DN baseDN2 = DN.decode("o=baseDN2"); |
| | | DN baseDN3 = DN.decode("o=baseDN3"); |
| | | DN baseDN1 = DN.valueOf("o=baseDN1"); |
| | | DN baseDN2 = DN.valueOf("o=baseDN2"); |
| | | DN baseDN3 = DN.valueOf("o=baseDN3"); |
| | | |
| | | CSN[] csns = newCSNs(1, 0, 3); |
| | | |
| | |
| | | |
| | | // Prepare data to be stored in the db |
| | | |
| | | DN baseDN1 = DN.decode("o=baseDN1"); |
| | | DN baseDN2 = DN.decode("o=baseDN2"); |
| | | DN baseDN3 = DN.decode("o=baseDN3"); |
| | | DN baseDN1 = DN.valueOf("o=baseDN1"); |
| | | DN baseDN2 = DN.valueOf("o=baseDN2"); |
| | | DN baseDN3 = DN.valueOf("o=baseDN3"); |
| | | |
| | | CSN[] csns = newCSNs(1, 0, 3); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server.changelog.je; |
| | | |
| | |
| | | @BeforeClass |
| | | public void setup() throws Exception |
| | | { |
| | | TEST_ROOT_DN = DN.decode(TEST_ROOT_DN_STRING); |
| | | TEST_ROOT_DN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | } |
| | | |
| | | @Test(enabled=true) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.service; |
| | | |
| | |
| | | int domain1ServerId, int domain2ServerId) |
| | | throws Exception |
| | | { |
| | | DN testService = DN.decode("o=test"); |
| | | DN testService = DN.valueOf("o=test"); |
| | | ReplicationServer replServer1 = null; |
| | | ReplicationServer replServer2 = null; |
| | | FakeReplicationDomain domain1 = null; |
| | |
| | | @Test(enabled=false) |
| | | public void publishPerf() throws Exception |
| | | { |
| | | DN testService = DN.decode("o=test"); |
| | | DN testService = DN.valueOf("o=test"); |
| | | ReplicationServer replServer1 = null; |
| | | int replServerID1 = 10; |
| | | FakeReplicationDomain domain1 = null; |
| | |
| | | public void exportAndImport(int serverId1, int serverId2) throws Exception |
| | | { |
| | | final int ENTRYCOUNT=5000; |
| | | DN testService = DN.decode("o=test"); |
| | | DN testService = DN.valueOf("o=test"); |
| | | ReplicationServer replServer = null; |
| | | int replServerID = 11; |
| | | FakeReplicationDomain domain1 = null; |
| | |
| | | public void exportAndImportAcross2ReplServers() throws Exception |
| | | { |
| | | final int ENTRYCOUNT=5000; |
| | | DN testService = DN.decode("o=test"); |
| | | DN testService = DN.valueOf("o=test"); |
| | | ReplicationServer replServer2 = null; |
| | | ReplicationServer replServer1 = null; |
| | | int replServerID = 11; |
| | |
| | | @Test(enabled=false) |
| | | public void senderInitialize() throws Exception |
| | | { |
| | | DN testService = DN.decode("o=test"); |
| | | DN testService = DN.valueOf("o=test"); |
| | | ReplicationServer replServer = null; |
| | | int replServerID = 12; |
| | | FakeStressReplicationDomain domain1 = null; |
| | |
| | | @Test(enabled=false) |
| | | public void receiverInitialize() throws Exception |
| | | { |
| | | DN testService = DN.decode("o=test"); |
| | | DN testService = DN.valueOf("o=test"); |
| | | ReplicationServer replServer = null; |
| | | int replServerID = 11; |
| | | FakeStressReplicationDomain domain1 = null; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | |
| | | ConfigEntry configEntry = |
| | | DirectoryServer.getConfigEntry( |
| | | DN.decode("cn=Salted MD5,cn=Password Storage Schemes,cn=config")); |
| | | DN.valueOf("cn=Salted MD5,cn=Password Storage Schemes,cn=config")); |
| | | |
| | | SaltedMD5PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | user1 = DN.decode("cn=user1,dc=example,dc=com"); |
| | | user2 = DN.decode("cn=user2,dc=example,dc=com"); |
| | | user3 = DN.decode("cn=user3,dc=example,dc=com"); |
| | | user4 = DN.decode("cn=user4,dc=example,dc=com"); |
| | | user1 = DN.valueOf("cn=user1,dc=example,dc=com"); |
| | | user2 = DN.valueOf("cn=user2,dc=example,dc=com"); |
| | | user3 = DN.valueOf("cn=user3,dc=example,dc=com"); |
| | | user4 = DN.valueOf("cn=user4,dc=example,dc=com"); |
| | | } |
| | | |
| | | |
| | |
| | | InternalSearchOperation internalSearch = |
| | | new InternalSearchOperation(conn, InternalClientConnection.nextOperationID(), |
| | | InternalClientConnection.nextMessageID(), requestControls, |
| | | DN.decode("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DN.valueOf("dc=example,dc=com"), SearchScope.WHOLE_SUBTREE, |
| | | DereferencePolicy.NEVER_DEREF_ALIASES, 0, 0, false, |
| | | SearchFilter.createFilterFromString(searchFilter), |
| | | null, null); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | SearchResultEntry e = entries.get(0); |
| | | //An entry must be returned. |
| | | assertNotNull(e); |
| | | assertTrue(e.getDN().equals(DN.decode("cn=test1,o=test"))); |
| | | assertTrue(e.getDN().equals(DN.valueOf("cn=test1,o=test"))); |
| | | } |
| | | finally |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010 ForgeRock AS. |
| | | * Portions Copyright 2010-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | |
| | |
| | | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | user1 = DN.decode("cn=user1,dc=example,dc=com"); |
| | | user2 = DN.decode("cn=user2,dc=example,dc=com"); |
| | | user3 = DN.decode("cn=user3,dc=example,dc=com"); |
| | | user4 = DN.decode("cn=user4,dc=example,dc=com"); |
| | | user5 = DN.decode("cn=user5,dc=example,dc=com"); |
| | | user6 = DN.decode("cn=user6,dc=example,dc=com"); |
| | | user7 = DN.decode("cn=user7,dc=example,dc=com"); |
| | | user8 = DN.decode("cn=user!,dc=example,dc=com"); |
| | | user1 = DN.valueOf("cn=user1,dc=example,dc=com"); |
| | | user2 = DN.valueOf("cn=user2,dc=example,dc=com"); |
| | | user3 = DN.valueOf("cn=user3,dc=example,dc=com"); |
| | | user4 = DN.valueOf("cn=user4,dc=example,dc=com"); |
| | | user5 = DN.valueOf("cn=user5,dc=example,dc=com"); |
| | | user6 = DN.valueOf("cn=user6,dc=example,dc=com"); |
| | | user7 = DN.valueOf("cn=user7,dc=example,dc=com"); |
| | | user8 = DN.valueOf("cn=user!,dc=example,dc=com"); |
| | | |
| | | /** |
| | | Extend the schema and add an attribute which is baseed on |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | |
| | | ConfigEntry configEntry = |
| | | DirectoryServer.getConfigEntry( |
| | | DN.decode("cn=Salted MD5,cn=Password Storage Schemes,cn=config")); |
| | | DN.valueOf("cn=Salted MD5,cn=Password Storage Schemes,cn=config")); |
| | | |
| | | SaltedMD5PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | "ds-task-schema-file-name: 05-single-valid.ldif"); |
| | | assertEquals(resultCode, 0); |
| | | |
| | | Task task = getCompletedTask(DN.decode(taskDNStr)); |
| | | Task task = getCompletedTask(DN.valueOf(taskDNStr)); |
| | | assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY); |
| | | assertFalse(DirectoryServer.getSchema().getYoungestModificationTime() == |
| | | beforeModifyTimestamp); |
| | |
| | | "ds-task-schema-file-name: 05-multiple-valid-2.ldif"); |
| | | assertEquals(resultCode, 0); |
| | | |
| | | Task task = getCompletedTask(DN.decode(taskDNStr)); |
| | | Task task = getCompletedTask(DN.valueOf(taskDNStr)); |
| | | assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY); |
| | | assertFalse(DirectoryServer.getSchema().getYoungestModificationTime() == |
| | | beforeModifyTimestamp); |
| | |
| | | "ds-task-schema-file-name: 05-empty.ldif"); |
| | | assertEquals(resultCode, 0); |
| | | |
| | | Task task = getCompletedTask(DN.decode(taskDNStr)); |
| | | Task task = getCompletedTask(DN.valueOf(taskDNStr)); |
| | | assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY); |
| | | assertFalse(DirectoryServer.getSchema().getYoungestModificationTime() == |
| | | beforeModifyTimestamp); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | assertEquals(LDAPModify.mainModify(args, false, System.out, System.err), |
| | | LDAPResultCode.SUCCESS); |
| | | |
| | | Task task = getCompletedTask(DN.decode( |
| | | Task task = getCompletedTask(DN.valueOf( |
| | | "ds-task-id=testAllowedTask 2,cn=Scheduled Tasks,cn=Tasks")); |
| | | assertNotNull(task); |
| | | assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | // Invoke the disconnect client task. |
| | | String taskID = "Disconnect Client " + connectionID; |
| | | Message disconnectMessage = Message.raw("testDisconnectWithNotification"); |
| | | DN taskDN = DN.decode("ds-task-id=" + taskID + |
| | | DN taskDN = DN.valueOf("ds-task-id=" + taskID + |
| | | ",cn=Scheduled Tasks,cn=Tasks"); |
| | | TestCaseUtils.addEntry( |
| | | "dn: " + taskDN.toString(), |
| | |
| | | |
| | | // Invoke the disconnect client task. |
| | | String taskID = "Disconnect Client " + connectionID; |
| | | DN taskDN = DN.decode("ds-task-id=" + taskID + |
| | | DN taskDN = DN.valueOf("ds-task-id=" + taskID + |
| | | ",cn=Scheduled Tasks,cn=Tasks"); |
| | | TestCaseUtils.addEntry( |
| | | "dn: " + taskDN.toString(), |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | "ds-task-id: Enter Lockdown Mode", |
| | | "ds-task-class-name: org.opends.server.tasks.EnterLockdownModeTask"); |
| | | |
| | | DN taskDN = DN.decode( |
| | | DN taskDN = DN.valueOf( |
| | | "ds-task-id=Enter Lockdown Mode,cn=Scheduled Tasks,cn=tasks"); |
| | | |
| | | |
| | |
| | | "ds-task-id: Leave Lockdown Mode", |
| | | "ds-task-class-name: org.opends.server.tasks.LeaveLockdownModeTask"); |
| | | |
| | | taskDN = DN.decode( |
| | | taskDN = DN.valueOf( |
| | | "ds-task-id=Leave Lockdown Mode,cn=Scheduled Tasks,cn=tasks"); |
| | | |
| | | args = new String[] |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | TaskBackend taskBackend = |
| | | (TaskBackend) DirectoryServer.getBackend(DN.decode("cn=tasks")); |
| | | (TaskBackend) DirectoryServer.getBackend(DN.valueOf("cn=tasks")); |
| | | Task task = taskBackend.getScheduledTask(taskEntryDN); |
| | | if (task == null) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | { |
| | | TaskUtils.enableBackend(beID); |
| | | Entry entry = DirectoryServer.getEntry( |
| | | DN.decode(" uid=user.0,dc=example,dc=com")); |
| | | DN.valueOf(" uid=user.0,dc=example,dc=com")); |
| | | TaskUtils.disableBackend(beID); |
| | | assertNotNull(entry); |
| | | for (Attribute a : attrs) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock, AS. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | DirectoryServer.getBackend(TestCaseUtils.TEST_BACKEND_ID); |
| | | String dn1 = "arg=success,o=test1,o=test"; |
| | | String dn2 = "arg=success,o=test2,o=test"; |
| | | addEntriesUpToParentDN(memoryBackend, DN.decode(dn1)); |
| | | addEntriesUpToParentDN(memoryBackend, DN.decode(dn2)); |
| | | addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn1)); |
| | | addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn2)); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | DirectoryServer.getBackend(TestCaseUtils.TEST_BACKEND_ID); |
| | | String dn1 = "arg=success,o=test1,o=test"; |
| | | String dn2 = "arg=fail,o=test2,o=test"; |
| | | addEntriesUpToParentDN(memoryBackend, DN.decode(dn1)); |
| | | addEntriesUpToParentDN(memoryBackend, DN.decode(dn2)); |
| | | addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn1)); |
| | | addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn2)); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | Backend memoryBackend = |
| | | DirectoryServer.getBackend(TestCaseUtils.TEST_BACKEND_ID); |
| | | String dn1 = "arg=success,o=test1,o=test"; |
| | | addEntriesUpToParentDN(memoryBackend, DN.decode(dn1)); |
| | | addEntriesUpToParentDN(memoryBackend, DN.valueOf(dn1)); |
| | | |
| | | String[] args = |
| | | { |
| | |
| | | private void addEntriesUpToParentDN(Backend backend, DN entryDN) |
| | | throws Exception |
| | | { |
| | | if (!backend.entryExists(entryDN.getParent())) |
| | | if (!backend.entryExists(entryDN.parent())) |
| | | { |
| | | addEntriesUpToParentDN(backend, entryDN.getParent()); |
| | | addEntriesUpToParentDN(backend, entryDN.parent()); |
| | | } |
| | | backend.addEntry(StaticUtils.createEntry(entryDN), null); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-enabled", "false"))); |
| | | final ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode(userRootDN), mods); |
| | | rootConnection.processModify(DN.valueOf(userRootDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-enabled", "true"))); |
| | | final ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode(userRootDN), mods); |
| | | rootConnection.processModify(DN.valueOf(userRootDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | Attributes.create("ds-cfg-base-dn", "o=airius.com"))); |
| | | String userRootDN = "ds-cfg-backend-id=userRoot,cn=Backends,cn=config"; |
| | | ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode(userRootDN), mods); |
| | | rootConnection.processModify(DN.valueOf(userRootDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | Attributes.create("ds-cfg-base-dn", "o=airius.com"))); |
| | | String userRootDN = "ds-cfg-backend-id=userRoot,cn=Backends,cn=config"; |
| | | ModifyOperation modifyOperation = |
| | | rootConnection.processModify(DN.decode(userRootDN), mods); |
| | | rootConnection.processModify(DN.valueOf(userRootDN), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | Message msg = Message.raw("Test Constructor 3"); |
| | | DN dn = DN.decode("cn=Test Constructor 3,dc=example,dc=com"); |
| | | DN dn = DN.valueOf("cn=Test Constructor 3,dc=example,dc=com"); |
| | | Exception e = new Exception("Test Constructor 3 Exception"); |
| | | |
| | | validateException(new DirectoryException(resultCode, msg, dn, e)); |
| | |
| | | throws Exception |
| | | { |
| | | Message msg = Message.raw("Test Constructor 4"); |
| | | DN dn = DN.decode("cn=Test Constructor 4,dc=example,dc=com"); |
| | | DN dn = DN.valueOf("cn=Test Constructor 4,dc=example,dc=com"); |
| | | Exception e = new Exception("Test Constructor 4 Exception"); |
| | | List<String> refs = new ArrayList<String>(); |
| | | refs.add("ldap://ldap.example.com/cn=Test Constructor 4,dc=example,dc=com"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | boolean isRoot) |
| | | throws DirectoryException |
| | | { |
| | | Entry userEntry = DirectoryServer.getEntry(DN.decode(userDN)); |
| | | Entry userEntry = DirectoryServer.getEntry(DN.valueOf(userDN)); |
| | | AuthenticationInfo authInfo = new AuthenticationInfo(userEntry, isRoot); |
| | | return new InternalClientConnection(authInfo); |
| | | } |
| | |
| | | |
| | | private void assertDeleteSuccessfully(String dn) throws DirectoryException |
| | | { |
| | | DeleteOperation deleteOperation = getRootConnection().processDelete(DN.decode(dn)); |
| | | DeleteOperation deleteOperation = getRootConnection().processDelete(DN.valueOf(dn)); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | |
| | | assertEquals(conn.hasPrivilege(Privilege.CONFIG_READ, null), hasPrivilege); |
| | | |
| | | CompareOperation compareOperation = |
| | | conn.processCompare(DN.decode("cn=config"), |
| | | conn.processCompare(DN.valueOf("cn=config"), |
| | | DirectoryServer.getAttributeType("cn"), |
| | | ByteString.valueOf("config")); |
| | | if (hasPrivilege) |
| | |
| | | DN dnToRemove = entry.getDN(); |
| | | if (!hasPrivilege) |
| | | { |
| | | dnToRemove = DN.decode("cn=Telex Number,cn=Syntaxes,cn=config"); |
| | | dnToRemove = DN.valueOf("cn=Telex Number,cn=Syntaxes,cn=config"); |
| | | } |
| | | DeleteOperation deleteOperation = conn.processDelete(dnToRemove); |
| | | assertPrivilege(deleteOperation.getResultCode(), hasPrivilege); |
| | |
| | | Attributes.create("ds-cfg-size-limit", "2000"))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=config"), mods); |
| | | conn.processModify(DN.valueOf("cn=config"), mods); |
| | | assertPrivilege(modifyOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-size-limit", "1000"))); |
| | | |
| | | modifyOperation = conn.processModify(DN.decode("cn=config"), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf("cn=config"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | assertEquals(conn.hasPrivilege(Privilege.CONFIG_WRITE, null), hasPrivilege); |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(DN.decode("cn=Work Queue,cn=config"), |
| | | conn.processModifyDN(DN.valueOf("cn=Work Queue,cn=config"), |
| | | RDN.decode("cn=New RDN for Work Queue"), true, |
| | | null); |
| | | if (hasPrivilege) |
| | |
| | | DN dnToRemove = entry.getDN(); |
| | | if (!hasPrivilege) |
| | | { |
| | | dnToRemove = DN.decode("cn=Subentry Target,o=test"); |
| | | dnToRemove = DN.valueOf("cn=Subentry Target,o=test"); |
| | | } |
| | | DeleteOperation deleteOperation = conn.processDelete(dnToRemove); |
| | | assertPrivilege(deleteOperation.getResultCode(), hasPrivilege); |
| | |
| | | "{base \"ou=doesnotexist\"}"))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=Subentry Target,o=test"), mods); |
| | | conn.processModify(DN.valueOf("cn=Subentry Target,o=test"), mods); |
| | | assertPrivilege(modifyOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | |
| | | Attributes.create("subtreeSpecification", "{}"))); |
| | | |
| | | modifyOperation = conn.processModify( |
| | | DN.decode("cn=Subentry Target,o=test"), mods); |
| | | DN.valueOf("cn=Subentry Target,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | hasPrivilege); |
| | | |
| | | ModifyDNOperation modifyDNOperation = |
| | | conn.processModifyDN(DN.decode("cn=Subentry Target,o=test"), |
| | | conn.processModifyDN(DN.valueOf("cn=Subentry Target,o=test"), |
| | | RDN.decode("cn=New Subentry Target"), |
| | | true, null); |
| | | assertPrivilege(modifyDNOperation.getResultCode(), hasPrivilege); |
| | | if (hasPrivilege) |
| | | { |
| | | modifyDNOperation = |
| | | conn.processModifyDN(DN.decode("cn=New Subentry Target,o=test"), |
| | | conn.processModifyDN(DN.valueOf("cn=New Subentry Target,o=test"), |
| | | RDN.decode("cn=Subentry Target"), |
| | | true, null); |
| | | assertEquals(modifyDNOperation.getResultCode(), ResultCode.SUCCESS); |
| | |
| | | Attributes.create("attributetypes", attrDefinition))); |
| | | |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(DN.decode("cn=schema"), mods); |
| | | conn.processModify(DN.valueOf("cn=schema"), mods); |
| | | assertPrivilege(modifyOperation.getResultCode(), hasPrivilege); |
| | | |
| | | if (hasPrivilege) |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("attributetypes", attrDefinition))); |
| | | |
| | | modifyOperation = conn.processModify(DN.decode("cn=schema"), mods); |
| | | modifyOperation = conn.processModify(DN.valueOf("cn=schema"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | } |
| | |
| | | "sn: Test"); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | controls.add(new ProxiedAuthV1Control(DN.decode("cn=PWReset Target,o=test"))); |
| | | controls.add(new ProxiedAuthV1Control(DN.valueOf("cn=PWReset Target,o=test"))); |
| | | |
| | | |
| | | // Try to add the entry. If this fails with the proxy control, then add it |
| | |
| | | // privileges the user actually has. |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.decode("cn=PWReset Target,o=test"); |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | controls.add(new ProxiedAuthV1Control(targetDN)); |
| | | |
| | |
| | | // privileges the user actually has. |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.decode("cn=PWReset Target,o=test"); |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | controls.add(new ProxiedAuthV2Control(ByteString.valueOf("dn:" + targetDN))); |
| | | |
| | |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | CopyOnWriteArraySet<ClientConnection> connections = DirectoryServer |
| | | .getAuthenticatedUsers().get(DN.decode("cn=Test User,o=test")); |
| | | .getAuthenticatedUsers().get(DN.valueOf("cn=Test User,o=test")); |
| | | |
| | | assertNotNull(connections); |
| | | assertEquals(connections.size(), 1); |
| | |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create( |
| | | "ds-privilege-name", "config-read"))); |
| | | ModifyOperation modifyOperation = rootConnection.processModify( |
| | | DN.decode("cn=Test User,o=test"), mods); |
| | | DN.valueOf("cn=Test User,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(testConnection.hasPrivilege(Privilege.CONFIG_READ, null)); |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, Attributes.create( |
| | | "ds-privilege-name", "config-read"))); |
| | | modifyOperation = rootConnection.processModify( |
| | | DN.decode("cn=Test User,o=test"), mods); |
| | | DN.valueOf("cn=Test User,o=test"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertFalse(testConnection.hasPrivilege(Privilege.CONFIG_READ, null)); |
| | | |
| | |
| | | { |
| | | // Make sure that a root connection doesn't have the proxied auth |
| | | // privilege. |
| | | DN unprivRootDN = DN.decode("cn=Unprivileged Root,cn=Root DNs,cn=config"); |
| | | DN unprivRootDN = DN.valueOf("cn=Unprivileged Root,cn=Root DNs,cn=config"); |
| | | Entry unprivRootEntry = DirectoryServer.getEntry(unprivRootDN); |
| | | AuthenticationInfo authInfo = new AuthenticationInfo(unprivRootEntry, true); |
| | | InternalClientConnection unprivRootConn = |
| | |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | | ModifyOperation modifyOperation = internalRootConn.processModify(DN.decode("cn=Root DNs,cn=config"), mods); |
| | | ModifyOperation modifyOperation = internalRootConn.processModify(DN.valueOf("cn=Root DNs,cn=config"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | | modifyOperation = internalRootConn.processModify(DN.decode("cn=Root DNs,cn=config"), mods); |
| | | modifyOperation = internalRootConn.processModify(DN.valueOf("cn=Root DNs,cn=config"), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | |
| | |
| | | private Task getCompletedTask(DN taskEntryDN) throws Exception |
| | | { |
| | | TaskBackend taskBackend = |
| | | (TaskBackend) DirectoryServer.getBackend(DN.decode("cn=tasks")); |
| | | (TaskBackend) DirectoryServer.getBackend(DN.valueOf("cn=tasks")); |
| | | Task task = taskBackend.getScheduledTask(taskEntryDN); |
| | | if (task == null) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | public void testCreateNullDN1() throws Exception { |
| | | DN dn = new DN(new RDN[0]); |
| | | |
| | | assertEquals(dn, DN.nullDN()); |
| | | assertEquals(dn, DN.rootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | public void testCreateNullDN2() throws Exception { |
| | | DN dn = new DN(); |
| | | |
| | | assertEquals(dn, DN.nullDN()); |
| | | assertEquals(dn, DN.rootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | public void testCreateNullDN3() throws Exception { |
| | | DN dn = new DN((RDN[]) null); |
| | | |
| | | assertEquals(dn, DN.nullDN()); |
| | | assertEquals(dn, DN.rootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | public void testCreateNullDN4() throws Exception { |
| | | DN dn = new DN((ArrayList<RDN>) null); |
| | | |
| | | assertEquals(dn, DN.nullDN()); |
| | | assertEquals(dn, DN.rootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | public void testCreateWithSingleRDN1() throws Exception { |
| | | DN dn = new DN(new RDN[] { RDN.decode("dc=com") }); |
| | | |
| | | assertEquals(dn, DN.decode("dc=com")); |
| | | assertEquals(dn, DN.valueOf("dc=com")); |
| | | } |
| | | |
| | | |
| | |
| | | DN dn = new DN(new RDN[] { RDN.decode("dc=foo"), |
| | | RDN.decode("dc=opends"), RDN.decode("dc=org") }); |
| | | |
| | | assertEquals(dn, DN.decode("dc=foo,dc=opends,dc=org")); |
| | | assertEquals(dn, DN.valueOf("dc=foo,dc=opends,dc=org")); |
| | | } |
| | | |
| | | |
| | |
| | | rdnList.add(RDN.decode("dc=org")); |
| | | DN dn = new DN(rdnList); |
| | | |
| | | assertEquals(dn, DN.decode("dc=foo,dc=opends,dc=org")); |
| | | assertEquals(dn, DN.valueOf("dc=foo,dc=opends,dc=org")); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(dataProvider = "testDNs") |
| | | public void testDecodeString(String rawDN, String normDN, |
| | | String stringDN) throws Exception { |
| | | DN dn = DN.decode(rawDN); |
| | | DN dn = DN.valueOf(rawDN); |
| | | StringBuilder buffer = new StringBuilder(); |
| | | buffer.append(normDN); |
| | | Platform.normalize(buffer); |
| | |
| | | */ |
| | | @Test |
| | | public void testToNormalizedString() throws Exception { |
| | | DN dn = DN.decode("dc=example,dc=com"); |
| | | DN dn = DN.valueOf("dc=example,dc=com"); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | dn.toNormalizedString(buffer); |
| | |
| | | */ |
| | | @Test |
| | | public void testDecodeNull() throws Exception { |
| | | assertEquals(DN.decode((ByteString) null), DN.nullDN()); |
| | | assertEquals(DN.decode((String) null), DN.nullDN()); |
| | | assertEquals(DN.decode((ByteString) null), DN.rootDN()); |
| | | assertEquals(DN.valueOf((String) null), DN.rootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(dataProvider = "illegalDNs", expectedExceptions = DirectoryException.class) |
| | | public void testIllegalStringDNs(String dn) throws Exception { |
| | | try { |
| | | DN.decode(dn); |
| | | DN.valueOf(dn); |
| | | } catch (DirectoryException e) { |
| | | throw e; |
| | | } catch (Exception e) { |
| | |
| | | */ |
| | | @Test |
| | | public void testNullDN() throws Exception { |
| | | DN nullDN = DN.nullDN(); |
| | | DN nullDN = DN.rootDN(); |
| | | |
| | | assertTrue(nullDN.getNumComponents() == 0); |
| | | assertTrue(nullDN.size() == 0); |
| | | assertEquals(nullDN.toNormalizedString(), ""); |
| | | } |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testIsNullDNWithNullDN() throws Exception { |
| | | DN nullDN = DN.nullDN(); |
| | | assertTrue(nullDN.isNullDN()); |
| | | DN nullDN = DN.rootDN(); |
| | | assertTrue(nullDN.isRootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testIsNullDNWithNonNullDN() throws Exception { |
| | | DN dn = DN.decode("dc=com"); |
| | | assertFalse(dn.isNullDN()); |
| | | DN dn = DN.valueOf("dc=com"); |
| | | assertFalse(dn.isRootDN()); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Test(dataProvider = "createNumComponentsTestData") |
| | | public void testNumComponents(String s, int sz) throws Exception { |
| | | DN dn = DN.decode(s); |
| | | assertEquals(dn.getNumComponents(), sz); |
| | | DN dn = DN.valueOf(s); |
| | | assertEquals(dn.size(), sz); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(dataProvider = "createParentAndRDNTestData") |
| | | public void testGetParent(String s, String p, String r) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN parent = (p != null ? DN.decode(p) : null); |
| | | DN dn = DN.valueOf(s); |
| | | DN parent = (p != null ? DN.valueOf(p) : null); |
| | | |
| | | assertEquals(dn.getParent(), parent, "For DN " + s); |
| | | assertEquals(dn.parent(), parent, "For DN " + s); |
| | | } |
| | | |
| | | |
| | |
| | | public void testGetParentDNInSuffix(DN namingContext) throws Exception { |
| | | assertNull(namingContext.getParentDNInSuffix()); |
| | | |
| | | DN childDN = namingContext.concat(RDN.decode("ou=People")); |
| | | DN childDN = namingContext.child(RDN.decode("ou=People")); |
| | | assertNotNull(childDN.getParentDNInSuffix()); |
| | | assertEquals(childDN.getParentDNInSuffix(), namingContext); |
| | | } |
| | |
| | | */ |
| | | @Test |
| | | public void testGetParentInteraction() throws Exception { |
| | | DN c = DN.decode("dc=foo,dc=bar,dc=opends,dc=org"); |
| | | DN e = DN.decode("dc=bar,dc=opends,dc=org"); |
| | | DN p = c.getParent(); |
| | | DN c = DN.valueOf("dc=foo,dc=bar,dc=opends,dc=org"); |
| | | DN e = DN.valueOf("dc=bar,dc=opends,dc=org"); |
| | | DN p = c.parent(); |
| | | |
| | | assertFalse(p.isNullDN()); |
| | | assertFalse(p.isRootDN()); |
| | | |
| | | assertEquals(p.getNumComponents(), 3); |
| | | assertEquals(p.size(), 3); |
| | | |
| | | assertEquals(p.compareTo(c), -1); |
| | | assertEquals(c.compareTo(p), 1); |
| | |
| | | assertEquals(p.toNormalizedString(), e.toNormalizedString()); |
| | | assertEquals(p.toString(), e.toString()); |
| | | |
| | | assertEquals(p.getRDN(), RDN.decode("dc=bar")); |
| | | assertEquals(p.rdn(), RDN.decode("dc=bar")); |
| | | |
| | | assertEquals(p.getRDN(0), RDN.decode("dc=bar")); |
| | | assertEquals(p.getRDN(1), RDN.decode("dc=opends")); |
| | | assertEquals(p.getRDN(2), RDN.decode("dc=org")); |
| | | |
| | | assertEquals(p.getParent(), DN.decode("dc=opends,dc=org")); |
| | | assertEquals(p.getParent(), e.getParent()); |
| | | assertEquals(p.parent(), DN.valueOf("dc=opends,dc=org")); |
| | | assertEquals(p.parent(), e.parent()); |
| | | |
| | | assertEquals(p.concat(RDN.decode("dc=foo")), DN |
| | | .decode("dc=foo,dc=bar,dc=opends,dc=org")); |
| | | assertEquals(p.concat(RDN.decode("dc=foo")), c); |
| | | assertEquals(p.concat(DN.decode("dc=xxx,dc=foo")), DN |
| | | .decode("dc=xxx,dc=foo,dc=bar,dc=opends,dc=org")); |
| | | assertEquals(p.child(RDN.decode("dc=foo")), DN |
| | | .valueOf("dc=foo,dc=bar,dc=opends,dc=org")); |
| | | assertEquals(p.child(RDN.decode("dc=foo")), c); |
| | | assertEquals(p.child(DN.valueOf("dc=xxx,dc=foo")), DN |
| | | .valueOf("dc=xxx,dc=foo,dc=bar,dc=opends,dc=org")); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(dataProvider = "createParentAndRDNTestData") |
| | | public void testGetRDN(String s, String p, String r) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN dn = DN.valueOf(s); |
| | | RDN rdn = (r != null ? RDN.decode(r) : null); |
| | | |
| | | assertEquals(dn.getRDN(), rdn, "For DN " + s); |
| | | assertEquals(dn.rdn(), rdn, "For DN " + s); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(dataProvider = "createRDNTestData") |
| | | public void testGetRDNIndexed(String s, int i, String r) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN dn = DN.valueOf(s); |
| | | RDN rdn = RDN.decode(r); |
| | | |
| | | assertEquals(dn.getRDN(i), rdn, "For DN " + s); |
| | |
| | | @Test(dataProvider = "createRDNIllegalTestData", expectedExceptions = IndexOutOfBoundsException.class) |
| | | public void testGetRDNIndexedException(String s, int i) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN dn = DN.valueOf(s); |
| | | |
| | | // Shoudld throw. |
| | | dn.getRDN(i); |
| | |
| | | @Test(dataProvider = "createConcatDNTestData") |
| | | public void testConcatDN(String s, String l, String e) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN localName = DN.decode(l); |
| | | DN expected = DN.decode(e); |
| | | DN dn = DN.valueOf(s); |
| | | DN localName = DN.valueOf(l); |
| | | DN expected = DN.valueOf(e); |
| | | |
| | | assertEquals(dn.concat(localName), expected); |
| | | assertEquals(dn.child(localName), expected); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(expectedExceptions = { NullPointerException.class, |
| | | AssertionError.class }) |
| | | public void testConcatDNException() throws Exception { |
| | | DN dn = DN.decode("dc=org"); |
| | | dn.concat((DN) null); |
| | | DN dn = DN.valueOf("dc=org"); |
| | | dn.child((DN) null); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testConcatDNInteraction() throws Exception { |
| | | DN p = DN.decode("dc=opends,dc=org"); |
| | | DN l = DN.decode("dc=foo,dc=bar"); |
| | | DN e = DN.decode("dc=foo,dc=bar,dc=opends,dc=org"); |
| | | DN c = p.concat(l); |
| | | DN p = DN.valueOf("dc=opends,dc=org"); |
| | | DN l = DN.valueOf("dc=foo,dc=bar"); |
| | | DN e = DN.valueOf("dc=foo,dc=bar,dc=opends,dc=org"); |
| | | DN c = p.child(l); |
| | | |
| | | assertFalse(c.isNullDN()); |
| | | assertFalse(c.isRootDN()); |
| | | |
| | | assertEquals(c.getNumComponents(), 4); |
| | | assertEquals(c.size(), 4); |
| | | |
| | | assertEquals(c.compareTo(p), 1); |
| | | assertEquals(p.compareTo(c), -1); |
| | |
| | | assertEquals(c.toNormalizedString(), e.toNormalizedString()); |
| | | assertEquals(c.toString(), e.toString()); |
| | | |
| | | assertEquals(c.getRDN(), RDN.decode("dc=foo")); |
| | | assertEquals(c.rdn(), RDN.decode("dc=foo")); |
| | | |
| | | assertEquals(c.getRDN(0), RDN.decode("dc=foo")); |
| | | assertEquals(c.getRDN(1), RDN.decode("dc=bar")); |
| | | assertEquals(c.getRDN(2), RDN.decode("dc=opends")); |
| | | assertEquals(c.getRDN(3), RDN.decode("dc=org")); |
| | | |
| | | assertEquals(c.getParent(), DN.decode("dc=bar,dc=opends,dc=org")); |
| | | assertEquals(c.getParent(), e.getParent()); |
| | | assertEquals(c.parent(), DN.valueOf("dc=bar,dc=opends,dc=org")); |
| | | assertEquals(c.parent(), e.parent()); |
| | | |
| | | assertEquals(c.concat(RDN.decode("dc=xxx")), DN |
| | | .decode("dc=xxx,dc=foo,dc=bar,dc=opends,dc=org")); |
| | | assertEquals(c.concat(DN.decode("dc=xxx,dc=yyy")), DN |
| | | .decode("dc=xxx,dc=yyy,dc=foo,dc=bar,dc=opends,dc=org")); |
| | | assertEquals(c.child(RDN.decode("dc=xxx")), DN |
| | | .valueOf("dc=xxx,dc=foo,dc=bar,dc=opends,dc=org")); |
| | | assertEquals(c.child(DN.valueOf("dc=xxx,dc=yyy")), DN |
| | | .valueOf("dc=xxx,dc=yyy,dc=foo,dc=bar,dc=opends,dc=org")); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(dataProvider = "createConcatRDNTestData") |
| | | public void testConcatSingleRDN(String s, String r, String e) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN dn = DN.valueOf(s); |
| | | RDN rdn = RDN.decode(r); |
| | | DN expected = DN.decode(e); |
| | | DN expected = DN.valueOf(e); |
| | | |
| | | assertEquals(dn.concat(rdn), expected); |
| | | assertEquals(dn.child(rdn), expected); |
| | | } |
| | | |
| | | |
| | |
| | | @Test(expectedExceptions = { NullPointerException.class, |
| | | AssertionError.class }) |
| | | public void testConcatRDNException() throws Exception { |
| | | DN dn = DN.decode("dc=org"); |
| | | DN dn = DN.valueOf("dc=org"); |
| | | dn.concat((RDN[]) null); |
| | | } |
| | | |
| | |
| | | @Test(dataProvider = "createConcatDNTestData") |
| | | public void testConcatRDNSequence1(String s, String l, String e) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN localName = DN.decode(l); |
| | | DN expected = DN.decode(e); |
| | | DN dn = DN.valueOf(s); |
| | | DN localName = DN.valueOf(l); |
| | | DN expected = DN.valueOf(e); |
| | | |
| | | // Construct sequence. |
| | | RDN[] rdns = new RDN[localName.getNumComponents()]; |
| | | for (int i = 0; i < localName.getNumComponents(); i++) { |
| | | RDN[] rdns = new RDN[localName.size()]; |
| | | for (int i = 0; i < localName.size(); i++) { |
| | | rdns[i] = localName.getRDN(i); |
| | | } |
| | | |
| | |
| | | @Test(dataProvider = "createIsAncestorOfTestData") |
| | | public void testIsAncestorOf(String s, String d, boolean e) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN other = DN.decode(d); |
| | | DN dn = DN.valueOf(s); |
| | | DN other = DN.valueOf(d); |
| | | |
| | | assertEquals(dn.isAncestorOf(other), e, s + " isAncestoryOf " + d); |
| | | } |
| | |
| | | @Test(expectedExceptions = { NullPointerException.class, |
| | | AssertionError.class }) |
| | | public void testIsAncestorOfException() throws Exception { |
| | | DN dn = DN.decode("dc=com"); |
| | | DN dn = DN.valueOf("dc=com"); |
| | | dn.isAncestorOf(null); |
| | | } |
| | | |
| | |
| | | @Test(dataProvider = "createIsDescendantOfTestData") |
| | | public void testIsDescendantOf(String s, String d, boolean e) |
| | | throws Exception { |
| | | DN dn = DN.decode(s); |
| | | DN other = DN.decode(d); |
| | | DN dn = DN.valueOf(s); |
| | | DN other = DN.valueOf(d); |
| | | |
| | | assertEquals(dn.isDescendantOf(other), e, s + " isDescendantOf " |
| | | + d); |
| | |
| | | @Test(expectedExceptions = { NullPointerException.class, |
| | | AssertionError.class }) |
| | | public void testIsDescendantOfException() throws Exception { |
| | | DN dn = DN.decode("dc=com"); |
| | | DN dn = DN.valueOf("dc=com"); |
| | | dn.isDescendantOf(null); |
| | | } |
| | | |
| | |
| | | @Test(dataProvider = "createDNEqualityData") |
| | | public void testEquality(String first, String second, int result) |
| | | throws Exception { |
| | | DN dn1 = DN.decode(first); |
| | | DN dn2 = DN.decode(second); |
| | | DN dn1 = DN.valueOf(first); |
| | | DN dn2 = DN.valueOf(second); |
| | | |
| | | if (result == 0) { |
| | | assertTrue(dn1.equals(dn2), "DN equality for <" + first |
| | |
| | | */ |
| | | @Test |
| | | public void testEqualsNonDN() throws Exception { |
| | | DN dn = DN.decode("dc=example,dc=com"); |
| | | DN dn = DN.valueOf("dc=example,dc=com"); |
| | | |
| | | assertFalse(dn.equals("not a DN")); |
| | | } |
| | |
| | | @Test(dataProvider = "createDNEqualityData") |
| | | public void testHashCode(String first, String second, int result) |
| | | throws Exception { |
| | | DN dn1 = DN.decode(first); |
| | | DN dn2 = DN.decode(second); |
| | | DN dn1 = DN.valueOf(first); |
| | | DN dn2 = DN.valueOf(second); |
| | | |
| | | int h1 = dn1.hashCode(); |
| | | int h2 = dn2.hashCode(); |
| | |
| | | @Test(dataProvider = "createDNEqualityData") |
| | | public void testCompareTo(String first, String second, int result) |
| | | throws Exception { |
| | | DN dn1 = DN.decode(first); |
| | | DN dn2 = DN.decode(second); |
| | | DN dn1 = DN.valueOf(first); |
| | | DN dn2 = DN.valueOf(second); |
| | | |
| | | int rc = dn1.compareTo(dn2); |
| | | |
| | |
| | | @Test(dataProvider = "testDNs") |
| | | public void testToString(String rawDN, String normDN, |
| | | String stringDN) throws Exception { |
| | | DN dn = DN.decode(rawDN); |
| | | DN dn = DN.valueOf(rawDN); |
| | | assertEquals(dn.toString(), stringDN); |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | // Construct entry DN. |
| | | DN entryDN; |
| | | try { |
| | | entryDN = DN.decode("dc=example, dc=com"); |
| | | entryDN = DN.valueOf("dc=example, dc=com"); |
| | | } catch (DirectoryException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | "{ base \"dc=example, dc=com\", maximum 2 }" }; |
| | | |
| | | // Relative to the root DN. |
| | | DN rootDN = DN.nullDN(); |
| | | DN rootDN = DN.rootDN(); |
| | | |
| | | SubtreeSpecificationSet expected = new SubtreeSpecificationSet(); |
| | | for (String value : values) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | SubtreeSpecificationTestCase { |
| | | |
| | | // Cached root DN. |
| | | private DN rootDN = DN.nullDN(); |
| | | private DN rootDN = DN.rootDN(); |
| | | |
| | | /** |
| | | * Tests the {@link SubtreeSpecification#valueOf(DN, String)} |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches1() throws Exception { |
| | | DN dn = DN.decode("dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\" }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches2() throws Exception { |
| | | DN dn = DN.decode("dc=com"); |
| | | DN dn = DN.valueOf("dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\" }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches3() throws Exception { |
| | | DN dn = DN.decode("dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\" }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches4() throws Exception { |
| | | DN dn = DN.decode("dc=foo, dc=bar, dc=com"); |
| | | DN dn = DN.valueOf("dc=foo, dc=bar, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\" }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches5() throws Exception { |
| | | DN dn = DN.decode("dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", minimum 1 }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches6() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", minimum 1 }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches7() throws Exception { |
| | | DN dn = DN.decode("dc=xyz, dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=xyz, dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", minimum 1 }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches8() throws Exception { |
| | | DN dn = DN.decode("dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", maximum 0 }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches9() throws Exception { |
| | | DN dn = DN.decode("dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", maximum 0 }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches10() throws Exception { |
| | | DN dn = DN.decode("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", maximum 1 }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches11() throws Exception { |
| | | DN dn = DN.decode("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", maximum 2 }"; |
| | | SubtreeSpecification ss = SubtreeSpecification.valueOf(rootDN, |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches12() throws Exception { |
| | | DN dn = DN.decode("dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopAfter:\"\" } }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches13() throws Exception { |
| | | DN dn = DN.decode("dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopAfter:\"\" } }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches14() throws Exception { |
| | | DN dn = DN.decode("dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopAfter:\"dc=foo\" } }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches15() throws Exception { |
| | | DN dn = DN.decode("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopAfter:\"dc=foo\" } }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches16() throws Exception { |
| | | DN dn = DN.decode("dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopBefore:\"dc=foo\" } }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches17() throws Exception { |
| | | DN dn = DN.decode("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=bar, dc=foo, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopBefore:\"dc=foo\" } }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches18() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificExclusions { chopBefore:\"dc=foo\" } }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches19() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificationFilter item:person }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches20() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificationFilter item:organization }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches21() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificationFilter not:item:person }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches22() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificationFilter not:item:organization }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches23() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificationFilter \"(objectClass=person)\" }"; |
| | |
| | | */ |
| | | @Test |
| | | public void testMatches24() throws Exception { |
| | | DN dn = DN.decode("dc=abc, dc=sun, dc=com"); |
| | | DN dn = DN.valueOf("dc=abc, dc=sun, dc=com"); |
| | | |
| | | String value = "{ base \"dc=sun, dc=com\", " |
| | | + "specificationFilter \"(objectClass=organization)\" }"; |
| opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/VirtualAttributeRuleTestCase.java
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/TestAddChangeRecordEntry.java
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/TestChangeRecordEntry.java
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/TestDeleteChangeRecordEntry.java
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/TestLDIFReader.java
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/TestLDIFWriter.java
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/TestModifyChangeRecordEntry.java
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/TestModifyDNChangeRecordEntry.java |