AutoRefactor'ed Use Diamond Operator
| | |
| | | private TreeMap<String, Backend<?>> backends; |
| | | |
| | | /** The set of supported controls registered with the Directory Server. */ |
| | | private final TreeSet<String> supportedControls = new TreeSet<String>(Arrays.asList( |
| | | private final TreeSet<String> supportedControls = new TreeSet<>(Arrays.asList( |
| | | OID_LDAP_ASSERTION, |
| | | OID_LDAP_READENTRY_PREREAD, |
| | | OID_LDAP_READENTRY_POSTREAD, |
| | |
| | | OID_NS_PASSWORD_EXPIRING)); |
| | | |
| | | /** The set of supported feature OIDs registered with the Directory Server. */ |
| | | private final TreeSet<String> supportedFeatures = new TreeSet<String>(Arrays.asList( |
| | | private final TreeSet<String> supportedFeatures = new TreeSet<>(Arrays.asList( |
| | | OID_ALL_OPERATIONAL_ATTRS_FEATURE, |
| | | OID_MODIFY_INCREMENT_FEATURE, |
| | | OID_TRUE_FALSE_FILTERS_FEATURE)); |
| | |
| | | |
| | | // Perform any additional initialization that might be necessary before |
| | | // loading the configuration. |
| | | directoryServer.alertHandlers = new CopyOnWriteArrayList<AlertHandler>(); |
| | | directoryServer.passwordStorageSchemes = |
| | | new ConcurrentHashMap<String,PasswordStorageScheme>(); |
| | | directoryServer.passwordStorageSchemesByDN = |
| | | new ConcurrentHashMap<DN,PasswordStorageScheme>(); |
| | | directoryServer.passwordGenerators = |
| | | new ConcurrentHashMap<DN,PasswordGenerator>(); |
| | | directoryServer.authPasswordStorageSchemes = |
| | | new ConcurrentHashMap<String,PasswordStorageScheme>(); |
| | | directoryServer.passwordValidators = |
| | | new ConcurrentHashMap<DN, |
| | | PasswordValidator<? extends PasswordValidatorCfg>>(); |
| | | directoryServer.accountStatusNotificationHandlers = |
| | | new ConcurrentHashMap<DN,AccountStatusNotificationHandler>(); |
| | | directoryServer.rootDNs = new CopyOnWriteArraySet<DN>(); |
| | | directoryServer.alternateRootBindDNs = new ConcurrentHashMap<DN,DN>(); |
| | | directoryServer.keyManagerProviders = |
| | | new ConcurrentHashMap<DN,KeyManagerProvider>(); |
| | | directoryServer.trustManagerProviders = |
| | | new ConcurrentHashMap<DN,TrustManagerProvider>(); |
| | | directoryServer.rotationPolicies = |
| | | new ConcurrentHashMap<DN, RotationPolicy>(); |
| | | directoryServer.retentionPolicies = |
| | | new ConcurrentHashMap<DN, RetentionPolicy>(); |
| | | directoryServer.certificateMappers = |
| | | new ConcurrentHashMap<DN,CertificateMapper>(); |
| | | directoryServer.authenticationPolicies = |
| | | new ConcurrentHashMap<DN,AuthenticationPolicy>(); |
| | | directoryServer.alertHandlers = new CopyOnWriteArrayList<>(); |
| | | directoryServer.passwordStorageSchemes = new ConcurrentHashMap<>(); |
| | | directoryServer.passwordStorageSchemesByDN = new ConcurrentHashMap<>(); |
| | | directoryServer.passwordGenerators = new ConcurrentHashMap<>(); |
| | | directoryServer.authPasswordStorageSchemes = new ConcurrentHashMap<>(); |
| | | directoryServer.passwordValidators = new ConcurrentHashMap<>(); |
| | | directoryServer.accountStatusNotificationHandlers = new ConcurrentHashMap<>(); |
| | | directoryServer.rootDNs = new CopyOnWriteArraySet<>(); |
| | | directoryServer.alternateRootBindDNs = new ConcurrentHashMap<>(); |
| | | directoryServer.keyManagerProviders = new ConcurrentHashMap<>(); |
| | | directoryServer.trustManagerProviders = new ConcurrentHashMap<>(); |
| | | directoryServer.rotationPolicies = new ConcurrentHashMap<>(); |
| | | directoryServer.retentionPolicies = new ConcurrentHashMap<>(); |
| | | directoryServer.certificateMappers = new ConcurrentHashMap<>(); |
| | | directoryServer.authenticationPolicies = new ConcurrentHashMap<>(); |
| | | directoryServer.defaultPasswordPolicyDN = null; |
| | | directoryServer.defaultPasswordPolicy = null; |
| | | directoryServer.monitorProviders = |
| | | new ConcurrentHashMap<String, |
| | | MonitorProvider<? extends MonitorProviderCfg>>(); |
| | | directoryServer.backends = new TreeMap<String, Backend<?>>(); |
| | | directoryServer.backendInitializationListeners = |
| | | new CopyOnWriteArraySet<BackendInitializationListener>(); |
| | | directoryServer.monitorProviders = new ConcurrentHashMap<>(); |
| | | directoryServer.backends = new TreeMap<>(); |
| | | directoryServer.backendInitializationListeners = new CopyOnWriteArraySet<>(); |
| | | directoryServer.baseDnRegistry = new BaseDnRegistry(); |
| | | directoryServer.initializationCompletedListeners = |
| | | new CopyOnWriteArrayList<InitializationCompletedListener>(); |
| | | directoryServer.shutdownListeners = |
| | | new CopyOnWriteArrayList<ServerShutdownListener>(); |
| | | directoryServer.synchronizationProviders = |
| | | new CopyOnWriteArrayList<SynchronizationProvider |
| | | <SynchronizationProviderCfg>>(); |
| | | directoryServer.supportedLDAPVersions = |
| | | new ConcurrentHashMap<Integer,List<ConnectionHandler>>(); |
| | | directoryServer.connectionHandlers = |
| | | new CopyOnWriteArrayList<ConnectionHandler>(); |
| | | directoryServer.identityMappers = |
| | | new ConcurrentHashMap<DN,IdentityMapper>(); |
| | | directoryServer.extendedOperationHandlers = |
| | | new ConcurrentHashMap<String,ExtendedOperationHandler>(); |
| | | directoryServer.saslMechanismHandlers = |
| | | new ConcurrentHashMap<String,SASLMechanismHandler>(); |
| | | directoryServer.offlineSchemaChanges = new LinkedList<Modification>(); |
| | | directoryServer.backupTaskListeners = |
| | | new CopyOnWriteArrayList<BackupTaskListener>(); |
| | | directoryServer.restoreTaskListeners = |
| | | new CopyOnWriteArrayList<RestoreTaskListener>(); |
| | | directoryServer.exportTaskListeners = |
| | | new CopyOnWriteArrayList<ExportTaskListener>(); |
| | | directoryServer.importTaskListeners = |
| | | new CopyOnWriteArrayList<ImportTaskListener>(); |
| | | directoryServer.allowedTasks = new LinkedHashSet<String>(0); |
| | | directoryServer.disabledPrivileges = new LinkedHashSet<Privilege>(0); |
| | | directoryServer.initializationCompletedListeners = new CopyOnWriteArrayList<>(); |
| | | directoryServer.shutdownListeners = new CopyOnWriteArrayList<>(); |
| | | directoryServer.synchronizationProviders = new CopyOnWriteArrayList<>(); |
| | | directoryServer.supportedLDAPVersions = new ConcurrentHashMap<>(); |
| | | directoryServer.connectionHandlers = new CopyOnWriteArrayList<>(); |
| | | directoryServer.identityMappers = new ConcurrentHashMap<>(); |
| | | directoryServer.extendedOperationHandlers = new ConcurrentHashMap<>(); |
| | | directoryServer.saslMechanismHandlers = new ConcurrentHashMap<>(); |
| | | directoryServer.offlineSchemaChanges = new LinkedList<>(); |
| | | directoryServer.backupTaskListeners = new CopyOnWriteArrayList<>(); |
| | | directoryServer.restoreTaskListeners = new CopyOnWriteArrayList<>(); |
| | | directoryServer.exportTaskListeners = new CopyOnWriteArrayList<>(); |
| | | directoryServer.importTaskListeners = new CopyOnWriteArrayList<>(); |
| | | directoryServer.allowedTasks = new LinkedHashSet<>(0); |
| | | directoryServer.disabledPrivileges = new LinkedHashSet<>(0); |
| | | directoryServer.returnBindErrorMessages = false; |
| | | directoryServer.idleTimeLimit = 0L; |
| | | } |
| | |
| | | |
| | | |
| | | // Initialize the variables that will be used for connection tracking. |
| | | establishedConnections = new LinkedHashSet<ClientConnection>(1000); |
| | | establishedConnections = new LinkedHashSet<>(1000); |
| | | currentConnections = 0; |
| | | maxConnections = 0; |
| | | totalConnections = 0; |
| | |
| | | |
| | | directoryServer.mBeanServer = MBeanServerFactory.newMBeanServer(); |
| | | } |
| | | directoryServer.mBeans = new ConcurrentHashMap<DN,JMXMBean>(); |
| | | directoryServer.mBeans = new ConcurrentHashMap<>(); |
| | | registerAlertGenerator(directoryServer); |
| | | } |
| | | catch (Exception e) |
| | |
| | | // preserve any configuration add/delete/change listeners that might have |
| | | // been registered with the old configuration (which will primarily be |
| | | // schema elements) so they can be re-registered with the new configuration. |
| | | Map<String, List<ConfigAddListener>> addListeners = |
| | | new LinkedHashMap<String,List<ConfigAddListener>>(); |
| | | Map<String, List<ConfigDeleteListener>> deleteListeners = |
| | | new LinkedHashMap<String,List<ConfigDeleteListener>>(); |
| | | Map<String, List<ConfigChangeListener>> changeListeners = |
| | | new LinkedHashMap<String,List<ConfigChangeListener>>(); |
| | | Map<String, List<ConfigAddListener>> addListeners = new LinkedHashMap<>(); |
| | | Map<String, List<ConfigDeleteListener>> deleteListeners = new LinkedHashMap<>(); |
| | | Map<String, List<ConfigChangeListener>> changeListeners = new LinkedHashMap<>(); |
| | | getChangeListeners(configHandler.getConfigRootEntry(), addListeners, |
| | | deleteListeners, changeListeners); |
| | | |
| | |
| | | */ |
| | | public static List<VirtualAttributeRule> getVirtualAttributes(Entry entry) |
| | | { |
| | | List<VirtualAttributeRule> ruleList = |
| | | new LinkedList<VirtualAttributeRule>(); |
| | | |
| | | List<VirtualAttributeRule> ruleList = new LinkedList<>(); |
| | | for (VirtualAttributeRule rule : getVirtualAttributes()) |
| | | { |
| | | if (rule.appliesToEntry(entry)) |
| | |
| | | ruleList.add(rule); |
| | | } |
| | | } |
| | | |
| | | return ruleList; |
| | | } |
| | | |
| | |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | | TreeMap<String, Backend<?>> newBackends = |
| | | new TreeMap<String, Backend<?>>(directoryServer.backends); |
| | | TreeMap<String, Backend<?>> newBackends = new TreeMap<>(directoryServer.backends); |
| | | if (newBackends.containsKey(backendID)) |
| | | { |
| | | LocalizableMessage message = ERR_REGISTER_BACKEND_ALREADY_EXISTS.get(backendID); |
| | |
| | | |
| | | synchronized (directoryServer) |
| | | { |
| | | TreeMap<String, Backend<?>> newBackends = |
| | | new TreeMap<String, Backend<?>>(directoryServer.backends); |
| | | TreeMap<String, Backend<?>> newBackends = new TreeMap<>(directoryServer.backends); |
| | | newBackends.remove(backend.getBackendID()); |
| | | |
| | | directoryServer.backends = newBackends; |
| | |
| | | directoryServer.supportedLDAPVersions.get(supportedLDAPVersion); |
| | | if (handlers == null) |
| | | { |
| | | handlers = new LinkedList<ConnectionHandler>(); |
| | | handlers = new LinkedList<>(); |
| | | handlers.add(connectionHandler); |
| | | directoryServer.supportedLDAPVersions.put(supportedLDAPVersion, handlers); |
| | | } |
| | |
| | | */ |
| | | private void startConnectionHandlers() throws ConfigException |
| | | { |
| | | Set<HostPort> usedListeners = new LinkedHashSet<HostPort>(); |
| | | Set<LocalizableMessage> errorMessages = new LinkedHashSet<LocalizableMessage>(); |
| | | Set<HostPort> usedListeners = new LinkedHashSet<>(); |
| | | Set<LocalizableMessage> errorMessages = new LinkedHashSet<>(); |
| | | // Check that the port specified in the connection handlers is available. |
| | | for (ConnectionHandler<?> c : connectionHandlers) |
| | | { |
| | |
| | | @Override |
| | | public Map<String, String> getAlerts() |
| | | { |
| | | Map<String, String> alerts = new LinkedHashMap<String, String>(); |
| | | Map<String, String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(ALERT_TYPE_SERVER_STARTED, ALERT_DESCRIPTION_SERVER_STARTED); |
| | | alerts.put(ALERT_TYPE_SERVER_SHUTDOWN, ALERT_DESCRIPTION_SERVER_SHUTDOWN); |
| | |
| | | // We're not really trying to start, so rebuild the argument list |
| | | // without the "--checkStartability" argument and try again. Exit with |
| | | // whatever that exits with. |
| | | List<String> newArgList = new LinkedList<String>(); |
| | | List<String> newArgList = new LinkedList<>(); |
| | | for (String arg : args) |
| | | { |
| | | if (!"--checkstartability".equalsIgnoreCase(arg)) |
| | |
| | | import org.opends.server.tools.LDAPReader; |
| | | import org.opends.server.tools.LDAPWriter; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.RDN; |
| | | import org.opends.server.util.Base64; |
| | | import org.opends.server.util.SelectableCertificateKeyManager; |
| | | import org.opends.server.util.ServerConstants; |
| | |
| | | * The map from encryption key ID to CipherKeyEntry (cache). The cache is |
| | | * accessed by methods that request, publish, and import keys. |
| | | */ |
| | | private final Map<KeyEntryID, CipherKeyEntry> cipherKeyEntryCache |
| | | = new ConcurrentHashMap<KeyEntryID, CipherKeyEntry>(); |
| | | private final Map<KeyEntryID, CipherKeyEntry> cipherKeyEntryCache = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * The map from encryption key ID to MacKeyEntry (cache). The cache is |
| | | * accessed by methods that request, publish, and import keys. |
| | | */ |
| | | private final Map<KeyEntryID, MacKeyEntry> macKeyEntryCache |
| | | = new ConcurrentHashMap<KeyEntryID, MacKeyEntry>(); |
| | | private final Map<KeyEntryID, MacKeyEntry> macKeyEntryCache = new ConcurrentHashMap<>(); |
| | | |
| | | |
| | | /** The preferred key wrapping transformation. */ |
| | |
| | | } |
| | | |
| | | // CryptoMangager crypto config parameters. |
| | | List<LocalizableMessage> why = new LinkedList<LocalizableMessage>(); |
| | | List<LocalizableMessage> why = new LinkedList<>(); |
| | | if (! isConfigurationChangeAcceptable(config, why)) { |
| | | throw new InitializationException(why.get(0)); |
| | | } |
| | |
| | | @see org.opends.admin.ads.ADSContext#getTrustedCertificates() |
| | | */ |
| | | private Map<String, byte[]> getTrustedCertificates() throws CryptoManagerException { |
| | | final Map<String, byte[]> certificateMap = new HashMap<String, byte[]>(); |
| | | final Map<String, byte[]> certificateMap = new HashMap<>(); |
| | | try { |
| | | // Construct the search filter. |
| | | final String FILTER_OC_INSTANCE_KEY = "(objectclass=" + ocInstanceKey.getNameOrOID() + ")"; |
| | |
| | | OID_GET_SYMMETRIC_KEY_EXTENDED_OP, |
| | | requestValue); |
| | | |
| | | ArrayList<Control> controls = |
| | | new ArrayList<Control>(); |
| | | LDAPMessage requestMessage = |
| | | new LDAPMessage(nextMessageID.getAndIncrement(), |
| | | extendedRequest, controls); |
| | | ArrayList<Control> controls = new ArrayList<>(); |
| | | LDAPMessage requestMessage = new LDAPMessage( |
| | | nextMessageID.getAndIncrement(), extendedRequest, controls); |
| | | writer.writeMessage(requestMessage); |
| | | LDAPMessage responseMessage = reader.readMessage(); |
| | | |
| | |
| | | // Write the value to the entry. |
| | | InternalClientConnection internalConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | List<Modification> modifications = |
| | | new ArrayList<Modification>(1); |
| | | List<Modification> modifications = new ArrayList<>(1); |
| | | Attribute attribute = Attributes.create( |
| | | ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey); |
| | | modifications.add( |
| | |
| | | isCompromised); |
| | | |
| | | // Write the value to the entry. |
| | | InternalClientConnection internalConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | List<Modification> modifications = |
| | | new ArrayList<Modification>(1); |
| | | Attribute attribute = Attributes.create( |
| | | ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey); |
| | | modifications.add( |
| | | new Modification(ModificationType.ADD, attribute, |
| | | false)); |
| | | List<Modification> modifications = new ArrayList<>(1); |
| | | Attribute attribute = Attributes.create(ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey); |
| | | modifications.add(new Modification(ModificationType.ADD, attribute, false)); |
| | | ModifyOperation internalModify = |
| | | internalConnection.processModify(entry.getName(), |
| | | modifications); |
| | | getRootConnection().processModify(entry.getName(), modifications); |
| | | if (internalModify.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | | throw new CryptoManagerException( |
| | |
| | | Map<AttributeType, List<Attribute>> attrs, AttributeType type, |
| | | String value) |
| | | { |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(Attributes.create(type, value)); |
| | | attrs.put(type, attrList); |
| | | attrs.put(type, asList(Attributes.create(type, value))); |
| | | } |
| | | |
| | | private static <T> List<T> asList(T element) |
| | | { |
| | | ArrayList<T> attrList = new ArrayList<>(1); |
| | | attrList.add(element); |
| | | return attrList; |
| | | } |
| | | |
| | | /** |
| | |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | |
| | | // Set the entry object classes. |
| | | LinkedHashMap<ObjectClass,String> ocMap = |
| | | new LinkedHashMap<ObjectClass,String>(2); |
| | | LinkedHashMap<ObjectClass,String> ocMap = new LinkedHashMap<>(2); |
| | | ocMap.put(DirectoryServer.getTopObjectClass(), OC_TOP); |
| | | ocMap.put(ocCipherKey, ConfigConstants.OC_CRYPTO_CIPHER_KEY); |
| | | ocMap.put(ocCipherKey, OC_CRYPTO_CIPHER_KEY); |
| | | |
| | | // Create the operational and user attributes. |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(0); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(); |
| | | |
| | | // Add the key ID attribute. |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(Attributes.create(attrKeyID, distinguishedValue)); |
| | | userAttrs.put(attrKeyID, attrList); |
| | | userAttrs.put(attrKeyID, asList(Attributes.create(attrKeyID, distinguishedValue))); |
| | | |
| | | // Add the transformation name attribute. |
| | | putSingleValueAttribute(userAttrs, attrTransformation, keyEntry.getType()); |
| | |
| | | |
| | | builder.add(symmetricKey); |
| | | } |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(builder.toAttribute()); |
| | | userAttrs.put(attrSymmetricKey, attrList); |
| | | userAttrs.put(attrSymmetricKey, asList(builder.toAttribute())); |
| | | |
| | | // Create the entry. |
| | | Entry entry = new Entry(entryDN, ocMap, userAttrs, opAttrs); |
| | | |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = connection.processAdd(entry); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | if (addOperation.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | | throw new CryptoManagerException( |
| | |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | |
| | | // Set the entry object classes. |
| | | LinkedHashMap<ObjectClass,String> ocMap = |
| | | new LinkedHashMap<ObjectClass,String>(2); |
| | | LinkedHashMap<ObjectClass,String> ocMap = new LinkedHashMap<>(2); |
| | | ocMap.put(DirectoryServer.getTopObjectClass(), OC_TOP); |
| | | ocMap.put(ocMacKey, ConfigConstants.OC_CRYPTO_MAC_KEY); |
| | | ocMap.put(ocMacKey, OC_CRYPTO_MAC_KEY); |
| | | |
| | | // Create the operational and user attributes. |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(0); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(); |
| | | |
| | | // Add the key ID attribute. |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(Attributes.create(attrKeyID, distinguishedValue)); |
| | | userAttrs.put(attrKeyID, attrList); |
| | | userAttrs.put(attrKeyID, asList(Attributes.create(attrKeyID, distinguishedValue))); |
| | | |
| | | // Add the mac algorithm name attribute. |
| | | putSingleValueAttribute(userAttrs, attrMacAlgorithm, keyEntry.getType()); |
| | |
| | | putSingleValueAttribute(userAttrs, attrKeyLength, String.valueOf(keyEntry.getKeyLengthBits())); |
| | | |
| | | // Get the trusted certificates. |
| | | Map<String, byte[]> trustedCerts = |
| | | cryptoManager.getTrustedCertificates(); |
| | | Map<String, byte[]> trustedCerts = cryptoManager.getTrustedCertificates(); |
| | | |
| | | // Need to add our own instance certificate. |
| | | byte[] instanceKeyCertificate = |
| | |
| | | builder.add(symmetricKey); |
| | | } |
| | | |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList.add(builder.toAttribute()); |
| | | userAttrs.put(attrSymmetricKey, attrList); |
| | | userAttrs.put(attrSymmetricKey, asList(builder.toAttribute())); |
| | | |
| | | // Create the entry. |
| | | Entry entry = new Entry(entryDN, ocMap, userAttrs, opAttrs); |
| | |
| | | |
| | | // Process the provided password. |
| | | String password = newPassword.toString(); |
| | | HashMap<String,Integer> setCounts = new HashMap<String,Integer>(); |
| | | HashMap<String,Integer> rangeCounts = new HashMap<String,Integer>(); |
| | | HashMap<String,Integer> setCounts = new HashMap<>(); |
| | | HashMap<String,Integer> rangeCounts = new HashMap<>(); |
| | | for (int i=0; i < password.length(); i++) |
| | | { |
| | | char c = password.charAt(i); |
| | |
| | | boolean apply) |
| | | throws ConfigException |
| | | { |
| | | HashMap<String,Integer> characterSets = new HashMap<String,Integer>(); |
| | | HashMap<String,Integer> characterRanges = new HashMap<String,Integer>(); |
| | | HashSet<Character> usedCharacters = new HashSet<Character>(); |
| | | HashMap<String,Integer> characterSets = new HashMap<>(); |
| | | HashMap<String,Integer> characterRanges = new HashMap<>(); |
| | | HashSet<Character> usedCharacters = new HashSet<>(); |
| | | int mandatoryCharacterSets = 0; |
| | | |
| | | for (String definition : configuration.getCharacterSet()) |
| | |
| | | |
| | | // Convert the entry to a configuration entry and put it in the config |
| | | // hash. |
| | | configEntries = new ConcurrentHashMap<DN,ConfigEntry>(); |
| | | configEntries = new ConcurrentHashMap<>(); |
| | | configRootEntry = new ConfigEntry(entry, null); |
| | | configEntries.put(entry.getName(), configRootEntry); |
| | | |
| | |
| | | |
| | | |
| | | // Apply the changes and make sure there were no errors. |
| | | List<LocalizableMessage> errorList = new LinkedList<LocalizableMessage>(); |
| | | List<LocalizableMessage> errorList = new LinkedList<>(); |
| | | boolean successful = LDIFModify.modifyLDIF(sourceReader, changesReader, |
| | | targetWriter, errorList); |
| | | |
| | |
| | | int numToDelete = archivedFileList.length - maxConfigArchiveSize; |
| | | if (numToDelete > 0) |
| | | { |
| | | Set<String> archiveSet = new TreeSet<String>(); |
| | | Set<String> archiveSet = new TreeSet<>(); |
| | | for (String name : archivedFileList) |
| | | { |
| | | if (! name.startsWith("config-")) |
| | |
| | | // See if the entry has any children. If so, then iterate through them and |
| | | // write them and their children. We'll copy the entries into a tree map |
| | | // so that we have a sensible order in the resulting LDIF. |
| | | TreeMap<DN,ConfigEntry> childMap = |
| | | new TreeMap<DN,ConfigEntry>(configEntry.getChildren()); |
| | | TreeMap<DN,ConfigEntry> childMap = new TreeMap<>(configEntry.getChildren()); |
| | | for (ConfigEntry childEntry : childMap.values()) |
| | | { |
| | | writeEntryAndChildren(writer, childEntry); |
| | |
| | | @Override |
| | | public Map<String,String> getAlerts() |
| | | { |
| | | Map<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | Map<String,String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(ALERT_TYPE_CANNOT_WRITE_CONFIGURATION, |
| | | ALERT_DESCRIPTION_CANNOT_WRITE_CONFIGURATION); |
| | |
| | | |
| | | // Read the contents of file into the dictionary as per the configuration. |
| | | BufferedReader reader = null; |
| | | HashSet<String> dictionary = new HashSet<String>(); |
| | | HashSet<String> dictionary = new HashSet<>(); |
| | | try |
| | | { |
| | | reader = new BufferedReader(new FileReader(dictionaryFile)); |
| | |
| | | LocalizableMessage msg= NOTE_DIGEST_MD5_SERVER_FQDN.get(serverFQDN); |
| | | logger.info(msg); |
| | | String QOP = getQOP(configuration); |
| | | saslProps = new HashMap<String,String>(); |
| | | saslProps = new HashMap<>(); |
| | | saslProps.put(Sasl.QOP, QOP); |
| | | String realm=getRealm(configuration); |
| | | if(realm != null) { |
| | |
| | | LocalizableMessage msg = NOTE_DIGEST_MD5_SERVER_FQDN.get(serverFQDN); |
| | | logger.info(msg); |
| | | String QOP = getQOP(configuration); |
| | | saslProps = new HashMap<String,String>(); |
| | | saslProps = new HashMap<>(); |
| | | saslProps.put(Sasl.QOP, QOP); |
| | | String realm=getRealm(configuration); |
| | | if(realm != null) { |
| | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Attribute> getMonitorData() { |
| | | final List<Attribute> monitorAttrs = new ArrayList<Attribute>(); |
| | | final List<Attribute> monitorAttrs = new ArrayList<>(); |
| | | monitorAttrs.add(attr("disk-dir", getDefaultStringSyntax(), directory.getPath())); |
| | | monitorAttrs.add(attr("disk-free", getDefaultIntegerSyntax(), getFreeSpace())); |
| | | monitorAttrs.add(attr("disk-state", getDefaultStringSyntax(), getState())); |
| | |
| | | private int state; |
| | | /** printable list of handlers names, for reporting backend names in alert messages */ |
| | | private final StringBuilder diskNames = new StringBuilder(); |
| | | private final List<MonitoredDirectory> allHandlers = new ArrayList<MonitoredDirectory>(); |
| | | private final List<MonitoredDirectory> allHandlers = new ArrayList<>(); |
| | | |
| | | private HandlerNotifier(File directory, int state) |
| | | { |
| | |
| | | private static final int LOW = 1; |
| | | private static final int FULL = 2; |
| | | private static final String INSTANCENAME = "Disk Space Monitor"; |
| | | private final HashMap<File, List<MonitoredDirectory>> monitoredDirs = |
| | | new HashMap<File, List<MonitoredDirectory>>(); |
| | | private final HashMap<File, List<MonitoredDirectory>> monitoredDirs = new HashMap<>(); |
| | | |
| | | /** |
| | | * Constructs a new DiskSpaceMonitor that will notify registered DiskSpaceMonitorHandler objects when filesystems |
| | |
| | | List<MonitoredDirectory> diskHelpers = monitoredDirs.get(fsMountPoint); |
| | | if (diskHelpers == null) |
| | | { |
| | | List<MonitoredDirectory> newList = new ArrayList<MonitoredDirectory>(); |
| | | List<MonitoredDirectory> newList = new ArrayList<>(); |
| | | newList.add(newDSH); |
| | | monitoredDirs.put(fsMountPoint, newList); |
| | | } |
| | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public List<Attribute> getMonitorData() { |
| | | return new ArrayList<Attribute>(); |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |
| | | List<HandlerNotifier> diskFull = new ArrayList<HandlerNotifier>(); |
| | | List<HandlerNotifier> diskLow = new ArrayList<HandlerNotifier>(); |
| | | List<HandlerNotifier> diskRestored = new ArrayList<HandlerNotifier>(); |
| | | List<HandlerNotifier> diskFull = new ArrayList<>(); |
| | | List<HandlerNotifier> diskLow = new ArrayList<>(); |
| | | List<HandlerNotifier> diskRestored = new ArrayList<>(); |
| | | |
| | | synchronized (monitoredDirs) |
| | | { |
| | |
| | | @Override |
| | | public Map<String, String> getAlerts() |
| | | { |
| | | Map<String, String> alerts = new LinkedHashMap<String, String>(); |
| | | Map<String, String> alerts = new LinkedHashMap<>(); |
| | | alerts.put(ALERT_TYPE_DISK_SPACE_LOW, ALERT_DESCRIPTION_DISK_SPACE_LOW); |
| | | alerts.put(ALERT_TYPE_DISK_FULL, ALERT_DESCRIPTION_DISK_FULL); |
| | | return alerts; |
| | |
| | | |
| | | // Get the memberURL attribute from the entry, if there is one, and parse |
| | | // out the LDAP URLs that it contains. |
| | | LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<LDAPURL>(); |
| | | LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<>(); |
| | | AttributeType memberURLType = |
| | | DirectoryConfig.getAttributeType(ATTR_MEMBER_URL_LC, true); |
| | | List<Attribute> attrList = groupEntry.getAttribute(memberURLType); |
| | |
| | | } |
| | | |
| | | searchesCompleted = false; |
| | | resultQueue = new LinkedBlockingQueue<Object>(10); |
| | | resultQueue = new LinkedBlockingQueue<>(10); |
| | | |
| | | |
| | | // We're going to have to perform one or more internal searches in order to |
| | | // get the results. We need to be careful about the way that we construct |
| | | // them in order to avoid the possibility of getting duplicate results, so |
| | | // searches with overlapping bases will need to be combined. |
| | | LinkedHashMap<DN,LinkedList<LDAPURL>> baseDNs = |
| | | new LinkedHashMap<DN,LinkedList<LDAPURL>>(); |
| | | LinkedHashMap<DN,LinkedList<LDAPURL>> baseDNs = new LinkedHashMap<>(); |
| | | for (LDAPURL memberURL : memberURLs) |
| | | { |
| | | // First, determine the base DN for the search. It needs to be evaluated |
| | |
| | | // the same hierarchy. |
| | | if (baseDNs.isEmpty()) |
| | | { |
| | | LinkedList<LDAPURL> urlList = new LinkedList<LDAPURL>(); |
| | | LinkedList<LDAPURL> urlList = new LinkedList<>(); |
| | | urlList.add(memberURL); |
| | | baseDNs.put(urlBaseDN, urlList); |
| | | } |
| | |
| | | |
| | | if (! found) |
| | | { |
| | | urlList = new LinkedList<LDAPURL>(); |
| | | urlList = new LinkedList<>(); |
| | | urlList.add(memberURL); |
| | | baseDNs.put(urlBaseDN, urlList); |
| | | } |
| | |
| | | // create the filter to use with that base DN. There are some special-case |
| | | // optimizations that we can do here, but in general the filter will look |
| | | // like "(&(filter)(|(urlFilters)))". |
| | | LinkedHashMap<DN,SearchFilter> searchMap = |
| | | new LinkedHashMap<DN,SearchFilter>(); |
| | | LinkedHashMap<DN,SearchFilter> searchMap = new LinkedHashMap<>(); |
| | | for (DN urlBaseDN : baseDNs.keySet()) |
| | | { |
| | | LinkedList<LDAPURL> urlList = baseDNs.get(urlBaseDN); |
| | | LinkedHashSet<SearchFilter> urlFilters = |
| | | new LinkedHashSet<SearchFilter>(); |
| | | LinkedHashSet<SearchFilter> urlFilters = new LinkedHashSet<>(); |
| | | for (LDAPURL url : urlList) |
| | | { |
| | | urlFilters.add(url.getFilter()); |
| | |
| | | } |
| | | else |
| | | { |
| | | LinkedHashSet<SearchFilter> filterSet = |
| | | new LinkedHashSet<SearchFilter>(); |
| | | LinkedHashSet<SearchFilter> filterSet = new LinkedHashSet<>(); |
| | | filterSet.add(filter); |
| | | filterSet.add(urlFilter); |
| | | combinedFilter = SearchFilter.createANDFilter(filterSet); |
| | |
| | | } |
| | | else |
| | | { |
| | | LinkedHashSet<SearchFilter> filterSet = |
| | | new LinkedHashSet<SearchFilter>(); |
| | | LinkedHashSet<SearchFilter> filterSet = new LinkedHashSet<>(); |
| | | filterSet.add(filter); |
| | | filterSet.add(SearchFilter.createORFilter(urlFilters)); |
| | | combinedFilter = SearchFilter.createANDFilter(filterSet); |
| | |
| | | SearchOperation searchOperation) |
| | | { |
| | | SearchFilter filter = searchOperation.getFilter(); |
| | | LinkedHashSet<DN> dnSet = new LinkedHashSet<DN>(); |
| | | LinkedHashSet<DN> dnSet = new LinkedHashSet<>(); |
| | | extractDNs(rule.getAttributeType(), filter, dnSet); |
| | | |
| | | if (dnSet.isEmpty()) |
| | |
| | | * The set of names for the account status notification types that may be |
| | | * logged by this notification handler. |
| | | */ |
| | | private static final HashSet<String> NOTIFICATION_TYPE_NAMES = |
| | | new HashSet<String>(); |
| | | |
| | | private static final HashSet<String> NOTIFICATION_TYPE_NAMES = new HashSet<>(); |
| | | static |
| | | { |
| | | for (AccountStatusNotificationType t : |
| | | AccountStatusNotificationType.values()) |
| | | for (AccountStatusNotificationType t : AccountStatusNotificationType.values()) |
| | | { |
| | | NOTIFICATION_TYPE_NAMES.add(t.getName()); |
| | | } |
| | |
| | | boolean isAcceptable = true; |
| | | |
| | | // The set of notification types that should generate log messages. |
| | | HashSet<AccountStatusNotificationType> newNotificationTypes = |
| | | new HashSet<AccountStatusNotificationType>(); |
| | | HashSet<AccountStatusNotificationType> newNotificationTypes = new HashSet<>(); |
| | | |
| | | // Initialize the set of notification types that should generate log |
| | | // messages. |
| | | // Initialize the set of notification types that should generate log messages. |
| | | for (ErrorLogAccountStatusNotificationHandlerCfgDefn. |
| | | AccountStatusNotificationType configNotificationType: |
| | | configuration.getAccountStatusNotificationType()) |
| | |
| | | |
| | | // Create the attribute list to include in search requests. We want to |
| | | // include all user and operational attributes. |
| | | requestedAttributes = new LinkedHashSet<String>(2); |
| | | requestedAttributes = new LinkedHashSet<>(2); |
| | | requestedAttributes.add("*"); |
| | | requestedAttributes.add("+"); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | ArrayList<SearchFilter> filterComps = |
| | | new ArrayList<SearchFilter>(attributeTypes.length); |
| | | ArrayList<SearchFilter> filterComps = new ArrayList<>(attributeTypes.length); |
| | | for (AttributeType t : attributeTypes) |
| | | { |
| | | ByteString value = ByteString.valueOf(id); |
| | |
| | | |
| | | // Create the attribute list to include in search requests. We want to |
| | | // include all user and operational attributes. |
| | | requestedAttributes = new LinkedHashSet<String>(2); |
| | | requestedAttributes = new LinkedHashSet<>(2); |
| | | requestedAttributes.add("*"); |
| | | requestedAttributes.add("+"); |
| | | } |
| | |
| | | identityMapper = DirectoryServer.getIdentityMapper(identityMapperDN); |
| | | serverFQDN = getFQDN(config); |
| | | logger.error(INFO_GSSAPI_SERVER_FQDN, serverFQDN); |
| | | saslProps = new HashMap<String, String>(); |
| | | saslProps = new HashMap<>(); |
| | | saslProps.put(Sasl.QOP, getQOP(config)); |
| | | saslProps.put(Sasl.REUSE, "false"); |
| | | String configFileName = configureLoginConfFile(config); |
| | |
| | | Set<ByteString> returnedDNs = null; |
| | | if (!nestedGroupsDNs.isEmpty()) |
| | | { |
| | | returnedDNs = new HashSet<ByteString>(); |
| | | returnedDNs = new HashSet<>(); |
| | | } |
| | | if (!returnGroupMembers(searchOperation, group.getMembers(), returnedDNs)) |
| | | { |
| | |
| | | */ |
| | | public MBeanNotificationInfo[] getNotificationInfo() |
| | | { |
| | | ArrayList<MBeanNotificationInfo> notifications = |
| | | new ArrayList<MBeanNotificationInfo>(); |
| | | ArrayList<MBeanNotificationInfo> notifications = new ArrayList<>(); |
| | | ConcurrentHashMap<DN,JMXMBean> mBeans = DirectoryServer.getJMXMBeans(); |
| | | for (JMXMBean mBean : mBeans.values()) |
| | | { |
| | |
| | | private final ConnectionFactory factory; |
| | | private final int poolSize = Runtime.getRuntime().availableProcessors() * 2; |
| | | private final Semaphore availableConnections = new Semaphore(poolSize); |
| | | private final Queue<Connection> connectionPool = |
| | | new ConcurrentLinkedQueue<Connection>(); |
| | | private final Queue<Connection> connectionPool = new ConcurrentLinkedQueue<>(); |
| | | |
| | | |
| | | |
| | |
| | | ByteString encodedPassword = pwdStorageScheme |
| | | .encodePasswordWithScheme(newCachedPassword); |
| | | |
| | | List<RawModification> modifications = |
| | | new ArrayList<RawModification>(2); |
| | | List<RawModification> modifications = new ArrayList<>(2); |
| | | modifications.add(RawModification.create(ModificationType.REPLACE, |
| | | OP_ATTR_PTAPOLICY_CACHED_PASSWORD, encodedPassword)); |
| | | modifications.add(RawModification.create(ModificationType.REPLACE, |
| | |
| | | // determine the bind DN. |
| | | |
| | | // Construct the search filter. |
| | | final LinkedList<SearchFilter> filterComponents = |
| | | new LinkedList<SearchFilter>(); |
| | | final LinkedList<SearchFilter> filterComponents = new LinkedList<>(); |
| | | for (final AttributeType at : cfg.getMappedAttribute()) |
| | | { |
| | | final List<Attribute> attributes = userEntry.getAttribute(at); |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** Attribute list for searches requesting no attributes. */ |
| | | static final LinkedHashSet<String> NO_ATTRIBUTES = new LinkedHashSet<String>(1); |
| | | static final LinkedHashSet<String> NO_ATTRIBUTES = new LinkedHashSet<>(1); |
| | | static |
| | | { |
| | | NO_ATTRIBUTES.add(SchemaConstants.NO_ATTRIBUTES); |
| | |
| | | computeNumWorkerThreads(configuration.getNumWorkerThreads()); |
| | | |
| | | // Create the actual work queue. |
| | | opQueue = new ConcurrentLinkedQueue<Operation>(); |
| | | opQueue = new ConcurrentLinkedQueue<>(); |
| | | |
| | | // Create the set of worker threads that should be used to service the |
| | | // work queue. |
| | | workerThreads = new ArrayList<ParallelWorkerThread>(numWorkerThreads); |
| | | // Create the set of worker threads that should be used to service the work queue. |
| | | workerThreads = new ArrayList<>(numWorkerThreads); |
| | | for (lastThreadNumber = 0; lastThreadNumber < numWorkerThreads; |
| | | lastThreadNumber++) |
| | | { |
| | |
| | | // Send responses to any operations in the pending queue to indicate that |
| | | // they won't be processed because the server is shutting down. |
| | | CancelRequest cancelRequest = new CancelRequest(true, reason); |
| | | ArrayList<Operation> pendingOperations = new ArrayList<Operation>(); |
| | | ArrayList<Operation> pendingOperations = new ArrayList<>(); |
| | | opQueue.removeAll(pendingOperations); |
| | | |
| | | for (Operation o : pendingOperations) |
| | |
| | | // Run the new password through the set of password validators. |
| | | if (selfChange || !pwPolicyState.getAuthenticationPolicy().isSkipValidationForAdministrators()) |
| | | { |
| | | Set<ByteString> clearPasswords = new HashSet<ByteString>(pwPolicyState.getClearPasswords()); |
| | | Set<ByteString> clearPasswords = new HashSet<>(pwPolicyState.getClearPasswords()); |
| | | if (oldPassword != null) |
| | | { |
| | | clearPasswords.add(oldPassword); |
| | |
| | | List<ByteString> encodedPasswords; |
| | | if (isPreEncoded) |
| | | { |
| | | encodedPasswords = new ArrayList<ByteString>(1); |
| | | encodedPasswords = new ArrayList<>(1); |
| | | encodedPasswords.add(newPassword); |
| | | } |
| | | else |
| | |
| | | // If the current password was provided, then remove all matching values from the user's entry |
| | | // and replace them with the new password. Otherwise replace all password values. |
| | | AttributeType attrType = pwPolicyState.getAuthenticationPolicy().getPasswordAttribute(); |
| | | List<Modification> modList = new ArrayList<Modification>(); |
| | | List<Modification> modList = new ArrayList<>(); |
| | | if (oldPassword != null) |
| | | { |
| | | // Remove all existing encoded values that match the old password. |
| | | Set<ByteString> existingValues = pwPolicyState.getPasswordValues(); |
| | | Set<ByteString> deleteValues = new LinkedHashSet<ByteString>(existingValues.size()); |
| | | Set<ByteString> deleteValues = new LinkedHashSet<>(existingValues.size()); |
| | | if (pwPolicyState.getAuthenticationPolicy().isAuthPasswordSyntax()) |
| | | { |
| | | for (ByteString v : existingValues) |
| | |
| | | List<ByteString> currentPasswords = null; |
| | | if (oldPassword != null) |
| | | { |
| | | currentPasswords = new ArrayList<ByteString>(1); |
| | | currentPasswords = new ArrayList<>(1); |
| | | currentPasswords.add(oldPassword); |
| | | } |
| | | List<ByteString> newPasswords = new ArrayList<ByteString>(1); |
| | | List<ByteString> newPasswords = new ArrayList<>(1); |
| | | newPasswords.add(newPassword); |
| | | |
| | | Map<AccountStatusNotificationProperty, List<String>> notifProperties = |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | userFilter = SearchFilter.objectClassPresent(); |
| | | |
| | | // Construct the set of request attributes. |
| | | requestAttributes = new LinkedHashSet<String>(2); |
| | | requestAttributes = new LinkedHashSet<>(2); |
| | | requestAttributes.add("*"); |
| | | requestAttributes.add("+"); |
| | | |
| | | |
| | | DirectoryServer.registerSupportedExtension(OID_PASSWORD_POLICY_STATE_EXTOP, |
| | | this); |
| | | DirectoryServer.registerSupportedExtension(OID_PASSWORD_POLICY_STATE_EXTOP, this); |
| | | // FIXME registerControlAndFeatures? |
| | | } |
| | | |
| | |
| | | // Create a hash set that will be used to hold the types of the return |
| | | // types that should be included in the response. |
| | | boolean returnAll; |
| | | LinkedHashSet<Integer> returnTypes = new LinkedHashSet<Integer>(); |
| | | LinkedHashSet<Integer> returnTypes = new LinkedHashSet<>(); |
| | | try |
| | | { |
| | | if (!reader.hasNextElement()) |
| | |
| | | else |
| | | { |
| | | reader.readStartSequence(); |
| | | opValues = new ArrayList<String>(); |
| | | opValues = new ArrayList<>(); |
| | | while (reader.hasNextElement()) |
| | | { |
| | | opValues.add(reader.readOctetStringAsString()); |
| | |
| | | ByteString valueString = ByteString.valueOf(opValues.get(0)); |
| | | long time = GeneralizedTime.valueOf(valueString.toString()).getTimeInMillis(); |
| | | List<Long> authFailureTimes = pwpState.getAuthFailureTimes(); |
| | | ArrayList<Long> newFailureTimes = new ArrayList<Long>(authFailureTimes.size()+1); |
| | | ArrayList<Long> newFailureTimes = new ArrayList<>(authFailureTimes.size()+1); |
| | | newFailureTimes.addAll(authFailureTimes); |
| | | newFailureTimes.add(time); |
| | | pwpState.setAuthFailureTimes(newFailureTimes); |
| | |
| | | case OP_SET_AUTHENTICATION_FAILURE_TIMES: |
| | | if (opValues == null) |
| | | { |
| | | ArrayList<Long> valueList = new ArrayList<Long>(1); |
| | | ArrayList<Long> valueList = new ArrayList<>(1); |
| | | valueList.add(pwpState.getCurrentTime()); |
| | | pwpState.setAuthFailureTimes(valueList); |
| | | } |
| | | else |
| | | { |
| | | ArrayList<Long> valueList = new ArrayList<Long>(opValues.size()); |
| | | ArrayList<Long> valueList = new ArrayList<>(opValues.size()); |
| | | for (String value : opValues) |
| | | { |
| | | try |
| | |
| | | ByteString valueString = ByteString.valueOf(opValues.get(0)); |
| | | long time = GeneralizedTime.valueOf(valueString.toString()).getTimeInMillis(); |
| | | List<Long> authFailureTimes = pwpState.getGraceLoginTimes(); |
| | | ArrayList<Long> newGraceTimes = new ArrayList<Long>(authFailureTimes.size()+1); |
| | | ArrayList<Long> newGraceTimes = new ArrayList<>(authFailureTimes.size()+1); |
| | | newGraceTimes.addAll(authFailureTimes); |
| | | newGraceTimes.add(time); |
| | | pwpState.setGraceLoginTimes(newGraceTimes); |
| | |
| | | case OP_SET_GRACE_LOGIN_USE_TIMES: |
| | | if (opValues == null) |
| | | { |
| | | ArrayList<Long> valueList = new ArrayList<Long>(1); |
| | | ArrayList<Long> valueList = new ArrayList<>(1); |
| | | valueList.add(pwpState.getCurrentTime()); |
| | | pwpState.setGraceLoginTimes(valueList); |
| | | } |
| | | else |
| | | { |
| | | ArrayList<Long> valueList = new ArrayList<Long>(opValues.size()); |
| | | ArrayList<Long> valueList = new ArrayList<>(opValues.size()); |
| | | for (String s : opValues) |
| | | { |
| | | try |
| | |
| | | |
| | | // Get the character sets for use in generating the password. At least one |
| | | // must have been provided. |
| | | HashMap<String,NamedCharacterSet> charsets = |
| | | new HashMap<String,NamedCharacterSet>(); |
| | | HashMap<String,NamedCharacterSet> charsets = new HashMap<>(); |
| | | |
| | | try |
| | | { |
| | |
| | | formatString = configuration.getPasswordFormat(); |
| | | StringTokenizer tokenizer = new StringTokenizer(formatString, ", "); |
| | | |
| | | ArrayList<NamedCharacterSet> setList = new ArrayList<NamedCharacterSet>(); |
| | | ArrayList<Integer> countList = new ArrayList<Integer>(); |
| | | ArrayList<NamedCharacterSet> setList = new ArrayList<>(); |
| | | ArrayList<Integer> countList = new ArrayList<>(); |
| | | |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | |
| | | { |
| | | DN cfgEntryDN = configuration.dn(); |
| | | |
| | | // Get the character sets for use in generating the password. At |
| | | // least one |
| | | // must have been provided. |
| | | HashMap<String,NamedCharacterSet> charsets = |
| | | new HashMap<String,NamedCharacterSet>(); |
| | | // Get the character sets for use in generating the password. |
| | | // At least one must have been provided. |
| | | HashMap<String,NamedCharacterSet> charsets = new HashMap<>(); |
| | | try |
| | | { |
| | | SortedSet<String> currentPasSet = configuration.getPasswordCharacterSet(); |
| | |
| | | // Get the character sets for use in generating the password. At least one |
| | | // must have been provided. |
| | | SortedSet<String> newEncodedCharacterSets = null; |
| | | HashMap<String,NamedCharacterSet> charsets = |
| | | new HashMap<String,NamedCharacterSet>(); |
| | | HashMap<String,NamedCharacterSet> charsets = new HashMap<>(); |
| | | try |
| | | { |
| | | newEncodedCharacterSets = configuration.getPasswordCharacterSet(); |
| | |
| | | |
| | | // Get the value that describes which character set(s) and how many |
| | | // characters from each should be used. |
| | | ArrayList<NamedCharacterSet> newSetList = |
| | | new ArrayList<NamedCharacterSet>(); |
| | | ArrayList<Integer> newCountList = new ArrayList<Integer>(); |
| | | ArrayList<NamedCharacterSet> newSetList = new ArrayList<>(); |
| | | ArrayList<Integer> newCountList = new ArrayList<>(); |
| | | String newFormatString = null; |
| | | |
| | | try |
| | |
| | | |
| | | // Create the attribute list to include in search requests. We want to |
| | | // include all user and operational attributes. |
| | | requestedAttributes = new LinkedHashSet<String>(2); |
| | | requestedAttributes = new LinkedHashSet<>(2); |
| | | requestedAttributes.add("*"); |
| | | requestedAttributes.add("+"); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | ArrayList<SearchFilter> filterComps = |
| | | new ArrayList<SearchFilter>(attributeTypes.length); |
| | | ArrayList<SearchFilter> filterComps = new ArrayList<>(attributeTypes.length); |
| | | for (AttributeType t : attributeTypes) |
| | | { |
| | | ByteString value = ByteString.valueOf(processedID); |
| | |
| | | SMTPAccountStatusNotificationHandlerCfg configuration) |
| | | throws ConfigException |
| | | { |
| | | HashMap<AccountStatusNotificationType,String> map = |
| | | new HashMap<AccountStatusNotificationType,String>(); |
| | | HashMap<AccountStatusNotificationType,String> map = new HashMap<>(); |
| | | |
| | | for (String s : configuration.getMessageSubject()) |
| | | { |
| | |
| | | throws ConfigException |
| | | { |
| | | HashMap<AccountStatusNotificationType, |
| | | List<NotificationMessageTemplateElement>> map = |
| | | new HashMap<AccountStatusNotificationType, |
| | | List<NotificationMessageTemplateElement>>(); |
| | | List<NotificationMessageTemplateElement>> map = new HashMap<>(); |
| | | |
| | | for (String s : configuration.getMessageTemplateFile()) |
| | | { |
| | |
| | | private List<NotificationMessageTemplateElement> parseTemplateFile(File f) |
| | | throws ConfigException |
| | | { |
| | | LinkedList<NotificationMessageTemplateElement> elementList = |
| | | new LinkedList<NotificationMessageTemplateElement>(); |
| | | LinkedList<NotificationMessageTemplateElement> elementList = new LinkedList<>(); |
| | | |
| | | BufferedReader reader = null; |
| | | try |
| | |
| | | // It is a notification that should be handled, so we can start generating |
| | | // the e-mail message. First, check to see if there are any mail attributes |
| | | // that would cause us to send a message to the end user. |
| | | LinkedList<String> recipients = new LinkedList<String>(); |
| | | LinkedList<String> recipients = new LinkedList<>(); |
| | | Set<AttributeType> addressAttrs = config.getEmailAddressAttributeType(); |
| | | Set<String> recipientAddrs = config.getRecipientAddress(); |
| | | if ((addressAttrs != null) && (! addressAttrs.isEmpty())) |
| | |
| | | { |
| | | SMTPAlertHandlerCfg cfg = currentConfig; |
| | | |
| | | ArrayList<String> recipients = |
| | | new ArrayList<String>(cfg.getRecipientAddress()); |
| | | ArrayList<String> recipients = new ArrayList<>(cfg.getRecipientAddress()); |
| | | |
| | | String alertIDStr; |
| | | String alertMessageStr; |
| | |
| | | private LinkedHashSet<CompactDn> memberDNs; |
| | | |
| | | /** The list of nested group DNs for this group. */ |
| | | private LinkedList<DN> nestedGroups = new LinkedList<DN>(); |
| | | private LinkedList<DN> nestedGroups = new LinkedList<>(); |
| | | |
| | | /** Passed to the group manager to see if the nested group list needs to be refreshed. */ |
| | | private long nestedGroupRefreshToken = DirectoryServer.getGroupManager().refreshToken(); |
| | |
| | | membersCount += a.size(); |
| | | } |
| | | } |
| | | LinkedHashSet<CompactDn> someMemberDNs = new LinkedHashSet<CompactDn>(membersCount); |
| | | LinkedHashSet<CompactDn> someMemberDNs = new LinkedHashSet<>(membersCount); |
| | | if (memberAttrList != null) |
| | | { |
| | | for (Attribute a : memberAttrList) |
| | |
| | | } |
| | | |
| | | Attribute attr = Attributes.create(memberAttributeType, nestedGroupDN.toString()); |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, attr)); |
| | | |
| | | LinkedList<Control> requestControls = new LinkedList<Control>(); |
| | | LinkedList<Control> requestControls = new LinkedList<>(); |
| | | requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false)); |
| | | |
| | | ModifyOperationBasis modifyOperation = new ModifyOperationBasis( |
| | |
| | | throw new DirectoryException(modifyOperation.getResultCode(), msg); |
| | | } |
| | | |
| | | LinkedList<DN> newNestedGroups = new LinkedList<DN>(nestedGroups); |
| | | LinkedList<DN> newNestedGroups = new LinkedList<>(nestedGroups); |
| | | newNestedGroups.add(nestedGroupDN); |
| | | nestedGroups = newNestedGroups; |
| | | //Add it to the member DN list. |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<CompactDn>(memberDNs); |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<>(memberDNs); |
| | | newMemberDNs.add(toCompactDn(nestedGroupDN)); |
| | | memberDNs = newMemberDNs; |
| | | } |
| | |
| | | } |
| | | |
| | | Attribute attr = Attributes.create(memberAttributeType, nestedGroupDN.toString()); |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, attr)); |
| | | |
| | | LinkedList<Control> requestControls = new LinkedList<Control>(); |
| | | LinkedList<Control> requestControls = new LinkedList<>(); |
| | | requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false)); |
| | | |
| | | ModifyOperationBasis modifyOperation = new ModifyOperationBasis( |
| | |
| | | throw new DirectoryException(modifyOperation.getResultCode(), message); |
| | | } |
| | | |
| | | LinkedList<DN> newNestedGroups = new LinkedList<DN>(nestedGroups); |
| | | LinkedList<DN> newNestedGroups = new LinkedList<>(nestedGroups); |
| | | newNestedGroups.remove(nestedGroupDN); |
| | | nestedGroups = newNestedGroups; |
| | | //Remove it from the member DN list. |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<CompactDn>(memberDNs); |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<>(memberDNs); |
| | | newMemberDNs.remove(toCompactDn(nestedGroupDN)); |
| | | memberDNs = newMemberDNs; |
| | | } |
| | |
| | | throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, |
| | | ERR_STATICGROUP_GROUP_INSTANCE_INVALID.get(groupEntryDN)); |
| | | } else if (thisGroup != this) { |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<CompactDn>(); |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<>(); |
| | | MemberList memberList = thisGroup.getMembers(); |
| | | while (memberList.hasMoreMembers()) |
| | | { |
| | |
| | | } |
| | | memberDNs = newMemberDNs; |
| | | } |
| | | LinkedList<DN> newNestedGroups = new LinkedList<DN>(); |
| | | LinkedList<DN> newNestedGroups = new LinkedList<>(); |
| | | for (CompactDn compactDn : memberDNs) |
| | | { |
| | | DN dn = fromCompactDn(compactDn); |
| | |
| | | } |
| | | |
| | | Attribute attr = Attributes.create(memberAttributeType, userDN.toString()); |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, attr)); |
| | | |
| | | LinkedList<Control> requestControls = new LinkedList<Control>(); |
| | | LinkedList<Control> requestControls = new LinkedList<>(); |
| | | requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false)); |
| | | |
| | | ModifyOperationBasis modifyOperation = new ModifyOperationBasis( |
| | |
| | | ERR_STATICGROUP_ADD_MEMBER_UPDATE_FAILED.get(userDN, groupEntryDN, modifyOperation.getErrorMessage())); |
| | | } |
| | | |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<CompactDn>(memberDNs.size()+1); |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<>(memberDNs.size()+1); |
| | | newMemberDNs.addAll(memberDNs); |
| | | newMemberDNs.add(compactUserDN); |
| | | memberDNs = newMemberDNs; |
| | |
| | | } |
| | | |
| | | Attribute attr = Attributes.create(memberAttributeType, userDN.toString()); |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, attr)); |
| | | |
| | | LinkedList<Control> requestControls = new LinkedList<Control>(); |
| | | LinkedList<Control> requestControls = new LinkedList<>(); |
| | | requestControls.add(new LDAPControl(OID_INTERNAL_GROUP_MEMBERSHIP_UPDATE, false)); |
| | | |
| | | ModifyOperationBasis modifyOperation = new ModifyOperationBasis( |
| | |
| | | ERR_STATICGROUP_REMOVE_MEMBER_UPDATE_FAILED.get(userDN, groupEntryDN, modifyOperation.getErrorMessage())); |
| | | } |
| | | |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<CompactDn>(memberDNs); |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<>(memberDNs); |
| | | newMemberDNs.remove(compactUserDN); |
| | | memberDNs = newMemberDNs; |
| | | //If it is in the nested group list remove it. |
| | | if(nestedGroups.contains(userDN)) { |
| | | LinkedList<DN> newNestedGroups = new LinkedList<DN>(nestedGroups); |
| | | LinkedList<DN> newNestedGroups = new LinkedList<>(nestedGroups); |
| | | newNestedGroups.remove(userDN); |
| | | nestedGroups = newNestedGroups; |
| | | } |
| | |
| | | configEntryDN = configuration.dn(); |
| | | |
| | | // Get and validate the subject attribute to user attribute mappings. |
| | | attributeMap = new LinkedHashMap<String,AttributeType>(); |
| | | attributeMap = new LinkedHashMap<>(); |
| | | for (String mapStr : configuration.getSubjectAttributeMapping()) |
| | | { |
| | | String lowerMap = toLowerCase(mapStr); |
| | |
| | | |
| | | // Create the attribute list to include in search requests. We want to |
| | | // include all user and operational attributes. |
| | | requestedAttributes = new LinkedHashSet<String>(2); |
| | | requestedAttributes = new LinkedHashSet<>(2); |
| | | requestedAttributes.add("*"); |
| | | requestedAttributes.add("+"); |
| | | } |
| | |
| | | de); |
| | | } |
| | | |
| | | LinkedList<SearchFilter> filterComps = new LinkedList<SearchFilter>(); |
| | | LinkedList<SearchFilter> filterComps = new LinkedList<>(); |
| | | for (int i=0; i < peerDN.size(); i++) |
| | | { |
| | | RDN rdn = peerDN.getRDN(i); |
| | |
| | | DN cfgEntryDN = configuration.dn(); |
| | | |
| | | // Get and validate the subject attribute to user attribute mappings. |
| | | LinkedHashMap<String,AttributeType> newAttributeMap = |
| | | new LinkedHashMap<String,AttributeType>(); |
| | | LinkedHashMap<String,AttributeType> newAttributeMap = new LinkedHashMap<>(); |
| | | mapLoop: |
| | | for (String mapStr : configuration.getSubjectAttributeMapping()) |
| | | { |
| | |
| | | |
| | | |
| | | // Get and validate the subject attribute to user attribute mappings. |
| | | LinkedHashMap<String,AttributeType> newAttributeMap = |
| | | new LinkedHashMap<String,AttributeType>(); |
| | | LinkedHashMap<String,AttributeType> newAttributeMap = new LinkedHashMap<>(); |
| | | mapLoop: |
| | | for (String mapStr : configuration.getSubjectAttributeMapping()) |
| | | { |
| | |
| | | |
| | | // Create the attribute list to include in search requests. We want to |
| | | // include all user and operational attributes. |
| | | requestedAttributes = new LinkedHashSet<String>(2); |
| | | requestedAttributes = new LinkedHashSet<>(2); |
| | | requestedAttributes.add("*"); |
| | | requestedAttributes.add("+"); |
| | | } |
| | |
| | | static final Map<String, Integer> CIPHER_MAP; |
| | | static |
| | | { |
| | | final Map<String, Integer> map = new LinkedHashMap<String, Integer>(); |
| | | final Map<String, Integer> map = new LinkedHashMap<>(); |
| | | map.put("_WITH_AES_256_", 256); |
| | | map.put("_WITH_ARIA_256_", 256); |
| | | map.put("_WITH_CAMELLIA_256_", 256); |
| | |
| | | private static final int MAX_RETRY_COUNT = 5; |
| | | |
| | | /** The set of worker threads that will be used to process this work queue. */ |
| | | private final ArrayList<TraditionalWorkerThread> workerThreads = |
| | | new ArrayList<TraditionalWorkerThread>(); |
| | | private final ArrayList<TraditionalWorkerThread> workerThreads = new ArrayList<>(); |
| | | |
| | | /** |
| | | * The number of operations that have been submitted to the work queue for |
| | | * processing. |
| | | */ |
| | | /** The number of operations that have been submitted to the work queue for processing. */ |
| | | private AtomicLong opsSubmitted; |
| | | |
| | | /** |
| | |
| | | // Create the actual work queue. |
| | | if (maxCapacity > 0) |
| | | { |
| | | opQueue = new LinkedBlockingQueue<Operation>(maxCapacity); |
| | | opQueue = new LinkedBlockingQueue<>(maxCapacity); |
| | | } |
| | | else |
| | | { |
| | | // This will never be the case, since the configuration definition |
| | | // ensures that the capacity is always finite. |
| | | opQueue = new LinkedBlockingQueue<Operation>(); |
| | | opQueue = new LinkedBlockingQueue<>(); |
| | | } |
| | | |
| | | // Create the set of worker threads that should be used to service the |
| | |
| | | // Send responses to any operations in the pending queue to indicate that |
| | | // they won't be processed because the server is shutting down. |
| | | CancelRequest cancelRequest = new CancelRequest(true, reason); |
| | | ArrayList<Operation> pendingOperations = new ArrayList<Operation>(); |
| | | ArrayList<Operation> pendingOperations = new ArrayList<>(); |
| | | opQueue.removeAll(pendingOperations); |
| | | for (Operation o : pendingOperations) |
| | | { |
| | |
| | | LinkedBlockingQueue<Operation> newOpQueue = null; |
| | | if (newMaxCapacity > 0) |
| | | { |
| | | newOpQueue = new LinkedBlockingQueue<Operation>( |
| | | newMaxCapacity); |
| | | newOpQueue = new LinkedBlockingQueue<>(newMaxCapacity); |
| | | } |
| | | else |
| | | { |
| | | newOpQueue = new LinkedBlockingQueue<Operation>(); |
| | | newOpQueue = new LinkedBlockingQueue<>(); |
| | | } |
| | | |
| | | oldOpQueue = opQueue; |
| | |
| | | |
| | | // Create a set that will be used to keep track of the unique characters |
| | | // contained in the proposed password. |
| | | HashSet<Character> passwordCharacters = new HashSet<Character>(); |
| | | HashSet<Character> passwordCharacters = new HashSet<>(); |
| | | |
| | | // Iterate through the characters in the new password and place them in the |
| | | // set as needed. If we should behave in a case-insensitive manner, then |
| | |
| | | * The set of loggers that have been registered with the server. It will |
| | | * initially be empty. |
| | | */ |
| | | private Collection<P> logPublishers = new CopyOnWriteArrayList<P>(); |
| | | private Collection<P> logPublishers = new CopyOnWriteArrayList<>(); |
| | | |
| | | |
| | | /** |
| | |
| | | private void buildFilters(final boolean suppressInternal, |
| | | final boolean suppressSynchronization, final FilteringPolicy policy) |
| | | { |
| | | final ArrayList<Filter> subFilters = new ArrayList<Filter>(); |
| | | final ArrayList<Filter> subFilters = new ArrayList<>(); |
| | | if (cfg != null) |
| | | { |
| | | for (final String criteriaName : cfg.listAccessLogFilteringCriteria()) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | import java.util.Collection; |
| | |
| | | |
| | | private static LoggerStorage |
| | | <AccessLogPublisher<AccessLogPublisherCfg>, AccessLogPublisherCfg> |
| | | loggerStorage = new LoggerStorage |
| | | <AccessLogPublisher<AccessLogPublisherCfg>, AccessLogPublisherCfg>(); |
| | | loggerStorage = new LoggerStorage<>(); |
| | | |
| | | /** The singleton instance of this class. */ |
| | | private static final AccessLogger instance = new AccessLogger(); |
| | |
| | | this.autoFlush = autoFlush; |
| | | this.writer = writer; |
| | | |
| | | this.queue = new LinkedBlockingQueue<String>(capacity); |
| | | this.queue = new LinkedBlockingQueue<>(capacity); |
| | | this.capacity = capacity; |
| | | this.writerThread = null; |
| | | this.stopRequested = new AtomicBoolean(false); |
| | |
| | | @Override |
| | | public void run() |
| | | { |
| | | ArrayList<String> drainList = new ArrayList<String>(capacity); |
| | | ArrayList<String> drainList = new ArrayList<>(capacity); |
| | | |
| | | String message = null; |
| | | while (!stopRequested.get() || !queue.isEmpty()) { |
| | |
| | | { |
| | | if (classTraceSettings == null) |
| | | { |
| | | classTraceSettings = new HashMap<String, TraceSettings>(); |
| | | classTraceSettings = new HashMap<>(); |
| | | } |
| | | classTraceSettings.put(className, settings); |
| | | } |
| | |
| | | String methodName, TraceSettings settings) |
| | | { |
| | | if (methodTraceSettings == null) { |
| | | methodTraceSettings = new HashMap<String, Map<String, TraceSettings>>(); |
| | | methodTraceSettings = new HashMap<>(); |
| | | } |
| | | Map<String, TraceSettings> methodLevels = methodTraceSettings.get(className); |
| | | if (methodLevels == null) |
| | | { |
| | | methodLevels = new TreeMap<String, TraceSettings>(); |
| | | methodLevels = new TreeMap<>(); |
| | | methodTraceSettings.put(className, methodLevels); |
| | | } |
| | | methodLevels.put(methodName, settings); |
| | |
| | | { |
| | | |
| | | /** The set of all DebugTracer instances. */ |
| | | private static Map<String, DebugTracer> classTracers = |
| | | new ConcurrentHashMap<String, DebugTracer>(); |
| | | private static Map<String, DebugTracer> classTracers = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * Trace methods will use this static boolean to determine if debug is enabled |
| | |
| | | |
| | | private static final LoggerStorage |
| | | <DebugLogPublisher<DebugLogPublisherCfg>, DebugLogPublisherCfg> |
| | | loggerStorage = new LoggerStorage |
| | | <DebugLogPublisher<DebugLogPublisherCfg>, DebugLogPublisherCfg>(); |
| | | loggerStorage = new LoggerStorage<>(); |
| | | |
| | | /** The singleton instance of this class. */ |
| | | static final DebugLogger instance = new DebugLogger(); |
| | |
| | | |
| | | private List<String> getDebugTargetsFromSystemProperties() |
| | | { |
| | | final List<String> targets = new ArrayList<String>(); |
| | | final List<String> targets = new ArrayList<>(); |
| | | for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) |
| | | { |
| | | if (((String) entry.getKey()).startsWith(PROPERTY_DEBUG_TARGET)) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | * The hash map that will be used to define specific log severities for the |
| | | * various categories. |
| | | */ |
| | | protected Map<String, Set<Severity>> definedSeverities = |
| | | new HashMap<String, Set<Severity>>(); |
| | | protected Map<String, Set<Severity>> definedSeverities = new HashMap<>(); |
| | | |
| | | /** |
| | | * The set of default log severities that will be used if no custom severities |
| | | * have been defined for the associated category. |
| | | */ |
| | | protected Set<Severity> defaultSeverities = new HashSet<Severity>(); |
| | | protected Set<Severity> defaultSeverities = new HashSet<>(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | |
| | | private static LoggerStorage |
| | | <ErrorLogPublisher<ErrorLogPublisherCfg>, ErrorLogPublisherCfg> |
| | | loggerStorage = new LoggerStorage |
| | | <ErrorLogPublisher<ErrorLogPublisherCfg>, ErrorLogPublisherCfg>(); |
| | | loggerStorage = new LoggerStorage<>(); |
| | | |
| | | /** The singleton instance of this class for configuration purposes. */ |
| | | private static final ErrorLogger instance = new ErrorLogger(); |
| | |
| | | // Sort files based on last modified time. |
| | | Arrays.sort(files, new FileComparator()); |
| | | |
| | | ArrayList<File> filesToDelete = new ArrayList<File>(); |
| | | ArrayList<File> filesToDelete = new ArrayList<>(); |
| | | for (int j = numFiles; j < files.length; j++) |
| | | { |
| | | filesToDelete.add(files[j]); |
| | |
| | | // Sort files based on last modified time. |
| | | Arrays.sort(files, new FileComparator()); |
| | | |
| | | List<File> filesToDelete = new ArrayList<File>(); |
| | | List<File> filesToDelete = new ArrayList<>(); |
| | | long freedSpace = 0; |
| | | for (int j = files.length - 1; j < 1; j--) |
| | | { |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | |
| | | private static LoggerStorage |
| | | <HTTPAccessLogPublisher<HTTPAccessLogPublisherCfg>, HTTPAccessLogPublisherCfg> |
| | | loggerStorage = new LoggerStorage |
| | | <HTTPAccessLogPublisher<HTTPAccessLogPublisherCfg>, HTTPAccessLogPublisherCfg> |
| | | (); |
| | | loggerStorage = new LoggerStorage<>(); |
| | | |
| | | /** The singleton instance of this class for configuration purposes. */ |
| | | private static final HTTPAccessLogger instance = new HTTPAccessLogger(); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | * most case, package name is sufficient to map to a category name. It is |
| | | * valid if several entries point to the same category name. |
| | | */ |
| | | private static final NavigableMap<String, String> NAMES = |
| | | new TreeMap<String, String>(); |
| | | |
| | | private static final NavigableMap<String, String> NAMES = new TreeMap<>(); |
| | | static |
| | | { |
| | | // The category used for messages associated with the core server. |
| | |
| | | |
| | | private static final String UTF8_ENCODING= "UTF-8"; |
| | | |
| | | private CopyOnWriteArrayList<RotationPolicy> rotationPolicies = |
| | | new CopyOnWriteArrayList<RotationPolicy>(); |
| | | private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies = |
| | | new CopyOnWriteArrayList<RetentionPolicy>(); |
| | | private CopyOnWriteArrayList<RotationPolicy> rotationPolicies = new CopyOnWriteArrayList<>(); |
| | | private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies = new CopyOnWriteArrayList<>(); |
| | | |
| | | private FileNamingPolicy namingPolicy; |
| | | private FilePermission filePermissions; |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | |
| | | private final ConcurrentMap<String, Logger> loggerMap; |
| | | |
| | | /** |
| | | * Create the factory. |
| | | */ |
| | | /** Create the factory. */ |
| | | public OpenDJLoggerFactory() { |
| | | loggerMap = new ConcurrentHashMap<String, Logger>(); |
| | | loggerMap = new ConcurrentHashMap<>(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | this.autoFlush = autoFlush; |
| | | this.writer = writer; |
| | | |
| | | this.queue = new ConcurrentLinkedQueue<String>(); |
| | | this.queue = new ConcurrentLinkedQueue<>(); |
| | | this.writerThread = null; |
| | | this.stopRequested = new AtomicBoolean(false); |
| | | |
| | |
| | | category = category.replace("-", "_").toUpperCase(); |
| | | try |
| | | { |
| | | Set<Severity> severities = new HashSet<Severity>(); |
| | | Set<Severity> severities = new HashSet<>(); |
| | | StringTokenizer sevTokenizer = new StringTokenizer(overrideSeverity.substring(equalPos + 1), ","); |
| | | while (sevTokenizer.hasMoreElements()) |
| | | { |
| | |
| | | category = category.replace("-", "_").toUpperCase(); |
| | | try |
| | | { |
| | | Set<Severity> severities = new HashSet<Severity>(); |
| | | Set<Severity> severities = new HashSet<>(); |
| | | StringTokenizer sevTokenizer = |
| | | new StringTokenizer(overrideSeverity.substring(equalPos+1), ","); |
| | | while (sevTokenizer.hasMoreElements()) |
| | |
| | | private static final String X_DATETIME = "x-datetime"; |
| | | private static final String X_ETIME = "x-etime"; |
| | | |
| | | private static final Set<String> ALL_SUPPORTED_FIELDS = new HashSet<String>( |
| | | private static final Set<String> ALL_SUPPORTED_FIELDS = new HashSet<>( |
| | | Arrays.asList(ELF_C_IP, ELF_C_PORT, ELF_CS_HOST, ELF_CS_METHOD, |
| | | ELF_CS_URI_QUERY, ELF_CS_USER_AGENT, ELF_CS_USERNAME, ELF_CS_VERSION, |
| | | ELF_S_COMPUTERNAME, ELF_S_IP, ELF_S_PORT, ELF_SC_STATUS, |
| | |
| | | */ |
| | | private <T> Collection<T> subtract(Collection<T> a, Collection<T> b) |
| | | { |
| | | final Collection<T> result = new ArrayList<T>(); |
| | | final Collection<T> result = new ArrayList<>(); |
| | | for (T elem : a) |
| | | { |
| | | if (!b.contains(elem)) |
| | |
| | | @Override |
| | | public void logRequestInfo(HTTPRequestInfo ri) |
| | | { |
| | | final Map<String, Object> fields = new HashMap<String, Object>(); |
| | | final Map<String, Object> fields = new HashMap<>(); |
| | | fields.put(ELF_C_IP, ri.getClientAddress()); |
| | | fields.put(ELF_C_PORT, ri.getClientPort()); |
| | | fields.put(ELF_CS_HOST, ri.getClientHost()); |
| | |
| | | /** {@inheritDoc} */ |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | LinkedList<Attribute> attrs = new LinkedList<Attribute>(); |
| | | LinkedList<Attribute> attrs = new LinkedList<>(); |
| | | |
| | | attrs.add(Attributes.create(backendIDType, backend.getBackendID())); |
| | | |
| | |
| | | public ArrayList<Attribute> getMonitorData() |
| | | { |
| | | // Re-order the connections by connection ID. |
| | | TreeMap<Long, ClientConnection> connMap = |
| | | new TreeMap<Long, ClientConnection>(); |
| | | TreeMap<Long, ClientConnection> connMap = new TreeMap<>(); |
| | | |
| | | if (handler == null) |
| | | { |
| | |
| | | builder.add(conn.getMonitorSummary()); |
| | | } |
| | | |
| | | ArrayList<Attribute> attrs = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> attrs = new ArrayList<>(1); |
| | | attrs.add(builder.toAttribute()); |
| | | return attrs; |
| | | } |
| | |
| | | @Override |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | LinkedList<Attribute> attrs = new LinkedList<Attribute>(); |
| | | LinkedList<Attribute> attrs = new LinkedList<>(); |
| | | |
| | | // Configuration DN |
| | | attrs.add(Attributes.create(configDnType, connectionHandler.getComponentEntryDN().toString())); |
| | | |
| | | int numConnections = 0; |
| | | LinkedList<ClientConnection> conns = new LinkedList<ClientConnection>( |
| | | connectionHandler.getClientConnections()); |
| | | LinkedList<HostPort> listeners = new LinkedList<HostPort>(connectionHandler |
| | | .getListeners()); |
| | | LinkedList<ClientConnection> conns = new LinkedList<>(connectionHandler.getClientConnections()); |
| | | LinkedList<HostPort> listeners = new LinkedList<>(connectionHandler.getListeners()); |
| | | |
| | | attrs.add(Attributes.create(protocolType, connectionHandler |
| | | .getProtocol())); |
| | | attrs.add(Attributes.create(protocolType, connectionHandler.getProtocol())); |
| | | |
| | | if (!listeners.isEmpty()) |
| | | { |
| | |
| | | private int maxEntries = 1024; |
| | | private boolean filterUseEnabled; |
| | | private String startTimeStamp; |
| | | private final HashMap<SearchFilter, FilterStats> filterToStats = |
| | | new HashMap<SearchFilter, FilterStats>(); |
| | | private final HashMap<SearchFilter, FilterStats> filterToStats = new HashMap<>(); |
| | | private final AtomicInteger indexedSearchCount = new AtomicInteger(); |
| | | private final AtomicInteger unindexedSearchCount = new AtomicInteger(); |
| | | |
| | |
| | | EnvironmentStats environmentStats = null; |
| | | TransactionStats transactionStats = null; |
| | | StatsConfig statsConfig = new StatsConfig(); |
| | | ArrayList<Attribute> monitorAttrs = new ArrayList<Attribute>(); |
| | | ArrayList<Attribute> monitorAttrs = new ArrayList<>(); |
| | | |
| | | try |
| | | { |
| | |
| | | AttributeBuilder needReindex = new AttributeBuilder("need-reindex"); |
| | | for(EntryContainer ec : rootContainer.getEntryContainers()) |
| | | { |
| | | List<DatabaseContainer> databases = new ArrayList<DatabaseContainer>(); |
| | | List<DatabaseContainer> databases = new ArrayList<>(); |
| | | ec.listDatabases(databases); |
| | | for(DatabaseContainer dc : databases) |
| | | { |
| | |
| | | implements Runnable |
| | | { |
| | | /** A map of the last GC counts seen by this monitor for calculating recent stats. */ |
| | | private HashMap<String,Long> lastGCCounts = new HashMap<String,Long>(); |
| | | |
| | | private HashMap<String,Long> lastGCCounts = new HashMap<>(); |
| | | /** A map of the last GC times seen by this monitor for calculating recent stats. */ |
| | | private HashMap<String,Long> lastGCTimes = new HashMap<String,Long>(); |
| | | |
| | | private HashMap<String,Long> lastGCTimes = new HashMap<>(); |
| | | /** A map of the most recent GC durations seen by this monitor. */ |
| | | private HashMap<String,Long> recentGCDurations = new HashMap<String,Long>(); |
| | | |
| | | /** |
| | | * A map of the memory manager names to names that are safe for use in |
| | | * attribute names. |
| | | */ |
| | | private HashMap<String,String> gcSafeNames = new HashMap<String,String>(); |
| | | |
| | | private HashMap<String,Long> recentGCDurations = new HashMap<>(); |
| | | /** A map of the memory manager names to names that are safe for use in attribute names. */ |
| | | private HashMap<String,String> gcSafeNames = new HashMap<>(); |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | @Override |
| | | public ArrayList<Attribute> getMonitorData() |
| | | { |
| | | ArrayList<Attribute> attrs = new ArrayList<Attribute>(); |
| | | ArrayList<Attribute> attrs = new ArrayList<>(); |
| | | |
| | | for (GarbageCollectorMXBean gc : |
| | | ManagementFactory.getGarbageCollectorMXBeans()) |
| | |
| | | */ |
| | | package org.opends.server.monitors; |
| | | |
| | | |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import org.opends.server.admin.std.server.MonitorProviderCfg; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.ParallelWorkQueue; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server monitor that can be used to provide |
| | | * information about the state of the work queue. |
| | |
| | | extends MonitorProvider<MonitorProviderCfg> |
| | | implements Runnable |
| | | { |
| | | /** |
| | | * The name to use for the monitor attribute that provides the current request |
| | | * backlog. |
| | | */ |
| | | /** The name to use for the monitor attribute that provides the current request backlog. */ |
| | | public static final String ATTR_CURRENT_BACKLOG = "currentRequestBacklog"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name to use for the monitor attribute that provides the average request |
| | | * backlog. |
| | | */ |
| | | /** The name to use for the monitor attribute that provides the average request backlog. */ |
| | | public static final String ATTR_AVERAGE_BACKLOG = "averageRequestBacklog"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name to use for the monitor attribute that provides the maximum |
| | | * observed request backlog. |
| | | */ |
| | | public static final String ATTR_MAX_BACKLOG = "maxRequestBacklog"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name to use for the monitor attribute that provides the total number of |
| | | * operations submitted. |
| | |
| | | public static final String ATTR_OPS_SUBMITTED = "requestsSubmitted"; |
| | | |
| | | |
| | | |
| | | /** The maximum backlog observed by polling the queue. */ |
| | | private int maxBacklog; |
| | | |
| | |
| | | /** The parallel work queue instance with which this monitor is associated. */ |
| | | private ParallelWorkQueue workQueue; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes this monitor provider. Note that no initialization should be |
| | | * done here, since it should be performed in the |
| | |
| | | } |
| | | |
| | | long averageBacklog = (long) (1.0 * totalBacklog / numPolls); |
| | | |
| | | long opsSubmitted = workQueue.getOpsSubmitted(); |
| | | |
| | | ArrayList<Attribute> monitorAttrs = new ArrayList<Attribute>(); |
| | | Syntax integerSyntax = DirectoryServer.getDefaultIntegerSyntax(); |
| | | |
| | | // The current backlog. |
| | | AttributeType attrType = DirectoryServer.getDefaultAttributeType( |
| | | ATTR_CURRENT_BACKLOG, integerSyntax); |
| | | monitorAttrs |
| | | .add(Attributes.create(attrType, String.valueOf(backlog))); |
| | | |
| | | // The average backlog. |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_AVERAGE_BACKLOG, |
| | | integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String |
| | | .valueOf(averageBacklog))); |
| | | |
| | | // The maximum backlog. |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_MAX_BACKLOG, |
| | | integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String |
| | | .valueOf(maxBacklog))); |
| | | |
| | | ArrayList<Attribute> monitorAttrs = new ArrayList<>(); |
| | | putAttribute(monitorAttrs, ATTR_CURRENT_BACKLOG, backlog); |
| | | putAttribute(monitorAttrs, ATTR_AVERAGE_BACKLOG, averageBacklog); |
| | | putAttribute(monitorAttrs, ATTR_MAX_BACKLOG, maxBacklog); |
| | | // The total number of operations submitted. |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_OPS_SUBMITTED, |
| | | integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String |
| | | .valueOf(opsSubmitted))); |
| | | putAttribute(monitorAttrs, ATTR_OPS_SUBMITTED, opsSubmitted); |
| | | |
| | | return monitorAttrs; |
| | | } |
| | | |
| | | private void putAttribute(ArrayList<Attribute> monitorAttrs, String attrName, Object value) |
| | | { |
| | | AttributeType attrType = getDefaultAttributeType(attrName, getDefaultIntegerSyntax()); |
| | | monitorAttrs.add(Attributes.create(attrType, String.valueOf(value))); |
| | | } |
| | | } |
| | |
| | | Map<Thread,StackTraceElement[]> threadStacks = Thread.getAllStackTraces(); |
| | | |
| | | |
| | | // Re-arrange all of the elements by thread ID so that there is some logical |
| | | // order. |
| | | TreeMap<Long,Map.Entry<Thread,StackTraceElement[]>> orderedStacks = |
| | | new TreeMap<Long,Map.Entry<Thread,StackTraceElement[]>>(); |
| | | // Re-arrange all of the elements by thread ID so that there is some logical order. |
| | | TreeMap<Long,Map.Entry<Thread,StackTraceElement[]>> orderedStacks = new TreeMap<>(); |
| | | for (Map.Entry<Thread,StackTraceElement[]> e : threadStacks.entrySet()) |
| | | { |
| | | orderedStacks.put(e.getKey().getId(), e); |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Attribute> attrs = new ArrayList<Attribute>(); |
| | | ArrayList<Attribute> attrs = new ArrayList<>(); |
| | | attrs.add(builder.toAttribute()); |
| | | |
| | | return attrs; |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public ArrayList<Attribute> getMonitorData() |
| | | { |
| | | ArrayList<Attribute> attrs = new ArrayList<Attribute>(13); |
| | | ArrayList<Attribute> attrs = new ArrayList<>(13); |
| | | |
| | | attrs.add(createAttribute("javaVersion", |
| | | System.getProperty("java.version"))); |
| | |
| | | */ |
| | | package org.opends.server.monitors; |
| | | |
| | | |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import org.opends.server.admin.std.server.MonitorProviderCfg; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.TraditionalWorkQueue; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a Directory Server monitor that can be used to provide |
| | | * information about the state of the work queue. |
| | |
| | | extends MonitorProvider<MonitorProviderCfg> |
| | | implements Runnable |
| | | { |
| | | /** |
| | | * The name to use for the monitor attribute that provides the current request |
| | | * backlog. |
| | | */ |
| | | /** The name to use for the monitor attribute that provides the current request backlog. */ |
| | | public static final String ATTR_CURRENT_BACKLOG = "currentRequestBacklog"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name to use for the monitor attribute that provides the average request |
| | | * backlog. |
| | | */ |
| | | /** The name to use for the monitor attribute that provides the average request backlog. */ |
| | | public static final String ATTR_AVERAGE_BACKLOG = "averageRequestBacklog"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name to use for the monitor attribute that provides the maximum |
| | | * observed request backlog. |
| | | */ |
| | | public static final String ATTR_MAX_BACKLOG = "maxRequestBacklog"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name to use for the monitor attribute that provides the total number of |
| | | * operations submitted. |
| | | */ |
| | | public static final String ATTR_OPS_SUBMITTED = "requestsSubmitted"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name to use for the monitor attribute that provides the total number of |
| | | * requests that have been rejected because the work queue was full. |
| | | */ |
| | | public static final String ATTR_OPS_REJECTED_QUEUE_FULL = |
| | | "requestsRejectedDueToQueueFull"; |
| | | |
| | | public static final String ATTR_OPS_REJECTED_QUEUE_FULL = "requestsRejectedDueToQueueFull"; |
| | | |
| | | |
| | | /** The maximum backlog observed by polling the queue. */ |
| | | private int maxBacklog; |
| | | |
| | | /** The total number of times the backlog has been polled. */ |
| | | private long numPolls; |
| | | |
| | | /** The total backlog observed from periodic polling. */ |
| | | private long totalBacklog; |
| | | |
| | | /** The traditional work queue instance with which this monitor is associated. */ |
| | | private TraditionalWorkQueue workQueue; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Initializes this monitor provider. Note that no initialization should be |
| | | * done here, since it should be performed in the |
| | |
| | | long opsSubmitted = workQueue.getOpsSubmitted(); |
| | | long rejectedQueueFull = workQueue.getOpsRejectedDueToQueueFull(); |
| | | |
| | | ArrayList<Attribute> monitorAttrs = new ArrayList<Attribute>(); |
| | | Syntax integerSyntax = DirectoryServer.getDefaultIntegerSyntax(); |
| | | |
| | | // The current backlog. |
| | | AttributeType attrType = DirectoryServer.getDefaultAttributeType( |
| | | ATTR_CURRENT_BACKLOG, integerSyntax); |
| | | monitorAttrs |
| | | .add(Attributes.create(attrType, String.valueOf(backlog))); |
| | | |
| | | // The average backlog. |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_AVERAGE_BACKLOG, |
| | | integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String |
| | | .valueOf(averageBacklog))); |
| | | |
| | | // The maximum backlog. |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_MAX_BACKLOG, |
| | | integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String |
| | | .valueOf(maxBacklog))); |
| | | |
| | | ArrayList<Attribute> monitorAttrs = new ArrayList<>(); |
| | | putAttribute(monitorAttrs, ATTR_CURRENT_BACKLOG, backlog); |
| | | putAttribute(monitorAttrs, ATTR_AVERAGE_BACKLOG, averageBacklog); |
| | | putAttribute(monitorAttrs, ATTR_MAX_BACKLOG, maxBacklog); |
| | | // The total number of operations submitted. |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_OPS_SUBMITTED, |
| | | integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String |
| | | .valueOf(opsSubmitted))); |
| | | |
| | | putAttribute(monitorAttrs, ATTR_OPS_SUBMITTED, opsSubmitted); |
| | | // The total number of operations rejected due to a full work queue. |
| | | attrType = DirectoryServer.getDefaultAttributeType( |
| | | ATTR_OPS_REJECTED_QUEUE_FULL, integerSyntax); |
| | | monitorAttrs.add(Attributes.create(attrType, String |
| | | .valueOf(rejectedQueueFull))); |
| | | |
| | | putAttribute(monitorAttrs, ATTR_OPS_REJECTED_QUEUE_FULL, rejectedQueueFull); |
| | | return monitorAttrs; |
| | | } |
| | | } |
| | | |
| | | private void putAttribute(ArrayList<Attribute> monitorAttrs, String attrName, Object value) |
| | | { |
| | | AttributeType attrType = getDefaultAttributeType(attrName, getDefaultIntegerSyntax()); |
| | | monitorAttrs.add(Attributes.create(attrType, String.valueOf(value))); |
| | | } |
| | | } |
| | |
| | | */ |
| | | public ArrayList<Attribute> getMonitorData() |
| | | { |
| | | ArrayList<Attribute> attrs = new ArrayList<Attribute>(12); |
| | | ArrayList<Attribute> attrs = new ArrayList<>(12); |
| | | |
| | | attrs.add(createAttribute(ATTR_PRODUCT_NAME, |
| | | DynamicConstants.PRODUCT_NAME)); |
| | |
| | | /* Apply the change, as at this point is has been validated. */ |
| | | this.config = config; |
| | | |
| | | attributesToRename = new HashMap<String, String>(); |
| | | attributesToRename = new HashMap<>(); |
| | | for (final String mapping : config.getRenameInboundAttributes()) |
| | | { |
| | | final int colonPos = mapping.lastIndexOf(":"); |
| | |
| | | attributesToRename.put(toLowerCase(fromAttr), toLowerCase(toAttr)); |
| | | } |
| | | |
| | | attributesToRemove = new HashSet<String>(); |
| | | attributesToRemove = new HashSet<>(); |
| | | for (final String attr : config.getRemoveInboundAttributes()) |
| | | { |
| | | attributesToRemove.add(toLowerCase(attr.trim())); |
| | |
| | | } |
| | | |
| | | /* Verify the current configuration. */ |
| | | final List<LocalizableMessage> messages = new LinkedList<LocalizableMessage>(); |
| | | final List<LocalizableMessage> messages = new LinkedList<>(); |
| | | if (!isConfigurationChangeAcceptable(configuration, messages)) |
| | | { |
| | | throw new ConfigException(messages.get(0)); |
| | |
| | | * Verify that there are no duplicate mappings and that attributes are |
| | | * renamed to valid attribute types. |
| | | */ |
| | | final Set<String> fromAttrs = new HashSet<String>(); |
| | | final Set<String> fromAttrs = new HashSet<>(); |
| | | for (final String attr : config.getRenameInboundAttributes()) |
| | | { |
| | | /* |
| | |
| | | */ |
| | | private void processInboundRemove(final PreParseAddOperation addOperation) |
| | | { |
| | | final List<RawAttribute> inAttrs = new LinkedList<RawAttribute>( |
| | | addOperation.getRawAttributes()); |
| | | final List<RawAttribute> inAttrs = new LinkedList<>(addOperation.getRawAttributes()); |
| | | final ListIterator<RawAttribute> iterator = inAttrs.listIterator(); |
| | | while (iterator.hasNext()) |
| | | { |
| | |
| | | private void processInboundRemove( |
| | | final PreParseModifyOperation modifyOperation) |
| | | { |
| | | final List<RawModification> rawMods = new LinkedList<RawModification>( |
| | | modifyOperation.getRawModifications()); |
| | | final List<RawModification> rawMods = new LinkedList<>(modifyOperation.getRawModifications()); |
| | | final ListIterator<RawModification> iterator = rawMods.listIterator(); |
| | | while (iterator.hasNext()) |
| | | { |
| | |
| | | */ |
| | | private void processInboundRename(final PreParseAddOperation addOperation) |
| | | { |
| | | final List<RawAttribute> inAttrs = new LinkedList<RawAttribute>( |
| | | addOperation.getRawAttributes()); |
| | | final List<RawAttribute> inAttrs = new LinkedList<>(addOperation.getRawAttributes()); |
| | | final ListIterator<RawAttribute> iterator = inAttrs.listIterator(); |
| | | while (iterator.hasNext()) |
| | | { |
| | |
| | | private void processInboundRename( |
| | | final PreParseModifyOperation modifyOperation) |
| | | { |
| | | final List<RawModification> rawMods = new LinkedList<RawModification>( |
| | | modifyOperation.getRawModifications()); |
| | | final List<RawModification> rawMods = new LinkedList<>(modifyOperation.getRawModifications()); |
| | | final ListIterator<RawModification> iterator = rawMods.listIterator(); |
| | | while (iterator.hasNext()) |
| | | { |
| | |
| | | { |
| | | currentConfig = configuration; |
| | | configuration.addChangeNumberControlChangeListener(this); |
| | | Set<PluginType> types = new TreeSet<PluginType>(); |
| | | Set<PluginType> types = new TreeSet<>(); |
| | | |
| | | // Make sure that the plugin has been enabled for the appropriate types. |
| | | for (PluginType t : pluginTypes) |
| | |
| | | UUID uuid = UUID.nameUUIDFromBytes(dnBytes); |
| | | |
| | | Attribute uuidAttr = Attributes.create(entryUUIDType, uuid.toString()); |
| | | uuidList = new ArrayList<Attribute>(1); |
| | | uuidList = new ArrayList<>(1); |
| | | uuidList.add(uuidAttr); |
| | | entry.putAttribute(entryUUIDType, uuidList); |
| | | |
| | |
| | | // Construct a new random UUID. |
| | | UUID uuid = UUID.randomUUID(); |
| | | Attribute uuidAttr = Attributes.create(entryUUIDType, uuid.toString()); |
| | | uuidList = new ArrayList<Attribute>(1); |
| | | uuidList = new ArrayList<>(1); |
| | | uuidList.add(uuidAttr); |
| | | |
| | | |
| | |
| | | |
| | | if (foundOC) |
| | | { |
| | | final LinkedHashSet<String> newAttrs = new LinkedHashSet<String>(); |
| | | final LinkedHashSet<String> newAttrs = new LinkedHashSet<>(); |
| | | for (final String attrName : attributes) |
| | | { |
| | | if (attrName.startsWith("@")) |
| | |
| | | builder.add(creatorDN.toString()); |
| | | } |
| | | Attribute nameAttr = builder.toAttribute(); |
| | | ArrayList<Attribute> nameList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> nameList = new ArrayList<>(1); |
| | | nameList.add(nameAttr); |
| | | addOperation.setAttribute(creatorsNameType, nameList); |
| | | |
| | |
| | | // Create the attribute list for the createTimestamp attribute. |
| | | Attribute timeAttr = Attributes.create(createTimestampType, |
| | | OP_ATTR_CREATE_TIMESTAMP, getGMTTime()); |
| | | ArrayList<Attribute> timeList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> timeList = new ArrayList<>(1); |
| | | timeList.add(timeAttr); |
| | | addOperation.setAttribute(createTimestampType, timeList); |
| | | |
| | |
| | | { |
| | | // Find the set of attribute types with the auth password and user password |
| | | // syntax defined in the schema. |
| | | HashSet<AttributeType> authPWTypes = new HashSet<AttributeType>(); |
| | | HashSet<AttributeType> userPWTypes = new HashSet<AttributeType>(); |
| | | HashSet<AttributeType> authPWTypes = new HashSet<>(); |
| | | HashSet<AttributeType> userPWTypes = new HashSet<>(); |
| | | for (AttributeType t : DirectoryServer.getAttributeTypes().values()) |
| | | { |
| | | if (t.getSyntax().getOID().equals(SYNTAX_AUTH_PASSWORD_OID)) |
| | |
| | | |
| | | // Get the set of password policies defined in the server and get the |
| | | // attribute types associated with them. |
| | | HashMap<DN,PasswordStorageScheme<?>[]> schemeMap = |
| | | new HashMap<DN,PasswordStorageScheme<?>[]>(); |
| | | HashMap<DN,PasswordStorageScheme<?>[]> schemeMap = new HashMap<>(); |
| | | for (AuthenticationPolicy ap : DirectoryServer.getAuthenticationPolicies()) |
| | | { |
| | | if (ap.isPasswordPolicy()) |
| | | { |
| | | PasswordPolicy p = (PasswordPolicy) ap; |
| | | |
| | | List<PasswordStorageScheme<?>> schemeList = p |
| | | .getDefaultPasswordStorageSchemes(); |
| | | List<PasswordStorageScheme<?>> schemeList = p.getDefaultPasswordStorageSchemes(); |
| | | PasswordStorageScheme<?>[] schemeArray = |
| | | new PasswordStorageScheme[schemeList.size()]; |
| | | schemeList.toArray(schemeArray); |
| | |
| | | /** Current plugin configuration. */ |
| | | private ReferentialIntegrityPluginCfg currentConfiguration; |
| | | |
| | | /** |
| | | * List of attribute types that will be checked during referential integrity |
| | | * processing. |
| | | */ |
| | | private LinkedHashSet<AttributeType> |
| | | attributeTypes = new LinkedHashSet<AttributeType>(); |
| | | |
| | | /** List of attribute types that will be checked during referential integrity processing. */ |
| | | private LinkedHashSet<AttributeType> attributeTypes = new LinkedHashSet<>(); |
| | | /** List of base DNs that limit the scope of the referential integrity checking. */ |
| | | private Set<DN> baseDNs = new LinkedHashSet<DN>(); |
| | | private Set<DN> baseDNs = new LinkedHashSet<>(); |
| | | |
| | | /** |
| | | * The update interval the background thread uses. If it is 0, then |
| | |
| | | * attributeTypes list) and the filter which the plugin should use |
| | | * to verify the integrity of the value of the given attribute. |
| | | */ |
| | | private LinkedHashMap<AttributeType, SearchFilter> attrFiltMap = |
| | | new LinkedHashMap<AttributeType, SearchFilter>(); |
| | | private LinkedHashMap<AttributeType, SearchFilter> attrFiltMap = new LinkedHashMap<>(); |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | throws ConfigException |
| | | { |
| | | pluginCfg.addReferentialIntegrityChangeListener(this); |
| | | LinkedList<LocalizableMessage> unacceptableReasons = new LinkedList<LocalizableMessage>(); |
| | | LinkedList<LocalizableMessage> unacceptableReasons = new LinkedList<>(); |
| | | |
| | | if (!isConfigurationAcceptable(pluginCfg, unacceptableReasons)) |
| | | { |
| | |
| | | final ConfigChangeResult ccr = new ConfigChangeResult(); |
| | | |
| | | //Load base DNs from new configuration. |
| | | LinkedHashSet<DN> newConfiguredBaseDNs = new LinkedHashSet<DN>(newConfiguration.getBaseDN()); |
| | | LinkedHashSet<DN> newConfiguredBaseDNs = new LinkedHashSet<>(newConfiguration.getBaseDN()); |
| | | //Load attribute types from new configuration. |
| | | LinkedHashSet<AttributeType> newAttributeTypes = |
| | | new LinkedHashSet<AttributeType>(newConfiguration.getAttributeType()); |
| | | new LinkedHashSet<>(newConfiguration.getAttributeType()); |
| | | |
| | | // Load the attribute-filter mapping |
| | | |
| | | LinkedHashMap<AttributeType, SearchFilter> newAttrFiltMap = |
| | | new LinkedHashMap<AttributeType, SearchFilter>(); |
| | | LinkedHashMap<AttributeType, SearchFilter> newAttrFiltMap = new LinkedHashMap<>(); |
| | | |
| | | for (String attrFilt : newConfiguration.getCheckReferencesFilterCriteria()) |
| | | { |
| | |
| | | (Map<DN, DN>) modifyDNOperation.getAttachment(MODIFYDN_DNS); |
| | | if(modDNmap == null) |
| | | { |
| | | modDNmap=new LinkedHashMap<DN,DN>(); |
| | | modDNmap = new LinkedHashMap<>(); |
| | | modifyDNOperation.setAttachment(MODIFYDN_DNS, modDNmap); |
| | | } |
| | | DN oldEntryDN=modifyDNOperation.getOriginalEntry().getName(); |
| | |
| | | (Set<DN>) deleteOperation.getAttachment(DELETE_DNS); |
| | | if(deleteDNset == null) |
| | | { |
| | | deleteDNset = new HashSet<DN>(); |
| | | deleteDNset = new HashSet<>(); |
| | | deleteOperation.setAttachment(MODIFYDN_DNS, deleteDNset); |
| | | } |
| | | deleteDNset.add(deleteOperation.getEntryDN()); |
| | |
| | | (Map<DN, DN>) modifyDNOperation.getAttachment(MODIFYDN_DNS); |
| | | if(modDNmap == null) |
| | | { |
| | | //First time through, create the map and set it in the operation |
| | | //attachment. |
| | | modDNmap=new LinkedHashMap<DN,DN>(); |
| | | // First time through, create the map and set it in the operation attachment. |
| | | modDNmap = new LinkedHashMap<>(); |
| | | modifyDNOperation.setAttachment(MODIFYDN_DNS, modDNmap); |
| | | } |
| | | modDNmap.put(oldEntry.getName(), newEntry.getName()); |
| | |
| | | public PluginResult.SubordinateDelete processSubordinateDelete( |
| | | DeleteOperation deleteOperation, Entry entry) |
| | | { |
| | | // This cast gives an unchecked cast warning, suppress it |
| | | // since the cast is ok. |
| | | Set<DN> deleteDNset = |
| | | (Set<DN>) deleteOperation.getAttachment(DELETE_DNS); |
| | | // This cast gives an unchecked cast warning, suppress it since the cast is ok. |
| | | Set<DN> deleteDNset = (Set<DN>) deleteOperation.getAttachment(DELETE_DNS); |
| | | if(deleteDNset == null) |
| | | { |
| | | // First time through, create the set and set it in |
| | | // the operation attachment. |
| | | deleteDNset = new HashSet<DN>(); |
| | | // First time through, create the set and set it in the operation attachment. |
| | | deleteDNset = new HashSet<>(); |
| | | deleteOperation.setAttachment(DELETE_DNS, deleteDNset); |
| | | } |
| | | deleteDNset.add(entry.getName()); |
| | |
| | | * or "name and optional UID" syntax. |
| | | * |
| | | * @param attribute The attribute to check the syntax of. |
| | | * |
| | | * @return Returns <code>true</code> if the attribute has a valid syntax. |
| | | * |
| | | */ |
| | | private boolean isAttributeSyntaxValid(AttributeType attribute) |
| | | { |
| | |
| | | { |
| | | //Build an equality search with all of the configured attribute types |
| | | //and the old entry DN. |
| | | HashSet<SearchFilter> componentFilters=new HashSet<SearchFilter>(); |
| | | HashSet<SearchFilter> componentFilters=new HashSet<>(); |
| | | for(AttributeType attributeType : attributeTypes) |
| | | { |
| | | componentFilters.add(SearchFilter.createEqualityFilter(attributeType, |
| | |
| | | */ |
| | | private void deleteAddAttributesEntry(Entry e, DN oldEntryDN, DN newEntryDN) |
| | | { |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | DN entryDN=e.getName(); |
| | | for(AttributeType type : attributeTypes) |
| | | { |
| | |
| | | { |
| | | |
| | | // Verify config parameters. |
| | | final LinkedList<LocalizableMessage> messages = new LinkedList<LocalizableMessage>(); |
| | | final LinkedList<LocalizableMessage> messages = new LinkedList<>(); |
| | | if (!isConfigurationAcceptable(configuration, messages)) |
| | | { |
| | | for (final LocalizableMessage m : messages) |
| | |
| | | */ |
| | | private List<Modification> getModifications(final String password) |
| | | { |
| | | ArrayList<Modification> modifications = new ArrayList<Modification>(); |
| | | ArrayList<Modification> modifications = new ArrayList<>(); |
| | | try |
| | | { |
| | | if (config.getPwdSyncPolicy().contains(PwdSyncPolicy.SYNC_NT_PASSWORD)) |
| | |
| | | * The set of attributes that will be requested when performing internal |
| | | * search operations. This indicates that no attributes should be returned. |
| | | */ |
| | | private static final Set<String> SEARCH_ATTRS = new LinkedHashSet<String>(1); |
| | | private static final Set<String> SEARCH_ATTRS = new LinkedHashSet<>(1); |
| | | static |
| | | { |
| | | SEARCH_ATTRS.add(SchemaConstants.NO_ATTRIBUTES); |
| | |
| | | } |
| | | } |
| | | |
| | | uniqueAttrValue2Dn = new ConcurrentHashMap<ByteString,DN>(); |
| | | uniqueAttrValue2Dn = new ConcurrentHashMap<>(); |
| | | DirectoryServer.registerAlertGenerator(this); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | DN entryDN = entry.getName(); |
| | | List<ByteString> recordedValues = new LinkedList<ByteString>(); |
| | | List<ByteString> recordedValues = new LinkedList<>(); |
| | | for (AttributeType t : config.getType()) |
| | | { |
| | | List<Attribute> attrList = entry.getAttribute(t); |
| | |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | List<ByteString> recordedValues = new LinkedList<ByteString>(); |
| | | List<ByteString> recordedValues = new LinkedList<>(); |
| | | for (Modification m : modifyOperation.getModifications()) |
| | | { |
| | | Attribute a = m.getAttribute(); |
| | |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | List<ByteString> recordedValues = new LinkedList<ByteString>(); |
| | | List<ByteString> recordedValues = new LinkedList<>(); |
| | | RDN newRDN = modifyDNOperation.getNewRDN(); |
| | | for (int i=0; i < newRDN.getNumValues(); i++) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | List<SearchFilter> equalityFilters = |
| | | new ArrayList<SearchFilter>(attrTypes.size()); |
| | | List<SearchFilter> equalityFilters = new ArrayList<>(attrTypes.size()); |
| | | for (AttributeType t : attrTypes) |
| | | { |
| | | equalityFilters.add(SearchFilter.createEqualityFilter(t, value)); |
| | |
| | | @Override |
| | | public Map<String,String> getAlerts() |
| | | { |
| | | Map<String,String> alerts = new LinkedHashMap<String,String>(2); |
| | | Map<String,String> alerts = new LinkedHashMap<>(2); |
| | | |
| | | alerts.put(ALERT_TYPE_UNIQUE_ATTR_SYNC_CONFLICT, |
| | | ALERT_DESCRIPTION_UNIQUE_ATTR_SYNC_CONFLICT); |
| | |
| | | this.className = className; |
| | | this.methodName = methodName; |
| | | |
| | | lineNumbers = new HashMap<Integer,Long>(); |
| | | subordinateFrames = new HashMap<ProfileStackFrame,ProfileStackFrame>(); |
| | | lineNumbers = new HashMap<>(); |
| | | subordinateFrames = new HashMap<>(); |
| | | } |
| | | |
| | | |
| | |
| | | HashMap<ProfileStack,Long> stackMap = stacksByMethod.get(classAndMethod); |
| | | if (stackMap == null) |
| | | { |
| | | stackMap = new HashMap<ProfileStack,Long>(); |
| | | stackMap = new HashMap<>(); |
| | | stacksByMethod.put(classAndMethod, stackMap); |
| | | } |
| | | stackMap.put(stack, count); |
| | |
| | | */ |
| | | public ProfileViewer() |
| | | { |
| | | rootFrames = new HashMap<ProfileStackFrame,ProfileStackFrame>(); |
| | | stacksByMethod = new HashMap<String,HashMap<ProfileStack,Long>>(); |
| | | rootFrames = new HashMap<>(); |
| | | stacksByMethod = new HashMap<>(); |
| | | totalDuration = 0; |
| | | totalIntervals = 0; |
| | | } |
| | |
| | | stacksByMethod.get(classAndMethod); |
| | | if (stackMap == null) |
| | | { |
| | | stackMap = new HashMap<ProfileStack,Long>(); |
| | | stackMap = new HashMap<>(); |
| | | stacksByMethod.put(classAndMethod, stackMap); |
| | | } |
| | | stackMap.put(stack, count); |
| | |
| | | |
| | | this.sampleInterval = sampleInterval; |
| | | |
| | | stackTraces = new HashMap<ProfileStack,Long>(); |
| | | stackTraces = new HashMap<>(); |
| | | numIntervals = 0; |
| | | stopProfiling = false; |
| | | captureStartTime = -1; |
| | |
| | | /** {@inheritDoc} */ |
| | | public LinkedHashMap<String,String> getAlerts() |
| | | { |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(ALERT_TYPE_LDIF_CONNHANDLER_PARSE_ERROR, |
| | | ALERT_DESCRIPTION_LDIF_CONNHANDLER_PARSE_ERROR); |
| | |
| | | * The Map (messageID => {@link OperationWithPromise}) of all operations |
| | | * currently in progress on this connection. |
| | | */ |
| | | private final Map<Integer, OperationWithPromise> operationsInProgress = |
| | | new ConcurrentHashMap<Integer, OperationWithPromise>(); |
| | | private final Map<Integer, OperationWithPromise> operationsInProgress = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * The number of operations performed on this connection. Used to compare with |
| | |
| | | public Collection<Operation> getOperationsInProgress() |
| | | { |
| | | Collection<OperationWithPromise> values = operationsInProgress.values(); |
| | | Collection<Operation> results = new ArrayList<Operation>(values.size()); |
| | | Collection<Operation> results = new ArrayList<>(values.size()); |
| | | for (OperationWithPromise op : values) |
| | | { |
| | | results.add(op.operation); |
| | |
| | | private boolean enabled; |
| | | |
| | | /** The set of listeners for this connection handler. */ |
| | | private List<HostPort> listeners = new LinkedList<HostPort>(); |
| | | private List<HostPort> listeners = new LinkedList<>(); |
| | | |
| | | /** The HTTP server embedded in OpenDJ. */ |
| | | private HttpServer httpServer; |
| | |
| | | * ensure no concurrent reads/writes can happen and adds/removes are fast. We |
| | | * only use the keys, so it does not matter what value is put there. |
| | | */ |
| | | private Map<ClientConnection, ClientConnection> clientConnections = |
| | | new ConcurrentHashMap<ClientConnection, ClientConnection>(); |
| | | private Map<ClientConnection, ClientConnection> clientConnections = new ConcurrentHashMap<>(); |
| | | |
| | | /** The set of statistics collected for this connection handler. */ |
| | | private HTTPStatistics statTracker; |
| | | |
| | | /** |
| | | * The client connection monitor provider associated with this connection |
| | | * handler. |
| | | */ |
| | | /** The client connection monitor provider associated with this connection handler. */ |
| | | private ClientConnectionMonitorProvider connMonitor; |
| | | |
| | | /** The unique name assigned to this connection handler. */ |
| | |
| | | |
| | | /** |
| | | * The condition variable that will be used by the start method to wait for |
| | | * the socket port to be opened and ready to process requests before |
| | | * returning. |
| | | * the socket port to be opened and ready to process requests before returning. |
| | | */ |
| | | private final Object waitListen = new Object(); |
| | | |
| | |
| | | @Override |
| | | public Map<String, String> getAlerts() |
| | | { |
| | | Map<String, String> alerts = new LinkedHashMap<String, String>(); |
| | | Map<String, String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(ALERT_TYPE_HTTP_CONNECTION_HANDLER_CONSECUTIVE_FAILURES, |
| | | ALERT_DESCRIPTION_HTTP_CONNECTION_HANDLER_CONSECUTIVE_FAILURES); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013 ForgeRock AS |
| | | * Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.http; |
| | | |
| | |
| | | * The keys are static because they need to be listed in the schema which is |
| | | * static. |
| | | */ |
| | | private Map<String, AtomicInteger> requestMethodsTotalCount = |
| | | new HashMap<String, AtomicInteger>(); |
| | | private Map<String, AtomicInteger> requestMethodsTotalCount = new HashMap<>(); |
| | | /** |
| | | * Map containing the total execution time for the requests per HTTP methods. |
| | | * <p> |
| | |
| | | * The keys are static because they need to be listed in the schema which is |
| | | * static. |
| | | */ |
| | | private Map<String, AtomicLong> requestMethodsTotalTime = |
| | | new HashMap<String, AtomicLong>(); |
| | | private Map<String, AtomicLong> requestMethodsTotalTime = new HashMap<>(); |
| | | /** |
| | | * Total number of requests. The total number may be different than the sum of |
| | | * the supported HTTP methods above because clients could use unsupported HTTP |
| | |
| | | { |
| | | // first take a snapshot of all the data as fast as possible |
| | | final int totalCount = this.requestsTotalCount.get(); |
| | | final Map<String, Integer> totalCountsSnapshot = |
| | | new HashMap<String, Integer>(); |
| | | for (Entry<String, AtomicInteger> entry : this.requestMethodsTotalCount |
| | | .entrySet()) |
| | | final Map<String, Integer> totalCountsSnapshot = new HashMap<>(); |
| | | for (Entry<String, AtomicInteger> entry : requestMethodsTotalCount.entrySet()) |
| | | { |
| | | totalCountsSnapshot.put(entry.getKey(), entry.getValue().get()); |
| | | } |
| | | final Map<String, Long> totalTimesSnapshot = new HashMap<String, Long>(); |
| | | for (Entry<String, AtomicLong> entry1 : this.requestMethodsTotalTime |
| | | .entrySet()) |
| | | final Map<String, Long> totalTimesSnapshot = new HashMap<>(); |
| | | for (Entry<String, AtomicLong> entry1 : requestMethodsTotalTime.entrySet()) |
| | | { |
| | | totalTimesSnapshot.put(entry1.getKey(), entry1.getValue().get()); |
| | | } |
| | | |
| | | // do the same with the underlying data |
| | | final List<Attribute> results = super.getMonitorData(); |
| | | |
| | | addAll(results, totalCountsSnapshot, "ds-mon-http-", |
| | | "-requests-total-count"); |
| | | addAll(results, totalTimesSnapshot, "ds-mon-resident-time-http-", |
| | | "-requests-total-time"); |
| | | results.add(createAttribute("ds-mon-http-requests-total-count", Integer |
| | | .toString(totalCount))); |
| | | |
| | | addAll(results, totalCountsSnapshot, "ds-mon-http-", "-requests-total-count"); |
| | | addAll(results, totalTimesSnapshot, "ds-mon-resident-time-http-", "-requests-total-time"); |
| | | results.add(createAttribute("ds-mon-http-requests-total-count", Integer.toString(totalCount))); |
| | | return results; |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | private final List<Control> controls = new LinkedList<Control>(); |
| | | private final List<Control> controls = new LinkedList<>(); |
| | | |
| | | /** Default constructor. */ |
| | | AbstractRequestImpl() { |
| | |
| | | String fullDNString = shortDNString + ",cn=Root DNs,cn=config"; |
| | | try |
| | | { |
| | | LinkedHashMap<ObjectClass,String> objectClasses = |
| | | new LinkedHashMap<ObjectClass,String>(); |
| | | LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(); |
| | | ObjectClass topOC = DirectoryServer.getTopObjectClass(); |
| | | ObjectClass personOC = DirectoryServer.getObjectClass(OC_PERSON, |
| | | true); |
| | | ObjectClass rootOC = DirectoryServer.getObjectClass(OC_ROOT_DN, |
| | | true); |
| | | ObjectClass personOC = DirectoryServer.getObjectClass(OC_PERSON, true); |
| | | ObjectClass rootOC = DirectoryServer.getObjectClass(OC_ROOT_DN, true); |
| | | |
| | | objectClasses.put(topOC, topOC.getPrimaryName()); |
| | | objectClasses.put(personOC, personOC.getPrimaryName()); |
| | | objectClasses.put(rootOC, rootOC.getPrimaryName()); |
| | | |
| | | |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(); |
| | | AttributeType cnAT = |
| | | DirectoryServer.getAttributeType(ATTR_COMMON_NAME, true); |
| | | AttributeType snAT = DirectoryServer.getAttributeType(ATTR_SN, |
| | | true); |
| | | AttributeType snAT = DirectoryServer.getAttributeType(ATTR_SN, true); |
| | | AttributeType altDNAT = |
| | | DirectoryServer.getAttributeType( |
| | | ATTR_ROOTDN_ALTERNATE_BIND_DN, true); |
| | | |
| | | LinkedList<Attribute> attrList = new LinkedList<Attribute>(); |
| | | attrList.add(Attributes.create(ATTR_COMMON_NAME, |
| | | commonName)); |
| | | LinkedList<Attribute> attrList = new LinkedList<>(); |
| | | attrList.add(Attributes.create(ATTR_COMMON_NAME, commonName)); |
| | | userAttrs.put(cnAT, attrList); |
| | | |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | attrList.add(Attributes.create(ATTR_SN, commonName)); |
| | | userAttrs.put(snAT, attrList); |
| | | |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList.add(Attributes.create( |
| | | ATTR_ROOTDN_ALTERNATE_BIND_DN, |
| | | shortDNString)); |
| | | attrList = new LinkedList<>(); |
| | | attrList.add(Attributes.create(ATTR_ROOTDN_ALTERNATE_BIND_DN, shortDNString)); |
| | | userAttrs.put(altDNAT, attrList); |
| | | |
| | | |
| | | LinkedHashMap<AttributeType,List<Attribute>> operationalAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> operationalAttrs = new LinkedHashMap<>(); |
| | | |
| | | AttributeType privType = |
| | | DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME, |
| | | true); |
| | | DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME, true); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(privType); |
| | | for (Privilege p : Privilege.getDefaultRootPrivileges()) |
| | | { |
| | | builder.add(p.getName()); |
| | | } |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | attrList.add(builder.toAttribute()); |
| | | |
| | | operationalAttrs.put(privType, attrList); |
| | | |
| | | |
| | | DN internalUserDN = DN.valueOf(fullDNString); |
| | | Entry internalUserEntry = |
| | | new Entry(internalUserDN, objectClasses, userAttrs, |
| | | operationalAttrs); |
| | | Entry internalUserEntry = new Entry( |
| | | internalUserDN, objectClasses, userAttrs, operationalAttrs); |
| | | |
| | | this.authenticationInfo = |
| | | new AuthenticationInfo(internalUserEntry, true); |
| | | this.authenticationInfo = new AuthenticationInfo(internalUserEntry, true); |
| | | super.setAuthenticationInfo(authenticationInfo); |
| | | super.setSizeLimit(0); |
| | | super.setTimeLimit(0); |
| | |
| | | */ |
| | | public AddOperation processAdd(AddChangeRecordEntry addRecord) |
| | | { |
| | | LinkedHashMap<ObjectClass,String> objectClasses = |
| | | new LinkedHashMap<ObjectClass,String>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(); |
| | | |
| | | Entry e = new Entry(addRecord.getDN(), objectClasses, userAttrs, opAttrs); |
| | | |
| | | ArrayList<ByteString> duplicateValues = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> duplicateValues = new ArrayList<>(); |
| | | for (Attribute a : addRecord.getAttributes()) |
| | | { |
| | | if (a.getAttributeType().isObjectClass()) |
| | |
| | | // method will always be called for this method, we'll do the |
| | | // necessary "initialization" here. |
| | | protocol = "internal"; |
| | | connectionList = new LinkedList<ClientConnection>(); |
| | | listeners = new LinkedList<HostPort>(); |
| | | connectionList = new LinkedList<>(); |
| | | listeners = new LinkedList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | public InternalLDAPInputStream(InternalLDAPSocket socket) |
| | | { |
| | | this.socket = socket; |
| | | this.messageQueue = new ArrayBlockingQueue<LDAPMessage>(10); |
| | | this.messageQueue = new ArrayBlockingQueue<>(10); |
| | | this.messageBuffer = new ByteStringBuilder(); |
| | | this.messageReader = messageBuffer.asReader(); |
| | | this.writer = ASN1.getWriter(messageBuffer); |
| | |
| | | if (searchListener == null) |
| | | { |
| | | this.searchListener = null; |
| | | this.entryList = new LinkedList<SearchResultEntry>(); |
| | | this.referenceList = new LinkedList<SearchResultReference>(); |
| | | this.entryList = new LinkedList<>(); |
| | | this.referenceList = new LinkedList<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | /** |
| | | * Use a LinkedHashSet to return the attributes in the same order as requested by the user. |
| | | */ |
| | | private final Set<String> attributes = new LinkedHashSet<String>(); |
| | | private final Set<String> attributes = new LinkedHashSet<>(); |
| | | private DereferenceAliasesPolicy dereferenceAliasesPolicy = DereferenceAliasesPolicy.NEVER; |
| | | private SearchFilter filter; |
| | | private DN name; |
| | |
| | | disconnect(DisconnectReason.ADMIN_LIMIT_EXCEEDED, true, |
| | | ERR_CONNHANDLER_REJECTED_BY_SERVER.get()); |
| | | } |
| | | operationList = new LinkedList<Operation>(); |
| | | operationList = new LinkedList<>(); |
| | | |
| | | // Register the Jmx Notification listener (this) |
| | | jmxConnectionHandler.getRMIConnector().jmxRmiConnectorNoClientCertificate |
| | |
| | | private String protocol; |
| | | |
| | | /** The set of listeners for this connection handler. */ |
| | | private final List<HostPort> listeners = new LinkedList<HostPort>(); |
| | | private final List<HostPort> listeners = new LinkedList<>(); |
| | | |
| | | /** |
| | | * Creates a new instance of this JMX connection handler. It must be |
| | |
| | | public JmxConnectionHandler() { |
| | | super("JMX Connection Handler Thread"); |
| | | |
| | | this.connectionList = new CopyOnWriteArrayList<ClientConnection>(); |
| | | this.connectionList = new CopyOnWriteArrayList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | // Configuration is ok. |
| | | currentConfig = config; |
| | | |
| | | final List<LocalizableMessage> reasons = new LinkedList<LocalizableMessage>(); |
| | | final List<LocalizableMessage> reasons = new LinkedList<>(); |
| | | if (!isPortConfigurationAcceptable(String.valueOf(config.dn()), |
| | | config.getListenPort(), reasons)) |
| | | { |
| | |
| | | try |
| | | { |
| | | // Environment map |
| | | HashMap<String, Object> env = new HashMap<String, Object>(); |
| | | HashMap<String, Object> env = new HashMap<>(); |
| | | |
| | | // --------------------- |
| | | // init an ssl context |
| | |
| | | public AddRequestProtocolOp(ByteString dn) |
| | | { |
| | | this.dn = dn; |
| | | this.attributes = new ArrayList<RawAttribute>(); |
| | | this.attributes = new ArrayList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (attributes == null) |
| | | { |
| | | this.attributes = new ArrayList<RawAttribute>(); |
| | | this.attributes = new ArrayList<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | { |
| | | this.attributeType = attributeType; |
| | | |
| | | values = new ArrayList<ByteString>(0); |
| | | values = new ArrayList<>(0); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | this.attributeType = attributeType; |
| | | |
| | | values = new ArrayList<ByteString>(1); |
| | | values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf(value)); |
| | | } |
| | | |
| | |
| | | { |
| | | this.attributeType = attributeType; |
| | | |
| | | values = new ArrayList<ByteString>(1); |
| | | values = new ArrayList<>(1); |
| | | values.add(value); |
| | | } |
| | | |
| | |
| | | |
| | | if (values == null) |
| | | { |
| | | this.values = new ArrayList<ByteString>(0); |
| | | this.values = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.values = new ArrayList<ByteString>(values.size()); |
| | | this.values = new ArrayList<>(values.size()); |
| | | for (String value : values) |
| | | { |
| | | this.values.add(ByteString.valueOf(value)); |
| | |
| | | |
| | | if (values == null) |
| | | { |
| | | this.values = new ArrayList<ByteString>(0); |
| | | this.values = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (attribute.isVirtual()) |
| | | { |
| | | values = new ArrayList<ByteString>(); |
| | | values = new ArrayList<>(); |
| | | } |
| | | else if (attribute.isEmpty()) |
| | | { |
| | | values = new ArrayList<ByteString>(0); |
| | | values = new ArrayList<>(0); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | values = new ArrayList<ByteString>(attribute.size()); |
| | | values = new ArrayList<>(attribute.size()); |
| | | } |
| | | |
| | | for (ByteString v : attribute) |
| | |
| | | nextOperationID = new AtomicLong(0); |
| | | connectionValid = true; |
| | | disconnectRequested = false; |
| | | operationsInProgress = new ConcurrentHashMap<Integer, Operation>(); |
| | | operationsInProgress = new ConcurrentHashMap<>(); |
| | | operationsPerformed = new AtomicLong(0); |
| | | keepStats = connectionHandler.keepStats(); |
| | | this.protocol = protocol; |
| | | writeSelector = new AtomicReference<Selector>(); |
| | | writeSelector = new AtomicReference<>(); |
| | | |
| | | final Socket socket = clientChannel.socket(); |
| | | clientAddress = socket.getInetAddress().getHostAddress(); |
| | |
| | | @Override |
| | | public Map<String, String> getAlerts() |
| | | { |
| | | Map<String, String> alerts = new LinkedHashMap<String, String>(); |
| | | Map<String, String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(ALERT_TYPE_LDAP_CONNECTION_HANDLER_CONSECUTIVE_FAILURES, |
| | | ALERT_DESCRIPTION_LDAP_CONNECTION_HANDLER_CONSECUTIVE_FAILURES); |
| | |
| | | @Override |
| | | public Collection<ClientConnection> getClientConnections() |
| | | { |
| | | List<ClientConnection> connectionList = new LinkedList<ClientConnection>(); |
| | | List<ClientConnection> connectionList = new LinkedList<>(); |
| | | for (LDAPRequestHandler requestHandler : requestHandlers) |
| | | { |
| | | connectionList.addAll(requestHandler.getClientConnections()); |
| | |
| | | |
| | | // Construct a unique name for this connection handler, and put |
| | | // together the set of listeners. |
| | | listeners = new LinkedList<HostPort>(); |
| | | listeners = new LinkedList<>(); |
| | | StringBuilder nameBuffer = new StringBuilder(); |
| | | nameBuffer.append(friendlyName); |
| | | for (InetAddress a : listenAddresses) |
| | |
| | | .newSingleThreadScheduledExecutor(new DirectoryThread.Factory( |
| | | "LDAP Connection Finalizer for connection handler " + toString())); |
| | | |
| | | connectionFinalizerActiveJobQueue = new ArrayList<Runnable>(); |
| | | connectionFinalizerPendingJobQueue = new ArrayList<Runnable>(); |
| | | connectionFinalizerActiveJobQueue = new ArrayList<>(); |
| | | connectionFinalizerPendingJobQueue = new ArrayList<>(); |
| | | |
| | | connectionFinalizer.scheduleWithFixedDelay( |
| | | new ConnectionFinalizerRunnable(), 100, 100, TimeUnit.MILLISECONDS); |
| | |
| | | case AND: |
| | | case OR: |
| | | Collection<SearchFilter> comps = filter.getFilterComponents(); |
| | | filterComponents = new ArrayList<RawFilter>(comps.size()); |
| | | filterComponents = new ArrayList<>(comps.size()); |
| | | for (SearchFilter f : comps) |
| | | { |
| | | filterComponents.add(new LDAPFilter(f)); |
| | |
| | | } |
| | | else |
| | | { |
| | | subAnyElements = new ArrayList<ByteString>(subAnyStrings); |
| | | subAnyElements = new ArrayList<>(subAnyStrings); |
| | | } |
| | | |
| | | filterComponents = null; |
| | |
| | | throws LDAPException |
| | | { |
| | | // Create a list to hold the returned components. |
| | | ArrayList<RawFilter> filterComponents = new ArrayList<RawFilter>(); |
| | | ArrayList<RawFilter> filterComponents = new ArrayList<>(); |
| | | |
| | | |
| | | // If the end pos is equal to the start pos, then there are no components. |
| | |
| | | // see if there are any escaped values, since they will need special |
| | | // treatment. |
| | | boolean hasEscape = false; |
| | | LinkedList<Integer> asteriskPositions = new LinkedList<Integer>(); |
| | | LinkedList<Integer> asteriskPositions = new LinkedList<>(); |
| | | for (int i=0; i < valueBytes.length; i++) |
| | | { |
| | | if (valueBytes[i] == 0x2A) // The asterisk. |
| | |
| | | |
| | | |
| | | // Next, process through the rest of the asterisks to get the subAny values. |
| | | ArrayList<ByteString> subAny = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> subAny = new ArrayList<>(); |
| | | for (int asteriskPos : asteriskPositions) |
| | | { |
| | | int length = asteriskPos - firstPos - 1; |
| | |
| | | } |
| | | else |
| | | { |
| | | subComps = new ArrayList<SearchFilter>(filterComponents.size()); |
| | | subComps = new ArrayList<>(filterComponents.size()); |
| | | for (RawFilter f : filterComponents) |
| | | { |
| | | subComps.add(f.toSearchFilter()); |
| | |
| | | attrType = DirectoryServer.getDefaultAttributeType(baseName); |
| | | } |
| | | |
| | | options = new HashSet<String>(); |
| | | options = new HashSet<>(); |
| | | StringTokenizer tokenizer = |
| | | new StringTokenizer(attributeType.substring(semicolonPos+1), ";"); |
| | | while (tokenizer.hasMoreTokens()) |
| | |
| | | // This method is not thread-safe. |
| | | if (controls == null) |
| | | { |
| | | controls = new ArrayList<Control>(0); |
| | | controls = new ArrayList<>(0); |
| | | } |
| | | return controls; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | attributes = new ArrayList<RawAttribute>(); |
| | | attributes = new ArrayList<>(); |
| | | while(reader.hasNextElement()) |
| | | { |
| | | attributes.add(LDAPAttribute.decode(reader)); |
| | |
| | | if (reader.hasNextElement()) |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | while(reader.hasNextElement()) |
| | | { |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | // Should have at least 1. |
| | | do |
| | |
| | | if (reader.hasNextElement()) |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | while(reader.hasNextElement()) |
| | | { |
| | |
| | | if (reader.hasNextElement()) |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | while(reader.hasNextElement()) |
| | | { |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | while(reader.hasNextElement()) |
| | | { |
| | |
| | | if (reader.hasNextElement()) |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | while(reader.hasNextElement()) |
| | | { |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | modifications = new ArrayList<RawModification>(); |
| | | modifications = new ArrayList<>(); |
| | | while(reader.hasNextElement()) |
| | | { |
| | | modifications.add(LDAPModification.decode(reader)); |
| | |
| | | if (reader.hasNextElement()) |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | while(reader.hasNextElement()) |
| | | { |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | attributes = new LinkedHashSet<String>(); |
| | | attributes = new LinkedHashSet<>(); |
| | | while(reader.hasNextElement()) |
| | | { |
| | | attributes.add(reader.readOctetStringAsString()); |
| | |
| | | if (reader.hasNextElement()) |
| | | { |
| | | reader.readStartSequence(); |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | |
| | | while(reader.hasNextElement()) |
| | | { |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | attributes = new LinkedList<LDAPAttribute>(); |
| | | attributes = new LinkedList<>(); |
| | | while(reader.hasNextElement()) |
| | | { |
| | | attributes.add(LDAPAttribute.decode(reader)); |
| | |
| | | } |
| | | |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | try |
| | | { |
| | | // Should have atleast 1 URL. |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | ArrayList<Control> controls = |
| | | new ArrayList<Control>(); |
| | | ArrayList<Control> controls = new ArrayList<>(); |
| | | while(reader.hasNextElement()) |
| | | { |
| | | controls.add(readControl(reader)); |
| | |
| | | * need to be registered with the selector. |
| | | * TODO: revisit, see Issue 4202. |
| | | */ |
| | | private List<LDAPClientConnection> pendingConnections = |
| | | new LinkedList<LDAPClientConnection>(); |
| | | private List<LDAPClientConnection> pendingConnections = new LinkedList<>(); |
| | | |
| | | /** Lock object for synchronizing access to the pending connections queue. */ |
| | | private final Object pendingConnectionsLock = new Object(); |
| | | |
| | | /** The list of connections ready for request processing. */ |
| | | private LinkedList<LDAPClientConnection> readyConnections = |
| | | new LinkedList<LDAPClientConnection>(); |
| | | private LinkedList<LDAPClientConnection> readyConnections = new LinkedList<>(); |
| | | |
| | | /** The selector that will be used to monitor the client connections. */ |
| | | private final Selector selector; |
| | |
| | | * |
| | | * @param connectionHandler The LDAP connection handler with which this |
| | | * request handler is associated. |
| | | * @param requestHandlerID The integer value that may be used to distingush |
| | | * @param requestHandlerID The integer value that may be used to distinguish |
| | | * this request handler from others associated with |
| | | * the same connection handler. |
| | | * |
| | | * @throws InitializationException If a problem occurs while initializing |
| | | * this request handler. |
| | | */ |
| | |
| | | if (!pendingConnections.isEmpty()) |
| | | { |
| | | tmp = pendingConnections; |
| | | pendingConnections = new LinkedList<LDAPClientConnection>(); |
| | | pendingConnections = new LinkedList<>(); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public Collection<LDAPClientConnection> getClientConnections() |
| | | { |
| | | ArrayList<LDAPClientConnection> connList = |
| | | new ArrayList<LDAPClientConnection>(keys.length); |
| | | ArrayList<LDAPClientConnection> connList = new ArrayList<>(keys.length); |
| | | for (SelectionKey key : keys) |
| | | { |
| | | LDAPClientConnection c = (LDAPClientConnection) key.attachment(); |
| | |
| | | @Override |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | List<Attribute> attrs = new ArrayList<Attribute>(); |
| | | List<Attribute> attrs = new ArrayList<>(); |
| | | |
| | | long tmpAbandonRequests = abandonRequests.get(); |
| | | long tmpAddRequests = addRequests.get(); |
| | |
| | | public ModifyRequestProtocolOp(ByteString dn) |
| | | { |
| | | this.dn = dn; |
| | | this.modifications = new ArrayList<RawModification>(); |
| | | this.modifications = new ArrayList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (modifications == null) |
| | | { |
| | | this.modifications = new ArrayList<RawModification>(); |
| | | this.modifications = new ArrayList<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (attributes == null) |
| | | { |
| | | this.attributes = new LinkedHashSet<String>(0); |
| | | this.attributes = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | LinkedList<LDAPAttribute> tmp = attributes; |
| | | if (tmp == null) |
| | | { |
| | | tmp = new LinkedList<LDAPAttribute>(); |
| | | tmp = new LinkedList<>(); |
| | | if (entry != null) |
| | | { |
| | | if (ldapVersion == 2) |
| | |
| | | return entry; |
| | | } |
| | | |
| | | HashMap<ObjectClass,String> objectClasses = |
| | | new HashMap<ObjectClass,String>(); |
| | | HashMap<AttributeType,List<Attribute>> userAttributes = |
| | | new HashMap<AttributeType,List<Attribute>>(); |
| | | HashMap<AttributeType,List<Attribute>> operationalAttributes = |
| | | new HashMap<AttributeType,List<Attribute>>(); |
| | | HashMap<ObjectClass,String> objectClasses = new HashMap<>(); |
| | | HashMap<AttributeType,List<Attribute>> userAttributes = new HashMap<>(); |
| | | HashMap<AttributeType,List<Attribute>> operationalAttributes = new HashMap<>(); |
| | | |
| | | |
| | | for (LDAPAttribute a : getAttributes()) |
| | |
| | | List<Attribute> attrs = operationalAttributes.get(attrType); |
| | | if (attrs == null) |
| | | { |
| | | attrs = new ArrayList<Attribute>(1); |
| | | attrs = new ArrayList<>(1); |
| | | attrs.add(attr); |
| | | operationalAttributes.put(attrType, attrs); |
| | | } |
| | |
| | | List<Attribute> attrs = userAttributes.get(attrType); |
| | | if (attrs == null) |
| | | { |
| | | attrs = new ArrayList<Attribute>(1); |
| | | attrs = new ArrayList<>(1); |
| | | attrs.add(attr); |
| | | userAttributes.put(attrType, attrs); |
| | | } |
| | |
| | | { |
| | | if (referralURLs == null) |
| | | { |
| | | this.referralURLs = new ArrayList<String>(); |
| | | this.referralURLs = new ArrayList<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | referralURLs = searchReference.getReferralURLs(); |
| | | if (referralURLs == null) |
| | | { |
| | | referralURLs = new ArrayList<String>(); |
| | | referralURLs = new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | |
| | | * Retrieves the set of referral URLs for this search result reference |
| | | * protocol op. The returned list may be altered by the caller. |
| | | * |
| | | * @return The set of referral URLs for this search result reference protocol |
| | | * op. |
| | | * @return The set of referral URLs for this search result reference protocol op. |
| | | */ |
| | | public List<String> getReferralURLs() |
| | | { |
| | |
| | | */ |
| | | public MultiDomainServerState() |
| | | { |
| | | list = new ConcurrentSkipListMap<DN, ServerState>(); |
| | | list = new ConcurrentSkipListMap<>(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public MultiDomainServerState(String mdss) throws DirectoryException |
| | | { |
| | | list = new ConcurrentSkipListMap<DN, ServerState>( |
| | | splitGenStateToServerStates(mdss)); |
| | | list = new ConcurrentSkipListMap<>(splitGenStateToServerStates(mdss)); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | return Collections.emptyMap(); |
| | | } |
| | | final Map<DN, List<CSN>> map = new HashMap<DN, List<CSN>>(); |
| | | final Map<DN, List<CSN>> map = new HashMap<>(); |
| | | for (Entry<DN, ServerState> entry : list.entrySet()) |
| | | { |
| | | final List<CSN> l = entry.getValue().getSnapshot(); |
| | |
| | | private static Map<DN, ServerState> splitGenStateToServerStates( |
| | | String multiDomainServerState) throws DirectoryException |
| | | { |
| | | Map<DN, ServerState> startStates = new TreeMap<DN, ServerState>(); |
| | | Map<DN, ServerState> startStates = new TreeMap<>(); |
| | | if (multiDomainServerState != null && multiDomainServerState.length() > 0) |
| | | { |
| | | try |
| | |
| | | { |
| | | |
| | | /** Associates a serverId with a CSN. */ |
| | | private final ConcurrentMap<Integer, CSN> serverIdToCSN = |
| | | new ConcurrentSkipListMap<Integer, CSN>(); |
| | | private final ConcurrentMap<Integer, CSN> serverIdToCSN = new ConcurrentSkipListMap<>(); |
| | | /** |
| | | * Whether the state has been saved to persistent storage. It starts at true, |
| | | * and moves to false when an update is made to the current object. |
| | |
| | | */ |
| | | public Set<String> toStringSet() |
| | | { |
| | | final Set<String> result = new HashSet<String>(); |
| | | final Set<String> result = new HashSet<>(); |
| | | for (CSN change : serverIdToCSN.values()) |
| | | { |
| | | Date date = new Date(change.getTime()); |
| | |
| | | */ |
| | | public ArrayList<ByteString> toASN1ArrayList() |
| | | { |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(0); |
| | | final ArrayList<ByteString> values = new ArrayList<>(0); |
| | | for (CSN csn : serverIdToCSN.values()) |
| | | { |
| | | values.add(ByteString.valueOf(csn.toString())); |
| | |
| | | { |
| | | // copy to protect from concurrent updates |
| | | // that could change the number of elements in the Map |
| | | return new HashMap<Integer, CSN>(serverIdToCSN); |
| | | return new HashMap<>(serverIdToCSN); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | * LinkedHashMap</li> |
| | | * </ol> |
| | | */ |
| | | private final Map<AttrValueHistorical, AttrValueHistorical> valuesHist = |
| | | new LinkedHashMap<AttrValueHistorical, AttrValueHistorical>(); |
| | | private final Map<AttrValueHistorical, AttrValueHistorical> valuesHist = new LinkedHashMap<>(); |
| | | |
| | | /** |
| | | * Create a new object from the provided information. |
| | |
| | | */ |
| | | public class AttrHistoricalWithOptions |
| | | { |
| | | private HashMap<Set<String>, AttrHistorical> attributesInfo; |
| | | private final HashMap<Set<String>, AttrHistorical> attributesInfo = new HashMap<>(); |
| | | |
| | | /** Creates a new AttrInfoWithOptions. */ |
| | | public AttrHistoricalWithOptions() |
| | | { |
| | | attributesInfo = new HashMap<Set<String> ,AttrHistorical>(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * Contains Historical information for each attribute sorted by attribute |
| | | * type. key:AttributeType value:AttrInfoWithOptions |
| | | */ |
| | | private HashMap<AttributeType,AttrHistoricalWithOptions> attributesHistorical |
| | | = new HashMap<AttributeType,AttrHistoricalWithOptions>(); |
| | | private final HashMap<AttributeType,AttrHistoricalWithOptions> attributesHistorical = new HashMap<>(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | |
| | | Attribute attr = Attributes.create(historicalAttrType, attrValue); |
| | | |
| | | // Set the created attribute to the operation |
| | | List<Attribute> attrList = new LinkedList<Attribute>(); |
| | | List<Attribute> attrList = new LinkedList<>(); |
| | | attrList.add(attr); |
| | | addOperation.setAttribute(historicalAttrType, attrList); |
| | | } |
| | |
| | | public static EntryHistorical newInstanceFromEntry(Entry entry) |
| | | { |
| | | AttributeType lastAttrType = null; |
| | | Set<String> lastOptions = new HashSet<String>(); |
| | | Set<String> lastOptions = new HashSet<>(); |
| | | AttrHistorical attrInfo = null; |
| | | AttrHistoricalWithOptions attrInfoWithOptions = null; |
| | | |
| | |
| | | */ |
| | | public static Iterable<FakeOperation> generateFakeOperations(Entry entry) |
| | | { |
| | | TreeMap<CSN, FakeOperation> operations = |
| | | new TreeMap<CSN, FakeOperation>(); |
| | | TreeMap<CSN, FakeOperation> operations = new TreeMap<>(); |
| | | List<Attribute> attrs = getHistoricalAttr(entry); |
| | | if (attrs != null) |
| | | { |
| | |
| | | */ |
| | | public class FakeModifyOperation extends FakeOperation |
| | | { |
| | | private List<Modification> mods = new ArrayList<Modification>(); |
| | | private List<Modification> mods = new ArrayList<>(); |
| | | private DN dn; |
| | | private String entryuuid; |
| | | |
| | |
| | | * session. This allows to potentially run man imports at the same time. |
| | | */ |
| | | private final Map<LDIFImportConfig, ImportFractionalContext> |
| | | importSessionContexts = new Hashtable<LDIFImportConfig, |
| | | ImportFractionalContext>(); |
| | | importSessionContexts = new Hashtable<>(); |
| | | |
| | | /** |
| | | * Holds an import session fractional context. |
| | |
| | | // Now flush attribute values into entry |
| | | if (somethingToFlush) |
| | | { |
| | | List<ByteString> duplicateValues = new ArrayList<ByteString>(); |
| | | List<ByteString> duplicateValues = new ArrayList<>(); |
| | | entry.addAttribute(attrBuilder.toAttribute(), duplicateValues); |
| | | } |
| | | } |
| | |
| | | { |
| | | String[] token = strVal.split(":", 4); |
| | | |
| | | options = new LinkedHashSet<String>(); |
| | | options = new LinkedHashSet<>(); |
| | | if (token[0].contains(";")) |
| | | { |
| | | String[] optionsToken = token[0].split(";"); |
| | |
| | | * replication related operational attributes when used in a search operation. |
| | | */ |
| | | private static final Set<String> USER_AND_REPL_OPERATIONAL_ATTRS = |
| | | new HashSet<String>(Arrays.asList( |
| | | HISTORICAL_ATTRIBUTE_NAME, ENTRYUUID_ATTRIBUTE_NAME, "*")); |
| | | new HashSet<>(Arrays.asList(HISTORICAL_ATTRIBUTE_NAME, ENTRYUUID_ATTRIBUTE_NAME, "*")); |
| | | |
| | | /** |
| | | * This class is used in the session establishment phase |
| | |
| | | * is not updated too early. |
| | | */ |
| | | private final PendingChanges pendingChanges; |
| | | private final AtomicReference<RSUpdater> rsUpdater = |
| | | new AtomicReference<RSUpdater>(null); |
| | | private final AtomicReference<RSUpdater> rsUpdater = new AtomicReference<>(null); |
| | | |
| | | /** |
| | | * It contain the updates that were done on other servers, transmitted by the |
| | |
| | | * This list is used to temporary store operations that needs to be replayed |
| | | * at session establishment time. |
| | | */ |
| | | private final SortedMap<CSN, FakeOperation> replayOperations = |
| | | new TreeMap<CSN, FakeOperation>(); |
| | | private final SortedMap<CSN, FakeOperation> replayOperations = new TreeMap<>(); |
| | | |
| | | private ExternalChangelogDomain eclDomain; |
| | | |
| | |
| | | * attributes values |
| | | */ |
| | | |
| | | Map<String, Set<String>> storedFractionalSpecificClassesAttributes = |
| | | new HashMap<String, Set<String>>(); |
| | | Set<String> storedFractionalAllClassesAttributes = new HashSet<String>(); |
| | | Map<String, Set<String>> storedFractionalSpecificClassesAttributes = new HashMap<>(); |
| | | Set<String> storedFractionalAllClassesAttributes = new HashSet<>(); |
| | | |
| | | int storedFractionalMode; |
| | | try |
| | |
| | | * - include mode : remove any attribute that is not in |
| | | * fractionalConcernedAttributes |
| | | */ |
| | | List<List<Attribute>> newRdnAttrLists = new ArrayList<List<Attribute>>(); |
| | | List<AttributeType> rdnAttrTypes = new ArrayList<AttributeType>(); |
| | | List<List<Attribute>> newRdnAttrLists = new ArrayList<>(); |
| | | List<AttributeType> rdnAttrTypes = new ArrayList<>(); |
| | | final Set<AttributeType> attrTypes = attributesMap.keySet(); |
| | | for (Iterator<AttributeType> iter = attrTypes.iterator(); iter.hasNext();) |
| | | { |
| | |
| | | |
| | | private static <T> ArrayList<T> newList(T elem) |
| | | { |
| | | final ArrayList<T> list = new ArrayList<T>(1); |
| | | final ArrayList<T> list = new ArrayList<>(1); |
| | | list.add(elem); |
| | | return list; |
| | | } |
| | | |
| | | private static <T> Set<T> newSet(T elem) |
| | | { |
| | | final Set<T> list = new LinkedHashSet<T>(1); |
| | | final Set<T> list = new LinkedHashSet<>(1); |
| | | list.add(elem); |
| | | return list; |
| | | } |
| | |
| | | * Using a Set to avoid duplicate attributes (from 2 inheriting classes for |
| | | * instance) |
| | | */ |
| | | Set<String> fractionalConcernedAttributes = new HashSet<String>(); |
| | | Set<String> fractionalConcernedAttributes = new HashSet<>(); |
| | | |
| | | // Get object classes the entry matches |
| | | Set<String> fractionalAllClassesAttributes = |
| | |
| | | newList(ByteString.valueOf(Long.toString(generationId))); |
| | | |
| | | LDAPAttribute attr = new LDAPAttribute(REPLICATION_GENERATION_ID, values); |
| | | List<RawModification> mods = new ArrayList<RawModification>(1); |
| | | List<RawModification> mods = new ArrayList<>(1); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, attr)); |
| | | |
| | | ModifyOperation op = new ModifyOperationBasis( |
| | |
| | | { |
| | | String includeAttributeStrings[] = |
| | | {"objectclass", "sn", "cn", "entryuuid"}; |
| | | Set<AttributeType> includeAttributes = new HashSet<AttributeType>(); |
| | | Set<AttributeType> includeAttributes = new HashSet<>(); |
| | | for (String attrName : includeAttributeStrings) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | |
| | | @Override |
| | | public Map<String, String> getAlerts() |
| | | { |
| | | Map<String, String> alerts = new LinkedHashMap<String, String>(); |
| | | Map<String, String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(ALERT_TYPE_REPLICATION_UNRESOLVED_CONFLICT, |
| | | ALERT_DESCRIPTION_REPLICATION_UNRESOLVED_CONFLICT); |
| | |
| | | |
| | | // Publish and remove all the changes from the replayOperations list |
| | | // that are older than the endCSN. |
| | | final List<FakeOperation> opsToSend = new LinkedList<FakeOperation>(); |
| | | final List<FakeOperation> opsToSend = new LinkedList<>(); |
| | | synchronized (replayOperations) |
| | | { |
| | | Iterator<FakeOperation> itOp = replayOperations.values().iterator(); |
| | |
| | | @Override |
| | | public Collection<Attribute> getAdditionalMonitoring() |
| | | { |
| | | List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | List<Attribute> attributes = new ArrayList<>(); |
| | | |
| | | // number of updates in the pending list |
| | | addMonitorData(attributes, "pending-updates", pendingChanges.size()); |
| | |
| | | else if (names.size() == 1 && names.contains("*")) |
| | | { |
| | | // Potential fast-path for delete operations. |
| | | List<Attribute> attributes = new LinkedList<Attribute>(); |
| | | List<Attribute> attributes = new LinkedList<>(); |
| | | for (List<Attribute> attributeList : entry.getUserAttributes().values()) |
| | | { |
| | | attributes.addAll(attributeList); |
| | |
| | | return names; |
| | | } |
| | | |
| | | final Set<String> expandedNames = new HashSet<String>(names.size()); |
| | | final Set<String> expandedNames = new HashSet<>(names.size()); |
| | | for (String name : names) |
| | | { |
| | | if (name.startsWith("@")) |
| | |
| | | private boolean fractionalExclusive = true; |
| | | |
| | | /** |
| | | * Used in fractional replication: holds attributes of a specific object |
| | | * class. |
| | | * Used in fractional replication: holds attributes of a specific object class. |
| | | * - key = object class (name or OID of the class) |
| | | * - value = the attributes of that class that should be taken into account |
| | | * (inclusive or exclusive fractional replication) (name or OID of the |
| | | * attribute) |
| | | * When an operation coming from the network is to be locally replayed, if |
| | | * the concerned entry has an objectClass attribute equals to 'key': |
| | | * - inclusive mode: only the attributes in 'value' will be added/deleted/ |
| | | * modified |
| | | * - exclusive mode: the attributes in 'value' will not be added/deleted/ |
| | | * modified |
| | | * - inclusive mode: only the attributes in 'value' will be added/deleted/modified |
| | | * - exclusive mode: the attributes in 'value' will not be added/deleted/modified |
| | | */ |
| | | private Map<String, Set<String>> fractionalSpecificClassesAttributes = |
| | | new HashMap<String, Set<String>>(); |
| | | private Map<String, Set<String>> fractionalSpecificClassesAttributes = new HashMap<>(); |
| | | |
| | | /** |
| | | * Used in fractional replication: holds attributes of any object class. |
| | |
| | | * fractionalAllClassesAttributes will not be added/deleted/modified |
| | | * The attributes may be in human readable form of OID form. |
| | | */ |
| | | private Set<String> fractionalAllClassesAttributes = new HashSet<String>(); |
| | | private Set<String> fractionalAllClassesAttributes = new HashSet<>(); |
| | | |
| | | /** |
| | | * Base DN the fractional configuration is for. |
| | | */ |
| | | /** Base DN the fractional configuration is for. */ |
| | | private final DN baseDN; |
| | | |
| | | /** |
| | |
| | | Iterator<String> inclIt = configuration.getFractionalInclude().iterator(); |
| | | |
| | | // Get potentially new fractional configuration |
| | | Map<String, Set<String>> newFractionalSpecificClassesAttributes = |
| | | new HashMap<String, Set<String>>(); |
| | | Set<String> newFractionalAllClassesAttributes = new HashSet<String>(); |
| | | Map<String, Set<String>> newFractionalSpecificClassesAttributes = new HashMap<>(); |
| | | Set<String> newFractionalAllClassesAttributes = new HashSet<>(); |
| | | |
| | | int newFractionalMode = parseFractionalConfig(exclIt, inclIt, |
| | | newFractionalSpecificClassesAttributes, |
| | |
| | | fractionalSpecificClassesAttributes.get(classNameLower); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new LinkedHashSet<String>(); |
| | | attrList = new LinkedHashSet<>(); |
| | | fractionalSpecificClassesAttributes.put(classNameLower, attrList); |
| | | } |
| | | attrList.add(attrNameLower); |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | private ReplicationServerListener replicationServerListener; |
| | | private static final Map<DN, LDAPReplicationDomain> domains = |
| | | new ConcurrentHashMap<DN, LDAPReplicationDomain>(4); |
| | | private static final Map<DN, LDAPReplicationDomain> domains = new ConcurrentHashMap<>(4); |
| | | private static final DSRSShutdownSync dsrsShutdownSync = new DSRSShutdownSync(); |
| | | |
| | | /** |
| | | * The queue of received update messages, to be treated by the ReplayThread |
| | | * threads. |
| | | */ |
| | | private static final BlockingQueue<UpdateToReplay> updateToReplayQueue = |
| | | new LinkedBlockingQueue<UpdateToReplay>(10000); |
| | | |
| | | /** |
| | | * The list of ReplayThread threads. |
| | | */ |
| | | private static final List<ReplayThread> replayThreads = |
| | | new ArrayList<ReplayThread>(); |
| | | |
| | | /** |
| | | * The configurable number of replay threads. |
| | | */ |
| | | /** The queue of received update messages, to be treated by the ReplayThread threads. */ |
| | | private static final BlockingQueue<UpdateToReplay> updateToReplayQueue = new LinkedBlockingQueue<>(10000); |
| | | /** The list of ReplayThread threads. */ |
| | | private static final List<ReplayThread> replayThreads = new ArrayList<>(); |
| | | /** The configurable number of replay threads. */ |
| | | private static int replayThreadNumber = 10; |
| | | |
| | | /** |
| | | * Enum that symbolizes the state of the multimaster replication. |
| | | */ |
| | | /** Enum that symbolizes the state of the multimaster replication. */ |
| | | private static enum State |
| | | { |
| | | STARTING, RUNNING, STOPPING |
| | | } |
| | | |
| | | private static final AtomicReference<State> state = |
| | | new AtomicReference<State>(State.STARTING); |
| | | private static final AtomicReference<State> state = new AtomicReference<>(State.STARTING); |
| | | |
| | | /** |
| | | * The configurable connection/handshake timeout. |
| | | */ |
| | | /** The configurable connection/handshake timeout. */ |
| | | private static volatile int connectionTimeoutMS = 5000; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static Set<DN> getExcludedChangelogDomains() throws DirectoryException |
| | | { |
| | | final Set<DN> disabledBaseDNs = new HashSet<DN>(domains.size() + 1); |
| | | final Set<DN> disabledBaseDNs = new HashSet<>(domains.size() + 1); |
| | | disabledBaseDNs.add(DN.valueOf(DN_EXTERNAL_CHANGELOG_ROOT)); |
| | | for (LDAPReplicationDomain domain : domains.values()) |
| | | { |
| | |
| | | class PendingChanges |
| | | { |
| | | /** A map used to store the pending changes. */ |
| | | private final TreeMap<CSN, PendingChange> pendingChanges = |
| | | new TreeMap<CSN, PendingChange>(); |
| | | private final TreeMap<CSN, PendingChange> pendingChanges = new TreeMap<>(); |
| | | |
| | | /** |
| | | * The {@link CSNGenerator} to use to create new unique CSNs |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | */ |
| | | final class RemotePendingChanges |
| | | { |
| | | /** |
| | | * A map used to store the pending changes. |
| | | */ |
| | | private final SortedMap<CSN, PendingChange> pendingChanges = |
| | | new TreeMap<CSN, PendingChange>(); |
| | | /** A map used to store the pending changes. */ |
| | | private final SortedMap<CSN, PendingChange> pendingChanges = new TreeMap<>(); |
| | | |
| | | /** |
| | | * A sorted set containing the list of PendingChanges that have |
| | | * not been replayed correctly because they are dependent on |
| | | * another change to be completed. |
| | | */ |
| | | private final SortedSet<PendingChange> dependentChanges = |
| | | new TreeSet<PendingChange>(); |
| | | private final SortedSet<PendingChange> dependentChanges = new TreeSet<>(); |
| | | |
| | | /** |
| | | * The ServerState that will be updated when LDAPUpdateMsg are fully replayed. |
| | | */ |
| | | /** The ServerState that will be updated when LDAPUpdateMsg are fully replayed. */ |
| | | private final ServerState state; |
| | | |
| | | /** |
| | |
| | | * (corresponding to CSN). Each server id of the list had one of the 3 |
| | | * possible errors (timeout/degraded or admin/replay error). |
| | | */ |
| | | private List<Integer> failedServers = new ArrayList<Integer>(); |
| | | private List<Integer> failedServers = new ArrayList<>(); |
| | | |
| | | /** |
| | | * Creates a new AckMsg from a CSN (no errors). |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | ArrayList<RawAttribute> decodeRawAttributes(byte[] in) |
| | | throws LDAPException, DecodeException |
| | | { |
| | | ArrayList<RawAttribute> rattr = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> rattr = new ArrayList<>(); |
| | | try |
| | | { |
| | | ByteSequenceReader reader = |
| | |
| | | ArrayList<Attribute> decodeAttributes(byte[] in) |
| | | throws LDAPException, DecodeException |
| | | { |
| | | ArrayList<Attribute> lattr = new ArrayList<Attribute>(); |
| | | ArrayList<Attribute> lattr = new ArrayList<>(); |
| | | try |
| | | { |
| | | ByteSequenceReader reader = |
| | |
| | | protected List<Modification> decodeMods(byte[] in) throws IOException, |
| | | LDAPException |
| | | { |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | ASN1Reader reader = ASN1.getReader(in); |
| | | while (reader.hasNextElement()) |
| | | { |
| | |
| | | protected List<RawModification> decodeRawMods(byte[] in) |
| | | throws LDAPException, IOException |
| | | { |
| | | List<RawModification> ldapmods = new ArrayList<RawModification>(); |
| | | List<RawModification> ldapmods = new ArrayList<>(); |
| | | ASN1Reader asn1Reader = ASN1.getReader(in); |
| | | while(asn1Reader.hasNextElement()) |
| | | { |
| | |
| | | } |
| | | return ldapmods; |
| | | } |
| | | |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | /** This replication server DbState. */ |
| | | private ServerState replServerDbState; |
| | | /** The data related to the LDAP servers connected to this RS. */ |
| | | private final Map<Integer, ServerData> ldapStates = |
| | | new HashMap<Integer, ServerData>(); |
| | | private final Map<Integer, ServerData> ldapStates = new HashMap<>(); |
| | | /** The data related to the RS servers connected to this RS. */ |
| | | private final Map<Integer, ServerData> rsStates = |
| | | new HashMap<Integer, ServerData>(); |
| | | private final Map<Integer, ServerData> rsStates = new HashMap<>(); |
| | | } |
| | | |
| | | private final SubTopoMonitorData data = new SubTopoMonitorData(); |
| | |
| | | */ |
| | | private BufferedOutputStream output; |
| | | |
| | | private final LinkedBlockingQueue<byte[]> sendQueue = |
| | | new LinkedBlockingQueue<byte[]>(4000); |
| | | private final LinkedBlockingQueue<byte[]> sendQueue = new LinkedBlockingQueue<>(4000); |
| | | private AtomicBoolean isRunning = new AtomicBoolean(false); |
| | | private final CountDownLatch latch = new CountDownLatch(1); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | public class StartSessionMsg extends ReplicationMsg |
| | | { |
| | | /** The list of referrals URLs to the sending DS. */ |
| | | private final List<String> referralsURLs = new ArrayList<String>(); |
| | | private final List<String> referralsURLs = new ArrayList<>(); |
| | | /** The initial status the DS starts with. */ |
| | | private ServerStatus status = ServerStatus.INVALID_STATUS; |
| | | /** Assured replication enabled on DS or not. */ |
| | |
| | | /** DS safe data level (relevant if assured mode is safe data). */ |
| | | private byte safeDataLevel = 1; |
| | | |
| | | private Set<String> eclIncludes = new HashSet<String>(); |
| | | private Set<String> eclIncludesForDeletes = new HashSet<String>(); |
| | | private Set<String> eclIncludes = new HashSet<>(); |
| | | private Set<String> eclIncludesForDeletes = new HashSet<>(); |
| | | |
| | | /** |
| | | * Creates a new StartSessionMsg message from its encoded form. |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | |
| | | // Read the DS info entries, first read number of them |
| | | int nDsInfo = scanner.nextByte(); |
| | | final Map<Integer, DSInfo> replicaInfos = |
| | | new HashMap<Integer, DSInfo>(Math.max(0, nDsInfo)); |
| | | final Map<Integer, DSInfo> replicaInfos = new HashMap<>(Math.max(0, nDsInfo)); |
| | | while (nDsInfo > 0 && !scanner.isEmpty()) |
| | | { |
| | | final DSInfo dsInfo = nextDSInfo(scanner, version); |
| | |
| | | |
| | | // Read the RS info entries |
| | | int nRsInfo = scanner.nextByte(); |
| | | final List<RSInfo> rsInfos = new ArrayList<RSInfo>(Math.max(0, nRsInfo)); |
| | | final List<RSInfo> rsInfos = new ArrayList<>(Math.max(0, nRsInfo)); |
| | | while (nRsInfo > 0 && !scanner.isEmpty()) |
| | | { |
| | | rsInfos.add(nextRSInfo(scanner, version)); |
| | |
| | | final byte safeDataLevel = scanner.nextByte(); |
| | | final byte groupId = scanner.nextByte(); |
| | | |
| | | final List<String> refUrls = new ArrayList<String>(); |
| | | final List<String> refUrls = new ArrayList<>(); |
| | | scanner.nextStrings(refUrls); |
| | | |
| | | final Set<String> attrs = new HashSet<String>(); |
| | | final Set<String> delattrs = new HashSet<String>(); |
| | | final Set<String> attrs = new HashSet<>(); |
| | | final Set<String> delattrs = new HashSet<>(); |
| | | short protocolVersion = -1; |
| | | if (version >= REPLICATION_PROTOCOL_V4) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | Map<Integer, DSInfo> replicas = new HashMap<Integer, DSInfo>(); |
| | | Map<Integer, DSInfo> replicas = new HashMap<>(); |
| | | for (DSInfo dsInfo : dsInfos) |
| | | { |
| | | replicas.put(dsInfo.getDsId(), dsInfo); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013-2014 ForgeRock AS |
| | | * Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | */ |
| | | public class ChangelogState |
| | | { |
| | | |
| | | private final ConcurrentSkipListMap<DN, Long> domainToGenerationId = new ConcurrentSkipListMap<DN, Long>(); |
| | | private final ConcurrentSkipListMap<DN, Set<Integer>> domainToServerIds = |
| | | new ConcurrentSkipListMap<DN, Set<Integer>>(); |
| | | private final ConcurrentSkipListMap<DN, Long> domainToGenerationId = new ConcurrentSkipListMap<>(); |
| | | private final ConcurrentSkipListMap<DN, Set<Integer>> domainToServerIds = new ConcurrentSkipListMap<>(); |
| | | private final MultiDomainServerState offlineReplicas = new MultiDomainServerState(); |
| | | |
| | | /** |
| | |
| | | Set<Integer> serverIds = domainToServerIds.get(baseDN); |
| | | if (serverIds == null) |
| | | { |
| | | serverIds = new HashSet<Integer>(); |
| | | serverIds = new HashSet<>(); |
| | | final Set<Integer> existingServerIds = |
| | | domainToServerIds.putIfAbsent(baseDN, serverIds); |
| | | if (existingServerIds != null) |
| | |
| | | private ServerStatus status = ServerStatus.INVALID_STATUS; |
| | | |
| | | /** Referrals URLs this DS is exporting. */ |
| | | private List<String> refUrls = new ArrayList<String>(); |
| | | private List<String> refUrls = new ArrayList<>(); |
| | | /** Assured replication enabled on DS or not. */ |
| | | private boolean assuredFlag; |
| | | /** DS assured mode (relevant if assured replication enabled). */ |
| | | private AssuredMode assuredMode = AssuredMode.SAFE_DATA_MODE; |
| | | /** DS safe data level (relevant if assured mode is safe data). */ |
| | | private byte safeDataLevel = -1; |
| | | private Set<String> eclIncludes = new HashSet<String>(); |
| | | private Set<String> eclIncludesForDeletes = new HashSet<String>(); |
| | | private Set<String> eclIncludes = new HashSet<>(); |
| | | private Set<String> eclIncludesForDeletes = new HashSet<>(); |
| | | |
| | | /** |
| | | * Creates a new data server handler. |
| | |
| | | * value: a boolean true if we received the ack from the server, |
| | | * false otherwise. |
| | | */ |
| | | protected Map<Integer,Boolean> expectedServersAckStatus = |
| | | new HashMap<Integer,Boolean>(); |
| | | protected Map<Integer,Boolean> expectedServersAckStatus = new HashMap<>(); |
| | | |
| | | /** |
| | | * Facility for monitoring: |
| | |
| | | @Override |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | List<Attribute> attributes = new ArrayList<>(); |
| | | |
| | | final int serverId = dsInfo.getDsId(); |
| | | final ReplicationServerDomain domain = replServerHandler.getDomain(); |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | private TreeMap<CSN, UpdateMsg> map = new TreeMap<CSN, UpdateMsg>(); |
| | | private TreeMap<CSN, UpdateMsg> map = new TreeMap<>(); |
| | | /** |
| | | * FIXME JNR to be investigated: |
| | | * I strongly suspect that we could replace this field |
| | |
| | | * <p> |
| | | * Guarded by pendingMonitorLock. |
| | | */ |
| | | private final Set<Integer> monitorDataLateServers = new HashSet<Integer>(); |
| | | private final Set<Integer> monitorDataLateServers = new HashSet<>(); |
| | | |
| | | /** This lock serializes updates to the pending monitor data. */ |
| | | private final Object pendingMonitorDataLock = new Object(); |
| | |
| | | * <p> |
| | | * Guarded by pendingMonitorDataLock. |
| | | */ |
| | | private final Set<Integer> pendingMonitorDataServerIDs = |
| | | new HashSet<Integer>(); |
| | | private final Set<Integer> pendingMonitorDataServerIDs = new HashSet<>(); |
| | | |
| | | /** |
| | | * This latch is non-null and is used in order to count incoming responses as |
| | |
| | | */ |
| | | private final long monitorDataLifeTime = 500; |
| | | |
| | | /** |
| | | * The replication domain monitored by this class. |
| | | */ |
| | | /** The replication domain monitored by this class. */ |
| | | private final ReplicationServerDomain domain; |
| | | |
| | | |
| | |
| | | * This table is used to store the list of dn for which we are currently |
| | | * handling servers. |
| | | */ |
| | | private final Map<DN, ReplicationServerDomain> baseDNs = |
| | | new HashMap<DN, ReplicationServerDomain>(); |
| | | private final Map<DN, ReplicationServerDomain> baseDNs = new HashMap<>(); |
| | | |
| | | /** The database storing the changes. */ |
| | | private final ChangelogDB changelogDB; |
| | |
| | | * This is required for unit testing, so that we can keep track of all the |
| | | * replication servers which are running in the VM. |
| | | */ |
| | | private static final Set<Integer> localPorts = |
| | | new CopyOnWriteArraySet<Integer>(); |
| | | private static final Set<Integer> localPorts = new CopyOnWriteArraySet<>(); |
| | | |
| | | /** Monitors for synchronizing domain creation with the connect thread. */ |
| | | private final Object domainTicketLock = new Object(); |
| | |
| | | * Holds the list of all replication servers instantiated in this VM. |
| | | * This allows to perform clean up of the RS databases in unit tests. |
| | | */ |
| | | private static final List<ReplicationServer> allInstances = |
| | | new ArrayList<ReplicationServer>(); |
| | | private static final List<ReplicationServer> allInstances = new ArrayList<>(); |
| | | |
| | | /** |
| | | * Creates a new Replication server using the provided configuration entry. |
| | |
| | | |
| | | private Set<HostPort> getConfiguredRSAddresses() |
| | | { |
| | | final Set<HostPort> results = new HashSet<HostPort>(); |
| | | final Set<HostPort> results = new HashSet<>(); |
| | | for (String serverAddress : this.config.getReplicationServer()) |
| | | { |
| | | results.add(HostPort.valueOf(serverAddress)); |
| | |
| | | |
| | | private Set<HostPort> getConnectedRSAddresses(ReplicationServerDomain domain) |
| | | { |
| | | Set<HostPort> results = new HashSet<HostPort>(); |
| | | Set<HostPort> results = new HashSet<>(); |
| | | for (ReplicationServerHandler rsHandler : domain.getConnectedRSs().values()) |
| | | { |
| | | results.add(HostPort.valueOf(rsHandler.getServerAddressURL())); |
| | |
| | | |
| | | private List<VirtualAttributeRule> getVirtualAttributesRules() throws DirectoryException |
| | | { |
| | | final List<VirtualAttributeRule> rules = new ArrayList<VirtualAttributeRule>(); |
| | | final List<VirtualAttributeRule> rules = new ArrayList<>(); |
| | | rules.add(buildVirtualAttributeRule("lastexternalchangelogcookie", new LastCookieVirtualProvider(this))); |
| | | rules.add(buildVirtualAttributeRule("firstchangenumber", new FirstChangeNumberVirtualAttributeProvider(this))); |
| | | rules.add(buildVirtualAttributeRule("lastchangenumber", new LastChangeNumberVirtualAttributeProvider(this))); |
| | |
| | | Set<DN> domains = null; |
| | | synchronized (baseDNs) |
| | | { |
| | | domains = new HashSet<DN>(baseDNs.keySet()); |
| | | domains = new HashSet<>(baseDNs.keySet()); |
| | | } |
| | | domains.removeAll(excludedBaseDNs); |
| | | return domains; |
| | |
| | | |
| | | private Set<DN> getDNsOfCookie(MultiDomainServerState cookie) |
| | | { |
| | | final Set<DN> cookieDomains = new HashSet<DN>(); |
| | | final Set<DN> cookieDomains = new HashSet<>(); |
| | | for (final DN dn : cookie) |
| | | { |
| | | cookieDomains.add(dn); |
| | |
| | | |
| | | private Set<DN> getDNsOfActiveDomainsInServer(final Set<DN> ignoredBaseDNs) throws DirectoryException |
| | | { |
| | | final Set<DN> activeDomains = new HashSet<DN>(); |
| | | final Set<DN> activeDomains = new HashSet<>(); |
| | | for (final DN dn : getDomainDNs(ignoredBaseDNs)) |
| | | { |
| | | final ServerState lastServerState = getReplicationServerDomain(dn).getLatestServerState(); |
| | |
| | | { |
| | | if (!activeDomains.containsAll(cookieDomains)) |
| | | { |
| | | final Set<DN> unknownCookieDomains = new HashSet<DN>(cookieDomains); |
| | | final Set<DN> unknownCookieDomains = new HashSet<>(cookieDomains); |
| | | unknownCookieDomains.removeAll(activeDomains); |
| | | final StringBuilder currentStartingCookie = new StringBuilder(); |
| | | for (DN domainDN : activeDomains) { |
| | |
| | | */ |
| | | private void disconnectRemovedReplicationServers(Set<HostPort> oldRSAddresses) |
| | | { |
| | | final Collection<HostPort> serversToDisconnect = new ArrayList<HostPort>(); |
| | | final Collection<HostPort> serversToDisconnect = new ArrayList<>(); |
| | | |
| | | final Set<HostPort> newRSAddresses = getConfiguredRSAddresses(); |
| | | for (HostPort oldRSAddress : oldRSAddresses) |
| | |
| | | { |
| | | synchronized (baseDNs) |
| | | { |
| | | return new ArrayList<ReplicationServerDomain>(baseDNs.values()); |
| | | return new ArrayList<>(baseDNs.values()); |
| | | } |
| | | } |
| | | |
| | |
| | | * topology. Using an AtomicReference to avoid leaking references to costly |
| | | * threads. |
| | | */ |
| | | private final AtomicReference<MonitoringPublisher> monitoringPublisher = |
| | | new AtomicReference<MonitoringPublisher>(); |
| | | /** |
| | | * Maintains monitor data for the current domain. |
| | | */ |
| | | private final ReplicationDomainMonitor domainMonitor = |
| | | new ReplicationDomainMonitor(this); |
| | | private final AtomicReference<MonitoringPublisher> monitoringPublisher = new AtomicReference<>(); |
| | | /** Maintains monitor data for the current domain. */ |
| | | private final ReplicationDomainMonitor domainMonitor = new ReplicationDomainMonitor(this); |
| | | |
| | | /** |
| | | * The following map contains one balanced tree for each replica ID to which |
| | | * we are currently publishing the first update in the balanced tree is the |
| | | * next change that we must push to this particular server. |
| | | */ |
| | | private final Map<Integer, DataServerHandler> connectedDSs = |
| | | new ConcurrentHashMap<Integer, DataServerHandler>(); |
| | | private final Map<Integer, DataServerHandler> connectedDSs = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * This map contains one ServerHandler for each replication servers with which |
| | |
| | | * in the balanced tree is the next change that we must push to this |
| | | * particular server. |
| | | */ |
| | | private final Map<Integer, ReplicationServerHandler> connectedRSs = |
| | | new ConcurrentHashMap<Integer, ReplicationServerHandler>(); |
| | | private final Map<Integer, ReplicationServerHandler> connectedRSs = new ConcurrentHashMap<>(); |
| | | |
| | | private final ReplicationDomainDB domainDB; |
| | | /** The ReplicationServer that created the current instance. */ |
| | |
| | | * @see ExpectedAcksInfo For more details, see ExpectedAcksInfo and its sub |
| | | * classes javadoc. |
| | | */ |
| | | private final Map<CSN, ExpectedAcksInfo> waitingAcks = |
| | | new ConcurrentHashMap<CSN, ExpectedAcksInfo>(); |
| | | private final Map<CSN, ExpectedAcksInfo> waitingAcks = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * The timer used to run the timeout code (timer tasks) for the assured update |
| | |
| | | */ |
| | | private static class PendingStatusMessages |
| | | { |
| | | private final Map<Integer, ChangeTimeHeartbeatMsg> pendingHeartbeats = |
| | | new HashMap<Integer, ChangeTimeHeartbeatMsg>(1); |
| | | private final Map<Integer, MonitorMsg> pendingDSMonitorMsgs = |
| | | new HashMap<Integer, MonitorMsg>(1); |
| | | private final Map<Integer, MonitorMsg> pendingRSMonitorMsgs = |
| | | new HashMap<Integer, MonitorMsg>(1); |
| | | private final Map<Integer, ChangeTimeHeartbeatMsg> pendingHeartbeats = new HashMap<>(1); |
| | | private final Map<Integer, MonitorMsg> pendingDSMonitorMsgs = new HashMap<>(1); |
| | | private final Map<Integer, MonitorMsg> pendingRSMonitorMsgs = new HashMap<>(1); |
| | | private boolean sendRSTopologyMsg; |
| | | private boolean sendDSTopologyMsg; |
| | | private int excludedDSForTopologyMsg = -1; |
| | |
| | | CSN csn = update.getCSN(); |
| | | byte groupId = localReplicationServer.getGroupId(); |
| | | byte sourceGroupId = sourceHandler.getGroupId(); |
| | | List<Integer> expectedServers = new ArrayList<Integer>(); |
| | | List<Integer> wrongStatusServers = new ArrayList<Integer>(); |
| | | List<Integer> expectedServers = new ArrayList<>(); |
| | | List<Integer> wrongStatusServers = new ArrayList<>(); |
| | | |
| | | if (sourceGroupId == groupId) |
| | | // Assured feature does not cross different group ids |
| | |
| | | } |
| | | } |
| | | |
| | | List<Integer> expectedServers = new ArrayList<Integer>(); |
| | | List<Integer> expectedServers = new ArrayList<>(); |
| | | if (interestedInAcks && sourceHandler.isDataServer()) |
| | | { |
| | | collectRSsEligibleForAssuredReplication(groupId, expectedServers); |
| | |
| | | private List<ServerHandler> getDestinationServers(RoutableMsg msg, |
| | | ServerHandler senderHandler) |
| | | { |
| | | List<ServerHandler> servers = new ArrayList<ServerHandler>(); |
| | | List<ServerHandler> servers = new ArrayList<>(); |
| | | |
| | | if (msg.getDestination() == RoutableMsg.THE_CLOSEST_SERVER) |
| | | { |
| | |
| | | */ |
| | | public TopologyMsg createTopologyMsgForRS() |
| | | { |
| | | List<DSInfo> dsInfos = new ArrayList<DSInfo>(); |
| | | List<DSInfo> dsInfos = new ArrayList<>(); |
| | | for (DataServerHandler dsHandler : connectedDSs.values()) |
| | | { |
| | | dsInfos.add(dsHandler.toDSInfo()); |
| | | } |
| | | |
| | | // Create info for the local RS |
| | | List<RSInfo> rsInfos = new ArrayList<RSInfo>(); |
| | | List<RSInfo> rsInfos = new ArrayList<>(); |
| | | rsInfos.add(toRSInfo(localReplicationServer, generationId)); |
| | | |
| | | return new TopologyMsg(dsInfos, rsInfos); |
| | |
| | | public TopologyMsg createTopologyMsgForDS(int destDsId) |
| | | { |
| | | // Go through every DSs (except recipient of msg) |
| | | List<DSInfo> dsInfos = new ArrayList<DSInfo>(); |
| | | List<DSInfo> dsInfos = new ArrayList<>(); |
| | | for (DataServerHandler dsHandler : connectedDSs.values()) |
| | | { |
| | | if (dsHandler.getServerId() == destDsId) |
| | |
| | | } |
| | | |
| | | |
| | | List<RSInfo> rsInfos = new ArrayList<RSInfo>(); |
| | | List<RSInfo> rsInfos = new ArrayList<>(); |
| | | // Add our own info (local RS) |
| | | rsInfos.add(toRSInfo(localReplicationServer, generationId)); |
| | | |
| | |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | // publish the server id and the port number. |
| | | List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | List<Attribute> attributes = new ArrayList<>(); |
| | | attributes.add(Attributes.create("replication-server-id", |
| | | String.valueOf(localReplicationServer.getServerId()))); |
| | | attributes.add(Attributes.create("replication-server-port", |
| | |
| | | * This collection will contain as many elements as there are |
| | | * LDAP servers connected to the remote replication server. |
| | | */ |
| | | private final Map<Integer, LightweightServerHandler> remoteDirectoryServers = |
| | | new ConcurrentHashMap<Integer, LightweightServerHandler>(); |
| | | private final Map<Integer, LightweightServerHandler> remoteDirectoryServers = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * Starts this handler based on a start message received from remote server. |
| | |
| | | // Fill collected errors info |
| | | ack.setHasTimeout(true); |
| | | // Tell which servers did not send an ack in time |
| | | List<Integer> failedServers = new ArrayList<Integer>(); |
| | | List<Integer> failedServers = new ArrayList<>(); |
| | | Set<Integer> serverIds = expectedServersAckStatus.keySet(); |
| | | serversInTimeout = new ArrayList<Integer>(); // Use next loop to fill it |
| | | serversInTimeout = new ArrayList<>(); // Use next loop to fill it |
| | | for (Integer serverId : serverIds) |
| | | { |
| | | boolean ackReceived = expectedServersAckStatus.get(serverId); |
| | |
| | | * server id of the list had one of the 3 possible errors (timeout, wrong |
| | | * status or replay error). |
| | | */ |
| | | private List<Integer> failedServers = new ArrayList<Integer>(); |
| | | private List<Integer> failedServers = new ArrayList<>(); |
| | | |
| | | /** |
| | | * Number of servers we want an ack from and from which we received the ack. |
| | |
| | | |
| | | // Add servers that did not respond in time |
| | | Set<Integer> serverIds = expectedServersAckStatus.keySet(); |
| | | serversInTimeout = new ArrayList<Integer>(); // Use next loop to fill it |
| | | serversInTimeout = new ArrayList<>(); // Use next loop to fill it |
| | | for (int serverId : serverIds) |
| | | { |
| | | boolean ackReceived = expectedServersAckStatus.get(serverId); |
| | |
| | | static <K extends Comparable<K>, V> BlockLogReader<K, V> newReader( |
| | | final File file, final RandomAccessFile reader, final RecordParser<K, V> parser) |
| | | { |
| | | return new BlockLogReader<K, V>(file, reader, parser, BLOCK_SIZE); |
| | | return new BlockLogReader<>(file, reader, parser, BLOCK_SIZE); |
| | | } |
| | | |
| | | /** |
| | |
| | | static <K extends Comparable<K>, V> BlockLogReader<K, V> newReaderForTests( |
| | | final File file, final RandomAccessFile reader, final RecordParser<K, V> parser, int blockSize) |
| | | { |
| | | return new BlockLogReader<K, V>(file, reader, parser, blockSize); |
| | | return new BlockLogReader<>(file, reader, parser, blockSize); |
| | | } |
| | | |
| | | private BlockLogReader( |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.server.changelog.file; |
| | | |
| | |
| | | static <K extends Comparable<K>, V> BlockLogWriter<K,V> newWriter( |
| | | final LogWriter writer, final RecordParser<K, V> parser) |
| | | { |
| | | return new BlockLogWriter<K, V>(writer, parser, BLOCK_SIZE); |
| | | return new BlockLogWriter<>(writer, parser, BLOCK_SIZE); |
| | | } |
| | | |
| | | /** |
| | |
| | | static <K extends Comparable<K>, V> BlockLogWriter<K,V> newWriterForTests( |
| | | final LogWriter writer, final RecordParser<K, V> parser, final int blockSize) |
| | | { |
| | | return new BlockLogWriter<K, V>(writer, parser, blockSize); |
| | | return new BlockLogWriter<>(writer, parser, blockSize); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (!exhaustedCursors.isEmpty()) |
| | | { |
| | | // try to recycle exhausted cursors in case the underlying replica DBs received new changes. |
| | | final Map<DBCursor<UpdateMsg>, T> copy = |
| | | new HashMap<DBCursor<UpdateMsg>, T>(exhaustedCursors); |
| | | final Map<DBCursor<UpdateMsg>, T> copy = new HashMap<>(exhaustedCursors); |
| | | exhaustedCursors.clear(); |
| | | for (Entry<DBCursor<UpdateMsg>, T> entry : copy.entrySet()) |
| | | { |
| | |
| | | long lastCN = readChangeNumber(ChangeNumberType.LAST); |
| | | long numberOfChanges = lastCN == NO_KEY ? 0 : lastCN - firstCN + 1; |
| | | |
| | | final List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | final List<Attribute> attributes = new ArrayList<>(); |
| | | attributes.add(toAttribute(ChangeNumberType.FIRST, firstCN)); |
| | | attributes.add(toAttribute(ChangeNumberType.LAST, lastCN)); |
| | | attributes.add(Attributes.create("count", Long.toString(numberOfChanges))); |
| | |
| | | * concurrent shutdown. |
| | | */ |
| | | private final ConcurrentMap<DN, ConcurrentMap<Integer, FileReplicaDB>> domainToReplicaDBs = |
| | | new ConcurrentHashMap<DN, ConcurrentMap<Integer, FileReplicaDB>>(); |
| | | new ConcurrentHashMap<>(); |
| | | private final ConcurrentSkipListMap<DN, CopyOnWriteArrayList<DomainDBCursor>> registeredDomainCursors = |
| | | new ConcurrentSkipListMap<DN, CopyOnWriteArrayList<DomainDBCursor>>(); |
| | | private final CopyOnWriteArrayList<MultiDomainDBCursor> registeredMultiDomainCursors = |
| | | new CopyOnWriteArrayList<MultiDomainDBCursor>(); |
| | | new ConcurrentSkipListMap<>(); |
| | | private final CopyOnWriteArrayList<MultiDomainDBCursor> registeredMultiDomainCursors = new CopyOnWriteArrayList<>(); |
| | | private final ConcurrentSkipListMap<ReplicaId, CopyOnWriteArrayList<ReplicaCursor>> replicaCursors = |
| | | new ConcurrentSkipListMap<ReplicaId, CopyOnWriteArrayList<ReplicaCursor>>(); |
| | | new ConcurrentSkipListMap<>(); |
| | | private ReplicationEnvironment replicationEnv; |
| | | private final ReplicationServerCfg config; |
| | | private final File dbDirectory; |
| | |
| | | * @GuardedBy("cnIndexDBLock") |
| | | */ |
| | | private FileChangeNumberIndexDB cnIndexDB; |
| | | private final AtomicReference<ChangeNumberIndexer> cnIndexer = new AtomicReference<ChangeNumberIndexer>(); |
| | | private final AtomicReference<ChangeNumberIndexer> cnIndexer = new AtomicReference<>(); |
| | | |
| | | /** Used for protecting {@link ChangeNumberIndexDB} related state. */ |
| | | private final Object cnIndexDBLock = new Object(); |
| | |
| | | * older than this delay might be removed. |
| | | */ |
| | | private volatile long purgeDelayInMillis; |
| | | private final AtomicReference<ChangelogDBPurger> cnPurger = new AtomicReference<ChangelogDBPurger>(); |
| | | private final AtomicReference<ChangelogDBPurger> cnPurger = new AtomicReference<>(); |
| | | |
| | | /** The local replication server. */ |
| | | private final ReplicationServer replicationServer; |
| | |
| | | |
| | | // unlucky, the domainMap does not exist: take the hit and create the |
| | | // newValue, even though the same could be done concurrently by another thread |
| | | final ConcurrentMap<Integer, FileReplicaDB> newValue = new ConcurrentHashMap<Integer, FileReplicaDB>(); |
| | | final ConcurrentMap<Integer, FileReplicaDB> newValue = new ConcurrentHashMap<>(); |
| | | final ConcurrentMap<Integer, FileReplicaDB> previousValue = domainToReplicaDBs.putIfAbsent(baseDN, newValue); |
| | | if (previousValue != null) |
| | | { |
| | |
| | | CopyOnWriteArrayList<V> cursors = map.get(key); |
| | | if (cursors == null) |
| | | { |
| | | cursors = new CopyOnWriteArrayList<V>(); |
| | | cursors = new CopyOnWriteArrayList<>(); |
| | | CopyOnWriteArrayList<V> previousValue = map.putIfAbsent(key, cursors); |
| | | if (previousValue != null) |
| | | { |
| | |
| | | @Override |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | final List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | final List<Attribute> attributes = new ArrayList<>(); |
| | | create(attributes, "replicationServer-database",String.valueOf(serverId)); |
| | | create(attributes, "domain-name", baseDN.toString()); |
| | | final CSNLimits limits = csnLimits; |
| | |
| | | }; |
| | | |
| | | /** Map that holds the unique log instance for each log path. */ |
| | | private static final Map<File, Log<?, ?>> logsCache = new HashMap<File, Log<?, ?>>(); |
| | | private static final Map<File, Log<?, ?>> logsCache = new HashMap<>(); |
| | | |
| | | /** |
| | | * The number of references on this log instance. It is incremented each time |
| | |
| | | * <p> |
| | | * The read-only log files are associated with the highest key they contain. |
| | | */ |
| | | private final TreeMap<K, LogFile<K, V>> logFiles = new TreeMap<K, LogFile<K, V>>(); |
| | | private final TreeMap<K, LogFile<K, V>> logFiles = new TreeMap<>(); |
| | | |
| | | /** |
| | | * The last key appended to the log. In order to keep the ordering of the keys |
| | |
| | | * The list of non-empty cursors opened on this log. Opened cursors may have |
| | | * to be updated when rotating the head log file. |
| | | */ |
| | | private final List<AbortableLogCursor<K, V>> openCursors = new CopyOnWriteArrayList<AbortableLogCursor<K, V>>(); |
| | | private final List<AbortableLogCursor<K, V>> openCursors = new CopyOnWriteArrayList<>(); |
| | | |
| | | /** |
| | | * A log file can be rotated once it has exceeded this size limit. The log file can have |
| | |
| | | Log<K, V> log = (Log<K, V>) logsCache.get(logPath); |
| | | if (log == null) |
| | | { |
| | | log = new Log<K, V>(replicationEnv, logPath, parser, rotationParameters); |
| | | log = new Log<>(replicationEnv, logPath, parser, rotationParameters); |
| | | logsCache.put(logPath, log); |
| | | } |
| | | else |
| | |
| | | * @return an empty cursor |
| | | */ |
| | | static <K extends Comparable<K>, V> RepositionableCursor<K, V> getEmptyCursor() { |
| | | return new Log.EmptyCursor<K, V>(); |
| | | return new Log.EmptyCursor<>(); |
| | | } |
| | | |
| | | /** Holds the parameters for log files rotation. */ |
| | |
| | | { |
| | | if (isClosed) |
| | | { |
| | | return new EmptyCursor<K, V>(); |
| | | return new EmptyCursor<>(); |
| | | } |
| | | cursor = new AbortableLogCursor<K, V>(this, new InternalLogCursor<K, V>(this)); |
| | | cursor = new AbortableLogCursor<>(this, new InternalLogCursor<K, V>(this)); |
| | | cursor.positionTo(null, null, null); |
| | | registerCursor(cursor); |
| | | return cursor; |
| | |
| | | { |
| | | if (isClosed) |
| | | { |
| | | return new EmptyCursor<K, V>(); |
| | | return new EmptyCursor<>(); |
| | | } |
| | | cursor = new AbortableLogCursor<K, V>(this, new InternalLogCursor<K, V>(this)); |
| | | cursor = new AbortableLogCursor<>(this, new InternalLogCursor<K, V>(this)); |
| | | final boolean isSuccessfullyPositioned = cursor.positionTo(key, matchingStrategy, positionStrategy); |
| | | // Allow for cursor re-initialization after exhaustion in case of |
| | | // LESS_THAN_OR_EQUAL_TO_KEY ands GREATER_THAN_OR_EQUAL_TO_KEY strategies |
| | |
| | | else |
| | | { |
| | | StaticUtils.close(cursor); |
| | | return new EmptyCursor<K, V>(); |
| | | return new EmptyCursor<>(); |
| | | } |
| | | } |
| | | catch (ChangelogException e) |
| | |
| | | { |
| | | return null; |
| | | } |
| | | final List<String> undeletableFiles = new ArrayList<String>(); |
| | | final List<String> undeletableFiles = new ArrayList<>(); |
| | | final Iterator<LogFile<K, V>> entriesToPurge = logFilesToPurge.values().iterator(); |
| | | while (entriesToPurge.hasNext()) |
| | | { |
| | |
| | | } |
| | | |
| | | // delete all log files |
| | | final List<String> undeletableFiles = new ArrayList<String>(); |
| | | final List<String> undeletableFiles = new ArrayList<>(); |
| | | for (LogFile<K, V> logFile : logFiles.values()) |
| | | { |
| | | try |
| | |
| | | @Override |
| | | CursorState<K, V> getState() throws ChangelogException |
| | | { |
| | | return new CursorState<K, V>(currentLogFile, currentCursor.getFilePosition(), currentCursor.getRecord()); |
| | | return new CursorState<>(currentLogFile, currentCursor.getFilePosition(), currentCursor.getRecord()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (mustAbort) |
| | | { |
| | | delegate.close(); |
| | | delegate = new AbortedLogCursor<K, V>(log.getPath()); |
| | | delegate = new AbortedLogCursor<>(log.getPath()); |
| | | mustAbort = false; |
| | | } |
| | | return delegate.next(); |
| | |
| | | { |
| | | writer = null; |
| | | } |
| | | readerPool = new LogReaderPool<K, V>(logfile, parser); |
| | | readerPool = new LogReaderPool<>(logfile, parser); |
| | | } |
| | | |
| | | /** |
| | |
| | | static <K extends Comparable<K>, V> LogFile<K, V> newReadOnlyLogFile(final File logFilePath, |
| | | final RecordParser<K, V> parser) throws ChangelogException |
| | | { |
| | | return new LogFile<K, V>(logFilePath, parser, false); |
| | | return new LogFile<>(logFilePath, parser, false); |
| | | } |
| | | |
| | | /** |
| | |
| | | static <K extends Comparable<K>, V> LogFile<K, V> newAppendableLogFile(final File logFilePath, |
| | | final RecordParser<K, V> parser) throws ChangelogException |
| | | { |
| | | return new LogFile<K, V>(logFilePath, parser, true); |
| | | return new LogFile<>(logFilePath, parser, true); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | LogFileCursor<K, V> getCursor() throws ChangelogException |
| | | { |
| | | return new LogFileCursor<K, V>(this); |
| | | return new LogFileCursor<>(this); |
| | | } |
| | | |
| | | /** |
| | | * Returns a cursor initialised to the provided record and position in file. |
| | | * Returns a cursor initialized to the provided record and position in file. |
| | | * |
| | | * @param record |
| | | * The initial record this cursor points on |
| | |
| | | */ |
| | | LogFileCursor<K, V> getCursorInitialisedTo(Record<K,V> record, long position) throws ChangelogException |
| | | { |
| | | return new LogFileCursor<K, V>(this, record, position); |
| | | return new LogFileCursor<>(this, record, position); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return a record |
| | | */ |
| | | static <K, V> Record<K, V> from(final K key, final V value) { |
| | | return new Record<K, V>(key, value); |
| | | return new Record<>(key, value); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | /** @NonNull */ |
| | | private final DBCursor<UpdateMsg> cursor; |
| | | private final AtomicReference<ReplicaOfflineMsg> replicaOfflineMsg = |
| | | new AtomicReference<ReplicaOfflineMsg>(); |
| | | private final AtomicReference<ReplicaOfflineMsg> replicaOfflineMsg = new AtomicReference<>(); |
| | | private UpdateMsg currentRecord; |
| | | |
| | | private final ReplicaId replicaId; |
| | |
| | | * |
| | | * @GuardedBy("domainsLock") |
| | | */ |
| | | private final Map<DN, String> domains = new HashMap<DN, String>(); |
| | | private final Map<DN, String> domains = new HashMap<>(); |
| | | |
| | | /** |
| | | * Exclusive lock to synchronize: |
| | |
| | | final File[] dnDirectories = changelogPath.listFiles(DOMAIN_FILE_FILTER); |
| | | if (dnDirectories != null) |
| | | { |
| | | final Set<String> domainIdsFromFileSystem = new HashSet<String>(); |
| | | final Set<String> domainIdsFromFileSystem = new HashSet<>(); |
| | | for (final File dnDir : dnDirectories) |
| | | { |
| | | final String fileName = dnDir.getName(); |
| | |
| | | domainIdsFromFileSystem.add(domainId); |
| | | } |
| | | |
| | | final Set<String> expectedDomainIds = new HashSet<String>(domains.values()); |
| | | final Set<String> expectedDomainIds = new HashSet<>(domains.values()); |
| | | if (!domainIdsFromFileSystem.equals(expectedDomainIds)) |
| | | { |
| | | throw new ChangelogException(ERR_CHANGELOG_INCOHERENT_DOMAIN_STATE.get(domains.values().toString(), |
| | |
| | | @Override |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | List<Attribute> attributes = new ArrayList<>(); |
| | | attributes.add(createChangeNumberAttribute(true)); |
| | | attributes.add(createChangeNumberAttribute(false)); |
| | | attributes.add(Attributes.create("count", Long.toString(count()))); |
| | |
| | | * concurrent shutdown. |
| | | */ |
| | | private final ConcurrentMap<DN, ConcurrentMap<Integer, JEReplicaDB>> domainToReplicaDBs = |
| | | new ConcurrentHashMap<DN, ConcurrentMap<Integer, JEReplicaDB>>(); |
| | | new ConcurrentHashMap<>(); |
| | | private final ConcurrentSkipListMap<DN, CopyOnWriteArrayList<DomainDBCursor>> registeredDomainCursors = |
| | | new ConcurrentSkipListMap<DN, CopyOnWriteArrayList<DomainDBCursor>>(); |
| | | private final CopyOnWriteArrayList<MultiDomainDBCursor> registeredMultiDomainCursors = |
| | | new CopyOnWriteArrayList<MultiDomainDBCursor>(); |
| | | new ConcurrentSkipListMap<>(); |
| | | private final CopyOnWriteArrayList<MultiDomainDBCursor> registeredMultiDomainCursors = new CopyOnWriteArrayList<>(); |
| | | private final ConcurrentSkipListMap<ReplicaId, CopyOnWriteArrayList<ReplicaCursor>> replicaCursors = |
| | | new ConcurrentSkipListMap<ReplicaId, CopyOnWriteArrayList<ReplicaCursor>>(); |
| | | new ConcurrentSkipListMap<>(); |
| | | private ReplicationDbEnv replicationEnv; |
| | | private final ReplicationServerCfg config; |
| | | private final File dbDirectory; |
| | |
| | | * @GuardedBy("cnIndexDBLock") |
| | | */ |
| | | private JEChangeNumberIndexDB cnIndexDB; |
| | | private final AtomicReference<ChangeNumberIndexer> cnIndexer = new AtomicReference<ChangeNumberIndexer>(); |
| | | private final AtomicReference<ChangeNumberIndexer> cnIndexer = new AtomicReference<>(); |
| | | |
| | | /** Used for protecting {@link ChangeNumberIndexDB} related state. */ |
| | | private final Object cnIndexDBLock = new Object(); |
| | |
| | | * older than this delay might be removed. |
| | | */ |
| | | private volatile long purgeDelayInMillis; |
| | | private final AtomicReference<ChangelogDBPurger> cnPurger = new AtomicReference<ChangelogDBPurger>(); |
| | | private final AtomicReference<ChangelogDBPurger> cnPurger = new AtomicReference<>(); |
| | | |
| | | /** The local replication server. */ |
| | | private final ReplicationServer replicationServer; |
| | |
| | | |
| | | // unlucky, the domainMap does not exist: take the hit and create the |
| | | // newValue, even though the same could be done concurrently by another thread |
| | | final ConcurrentMap<Integer, JEReplicaDB> newValue = new ConcurrentHashMap<Integer, JEReplicaDB>(); |
| | | final ConcurrentMap<Integer, JEReplicaDB> newValue = new ConcurrentHashMap<>(); |
| | | final ConcurrentMap<Integer, JEReplicaDB> previousValue = domainToReplicaDBs.putIfAbsent(baseDN, newValue); |
| | | if (previousValue != null) |
| | | { |
| | |
| | | CopyOnWriteArrayList<V> cursors = map.get(key); |
| | | if (cursors == null) |
| | | { |
| | | cursors = new CopyOnWriteArrayList<V>(); |
| | | cursors = new CopyOnWriteArrayList<>(); |
| | | CopyOnWriteArrayList<V> previousValue = map.putIfAbsent(key, cursors); |
| | | if (previousValue != null) |
| | | { |
| | |
| | | @Override |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | final List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | final List<Attribute> attributes = new ArrayList<>(); |
| | | create(attributes, "replicationServer-database",String.valueOf(serverId)); |
| | | create(attributes, "domain-name", baseDN.toString()); |
| | | final CSNLimits limits = csnLimits; |
| | |
| | | private final ChangelogState changelogState; |
| | | /** Exclusive lock to synchronize updates to in-memory and on-disk changelogState. */ |
| | | private final Object stateLock = new Object(); |
| | | private final List<Database> allDbs = new CopyOnWriteArrayList<Database>(); |
| | | private final List<Database> allDbs = new CopyOnWriteArrayList<>(); |
| | | private ReplicationServer replicationServer; |
| | | private final AtomicBoolean isShuttingDown = new AtomicBoolean(false); |
| | | private static final String GENERATION_ID_TAG = "GENID"; |
| | |
| | | |
| | | try |
| | | { |
| | | final Map<byte[], byte[]> results = new LinkedHashMap<byte[], byte[]>(); |
| | | final Map<byte[], byte[]> results = new LinkedHashMap<>(); |
| | | |
| | | OperationStatus status = cursor.getFirst(key, data, LockMode.DEFAULT); |
| | | while (status == OperationStatus.SUCCESS) |
| | |
| | | { |
| | | final String key = serverId + FIELD_SEPARATOR + baseDN.toNormalizedUrlSafeString(); |
| | | final String value = serverId + FIELD_SEPARATOR + baseDN; |
| | | return new SimpleImmutableEntry<String, String>(key, value); |
| | | return toEntry(key, value); |
| | | } |
| | | |
| | | /** |
| | |
| | | static Entry<byte[], byte[]> toGenIdEntry(DN baseDN, long generationId) |
| | | { |
| | | final String key = GENERATION_ID_TAG + FIELD_SEPARATOR + baseDN.toNormalizedUrlSafeString(); |
| | | final String data = GENERATION_ID_TAG + FIELD_SEPARATOR + generationId |
| | | + FIELD_SEPARATOR + baseDN; |
| | | return new SimpleImmutableEntry<byte[], byte[]>(toBytes(key), toBytes(data)); |
| | | final String data = GENERATION_ID_TAG + FIELD_SEPARATOR + generationId + FIELD_SEPARATOR + baseDN; |
| | | return toEntry(toBytes(key), toBytes(data)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | static Entry<byte[], byte[]> toByteArray(Entry<String, String> entry) |
| | | { |
| | | return new SimpleImmutableEntry<byte[], byte[]>(toBytes(entry.getKey()), toBytes(entry.getValue())); |
| | | return toEntry(toBytes(entry.getKey()), toBytes(entry.getValue())); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | final int serverId = offlineCSN.getServerId(); |
| | | final byte[] key = toReplicaOfflineKey(baseDN, serverId); |
| | | final byte[] data = toBytes(offlineCSN.getTime() + FIELD_SEPARATOR + serverId |
| | | + FIELD_SEPARATOR + baseDN); |
| | | return new SimpleImmutableEntry<byte[], byte[]>(key, data); |
| | | final byte[] data = toBytes(offlineCSN.getTime() + FIELD_SEPARATOR + serverId + FIELD_SEPARATOR + baseDN); |
| | | return toEntry(key, data); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** Returns an entry with the provided key and a null value. */ |
| | | private SimpleImmutableEntry<byte[], byte[]> toEntryWithNullValue(byte[] key) |
| | | { |
| | | return new SimpleImmutableEntry<byte[], byte[]>(key, null); |
| | | return toEntry(key, null); |
| | | } |
| | | |
| | | private static <K, V> SimpleImmutableEntry<K, V> toEntry(final K key, final V value) |
| | | { |
| | | return new SimpleImmutableEntry<>(key, value); |
| | | } |
| | | |
| | | private void putInChangelogStateDBIfNotExist(Entry<byte[], byte[]> entry) |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2014 ForgeRock AS |
| | | * Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.service; |
| | | |
| | |
| | | */ |
| | | public class DSRSShutdownSync |
| | | { |
| | | |
| | | private static final ConcurrentSkipListSet<DN> replicaOfflineMsgs = |
| | | new ConcurrentSkipListSet<DN>(); |
| | | private static final ConcurrentSkipListSet<DN> replicaOfflineMsgs = new ConcurrentSkipListSet<>(); |
| | | private static AtomicLong stopInstanceTimestamp = new AtomicLong(); |
| | | |
| | | /** |
| | |
| | | * connected RS. |
| | | */ |
| | | // @NotNull // for the reference |
| | | private final AtomicReference<ConnectedRS> connectedRS = |
| | | new AtomicReference<ConnectedRS>(ConnectedRS.noConnectedRS()); |
| | | private final AtomicReference<ConnectedRS> connectedRS = new AtomicReference<>(ConnectedRS.noConnectedRS()); |
| | | /** Our replication domain. */ |
| | | private final ReplicationDomain domain; |
| | | /** |
| | |
| | | * as seen by the ReplicationServer the last time it was polled or the last |
| | | * time it published monitoring information. |
| | | */ |
| | | private Map<Integer, ServerState> replicaStates = |
| | | new HashMap<Integer, ServerState>(); |
| | | /** |
| | | * A thread to monitor heartbeats on the session. |
| | | */ |
| | | private Map<Integer, ServerState> replicaStates = new HashMap<>(); |
| | | /** A thread to monitor heartbeats on the session. */ |
| | | private HeartbeatMonitor heartbeatMonitor; |
| | | /** |
| | | * The number of times the connection was lost. |
| | | */ |
| | | /** The number of times the connection was lost. */ |
| | | private int numLostConnections; |
| | | /** |
| | | * When the broker cannot connect to any replication server |
| | |
| | | * Properties for the last topology info received from the network. |
| | | */ |
| | | /** Contains the last known state of the replication topology. */ |
| | | private final AtomicReference<Topology> topology = |
| | | new AtomicReference<Topology>(new Topology()); |
| | | private final AtomicReference<Topology> topology = new AtomicReference<>(new Topology()); |
| | | /** <pre>@GuardedBy("this")</pre>. */ |
| | | private volatile int updateDoneCount; |
| | | private volatile boolean connectRequiresRecovery; |
| | |
| | | */ |
| | | private Map<Integer, ReplicationServerInfo> collectReplicationServersInfo() |
| | | { |
| | | final Map<Integer, ReplicationServerInfo> rsInfos = |
| | | new ConcurrentSkipListMap<Integer, ReplicationServerInfo>(); |
| | | final Map<Integer, ReplicationServerInfo> rsInfos = new ConcurrentSkipListMap<>(); |
| | | |
| | | for (String serverUrl : getReplicationServerUrls()) |
| | | { |
| | |
| | | */ |
| | | static class RSEvaluations |
| | | { |
| | | |
| | | private final int localServerId; |
| | | private Map<Integer, ReplicationServerInfo> bestRSs; |
| | | private final Map<Integer, LocalizableMessage> rsEvals = |
| | | new HashMap<Integer, LocalizableMessage>(); |
| | | private final Map<Integer, LocalizableMessage> rsEvals = new HashMap<>(); |
| | | |
| | | /** |
| | | * Ctor. |
| | |
| | | */ |
| | | private static class LocalEvaluation |
| | | { |
| | | private final Map<Integer, ReplicationServerInfo> accepted = |
| | | new HashMap<Integer, ReplicationServerInfo>(); |
| | | private final Map<ReplicationServerInfo, LocalizableMessage> rsEvals = |
| | | new HashMap<ReplicationServerInfo, LocalizableMessage>(); |
| | | private final Map<Integer, ReplicationServerInfo> accepted = new HashMap<>(); |
| | | private final Map<ReplicationServerInfo, LocalizableMessage> rsEvals = new HashMap<>(); |
| | | |
| | | private void accept(Integer rsId, ReplicationServerInfo rsInfo) |
| | | { |
| | |
| | | |
| | | public Map<Integer, LocalizableMessage> getRejected() |
| | | { |
| | | final Map<Integer, LocalizableMessage> result = new HashMap<Integer, LocalizableMessage>(); |
| | | final Map<Integer, LocalizableMessage> result = new HashMap<>(); |
| | | for (Entry<ReplicationServerInfo, LocalizableMessage> entry : rsEvals.entrySet()) |
| | | { |
| | | result.put(entry.getKey().getServerId(), entry.getValue()); |
| | |
| | | |
| | | // Distance (difference) of the current loads to the load goals of each RS: |
| | | // key:server id, value: distance |
| | | Map<Integer, BigDecimal> loadDistances = new HashMap<Integer, BigDecimal>(); |
| | | Map<Integer, BigDecimal> loadDistances = new HashMap<>(); |
| | | // Precision for the operations (number of digits after the dot) |
| | | final MathContext mathContext = new MathContext(32, RoundingMode.HALF_UP); |
| | | for (Entry<Integer, ReplicationServerInfo> entry : bestServers.entrySet()) |
| | |
| | | private static boolean isServerOverloadingRS(int localServerId, |
| | | ReplicationServerInfo currentRsInfo, int overloadingDSsNumber) |
| | | { |
| | | List<Integer> serversConnectedToCurrentRS = |
| | | new ArrayList<Integer>(currentRsInfo.getConnectedDSs()); |
| | | List<Integer> serversConnectedToCurrentRS = new ArrayList<>(currentRsInfo.getConnectedDSs()); |
| | | Collections.sort(serversConnectedToCurrentRS); |
| | | |
| | | final int idx = serversConnectedToCurrentRS.indexOf(localServerId); |
| | |
| | | MonitorMsg monitorMsg = (MonitorMsg) msg; |
| | | |
| | | // Extract and store replicas ServerStates |
| | | final Map<Integer, ServerState> newReplicaStates = |
| | | new HashMap<Integer, ServerState>(); |
| | | final Map<Integer, ServerState> newReplicaStates = new HashMap<>(); |
| | | for (int srvId : toIterable(monitorMsg.ldapIterator())) |
| | | { |
| | | newReplicaStates.put(srvId, monitorMsg.getLDAPServerState(srvId)); |
| | |
| | | |
| | | private List<RSInfo> toRSInfos(Map<Integer, ReplicationServerInfo> rsInfos) |
| | | { |
| | | final List<RSInfo> result = new ArrayList<RSInfo>(); |
| | | final List<RSInfo> result = new ArrayList<>(); |
| | | for (ReplicationServerInfo rsInfo : rsInfos.values()) |
| | | { |
| | | result.add(rsInfo.toRSInfo()); |
| | |
| | | private Map<Integer, DSInfo> removeThisDs(Map<Integer, DSInfo> dsInfos, |
| | | int dsServerId) |
| | | { |
| | | final Map<Integer, DSInfo> copy = new HashMap<Integer, DSInfo>(dsInfos); |
| | | final Map<Integer, DSInfo> copy = new HashMap<>(dsInfos); |
| | | copy.remove(dsServerId); |
| | | return Collections.unmodifiableMap(copy); |
| | | } |
| | |
| | | Map<Integer, ReplicationServerInfo> previousRsInfos, |
| | | Set<String> configuredReplicationServerUrls) |
| | | { |
| | | final Map<Integer, ReplicationServerInfo> results = |
| | | new HashMap<Integer, ReplicationServerInfo>(previousRsInfos); |
| | | final Map<Integer, ReplicationServerInfo> results = new HashMap<>(previousRsInfos); |
| | | |
| | | // Update replication server info list with the received topology info |
| | | final Set<Integer> rssToKeep = new HashSet<Integer>(); |
| | | final Set<Integer> rssToKeep = new HashSet<>(); |
| | | for (RSInfo newRSInfo : newRsInfos) |
| | | { |
| | | final int rsId = newRSInfo.getId(); |
| | |
| | | /** Computes the list of DSs connected to a particular RS. */ |
| | | private Set<Integer> computeDSsConnectedTo(int rsId, int dsServerId) |
| | | { |
| | | final Set<Integer> connectedDSs = new HashSet<Integer>(); |
| | | final Set<Integer> connectedDSs = new HashSet<>(); |
| | | if (rsServerId == rsId) |
| | | { |
| | | /* |
| | |
| | | { |
| | | boolean configurationChanged = false; |
| | | |
| | | Set<String> s1 = new HashSet<String>(includeAttributes); |
| | | Set<String> s1 = new HashSet<>(includeAttributes); |
| | | |
| | | // Combine all+delete attributes. |
| | | Set<String> s2 = new HashSet<String>(s1); |
| | | Set<String> s2 = new HashSet<>(s1); |
| | | s2.addAll(includeAttributesForDeletes); |
| | | |
| | | Map<Integer,Set<String>> eclIncludesByServer = this.includedAttrsByServer; |
| | | if (!s1.equals(this.includedAttrsByServer.get(serverId))) |
| | | { |
| | | configurationChanged = true; |
| | | eclIncludesByServer = new HashMap<Integer, Set<String>>( |
| | | this.includedAttrsByServer); |
| | | eclIncludesByServer = new HashMap<>(this.includedAttrsByServer); |
| | | eclIncludesByServer.put(serverId, Collections.unmodifiableSet(s1)); |
| | | } |
| | | |
| | | Map<Integer, Set<String>> eclIncludesForDeletesByServer = |
| | | this.includedAttrsForDeletesByServer; |
| | | Map<Integer, Set<String>> eclIncludesForDeletesByServer = this.includedAttrsForDeletesByServer; |
| | | if (!s2.equals(this.includedAttrsForDeletesByServer.get(serverId))) |
| | | { |
| | | configurationChanged = true; |
| | | eclIncludesForDeletesByServer = new HashMap<Integer, Set<String>>( |
| | | this.includedAttrsForDeletesByServer); |
| | | eclIncludesForDeletesByServer.put( |
| | | serverId, Collections.unmodifiableSet(s2)); |
| | | eclIncludesForDeletesByServer = new HashMap<>(this.includedAttrsForDeletesByServer); |
| | | eclIncludesForDeletesByServer.put(serverId, Collections.unmodifiableSet(s2)); |
| | | } |
| | | |
| | | if (!configurationChanged) |
| | |
| | | } |
| | | |
| | | // and rebuild the global list to be ready for usage |
| | | Set<String> eclIncludesAllServer = new HashSet<String>(); |
| | | Set<String> eclIncludesAllServer = new HashSet<>(); |
| | | for (Set<String> attributes : eclIncludesByServer.values()) |
| | | { |
| | | eclIncludesAllServer.addAll(attributes); |
| | | } |
| | | |
| | | Set<String> eclIncludesForDeletesAllServer = new HashSet<String>(); |
| | | Set<String> eclIncludesForDeletesAllServer = new HashSet<>(); |
| | | for (Set<String> attributes : eclIncludesForDeletesByServer.values()) |
| | | { |
| | | eclIncludesForDeletesAllServer.addAll(attributes); |
| | |
| | | * to be able to correlate all the coming back acks to the original |
| | | * operation. |
| | | */ |
| | | private final Map<CSN, UpdateMsg> waitingAckMsgs = |
| | | new ConcurrentHashMap<CSN, UpdateMsg>(); |
| | | |
| | | |
| | | private final Map<CSN, UpdateMsg> waitingAckMsgs = new ConcurrentHashMap<>(); |
| | | /** |
| | | * The context related to an import or export being processed |
| | | * Null when none is being processed. |
| | | */ |
| | | private final AtomicReference<ImportExportContext> importExportContext = |
| | | new AtomicReference<ImportExportContext>(); |
| | | private final AtomicReference<ImportExportContext> importExportContext = new AtomicReference<>(); |
| | | |
| | | /** |
| | | * The Thread waiting for incoming update messages for this domain and pushing |
| | |
| | | */ |
| | | private volatile DirectoryThread listenerThread; |
| | | |
| | | /** |
| | | * A set of counters used for Monitoring. |
| | | */ |
| | | /** A set of counters used for Monitoring. */ |
| | | private AtomicInteger numProcessedUpdates = new AtomicInteger(0); |
| | | private AtomicInteger numRcvdUpdates = new AtomicInteger(0); |
| | | private AtomicInteger numSentUpdates = new AtomicInteger(0); |
| | |
| | | * successfully acknowledged (either because of timeout, wrong status or error |
| | | * at replay). |
| | | */ |
| | | private AtomicInteger assuredSrNotAcknowledgedUpdates = |
| | | new AtomicInteger(0); |
| | | private AtomicInteger assuredSrNotAcknowledgedUpdates = new AtomicInteger(0); |
| | | /** |
| | | * Number of updates sent in Assured Mode, Safe Read, that have not been |
| | | * successfully acknowledged because of timeout. |
| | |
| | | * <p> |
| | | * String format: <server id>:<number of failed updates> |
| | | */ |
| | | private final Map<Integer, Integer> assuredSrServerNotAcknowledgedUpdates = |
| | | new HashMap<Integer,Integer>(); |
| | | private final Map<Integer, Integer> assuredSrServerNotAcknowledgedUpdates = new HashMap<>(); |
| | | /** Number of updates received in Assured Mode, Safe Read request. */ |
| | | private AtomicInteger assuredSrReceivedUpdates = new AtomicInteger(0); |
| | | /** |
| | |
| | | * <p> |
| | | * String format: <server id>:<number of failed updates> |
| | | */ |
| | | private final Map<Integer, Integer> assuredSdServerTimeoutUpdates = |
| | | new HashMap<Integer,Integer>(); |
| | | private final Map<Integer, Integer> assuredSdServerTimeoutUpdates = new HashMap<>(); |
| | | |
| | | /* Status related monitoring fields */ |
| | | |
| | |
| | | */ |
| | | private final CSNGenerator generator; |
| | | |
| | | private final AtomicReference<ECLIncludes> eclIncludes = |
| | | new AtomicReference<ECLIncludes>(new ECLIncludes()); |
| | | private final AtomicReference<ECLIncludes> eclIncludes = new AtomicReference<>(new ECLIncludes()); |
| | | |
| | | /** |
| | | * An object used to protect the initialization of the underlying broker |
| | |
| | | */ |
| | | private final long startTime; |
| | | |
| | | /** |
| | | * List for replicas (DS) connected to the topology when initialization |
| | | * started. |
| | | */ |
| | | private final Set<Integer> startList = new HashSet<Integer>(0); |
| | | /** List for replicas (DS) connected to the topology when initialization started. */ |
| | | private final Set<Integer> startList = new HashSet<>(0); |
| | | |
| | | /** |
| | | * List for replicas (DS) with a failure (disconnected from the topology) |
| | | * since the initialization started. |
| | | */ |
| | | private final Set<Integer> failureList = new HashSet<Integer>(0); |
| | | private final Set<Integer> failureList = new HashSet<>(0); |
| | | |
| | | /** |
| | | * Flow control during initialization: for each remote server, counter of |
| | | * messages received. |
| | | */ |
| | | private final Map<Integer, Integer> ackVals = |
| | | new HashMap<Integer, Integer>(); |
| | | /** |
| | | * ServerId of the slowest server (the one with the smallest non null |
| | | * counter). |
| | | */ |
| | | private final Map<Integer, Integer> ackVals = new HashMap<>(); |
| | | /** ServerId of the slowest server (the one with the smallest non null counter). */ |
| | | private int slowestServerId = -1; |
| | | |
| | | private short exporterProtocolVersion = -1; |
| | |
| | | */ |
| | | private void waitForRemoteStartOfInit(ImportExportContext ieCtx) |
| | | { |
| | | final Set<Integer> replicasWeAreWaitingFor = |
| | | new HashSet<Integer>(ieCtx.startList); |
| | | final Set<Integer> replicasWeAreWaitingFor = new HashSet<>(ieCtx.startList); |
| | | |
| | | if (logger.isTraceEnabled()) |
| | | logger.trace( |
| | |
| | | */ |
| | | private void waitForRemoteEndOfInit(ImportExportContext ieCtx) |
| | | { |
| | | final Set<Integer> replicasWeAreWaitingFor = |
| | | new HashSet<Integer>(ieCtx.startList); |
| | | final Set<Integer> replicasWeAreWaitingFor = new HashSet<>(ieCtx.startList); |
| | | |
| | | if (logger.isTraceEnabled()) |
| | | logger.trace( |
| | |
| | | { |
| | | synchronized(assuredSrServerNotAcknowledgedUpdates) |
| | | { |
| | | return new HashMap<Integer, Integer>( |
| | | assuredSrServerNotAcknowledgedUpdates); |
| | | return new HashMap<>(assuredSrServerNotAcknowledgedUpdates); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | synchronized(assuredSdServerTimeoutUpdates) |
| | | { |
| | | return new HashMap<Integer, Integer>(assuredSdServerTimeoutUpdates); |
| | | return new HashMap<>(assuredSdServerTimeoutUpdates); |
| | | } |
| | | } |
| | | |
| | |
| | | // -> replay error occurred |
| | | ackMsg.setHasReplayError(true); |
| | | // -> replay error occurred in our server |
| | | List<Integer> idList = new ArrayList<Integer>(); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | idList.add(getServerId()); |
| | | ackMsg.setFailedServers(idList); |
| | | } |
| | |
| | | */ |
| | | public Collection<Attribute> getAdditionalMonitoring() |
| | | { |
| | | return new ArrayList<Attribute>(); |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public List<Attribute> getMonitorData() |
| | | { |
| | | List<Attribute> attributes = new ArrayList<Attribute>(); |
| | | List<Attribute> attributes = new ArrayList<>(); |
| | | |
| | | attributes.add(Attributes.create("domain-name", String.valueOf(domain.getBaseDN()))); |
| | | attributes.add(Attributes.create("connected-to", domain.getReplicationServer())); |
| | |
| | | // we get to the end of the value. But before we start, set default values |
| | | // for everything else we might need to know. |
| | | String primaryName = oid; |
| | | List<String> typeNames = new LinkedList<String>(); |
| | | List<String> typeNames = new LinkedList<>(); |
| | | String description = null; |
| | | AttributeType superiorType = null; |
| | | Syntax syntax = DirectoryServer.getDefaultAttributeSyntax(); |
| | |
| | | boolean isNoUserModification = false; |
| | | boolean isObsolete = false; |
| | | boolean isSingleValue = false; |
| | | HashMap<String,List<String>> extraProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | HashMap<String,List<String>> extraProperties = new LinkedHashMap<>(); |
| | | |
| | | |
| | | while (true) |
| | |
| | | // either a single value in single quotes or an open parenthesis |
| | | // followed by one or more values in single quotes separated by spaces |
| | | // followed by a close parenthesis. |
| | | List<String> valueList = new ArrayList<String>(); |
| | | List<String> valueList = new ArrayList<>(); |
| | | pos = readExtraParameterValues(valueStr, valueList, pos); |
| | | extraProperties.put(tokenName, valueList); |
| | | } |
| | |
| | | MatchingRuleFactory<CollationMatchingRuleCfg> implements |
| | | ConfigurationChangeListener<CollationMatchingRuleCfg> |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** Stores the list of available locales on this JVM. */ |
| | | private static final Set<Locale> supportedLocales = new HashSet<Locale>( |
| | | Arrays.asList(Locale.getAvailableLocales())); |
| | | private static final Set<Locale> supportedLocales = new HashSet<>(Arrays.asList(Locale.getAvailableLocales())); |
| | | |
| | | /** Current Configuration. */ |
| | | private CollationMatchingRuleCfg currentConfig; |
| | | |
| | | /** Map of OID and the Matching Rule. */ |
| | | private final Map<String, MatchingRule> matchingRules = |
| | | new HashMap<String, MatchingRule>(); |
| | | private final Map<String, MatchingRule> matchingRules = new HashMap<>(); |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of CollationMatchingRuleFactory. |
| | | */ |
| | | /** Creates a new instance of CollationMatchingRuleFactory. */ |
| | | public CollationMatchingRuleFactory() |
| | | { |
| | | super(); |
| | |
| | | // out what it is and how to treat what comes after it, then repeat until |
| | | // we get to the end of the value. But before we start, set default values |
| | | // for everything else we might need to know. |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<>(); |
| | | String description = null; |
| | | boolean isObsolete = false; |
| | | LinkedHashSet<ObjectClass> auxiliaryClasses = |
| | | new LinkedHashSet<ObjectClass>(); |
| | | LinkedHashSet<AttributeType> requiredAttributes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | LinkedHashSet<AttributeType> optionalAttributes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | LinkedHashSet<AttributeType> prohibitedAttributes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | LinkedHashMap<String,List<String>> extraProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | LinkedHashSet<ObjectClass> auxiliaryClasses = new LinkedHashSet<>(); |
| | | LinkedHashSet<AttributeType> requiredAttributes = new LinkedHashSet<>(); |
| | | LinkedHashSet<AttributeType> optionalAttributes = new LinkedHashSet<>(); |
| | | LinkedHashSet<AttributeType> prohibitedAttributes = new LinkedHashSet<>(); |
| | | LinkedHashMap<String,List<String>> extraProperties = new LinkedHashMap<>(); |
| | | |
| | | |
| | | while (true) |
| | |
| | | } |
| | | else if (lowerTokenName.equals("aux")) |
| | | { |
| | | LinkedList<ObjectClass> ocs = new LinkedList<ObjectClass>(); |
| | | LinkedList<ObjectClass> ocs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of required auxiliary objectclasses for this |
| | | // DIT content rule. It may be a single name or OID (not in quotes), or |
| | |
| | | } |
| | | else if (lowerTokenName.equals("must")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of required attributes for the DIT content |
| | | // rule. It may be a single name or OID (not in quotes), or it may be |
| | |
| | | } |
| | | else if (lowerTokenName.equals("may")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of optional attributes for the DIT content |
| | | // rule. It may be a single name or OID (not in quotes), or it may be |
| | |
| | | } |
| | | else if (lowerTokenName.equals("not")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of prohibited attributes for the DIT content |
| | | // rule. It may be a single name or OID (not in quotes), or it may be |
| | |
| | | // either a single value in single quotes or an open parenthesis |
| | | // followed by one or more values in single quotes separated by spaces |
| | | // followed by a close parenthesis. |
| | | LinkedList<String> valueList = new LinkedList<String>(); |
| | | LinkedList<String> valueList = new LinkedList<>(); |
| | | pos = readExtraParameterValues(valueStr, valueList, pos); |
| | | extraProperties.put(tokenName, valueList); |
| | | } |
| | |
| | | // out what it is and how to treat what comes after it, then repeat until |
| | | // we get to the end of the value. But before we start, set default values |
| | | // for everything else we might need to know. |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<>(); |
| | | String description = null; |
| | | boolean isObsolete = false; |
| | | NameForm nameForm = null; |
| | | boolean nameFormGiven = false; |
| | | LinkedHashSet<DITStructureRule> superiorRules = null; |
| | | LinkedHashMap<String,List<String>> extraProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | LinkedHashMap<String,List<String>> extraProperties = new LinkedHashMap<>(); |
| | | |
| | | |
| | | while (true) |
| | |
| | | } |
| | | else if (lowerTokenName.equals("sup")) |
| | | { |
| | | LinkedList<DITStructureRule> superiorList = |
| | | new LinkedList<DITStructureRule>(); |
| | | LinkedList<DITStructureRule> superiorList = new LinkedList<>(); |
| | | |
| | | // This specifies the set of superior rule IDs (which are integers) for |
| | | // this DIT structure rule. It may be a single rule ID or a set of |
| | |
| | | } |
| | | } |
| | | |
| | | superiorRules = new LinkedHashSet<DITStructureRule>(superiorList); |
| | | superiorRules = new LinkedHashSet<>(superiorList); |
| | | } |
| | | else |
| | | { |
| | |
| | | // either a single value in single quotes or an open parenthesis |
| | | // followed by one or more values in single quotes separated by spaces |
| | | // followed by a close parenthesis. |
| | | LinkedList<String> valueList = |
| | | new LinkedList<String>(); |
| | | LinkedList<String> valueList = new LinkedList<>(); |
| | | pos = readExtraParameterValues(valueStr, valueList, pos); |
| | | extraProperties.put(tokenName, valueList); |
| | | } |
| | |
| | | // for everything else we might need to know. |
| | | String description = null; |
| | | Syntax syntax = null; |
| | | HashMap<String,List<String>> extraProperties = new LinkedHashMap<String,List<String>>(); |
| | | HashMap<String,List<String>> extraProperties = new LinkedHashMap<>(); |
| | | boolean hasXSyntaxToken = false; |
| | | |
| | | while (true) |
| | |
| | | message); |
| | | } |
| | | hasXSyntaxToken = true; |
| | | LinkedList<String> values = new LinkedList<String>(); |
| | | LinkedList<String> values = new LinkedList<>(); |
| | | pos = readExtraParameterValues(valueStr, values, pos); |
| | | |
| | | if (values.isEmpty()) |
| | |
| | | // either a single value in single quotes or an open parenthesis |
| | | // followed by one or more values in single quotes separated by spaces |
| | | // followed by a close parenthesis. |
| | | List<String> valueList = new ArrayList<String>(); |
| | | List<String> valueList = new ArrayList<>(); |
| | | pos = readExtraParameterValues(valueStr, valueList, pos); |
| | | extraProperties.put(tokenName, valueList); |
| | | } |
| | |
| | | // out what it is and how to treat what comes after it, then repeat until |
| | | // we get to the end of the value. But before we start, set default values |
| | | // for everything else we might need to know. |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<>(); |
| | | String description = null; |
| | | boolean isObsolete = false; |
| | | LinkedHashSet<AttributeType> attributes = null; |
| | | LinkedHashMap<String,List<String>> extraProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | LinkedHashMap<String,List<String>> extraProperties = new LinkedHashMap<>(); |
| | | |
| | | while (true) |
| | | { |
| | |
| | | } |
| | | else if (lowerTokenName.equals("applies")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of attribute types that may be used with the |
| | | // associated matching rule. It may be a single name or OID (not in |
| | |
| | | attrs.add(attr); |
| | | } |
| | | |
| | | attributes = new LinkedHashSet<AttributeType>(attrs); |
| | | attributes = new LinkedHashSet<>(attrs); |
| | | } |
| | | else |
| | | { |
| | |
| | | // either a single value in single quotes or an open parenthesis |
| | | // followed by one or more values in single quotes separated by spaces |
| | | // followed by a close parenthesis. |
| | | LinkedList<String> valueList = new LinkedList<String>(); |
| | | LinkedList<String> valueList = new LinkedList<>(); |
| | | pos = readExtraParameterValues(valueStr, valueList, pos); |
| | | extraProperties.put(tokenName, valueList); |
| | | } |
| | |
| | | // out what it is and how to treat what comes after it, then repeat until |
| | | // we get to the end of the value. But before we start, set default values |
| | | // for everything else we might need to know. |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<String,String> names = new LinkedHashMap<>(); |
| | | String description = null; |
| | | boolean isObsolete = false; |
| | | ObjectClass structuralClass = null; |
| | | LinkedHashSet<AttributeType> requiredAttributes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | LinkedHashSet<AttributeType> optionalAttributes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | LinkedHashMap<String,List<String>> extraProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | LinkedHashSet<AttributeType> requiredAttributes = new LinkedHashSet<>(); |
| | | LinkedHashSet<AttributeType> optionalAttributes = new LinkedHashSet<>(); |
| | | LinkedHashMap<String,List<String>> extraProperties = new LinkedHashMap<>(); |
| | | |
| | | |
| | | while (true) |
| | |
| | | } |
| | | else if (lowerTokenName.equals("must")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of required attributes for the name from. |
| | | // It may be a single name or OID (not in quotes), or it may be an |
| | |
| | | } |
| | | else if (lowerTokenName.equals("may")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of optional attributes for the name form. It |
| | | // may be a single name or OID (not in quotes), or it may be an open |
| | |
| | | // either a single value in single quotes or an open parenthesis |
| | | // followed by one or more values in single quotes separated by spaces |
| | | // followed by a close parenthesis. |
| | | LinkedList<String> valueList = new LinkedList<String>(); |
| | | LinkedList<String> valueList = new LinkedList<>(); |
| | | pos = readExtraParameterValues(valueStr, valueList, pos); |
| | | extraProperties.put(tokenName, valueList); |
| | | } |
| | |
| | | // we get to the end of the value. But before we start, set default values |
| | | // for everything else we might need to know. |
| | | String primaryName = oid; |
| | | List<String> names = new LinkedList<String>(); |
| | | List<String> names = new LinkedList<>(); |
| | | String description = null; |
| | | boolean isObsolete = false; |
| | | Set<AttributeType> requiredAttributes = new LinkedHashSet<AttributeType>(); |
| | | Set<AttributeType> optionalAttributes = new LinkedHashSet<AttributeType>(); |
| | | Set<ObjectClass> superiorClasses = new LinkedHashSet<ObjectClass>(); |
| | | Set<AttributeType> requiredAttributes = new LinkedHashSet<>(); |
| | | Set<AttributeType> optionalAttributes = new LinkedHashSet<>(); |
| | | Set<ObjectClass> superiorClasses = new LinkedHashSet<>(); |
| | | //Default OC Type is STRUCTURAL ( RFC 4512 4.1.1) |
| | | ObjectClassType objectClassType = ObjectClassType.STRUCTURAL; |
| | | Map<String, List<String>> extraProperties = |
| | | new LinkedHashMap<String, List<String>>(); |
| | | Map<String, List<String>> extraProperties = new LinkedHashMap<>(); |
| | | |
| | | |
| | | while (true) |
| | |
| | | // by one or more names separated by spaces and the dollar sign |
| | | // character, followed by a closing parenthesis. |
| | | c = valueStr.charAt(pos++); |
| | | LinkedList<ObjectClass> listSupOCs = new LinkedList<ObjectClass>(); |
| | | LinkedList<ObjectClass> listSupOCs = new LinkedList<>(); |
| | | if(c == '(') |
| | | { |
| | | while(true) |
| | |
| | | } |
| | | else if (lowerTokenName.equals("must")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of required attributes for the objectclass. |
| | | // It may be a single name or OID (not in quotes), or it may be an |
| | |
| | | } |
| | | else if (lowerTokenName.equals("may")) |
| | | { |
| | | LinkedList<AttributeType> attrs = new LinkedList<AttributeType>(); |
| | | LinkedList<AttributeType> attrs = new LinkedList<>(); |
| | | |
| | | // This specifies the set of optional attributes for the objectclass. |
| | | // It may be a single name or OID (not in quotes), or it may be an |
| | |
| | | // either a single value in single quotes or an open parenthesis |
| | | // followed by one or more values in single quotes separated by spaces |
| | | // followed by a close parenthesis. |
| | | List<String> valueList = new LinkedList<String>(); |
| | | List<String> valueList = new LinkedList<>(); |
| | | pos = readExtraParameterValues(valueStr, valueList, pos); |
| | | extraProperties.put(tokenName, valueList); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | public void initializeMatchingRule(MatchingRuleCfg configuration) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | matchingRules = new HashSet<MatchingRule>(); |
| | | matchingRules = new HashSet<>(); |
| | | // relative time greater than |
| | | matchingRules.add(CoreSchema.getInstance().getMatchingRule("1.3.6.1.4.1.26027.1.4.5")); |
| | | // relative time less than |
| | |
| | | // the schema directory. |
| | | String schemaInstanceDirectory = |
| | | SchemaConfigManager.getSchemaDirectoryPath(); |
| | | filesToAdd = new TreeSet<String>(); |
| | | filesToAdd = new TreeSet<>(); |
| | | for (Attribute a : attrList) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | try |
| | | { |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | Schema schema = DirectoryServer.getSchema().duplicate(); |
| | | for (String schemaFile : filesToAdd) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Stores mapping between configuration attribute name and its label. |
| | | */ |
| | | private static Map<String,LocalizableMessage> argDisplayMap = |
| | | new HashMap<String,LocalizableMessage>(); |
| | | /** Stores mapping between configuration attribute name and its label. */ |
| | | private static Map<String,LocalizableMessage> argDisplayMap = new HashMap<>(); |
| | | static { |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_ALL, |
| | | INFO_BACKUP_ARG_BACKUPALL.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_COMPRESS, |
| | | INFO_BACKUP_ARG_COMPRESS.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_ENCRYPT, |
| | | INFO_BACKUP_ARG_ENCRYPT.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_HASH, |
| | | INFO_BACKUP_ARG_HASH.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_INCREMENTAL, |
| | | INFO_BACKUP_ARG_INCREMENTAL.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_SIGN_HASH, |
| | | INFO_BACKUP_ARG_SIGN_HASH.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_BACKEND_ID, |
| | | INFO_BACKUP_ARG_BACKEND_IDS.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_BACKUP_ID, |
| | | INFO_BACKUP_ARG_BACKUP_ID.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_BACKUP_DIRECTORY_PATH, |
| | | INFO_BACKUP_ARG_BACKUP_DIR.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID, |
| | | INFO_BACKUP_ARG_INC_BASE_ID.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_ALL, INFO_BACKUP_ARG_BACKUPALL.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_COMPRESS, INFO_BACKUP_ARG_COMPRESS.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_ENCRYPT, INFO_BACKUP_ARG_ENCRYPT.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_HASH, INFO_BACKUP_ARG_HASH.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_INCREMENTAL, INFO_BACKUP_ARG_INCREMENTAL.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_SIGN_HASH, INFO_BACKUP_ARG_SIGN_HASH.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_BACKEND_ID, INFO_BACKUP_ARG_BACKEND_IDS.get()); |
| | | argDisplayMap.put(ATTR_BACKUP_ID, INFO_BACKUP_ARG_BACKUP_ID.get()); |
| | | argDisplayMap.put(ATTR_BACKUP_DIRECTORY_PATH, INFO_BACKUP_ARG_BACKUP_DIR.get()); |
| | | argDisplayMap.put(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID, INFO_BACKUP_ARG_INC_BASE_ID.get()); |
| | | } |
| | | |
| | | |
| | |
| | | int numBackends = configEntries.size(); |
| | | |
| | | |
| | | backendsToArchive = new ArrayList<Backend<?>>(numBackends); |
| | | backendsToArchive = new ArrayList<>(numBackends); |
| | | |
| | | if (backUpAll) |
| | | { |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** |
| | | * Stores mapping between configuration attribute name and its label. |
| | | */ |
| | | private static Map<String,LocalizableMessage> argDisplayMap = |
| | | new HashMap<String,LocalizableMessage>(); |
| | | /** Stores mapping between configuration attribute name and its label. */ |
| | | private static Map<String,LocalizableMessage> argDisplayMap = new HashMap<>(); |
| | | static { |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_LDIF_FILE, |
| | | INFO_EXPORT_ARG_LDIF_FILE.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_BACKEND_ID, |
| | | INFO_EXPORT_ARG_BACKEND_ID.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_APPEND_TO_LDIF, |
| | | INFO_EXPORT_ARG_APPEND_TO_LDIF.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_COMPRESS_LDIF, |
| | | INFO_EXPORT_ARG_COMPRESS_LDIF.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_ENCRYPT_LDIF, |
| | | INFO_EXPORT_ARG_ENCRYPT_LDIF.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_SIGN_HASH, |
| | | INFO_EXPORT_ARG_SIGN_HASH.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_INCLUDE_ATTRIBUTE, |
| | | INFO_EXPORT_ARG_INCL_ATTR.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_EXCLUDE_ATTRIBUTE, |
| | | INFO_EXPORT_ARG_EXCL_ATTR.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_INCLUDE_FILTER, |
| | | INFO_EXPORT_ARG_INCL_FILTER.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_EXCLUDE_FILTER, |
| | | INFO_EXPORT_ARG_EXCL_FILTER.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_INCLUDE_BRANCH, |
| | | INFO_EXPORT_ARG_INCL_BRANCH.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_EXCLUDE_BRANCH, |
| | | INFO_EXPORT_ARG_EXCL_BRANCH.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_EXPORT_WRAP_COLUMN, |
| | | INFO_EXPORT_ARG_WRAP_COLUMN.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_LDIF_FILE, INFO_EXPORT_ARG_LDIF_FILE.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_BACKEND_ID, INFO_EXPORT_ARG_BACKEND_ID.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_APPEND_TO_LDIF, INFO_EXPORT_ARG_APPEND_TO_LDIF.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_COMPRESS_LDIF, INFO_EXPORT_ARG_COMPRESS_LDIF.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_ENCRYPT_LDIF, INFO_EXPORT_ARG_ENCRYPT_LDIF.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_SIGN_HASH, INFO_EXPORT_ARG_SIGN_HASH.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_INCLUDE_ATTRIBUTE, INFO_EXPORT_ARG_INCL_ATTR.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_EXCLUDE_ATTRIBUTE, INFO_EXPORT_ARG_EXCL_ATTR.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_INCLUDE_FILTER, INFO_EXPORT_ARG_INCL_FILTER.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_EXCLUDE_FILTER, INFO_EXPORT_ARG_EXCL_FILTER.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_INCLUDE_BRANCH, INFO_EXPORT_ARG_INCL_BRANCH.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_EXCLUDE_BRANCH, INFO_EXPORT_ARG_EXCL_BRANCH.get()); |
| | | argDisplayMap.put(ATTR_TASK_EXPORT_WRAP_COLUMN, INFO_EXPORT_ARG_WRAP_COLUMN.get()); |
| | | } |
| | | |
| | | private String ldifFile; |
| | |
| | | } |
| | | else |
| | | { |
| | | excludeFilters = new ArrayList<SearchFilter>(); |
| | | excludeFilters = new ArrayList<>(); |
| | | for (String filterString : excludeFilterStrings) |
| | | { |
| | | try |
| | |
| | | } |
| | | else |
| | | { |
| | | includeFilters = new ArrayList<SearchFilter>(); |
| | | includeFilters = new ArrayList<>(); |
| | | for (String filterString : includeFilterStrings) |
| | | { |
| | | try |
| | |
| | | return TaskState.STOPPED_BY_ERROR; |
| | | } |
| | | |
| | | ArrayList<DN> defaultIncludeBranches = new ArrayList<DN>(backend.getBaseDNs().length); |
| | | ArrayList<DN> defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs().length); |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | | defaultIncludeBranches.add(dn); |
| | | } |
| | | |
| | | ArrayList<DN> excludeBranches = new ArrayList<DN>(); |
| | | ArrayList<DN> excludeBranches = new ArrayList<>(); |
| | | if (excludeBranchStrings != null) |
| | | { |
| | | for (String s : excludeBranchStrings) |
| | |
| | | ArrayList<DN> includeBranches; |
| | | if (!includeBranchStrings.isEmpty()) |
| | | { |
| | | includeBranches = new ArrayList<DN>(); |
| | | includeBranches = new ArrayList<>(); |
| | | for (String s : includeBranchStrings) |
| | | { |
| | | DN includeBranch; |
| | |
| | | { |
| | | return null; |
| | | } |
| | | HashSet<AttributeType> attributes = new HashSet<AttributeType>(); |
| | | HashSet<AttributeType> attributes = new HashSet<>(); |
| | | for (String attrName : attributeStrings) |
| | | { |
| | | String lowerName = attrName.toLowerCase(); |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** Stores mapping between configuration attribute name and its label. */ |
| | | private static final Map<String, LocalizableMessage> argDisplayMap = new HashMap<String, LocalizableMessage>(); |
| | | |
| | | private static final Map<String, LocalizableMessage> argDisplayMap = new HashMap<>(); |
| | | static |
| | | { |
| | | argDisplayMap.put(ATTR_IMPORT_LDIF_FILE, INFO_IMPORT_ARG_LDIF_FILE.get()); |
| | |
| | | AttributeType typeDNCheckPhase2 = getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION, true); |
| | | |
| | | ArrayList<String> ldifFilestmp = asListOfStrings(taskEntry, typeLdifFile); |
| | | ldifFiles = new ArrayList<String>(ldifFilestmp.size()); |
| | | ldifFiles = new ArrayList<>(ldifFilestmp.size()); |
| | | for (String s : ldifFilestmp) |
| | | { |
| | | File f = new File (s); |
| | |
| | | |
| | | Backend<?> backend = null; |
| | | ArrayList<DN> defaultIncludeBranches; |
| | | HashSet<DN> excludeBranches = new HashSet<DN>(excludeBranchStrings.size()); |
| | | HashSet<DN> includeBranches = new HashSet<DN>(includeBranchStrings.size()); |
| | | HashSet<DN> excludeBranches = new HashSet<>(excludeBranchStrings.size()); |
| | | HashSet<DN> includeBranches = new HashSet<>(includeBranchStrings.size()); |
| | | |
| | | for (String s : includeBranchStrings) |
| | | { |
| | |
| | | } |
| | | |
| | | // Make sure the selected backend will handle all the include branches |
| | | defaultIncludeBranches = new ArrayList<DN>(backend.getBaseDNs().length); |
| | | defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs().length); |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | | defaultIncludeBranches.add(dn); |
| | |
| | | HashSet<AttributeType> excludeAttributes = toAttributeTypes(excludeAttributeStrings); |
| | | HashSet<AttributeType> includeAttributes = toAttributeTypes(includeAttributeStrings); |
| | | |
| | | ArrayList<SearchFilter> excludeFilters = |
| | | new ArrayList<SearchFilter>(excludeFilterStrings.size()); |
| | | ArrayList<SearchFilter> excludeFilters = new ArrayList<>(excludeFilterStrings.size()); |
| | | for (String filterString : excludeFilterStrings) |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<SearchFilter> includeFilters = |
| | | new ArrayList<SearchFilter>(includeFilterStrings.size()); |
| | | ArrayList<SearchFilter> includeFilters = new ArrayList<>(includeFilterStrings.size()); |
| | | for (String filterString : includeFilterStrings) |
| | | { |
| | | try |
| | |
| | | // Get the backend into which the LDIF should be imported. |
| | | Backend<?> backend = null; |
| | | HashSet<DN> defaultIncludeBranches; |
| | | HashSet<DN> excludeBranches = new HashSet<DN>(excludeBranchStrings.size()); |
| | | HashSet<DN> includeBranches = new HashSet<DN>(includeBranchStrings.size()); |
| | | HashSet<DN> excludeBranches = new HashSet<>(excludeBranchStrings.size()); |
| | | HashSet<DN> includeBranches = new HashSet<>(includeBranchStrings.size()); |
| | | |
| | | for (String s : includeBranchStrings) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | // Find backends with subordinate base DNs that should be excluded from the |
| | | // import. |
| | | |
| | | defaultIncludeBranches = new HashSet<DN>(backend.getBaseDNs().length); |
| | | // Find backends with subordinate base DNs that should be excluded from the import. |
| | | defaultIncludeBranches = new HashSet<>(backend.getBaseDNs().length); |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | | defaultIncludeBranches.add(dn); |
| | |
| | | PATH_MAKELDIF_RESOURCE_DIR; |
| | | TemplateFile tf = new TemplateFile(resourcePath, random); |
| | | |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<>(); |
| | | try |
| | | { |
| | | tf.parse(templateFile, warnings); |
| | |
| | | } |
| | | else |
| | | { |
| | | ArrayList<String> fileList = new ArrayList<String>(ldifFiles); |
| | | ArrayList<String> fileList = new ArrayList<>(ldifFiles); |
| | | importConfig = new LDIFImportConfig(fileList); |
| | | } |
| | | if(tmpDirectory == null) |
| | |
| | | |
| | | private HashSet<AttributeType> toAttributeTypes(ArrayList<String> attrNames) |
| | | { |
| | | final HashSet<AttributeType> attrTypes = new HashSet<AttributeType>(attrNames.size()); |
| | | final HashSet<AttributeType> attrTypes = new HashSet<>(attrNames.size()); |
| | | for (String attrName : attrNames) |
| | | { |
| | | String lowerName = attrName.toLowerCase(); |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | |
| | | /** |
| | | * Stores mapping between configuration attribute name and its label. |
| | | */ |
| | | private static Map<String,LocalizableMessage> argDisplayMap = |
| | | new HashMap<String,LocalizableMessage>(); |
| | | /** Stores mapping between configuration attribute name and its label. */ |
| | | private static Map<String,LocalizableMessage> argDisplayMap = new HashMap<>(); |
| | | static { |
| | | argDisplayMap.put( |
| | | ATTR_BACKUP_DIRECTORY_PATH, |
| | | INFO_RESTORE_ARG_BACKUP_DIR.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_BACKUP_ID, |
| | | INFO_RESTORE_ARG_BACKUP_ID.get()); |
| | | |
| | | argDisplayMap.put( |
| | | ATTR_TASK_RESTORE_VERIFY_ONLY, |
| | | INFO_RESTORE_ARG_VERIFY_ONLY.get()); |
| | | argDisplayMap.put(ATTR_BACKUP_DIRECTORY_PATH, INFO_RESTORE_ARG_BACKUP_DIR.get()); |
| | | argDisplayMap.put(ATTR_BACKUP_ID, INFO_RESTORE_ARG_BACKUP_ID.get()); |
| | | argDisplayMap.put(ATTR_TASK_RESTORE_VERIFY_ONLY, INFO_RESTORE_ARG_VERIFY_ONLY.get()); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tasks; |
| | | |
| | |
| | | */ |
| | | public static Map<String,ConfigEntry> getBackendConfigEntries() |
| | | { |
| | | Map<String,ConfigEntry> configEntries = new HashMap<String,ConfigEntry>(); |
| | | Map<String,ConfigEntry> configEntries = new HashMap<>(); |
| | | |
| | | // FIXME The error messages should not be the LDIF import messages |
| | | |
| | |
| | | e.getMessageObject(), e); |
| | | } |
| | | |
| | | ArrayList<ByteString> valueList = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> valueList = new ArrayList<>(1); |
| | | valueList.add(ServerConstants.TRUE_VALUE); |
| | | LDAPAttribute a = new LDAPAttribute(ATTR_BACKEND_ENABLED, valueList); |
| | | |
| | | LDAPModification m = new LDAPModification(ModificationType.REPLACE, a); |
| | | |
| | | ArrayList<RawModification> modList = new ArrayList<RawModification>(1); |
| | | ArrayList<RawModification> modList = new ArrayList<>(1); |
| | | modList.add(m); |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | e.getMessageObject(), e); |
| | | } |
| | | |
| | | ArrayList<ByteString> valueList = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> valueList = new ArrayList<>(1); |
| | | valueList.add(ServerConstants.FALSE_VALUE); |
| | | LDAPAttribute a = new LDAPAttribute(ATTR_BACKEND_ENABLED, valueList); |
| | | |
| | | LDAPModification m = new LDAPModification(ModificationType.REPLACE, a); |
| | | |
| | | ArrayList<RawModification> modList = new ArrayList<RawModification>(1); |
| | | ArrayList<RawModification> modList = new ArrayList<>(1); |
| | | modList.add(m); |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | */ |
| | | public static ArrayList<String> getMultiValueString(List<Attribute> attrList) |
| | | { |
| | | ArrayList<String> valueStrings = new ArrayList<String>(); |
| | | ArrayList<String> valueStrings = new ArrayList<>(); |
| | | |
| | | if (attrList != null && !attrList.isEmpty()) |
| | | { |
| | |
| | | import org.opends.server.types.RawAttribute; |
| | | import org.opends.server.util.args.LDAPConnectionArgumentParser; |
| | | |
| | | import com.forgerock.opendj.cli.Argument; |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | | import com.forgerock.opendj.cli.ClientException; |
| | |
| | | else |
| | | { |
| | | // Check that the backendID has not been expressed twice. |
| | | HashSet<String> backendIDLowerCase = new HashSet<String>(); |
| | | HashSet<String> repeatedBackendIds = new HashSet<String>(); |
| | | HashSet<String> backendIDLowerCase = new HashSet<>(); |
| | | HashSet<String> repeatedBackendIds = new HashSet<>(); |
| | | StringBuilder repeatedBackends = new StringBuilder(); |
| | | for (String id : backendID.getValues()) |
| | | { |
| | |
| | | @Override |
| | | public void addTaskAttributes(List<RawAttribute> attributes) |
| | | { |
| | | ArrayList<ByteString> values; |
| | | if (backUpAll.getValue() != null && |
| | | !backUpAll.getValue().equals( |
| | | backUpAll.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(backUpAll.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_ALL, values)); |
| | | } |
| | | |
| | | if (compress.getValue() != null && |
| | | !compress.getValue().equals( |
| | | compress.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(compress.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_COMPRESS, values)); |
| | | } |
| | | |
| | | if (encrypt.getValue() != null && |
| | | !encrypt.getValue().equals( |
| | | encrypt.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(encrypt.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_ENCRYPT, values)); |
| | | } |
| | | |
| | | if (hash.getValue() != null && |
| | | !hash.getValue().equals( |
| | | hash.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(hash.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_HASH, values)); |
| | | } |
| | | |
| | | if (incremental.getValue() != null && |
| | | !incremental.getValue().equals( |
| | | incremental.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(incremental.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_INCREMENTAL, values)); |
| | | } |
| | | |
| | | if (signHash.getValue() != null && |
| | | !signHash.getValue().equals( |
| | | signHash.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(signHash.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_SIGN_HASH, values)); |
| | | } |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_ALL, backUpAll); |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_COMPRESS, compress); |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_ENCRYPT, encrypt); |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_HASH, hash); |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_INCREMENTAL, incremental); |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_SIGN_HASH, signHash); |
| | | |
| | | List<String> backendIDs = backendID.getValues(); |
| | | if (backendIDs != null && backendIDs.size() > 0) { |
| | | values = new ArrayList<ByteString>(backendIDs.size()); |
| | | ArrayList<ByteString> values = new ArrayList<>(backendIDs.size()); |
| | | for (String s : backendIDs) { |
| | | values.add(ByteString.valueOf(s)); |
| | | } |
| | |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_BACKEND_ID, values)); |
| | | } |
| | | |
| | | if (backupIDString.getValue() != null && |
| | | !backupIDString.getValue().equals( |
| | | backupIDString.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(backupIDString.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_BACKUP_ID, values)); |
| | | addIfHasValue(attributes, ATTR_BACKUP_ID, backupIDString); |
| | | addIfHasValue(attributes, ATTR_BACKUP_DIRECTORY_PATH, backupDirectory); |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID, incrementalBaseID); |
| | | } |
| | | |
| | | if (backupDirectory.getValue() != null && |
| | | !backupDirectory.getValue().equals( |
| | | backupDirectory.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(backupDirectory.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_BACKUP_DIRECTORY_PATH, values)); |
| | | private void addIfHasValue(List<RawAttribute> attributes, String attrName, Argument arg) |
| | | { |
| | | if (hasValueDifferentThanDefaultValue(arg)) { |
| | | attributes.add(new LDAPAttribute(attrName, asList(arg.getValue()))); |
| | | } |
| | | } |
| | | |
| | | if (incrementalBaseID.getValue() != null && |
| | | !incrementalBaseID.getValue().equals( |
| | | incrementalBaseID.getDefaultValue())) { |
| | | values = new ArrayList<ByteString>(1); |
| | | values.add(ByteString.valueOf(incrementalBaseID.getValue())); |
| | | attributes.add( |
| | | new LDAPAttribute(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID, values)); |
| | | private boolean hasValueDifferentThanDefaultValue(Argument arg) |
| | | { |
| | | return arg.getValue() != null |
| | | && !arg.getValue().equals(arg.getDefaultValue()); |
| | | } |
| | | |
| | | private ArrayList<ByteString> asList(String value) |
| | | { |
| | | ArrayList<ByteString> values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf(value)); |
| | | return values; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | |
| | | // Get information about the backends defined in the server, and determine |
| | | // whether we are backing up multiple backends or a single backend. |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | ArrayList<Backend> backendList = new ArrayList<>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | int numBackends = backendList.size(); |
| | | |
| | | boolean multiple; |
| | | ArrayList<Backend<?>> backendsToArchive = new ArrayList<Backend<?>>(numBackends); |
| | | HashMap<String,BackendCfg> configEntries = |
| | | new HashMap<String,BackendCfg>(numBackends); |
| | | ArrayList<Backend<?>> backendsToArchive = new ArrayList<>(numBackends); |
| | | HashMap<String,BackendCfg> configEntries = new HashMap<>(numBackends); |
| | | if (backUpAll.isPresent()) |
| | | { |
| | | for (int i=0; i < numBackends; i++) |
| | |
| | | } |
| | | else |
| | | { |
| | | // Iterate through the set of backends and pick out those that were |
| | | // requested. |
| | | HashSet<String> requestedBackends = new HashSet<String>(backendID.getValues()); |
| | | // Iterate through the set of backends and pick out those that were requested. |
| | | HashSet<String> requestedBackends = new HashSet<>(backendID.getValues()); |
| | | for (int i=0; i < numBackends; i++) |
| | | { |
| | | Backend<?> b = backendList.get(i); |
| | |
| | | try |
| | | { |
| | | final IntegerArgument[] portArgs = {ldapPort, adminConnectorPort, ldapsPort, jmxPort}; |
| | | final Set<Integer> portsAdded = new HashSet<Integer>(); |
| | | final Set<Integer> portsAdded = new HashSet<>(); |
| | | |
| | | for (final IntegerArgument portArg : portArgs) |
| | | { |
| | |
| | | |
| | | private LinkedList<org.forgerock.opendj.ldap.DN> parseProvidedBaseDNs() throws ConfigureDSException |
| | | { |
| | | LinkedList<org.forgerock.opendj.ldap.DN> baseDNs = new LinkedList<org.forgerock.opendj.ldap.DN>(); |
| | | LinkedList<org.forgerock.opendj.ldap.DN> baseDNs = new LinkedList<>(); |
| | | if (baseDNString.isPresent()) |
| | | { |
| | | for (final String dnString : baseDNString.getValues()) |
| | |
| | | } |
| | | else |
| | | { |
| | | ArrayList<String> nameList = new ArrayList<String>(storageSchemes.size()); |
| | | ArrayList<String> nameList = new ArrayList<>(storageSchemes.size()); |
| | | for (PasswordStorageScheme<?> s : storageSchemes.values()) |
| | | { |
| | | if (authPasswordSchemeName) |
| | |
| | | |
| | | private ArrayList<ByteString> toByteStrings(String value) |
| | | { |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(1); |
| | | final ArrayList<ByteString> values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf(value)); |
| | | return values; |
| | | } |
| | | |
| | | private ArrayList<ByteString> toByteStrings(List<String> includeAttributes) |
| | | { |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(includeAttributes.size()); |
| | | final ArrayList<ByteString> values = new ArrayList<>(includeAttributes.size()); |
| | | for (String includeAttribute : includeAttributes) |
| | | { |
| | | values.add(ByteString.valueOf(includeAttribute)); |
| | |
| | | // Make sure that the Directory Server plugin initialization is performed. |
| | | try |
| | | { |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(1); |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(1); |
| | | pluginTypes.add(PluginType.LDIF_EXPORT); |
| | | directoryServer.initializePlugins(pluginTypes); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | excludeAttributes = new HashSet<AttributeType>(); |
| | | excludeAttributes = new HashSet<>(); |
| | | for (String attrName : excludeAttributeStrings.getValues()) |
| | | { |
| | | String lowerName = attrName.toLowerCase(); |
| | |
| | | } |
| | | else |
| | | { |
| | | includeAttributes =new HashSet<AttributeType>(); |
| | | includeAttributes = new HashSet<>(); |
| | | for (String attrName : includeAttributeStrings.getValues()) |
| | | { |
| | | String lowerName = attrName.toLowerCase(); |
| | |
| | | } |
| | | else |
| | | { |
| | | excludeFilters = new ArrayList<SearchFilter>(); |
| | | excludeFilters = new ArrayList<>(); |
| | | for (String filterString : excludeFilterStrings.getValues()) |
| | | { |
| | | try |
| | |
| | | } |
| | | else |
| | | { |
| | | includeFilters = new ArrayList<SearchFilter>(); |
| | | includeFilters = new ArrayList<>(); |
| | | for (String filterString : includeFilterStrings.getValues()) |
| | | { |
| | | try |
| | |
| | | List<DN> defaultIncludeBranches = null; |
| | | ArrayList<DN> excludeBranches = null; |
| | | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | ArrayList<Backend> backendList = new ArrayList<>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | int numBackends = backendList.size(); |
| | |
| | | |
| | | if (excludeBranchStrings.isPresent()) |
| | | { |
| | | excludeBranches = new ArrayList<DN>(); |
| | | excludeBranches = new ArrayList<>(); |
| | | for (String s : excludeBranchStrings.getValues()) |
| | | { |
| | | DN excludeBranch; |
| | |
| | | List<DN> includeBranches; |
| | | if (includeBranchStrings.isPresent()) |
| | | { |
| | | includeBranches = new ArrayList<DN>(); |
| | | includeBranches = new ArrayList<>(); |
| | | for (String s : includeBranchStrings.getValues()) |
| | | { |
| | | DN includeBranch; |
| | |
| | | |
| | | private ArrayList<ByteString> toByteStrings(String value) |
| | | { |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(1); |
| | | final ArrayList<ByteString> values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf(value)); |
| | | return values; |
| | | } |
| | | |
| | | private ArrayList<ByteString> toByteStrings(List<String> attrValues) |
| | | { |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(attrValues.size()); |
| | | final ArrayList<ByteString> values = new ArrayList<>(attrValues.size()); |
| | | for (String includeBranche : attrValues) |
| | | { |
| | | values.add(ByteString.valueOf(includeBranche)); |
| | |
| | | // Initialize the plugin manager. |
| | | try |
| | | { |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(1); |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(1); |
| | | directoryServer.initializePlugins(pluginTypes); |
| | | } |
| | | catch (Exception e) |
| | |
| | | // Make sure that the plugin initialization is performed. |
| | | try |
| | | { |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(1); |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(1); |
| | | pluginTypes.add(PluginType.LDIF_IMPORT); |
| | | PluginConfigManager pluginConfigManager = |
| | | DirectoryServer.getPluginConfigManager(); |
| | |
| | | } |
| | | else |
| | | { |
| | | excludeAttributes = new HashSet<AttributeType>(); |
| | | excludeAttributes = new HashSet<>(); |
| | | for (String attrName : excludeAttributeStrings.getValues()) |
| | | { |
| | | String lowerName = attrName.toLowerCase(); |
| | |
| | | } |
| | | else |
| | | { |
| | | includeAttributes = new HashSet<AttributeType>(); |
| | | includeAttributes = new HashSet<>(); |
| | | for (String attrName : includeAttributeStrings.getValues()) |
| | | { |
| | | String lowerName = attrName.toLowerCase(); |
| | |
| | | } |
| | | else |
| | | { |
| | | excludeFilters = new ArrayList<SearchFilter>(); |
| | | excludeFilters = new ArrayList<>(); |
| | | for (String filterString : excludeFilterStrings.getValues()) |
| | | { |
| | | try |
| | |
| | | } |
| | | else |
| | | { |
| | | includeFilters = new ArrayList<SearchFilter>(); |
| | | includeFilters = new ArrayList<>(); |
| | | for (String filterString : includeFilterStrings.getValues()) |
| | | { |
| | | try |
| | |
| | | // excluded from the import. |
| | | Backend<?> backend = null; |
| | | Set<DN> defaultIncludeBranches = null; |
| | | Set<DN> excludeBranches = new HashSet<DN>(); |
| | | Set<DN> includeBranches = new HashSet<DN>(); |
| | | Set<DN> excludeBranches = new HashSet<>(); |
| | | Set<DN> includeBranches = new HashSet<>(); |
| | | |
| | | if (includeBranchStrings.isPresent()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | ArrayList<Backend> backendList = new ArrayList<>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | int code = BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | if (code != 0) |
| | | { |
| | |
| | | if (backend == null) |
| | | { |
| | | backend = b; |
| | | defaultIncludeBranches = new HashSet<DN>(dnList.get(i)); |
| | | defaultIncludeBranches = new HashSet<>(dnList.get(i)); |
| | | } |
| | | else |
| | | { |
| | |
| | | LDIFImportConfig importConfig; |
| | | if (ldifFiles.isPresent()) |
| | | { |
| | | ArrayList<String> fileList = new ArrayList<String>(ldifFiles.getValues()); |
| | | ArrayList<String> fileList = new ArrayList<>(ldifFiles.getValues()); |
| | | int badFileCount = 0; |
| | | for (String pathname : fileList) |
| | | { |
| | |
| | | PATH_MAKELDIF_RESOURCE_DIR; |
| | | TemplateFile tf = new TemplateFile(resourcePath, random); |
| | | |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<>(); |
| | | try |
| | | { |
| | | tf.parse(templateFile.getValue(), warnings); |
| | |
| | | @Override |
| | | public void parseArguments(String[] args) throws ArgumentException |
| | | { |
| | | LinkedHashSet<LocalizableMessage> errorMessages = new LinkedHashSet<LocalizableMessage>(); |
| | | LinkedHashSet<LocalizableMessage> errorMessages = new LinkedHashSet<>(); |
| | | try |
| | | { |
| | | super.parseArguments(args); |
| | |
| | | { |
| | | try |
| | | { |
| | | Set<Integer> ports = new HashSet<Integer>(); |
| | | Set<Integer> ports = new HashSet<>(); |
| | | ports.add(ldapPortArg.getIntValue()); |
| | | |
| | | checkPortAlreadyUsed(ports, adminConnectorPortArg.getIntValue(), errorMessages, |
| | |
| | | @Override |
| | | public void parseArguments(String[] args) throws ArgumentException |
| | | { |
| | | LinkedHashSet<LocalizableMessage> errorMessages = new LinkedHashSet<LocalizableMessage>(); |
| | | LinkedHashSet<LocalizableMessage> errorMessages = new LinkedHashSet<>(); |
| | | try |
| | | { |
| | | super.parseArguments(args); |
| | |
| | | */ |
| | | public static LinkedHashMap<String, LocalizableMessage> getSASLAnonymousProperties() |
| | | { |
| | | LinkedHashMap<String,LocalizableMessage> properties = |
| | | new LinkedHashMap<String,LocalizableMessage>(1); |
| | | LinkedHashMap<String,LocalizableMessage> properties = new LinkedHashMap<>(1); |
| | | |
| | | properties.put(SASL_PROPERTY_TRACE, |
| | | INFO_LDAPAUTH_PROPERTY_DESCRIPTION_TRACE.get()); |
| | |
| | | */ |
| | | public static LinkedHashMap<String,LocalizableMessage> getSASLCRAMMD5Properties() |
| | | { |
| | | LinkedHashMap<String,LocalizableMessage> properties = |
| | | new LinkedHashMap<String,LocalizableMessage>(1); |
| | | LinkedHashMap<String,LocalizableMessage> properties = new LinkedHashMap<>(1); |
| | | |
| | | properties.put(SASL_PROPERTY_AUTHID, |
| | | INFO_LDAPAUTH_PROPERTY_DESCRIPTION_AUTHID.get()); |
| | |
| | | // list. Decode that list and make sure the QoP we have chosen is in |
| | | // that list. |
| | | StringTokenizer tokenizer = new StringTokenizer(tokenValue, ","); |
| | | LinkedList<String> qopModes = new LinkedList<String>(); |
| | | LinkedList<String> qopModes = new LinkedList<>(); |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | | qopModes.add(toLowerCase(tokenizer.nextToken().trim())); |
| | |
| | | */ |
| | | public static LinkedHashMap<String,LocalizableMessage> getSASLDigestMD5Properties() |
| | | { |
| | | LinkedHashMap<String,LocalizableMessage> properties = |
| | | new LinkedHashMap<String,LocalizableMessage>(5); |
| | | LinkedHashMap<String,LocalizableMessage> properties = new LinkedHashMap<>(5); |
| | | |
| | | properties.put(SASL_PROPERTY_AUTHID, |
| | | INFO_LDAPAUTH_PROPERTY_DESCRIPTION_AUTHID.get()); |
| | |
| | | public static LinkedHashMap<String,LocalizableMessage> getSASLExternalProperties() |
| | | { |
| | | // There are no properties for the SASL EXTERNAL mechanism. |
| | | return new LinkedHashMap<String,LocalizableMessage>(0); |
| | | return new LinkedHashMap<>(0); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public static LinkedHashMap<String,LocalizableMessage> getSASLGSSAPIProperties() |
| | | { |
| | | LinkedHashMap<String,LocalizableMessage> properties = |
| | | new LinkedHashMap<String,LocalizableMessage>(4); |
| | | LinkedHashMap<String,LocalizableMessage> properties = new LinkedHashMap<>(4); |
| | | |
| | | properties.put(SASL_PROPERTY_AUTHID, |
| | | INFO_LDAPAUTH_PROPERTY_DESCRIPTION_AUTHID.get()); |
| | |
| | | */ |
| | | public static LinkedHashMap<String,LocalizableMessage> getSASLPlainProperties() |
| | | { |
| | | LinkedHashMap<String,LocalizableMessage> properties = |
| | | new LinkedHashMap<String,LocalizableMessage>(2); |
| | | LinkedHashMap<String,LocalizableMessage> properties = new LinkedHashMap<>(2); |
| | | |
| | | properties.put(SASL_PROPERTY_AUTHID, |
| | | INFO_LDAPAUTH_PROPERTY_DESCRIPTION_AUTHID.get()); |
| | |
| | | else if (saslMechanism.equals(SASL_MECHANISM_GSSAPI)) |
| | | { |
| | | // Create the property map that will be used by the internal SASL handler. |
| | | HashMap<String,String> saslProperties = new HashMap<String,String>(); |
| | | HashMap<String,String> saslProperties = new HashMap<>(); |
| | | saslProperties.put(Sasl.QOP, gssapiQoP); |
| | | saslProperties.put(Sasl.SERVER_AUTH, "true"); |
| | | |
| | |
| | | StringArgument propertiesFileArgument = null; |
| | | BooleanArgument noPropertiesFileArgument = null; |
| | | |
| | | ArrayList<String> dnStrings = new ArrayList<String> (); |
| | | ArrayList<String> dnStrings = new ArrayList<> (); |
| | | String attributeType = null; |
| | | byte[] attributeVal = null; |
| | | Reader rdr = null; |
| | |
| | | Socket socket; |
| | | Socket startTLSSocket = null; |
| | | int resultCode; |
| | | ArrayList<Control> requestControls = new ArrayList<Control> (); |
| | | ArrayList<Control> responseControls = new ArrayList<Control> (); |
| | | ArrayList<Control> requestControls = new ArrayList<> (); |
| | | ArrayList<Control> responseControls = new ArrayList<> (); |
| | | |
| | | if (connectionOptions.isVerbose()) |
| | | { |
| | |
| | | private SSLConnectionFactory sslConnectionFactory; |
| | | private String saslMechanism; |
| | | private int versionNumber = 3; |
| | | private Map<String, List<String>> saslProperties = |
| | | new HashMap<String, List<String>> (); |
| | | private Map<String, List<String>> saslProperties = new HashMap<> (); |
| | | private boolean verbose; |
| | | |
| | | /** |
| | | * Creates a the connection options instance. |
| | | * |
| | | */ |
| | | /** Creates a the connection options instance. */ |
| | | public LDAPConnectionOptions() |
| | | { |
| | | } |
| | |
| | | * Set whether to use SSL for the connection or not. |
| | | * |
| | | * @param useSSL True if SSL should be used, false otherwise. |
| | | * |
| | | */ |
| | | |
| | | public void setUseSSL(boolean useSSL) |
| | | { |
| | | this.useSSL = useSSL; |
| | |
| | | /** |
| | | * Return the useSSL flag value. |
| | | * |
| | | * @return <CODE>true</CODE> if SSL should be used, or <CODE>false</CODE> if |
| | | * not. |
| | | * @return {@code true} if SSL should be used, or {@code false} if not. |
| | | */ |
| | | public boolean useSSL() |
| | | { |
| | |
| | | List<String> valList = saslProperties.get(key); |
| | | if(valList == null) |
| | | { |
| | | valList = new ArrayList<String> (); |
| | | valList = new ArrayList<>(); |
| | | } |
| | | valList.add(value); |
| | | |
| | |
| | | BooleanArgument noPropertiesFileArgument = null; |
| | | |
| | | Reader rdr = null; |
| | | ArrayList<String> dnStrings = new ArrayList<String> (); |
| | | ArrayList<String> dnStrings = new ArrayList<>(); |
| | | |
| | | // Create the command-line argument parser for use with this program. |
| | | LocalizableMessage toolDescription = INFO_LDAPDELETE_TOOL_DESCRIPTION.get(); |
| | |
| | | operationType = "ADD"; |
| | | AddChangeRecordEntry addEntry = (AddChangeRecordEntry) entry; |
| | | List<Attribute> attrs = addEntry.getAttributes(); |
| | | ArrayList<RawAttribute> attributes = |
| | | new ArrayList<RawAttribute>(attrs.size()); |
| | | ArrayList<RawAttribute> attributes = new ArrayList<>(attrs.size()); |
| | | for(Attribute a : attrs) |
| | | { |
| | | attributes.add(new LDAPAttribute(a)); |
| | |
| | | case MODIFY: |
| | | operationType = "MODIFY"; |
| | | ModifyChangeRecordEntry modEntry = (ModifyChangeRecordEntry) entry; |
| | | ArrayList<RawModification> mods = |
| | | new ArrayList<RawModification>(modEntry.getModifications()); |
| | | ArrayList<RawModification> mods = new ArrayList<>(modEntry.getModifications()); |
| | | protocolOp = new ModifyRequestProtocolOp(asn1OctetStr, mods); |
| | | out.println(INFO_PROCESSING_OPERATION.get(operationType, asn1OctetStr)); |
| | | break; |
| | |
| | | if (preReadAttributes.isPresent()) |
| | | { |
| | | String valueStr = preReadAttributes.getValue(); |
| | | Set<String> attrElements = new LinkedHashSet<String>(); |
| | | Set<String> attrElements = new LinkedHashSet<>(); |
| | | |
| | | StringTokenizer tokenizer = new StringTokenizer(valueStr, ", "); |
| | | while (tokenizer.hasMoreTokens()) |
| | |
| | | if (postReadAttributes.isPresent()) |
| | | { |
| | | String valueStr = postReadAttributes.getValue(); |
| | | Set<String> attrElements = new LinkedHashSet<String>(); |
| | | Set<String> attrElements = new LinkedHashSet<>(); |
| | | |
| | | StringTokenizer tokenizer = new StringTokenizer(valueStr, ", "); |
| | | while (tokenizer.hasMoreTokens()) |
| | |
| | | |
| | | |
| | | // If a control string was provided, then decode the requested controls. |
| | | ArrayList<Control> controls = new ArrayList<Control>(); |
| | | ArrayList<Control> controls = new ArrayList<>(); |
| | | if(controlStr.isPresent()) |
| | | { |
| | | for (String ctrlString : controlStr.getValues()) |
| | |
| | | this.nextMessageID = nextMessageID; |
| | | this.out = out; |
| | | this.err = err; |
| | | responseControls = new ArrayList<Control>(); |
| | | responseControls = new ArrayList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions(); |
| | | LDAPSearchOptions searchOptions = new LDAPSearchOptions(); |
| | | LDAPConnection connection = null; |
| | | ArrayList<LDAPFilter> filters = new ArrayList<LDAPFilter>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | ArrayList<LDAPFilter> filters = new ArrayList<>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | |
| | | BooleanArgument continueOnError = null; |
| | | BooleanArgument countEntries = null; |
| | |
| | | baseDN.setPropertyName(OPTION_LONG_BASEDN); |
| | | argParser.addArgument(baseDN); |
| | | |
| | | HashSet<String> allowedScopes = new HashSet<String>(); |
| | | HashSet<String> allowedScopes = new HashSet<>(); |
| | | allowedScopes.add("base"); |
| | | allowedScopes.add("one"); |
| | | allowedScopes.add("sub"); |
| | |
| | | if (pSearchInfo.isPresent()) |
| | | { |
| | | String infoString = toLowerCase(pSearchInfo.getValue().trim()); |
| | | HashSet<PersistentSearchChangeType> changeTypes = |
| | | new HashSet<PersistentSearchChangeType>(); |
| | | HashSet<PersistentSearchChangeType> changeTypes = new HashSet<>(); |
| | | boolean changesOnly = true; |
| | | boolean returnECs = true; |
| | | |
| | |
| | | if (matchedValuesFilter.isPresent()) |
| | | { |
| | | LinkedList<String> mvFilterStrings = matchedValuesFilter.getValues(); |
| | | ArrayList<MatchedValuesFilter> mvFilters = |
| | | new ArrayList<MatchedValuesFilter>(); |
| | | ArrayList<MatchedValuesFilter> mvFilters = new ArrayList<>(); |
| | | for (String s : mvFilterStrings) |
| | | { |
| | | try |
| | |
| | | |
| | | while (true) |
| | | { |
| | | ArrayList<Control> newControls = |
| | | new ArrayList<Control>(origControls.size()+1); |
| | | ArrayList<Control> newControls = new ArrayList<>(origControls.size() + 1); |
| | | newControls.addAll(origControls); |
| | | newControls.add(new PagedResultsControl(true, pageSize, cookieValue)); |
| | | searchOptions.setControls(newControls); |
| | |
| | | private boolean verbose; |
| | | private boolean continueOnError; |
| | | private String encoding = System.getProperty("file.encoding"); |
| | | private ArrayList<Control> controls = new ArrayList<Control>(); |
| | | private ArrayList<Control> controls = new ArrayList<>(); |
| | | |
| | | /** |
| | | * Creates a the tool options instance. |
| | |
| | | |
| | | // Read in ignored entries and attributes if any |
| | | BufferedReader ignReader = null; |
| | | Collection<DN> ignoreEntries = new HashSet<DN>(); |
| | | Collection<String> ignoreAttrs = new HashSet<String>(); |
| | | Collection<DN> ignoreEntries = new HashSet<>(); |
| | | Collection<String> ignoreAttrs = new HashSet<>(); |
| | | |
| | | if (ignoreAttrsFile.getValue() != null) |
| | | { |
| | |
| | | return OPERATIONS_ERROR; |
| | | } |
| | | |
| | | TreeMap<DN,Entry> sourceMap = new TreeMap<DN,Entry>(); |
| | | TreeMap<DN,Entry> sourceMap = new TreeMap<>(); |
| | | try |
| | | { |
| | | while (true) |
| | |
| | | return OPERATIONS_ERROR; |
| | | } |
| | | |
| | | TreeMap<DN,Entry> targetMap = new TreeMap<DN,Entry>(); |
| | | TreeMap<DN,Entry> targetMap = new TreeMap<>(); |
| | | try |
| | | { |
| | | while (true) |
| | |
| | | throws IOException |
| | | { |
| | | // Create a list to hold the modifications that are found. |
| | | LinkedList<Modification> modifications = new LinkedList<Modification>(); |
| | | LinkedList<Modification> modifications = new LinkedList<>(); |
| | | |
| | | |
| | | // Look at the set of objectclasses for the entries. |
| | | LinkedHashSet<ObjectClass> sourceClasses = |
| | | new LinkedHashSet<ObjectClass>( |
| | | sourceEntry.getObjectClasses().keySet()); |
| | | LinkedHashSet<ObjectClass> targetClasses = |
| | | new LinkedHashSet<ObjectClass>( |
| | | targetEntry.getObjectClasses().keySet()); |
| | | LinkedHashSet<ObjectClass> sourceClasses = new LinkedHashSet<>(sourceEntry.getObjectClasses().keySet()); |
| | | LinkedHashSet<ObjectClass> targetClasses = new LinkedHashSet<>(targetEntry.getObjectClasses().keySet()); |
| | | Iterator<ObjectClass> sourceClassIterator = sourceClasses.iterator(); |
| | | while (sourceClassIterator.hasNext()) |
| | | { |
| | |
| | | |
| | | |
| | | // Look at the user attributes for the entries. |
| | | LinkedHashSet<AttributeType> sourceTypes = |
| | | new LinkedHashSet<AttributeType>( |
| | | sourceEntry.getUserAttributes().keySet()); |
| | | LinkedHashSet<AttributeType> sourceTypes = new LinkedHashSet<>(sourceEntry.getUserAttributes().keySet()); |
| | | Iterator<AttributeType> sourceTypeIterator = sourceTypes.iterator(); |
| | | while (sourceTypeIterator.hasNext()) |
| | | { |
| | |
| | | Attribute a = m.getAttribute(); |
| | | if (a.isEmpty()) |
| | | { |
| | | LinkedList<Modification> attrMods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> attrMods = new LinkedList<>(); |
| | | attrMods.add(m); |
| | | writer.writeModifyChangeRecord(sourceEntry.getName(), attrMods); |
| | | } |
| | | else |
| | | { |
| | | LinkedList<Modification> attrMods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> attrMods = new LinkedList<>(); |
| | | for (ByteString v : a) |
| | | { |
| | | AttributeBuilder builder = new AttributeBuilder(a, true); |
| | |
| | | throws IOException, LDIFException |
| | | { |
| | | // Read the changes into memory. |
| | | TreeMap<DN,AddChangeRecordEntry> adds = |
| | | new TreeMap<DN,AddChangeRecordEntry>(); |
| | | TreeMap<DN,Entry> ldifEntries = |
| | | new TreeMap<DN,Entry>(); |
| | | HashMap<DN,DeleteChangeRecordEntry> deletes = |
| | | new HashMap<DN,DeleteChangeRecordEntry>(); |
| | | HashMap<DN,LinkedList<Modification>> modifications = |
| | | new HashMap<DN,LinkedList<Modification>>(); |
| | | TreeMap<DN,AddChangeRecordEntry> adds = new TreeMap<>(); |
| | | TreeMap<DN,Entry> ldifEntries = new TreeMap<>(); |
| | | HashMap<DN,DeleteChangeRecordEntry> deletes = new HashMap<>(); |
| | | HashMap<DN,LinkedList<Modification>> modifications = new HashMap<>(); |
| | | |
| | | while (true) |
| | | { |
| | |
| | | modifications.get(changeDN); |
| | | if (mods == null) |
| | | { |
| | | mods = new LinkedList<Modification>(); |
| | | mods = new LinkedList<>(); |
| | | modifications.put(changeDN, mods); |
| | | } |
| | | |
| | |
| | | // Perform any adds that may be necessary. |
| | | for (AddChangeRecordEntry add : adds.values()) |
| | | { |
| | | Map<ObjectClass,String> objectClasses = |
| | | new LinkedHashMap<ObjectClass,String>(); |
| | | Map<AttributeType,List<Attribute>> userAttributes = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | Map<AttributeType,List<Attribute>> operationalAttributes = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | Map<ObjectClass,String> objectClasses = new LinkedHashMap<>(); |
| | | Map<AttributeType,List<Attribute>> userAttributes = new LinkedHashMap<>(); |
| | | Map<AttributeType,List<Attribute>> operationalAttributes = new LinkedHashMap<>(); |
| | | |
| | | for (Attribute a : add.getAttributes()) |
| | | { |
| | |
| | | List<Attribute> attrList = operationalAttributes.get(t); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | operationalAttributes.put(t, attrList); |
| | | } |
| | | attrList.add(a); |
| | |
| | | List<Attribute> attrList = userAttributes.get(t); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | userAttributes.put(t, attrList); |
| | | } |
| | | attrList.add(a); |
| | |
| | | } |
| | | |
| | | |
| | | // Actually invoke the LDIF procesing. |
| | | LinkedList<LocalizableMessage> errorList = new LinkedList<LocalizableMessage>(); |
| | | // Actually invoke the LDIF processing. |
| | | LinkedList<LocalizableMessage> errorList = new LinkedList<>(); |
| | | boolean successful; |
| | | try |
| | | { |
| | |
| | | PrintStream err = NullOutputStream.wrapOrNullStream(errStream); |
| | | JDKLogging.disableLogging(); |
| | | |
| | | LinkedHashSet<String> scopeStrings = new LinkedHashSet<String>(4); |
| | | LinkedHashSet<String> scopeStrings = new LinkedHashSet<>(4); |
| | | scopeStrings.add(SCOPE_STRING_BASE); |
| | | scopeStrings.add(SCOPE_STRING_ONE); |
| | | scopeStrings.add(SCOPE_STRING_SUB); |
| | |
| | | //Return objectclass attribute unless analysis of the arguments determines |
| | | //otherwise. |
| | | boolean includeObjectclassAttrs = true; |
| | | final LinkedList<String> attributeNames = new LinkedList<String>(); |
| | | LinkedList<String> objectClassNames = new LinkedList<String>(); |
| | | LinkedList<String> filterStrings = new LinkedList<String>(); |
| | | final LinkedList<String> attributeNames = new LinkedList<>(); |
| | | LinkedList<String> objectClassNames = new LinkedList<>(); |
| | | LinkedList<String> filterStrings = new LinkedList<>(); |
| | | if (filterFile.isPresent()) |
| | | { |
| | | BufferedReader in = null; |
| | |
| | | { |
| | | Iterator<String> iterator = trailingArguments.iterator(); |
| | | |
| | | filterStrings = new LinkedList<String>(); |
| | | filterStrings = new LinkedList<>(); |
| | | filterStrings.add(iterator.next()); |
| | | |
| | | while (iterator.hasNext()) |
| | |
| | | |
| | | |
| | | // Create the list of filters that will be used to process the searches. |
| | | LinkedList<SearchFilter> searchFilters = new LinkedList<SearchFilter>(); |
| | | LinkedList<SearchFilter> searchFilters = new LinkedList<>(); |
| | | for (String filterString : filterStrings) |
| | | { |
| | | try |
| | |
| | | |
| | | |
| | | // Transform the attributes to return from strings to attribute types. |
| | | LinkedHashSet<AttributeType> userAttributeTypes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | LinkedHashSet<AttributeType> operationalAttributeTypes = |
| | | new LinkedHashSet<AttributeType>(); |
| | | LinkedHashSet<AttributeType> userAttributeTypes = new LinkedHashSet<>(); |
| | | LinkedHashSet<AttributeType> operationalAttributeTypes = new LinkedHashSet<>(); |
| | | for (String attributeName : attributeNames) |
| | | { |
| | | AttributeType t = DirectoryServer.getAttributeType(attributeName, true); |
| | |
| | | |
| | | |
| | | // Set the base DNs for the import config. |
| | | LinkedList<DN> baseDNs = new LinkedList<DN>(); |
| | | LinkedList<DN> baseDNs = new LinkedList<>(); |
| | | if (baseDNString.isPresent()) |
| | | { |
| | | for (String dnString : baseDNString.getValues()) |
| | |
| | | { |
| | | // Create a map from the base DNs of the backends to the corresponding |
| | | // backend ID. |
| | | TreeMap<DN,String> baseToIDMap = new TreeMap<DN,String>(); |
| | | TreeMap<DN,String> baseToIDMap = new TreeMap<>(); |
| | | for (String id : backends.keySet()) |
| | | { |
| | | for (DN dn : backends.get(id)) |
| | |
| | | } |
| | | else |
| | | { |
| | | backendIDs = new LinkedList<String>(backends.keySet()); |
| | | backendIDs = new LinkedList<>(backends.keySet()); |
| | | } |
| | | |
| | | // Figure out the length of the longest backend ID and base DN defined in |
| | |
| | | } |
| | | |
| | | |
| | | // Iterate through the immediate children, attempting to parse them as |
| | | // backends. |
| | | TreeMap<String,TreeSet<DN>> backendMap = new TreeMap<String,TreeSet<DN>>(); |
| | | // Iterate through the immediate children, attempting to parse them as backends. |
| | | TreeMap<String,TreeSet<DN>> backendMap = new TreeMap<>(); |
| | | for (ConfigEntry configEntry : baseEntry.getChildren().values()) |
| | | { |
| | | // Get the backend ID attribute from the entry. If there isn't one, then |
| | |
| | | |
| | | // Get the base DN attribute from the entry. If there isn't one, then |
| | | // just skip this entry. |
| | | TreeSet<DN> baseDNs = new TreeSet<DN>(); |
| | | TreeSet<DN> baseDNs = new TreeSet<>(); |
| | | try |
| | | { |
| | | LocalizableMessage msg = INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(); |
| | |
| | | { |
| | | reader.readStartSequence(); |
| | | opType = (int)reader.readInteger(); |
| | | opValues = new ArrayList<String>(); |
| | | opValues = new ArrayList<>(); |
| | | if (reader.hasNextElement()) |
| | | { |
| | | reader.readStartSequence(); |
| | |
| | | argParser.setUsageArgument(showUsage, out); |
| | | |
| | | |
| | | HashSet<String> booleanValues = new HashSet<String>(2); |
| | | HashSet<String> booleanValues = new HashSet<>(2); |
| | | booleanValues.add(INFO_MULTICHOICE_TRUE_VALUE.get().toString()); |
| | | booleanValues.add(INFO_MULTICHOICE_FALSE_VALUE.get().toString()); |
| | | |
| | |
| | | if (saslOption.isPresent()) |
| | | { |
| | | String mechanism = null; |
| | | LinkedList<String> options = new LinkedList<String>(); |
| | | LinkedList<String> options = new LinkedList<>(); |
| | | |
| | | for (String s : saslOption.getValues()) |
| | | { |
| | |
| | | Argument a = subCommand.getArgumentForName(ARG_OP_VALUE); |
| | | if ((a != null) && a.isPresent()) |
| | | { |
| | | ArrayList<String> valueList = new ArrayList<String>(a.getValues()); |
| | | ArrayList<String> valueList = new ArrayList<>(a.getValues()); |
| | | String[] values = new String[valueList.size()]; |
| | | valueList.toArray(values); |
| | | |
| | |
| | | Argument a = subCommand.getArgumentForName(ARG_OP_VALUE); |
| | | if ((a != null) && a.isPresent()) |
| | | { |
| | | ArrayList<String> valueList = new ArrayList<String>(a.getValues()); |
| | | ArrayList<String> valueList = new ArrayList<>(a.getValues()); |
| | | String[] values = new String[valueList.size()]; |
| | | valueList.toArray(values); |
| | | |
| | |
| | | List<TaskEntry> entries = taskClient.getTaskEntries(); |
| | | if (entries.size() > 0) { |
| | | TableBuilder table = new TableBuilder(); |
| | | Map<String, TaskEntry> mapIdToEntry = |
| | | new TreeMap<String, TaskEntry>(); |
| | | Map<String, TaskEntry> mapIdToEntry = new TreeMap<>(); |
| | | for (TaskEntry entry : entries) { |
| | | String taskId = entry.getId(); |
| | | if (taskId != null) { |
| | |
| | | */ |
| | | private Menu<Void> getSummaryMenu() |
| | | throws LDAPException, IOException, DecodeException { |
| | | List<String> taskIds = new ArrayList<String>(); |
| | | List<Integer> cancelableIndices = new ArrayList<Integer>(); |
| | | List<String> taskIds = new ArrayList<>(); |
| | | List<Integer> cancelableIndices = new ArrayList<>(); |
| | | List<TaskEntry> entries = taskClient.getTaskEntries(); |
| | | MenuBuilder<Void> menuBuilder = new MenuBuilder<Void>(this); |
| | | MenuBuilder<Void> menuBuilder = new MenuBuilder<>(this); |
| | | if (entries.size() > 0) { |
| | | Map<String, TaskEntry> mapIdToEntry = |
| | | new TreeMap<String, TaskEntry>(); |
| | | Map<String, TaskEntry> mapIdToEntry = new TreeMap<>(); |
| | | for (TaskEntry entry : entries) { |
| | | String taskId = entry.getId(); |
| | | if (taskId != null) { |
| | |
| | | taskEntry = app.getTaskClient().getTaskEntry(taskId); |
| | | |
| | | // Show the menu |
| | | MenuBuilder<TaskEntry> menuBuilder = |
| | | new MenuBuilder<TaskEntry>(app); |
| | | MenuBuilder<TaskEntry> menuBuilder = new MenuBuilder<>(app); |
| | | menuBuilder.addBackOption(true); |
| | | menuBuilder.addCharOption( |
| | | INFO_TASKINFO_CMD_REFRESH_CHAR.get(), |
| | |
| | | { |
| | | Backend<?> backend = null; |
| | | |
| | | final ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | final ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>(); |
| | | final ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | final ArrayList<Backend> backendList = new ArrayList<>(); |
| | | final ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | final ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | final int numBackends = backendList.size(); |
| | |
| | | addLdapAttribute(attributes, ATTR_REBUILD_BASE_DN, baseDNString.getValue()); |
| | | |
| | | final List<String> indexes = indexList.getValues(); |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(indexes.size()); |
| | | final ArrayList<ByteString> values = new ArrayList<>(indexes.size()); |
| | | for (final String s : indexes) |
| | | { |
| | | values.add(ByteString.valueOf(s)); |
| | |
| | | |
| | | private ArrayList<ByteString> toByteStrings(String value) |
| | | { |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(1); |
| | | final ArrayList<ByteString> values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf(value)); |
| | | return values; |
| | | } |
| | |
| | | |
| | | private ArrayList<ByteString> toByteStrings(String value) |
| | | { |
| | | final ArrayList<ByteString> values = new ArrayList<ByteString>(1); |
| | | final ArrayList<ByteString> values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf(value)); |
| | | return values; |
| | | } |
| | |
| | | |
| | | // Get information about the backends defined in the server and determine |
| | | // which to use for the restore. |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | ArrayList<Backend> backendList = new ArrayList<>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | |
| | |
| | | if (saslOption.isPresent()) |
| | | { |
| | | String mechanism = null; |
| | | LinkedList<String> options = new LinkedList<String>(); |
| | | LinkedList<String> options = new LinkedList<>(); |
| | | |
| | | for (String s : saslOption.getValues()) |
| | | { |
| | |
| | | ByteString.valueOf(ATTR_TASK_ID + "=" + taskID + "," + |
| | | SCHEDULED_TASK_BASE_RDN + "," + DN_TASK_ROOT); |
| | | |
| | | ArrayList<RawAttribute> attributes = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> attributes = new ArrayList<>(); |
| | | |
| | | ArrayList<ByteString> ocValues = new ArrayList<ByteString>(3); |
| | | ArrayList<ByteString> ocValues = new ArrayList<>(3); |
| | | ocValues.add(ByteString.valueOf("top")); |
| | | ocValues.add(ByteString.valueOf("ds-task")); |
| | | ocValues.add(ByteString.valueOf("ds-task-shutdown")); |
| | | attributes.add(new LDAPAttribute(ATTR_OBJECTCLASS, ocValues)); |
| | | |
| | | ArrayList<ByteString> taskIDValues = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> taskIDValues = new ArrayList<>(1); |
| | | taskIDValues.add(ByteString.valueOf(taskID)); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_ID, taskIDValues)); |
| | | |
| | | ArrayList<ByteString> classValues = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> classValues = new ArrayList<>(1); |
| | | classValues.add(ByteString.valueOf(ShutdownTask.class.getName())); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_CLASS, classValues)); |
| | | |
| | | if (restart.isPresent()) |
| | | { |
| | | ArrayList<ByteString> restartValues = |
| | | new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> restartValues = new ArrayList<>(1); |
| | | restartValues.add(ByteString.valueOf("true")); |
| | | attributes.add(new LDAPAttribute(ATTR_RESTART_SERVER, restartValues)); |
| | | } |
| | | |
| | | if (stopReason.isPresent()) |
| | | { |
| | | ArrayList<ByteString> stopReasonValues = |
| | | new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> stopReasonValues = new ArrayList<>(1); |
| | | stopReasonValues.add(ByteString.valueOf(stopReason.getValue())); |
| | | attributes.add(new LDAPAttribute(ATTR_SHUTDOWN_MESSAGE, |
| | | stopReasonValues)); |
| | | attributes.add(new LDAPAttribute(ATTR_SHUTDOWN_MESSAGE, stopReasonValues)); |
| | | } |
| | | |
| | | if (stopTime != null) |
| | | { |
| | | ArrayList<ByteString> stopTimeValues = |
| | | new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> stopTimeValues = new ArrayList<>(1); |
| | | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME); |
| | | dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); |
| | |
| | | stopTimeValues)); |
| | | } |
| | | |
| | | ArrayList<Control> controls = new ArrayList<Control>(); |
| | | ArrayList<Control> controls = new ArrayList<>(); |
| | | if (proxyAuthzID.isPresent()) |
| | | { |
| | | Control c = new ProxiedAuthV2Control( |
| | |
| | | // through them, finding the one backend to be verified. |
| | | Backend<?> backend = null; |
| | | |
| | | ArrayList<Backend> backendList = new ArrayList<Backend>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<BackendCfg>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<List<DN>>(); |
| | | ArrayList<Backend> backendList = new ArrayList<>(); |
| | | ArrayList<BackendCfg> entryList = new ArrayList<>(); |
| | | ArrayList<List<DN>> dnList = new ArrayList<>(); |
| | | BackendToolUtils.getBackends(backendList, entryList, dnList); |
| | | |
| | | int numBackends = backendList.size(); |
| | |
| | | /** {@inheritDoc} */ |
| | | public void addTaskAttributes(List<RawAttribute> attributes) |
| | | { |
| | | ArrayList<ByteString> baseDNs = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> baseDNs = new ArrayList<>(); |
| | | for (String baseDN : uData.getBaseDNs()) |
| | | { |
| | | baseDNs.add(ByteString.valueOf(baseDN)); |
| | |
| | | { |
| | | int returnValue; |
| | | super.validateGlobalOptions(buf); |
| | | ArrayList<LocalizableMessage> errors = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<LocalizableMessage> errors = new ArrayList<>(); |
| | | if (secureArgsList.bindPasswordArg.isPresent() && |
| | | secureArgsList.bindPasswordFileArg.isPresent()) { |
| | | LocalizableMessage message = ERR_TOOL_CONFLICTING_ARGS.get( |
| | |
| | | String file = equivalentCommandFileArgument.getValue(); |
| | | if (!canWrite(file)) |
| | | { |
| | | errors.add( |
| | | ERR_REPLICATION_CANNOT_WRITE_EQUIVALENT_COMMAND_LINE_FILE.get( |
| | | file)); |
| | | errors.add(ERR_REPLICATION_CANNOT_WRITE_EQUIVALENT_COMMAND_LINE_FILE.get(file)); |
| | | } |
| | | else |
| | | { |
| | |
| | | private void initializeGlobalArguments(OutputStream outStream) |
| | | throws ArgumentException |
| | | { |
| | | ArrayList<Argument> defaultArgs = |
| | | new ArrayList<Argument>(createGlobalArguments(outStream, alwaysSSL)); |
| | | ArrayList<Argument> defaultArgs = new ArrayList<>(createGlobalArguments(outStream, alwaysSSL)); |
| | | |
| | | Argument[] argsToRemove = { |
| | | secureArgsList.hostNameArg, |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.tools.dsreplication; |
| | | |
| | | import java.util.LinkedList; |
| | |
| | | * This class is used to store the information provided by the user in the |
| | | * replication command line. It is required because when we are in interactive |
| | | * mode the ReplicationCliArgumentParser is not enough. |
| | | * |
| | | */ |
| | | public abstract class ReplicationUserData |
| | | { |
| | | private final LinkedList<String> baseDNs = new LinkedList<String>(); |
| | | private final LinkedList<String> baseDNs = new LinkedList<>(); |
| | | private String adminUid; |
| | | private String adminPwd; |
| | | |
| | |
| | | */ |
| | | public List<String> getBaseDNs() |
| | | { |
| | | return new LinkedList<String>(baseDNs); |
| | | return new LinkedList<>(baseDNs); |
| | | } |
| | | |
| | | /** |
| | |
| | | // Get the RDN template lines based just on the entry DN. |
| | | Entry entry = createEntry(branchDN); |
| | | |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<TemplateLine> lineList = new ArrayList<TemplateLine>(); |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<>(); |
| | | ArrayList<TemplateLine> lineList = new ArrayList<>(); |
| | | |
| | | for (String ocName : entry.getObjectClasses().values()) |
| | | { |
| | |
| | | |
| | | |
| | | // Load and parse the template file. |
| | | LinkedList<LocalizableMessage> warnings = new LinkedList<LocalizableMessage>(); |
| | | TemplateFile templateFile = new TemplateFile(resourcePath.getValue(), |
| | | random); |
| | | LinkedList<LocalizableMessage> warnings = new LinkedList<>(); |
| | | TemplateFile templateFile = new TemplateFile(resourcePath.getValue(), random); |
| | | try |
| | | { |
| | | templateFile.parse(templatePath.getValue(), warnings); |
| | | } |
| | | catch (IOException ioe) |
| | | { |
| | | LocalizableMessage message = ERR_MAKELDIF_IOEXCEPTION_DURING_PARSE.get( |
| | | ioe.getMessage()); |
| | | LocalizableMessage message = ERR_MAKELDIF_IOEXCEPTION_DURING_PARSE.get(ioe.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = ERR_MAKELDIF_EXCEPTION_DURING_PARSE.get( |
| | | e.getMessage()); |
| | | LocalizableMessage message = ERR_MAKELDIF_EXCEPTION_DURING_PARSE.get(e.getMessage()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | |
| | | |
| | | allGenerated = false; |
| | | closed = false; |
| | | entryQueue = new LinkedBlockingQueue<TemplateEntry>(10); |
| | | entryQueue = new LinkedBlockingQueue<>(10); |
| | | ioException = null; |
| | | entryBytes = null; |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | |
| | | // Make sure that all of the RDN attributes are defined. |
| | | HashSet<AttributeType> rdnAttrs = |
| | | new HashSet<AttributeType>(rdnAttributes.length); |
| | | for (AttributeType t : rdnAttributes) |
| | | { |
| | | rdnAttrs.add(t); |
| | | } |
| | | HashSet<AttributeType> rdnAttrs = new HashSet<>(rdnAttributes.length); |
| | | Collections.addAll(rdnAttrs, rdnAttributes); |
| | | |
| | | for (TemplateLine l : templateLines) |
| | | { |
| | |
| | | { |
| | | /** The branch used to generate this entry (if it is associated with a branch). */ |
| | | private Branch branch; |
| | | |
| | | /** The DN for this template entry, if it is known. */ |
| | | private DN dn; |
| | | |
| | | /** The DN of the parent entry for this template entry, if it is available. */ |
| | | private DN parentDN; |
| | | |
| | |
| | | * The set of attributes associated with this template entry, mapped from the |
| | | * lowercase name of the attribute to the list of generated values. |
| | | */ |
| | | private LinkedHashMap<AttributeType,ArrayList<TemplateValue>> attributes; |
| | | private final LinkedHashMap<AttributeType, ArrayList<TemplateValue>> attributes = new LinkedHashMap<>(); |
| | | |
| | | /** |
| | | * The template used to generate this entry (if it is associated with a |
| | | * template). |
| | | */ |
| | | /** The template used to generate this entry (if it is associated with a template). */ |
| | | private Template template; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new template entry that will be associated with the provided |
| | | * branch. |
| | |
| | | this.branch = branch; |
| | | |
| | | dn = branch.getBranchDN(); |
| | | template = null; |
| | | parentDN = null; |
| | | attributes = new LinkedHashMap<AttributeType,ArrayList<TemplateValue>>(); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | this.template = template; |
| | | this.parentDN = parentDN; |
| | | |
| | | dn = null; |
| | | branch = null; |
| | | attributes = new LinkedHashMap<AttributeType,ArrayList<TemplateValue>>(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public void addValue(TemplateValue value) |
| | | { |
| | | ArrayList<TemplateValue> valueList = |
| | | attributes.get(value.getAttributeType()); |
| | | ArrayList<TemplateValue> valueList = attributes.get(value.getAttributeType()); |
| | | if (valueList == null) |
| | | { |
| | | valueList = new ArrayList<TemplateValue>(); |
| | | valueList = new ArrayList<>(); |
| | | attributes.put(value.getAttributeType(), valueList); |
| | | } |
| | | valueList.add(value); |
| | |
| | | throws IOException, LDIFException |
| | | { |
| | | // Process all of the attributes for this entry. |
| | | LinkedHashMap<ObjectClass,String> objectClasses = |
| | | new LinkedHashMap<ObjectClass,String>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttributes = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> operationalAttributes = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType, List<Attribute>> urlAttributes = |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(); |
| | | LinkedHashMap<AttributeType, List<Attribute>> base64Attributes = |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(); |
| | | LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttributes = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> operationalAttributes = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType, List<Attribute>> urlAttributes = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType, List<Attribute>> base64Attributes = new LinkedHashMap<>(); |
| | | |
| | | for (AttributeType t : attributes.keySet()) |
| | | { |
| | |
| | | |
| | | private ArrayList<Attribute> asList(AttributeBuilder builder) |
| | | { |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> attrList = new ArrayList<>(1); |
| | | attrList.add(builder.toAttribute()); |
| | | return attrList; |
| | | } |
| | |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileReader; |
| | |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a template file, which is a collection of constant |
| | | * definitions, branches, and templates. |
| | | */ |
| | | public class TemplateFile |
| | | { |
| | | /** |
| | | * The name of the file holding the list of first names. |
| | | */ |
| | | /** The name of the file holding the list of first names. */ |
| | | public static final String FIRST_NAME_FILE = "first.names"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * The name of the file holding the list of last names. |
| | | */ |
| | | /** The name of the file holding the list of last names. */ |
| | | public static final String LAST_NAME_FILE = "last.names"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A map of the contents of various text files used during the parsing |
| | | * process, mapped from absolute path to the array of lines in the file. |
| | | */ |
| | | private HashMap<String,String[]> fileLines; |
| | | private final HashMap<String, String[]> fileLines = new HashMap<>(); |
| | | |
| | | /** The index of the next first name value that should be used. */ |
| | | private int firstNameIndex; |
| | | |
| | | /** The index of the next last name value that should be used. */ |
| | | private int lastNameIndex; |
| | | |
| | |
| | | * first/last name list has been completed. |
| | | */ |
| | | private int nameLoopCounter; |
| | | |
| | | /** |
| | | * A counter that will be used in case we have exhausted all possible first |
| | | * and last name combinations. |
| | |
| | | private int nameUniquenessCounter; |
| | | |
| | | /** The set of branch definitions for this template file. */ |
| | | private LinkedHashMap<DN,Branch> branches; |
| | | |
| | | private final LinkedHashMap<DN, Branch> branches = new LinkedHashMap<>(); |
| | | /** The set of constant definitions for this template file. */ |
| | | private LinkedHashMap<String,String> constants; |
| | | |
| | | private final LinkedHashMap<String, String> constants = new LinkedHashMap<>(); |
| | | /** The set of registered tags for this template file. */ |
| | | private LinkedHashMap<String,Tag> registeredTags; |
| | | |
| | | private final LinkedHashMap<String, Tag> registeredTags = new LinkedHashMap<>(); |
| | | /** The set of template definitions for this template file. */ |
| | | private LinkedHashMap<String,Template> templates; |
| | | private final LinkedHashMap<String, Template> templates = new LinkedHashMap<>(); |
| | | |
| | | /** The random number generator for this template file. */ |
| | | private Random random; |
| | | |
| | | /** The next first name that should be used. */ |
| | | private String firstName; |
| | | |
| | | /** The next last name that should be used. */ |
| | | private String lastName; |
| | | |
| | |
| | | * anywhere else. |
| | | */ |
| | | private String resourcePath; |
| | | |
| | | /** The path to the directory containing the template file, if available. */ |
| | | private String templatePath; |
| | | |
| | | /** The set of first names to use when generating the LDIF. */ |
| | | private String[] firstNames; |
| | | |
| | | /** The set of last names to use when generating the LDIF. */ |
| | | private String[] lastNames; |
| | | |
| | |
| | | this.resourcePath = resourcePath; |
| | | this.random = random; |
| | | |
| | | fileLines = new HashMap<String,String[]>(); |
| | | branches = new LinkedHashMap<DN,Branch>(); |
| | | constants = new LinkedHashMap<String,String>(); |
| | | registeredTags = new LinkedHashMap<String,Tag>(); |
| | | templates = new LinkedHashMap<String,Template>(); |
| | | templatePath = null; |
| | | firstNames = new String[0]; |
| | | lastNames = new String[0]; |
| | | firstName = null; |
| | | lastName = null; |
| | | firstNameIndex = 0; |
| | | lastNameIndex = 0; |
| | | nameLoopCounter = 0; |
| | | nameUniquenessCounter = 1; |
| | | |
| | | registerDefaultTags(); |
| | |
| | | throws IOException |
| | | { |
| | | File f = getFile(FIRST_NAME_FILE); |
| | | ArrayList<String> nameList = new ArrayList<String>(); |
| | | BufferedReader reader = new BufferedReader(new FileReader(f)); |
| | | while (true) |
| | | { |
| | | String line = reader.readLine(); |
| | | if (line == null) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | nameList.add(line); |
| | | } |
| | | } |
| | | reader.close(); |
| | | List<String> nameList = readLines(f); |
| | | firstNames = new String[nameList.size()]; |
| | | nameList.toArray(firstNames); |
| | | |
| | | f = getFile(LAST_NAME_FILE); |
| | | nameList = new ArrayList<String>(); |
| | | reader = new BufferedReader(new FileReader(f)); |
| | | nameList = readLines(f); |
| | | lastNames = new String[nameList.size()]; |
| | | nameList.toArray(lastNames); |
| | | } |
| | | |
| | | private List<String> readLines(File f) throws IOException |
| | | { |
| | | try (BufferedReader reader = new BufferedReader(new FileReader(f))) |
| | | { |
| | | ArrayList<String> lines = new ArrayList<>(); |
| | | while (true) |
| | | { |
| | | String line = reader.readLine(); |
| | |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | nameList.add(line); |
| | | lines.add(line); |
| | | } |
| | | return lines; |
| | | } |
| | | reader.close(); |
| | | lastNames = new String[nameList.size()]; |
| | | nameList.toArray(lastNames); |
| | | } |
| | | |
| | | |
| | |
| | | public void parse(String filename, List<LocalizableMessage> warnings) |
| | | throws IOException, InitializationException, MakeLDIFException |
| | | { |
| | | ArrayList<String> fileLines = new ArrayList<String>(); |
| | | |
| | | templatePath = null; |
| | | File f = getFile(filename); |
| | | if ((f == null) || (! f.exists())) |
| | |
| | | LocalizableMessage message = ERR_MAKELDIF_COULD_NOT_FIND_TEMPLATE_FILE.get(filename); |
| | | throw new IOException(message.toString()); |
| | | } |
| | | else |
| | | { |
| | | templatePath = f.getParentFile().getAbsolutePath(); |
| | | } |
| | | |
| | | BufferedReader reader = new BufferedReader(new FileReader(f)); |
| | | while (true) |
| | | { |
| | | String line = reader.readLine(); |
| | | if (line == null) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | fileLines.add(line); |
| | | } |
| | | } |
| | | |
| | | reader.close(); |
| | | |
| | | List<String> fileLines = readLines(f); |
| | | String[] lines = new String[fileLines.size()]; |
| | | fileLines.toArray(lines); |
| | | parse(lines, warnings); |
| | |
| | | public void parse(InputStream inputStream, List<LocalizableMessage> warnings) |
| | | throws IOException, InitializationException, MakeLDIFException |
| | | { |
| | | ArrayList<String> fileLines = new ArrayList<String>(); |
| | | ArrayList<String> fileLines = new ArrayList<>(); |
| | | |
| | | BufferedReader reader = |
| | | new BufferedReader(new InputStreamReader(inputStream)); |
| | | try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) |
| | | { |
| | | while (true) |
| | | { |
| | | String line = reader.readLine(); |
| | |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | fileLines.add(line); |
| | | } |
| | | } |
| | | |
| | | reader.close(); |
| | | |
| | | String[] lines = new String[fileLines.size()]; |
| | | fileLines.toArray(lines); |
| | | parse(lines, warnings); |
| | |
| | | throws InitializationException, MakeLDIFException |
| | | { |
| | | // Create temporary variables that will be used to hold the data read. |
| | | LinkedHashMap<String,Tag> templateFileIncludeTags = |
| | | new LinkedHashMap<String,Tag>(); |
| | | LinkedHashMap<String,String> templateFileConstants = |
| | | new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<DN,Branch> templateFileBranches = |
| | | new LinkedHashMap<DN,Branch>(); |
| | | LinkedHashMap<String,Template> templateFileTemplates = |
| | | new LinkedHashMap<String,Template>(); |
| | | LinkedHashMap<String,Tag> templateFileIncludeTags = new LinkedHashMap<>(); |
| | | LinkedHashMap<String,String> templateFileConstants = new LinkedHashMap<>(); |
| | | LinkedHashMap<DN,Branch> templateFileBranches = new LinkedHashMap<>(); |
| | | LinkedHashMap<String,Template> templateFileTemplates = new LinkedHashMap<>(); |
| | | |
| | | for (int lineNumber=0; lineNumber < lines.length; lineNumber++) |
| | | { |
| | |
| | | else if (lowerLine.startsWith("branch: ")) |
| | | { |
| | | int startLineNumber = lineNumber; |
| | | ArrayList<String> lineList = new ArrayList<String>(); |
| | | ArrayList<String> lineList = new ArrayList<>(); |
| | | lineList.add(line); |
| | | while (true) |
| | | { |
| | |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | line = replaceConstants(line, lineNumber, |
| | | templateFileConstants, warnings); |
| | | line = replaceConstants(line, lineNumber, templateFileConstants, warnings); |
| | | lineList.add(line); |
| | | } |
| | | } |
| | | |
| | | String[] branchLines = new String[lineList.size()]; |
| | | lineList.toArray(branchLines); |
| | |
| | | else if (lowerLine.startsWith("template: ")) |
| | | { |
| | | int startLineNumber = lineNumber; |
| | | ArrayList<String> lineList = new ArrayList<String>(); |
| | | ArrayList<String> lineList = new ArrayList<>(); |
| | | lineList.add(line); |
| | | while (true) |
| | | { |
| | |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | line = replaceConstants(line, lineNumber, |
| | | templateFileConstants, warnings); |
| | | line = replaceConstants(line, lineNumber, templateFileConstants, warnings); |
| | | lineList.add(line); |
| | | } |
| | | } |
| | | |
| | | String[] templateLines = new String[lineList.size()]; |
| | | lineList.toArray(templateLines); |
| | |
| | | LocalizableMessage message = ERR_MAKELDIF_CONFLICTING_TEMPLATE_NAME.get(t.getName(), startLineNumber); |
| | | throw new MakeLDIFException(message); |
| | | } |
| | | else |
| | | { |
| | | templateFileTemplates.put(lowerName, t); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | int arrayLineNumber = 1; |
| | | Template parentTemplate = null; |
| | | AttributeType[] rdnAttributes = null; |
| | | ArrayList<String> subTemplateNames = new ArrayList<String>(); |
| | | ArrayList<Integer> entriesPerTemplate = new ArrayList<Integer>(); |
| | | ArrayList<String> subTemplateNames = new ArrayList<>(); |
| | | ArrayList<Integer> entriesPerTemplate = new ArrayList<>(); |
| | | for ( ; arrayLineNumber < templateLines.length; arrayLineNumber++) |
| | | { |
| | | int lineNumber = startLineNumber + arrayLineNumber; |
| | |
| | | { |
| | | // This is the set of RDN attributes. If there are multiple, they may |
| | | // be separated by plus signs. |
| | | ArrayList<AttributeType> attrList = new ArrayList<AttributeType>(); |
| | | ArrayList<AttributeType> attrList = new ArrayList<>(); |
| | | String rdnAttrNames = lowerLine.substring(9).trim(); |
| | | StringTokenizer tokenizer = new StringTokenizer(rdnAttrNames, "+"); |
| | | while (tokenizer.hasMoreTokens()) |
| | |
| | | int phase = PARSING_STATIC_TEXT; |
| | | int previousPhase = PARSING_STATIC_TEXT; |
| | | |
| | | ArrayList<Tag> tagList = new ArrayList<Tag>(); |
| | | ArrayList<Tag> tagList = new ArrayList<>(); |
| | | StringBuilder buffer = new StringBuilder(); |
| | | |
| | | for ( ; pos < length; pos++) |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<String> argList = new ArrayList<String>(); |
| | | ArrayList<String> argList = new ArrayList<>(); |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | | argList.add(tokenizer.nextToken().trim()); |
| | |
| | | // number of characters to use from the attribute value. The arguments will |
| | | // be delimited by colons. |
| | | StringTokenizer tokenizer = new StringTokenizer(tagString, ":"); |
| | | ArrayList<String> argList = new ArrayList<String>(); |
| | | ArrayList<String> argList = new ArrayList<>(); |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | | argList.add(tokenizer.nextToken()); |
| | |
| | | * |
| | | * @throws IOException If a problem occurs while reading the file. |
| | | */ |
| | | public String[] getFileLines(File file) |
| | | throws IOException |
| | | public String[] getFileLines(File file) throws IOException |
| | | { |
| | | String absolutePath = file.getAbsolutePath(); |
| | | String[] lines = fileLines.get(absolutePath); |
| | | if (lines == null) |
| | | { |
| | | ArrayList<String> lineList = new ArrayList<String>(); |
| | | |
| | | BufferedReader reader = new BufferedReader(new FileReader(file)); |
| | | while (true) |
| | | { |
| | | String line = reader.readLine(); |
| | | if (line == null) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | lineList.add(line); |
| | | } |
| | | } |
| | | |
| | | reader.close(); |
| | | List<String> lineList = readLines(file); |
| | | |
| | | lines = new String[lineList.size()]; |
| | | lineList.toArray(lines); |
| | |
| | | Set<DN> administrators = desc.getAdministrativeUsers(); |
| | | if (administrators.size() > 0) |
| | | { |
| | | TreeSet<DN> ordered = new TreeSet<DN>(administrators); |
| | | TreeSet<DN> ordered = new TreeSet<>(administrators); |
| | | for (DN dn : ordered) |
| | | { |
| | | writeLabelValue(INFO_ADMINISTRATIVE_USERS_LABEL.get(), dn.toString(), maxLabelWidth); |
| | |
| | | println(centerTitle(title)); |
| | | } |
| | | |
| | | Set<BaseDNDescriptor> replicas = new HashSet<BaseDNDescriptor>(); |
| | | Set<BaseDNDescriptor> replicas = new HashSet<>(); |
| | | Set<BackendDescriptor> bs = desc.getBackends(); |
| | | for (BackendDescriptor backend: bs) |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.tools.status; |
| | | |
| | | import static com.forgerock.opendj.cli.CommonArguments.*; |
| | | |
| | | import static org.opends.messages.AdminToolMessages.*; |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | |
| | | import com.forgerock.opendj.cli.Argument; |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | | import com.forgerock.opendj.cli.CommonArguments; |
| | | import com.forgerock.opendj.cli.IntegerArgument; |
| | | import com.forgerock.opendj.cli.StringArgument; |
| | | |
| | |
| | | public void initializeGlobalArguments(OutputStream outStream) |
| | | throws ArgumentException |
| | | { |
| | | ArrayList<Argument> defaultArgs = |
| | | new ArrayList<Argument>(createGlobalArguments(outStream, alwaysSSL)); |
| | | ArrayList<Argument> defaultArgs = new ArrayList<>(createGlobalArguments(outStream, alwaysSSL)); |
| | | defaultArgs.remove(secureArgsList.portArg); |
| | | defaultArgs.remove(secureArgsList.hostNameArg); |
| | | defaultArgs.remove(verboseArg); |
| | | defaultArgs.remove(noPropertiesFileArg); |
| | | defaultArgs.remove(propertiesFileArg); |
| | | noPromptArg = CommonArguments.getNoPrompt(); |
| | | noPromptArg = getNoPrompt(); |
| | | defaultArgs.add(0, noPromptArg); |
| | | |
| | | scriptFriendlyArg = CommonArguments.getScriptFriendly(); |
| | | scriptFriendlyArg = getScriptFriendly(); |
| | | defaultArgs.add(1, scriptFriendlyArg); |
| | | |
| | | StringArgument propertiesFileArgument |
| | | = CommonArguments.getPropertiesFile(); |
| | | StringArgument propertiesFileArgument = getPropertiesFile(); |
| | | |
| | | defaultArgs.add(propertiesFileArgument); |
| | | setFilePropertiesArgument(propertiesFileArgument); |
| | | |
| | | BooleanArgument noPropertiesFileArgument = |
| | | CommonArguments.getNoPropertiesFile(); |
| | | BooleanArgument noPropertiesFileArgument = getNoPropertiesFile(); |
| | | defaultArgs.add(noPropertiesFileArgument); |
| | | setNoPropertiesFileArgument(noPropertiesFileArgument); |
| | | |
| | |
| | | taskID = df.format(new Date()); |
| | | } |
| | | |
| | | ArrayList<RawAttribute> attributes = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> attributes = new ArrayList<>(); |
| | | |
| | | ArrayList<ByteString> ocValues = new ArrayList<ByteString>(3); |
| | | ArrayList<ByteString> ocValues = new ArrayList<>(3); |
| | | ocValues.add(ByteString.valueOf("top")); |
| | | ocValues.add(ByteString.valueOf(ConfigConstants.OC_TASK)); |
| | | |
| | |
| | | ocValues.add(ByteString.valueOf(information.getTaskObjectclass())); |
| | | attributes.add(new LDAPAttribute(ATTR_OBJECTCLASS, ocValues)); |
| | | |
| | | ArrayList<ByteString> taskIDValues = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> taskIDValues = new ArrayList<>(1); |
| | | taskIDValues.add(ByteString.valueOf(taskID)); |
| | | |
| | | if (scheduleRecurring) { |
| | |
| | | } |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_ID, taskIDValues)); |
| | | |
| | | ArrayList<ByteString> classValues = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> classValues = new ArrayList<>(1); |
| | | classValues.add(ByteString.valueOf(information.getTaskClass().getName())); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_CLASS, classValues)); |
| | | |
| | |
| | | Date startDate = information.getStartDateTime(); |
| | | if (startDate != null) { |
| | | String startTimeString = StaticUtils.formatDateTimeString(startDate); |
| | | ArrayList<ByteString> startDateValues = |
| | | new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> startDateValues = new ArrayList<>(1); |
| | | startDateValues.add(ByteString.valueOf(startTimeString)); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_SCHEDULED_START_TIME, |
| | | startDateValues)); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_SCHEDULED_START_TIME, startDateValues)); |
| | | } |
| | | |
| | | if (scheduleRecurring) { |
| | | ArrayList<ByteString> recurringPatternValues = |
| | | new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> recurringPatternValues = new ArrayList<>(1); |
| | | recurringPatternValues.add(ByteString.valueOf( |
| | | information.getRecurringDateTime())); |
| | | attributes.add(new LDAPAttribute(ATTR_RECURRING_TASK_SCHEDULE, |
| | | recurringPatternValues)); |
| | | attributes.add(new LDAPAttribute(ATTR_RECURRING_TASK_SCHEDULE, recurringPatternValues)); |
| | | } |
| | | |
| | | // add dependency IDs |
| | | List<String> dependencyIds = information.getDependencyIds(); |
| | | if (dependencyIds != null && dependencyIds.size() > 0) { |
| | | ArrayList<ByteString> dependencyIdValues = |
| | | new ArrayList<ByteString>(dependencyIds.size()); |
| | | ArrayList<ByteString> dependencyIdValues = new ArrayList<>(dependencyIds.size()); |
| | | for (String dependencyId : dependencyIds) { |
| | | dependencyIdValues.add(ByteString.valueOf(dependencyId)); |
| | | } |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_DEPENDENCY_IDS, |
| | | dependencyIdValues)); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_DEPENDENCY_IDS, dependencyIdValues)); |
| | | |
| | | // add the dependency action |
| | | FailedDependencyAction fda = information.getFailedDependencyAction(); |
| | | if (fda == null) { |
| | | fda = FailedDependencyAction.defaultValue(); |
| | | } |
| | | ArrayList<ByteString> fdaValues = |
| | | new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> fdaValues = new ArrayList<>(1); |
| | | fdaValues.add(ByteString.valueOf(fda.name())); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_FAILED_DEPENDENCY_ACTION, |
| | | fdaValues)); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_FAILED_DEPENDENCY_ACTION, fdaValues)); |
| | | } |
| | | |
| | | // add completion notification email addresses |
| | | List<String> compNotifEmailAddresss = |
| | | information.getNotifyUponCompletionEmailAddresses(); |
| | | if (compNotifEmailAddresss != null && compNotifEmailAddresss.size() > 0) { |
| | | ArrayList<ByteString> compNotifEmailAddrValues = |
| | | new ArrayList<ByteString>(compNotifEmailAddresss.size()); |
| | | ArrayList<ByteString> compNotifEmailAddrValues = new ArrayList<>(compNotifEmailAddresss.size()); |
| | | for (String emailAddr : compNotifEmailAddresss) { |
| | | compNotifEmailAddrValues.add(ByteString.valueOf(emailAddr)); |
| | | } |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_NOTIFY_ON_COMPLETION, |
| | | compNotifEmailAddrValues)); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_NOTIFY_ON_COMPLETION, compNotifEmailAddrValues)); |
| | | } |
| | | |
| | | // add error notification email addresses |
| | | List<String> errNotifEmailAddresss = |
| | | information.getNotifyUponErrorEmailAddresses(); |
| | | if (errNotifEmailAddresss != null && errNotifEmailAddresss.size() > 0) { |
| | | ArrayList<ByteString> errNotifEmailAddrValues = |
| | | new ArrayList<ByteString>(errNotifEmailAddresss.size()); |
| | | ArrayList<ByteString> errNotifEmailAddrValues = new ArrayList<>(errNotifEmailAddresss.size()); |
| | | for (String emailAddr : errNotifEmailAddresss) { |
| | | errNotifEmailAddrValues.add(ByteString.valueOf(emailAddr)); |
| | | } |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_NOTIFY_ON_ERROR, |
| | | errNotifEmailAddrValues)); |
| | | attributes.add(new LDAPAttribute(ATTR_TASK_NOTIFY_ON_ERROR, errNotifEmailAddrValues)); |
| | | } |
| | | |
| | | information.addTaskAttributes(attributes); |
| | |
| | | LDAPReader reader = connection.getLDAPReader(); |
| | | LDAPWriter writer = connection.getLDAPWriter(); |
| | | |
| | | ArrayList<Control> controls = new ArrayList<Control>(); |
| | | ArrayList<Control> controls = new ArrayList<>(); |
| | | ArrayList<RawAttribute> attributes = getTaskAttributes(information); |
| | | |
| | | ByteString entryDN = ByteString.valueOf(getTaskDN(attributes)); |
| | | AddRequestProtocolOp addRequest = new AddRequestProtocolOp(entryDN, |
| | | attributes); |
| | | AddRequestProtocolOp addRequest = new AddRequestProtocolOp(entryDN, attributes); |
| | | LDAPMessage requestMessage = |
| | | new LDAPMessage(nextMessageID.getAndIncrement(), addRequest, controls); |
| | | |
| | |
| | | */ |
| | | public synchronized List<TaskEntry> getTaskEntries() |
| | | throws LDAPException, IOException, DecodeException { |
| | | List<Entry> entries = new ArrayList<Entry>(); |
| | | List<Entry> entries = new ArrayList<>(); |
| | | |
| | | writeSearch(new SearchRequestProtocolOp( |
| | | ByteString.valueOf(ConfigConstants.DN_TASK_ROOT), |
| | |
| | | } |
| | | } |
| | | while (opType != LDAPConstants.OP_TYPE_SEARCH_RESULT_DONE); |
| | | List<TaskEntry> taskEntries = new ArrayList<TaskEntry>(entries.size()); |
| | | List<TaskEntry> taskEntries = new ArrayList<>(entries.size()); |
| | | for (Entry entry : entries) { |
| | | taskEntries.add(new TaskEntry(entry)); |
| | | } |
| | |
| | | |
| | | ByteString dn = ByteString.valueOf(entry.getDN().toString()); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | String newState; |
| | | if (TaskState.isPending(state)) { |
| | | newState = TaskState.CANCELED_BEFORE_STARTING.name(); |
| | |
| | | */ |
| | | public class TaskEntry { |
| | | |
| | | private static Map<String, LocalizableMessage> mapClassToTypeName = |
| | | new HashMap<String, LocalizableMessage>(); |
| | | |
| | | private static Map<String, LocalizableMessage> mapAttrToDisplayName = |
| | | new HashMap<String, LocalizableMessage>(); |
| | | private static Map<String, LocalizableMessage> mapClassToTypeName = new HashMap<>(); |
| | | private static Map<String, LocalizableMessage> mapAttrToDisplayName = new HashMap<>(); |
| | | |
| | | private int hashCode; |
| | | |
| | |
| | | * These attributes associated with the ds-task object |
| | | * class are all handled explicitly below in the constructor. |
| | | */ |
| | | private static Set<String> supAttrNames = new HashSet<String>(); |
| | | private static Set<String> supAttrNames = new HashSet<>(); |
| | | static { |
| | | supAttrNames.add("ds-task-id"); |
| | | supAttrNames.add("ds-task-class-name"); |
| | |
| | | */ |
| | | private Task task; |
| | | |
| | | private Map<LocalizableMessage, List<String>> taskSpecificAttrValues = |
| | | new HashMap<LocalizableMessage, List<String>>(); |
| | | private Map<LocalizableMessage, List<String>> taskSpecificAttrValues = new HashMap<>(); |
| | | |
| | | /** |
| | | * Creates a parameterized instance. |
| | |
| | | for (ByteString av : attr) { |
| | | List<String> valueList = taskSpecificAttrValues.get(attrTypeName); |
| | | if (valueList == null) { |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | taskSpecificAttrValues.put(attrTypeName, valueList); |
| | | } |
| | | valueList.add(av.toString()); |
| | |
| | | * @return array of log messages |
| | | */ |
| | | public List<LocalizableMessage> getLogMessages() { |
| | | List<LocalizableMessage> formattedLogs = new ArrayList<LocalizableMessage>(); |
| | | List<LocalizableMessage> formattedLogs = new ArrayList<>(); |
| | | for (String aLog : logs) { |
| | | formattedLogs.add(LocalizableMessage.raw(aLog)); |
| | | } |
| | |
| | | } |
| | | |
| | | private List<String> getMultiStringValue(Entry entry, String attrName) { |
| | | List<String> valuesList = new ArrayList<String>(); |
| | | List<String> valuesList = new ArrayList<>(); |
| | | List<Attribute> attrList = entry.getAttribute(attrName); |
| | | if (attrList != null) { |
| | | for (Attribute attr : attrList) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.tasks; |
| | | |
| | |
| | | { |
| | | checkHeaderDisplay(); |
| | | |
| | | MenuBuilder<FailedDependencyAction> builder = |
| | | new MenuBuilder<FailedDependencyAction>(app); |
| | | MenuBuilder<FailedDependencyAction> builder = new MenuBuilder<>(app); |
| | | builder.setPrompt(INFO_TASK_FAILED_DEPENDENCY_ACTION_PROMPT.get()); |
| | | builder.addCancelOption(false); |
| | | for (FailedDependencyAction choice : FailedDependencyAction.values()) |
| | |
| | | { |
| | | throw new ClientException(ReturnCode.ERROR_UNEXPECTED, LocalizableMessage.EMPTY); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void runDependency() throws ClientException |
| | |
| | | if (hasDependencies) |
| | | { |
| | | printAvailableDependencyTaskMessage(); |
| | | HashSet<String> dependencies = new HashSet<String>(); |
| | | HashSet<String> dependencies = new HashSet<>(); |
| | | while (true) |
| | | { |
| | | String dependencyID = |
| | |
| | | { |
| | | checkHeaderDisplay(); |
| | | |
| | | List<String> addresses = new ArrayList<String>(); |
| | | List<String> addresses = new ArrayList<>(); |
| | | boolean hasNotification = |
| | | app.confirmAction(hasNotificationPrompt, false); |
| | | if (hasNotification) |
| | | { |
| | | HashSet<String> set = new HashSet<String>(); |
| | | HashSet<String> set = new HashSet<>(); |
| | | while (true) |
| | | { |
| | | String address = |
| | | app.readLineOfInput(emailAddressPrompt); |
| | | if (address != null && !address.isEmpty()) |
| | | String address = app.readLineOfInput(emailAddressPrompt); |
| | | if (address == null || address.isEmpty()) |
| | | { |
| | | break; |
| | | } |
| | | if (!StaticUtils.isEmailAddress(address)) { |
| | | app.println(ERR_INVALID_EMAIL_ADDRESS.get(address)); |
| | | } |
| | |
| | | set.add(address); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | addresses.addAll(set); |
| | | } |
| | | return addresses; |
| | |
| | | { |
| | | checkHeaderDisplay(); |
| | | |
| | | MenuBuilder<ScheduleOption> builder = new MenuBuilder<ScheduleOption>(app); |
| | | MenuBuilder<ScheduleOption> builder = new MenuBuilder<>(app); |
| | | builder.setPrompt(INFO_TASK_SCHEDULE_PROMPT.get(taskName)); |
| | | builder.addCancelOption(false); |
| | | for (ScheduleOption choice : ScheduleOption.values()) |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.tasks; |
| | | |
| | |
| | | private boolean startNow; |
| | | private Date startDate; |
| | | private String recurringDateTime; |
| | | private final List<String> dependencyIds = |
| | | new ArrayList<String>(); |
| | | private final List<String> dependencyIds = new ArrayList<>(); |
| | | private FailedDependencyAction failedDependencyAction; |
| | | private final List<String> notifyUponCompletionEmailAddresses = |
| | | new ArrayList<String>(); |
| | | private final List<String> notifyUponErrorEmailAddresses = |
| | | new ArrayList<String>(); |
| | | private final List<String> notifyUponCompletionEmailAddresses = new ArrayList<>(); |
| | | private final List<String> notifyUponErrorEmailAddresses = new ArrayList<>(); |
| | | |
| | | /** |
| | | * Whether the arguments provided by the user, indicate that the task should |
| | |
| | | |
| | | // Poll the task printing log messages until finished |
| | | String taskId = taskEntry.getId(); |
| | | Set<LocalizableMessage> printedLogMessages = new HashSet<LocalizableMessage>(); |
| | | Set<LocalizableMessage> printedLogMessages = new HashSet<>(); |
| | | do { |
| | | taskEntry = tc.getTaskEntry(taskId); |
| | | List<LocalizableMessage> logs = taskEntry.getLogMessages(); |
| | |
| | | static boolean hasPostUpgradeTask; |
| | | |
| | | /** Developers should register upgrade tasks below. */ |
| | | private static final NavigableMap<BuildVersion, List<UpgradeTask>> TASKS = |
| | | new TreeMap<BuildVersion, List<UpgradeTask>>(); |
| | | private static final List<UpgradeTask> MANDATORY_TASKS = |
| | | new LinkedList<UpgradeTask>(); |
| | | private static final NavigableMap<BuildVersion, List<UpgradeTask>> TASKS = new TreeMap<>(); |
| | | private static final List<UpgradeTask> MANDATORY_TASKS = new LinkedList<>(); |
| | | |
| | | static |
| | | { |
| | |
| | | private static List<UpgradeTask> getUpgradeTasks( |
| | | final BuildVersion fromVersion, final BuildVersion toVersion) |
| | | { |
| | | final List<UpgradeTask> tasks = new LinkedList<UpgradeTask>(); |
| | | final List<UpgradeTask> tasks = new LinkedList<>(); |
| | | for (final List<UpgradeTask> subList : TASKS.subMap(fromVersion, false, |
| | | toVersion, true).values()) |
| | | { |
| | |
| | | List<UpgradeTask> taskList = TASKS.get(version); |
| | | if (taskList == null) |
| | | { |
| | | taskList = new LinkedList<UpgradeTask>(); |
| | | taskList = new LinkedList<>(); |
| | | TASKS.put(version, taskList); |
| | | } |
| | | taskList.addAll(Arrays.asList(tasks)); |
| | |
| | | else if (c instanceof ConfirmationCallback) |
| | | { |
| | | final ConfirmationCallback cc = (ConfirmationCallback) c; |
| | | List<String> choices = new ArrayList<String>(); |
| | | List<String> choices = new ArrayList<>(); |
| | | |
| | | final String defaultOption = getDefaultOption(cc.getDefaultOption()); |
| | | StringBuilder prompt = |
| | |
| | | static int countErrors; |
| | | |
| | | /** Contains all the indexes to rebuild. */ |
| | | static Set<String> indexesToRebuild = new HashSet<String>(); |
| | | static Set<String> indexesToRebuild = new HashSet<>(); |
| | | |
| | | /** A flag to avoid rebuild single indexes if 'rebuild all' is selected. */ |
| | | static boolean isRebuildAllIndexesIsPresent; |
| | |
| | | public void postUpgrade(final UpgradeContext context) throws ClientException |
| | | { |
| | | LocalizableMessage message = null; |
| | | final List<String> args = new LinkedList<String>(); |
| | | final List<String> args = new LinkedList<>(); |
| | | |
| | | if (isRebuildAllIndexesIsPresent && isRebuildAllIndexesTaskAccepted) |
| | | { |
| | |
| | | { |
| | | final Schema schema = getUpgradeSchema(); |
| | | |
| | | final List<String> listBackends = new LinkedList<String>(); |
| | | final List<String> listBackends = new LinkedList<>(); |
| | | LDIFEntryReader entryReader = null; |
| | | try |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | * The set of response controls that will always be returned for |
| | | * an abandon operation. |
| | | */ |
| | | protected static final List<Control> NO_RESPONSE_CONTROLS = |
| | | new ArrayList<Control>(0); |
| | | protected static final List<Control> NO_RESPONSE_CONTROLS = new ArrayList<>(0); |
| | | |
| | | /** The client connection with which this operation is associated. */ |
| | | protected final ClientConnection clientConnection; |
| | |
| | | |
| | | if (requestControls == null) |
| | | { |
| | | this.requestControls = new ArrayList<Control>(0); |
| | | this.requestControls = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | resultCode = ResultCode.UNDEFINED; |
| | | additionalLogItems = null; |
| | | errorMessage = new LocalizableMessageBuilder(); |
| | | attachments = new HashMap<String,Object>(); |
| | | attachments = new HashMap<>(); |
| | | matchedDN = null; |
| | | referralURLs = null; |
| | | cancelResult = null; |
| | |
| | | Reject.ifNull(item); |
| | | if (additionalLogItems == null) |
| | | { |
| | | additionalLogItems = new LinkedList<AdditionalLogItem>(); |
| | | additionalLogItems = new LinkedList<>(); |
| | | } |
| | | additionalLogItems.add(item); |
| | | } |
| | |
| | | { |
| | | if (postResponseCallbacks == null) |
| | | { |
| | | postResponseCallbacks = new LinkedList<Runnable>(); |
| | | postResponseCallbacks = new LinkedList<>(); |
| | | } |
| | | postResponseCallbacks.add(callback); |
| | | } |
| | |
| | | |
| | | if (notificationProperties == null) |
| | | { |
| | | this.notificationProperties = |
| | | new HashMap<AccountStatusNotificationProperty, |
| | | List<String>>(0); |
| | | this.notificationProperties = new HashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | List<ByteString> oldPasswords, |
| | | List<ByteString> newPasswords) |
| | | { |
| | | HashMap<AccountStatusNotificationProperty,List<String>> props = |
| | | new HashMap<AccountStatusNotificationProperty, |
| | | List<String>>(4); |
| | | HashMap<AccountStatusNotificationProperty,List<String>> props = new HashMap<>(4); |
| | | |
| | | PasswordPolicy policy = pwPolicyState.getAuthenticationPolicy(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(1); |
| | | ArrayList<String> propList = new ArrayList<>(1); |
| | | propList.add(policy.getDN().toString()); |
| | | props.put(PASSWORD_POLICY_DN, propList); |
| | | |
| | |
| | | long secondsUntilUnlock = policy.getLockoutDuration(); |
| | | if (secondsUntilUnlock > 0L) |
| | | { |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(String.valueOf(secondsUntilUnlock)); |
| | | props.put(SECONDS_UNTIL_UNLOCK, propList); |
| | | |
| | | propList = new ArrayList<String>(1); |
| | | propList.add( |
| | | secondsToTimeString(secondsUntilUnlock).toString()); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(secondsToTimeString(secondsUntilUnlock).toString()); |
| | | props.put(TIME_UNTIL_UNLOCK, propList); |
| | | |
| | | long unlockTime = System.currentTimeMillis() + |
| | | (1000*secondsUntilUnlock); |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(new Date(unlockTime).toString()); |
| | | props.put(ACCOUNT_UNLOCK_TIME, propList); |
| | | } |
| | |
| | | |
| | | if (timeToExpiration >= 0) |
| | | { |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(String.valueOf(timeToExpiration)); |
| | | props.put(SECONDS_UNTIL_EXPIRATION, propList); |
| | | |
| | | propList = new ArrayList<String>(1); |
| | | propList.add( |
| | | secondsToTimeString(timeToExpiration).toString()); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(secondsToTimeString(timeToExpiration).toString()); |
| | | props.put(TIME_UNTIL_EXPIRATION, propList); |
| | | |
| | | long expTime = System.currentTimeMillis() + |
| | | (1000*timeToExpiration); |
| | | propList = new ArrayList<String>(1); |
| | | long expTime = System.currentTimeMillis() + (1000*timeToExpiration); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(new Date(expTime).toString()); |
| | | props.put(PASSWORD_EXPIRATION_TIME, propList); |
| | | } |
| | |
| | | |
| | | private static ArrayList<String> toStrings(List<ByteString> byteStrings) |
| | | { |
| | | ArrayList<String> results = new ArrayList<String>(byteStrings.size()); |
| | | ArrayList<String> results = new ArrayList<>(byteStrings.size()); |
| | | for (ByteString v : byteStrings) |
| | | { |
| | | results.add(v.toString()); |
| | |
| | | |
| | | if (initialCapacity > 1) |
| | | { |
| | | elements = new LinkedHashSet<T>(initialCapacity); |
| | | elements = new LinkedHashSet<>(initialCapacity); |
| | | } |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | elements = new LinkedHashSet<T>(2); |
| | | elements = new LinkedHashSet<>(2); |
| | | |
| | | // Move the first value into the set. |
| | | elements.add(firstElement); |
| | |
| | | |
| | | if (firstElement != null) |
| | | { |
| | | elements = new LinkedHashSet<T>(1 + c.size()); |
| | | elements = new LinkedHashSet<>(1 + c.size()); |
| | | elements.add(firstElement); |
| | | firstElement = null; |
| | | return elements.addAll(c); |
| | |
| | | firstElement = c.iterator().next(); |
| | | return true; |
| | | default: |
| | | elements = new LinkedHashSet<T>(c); |
| | | elements = new LinkedHashSet<>(c); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | |
| | | if (initialCapacity > 1) |
| | | { |
| | | elements = new LinkedHashSet<T>(initialCapacity); |
| | | elements = new LinkedHashSet<>(initialCapacity); |
| | | } |
| | | } |
| | | |
| | |
| | | private SortedSet<String> normalizedOptions; |
| | | |
| | | /** The set of options. */ |
| | | private final SmallSet<String> options = new SmallSet<String>(); |
| | | private final SmallSet<String> options = new SmallSet<>(); |
| | | |
| | | /** The set of attribute values, which are lazily normalized. */ |
| | | private Set<AttributeValue> values = new SmallSet<>(); |
| | |
| | | return options.add(option); |
| | | case 1: |
| | | // Normalize and add the first option to normalized set. |
| | | normalizedOptions = new TreeSet<String>(); |
| | | normalizedOptions = new TreeSet<>(); |
| | | normalizedOptions.add(toLowerCase(options.firstElement)); |
| | | |
| | | if (normalizedOptions.add(toLowerCase(option))) |
| | |
| | | name = null; |
| | | normalizedOptions = null; |
| | | options.clear(); |
| | | values = new SmallSet<AttributeValue>(); |
| | | values = new SmallSet<>(); |
| | | |
| | | return attribute; |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2012-2014 ForgeRock AS. |
| | | * Copyright 2012-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | public <T> Set<T> asSetOf(final Function<ByteString, ? extends T, NeverThrowsException> f, |
| | | final Collection<? extends T> defaultValues) { |
| | | if (!isEmpty(attribute)) { |
| | | final LinkedHashSet<T> result = new LinkedHashSet<T>(attribute.size()); |
| | | final LinkedHashSet<T> result = new LinkedHashSet<>(attribute.size()); |
| | | for (final ByteString v : attribute) { |
| | | result.add(f.apply(v)); |
| | | } |
| | | return result; |
| | | } else if (defaultValues != null) { |
| | | return new LinkedHashSet<T>(defaultValues); |
| | | return new LinkedHashSet<>(defaultValues); |
| | | } else { |
| | | return new LinkedHashSet<T>(0); |
| | | return new LinkedHashSet<>(0); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (dependencies == null) |
| | | { |
| | | this.dependencies = new HashSet<String>(); |
| | | this.dependencies = new HashSet<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (backupProperties == null) |
| | | { |
| | | this.backupProperties = new HashMap<String,String>(); |
| | | this.backupProperties = new HashMap<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | */ |
| | | public LinkedList<String> encode() |
| | | { |
| | | LinkedList<String> list = new LinkedList<String>(); |
| | | LinkedList<String> list = new LinkedList<>(); |
| | | SimpleDateFormat dateFormat = |
| | | new SimpleDateFormat(DATE_FORMAT_GMT_TIME); |
| | | |
| | | dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); |
| | | |
| | | list.add(PROPERTY_BACKUP_ID + "=" + backupID); |
| | | list.add(PROPERTY_BACKUP_DATE + "=" + |
| | | dateFormat.format(backupDate)); |
| | | list.add(PROPERTY_IS_INCREMENTAL + "=" + |
| | | String.valueOf(isIncremental)); |
| | | list.add(PROPERTY_IS_COMPRESSED + "=" + |
| | | String.valueOf(isCompressed)); |
| | | list.add(PROPERTY_IS_ENCRYPTED + "=" + |
| | | String.valueOf(isEncrypted)); |
| | | list.add(PROPERTY_BACKUP_DATE + "=" + dateFormat.format(backupDate)); |
| | | list.add(PROPERTY_IS_INCREMENTAL + "=" + String.valueOf(isIncremental)); |
| | | list.add(PROPERTY_IS_COMPRESSED + "=" + String.valueOf(isCompressed)); |
| | | list.add(PROPERTY_IS_ENCRYPTED + "=" + String.valueOf(isEncrypted)); |
| | | |
| | | if (unsignedHash != null) |
| | | { |
| | | list.add(PROPERTY_UNSIGNED_HASH + "=" + |
| | | Base64.encode(unsignedHash)); |
| | | list.add(PROPERTY_UNSIGNED_HASH + "=" + Base64.encode(unsignedHash)); |
| | | } |
| | | |
| | | if (signedHash != null) |
| | | { |
| | | list.add(PROPERTY_SIGNED_HASH + "=" + |
| | | Base64.encode(signedHash)); |
| | | list.add(PROPERTY_SIGNED_HASH + "=" + Base64.encode(signedHash)); |
| | | } |
| | | |
| | | if (! dependencies.isEmpty()) |
| | |
| | | boolean isEncrypted = false; |
| | | byte[] unsignedHash = null; |
| | | byte[] signedHash = null; |
| | | HashSet<String> dependencies = new HashSet<String>(); |
| | | HashMap<String,String> backupProperties = |
| | | new HashMap<String,String>(); |
| | | HashSet<String> dependencies = new HashSet<>(); |
| | | HashMap<String,String> backupProperties = new HashMap<>(); |
| | | |
| | | String backupPath = backupDirectory.getPath(); |
| | | try |
| | |
| | | |
| | | // Construct the normalized attribute name mapping. |
| | | if (names != null) { |
| | | this.names = new LinkedHashMap<String, String>(names.size()); |
| | | this.names = new LinkedHashMap<>(names.size()); |
| | | |
| | | // Make sure the primary name is first (never null). |
| | | this.names.put(lowerName, this.primaryName); |
| | |
| | | this.names.put(toLowerCase(name), name); |
| | | } |
| | | } else if (this.primaryName != null) { |
| | | this.names = Collections.singletonMap(lowerName, |
| | | this.primaryName); |
| | | this.names = Collections.singletonMap(lowerName, this.primaryName); |
| | | } else { |
| | | this.names = Collections.emptyMap(); |
| | | } |
| | | |
| | | // FIXME: should really be a deep-copy. |
| | | if (extraProperties != null) { |
| | | this.extraProperties = new LinkedHashMap<String, List<String>>( |
| | | extraProperties); |
| | | this.extraProperties = new LinkedHashMap<>(extraProperties); |
| | | } else { |
| | | this.extraProperties = Collections.emptyMap(); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | LinkedList<String> values = new LinkedList<String>(); |
| | | LinkedList<String> values = new LinkedList<>(); |
| | | values.add(value); |
| | | |
| | | elem.getExtraProperties().put(name, values); |
| | |
| | | } |
| | | else |
| | | { |
| | | LinkedList<String> valuesCopy = new LinkedList<String>(values); |
| | | LinkedList<String> valuesCopy = new LinkedList<>(values); |
| | | extraProperties.put(name, valuesCopy); |
| | | } |
| | | } |
| | |
| | | |
| | | if ((names == null) || names.isEmpty()) |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(0); |
| | | this.names = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(names); |
| | | this.names = new LinkedHashMap<>(names); |
| | | } |
| | | |
| | | if ((auxiliaryClasses == null) || auxiliaryClasses.isEmpty()) |
| | | { |
| | | this.auxiliaryClasses = new LinkedHashSet<ObjectClass>(0); |
| | | this.auxiliaryClasses = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.auxiliaryClasses = |
| | | new LinkedHashSet<ObjectClass>(auxiliaryClasses); |
| | | this.auxiliaryClasses = new LinkedHashSet<>(auxiliaryClasses); |
| | | } |
| | | |
| | | if ((requiredAttributes == null) || requiredAttributes.isEmpty()) |
| | | { |
| | | this.requiredAttributes = new LinkedHashSet<AttributeType>(0); |
| | | this.requiredAttributes = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.requiredAttributes = |
| | | new LinkedHashSet<AttributeType>(requiredAttributes); |
| | | this.requiredAttributes = new LinkedHashSet<>(requiredAttributes); |
| | | } |
| | | |
| | | if ((optionalAttributes == null) || optionalAttributes.isEmpty()) |
| | | { |
| | | this.optionalAttributes = new LinkedHashSet<AttributeType>(0); |
| | | this.optionalAttributes = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.optionalAttributes = |
| | | new LinkedHashSet<AttributeType>(optionalAttributes); |
| | | this.optionalAttributes = new LinkedHashSet<>(optionalAttributes); |
| | | } |
| | | |
| | | if ((prohibitedAttributes == null) || |
| | | prohibitedAttributes.isEmpty()) |
| | | { |
| | | this.prohibitedAttributes = new LinkedHashSet<AttributeType>(0); |
| | | this.prohibitedAttributes = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.prohibitedAttributes = |
| | | new LinkedHashSet<AttributeType>(prohibitedAttributes); |
| | | this.prohibitedAttributes = new LinkedHashSet<>(prohibitedAttributes); |
| | | } |
| | | |
| | | if ((extraProperties == null) || extraProperties.isEmpty()) |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(0); |
| | | this.extraProperties = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(extraProperties); |
| | | this.extraProperties = new LinkedHashMap<>(extraProperties); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if ((names == null) || names.isEmpty()) |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(0); |
| | | this.names = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(names); |
| | | this.names = new LinkedHashMap<>(names); |
| | | } |
| | | |
| | | if ((superiorRules == null) || superiorRules.isEmpty()) |
| | | { |
| | | this.superiorRules = new LinkedHashSet<DITStructureRule>(0); |
| | | this.superiorRules = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.superiorRules = |
| | | new LinkedHashSet<DITStructureRule>(superiorRules); |
| | | this.superiorRules = new LinkedHashSet<>(superiorRules); |
| | | } |
| | | |
| | | if ((extraProperties == null) || extraProperties.isEmpty()) |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(0); |
| | | this.extraProperties = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(extraProperties); |
| | | this.extraProperties = new LinkedHashMap<>(extraProperties); |
| | | } |
| | | } |
| | | |
| | |
| | | // components. |
| | | boolean allowExceptions = |
| | | DirectoryServer.allowAttributeNameExceptions(); |
| | | LinkedList<RDN> rdnComponents = new LinkedList<RDN>(); |
| | | LinkedList<RDN> rdnComponents = new LinkedList<>(); |
| | | while (true) |
| | | { |
| | | ByteString attributeName = |
| | |
| | | // components. |
| | | boolean allowExceptions = |
| | | DirectoryServer.allowAttributeNameExceptions(); |
| | | LinkedList<RDN> rdnComponents = new LinkedList<RDN>(); |
| | | LinkedList<RDN> rdnComponents = new LinkedList<>(); |
| | | while (true) |
| | | { |
| | | StringBuilder attributeName = new StringBuilder(); |
| | |
| | | public DirectoryEnvironmentConfig(Properties properties, boolean checkIfServerIsRunning) |
| | | { |
| | | this.checkIfServerIsRunning = checkIfServerIsRunning; |
| | | configProperties = new HashMap<String,String>(); |
| | | configProperties = new HashMap<>(); |
| | | if (properties != null) |
| | | { |
| | | Enumeration<?> propertyNames = properties.propertyNames(); |
| | |
| | | this.checkIfServerIsRunning = checkIfServerIsRunning; |
| | | if (properties == null) |
| | | { |
| | | configProperties = new HashMap<String,String>(); |
| | | configProperties = new HashMap<>(); |
| | | } |
| | | else |
| | | { |
| | | configProperties = new HashMap<String,String>(properties); |
| | | configProperties = new HashMap<>(properties); |
| | | } |
| | | } |
| | | |
| | |
| | | * The set of suppressed real attributes for this entry. It contains real |
| | | * attributes that have been overridden by virtual attributes. |
| | | */ |
| | | private final Map<AttributeType, List<Attribute>> suppressedAttributes = |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(); |
| | | private final Map<AttributeType, List<Attribute>> suppressedAttributes = new LinkedHashMap<>(); |
| | | |
| | | /** The set of objectclasses for this entry. */ |
| | | private Map<ObjectClass,String> objectClasses; |
| | |
| | | { |
| | | return map; |
| | | } |
| | | return new HashMap<K, V>(); |
| | | return new HashMap<>(); |
| | | } |
| | | |
| | | |
| | |
| | | // Estimate the size. |
| | | int size = userAttributes.size() + operationalAttributes.size(); |
| | | |
| | | final List<Attribute> attributes = new ArrayList<Attribute>(size); |
| | | final List<Attribute> attributes = new ArrayList<>(size); |
| | | for (List<Attribute> attrs : userAttributes.values()) |
| | | { |
| | | attributes.addAll(attrs); |
| | |
| | | { |
| | | if (includeSubordinates && attributeType.mayHaveSubordinateTypes()) |
| | | { |
| | | List<Attribute> attributes = new LinkedList<Attribute>(); |
| | | List<Attribute> attributes = new LinkedList<>(); |
| | | addAllIfNotNull(attributes, userAttributes.get(attributeType)); |
| | | addAllIfNotNull(attributes, operationalAttributes.get(attributeType)); |
| | | |
| | |
| | | if (lowerName.equals(OBJECTCLASS_ATTRIBUTE_TYPE_NAME) && |
| | | (! objectClasses.isEmpty())) |
| | | { |
| | | List<Attribute> attrList = new LinkedList<Attribute>(); |
| | | List<Attribute> attrList = new LinkedList<>(); |
| | | attrList.add(getObjectClassAttribute()); |
| | | return attrList; |
| | | } |
| | |
| | | boolean includeSubordinates, |
| | | Set<String> options) |
| | | { |
| | | List<Attribute> attributes = new LinkedList<Attribute>(); |
| | | List<Attribute> attributes = new LinkedList<>(); |
| | | if (includeSubordinates && attributeType.mayHaveSubordinateTypes()) |
| | | { |
| | | addAllIfNotNull(attributes, userAttributes.get(attributeType)); |
| | |
| | | if (lowerName.equals(OBJECTCLASS_ATTRIBUTE_TYPE_NAME) && |
| | | ((options == null) || options.isEmpty())) |
| | | { |
| | | List<Attribute> attributes = new LinkedList<Attribute>(); |
| | | List<Attribute> attributes = new LinkedList<>(); |
| | | attributes.add(getObjectClassAttribute()); |
| | | return attributes; |
| | | } |
| | |
| | | { |
| | | if (attributeType.mayHaveSubordinateTypes()) |
| | | { |
| | | List<Attribute> attributes = new LinkedList<Attribute>(); |
| | | List<Attribute> attributes = new LinkedList<>(); |
| | | addAllIfNotNull(attributes, attrs.get(attributeType)); |
| | | for (AttributeType at : schema.getSubTypes(attributeType)) |
| | | { |
| | |
| | | private List<Attribute> getAttribute(AttributeType attributeType, |
| | | Set<String> options, Map<AttributeType, List<Attribute>> attrs) |
| | | { |
| | | List<Attribute> attributes = new LinkedList<Attribute>(); |
| | | List<Attribute> attributes = new LinkedList<>(); |
| | | addAllIfNotNull(attributes, attrs.get(attributeType)); |
| | | |
| | | if (attributeType.mayHaveSubordinateTypes()) |
| | |
| | | // special way. |
| | | if (t.isObjectClass()) |
| | | { |
| | | Map<ObjectClass, String> ocs = new LinkedHashMap<ObjectClass, String>(); |
| | | Map<ObjectClass, String> ocs = new LinkedHashMap<>(); |
| | | for (ByteString v : a) |
| | | { |
| | | String ocName = v.toString(); |
| | |
| | | switch (mod.getModificationType().asEnum()) |
| | | { |
| | | case ADD: |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | addAttribute(a, duplicateValues); |
| | | if (!duplicateValues.isEmpty() && !relaxConstraints) |
| | | { |
| | |
| | | break; |
| | | |
| | | case DELETE: |
| | | List<ByteString> missingValues = new LinkedList<ByteString>(); |
| | | List<ByteString> missingValues = new LinkedList<>(); |
| | | removeAttribute(a, missingValues); |
| | | if (!missingValues.isEmpty() && !relaxConstraints) |
| | | { |
| | |
| | | */ |
| | | public Entry duplicate(boolean processVirtual) |
| | | { |
| | | Map<ObjectClass, String> objectClassesCopy = |
| | | new HashMap<ObjectClass,String>(objectClasses); |
| | | Map<ObjectClass, String> objectClassesCopy = new HashMap<>(objectClasses); |
| | | |
| | | Map<AttributeType, List<Attribute>> userAttrsCopy = |
| | | new HashMap<AttributeType,List<Attribute>>( |
| | | userAttributes.size()); |
| | | Map<AttributeType, List<Attribute>> userAttrsCopy = new HashMap<>(userAttributes.size()); |
| | | deepCopy(userAttributes, userAttrsCopy, false, false, false, |
| | | true, false); |
| | | |
| | | Map<AttributeType, List<Attribute>> operationalAttrsCopy = |
| | | new HashMap<AttributeType,List<Attribute>>( |
| | | operationalAttributes.size()); |
| | | new HashMap<>(operationalAttributes.size()); |
| | | deepCopy(operationalAttributes, operationalAttrsCopy, false, |
| | | false, false, true, false); |
| | | |
| | |
| | | { |
| | | AttributeType t = mapEntry.getKey(); |
| | | List<Attribute> sourceList = mapEntry.getValue(); |
| | | List<Attribute> targetList = new ArrayList<Attribute>(sourceList.size()); |
| | | List<Attribute> targetList = new ArrayList<>(sourceList.size()); |
| | | |
| | | for (Attribute a : sourceList) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | Set<String> referralURLs = new LinkedHashSet<String>(); |
| | | Set<String> referralURLs = new LinkedHashSet<>(); |
| | | for (Attribute a : refAttrs) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | ATTR_COLLECTIVE_EXCLUSIONS_LC); |
| | | List<Attribute> exclusionsAttrList = |
| | | operationalAttributes.get(exclusionsType); |
| | | Set<String> exclusionsNameSet = new HashSet<String>(); |
| | | Set<String> exclusionsNameSet = new HashSet<>(); |
| | | if (exclusionsAttrList != null && !exclusionsAttrList.isEmpty()) |
| | | { |
| | | for (Attribute attr : exclusionsAttrList) |
| | |
| | | { |
| | | // There aren't any conflicts, so we can just add the |
| | | // attribute to the entry. |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | attrList.add(collectiveAttr); |
| | | putAttributes(attributeType, attrList); |
| | | } |
| | |
| | | // suppressed list and replace it with the |
| | | // virtual attribute. |
| | | suppressedAttributes.put(attributeType, attrList); |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | attrList.add(collectiveAttr); |
| | | attributes.put(attributeType, attrList); |
| | | break; |
| | |
| | | { |
| | | // There aren't any conflicts, so we can just add the |
| | | // attribute to the entry. |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | attrList.add(new VirtualAttribute(attributeType, this, rule)); |
| | | putAttributes(attributeType, attrList); |
| | | } |
| | |
| | | // We need to move the real attribute to the suppressed |
| | | // list and replace it with the virtual attribute. |
| | | suppressedAttributes.put(attributeType, attrList); |
| | | attrList = new LinkedList<Attribute>(); |
| | | attrList = new LinkedList<>(); |
| | | attrList.add(new VirtualAttribute(attributeType, this, rule)); |
| | | attributes.put(attributeType, attrList); |
| | | break; |
| | |
| | | |
| | | // The set of object classes will be encoded as a single |
| | | // string with the object class names separated by zeros. |
| | | objectClasses = new LinkedHashMap<ObjectClass,String>(); |
| | | objectClasses = new LinkedHashMap<>(); |
| | | int startPos = entryBuffer.position(); |
| | | for (int i=0; i < ocLength; i++) |
| | | { |
| | |
| | | { |
| | | // Next is the number of zero terminated object classes. |
| | | int numOC = entryBuffer.getBERLength(); |
| | | objectClasses = new LinkedHashMap<ObjectClass,String>(numOC); |
| | | objectClasses = new LinkedHashMap<>(numOC); |
| | | for(int i = 0; i < numOC; i++) |
| | | { |
| | | int startPos = entryBuffer.position(); |
| | |
| | | |
| | | |
| | | // Now, we should iterate through the attributes and decode each one. |
| | | Map<AttributeType, List<Attribute>> attributes = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(attrs); |
| | | Map<AttributeType, List<Attribute>> attributes = new LinkedHashMap<>(attrs); |
| | | if (config.compressAttributeDescriptions()) |
| | | { |
| | | for (int i=0; i < attrs; i++) |
| | |
| | | List<Attribute> attrList = attributes.get(a.getAttributeType()); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList = new ArrayList<>(1); |
| | | attributes.put(a.getAttributeType(), attrList); |
| | | } |
| | | attrList.add(a); |
| | |
| | | List<Attribute> attrList = attributes.get(attributeType); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList = new ArrayList<>(1); |
| | | attributes.put(attributeType, attrList); |
| | | } |
| | | attrList.add(a); |
| | |
| | | */ |
| | | public List<StringBuilder> toLDIF() |
| | | { |
| | | List<StringBuilder> ldifLines = new LinkedList<StringBuilder>(); |
| | | List<StringBuilder> ldifLines = new LinkedList<>(); |
| | | |
| | | // First, append the DN. |
| | | StringBuilder dnLine = new StringBuilder("dn"); |
| | |
| | | if (attrNameList == null || attrNameList.isEmpty()) |
| | | { |
| | | // Common case: return filtered user attributes. |
| | | userAttrsCopy = new LinkedHashMap<AttributeType, List<Attribute>>( |
| | | userAttributes.size()); |
| | | operationalAttrsCopy = |
| | | new LinkedHashMap<AttributeType, List<Attribute>>(0); |
| | | userAttrsCopy = new LinkedHashMap<>(userAttributes.size()); |
| | | operationalAttrsCopy = new LinkedHashMap<>(0); |
| | | |
| | | if (omitReal) |
| | | { |
| | | objectClassesCopy = new LinkedHashMap<ObjectClass, String>(0); |
| | | objectClassesCopy = new LinkedHashMap<>(0); |
| | | } |
| | | else if (omitValues) |
| | | { |
| | | objectClassesCopy = new LinkedHashMap<ObjectClass, String>(0); |
| | | objectClassesCopy = new LinkedHashMap<>(0); |
| | | |
| | | // Add empty object class attribute. |
| | | userAttrsCopy.put(ocType, newList(Attributes.empty(ocType))); |
| | | } |
| | | else |
| | | { |
| | | objectClassesCopy = |
| | | new LinkedHashMap<ObjectClass, String>(objectClasses); |
| | | objectClassesCopy = new LinkedHashMap<>(objectClasses); |
| | | |
| | | // First, add the objectclass attribute. |
| | | Attribute ocAttr = getObjectClassAttribute(); |
| | |
| | | // Incrementally build table of attributes. |
| | | if (omitReal || omitValues) |
| | | { |
| | | objectClassesCopy = new LinkedHashMap<ObjectClass, String>(0); |
| | | objectClassesCopy = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | objectClassesCopy = |
| | | new LinkedHashMap<ObjectClass, String>(objectClasses.size()); |
| | | objectClassesCopy = new LinkedHashMap<>(objectClasses.size()); |
| | | } |
| | | |
| | | userAttrsCopy = new LinkedHashMap<AttributeType, List<Attribute>>( |
| | | userAttributes.size()); |
| | | operationalAttrsCopy = |
| | | new LinkedHashMap<AttributeType, List<Attribute>>( |
| | | operationalAttributes.size()); |
| | | userAttrsCopy = new LinkedHashMap<>(userAttributes.size()); |
| | | operationalAttrsCopy = new LinkedHashMap<>(operationalAttributes.size()); |
| | | |
| | | for (String attrName : attrNameList) |
| | | { |
| | |
| | | String tmpName = attrName.substring(0, semicolonPos); |
| | | lowerName = toLowerCase(tmpName); |
| | | int nextPos = attrName.indexOf(';', semicolonPos+1); |
| | | options = new HashSet<String>(); |
| | | options = new HashSet<>(); |
| | | while (nextPos > 0) |
| | | { |
| | | options.add(attrName.substring(semicolonPos+1, nextPos)); |
| | |
| | | */ |
| | | private List<Attribute> newList(Attribute elem) |
| | | { |
| | | List<Attribute> l = new ArrayList<Attribute>(1); |
| | | List<Attribute> l = new ArrayList<>(1); |
| | | l.add(elem); |
| | | return l; |
| | | } |
| | |
| | | if (attrList == null) |
| | | { |
| | | // Assume that they'll all go in the one list. This isn't |
| | | // always the case, for example if the list contains |
| | | // sub-types. |
| | | attrList = new ArrayList<Attribute>(sourceList.size()); |
| | | // always the case, for example if the list contains sub-types. |
| | | attrList = new ArrayList<>(sourceList.size()); |
| | | attrList.add(attribute); |
| | | destMap.put(subAttrType, attrList); |
| | | } |
| | |
| | | /** Time-stamp acts as memory barrier for networkInterfaces. */ |
| | | private static final long CACHED_LOCAL_ADDRESSES_TIMEOUT_MS = 30 * 1000; |
| | | private static volatile long localAddressesTimeStamp; |
| | | private static Set<InetAddress> localAddresses = new HashSet<InetAddress>(); |
| | | private static Set<InetAddress> localAddresses = new HashSet<>(); |
| | | |
| | | /** |
| | | * Returns {@code true} if the provided {@code InetAddress} represents the |
| | |
| | | final Enumeration<NetworkInterface> i = |
| | | NetworkInterface.getNetworkInterfaces(); |
| | | if (i != null) { |
| | | final Set<InetAddress> newLocalAddresses = new HashSet<InetAddress>(); |
| | | final Set<InetAddress> newLocalAddresses = new HashSet<>(); |
| | | while (i.hasMoreElements()) |
| | | { |
| | | NetworkInterface n = i.nextElement(); |
| | |
| | | |
| | | if (controls == null) |
| | | { |
| | | this.controls = new ArrayList<Control>(0); |
| | | this.controls = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if ((extraProperties == null) || extraProperties.isEmpty()) |
| | | { |
| | | this.extraProperties = new LinkedHashMap<String,List<String>>(0); |
| | | this.extraProperties = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.extraProperties = new LinkedHashMap<String,List<String>>(extraProperties); |
| | | this.extraProperties = new LinkedHashMap<>(extraProperties); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | LinkedList<String> valuesCopy = new LinkedList<String>(values); |
| | | LinkedList<String> valuesCopy = new LinkedList<>(values); |
| | | extraProperties.put(name, valuesCopy); |
| | | } |
| | | } |
| | |
| | | |
| | | if (attributes == null) |
| | | { |
| | | this.attributes = new LinkedHashSet<String>(); |
| | | this.attributes = new LinkedHashSet<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (extensions == null) |
| | | { |
| | | this.extensions = new LinkedList<String>(); |
| | | this.extensions = new LinkedList<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (attributes == null) |
| | | { |
| | | this.attributes = new LinkedHashSet<String>(); |
| | | this.attributes = new LinkedHashSet<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (extensions == null) |
| | | { |
| | | this.extensions = new LinkedList<String>(); |
| | | this.extensions = new LinkedList<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | startPos = pos+1; |
| | | } |
| | | |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | StringTokenizer tokenizer = new StringTokenizer(attrsString, ","); |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | |
| | | |
| | | // The rest of the string must be the set of extensions. |
| | | String extensionsString = url.substring(startPos); |
| | | LinkedList<String> extensions = new LinkedList<String>(); |
| | | LinkedList<String> extensions = new LinkedList<>(); |
| | | tokenizer = new StringTokenizer(extensionsString, ","); |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | this.existingFileBehavior = existingFileBehavior; |
| | | ldifOutputStream = null; |
| | | |
| | | excludeBranches = new ArrayList<DN>(); |
| | | includeBranches = new ArrayList<DN>(); |
| | | excludeFilters = new ArrayList<SearchFilter>(); |
| | | includeFilters = new ArrayList<SearchFilter>(); |
| | | excludeBranches = new ArrayList<>(); |
| | | includeBranches = new ArrayList<>(); |
| | | excludeFilters = new ArrayList<>(); |
| | | includeFilters = new ArrayList<>(); |
| | | compressData = false; |
| | | encryptData = false; |
| | | hashData = false; |
| | |
| | | signHash = false; |
| | | typesOnly = false; |
| | | writer = null; |
| | | excludeAttributes = new HashSet<AttributeType>(); |
| | | includeAttributes = new HashSet<AttributeType>(); |
| | | excludeAttributes = new HashSet<>(); |
| | | includeAttributes = new HashSet<>(); |
| | | wrapColumn = -1; |
| | | } |
| | | |
| | |
| | | ldifFile = null; |
| | | existingFileBehavior = ExistingFileBehavior.FAIL; |
| | | |
| | | excludeBranches = new ArrayList<DN>(); |
| | | includeBranches = new ArrayList<DN>(); |
| | | excludeFilters = new ArrayList<SearchFilter>(); |
| | | includeFilters = new ArrayList<SearchFilter>(); |
| | | excludeBranches = new ArrayList<>(); |
| | | includeBranches = new ArrayList<>(); |
| | | excludeFilters = new ArrayList<>(); |
| | | includeFilters = new ArrayList<>(); |
| | | compressData = false; |
| | | encryptData = false; |
| | | hashData = false; |
| | |
| | | signHash = false; |
| | | typesOnly = false; |
| | | writer = null; |
| | | excludeAttributes = new HashSet<AttributeType>(); |
| | | includeAttributes = new HashSet<AttributeType>(); |
| | | excludeAttributes = new HashSet<>(); |
| | | includeAttributes = new HashSet<>(); |
| | | wrapColumn = -1; |
| | | } |
| | | |
| | |
| | | { |
| | | if (excludeBranches == null) |
| | | { |
| | | this.excludeBranches = new ArrayList<DN>(0); |
| | | this.excludeBranches = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (includeBranches == null) |
| | | { |
| | | this.includeBranches = new ArrayList<DN>(0); |
| | | this.includeBranches = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (excludeAttributes == null) |
| | | { |
| | | this.excludeAttributes = new HashSet<AttributeType>(0); |
| | | this.excludeAttributes = new HashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (includeAttributes == null) |
| | | { |
| | | this.includeAttributes = new HashSet<AttributeType>(0); |
| | | this.includeAttributes = new HashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (excludeFilters == null) |
| | | { |
| | | this.excludeFilters = new ArrayList<SearchFilter>(0); |
| | | this.excludeFilters = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | if (includeFilters == null) |
| | | { |
| | | this.includeFilters = new ArrayList<SearchFilter>(0); |
| | | this.includeFilters = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | private Iterator<String> ldifFileIterator; |
| | | |
| | | /** The set of base DNs to exclude from the import. */ |
| | | private Set<DN> excludeBranches = new HashSet<DN>(0); |
| | | private Set<DN> excludeBranches = new HashSet<>(0); |
| | | /** The set of base DNs to include from the import. */ |
| | | private Set<DN> includeBranches = new HashSet<DN>(0); |
| | | private Set<DN> includeBranches = new HashSet<>(0); |
| | | |
| | | /** The set of search filters for entries to exclude from the import. */ |
| | | private List<SearchFilter> excludeFilters = new ArrayList<SearchFilter>(0); |
| | | private List<SearchFilter> excludeFilters = new ArrayList<>(0); |
| | | /** The set of search filters for entries to include in the import. */ |
| | | private List<SearchFilter> includeFilters = new ArrayList<SearchFilter>(0); |
| | | private List<SearchFilter> includeFilters = new ArrayList<>(0); |
| | | |
| | | /** The set of LDIF files to be imported. */ |
| | | private List<String> ldifFiles; |
| | | |
| | | /** The set of attribute types that should be excluded from the import. */ |
| | | private Set<AttributeType> excludeAttributes = new HashSet<AttributeType>(0); |
| | | private Set<AttributeType> excludeAttributes = new HashSet<>(0); |
| | | /** The set of attribute types that should be included in the import. */ |
| | | private Set<AttributeType> includeAttributes = new HashSet<AttributeType>(0); |
| | | private Set<AttributeType> includeAttributes = new HashSet<>(0); |
| | | |
| | | /** Indicates whether all the user attributes should be included. */ |
| | | private boolean includeAllUserAttrs; |
| | |
| | | */ |
| | | public LDIFImportConfig(String ldifFile) |
| | | { |
| | | ldifFiles = new ArrayList<String>(1); |
| | | ldifFiles = new ArrayList<>(1); |
| | | ldifFiles.add(ldifFile); |
| | | ldifFileIterator = ldifFiles.iterator(); |
| | | } |
| | |
| | | private final TimeUnit lockTimeoutUnits; |
| | | |
| | | // Avoid sub-classing in order to workaround class leaks in app servers. |
| | | private final ThreadLocal<LinkedList<DNLockHolder>> threadLocalCache = new ThreadLocal<LinkedList<DNLockHolder>>(); |
| | | private final ThreadLocal<LinkedList<DNLockHolder>> threadLocalCache = new ThreadLocal<>(); |
| | | |
| | | /** |
| | | * Creates a new lock manager with a lock timeout of 9 seconds and an automatically chosen number |
| | |
| | | this.lockTable = new LinkedList[this.numberOfBuckets]; |
| | | for (int i = 0; i < this.numberOfBuckets; i++) |
| | | { |
| | | this.lockTable[i] = new LinkedList<DNLockHolder>(); |
| | | this.lockTable[i] = new LinkedList<>(); |
| | | } |
| | | } |
| | | |
| | |
| | | LinkedList<DNLockHolder> cache = threadLocalCache.get(); |
| | | if (cache == null) |
| | | { |
| | | cache = new LinkedList<DNLockHolder>(); |
| | | cache = new LinkedList<>(); |
| | | threadLocalCache.set(cache); |
| | | } |
| | | return acquireLockFromCache0(dn, cache); |
| | |
| | | |
| | | if ((names == null) || names.isEmpty()) |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(0); |
| | | this.names = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(names); |
| | | this.names = new LinkedHashMap<>(names); |
| | | } |
| | | |
| | | if ((attributes == null) || attributes.isEmpty()) |
| | | { |
| | | this.attributes = new LinkedHashSet<AttributeType>(0); |
| | | this.attributes = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.attributes = new LinkedHashSet<AttributeType>(attributes); |
| | | this.attributes = new LinkedHashSet<>(attributes); |
| | | } |
| | | |
| | | if ((extraProperties == null) || extraProperties.isEmpty()) |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(0); |
| | | this.extraProperties = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(extraProperties); |
| | | this.extraProperties = new LinkedHashMap<>(extraProperties); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if ((names == null) || names.isEmpty()) |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(0); |
| | | this.names = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.names = new LinkedHashMap<String,String>(names); |
| | | this.names = new LinkedHashMap<>(names); |
| | | } |
| | | |
| | | if ((requiredAttributes == null) || requiredAttributes.isEmpty()) |
| | | { |
| | | this.requiredAttributes = new LinkedHashSet<AttributeType>(0); |
| | | this.requiredAttributes = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.requiredAttributes = |
| | | new LinkedHashSet<AttributeType>(requiredAttributes); |
| | | this.requiredAttributes = new LinkedHashSet<>(requiredAttributes); |
| | | } |
| | | |
| | | if ((optionalAttributes == null) || optionalAttributes.isEmpty()) |
| | | { |
| | | this.optionalAttributes = new LinkedHashSet<AttributeType>(0); |
| | | this.optionalAttributes = new LinkedHashSet<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.optionalAttributes = |
| | | new LinkedHashSet<AttributeType>(optionalAttributes); |
| | | this.optionalAttributes = new LinkedHashSet<>(optionalAttributes); |
| | | } |
| | | |
| | | if ((extraProperties == null) || extraProperties.isEmpty()) |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(0); |
| | | this.extraProperties = new LinkedHashMap<>(0); |
| | | } |
| | | else |
| | | { |
| | | this.extraProperties = |
| | | new LinkedHashMap<String,List<String>>(extraProperties); |
| | | this.extraProperties = new LinkedHashMap<>(extraProperties); |
| | | } |
| | | } |
| | | |
| | |
| | | if (this.superiorClasses.isEmpty()) { |
| | | this.requiredAttributesChain = this.requiredAttributes; |
| | | } else { |
| | | Set<AttributeType> tmp = new HashSet<AttributeType>( |
| | | this.requiredAttributes); |
| | | Set<AttributeType> tmp = new HashSet<>(this.requiredAttributes); |
| | | for(ObjectClass oc: this.superiorClasses) |
| | | { |
| | | tmp.addAll(oc.getRequiredAttributeChain()); |
| | |
| | | if (this.superiorClasses.isEmpty()) { |
| | | this.optionalAttributesChain = this.optionalAttributes; |
| | | } else { |
| | | Set<AttributeType> tmp = new HashSet<AttributeType>( |
| | | this.optionalAttributes); |
| | | Set<AttributeType> tmp = new HashSet<>(this.optionalAttributes); |
| | | for(ObjectClass oc : this.superiorClasses) |
| | | { |
| | | tmp.addAll(oc.getOptionalAttributeChain()); |
| | |
| | | this.optionalAttributesChain = Collections.unmodifiableSet(tmp); |
| | | } |
| | | |
| | | // Construct unmodifiable views of the required and optional |
| | | // attribute chains. |
| | | HashSet<AttributeType> reqAndOptSet = |
| | | new HashSet<AttributeType>(requiredAttributesChain.size() + |
| | | optionalAttributesChain.size()); |
| | | // Construct unmodifiable views of the required and optional attribute chains. |
| | | int size = requiredAttributesChain.size() + optionalAttributesChain.size(); |
| | | HashSet<AttributeType> reqAndOptSet = new HashSet<>(size); |
| | | reqAndOptSet.addAll(requiredAttributesChain); |
| | | reqAndOptSet.addAll(optionalAttributesChain); |
| | | requiredAndOptionalChain = |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | CHANGELOG_READ("changelog-read"); |
| | | |
| | | |
| | | |
| | | /** |
| | | * A map that will be used to hold a mapping between privilege names |
| | | * and enum values. |
| | | */ |
| | | private static final Map<String, Privilege> PRIV_MAP = |
| | | new HashMap<String,Privilege>(); |
| | | |
| | | |
| | | /** A map that will be used to hold a mapping between privilege names and enum values. */ |
| | | private static final Map<String, Privilege> PRIV_MAP = new HashMap<>(); |
| | | |
| | | /** |
| | | * The set of privileges that will be automatically assigned to root |
| | | * users if the root privilege set is not specified in the |
| | | * configuration. |
| | | * users if the root privilege set is not specified in the configuration. |
| | | */ |
| | | private static final Set<Privilege> DEFAULT_ROOT_PRIV_SET = |
| | | new HashSet<Privilege>(); |
| | | private static final Set<Privilege> DEFAULT_ROOT_PRIV_SET = new HashSet<>(); |
| | | |
| | | |
| | | /** The human-readable name for this privilege. */ |
| | |
| | | else |
| | | { |
| | | // Normalization sorts RDNs alphabetically |
| | | SortedSet<String> avaStrings = new TreeSet<String>(); |
| | | SortedSet<String> avaStrings = new TreeSet<>(); |
| | | for (int i=0; i < attributeNames.length; i++) |
| | | { |
| | | StringBuilder builder = new StringBuilder(); |
| | |
| | | else |
| | | { |
| | | // Normalization sorts RDNs |
| | | SortedSet<ByteString> avaStrings = new TreeSet<ByteString>(); |
| | | SortedSet<ByteString> avaStrings = new TreeSet<>(); |
| | | for (int i = 0; i < attributeNames.length; i++) |
| | | { |
| | | ByteStringBuilder b = new ByteStringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | | values = new ArrayList<ByteString>(); |
| | | values = new ArrayList<>(); |
| | | while(reader.hasNextElement()) |
| | | { |
| | | values.add(reader.readOctetString()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | filterType = null; |
| | | } |
| | | |
| | | ArrayList<RawFilter> filterComponents = |
| | | new ArrayList<RawFilter>(); |
| | | ArrayList<RawFilter> filterComponents = new ArrayList<>(); |
| | | try |
| | | { |
| | | reader.readStartSequence(); |
| | |
| | | { |
| | | if(subAnyElements == null) |
| | | { |
| | | subAnyElements = new ArrayList<ByteString>(); |
| | | subAnyElements = new ArrayList<>(); |
| | | } |
| | | subAnyElements.add(reader.readOctetString()); |
| | | } |
| | |
| | | * <p> |
| | | * ex : Replication uses this to store its state and GenerationID. |
| | | */ |
| | | private Map<String, Attribute> extraAttributes = |
| | | new HashMap<String, Attribute>(); |
| | | private Map<String, Attribute> extraAttributes = new HashMap<>(); |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new schema structure with all elements initialized but |
| | | * empty. |
| | | */ |
| | | /** Creates a new schema structure with all elements initialized but empty. */ |
| | | public Schema() |
| | | { |
| | | attributeTypes = new ConcurrentHashMap<String,AttributeType>(); |
| | | objectClasses = new ConcurrentHashMap<String,ObjectClass>(); |
| | | syntaxes = new ConcurrentHashMap<String,Syntax>(); |
| | | matchingRules = new ConcurrentHashMap<String,MatchingRule>(); |
| | | matchingRuleUses = |
| | | new ConcurrentHashMap<MatchingRule,MatchingRuleUse>(); |
| | | ditContentRules = |
| | | new ConcurrentHashMap<ObjectClass,DITContentRule>(); |
| | | ditStructureRulesByID = |
| | | new ConcurrentHashMap<Integer,DITStructureRule>(); |
| | | ditStructureRulesByNameForm = |
| | | new ConcurrentHashMap<NameForm,DITStructureRule>(); |
| | | nameFormsByOC = |
| | | new ConcurrentHashMap<ObjectClass,List<NameForm>>(); |
| | | nameFormsByName = new ConcurrentHashMap<String,NameForm>(); |
| | | ldapSyntaxDescriptions = |
| | | new ConcurrentHashMap<String,LDAPSyntaxDescription>(); |
| | | subordinateTypes = |
| | | new ConcurrentHashMap<AttributeType,List<AttributeType>>(); |
| | | attributeTypes = new ConcurrentHashMap<>(); |
| | | objectClasses = new ConcurrentHashMap<>(); |
| | | syntaxes = new ConcurrentHashMap<>(); |
| | | matchingRules = new ConcurrentHashMap<>(); |
| | | matchingRuleUses = new ConcurrentHashMap<>(); |
| | | ditContentRules = new ConcurrentHashMap<>(); |
| | | ditStructureRulesByID = new ConcurrentHashMap<>(); |
| | | ditStructureRulesByNameForm = new ConcurrentHashMap<>(); |
| | | nameFormsByOC = new ConcurrentHashMap<>(); |
| | | nameFormsByName = new ConcurrentHashMap<>(); |
| | | ldapSyntaxDescriptions = new ConcurrentHashMap<>(); |
| | | subordinateTypes = new ConcurrentHashMap<>(); |
| | | |
| | | oldestModificationTime = System.currentTimeMillis(); |
| | | youngestModificationTime = oldestModificationTime; |
| | |
| | | if (subTypes == null) |
| | | { |
| | | superiorType.setMayHaveSubordinateTypes(); |
| | | subTypes = new LinkedList<AttributeType>(); |
| | | subTypes = new LinkedList<>(); |
| | | subTypes.add(attributeType); |
| | | subordinateTypes.put(superiorType, subTypes); |
| | | } |
| | |
| | | |
| | | if(mappedForms == null) |
| | | { |
| | | mappedForms = new ArrayList<NameForm>(); |
| | | mappedForms = new ArrayList<>(); |
| | | } |
| | | |
| | | mappedForms.add(nameForm); |
| | |
| | | dupSchema.youngestModificationTime = youngestModificationTime; |
| | | if (extraAttributes != null) |
| | | { |
| | | dupSchema.extraAttributes = |
| | | new HashMap<String, Attribute>(extraAttributes); |
| | | dupSchema.extraAttributes = new HashMap<>(extraAttributes); |
| | | } |
| | | |
| | | return dupSchema; |
| | |
| | | String concatFilePath = null; |
| | | try |
| | | { |
| | | Set<String> attributeTypes = new LinkedHashSet<String>(); |
| | | Set<String> objectClasses = new LinkedHashSet<String>(); |
| | | Set<String> nameForms = new LinkedHashSet<String>(); |
| | | Set<String> ditContentRules = new LinkedHashSet<String>(); |
| | | Set<String> ditStructureRules = new LinkedHashSet<String>(); |
| | | Set<String> matchingRuleUses = new LinkedHashSet<String>(); |
| | | Set<String> ldapSyntaxes = new LinkedHashSet<String>(); |
| | | Set<String> attributeTypes = new LinkedHashSet<>(); |
| | | Set<String> objectClasses = new LinkedHashSet<>(); |
| | | Set<String> nameForms = new LinkedHashSet<>(); |
| | | Set<String> ditContentRules = new LinkedHashSet<>(); |
| | | Set<String> ditStructureRules = new LinkedHashSet<>(); |
| | | Set<String> matchingRuleUses = new LinkedHashSet<>(); |
| | | Set<String> ldapSyntaxes = new LinkedHashSet<>(); |
| | | genConcatenatedSchema(attributeTypes, objectClasses, nameForms, |
| | | ditContentRules, ditStructureRules, |
| | | matchingRuleUses,ldapSyntaxes); |
| | |
| | | throws IOException |
| | | { |
| | | // Get a sorted list of the files in the schema directory. |
| | | TreeSet<File> schemaFiles = new TreeSet<File>(); |
| | | TreeSet<File> schemaFiles = new TreeSet<>(); |
| | | String schemaDirectory = |
| | | SchemaConfigManager.getSchemaDirectoryPath(); |
| | | |
| | |
| | | { |
| | | // Read the contents of the file into a list with one schema |
| | | // element per list element. |
| | | LinkedList<StringBuilder> lines = |
| | | new LinkedList<StringBuilder>(); |
| | | BufferedReader reader = |
| | | new BufferedReader(new FileReader(f)); |
| | | LinkedList<StringBuilder> lines = new LinkedList<>(); |
| | | BufferedReader reader = new BufferedReader(new FileReader(f)); |
| | | |
| | | while (true) |
| | | { |
| | |
| | | // This used to happen in getSubAnyElements, but we do it here |
| | | // so that we can make this.subAnyElements final. |
| | | if (subAnyElements == null) { |
| | | subAnyElements = new ArrayList<ByteString>(0); |
| | | subAnyElements = new ArrayList<>(0); |
| | | } |
| | | |
| | | // This used to happen in getFilterComponents, but we do it here |
| | |
| | | } |
| | | |
| | | this.filterType = filterType; |
| | | this.filterComponents = |
| | | new LinkedHashSet<SearchFilter>(filterComponents); |
| | | this.filterComponents = new LinkedHashSet<>(filterComponents); |
| | | this.notComponent = notComponent; |
| | | this.attributeType = attributeType; |
| | | this.attributeOptions = attributeOptions; |
| | |
| | | // the attribute type (with or without options). Decode it. |
| | | String attrType = filterString.substring(startPos, attrEndPos); |
| | | StringBuilder lowerType = new StringBuilder(attrType.length()); |
| | | Set<String> attributeOptions = new HashSet<String>(); |
| | | Set<String> attributeOptions = new HashSet<>(); |
| | | |
| | | int semicolonPos = attrType.indexOf(';'); |
| | | if (semicolonPos < 0) |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Create a list to hold the returned components. |
| | | List<SearchFilter> filterComponents = |
| | | new ArrayList<SearchFilter>(); |
| | | List<SearchFilter> filterComponents = new ArrayList<>(); |
| | | |
| | | |
| | | // If the end pos is equal to the start pos, then there are no |
| | | // components. |
| | | // If the end pos is equal to the start pos, then there are no components. |
| | | if (startPos == endPos) |
| | | { |
| | | if (filterType == FilterType.NOT) |
| | | { |
| | | LocalizableMessage message = ERR_SEARCH_FILTER_NOT_EXACTLY_ONE.get( |
| | | filterString, startPos, endPos); |
| | | throw new DirectoryException(ResultCode.PROTOCOL_ERROR, |
| | | message); |
| | | throw new DirectoryException(ResultCode.PROTOCOL_ERROR, message); |
| | | } |
| | | else |
| | | { |
| | |
| | | // check to see if there are any escaped values, since they will |
| | | // need special treatment. |
| | | boolean hasEscape = false; |
| | | LinkedList<Integer> asteriskPositions = new LinkedList<Integer>(); |
| | | LinkedList<Integer> asteriskPositions = new LinkedList<>(); |
| | | for (int i=0; i < valueBytes.length; i++) |
| | | { |
| | | if (valueBytes[i] == 0x2A) // The asterisk. |
| | |
| | | } |
| | | |
| | | |
| | | // Next, process through the rest of the asterisks to get the |
| | | // subAny values. |
| | | List<ByteString> subAny = new ArrayList<ByteString>(); |
| | | // Next, process through the rest of the asterisks to get the subAny values. |
| | | List<ByteString> subAny = new ArrayList<>(); |
| | | for (int asteriskPos : asteriskPositions) |
| | | { |
| | | int length = asteriskPos - firstPos - 1; |
| | |
| | | throws DirectoryException |
| | | { |
| | | AttributeType attributeType = null; |
| | | Set<String> attributeOptions = new HashSet<String>(); |
| | | Set<String> attributeOptions = new HashSet<>(); |
| | | boolean dnAttributes = false; |
| | | String matchingRuleID = null; |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | HashSet<String> lowerOptions = |
| | | new HashSet<String>(options1.size()); |
| | | HashSet<String> lowerOptions = new HashSet<>(options1.size()); |
| | | for (String option : options1) |
| | | { |
| | | lowerOptions.add(toLowerCase(option)); |
| | |
| | | entry.getOperationalAttributes()); |
| | | |
| | | |
| | | this.controls = new ArrayList<Control>(0); |
| | | this.controls = new ArrayList<>(0); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (controls == null) |
| | | { |
| | | this.controls = new ArrayList<Control>(0); |
| | | this.controls = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | */ |
| | | public SearchResultReference(String referralURL) |
| | | { |
| | | referralURLs = new ArrayList<String>(1); |
| | | referralURLs = new ArrayList<>(1); |
| | | referralURLs.add(referralURL); |
| | | |
| | | this.controls = new ArrayList<Control>(0); |
| | | this.controls = new ArrayList<>(0); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (referralURLs == null) |
| | | { |
| | | this.referralURLs = new ArrayList<String>(); |
| | | this.referralURLs = new ArrayList<>(); |
| | | } |
| | | else |
| | | { |
| | | this.referralURLs = referralURLs; |
| | | } |
| | | |
| | | this.controls = new ArrayList<Control>(0); |
| | | this.controls = new ArrayList<>(0); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (referralURLs == null) |
| | | { |
| | | this.referralURLs = new ArrayList<String>(); |
| | | this.referralURLs = new ArrayList<>(); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (controls == null) |
| | | { |
| | | this.controls = new ArrayList<Control>(0); |
| | | this.controls = new ArrayList<>(0); |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2014 ForgeRock AS |
| | | * Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | /** |
| | | * A small map of values. This map implementation is optimized to use as little |
| | | * memory as possible in the case where there zero or one elements. In addition, |
| | | * any normalization of entriess is delayed until the second entry is added |
| | | * any normalization of entries is delayed until the second entry is added |
| | | * (normalization may be triggered by invoking {@link Object#hashCode()} or |
| | | * {@link Object#equals(Object)}. |
| | | * <p> |
| | |
| | | return oldValue; |
| | | } |
| | | // overflow to the underlying map |
| | | entries = new LinkedHashMap<K, V>(2); |
| | | entries = new LinkedHashMap<>(2); |
| | | entries.put(firstKey, firstValue); |
| | | firstKey = null; |
| | | firstValue = null; |
| | |
| | | throw new NoSuchElementException(); |
| | | } |
| | | isFirst = false; |
| | | return new SimpleEntry<K, V>(firstKey, firstValue); |
| | | return new SimpleEntry<>(firstKey, firstValue); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | // Process collective attributes. |
| | | this.collectiveAttributes = new ArrayList<Attribute>(); |
| | | this.collectiveAttributes = new ArrayList<>(); |
| | | if (this.isCollective) |
| | | { |
| | | List<Attribute> subAttrList = entry.getAttributes(); |
| | |
| | | } |
| | | else if (subAttr.hasOption(ATTR_OPTION_COLLECTIVE)) |
| | | { |
| | | AttributeBuilder builder = new AttributeBuilder( |
| | | subAttr.getAttributeType()); |
| | | AttributeBuilder builder = new AttributeBuilder(subAttr.getAttributeType()); |
| | | builder.addAll(subAttr); |
| | | Set<String> options = new LinkedHashSet<String>( |
| | | subAttr.getOptions()); |
| | | Set<String> options = new LinkedHashSet<>(subAttr.getOptions()); |
| | | options.remove(ATTR_OPTION_COLLECTIVE); |
| | | builder.setOptions(options); |
| | | Attribute attr = builder.toAttribute(); |
| | | CollectiveVirtualAttribute collectiveAttr = |
| | | new CollectiveVirtualAttribute(attr); |
| | | CollectiveVirtualAttribute collectiveAttr = new CollectiveVirtualAttribute(attr); |
| | | this.collectiveAttributes.add(collectiveAttr); |
| | | } |
| | | } |
| | |
| | | int minimum = -1; |
| | | int maximum = -1; |
| | | |
| | | final HashSet<DN> chopBefore = new HashSet<DN>(); |
| | | final HashSet<DN> chopAfter = new HashSet<DN>(); |
| | | final HashSet<DN> chopBefore = new HashSet<>(); |
| | | final HashSet<DN> chopAfter = new HashSet<>(); |
| | | |
| | | Refinement refinement = null; |
| | | |
| | |
| | | { |
| | | if (parser.hasNextRightBrace()) |
| | | { |
| | | // Make sure that there is a closing brace and no trailing |
| | | // text. |
| | | // Make sure that there is a closing brace and no trailing text. |
| | | parser.skipRightBrace(); |
| | | |
| | | if (parser.hasNext()) |
| | |
| | | final Parser parser) throws InputMismatchException, |
| | | NoSuchElementException |
| | | { |
| | | final ArrayList<Refinement> refinements = |
| | | new ArrayList<Refinement>(); |
| | | final ArrayList<Refinement> refinements = new ArrayList<>(); |
| | | |
| | | // Skip leading open-brace. |
| | | parser.skipLeftBrace(); |
| | |
| | | if (chopBefore != null && chopBefore.iterator().hasNext()) |
| | | { |
| | | // Calculate the absolute DNs. |
| | | final TreeMap<DN, DN> map = new TreeMap<DN, DN>(); |
| | | final TreeMap<DN, DN> map = new TreeMap<>(); |
| | | for (final DN localName : chopBefore) |
| | | { |
| | | map.put(baseDN.child(localName), localName); |
| | |
| | | if (chopAfter != null && chopAfter.iterator().hasNext()) |
| | | { |
| | | // Calculate the absolute DNs. |
| | | final TreeMap<DN, DN> map = new TreeMap<DN, DN>(); |
| | | final TreeMap<DN, DN> map = new TreeMap<>(); |
| | | for (final DN localName : chopAfter) |
| | | { |
| | | map.put(baseDN.child(localName), localName); |
| | |
| | | ifNull(attributes); |
| | | |
| | | |
| | | this.attributes = new ArrayList<Attribute>(attributes.size()); |
| | | this.attributes = new ArrayList<>(attributes.size()); |
| | | for (List<Attribute> list : attributes.values()) |
| | | { |
| | | this.attributes.addAll(list); |
| | |
| | | { |
| | | backupID = backupConfig.getBackupID(); |
| | | backupDir = backupConfig.getBackupDirectory(); |
| | | backupProperties = new HashMap<String,String>(); |
| | | backupProperties = new HashMap<>(); |
| | | shouldCompress = backupConfig.compressData(); |
| | | |
| | | incrementalBaseID = retrieveIncrementalBaseID(backupConfig); |
| | |
| | | this.backendID = backendID; |
| | | this.newBackupParams = backupParams; |
| | | this.cryptoEngine = crypt; |
| | | dependencies = new HashSet<String>(); |
| | | dependencies = new HashSet<>(); |
| | | if (backupParams.isIncremental) |
| | | { |
| | | HashMap<String,String> properties = backupParams.baseBackupInfo.getBackupProperties(); |
| | |
| | | */ |
| | | List<BackupInfo> getBackupDependencies() throws DirectoryException |
| | | { |
| | | List<BackupInfo> dependencies = new ArrayList<BackupInfo>(); |
| | | List<BackupInfo> dependencies = new ArrayList<>(); |
| | | BackupInfo currentBackupInfo = backupInfo; |
| | | while (currentBackupInfo != null && !currentBackupInfo.getDependencies().isEmpty()) |
| | | { |
| | |
| | | void writeUnchangedFiles(Path rootDirectory, ListIterator<Path> files, BackupConfig backupConfig) |
| | | throws DirectoryException |
| | | { |
| | | List<String> unchangedFilenames = new ArrayList<String>(); |
| | | List<String> unchangedFilenames = new ArrayList<>(); |
| | | while (files.hasNext() && !backupConfig.isCancelled()) |
| | | { |
| | | Path file = files.next(); |
| | |
| | | */ |
| | | Set<String> readUnchangedDependentFiles() throws DirectoryException |
| | | { |
| | | Set<String> hashSet = new HashSet<String>(); |
| | | Set<String> hashSet = new HashSet<>(); |
| | | ZipInputStream zipStream = null; |
| | | try |
| | | { |
| | |
| | | |
| | | private List<String> readAllLines(ZipInputStream zipStream) throws IOException |
| | | { |
| | | final ArrayList<String> results = new ArrayList<String>(); |
| | | final ArrayList<String> results = new ArrayList<>(); |
| | | String line; |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(zipStream)); |
| | | while ((line = reader.readLine()) != null) |
| | |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | encodeSubCommand.addArgument(toEncodedFile); |
| | | |
| | | |
| | | ArrayList<SubCommand> subCommandList = new ArrayList<SubCommand>(2); |
| | | ArrayList<SubCommand> subCommandList = new ArrayList<>(2); |
| | | subCommandList.add(decodeSubCommand); |
| | | subCommandList.add(encodeSubCommand); |
| | | |
| | |
| | | aliasEnumeration = keyStore.aliases(); |
| | | if (aliasEnumeration == null) |
| | | return new String[0]; |
| | | ArrayList<String> aliasList = new ArrayList<String>(); |
| | | ArrayList<String> aliasList = new ArrayList<>(); |
| | | while (aliasEnumeration.hasMoreElements()) |
| | | aliasList.add(aliasEnumeration.nextElement()); |
| | | String[] aliases = new String[aliasList.size()]; |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2014 ForgeRock AS |
| | | * Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.util; |
| | | |
| | |
| | | */ |
| | | public static <E> ArrayList<E> newArrayList(E... elements) |
| | | { |
| | | return new ArrayList<E>(Arrays.asList(elements)); |
| | | return new ArrayList<>(Arrays.asList(elements)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static <E> LinkedList<E> newLinkedList(E... elements) |
| | | { |
| | | return new LinkedList<E>(Arrays.asList(elements)); |
| | | return new LinkedList<>(Arrays.asList(elements)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static <E> HashSet<E> newHashSet(E... elements) |
| | | { |
| | | return new HashSet<E>(Arrays.asList(elements)); |
| | | return new HashSet<>(Arrays.asList(elements)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static <E> LinkedHashSet<E> newLinkedHashSet(E... elements) |
| | | { |
| | | return new LinkedHashSet<E>(Arrays.asList(elements)); |
| | | return new LinkedHashSet<>(Arrays.asList(elements)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static <E> TreeSet<E> newTreeSet(E... elements) |
| | | { |
| | | return new TreeSet<E>(Arrays.asList(elements)); |
| | | return new TreeSet<>(Arrays.asList(elements)); |
| | | } |
| | | } |
| | |
| | | this.sender = sender; |
| | | this.subject = subject; |
| | | |
| | | recipients = new ArrayList<String>(); |
| | | recipients = new ArrayList<>(); |
| | | recipients.add(recipient); |
| | | |
| | | body = new LocalizableMessageBuilder(); |
| | | attachments = new LinkedList<MimeBodyPart>(); |
| | | attachments = new LinkedList<>(); |
| | | bodyMIMEType = "text/plain"; |
| | | } |
| | | |
| | |
| | | this.subject = subject; |
| | | |
| | | body = new LocalizableMessageBuilder(); |
| | | attachments = new LinkedList<MimeBodyPart>(); |
| | | attachments = new LinkedList<>(); |
| | | bodyMIMEType = "text/plain"; |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | LinkedList<Properties> mailServerProperties = new LinkedList<Properties>(); |
| | | LinkedList<Properties> mailServerProperties = new LinkedList<>(); |
| | | for (String s : host.getValues()) |
| | | { |
| | | Properties p = new Properties(); |
| | |
| | | this.importConfig = importConfig; |
| | | |
| | | reader = importConfig.getReader(); |
| | | lastEntryBodyLines = new LinkedList<StringBuilder>(); |
| | | lastEntryHeaderLines = new LinkedList<StringBuilder>(); |
| | | lastEntryBodyLines = new LinkedList<>(); |
| | | lastEntryHeaderLines = new LinkedList<>(); |
| | | pluginConfigManager = DirectoryServer.getPluginConfigManager(); |
| | | // If we should invoke import plugins, then do so. |
| | | if (importConfig.invokeImportPlugins()) |
| | |
| | | return null; |
| | | } |
| | | lastEntryBodyLines = lines; |
| | | lastEntryHeaderLines = new LinkedList<StringBuilder>(); |
| | | lastEntryHeaderLines = new LinkedList<>(); |
| | | |
| | | |
| | | // Read the DN of the entry and see if it is one that should be included |
| | |
| | | |
| | | private Entry createEntry(DN entryDN, List<StringBuilder> lines, boolean checkSchema) throws LDIFException |
| | | { |
| | | Map<ObjectClass, String> objectClasses = new HashMap<ObjectClass, String>(); |
| | | Map<AttributeType, List<AttributeBuilder>> userAttrBuilders = new HashMap<AttributeType, List<AttributeBuilder>>(); |
| | | Map<AttributeType, List<AttributeBuilder>> operationalAttrBuilders = |
| | | new HashMap<AttributeType, List<AttributeBuilder>>(); |
| | | Map<ObjectClass, String> objectClasses = new HashMap<>(); |
| | | Map<AttributeType, List<AttributeBuilder>> userAttrBuilders = new HashMap<>(); |
| | | Map<AttributeType, List<AttributeBuilder>> operationalAttrBuilders = new HashMap<>(); |
| | | for (StringBuilder line : lines) |
| | | { |
| | | readAttribute(lines, line, entryDN, objectClasses, userAttrBuilders, operationalAttrBuilders, checkSchema); |
| | |
| | | */ |
| | | protected Map<AttributeType, List<Attribute>> toAttributesMap(Map<AttributeType, List<AttributeBuilder>> attrBuilders) |
| | | { |
| | | Map<AttributeType, List<Attribute>> attributes = new HashMap<AttributeType, List<Attribute>>(attrBuilders.size()); |
| | | Map<AttributeType, List<Attribute>> attributes = new HashMap<>(attrBuilders.size()); |
| | | for (Map.Entry<AttributeType, List<AttributeBuilder>> attrTypeEntry : attrBuilders.entrySet()) |
| | | { |
| | | AttributeType attrType = attrTypeEntry.getKey(); |
| | |
| | | */ |
| | | protected List<Attribute> toAttributesList(List<AttributeBuilder> builders) |
| | | { |
| | | List<Attribute> results = new ArrayList<Attribute>(builders.size()); |
| | | List<Attribute> results = new ArrayList<>(builders.size()); |
| | | for (AttributeBuilder builder : builders) |
| | | { |
| | | results.add(builder.toAttribute()); |
| | |
| | | protected LinkedList<StringBuilder> readEntryLines() throws IOException, LDIFException |
| | | { |
| | | // Read the entry lines into a buffer. |
| | | LinkedList<StringBuilder> lines = new LinkedList<StringBuilder>(); |
| | | LinkedList<StringBuilder> lines = new LinkedList<>(); |
| | | int lastLine = -1; |
| | | |
| | | if(reader == null) |
| | |
| | | { |
| | | AttributeBuilder builder = new AttributeBuilder(attribute, true); |
| | | builder.add(attributeValue); |
| | | attrList = new ArrayList<AttributeBuilder>(); |
| | | attrList = new ArrayList<>(); |
| | | attrList.add(builder); |
| | | attrBuilders.put(attrType, attrList); |
| | | return; |
| | |
| | | private ChangeRecordEntry parseModifyChangeRecordEntry(DN entryDN, |
| | | LinkedList<StringBuilder> lines) throws LDIFException { |
| | | |
| | | List<RawModification> modifications = new ArrayList<RawModification>(); |
| | | List<RawModification> modifications = new ArrayList<>(); |
| | | while(!lines.isEmpty()) |
| | | { |
| | | StringBuilder line = lines.remove(); |
| | |
| | | private ChangeRecordEntry parseAddChangeRecordEntry(DN entryDN, |
| | | List<StringBuilder> lines) throws LDIFException |
| | | { |
| | | Map<ObjectClass, String> objectClasses = new HashMap<ObjectClass, String>(); |
| | | Map<AttributeType, List<AttributeBuilder>> attrBuilders = |
| | | new HashMap<AttributeType, List<AttributeBuilder>>(); |
| | | Map<ObjectClass, String> objectClasses = new HashMap<>(); |
| | | Map<AttributeType, List<AttributeBuilder>> attrBuilders = new HashMap<>(); |
| | | for(StringBuilder line : lines) |
| | | { |
| | | readAttribute(lines, line, entryDN, objectClasses, |
| | |
| | | toAttributesMap(attrBuilders); |
| | | if (attributes.get(ocType) == null) |
| | | { |
| | | List<Attribute> ocAttrList = new ArrayList<Attribute>(1); |
| | | List<Attribute> ocAttrList = new ArrayList<>(1); |
| | | ocAttrList.add(builder.toAttribute()); |
| | | attributes.put(ocType, ocAttrList); |
| | | } |
| | |
| | | List<Attribute> attrList = attributes.get(t); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new ArrayList<Attribute>(); |
| | | attrList = new ArrayList<>(); |
| | | attrList.add(Attributes.create(t, n, v)); |
| | | attributes.put(t, attrList); |
| | | } |
| | |
| | | |
| | | ifNull(modifications); |
| | | |
| | | this.modifications = new ArrayList<RawModification>(modifications); |
| | | this.modifications = new ArrayList<>(modifications); |
| | | } |
| | | |
| | | |
| | |
| | | public static File createTemplateFile(String baseDN, int numEntries) |
| | | throws IOException |
| | | { |
| | | Set<String> baseDNs = new HashSet<String>(1); |
| | | Set<String> baseDNs = new HashSet<>(1); |
| | | baseDNs.add(baseDN); |
| | | return createTemplateFile(baseDNs, numEntries); |
| | | } |
| | |
| | | File templateFile = File.createTempFile("opendj-install", ".template"); |
| | | templateFile.deleteOnExit(); |
| | | |
| | | LinkedList<String> lines = new LinkedList<String>(); |
| | | LinkedList<String> lines = new LinkedList<>(); |
| | | int i = 0; |
| | | for (String baseDN : baseDNs) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | ArrayList<String> commandAndArgs = new ArrayList<String>(); |
| | | ArrayList<String> commandAndArgs = new ArrayList<>(); |
| | | commandAndArgs.add(command); |
| | | if ((args != null) && (args.length > 0)) |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | ArrayList<String> stringList = new ArrayList<String>(stringArray.length); |
| | | ArrayList<String> stringList = new ArrayList<>(stringArray.length); |
| | | for (String s : stringArray) |
| | | { |
| | | stringList.add(s); |
| | |
| | | ObjectClass structuralClass = DirectoryServer.getObjectClass(getObjectClassName(rdn, numAVAs)); |
| | | |
| | | // Get the top and untypedObject classes to include in the entry. |
| | | LinkedHashMap<ObjectClass,String> objectClasses = |
| | | new LinkedHashMap<ObjectClass,String>(3); |
| | | LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(3); |
| | | |
| | | objectClasses.put(DirectoryServer.getTopObjectClass(), OC_TOP); |
| | | objectClasses.put(structuralClass, structuralClass.getNameOrOID()); |
| | |
| | | |
| | | // Iterate through the RDN attributes and add them to the set of user or |
| | | // operational attributes. |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttributes = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> operationalAttributes = |
| | | new LinkedHashMap<AttributeType,List<Attribute>>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttributes = new LinkedHashMap<>(); |
| | | LinkedHashMap<AttributeType,List<Attribute>> operationalAttributes = new LinkedHashMap<>(); |
| | | |
| | | boolean extensibleObjectAdded = false; |
| | | for (int i=0; i < numAVAs; i++) |
| | |
| | | { |
| | | AttributeBuilder builder = new AttributeBuilder(attrType, attrName); |
| | | builder.add(attrValue); |
| | | attrList = new ArrayList<Attribute>(1); |
| | | attrList = new ArrayList<>(1); |
| | | attrList.add(builder.toAttribute()); |
| | | attrs.put(attrType, attrList); |
| | | } |
| | |
| | | { |
| | | if (additionalClasses == null) |
| | | { |
| | | additionalClasses = new HashSet<ObjectClass>(); |
| | | additionalClasses = new HashSet<>(); |
| | | } |
| | | |
| | | additionalClasses.add(superiorClass); |
| | |
| | | */ |
| | | public TimeInfo() |
| | | { |
| | | userDefinedFormatters = |
| | | new CopyOnWriteArrayList<SimpleDateFormat>(); |
| | | userDefinedTimeStrings = new ConcurrentHashMap<String, String>(); |
| | | userDefinedFormatters = new CopyOnWriteArrayList<>(); |
| | | userDefinedTimeStrings = new ConcurrentHashMap<>(); |
| | | |
| | | TimeZone utcTimeZone = TimeZone.getTimeZone("UTC"); |
| | | |
| | |
| | | } |
| | | |
| | | private int id; |
| | | private Set<Effect> effects = new HashSet<Effect>(); |
| | | private Set<Effect> effects = new HashSet<>(); |
| | | private LocalizableMessage upgradeMsg; |
| | | private LocalizableMessage reversionMsg; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * Container for registered issues. |
| | | */ |
| | | private static final Set<VersionCompatibilityIssue> |
| | | VERSION_COMPATIBILITY_ISSUES = |
| | | new HashSet<VersionCompatibilityIssue>(); |
| | | /** Container for registered issues. */ |
| | | private static final Set<VersionCompatibilityIssue> VERSION_COMPATIBILITY_ISSUES = new HashSet<>(); |
| | | |
| | | //*************************************************** |
| | | // |
| | |
| | | * they appear |
| | | */ |
| | | public static List<VersionCompatibilityIssue> getAllEvents() { |
| | | List<VersionCompatibilityIssue> issueList = |
| | | new ArrayList<VersionCompatibilityIssue> |
| | | (VERSION_COMPATIBILITY_ISSUES); |
| | | List<VersionCompatibilityIssue> issueList = new ArrayList<>(VERSION_COMPATIBILITY_ISSUES); |
| | | Collections.sort(issueList, VERSION_COMPARATOR); |
| | | return Collections.unmodifiableList(issueList); |
| | | } |
| | |
| | | BuildInformation neu) |
| | | { |
| | | if (excludeIds == null) excludeIds = Collections.emptySet(); |
| | | List<VersionCompatibilityIssue> issueList = |
| | | new ArrayList<VersionCompatibilityIssue>(); |
| | | List<VersionCompatibilityIssue> issueList = new ArrayList<>(); |
| | | for (VersionCompatibilityIssue evt : VERSION_COMPATIBILITY_ISSUES) { |
| | | if (!excludeIds.contains(evt.getCause().getId())) { |
| | | BuildVersion currentVersion = new BuildVersion( |
| | |
| | | * @return List or IncompatibleVersionEvent objects |
| | | */ |
| | | public static List<VersionCompatibilityIssue> getEvents(BuildVersion from) { |
| | | List<VersionCompatibilityIssue> issueList = |
| | | new ArrayList<VersionCompatibilityIssue>(); |
| | | List<VersionCompatibilityIssue> issueList = new ArrayList<>(); |
| | | for (VersionCompatibilityIssue evt : VERSION_COMPATIBILITY_ISSUES) { |
| | | BuildVersion evtVer = evt.getVersion(); |
| | | if (evtVer.compareTo(from) >= 0) { |
| | |
| | | { |
| | | checkHeadingDisplayed(); |
| | | |
| | | MenuBuilder<Integer> builder = new MenuBuilder<Integer>(app); |
| | | MenuBuilder<Integer> builder = new MenuBuilder<>(app); |
| | | builder.setPrompt(INFO_LDAP_CONN_PROMPT_SECURITY_USE_SECURE_CTX.get()); |
| | | |
| | | Protocols defaultProtocol; |
| | |
| | | checkHeadingDisplayed(); |
| | | |
| | | app.println(); |
| | | MenuBuilder<Integer> builder = new MenuBuilder<Integer>(app); |
| | | MenuBuilder<Integer> builder = new MenuBuilder<>(app); |
| | | builder.setPrompt(INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_METHOD.get()); |
| | | |
| | | TrustMethod defaultTrustMethod = TrustMethod.DISPLAY_CERTIFICATE; |
| | |
| | | |
| | | try |
| | | { |
| | | MenuBuilder<String> builder = new MenuBuilder<String>(app); |
| | | MenuBuilder<String> builder = new MenuBuilder<>(app); |
| | | builder.setPrompt(INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_ALIASES.get()); |
| | | int certificateNumber = 0; |
| | | for (; aliasesEnum.hasMoreElements();) |
| | |
| | | app.println(); |
| | | } |
| | | } |
| | | MenuBuilder<Integer> builder = new MenuBuilder<Integer>(app); |
| | | MenuBuilder<Integer> builder = new MenuBuilder<>(app); |
| | | builder.setPrompt(INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION.get()); |
| | | |
| | | TrustOption defaultTrustMethod = TrustOption.SESSION; |
| | |
| | | if (isSynchronizationOperation() || |
| | | DirectoryServer.addMissingRDNAttributes()) |
| | | { |
| | | attrList = new ArrayList<Attribute>(); |
| | | attrList = new ArrayList<>(); |
| | | attrList.add(Attributes.create(t, n, v)); |
| | | attributes.put(t, attrList); |
| | | } |
| | |
| | | if (! passwordPolicy.isSkipValidationForAdministrators()) |
| | | { |
| | | // There are never any current passwords for an add operation. |
| | | HashSet<ByteString> currentPasswords = new HashSet<ByteString>(0); |
| | | HashSet<ByteString> currentPasswords = new HashSet<>(0); |
| | | LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder(); |
| | | // Work on a copy of the entry without the password to avoid |
| | | // false positives from some validators. |
| | |
| | | |
| | | |
| | | // Set the password changed time attribute. |
| | | ArrayList<Attribute> changedTimeList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> changedTimeList = new ArrayList<>(1); |
| | | Attribute changedTime = Attributes.create( |
| | | OP_ATTR_PWPOLICY_CHANGED_TIME, TimeThread.getGeneralizedTime()); |
| | | changedTimeList.add(changedTime); |
| | |
| | | { |
| | | addPWPolicyControl(PasswordPolicyErrorType.CHANGE_AFTER_RESET); |
| | | |
| | | ArrayList<Attribute> resetList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> resetList = new ArrayList<>(1); |
| | | Attribute reset = Attributes.create( |
| | | OP_ATTR_PWPOLICY_RESET_REQUIRED, "TRUE"); |
| | | resetList.add(reset); |
| | |
| | | ERR_MODDN_OLD_RDN_ATTR_IS_NO_USER_MOD.get(entryDN, a.getName())); |
| | | } |
| | | |
| | | List<ByteString> missingValues = new LinkedList<ByteString>(); |
| | | List<ByteString> missingValues = new LinkedList<>(); |
| | | newEntry.removeAttribute(a, missingValues); |
| | | |
| | | if (missingValues.isEmpty()) |
| | |
| | | newRDN.getAttributeName(i), |
| | | newRDN.getAttributeValue(i)); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | newEntry.addAttribute(a, duplicateValues); |
| | | |
| | | if (duplicateValues.isEmpty()) |
| | |
| | | switch (m.getModificationType().asEnum()) |
| | | { |
| | | case ADD: |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | newEntry.addAttribute(a, duplicateValues); |
| | | break; |
| | | |
| | | case DELETE: |
| | | List<ByteString> missingValues = new LinkedList<ByteString>(); |
| | | List<ByteString> missingValues = new LinkedList<>(); |
| | | newEntry.removeAttribute(a, missingValues); |
| | | break; |
| | | |
| | |
| | | |
| | | if (newPasswords == null) |
| | | { |
| | | newPasswords = new LinkedList<ByteString>(); |
| | | newPasswords = new LinkedList<>(); |
| | | } |
| | | |
| | | newPasswords.add(v); |
| | |
| | | { |
| | | if (currentPasswords == null) |
| | | { |
| | | currentPasswords = new LinkedList<ByteString>(); |
| | | currentPasswords = new LinkedList<>(); |
| | | } |
| | | currentPasswords.add(v); |
| | | numPasswords--; |
| | |
| | | } |
| | | |
| | | // Add the provided attribute or merge an existing attribute with |
| | | // the values of the new attribute. If there are any duplicates, |
| | | // then fail. |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | // the values of the new attribute. If there are any duplicates, then fail. |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | modifiedEntry.addAttribute(attr, duplicateValues); |
| | | if (!duplicateValues.isEmpty() && !permissiveModify) |
| | | { |
| | |
| | | // Remove the specified attribute values or the entire attribute from the |
| | | // value. If there are any specified values that were not present, then |
| | | // fail. If the RDN attribute value would be removed, then fail. |
| | | List<ByteString> missingValues = new LinkedList<ByteString>(); |
| | | List<ByteString> missingValues = new LinkedList<>(); |
| | | boolean attrExists = modifiedEntry.removeAttribute(attr, missingValues); |
| | | |
| | | if (attrExists) |
| | |
| | | if (newPasswords != null |
| | | && (selfChange || !authPolicy.isSkipValidationForAdministrators())) |
| | | { |
| | | HashSet<ByteString> clearPasswords = new HashSet<ByteString>(pwPolicyState.getClearPasswords()); |
| | | HashSet<ByteString> clearPasswords = new HashSet<>(pwPolicyState.getClearPasswords()); |
| | | if (currentPasswords != null) |
| | | { |
| | | if (clearPasswords.isEmpty()) |
| | |
| | | private final Backend<?> backend; |
| | | |
| | | /** The set of local backend workflow elements registered with the server. */ |
| | | private static TreeMap<DN, LocalBackendWorkflowElement> registeredLocalBackends = |
| | | new TreeMap<DN, LocalBackendWorkflowElement>(); |
| | | private static TreeMap<DN, LocalBackendWorkflowElement> registeredLocalBackends = new TreeMap<>(); |
| | | |
| | | /** A lock to guarantee safe concurrent access to the registeredLocalBackends variable. */ |
| | | private static final Object registeredLocalBackendsLock = new Object(); |
| | |
| | | LocalBackendWorkflowElement existingLocalBackend = registeredLocalBackends.get(baseDN); |
| | | if (existingLocalBackend == null) |
| | | { |
| | | TreeMap<DN, LocalBackendWorkflowElement> newLocalBackends = |
| | | new TreeMap<DN, LocalBackendWorkflowElement>(registeredLocalBackends); |
| | | TreeMap<DN, LocalBackendWorkflowElement> newLocalBackends = new TreeMap<>(registeredLocalBackends); |
| | | newLocalBackends.put(baseDN, localBackend); |
| | | registeredLocalBackends = newLocalBackends; |
| | | } |
| | |
| | | LocalBackendWorkflowElement existingLocalBackend = registeredLocalBackends.get(baseDN); |
| | | if (existingLocalBackend != null) |
| | | { |
| | | TreeMap<DN, LocalBackendWorkflowElement> newLocalBackends = |
| | | new TreeMap<DN, LocalBackendWorkflowElement>(registeredLocalBackends); |
| | | TreeMap<DN, LocalBackendWorkflowElement> newLocalBackends = new TreeMap<>(registeredLocalBackends); |
| | | newLocalBackends.remove(baseDN); |
| | | registeredLocalBackends = newLocalBackends; |
| | | } |
| | |
| | | static <O extends Operation, L> void attachLocalOperation(O globalOperation, L currentLocalOperation) |
| | | { |
| | | List<?> existingAttachment = (List<?>) globalOperation.getAttachment(Operation.LOCALBACKENDOPERATIONS); |
| | | List<L> newAttachment = new ArrayList<L>(); |
| | | List<L> newAttachment = new ArrayList<>(); |
| | | |
| | | if (existingAttachment != null) |
| | | { |
| | |
| | | { |
| | | final RootDSEBackend rootDSEBackend = DirectoryServer.getRootDSEBackend(); |
| | | |
| | | final List<LocalBackendWorkflowElement> results = new ArrayList<LocalBackendWorkflowElement>(); |
| | | final List<LocalBackendWorkflowElement> results = new ArrayList<>(); |
| | | for (DN subordinateBaseDN : rootDSEBackend.getSubordinateBaseDNs().keySet()) |
| | | { |
| | | results.add(registeredLocalBackends.get(subordinateBaseDN)); |
| | |
| | | final DN baseDN = workflow.getBaseDN(); |
| | | final Backend<?> backend = workflow.getBackend(); |
| | | |
| | | final ArrayList<LocalBackendWorkflowElement> results = new ArrayList<LocalBackendWorkflowElement>(); |
| | | final ArrayList<LocalBackendWorkflowElement> results = new ArrayList<>(); |
| | | for (Backend<?> subordinate : backend.getSubordinateBackends()) |
| | | { |
| | | for (DN subordinateDN : subordinate.getBaseDNs()) |
| | |
| | | private static Map<Integer,Category> MASK_VALUE_MAP; |
| | | |
| | | static { |
| | | MASK_VALUE_MAP = new HashMap<Integer,Category>(); |
| | | MASK_VALUE_MAP = new HashMap<>(); |
| | | for (Category c : EnumSet.allOf(Category.class)) { |
| | | MASK_VALUE_MAP.put(c.mask, c); |
| | | } |
| | |
| | | private static Map<String,Severity> PROPERTY_KEY_FORM_MAP; |
| | | |
| | | static { |
| | | PROPERTY_KEY_FORM_MAP = new HashMap<String,Severity>(); |
| | | PROPERTY_KEY_FORM_VALUES_SET = new HashSet<String>(); |
| | | PROPERTY_KEY_FORM_MAP = new HashMap<>(); |
| | | PROPERTY_KEY_FORM_VALUES_SET = new HashSet<>(); |
| | | for (Severity s : EnumSet.allOf(Severity.class)) { |
| | | PROPERTY_KEY_FORM_MAP.put(s.propertyKeyFormName(), s); |
| | | PROPERTY_KEY_FORM_VALUES_SET.add(s.propertyKeyFormName()); |
| | |
| | | .newControl("dn:uid=kvaughan,ou=People,dc=example,dc=com"); |
| | | assertThat(control3.getOID()).isEqualTo("2.16.840.1.113730.3.4.18"); |
| | | |
| | | List<org.forgerock.opendj.ldap.controls.Control> mySDKControlsList = |
| | | new LinkedList<org.forgerock.opendj.ldap.controls.Control>(); |
| | | List<org.forgerock.opendj.ldap.controls.Control> mySDKControlsList = new LinkedList<>(); |
| | | mySDKControlsList.add(control); |
| | | mySDKControlsList.add(control2); |
| | | mySDKControlsList.add(control3); |
| | |
| | | isProfileRegistered = true; |
| | | } |
| | | |
| | | SingletonRelationDefinition.Builder<C, S> builder = new SingletonRelationDefinition.Builder<C, S>( |
| | | SingletonRelationDefinition.Builder<C, S> builder = new SingletonRelationDefinition.Builder<>( |
| | | RootCfgDefn.getInstance(), DUMMY_TEST_RELATION, d); |
| | | ManagedObjectPath<?, ?> root = ManagedObjectPath.emptyPath(); |
| | | return root.child(builder.getInstance()); |
| | |
| | | ldapPort = ports[0]; |
| | | jmxPort = ports[1]; |
| | | |
| | | List<String> args = new ArrayList<String>(); |
| | | List<String> args = new ArrayList<>(); |
| | | File root = getQuickSetupTestServerRootDir(); |
| | | String filename = OperatingSystem.isUnixBased() ? "setup" : "setup.bat"; |
| | | args.add(new File(root, filename).getPath()); |
| | |
| | | * keep this so that once all of the tests are finished, we can clear |
| | | * it out in an @AfterClass method. We can't just clear it out right |
| | | * away in the TestListener because some methods share a @DataProvider.*/ |
| | | private final IdentityHashMap<Object[],Object> successfulTestParams = new IdentityHashMap<Object[],Object>(); |
| | | private final IdentityHashMap<Object[],Object> successfulTestParams = new IdentityHashMap<>(); |
| | | |
| | | /** These are test parameters from a test that has failed. We need to |
| | | * keep these around because the test report expects to find them when |
| | | * printing out failures. */ |
| | | private final IdentityHashMap<Object[],Object> failedTestParams = new IdentityHashMap<Object[],Object>(); |
| | | private final IdentityHashMap<Object[],Object> failedTestParams = new IdentityHashMap<>(); |
| | | |
| | | /** |
| | | * Adds testParams to the list of all test parameters, so it can be |
| | |
| | | Thread threads[] = new Thread[topGroup.activeCount() * 2]; |
| | | int numThreads = topGroup.enumerate(threads); |
| | | |
| | | List<String> activeThreads = new ArrayList<String>(); |
| | | List<String> activeThreads = new ArrayList<>(); |
| | | for (int i = 0; i < numThreads; i++) |
| | | { |
| | | Thread thread = threads[i]; |
| | |
| | | } |
| | | } |
| | | |
| | | private static List<Long> restartTimesMs = new ArrayList<Long>(); |
| | | private static List<Long> restartTimesMs = new ArrayList<>(); |
| | | public static List<Long> getRestartTimesMs() { |
| | | return Collections.unmodifiableList(restartTimesMs); |
| | | } |
| | |
| | | RootContainer rootContainer = backend.getRootContainer(); |
| | | for (EntryContainer ec : rootContainer.getEntryContainers()) |
| | | { |
| | | List<DatabaseContainer> databases = new ArrayList<DatabaseContainer>(); |
| | | List<DatabaseContainer> databases = new ArrayList<>(); |
| | | ec.listDatabases(databases); |
| | | for (DatabaseContainer dbContainer: databases) { |
| | | if (dbContainer instanceof Index) { |
| | |
| | | ldifImportConfig.setValidateSchema(false); |
| | | LDIFReader reader = new LDIFReader(ldifImportConfig); |
| | | |
| | | List<Entry> entries = new ArrayList<Entry>(); |
| | | List<Entry> entries = new ArrayList<>(); |
| | | Entry entry; |
| | | while ((entry = reader.readEntry()) != null) { |
| | | entries.add(entry); |
| | |
| | | */ |
| | | public static Map<String, String> makeMap(String... keyValuePairs) |
| | | { |
| | | Map<String, String> map = new LinkedHashMap<String, String>(); |
| | | Map<String, String> map = new LinkedHashMap<>(); |
| | | for (int i = 0; i < keyValuePairs.length; i += 2) { |
| | | map.put(keyValuePairs[i], keyValuePairs[i+1]); |
| | | } |
| | |
| | | // --------------------------------------------------------------------------- |
| | | |
| | | /** The set of loggers for which the console logger has been disabled. */ |
| | | private static final Map<Logger, Handler> disabledLogHandlers = new HashMap<Logger,Handler>(); |
| | | private static final Map<Logger, Handler> disabledLogHandlers = new HashMap<>(); |
| | | |
| | | /** The original System.err print stream. Use this if you absolutely |
| | | * must write something to System.err. */ |
| | |
| | | * included). An ArrayList is explicitly returned, so that callers know that |
| | | * random access is not expensive. |
| | | */ |
| | | public static ArrayList<String> readFileToLines(File file) |
| | | throws IOException { |
| | | BufferedReader reader = |
| | | new BufferedReader( |
| | | new InputStreamReader( |
| | | new DataInputStream( |
| | | new FileInputStream(file)))); |
| | | public static ArrayList<String> readFileToLines(File file) throws IOException { |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); |
| | | |
| | | ArrayList<String> lines = new ArrayList<String>(); |
| | | ArrayList<String> lines = new ArrayList<>(); |
| | | String line; |
| | | while ((line = reader.readLine()) != null) { |
| | | lines.add(line); |
| | |
| | | |
| | | |
| | | // Re-arrange all of the elements by thread ID so that there is some logical order. |
| | | Map<Long, Map.Entry<Thread, StackTraceElement[]>> orderedStacks = |
| | | new TreeMap<Long,Map.Entry<Thread,StackTraceElement[]>>(); |
| | | Map<Long, Map.Entry<Thread, StackTraceElement[]>> orderedStacks = new TreeMap<>(); |
| | | for (Map.Entry<Thread,StackTraceElement[]> e : threadStacks.entrySet()) |
| | | { |
| | | orderedStacks.put(e.getKey().getId(), e); |
| | |
| | | |
| | | public static HashSet<PluginType> getPluginTypes(Entry e) |
| | | { |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(); |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | List<Attribute> attrList = e.getAttribute("ds-cfg-plugin-type"); |
| | | if (attrList != null) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private final LinkedHashSet<Class<?>> _classesWithTestsRunInterleaved = new LinkedHashSet<Class<?>>(); |
| | | private final LinkedHashSet<Class<?>> _classesWithTestsRunInterleaved = new LinkedHashSet<>(); |
| | | private Object _lastTestObject; |
| | | private final IdentityHashMap<Object,Object> _previousTestObjects = new IdentityHashMap<Object,Object>(); |
| | | private final IdentityHashMap<Object,Object> _previousTestObjects = new IdentityHashMap<>(); |
| | | private void checkForInterleavedBetweenClasses(ITestResult tr) { |
| | | Object[] testInstances = tr.getMethod().getInstances(); |
| | | // This will almost always have a single element. If it doesn't, just skip it. |
| | |
| | | } |
| | | |
| | | |
| | | private Set<Method> _checkedForAnnotation = new HashSet<Method>(); |
| | | private Set<Method> _checkedForAnnotation = new HashSet<>(); |
| | | private void enforceMethodHasAnnotation(ITestResult tr) { |
| | | // Only warn once per method. |
| | | Method testMethod = tr.getMethod().getMethod(); |
| | |
| | | return runtime.totalMemory() - runtime.freeMemory(); |
| | | } |
| | | |
| | | private final LinkedHashMap<IClass, TestClassResults> _classResults = new LinkedHashMap<IClass, TestClassResults>(); |
| | | private final LinkedHashMap<IClass, TestClassResults> _classResults = new LinkedHashMap<>(); |
| | | |
| | | private TestClassResults getResultsForClass(IClass cls) { |
| | | TestClassResults results = _classResults.get(cls); |
| | |
| | | } |
| | | |
| | | private synchronized List<TestMethodResults> getAllMethodResults() { |
| | | List<TestMethodResults> allResults = new ArrayList<TestMethodResults>(); |
| | | List<TestMethodResults> allResults = new ArrayList<>(); |
| | | for (TestClassResults results: _classResults.values()) { |
| | | allResults.addAll(results.getAllMethodResults()); |
| | | } |
| | |
| | | } |
| | | |
| | | private List<TestClassResults> getClassesDescendingSortedByDuration() { |
| | | List<TestClassResults> allClasses = new ArrayList<TestClassResults>(_classResults.values()); |
| | | List<TestClassResults> allClasses = new ArrayList<>(_classResults.values()); |
| | | Collections.sort(allClasses, new Comparator<TestClassResults>() { |
| | | @Override |
| | | public int compare(TestClassResults o1, TestClassResults o2) { |
| | |
| | | |
| | | private static class TestClassResults { |
| | | private final IClass _cls; |
| | | private final LinkedHashMap<ITestNGMethod, TestMethodResults> _methods = new LinkedHashMap<ITestNGMethod, TestMethodResults>(); |
| | | private final LinkedHashMap<ITestNGMethod, TestMethodResults> _methods = new LinkedHashMap<>(); |
| | | private int _totalInvocations; |
| | | private long _totalDurationMs; |
| | | |
| | |
| | | |
| | | public TestTextWriter() |
| | | { |
| | | messageList = new LinkedList<String>(); |
| | | messageList = new LinkedList<>(); |
| | | } |
| | | |
| | | public synchronized void writeRecord(String record) |
| | |
| | | */ |
| | | public synchronized List<String> getMessages() |
| | | { |
| | | return new ArrayList<String>(messageList); |
| | | return new ArrayList<>(messageList); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Clears any messages currently stored by this logger. |
| | | */ |
| | | /** Clears any messages currently stored by this logger. */ |
| | | public synchronized void clear() |
| | | { |
| | | messageList.clear(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | @BeforeClass |
| | | public void setUp() { |
| | | this.ridbp = new RelativeInheritedDefaultBehaviorProvider<Boolean>(d, d |
| | | this.ridbp = new RelativeInheritedDefaultBehaviorProvider<>(d, d |
| | | .getMandatoryBooleanPropertyPropertyDefinition().getName(), OFFSET); |
| | | } |
| | | |
| | |
| | | |
| | | /** Create a one-to-many relation for test-parent components. */ |
| | | static { |
| | | InstantiableRelationDefinition.Builder<TestParentCfgClient, TestParentCfg> builder = new InstantiableRelationDefinition.Builder<TestParentCfgClient, TestParentCfg>( |
| | | InstantiableRelationDefinition.Builder<TestParentCfgClient, TestParentCfg> builder = new InstantiableRelationDefinition.Builder<>( |
| | | RootCfgDefn.getInstance(), "test-one-to-many-parent", |
| | | "test-one-to-many-parents", TestParentCfgDefn.getInstance()); |
| | | RD_TEST_ONE_TO_MANY_PARENT = builder.getInstance(); |
| | |
| | | |
| | | /** Create a one-to-many relation for test-parent components. */ |
| | | static { |
| | | OptionalRelationDefinition.Builder<TestParentCfgClient, TestParentCfg> builder = new OptionalRelationDefinition.Builder<TestParentCfgClient, TestParentCfg>( |
| | | OptionalRelationDefinition.Builder<TestParentCfgClient, TestParentCfg> builder = new OptionalRelationDefinition.Builder<>( |
| | | RootCfgDefn.getInstance(), "test-one-to-zero-or-one-parent", |
| | | TestParentCfgDefn.getInstance()); |
| | | RD_TEST_ONE_TO_ZERO_OR_ONE_PARENT = builder.getInstance(); |
| | |
| | | ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "mandatory-class-property"); |
| | | builder.setOption(PropertyOption.MANDATORY); |
| | | builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "mandatory-class-property")); |
| | | DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<>("org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | builder.setDefaultBehaviorProvider(provider); |
| | | builder.addInstanceOf("org.opends.server.api.VirtualAttributeProvider"); |
| | | PD_MANDATORY_CLASS_PROPERTY = builder.getInstance(); |
| | |
| | | DNPropertyDefinition.Builder builder = DNPropertyDefinition.createBuilder(INSTANCE, "optional-multi-valued-dn-property1"); |
| | | builder.setOption(PropertyOption.MULTI_VALUED); |
| | | builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "optional-multi-valued-dn-property1")); |
| | | DefaultBehaviorProvider<DN> provider = new RelativeInheritedDefaultBehaviorProvider<DN>(TestParentCfgDefn.getInstance(), "optional-multi-valued-dn-property", 1); |
| | | DefaultBehaviorProvider<DN> provider = new RelativeInheritedDefaultBehaviorProvider<>(TestParentCfgDefn.getInstance(), "optional-multi-valued-dn-property", 1); |
| | | builder.setDefaultBehaviorProvider(provider); |
| | | PD_OPTIONAL_MULTI_VALUED_DN_PROPERTY1 = builder.getInstance(); |
| | | INSTANCE.registerPropertyDefinition(PD_OPTIONAL_MULTI_VALUED_DN_PROPERTY1); |
| | |
| | | DNPropertyDefinition.Builder builder = DNPropertyDefinition.createBuilder(INSTANCE, "optional-multi-valued-dn-property2"); |
| | | builder.setOption(PropertyOption.MULTI_VALUED); |
| | | builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "optional-multi-valued-dn-property2")); |
| | | DefaultBehaviorProvider<DN> provider = new RelativeInheritedDefaultBehaviorProvider<DN>(TestChildCfgDefn.getInstance(), "optional-multi-valued-dn-property1", 0); |
| | | DefaultBehaviorProvider<DN> provider = new RelativeInheritedDefaultBehaviorProvider<>(TestChildCfgDefn.getInstance(), "optional-multi-valued-dn-property1", 0); |
| | | builder.setDefaultBehaviorProvider(provider); |
| | | PD_OPTIONAL_MULTI_VALUED_DN_PROPERTY2 = builder.getInstance(); |
| | | INSTANCE.registerPropertyDefinition(PD_OPTIONAL_MULTI_VALUED_DN_PROPERTY2); |
| | |
| | | ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "mandatory-class-property"); |
| | | builder.setOption(PropertyOption.MANDATORY); |
| | | builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.COMPONENT_RESTART, INSTANCE, "mandatory-class-property")); |
| | | DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<>("org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | builder.setDefaultBehaviorProvider(provider); |
| | | builder.addInstanceOf("org.opends.server.api.VirtualAttributeProvider"); |
| | | PD_MANDATORY_CLASS_PROPERTY = builder.getInstance(); |
| | |
| | | DNPropertyDefinition.Builder builder = DNPropertyDefinition.createBuilder(INSTANCE, "optional-multi-valued-dn-property"); |
| | | builder.setOption(PropertyOption.MULTI_VALUED); |
| | | builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "optional-multi-valued-dn-property")); |
| | | DefaultBehaviorProvider<DN> provider = new DefinedDefaultBehaviorProvider<DN>("dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | DefaultBehaviorProvider<DN> provider = new DefinedDefaultBehaviorProvider<>("dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | builder.setDefaultBehaviorProvider(provider); |
| | | PD_OPTIONAL_MULTI_VALUED_DN_PROPERTY = builder.getInstance(); |
| | | INSTANCE.registerPropertyDefinition(PD_OPTIONAL_MULTI_VALUED_DN_PROPERTY); |
| | |
| | | /** Build the "test-children" relation definition. */ |
| | | static { |
| | | InstantiableRelationDefinition.Builder<TestChildCfgClient, TestChildCfg> builder = |
| | | new InstantiableRelationDefinition.Builder<TestChildCfgClient, TestChildCfg>( |
| | | INSTANCE, "multiple-children", "test-children", TestChildCfgDefn |
| | | .getInstance()); |
| | | new InstantiableRelationDefinition.Builder<>( |
| | | INSTANCE, "multiple-children", "test-children", TestChildCfgDefn.getInstance()); |
| | | RD_TEST_CHILDREN = builder.getInstance(); |
| | | INSTANCE.registerRelationDefinition(RD_TEST_CHILDREN); |
| | | } |
| | |
| | | /** Build the "optional-test-child" relation definition. */ |
| | | static { |
| | | OptionalRelationDefinition.Builder<TestChildCfgClient, TestChildCfg> builder = |
| | | new OptionalRelationDefinition.Builder<TestChildCfgClient, TestChildCfg>( |
| | | new OptionalRelationDefinition.Builder<>( |
| | | INSTANCE, "optional-test-child", TestChildCfgDefn.getInstance()); |
| | | RD_OPTIONAL_TEST_CHILD = builder.getInstance(); |
| | | INSTANCE.registerRelationDefinition(RD_OPTIONAL_TEST_CHILD); |
| | |
| | | @DataProvider |
| | | public Object[][] enumrateManageObjectDefns() throws Exception { |
| | | TopCfgDefn topCfgDefn = TopCfgDefn.getInstance(); |
| | | List<AbstractManagedObjectDefinition<?,?>> allCfgDefns = |
| | | new ArrayList<AbstractManagedObjectDefinition<?,?>>(topCfgDefn.getAllChildren()); |
| | | List<AbstractManagedObjectDefinition<?,?>> allCfgDefns = new ArrayList<>(topCfgDefn.getAllChildren()); |
| | | |
| | | Object[][] params = new Object[allCfgDefns.size()][]; |
| | | for (int i = 0; i < params.length; i++) { |
| | |
| | | " is declared as mandatory in the schema.").append(EOL + EOL); |
| | | } |
| | | |
| | | Set<AttributeType> allowedAttributes = new HashSet<AttributeType>(mandatoryAttributes); |
| | | Set<AttributeType> allowedAttributes = new HashSet<>(mandatoryAttributes); |
| | | allowedAttributes.addAll(configObjectClass.getOptionalAttributeChain()); |
| | | if (!allowedAttributes.contains(attrType)) { |
| | | errors.append(propName + " property on config object " + objName + " has" + |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | /** Asserts that the actual set of DNs contains the expected values. */ |
| | | private void assertSetEquals(SortedSet<String> actual, String... expected) { |
| | | SortedSet<String> values = new TreeSet<String>(TestChildCfgDefn |
| | | SortedSet<String> values = new TreeSet<>(TestChildCfgDefn |
| | | .getInstance().getAggregationPropertyPropertyDefinition()); |
| | | if (expected != null) { |
| | | for (String value : expected) { |
| | |
| | | private boolean alreadyAdded; |
| | | |
| | | /** The expected set of attributes (attribute name -> list of values). */ |
| | | private final Map<String, List<String>> attributes = new HashMap<String, List<String>>(); |
| | | private final Map<String, List<String>> attributes = new HashMap<>(); |
| | | |
| | | /** The expected DN. */ |
| | | private final LdapName expectedDN; |
| | |
| | | public MockEntry(DN dn, Attributes attributes) { |
| | | this.dn = dn; |
| | | this.attributes = attributes; |
| | | this.children = new LinkedList<MockEntry>(); |
| | | this.children = new LinkedList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public MockLDAPConnection() { |
| | | this.rootEntry = new MockEntry(DN.rootDN(), new BasicAttributes()); |
| | | this.entries = new HashMap<DN, MockEntry>(); |
| | | this.entries = new HashMap<>(); |
| | | this.entries.put(DN.rootDN(), this.rootEntry); |
| | | } |
| | | |
| | |
| | | throw new NameNotFoundException("could not find entry " + dn); |
| | | } |
| | | |
| | | LinkedList<LdapName> names = new LinkedList<LdapName>(); |
| | | LinkedList<LdapName> names = new LinkedList<>(); |
| | | for (MockEntry child : entry.children) |
| | | { |
| | | names.add(new LdapName(child.getDN().toString())); |
| | |
| | | */ |
| | | protected final void assertAttributeEquals(Attribute attr, |
| | | Collection<String> values) throws NamingException { |
| | | LinkedList<String> actualValues = new LinkedList<String>(); |
| | | LinkedList<String> actualValues = new LinkedList<>(); |
| | | NamingEnumeration<?> ne = attr.getAll(); |
| | | while (ne.hasMore()) { |
| | | actualValues.add(ne.next().toString()); |
| | |
| | | private final LdapName expectedDN; |
| | | |
| | | /** The expected set of modifications (attribute name -> list of values). */ |
| | | private final Map<String, List<String>> modifications = new HashMap<String, List<String>>(); |
| | | private final Map<String, List<String>> modifications = new HashMap<>(); |
| | | |
| | | |
| | | |
| | |
| | | BooleanPropertyDefinition.Builder builder = |
| | | BooleanPropertyDefinition.createBuilder(TopCfgDefn.getInstance(), "test-bool-prop"); |
| | | DefinedDefaultBehaviorProvider<Boolean> dbp = |
| | | new DefinedDefaultBehaviorProvider<Boolean>(BOOL_DEFAULT.toString()); |
| | | new DefinedDefaultBehaviorProvider<>(BOOL_DEFAULT.toString()); |
| | | builder.setDefaultBehaviorProvider(dbp); |
| | | testBoolPropertyDefinition = builder.getInstance(); |
| | | |
| | | StringPropertyDefinition.Builder builder2 = |
| | | StringPropertyDefinition.createBuilder(TopCfgDefn.getInstance(), "test-sv-str-prop"); |
| | | DefinedDefaultBehaviorProvider<String> dbp2 = |
| | | new DefinedDefaultBehaviorProvider<String>(STR_DEFAULT); |
| | | new DefinedDefaultBehaviorProvider<>(STR_DEFAULT); |
| | | builder2.setDefaultBehaviorProvider(dbp2); |
| | | testSvStringPropertyDefinition = builder2.getInstance(); |
| | | |
| | | StringPropertyDefinition.Builder builder3 = |
| | | StringPropertyDefinition.createBuilder(TopCfgDefn.getInstance(), "test-mv-str-prop"); |
| | | DefinedDefaultBehaviorProvider<String> dbp3 = |
| | | new DefinedDefaultBehaviorProvider<String>(STR_DEFAULT); |
| | | new DefinedDefaultBehaviorProvider<>(STR_DEFAULT); |
| | | builder3.setDefaultBehaviorProvider(dbp3); |
| | | builder3.setOption(PropertyOption.MULTI_VALUED); |
| | | testMvStringPropertyDefinition = builder3.getInstance(); |
| | |
| | | @DataProvider(name = "propertyDefinitionAndValuesData") |
| | | public Object[][] createPropertyDefinitionAndValuesData() { |
| | | |
| | | Set<Boolean> sb = new HashSet<Boolean>(); |
| | | Set<Boolean> sb = new HashSet<>(); |
| | | sb.add(Boolean.TRUE); |
| | | |
| | | Set<String> ss1 = new HashSet<String>(); |
| | | Set<String> ss1 = new HashSet<>(); |
| | | ss1.add("v"); |
| | | |
| | | Set<String> ss2 = new HashSet<String>(); |
| | | Set<String> ss2 = new HashSet<>(); |
| | | ss2.add("v1"); |
| | | ss2.add("v2"); |
| | | |
| | |
| | | */ |
| | | @Test(dataProvider = "propertyDefinitionAndValuesData") |
| | | public <T> void testGetActiveValues(final PropertyDefinition<T> pd, final Collection<T> values) { |
| | | PropertyProvider pp = new TestPropertyProvider<T>(pd, values); |
| | | PropertyProvider pp = new TestPropertyProvider<>(pd, values); |
| | | PropertySet ps = createTestPropertySet(pp); |
| | | Property<T> p = ps.getProperty(pd); |
| | | SortedSet<T> ss = p.getActiveValues(); |
| | |
| | | @DataProvider(name = "defaultData") |
| | | public Object[][] createDefaultData() { |
| | | |
| | | Set<Boolean> sb = new HashSet<Boolean>(); |
| | | Set<Boolean> sb = new HashSet<>(); |
| | | sb.add(BOOL_DEFAULT); |
| | | |
| | | Set<String> ss1 = new HashSet<String>(); |
| | | Set<String> ss1 = new HashSet<>(); |
| | | ss1.add(STR_DEFAULT); |
| | | |
| | | Set<String> ss2 = new HashSet<String>(); |
| | | Set<String> ss2 = new HashSet<>(); |
| | | ss2.add(STR_DEFAULT); |
| | | |
| | | return new Object[][] { |
| | |
| | | @DataProvider(name = "effectiveData") |
| | | public Object[][] createEffectiveData() { |
| | | |
| | | Set<Boolean> nvb = new HashSet<Boolean>(); |
| | | Set<Boolean> nvb = new HashSet<>(); |
| | | nvb.add(Boolean.FALSE); |
| | | |
| | | Set<Boolean> edb = new HashSet<Boolean>(); |
| | | Set<Boolean> edb = new HashSet<>(); |
| | | edb.add(BOOL_DEFAULT); |
| | | |
| | | Set<String> nvss1 = new HashSet<String>(); |
| | | Set<String> nvss1 = new HashSet<>(); |
| | | nvss1.add("new value"); |
| | | |
| | | Set<String> edss1 = new HashSet<String>(); |
| | | Set<String> edss1 = new HashSet<>(); |
| | | edss1.add(STR_DEFAULT); |
| | | |
| | | Set<String> nvss2 = new HashSet<String>(); |
| | | Set<String> nvss2 = new HashSet<>(); |
| | | nvss2.add("new value 1"); |
| | | nvss2.add("new value 2"); |
| | | |
| | | Set<String> edss2 = new HashSet<String>(); |
| | | Set<String> edss2 = new HashSet<>(); |
| | | edss2.add(STR_DEFAULT); |
| | | |
| | | return new Object[][] { |
| | |
| | | } |
| | | |
| | | private PropertySet createTestPropertySet(PropertyProvider pp) { |
| | | ManagedObjectDefinition<?, ?> d = new TestManagedObjectDefinition<ConfigurationClient, Configuration>("test-mod", null); |
| | | ManagedObjectDefinition<?, ?> d = new TestManagedObjectDefinition<>("test-mod", null); |
| | | PropertySet ps = new PropertySet(); |
| | | for (PropertyDefinition<?> pd : d.getPropertyDefinitions()) { |
| | | addProperty(ps, pd, pp); |
| | |
| | | } |
| | | |
| | | private <T> void addProperty(PropertySet ps, PropertyDefinition<T> pd, PropertyProvider pp) { |
| | | Collection<T> defaultValues = new LinkedList<T>(); |
| | | Collection<T> defaultValues = new LinkedList<>(); |
| | | DefaultBehaviorProvider<T> dbp = pd.getDefaultBehaviorProvider(); |
| | | if (dbp instanceof DefinedDefaultBehaviorProvider) { |
| | | DefinedDefaultBehaviorProvider<T> ddbp = (DefinedDefaultBehaviorProvider<T>) dbp; |
| | |
| | | } |
| | | |
| | | SingletonRelationDefinition.Builder<C, S> builder = |
| | | new SingletonRelationDefinition.Builder<C, S>( |
| | | new SingletonRelationDefinition.Builder<>( |
| | | RootCfgDefn.getInstance(), DUMMY_TEST_RELATION, d); |
| | | ManagedObjectPath<?, ?> root = ManagedObjectPath.emptyPath(); |
| | | return root.child(builder.getInstance()); |
| | |
| | | |
| | | /** Asserts that the actual set of DNs contains the expected values. */ |
| | | private void assertSetEquals(SortedSet<String> actual, String... expected) { |
| | | SortedSet<String> values = new TreeSet<String>(TestChildCfgDefn |
| | | SortedSet<String> values = new TreeSet<>(TestChildCfgDefn |
| | | .getInstance().getAggregationPropertyPropertyDefinition()); |
| | | if (expected != null) { |
| | | for (String value : expected) { |
| | |
| | | .emptyPath(); |
| | | |
| | | SingletonRelationDefinition.Builder<TestChildCfgClient, TestChildCfg> b = |
| | | new SingletonRelationDefinition.Builder<TestChildCfgClient, TestChildCfg>( |
| | | new SingletonRelationDefinition.Builder<>( |
| | | TestParentCfgDefn.getInstance(), "singleton-test-child", |
| | | TestChildCfgDefn.getInstance()); |
| | | final SingletonRelationDefinition<TestChildCfgClient, TestChildCfg> r2 = b.getInstance(); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | path = path.child(TestCfg.getTestOneToManyParentRelationDefinition(), "test-parent-1"); |
| | |
| | | @Test // TestNG treats this as a test, so we annotate it to eliminate warnings |
| | | public LinkedHashMap<String,String> getAlerts() |
| | | { |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(ALERT_TYPE, ALERT_DESCRIPTION); |
| | | |
| | |
| | | public Object[][] getConfigChangeListeners() |
| | | throws Exception |
| | | { |
| | | ArrayList<DN> dns = new ArrayList<DN>(); |
| | | ArrayList<ConfigChangeListener> listeners = |
| | | new ArrayList<ConfigChangeListener>(); |
| | | getChangeListeners(DirectoryServer.getConfigHandler().getConfigRootEntry(), |
| | | dns, listeners); |
| | | |
| | | ArrayList<DN> dns = new ArrayList<>(); |
| | | ArrayList<ConfigChangeListener> listeners = new ArrayList<>(); |
| | | getChangeListeners(DirectoryServer.getConfigHandler().getConfigRootEntry(), dns, listeners); |
| | | |
| | | Object[][] componentArray = new Object[listeners.size()][1]; |
| | | for (int i=0; i < componentArray.length; i++) |
| | | { |
| | | componentArray[i] = new Object[] { dns.get(i), listeners.get(i) }; |
| | | } |
| | | |
| | | return componentArray; |
| | | } |
| | | |
| | |
| | | */ |
| | | public class DITCacheMapTestCase extends APITestCase |
| | | { |
| | | private static final DITCacheMap<String> ditMap = |
| | | new DITCacheMap<String>(); |
| | | private static final DITCacheMap<String> ditMap = new DITCacheMap<>(); |
| | | |
| | | private static final String dn0String = |
| | | "cn=Object0,dc=example,dc=com"; |
| | |
| | | |
| | | private void putAllAndVerify() |
| | | { |
| | | Map<DN,String> hashMap = |
| | | new HashMap<DN,String>(); |
| | | Map<DN,String> hashMap = new HashMap<>(); |
| | | |
| | | hashMap.put(dn0, dn0String); |
| | | hashMap.put(dn1, dn1String); |
| | |
| | | assertFalse(entrySet.isEmpty()); |
| | | assertEquals(entrySet.size(), 10); |
| | | Iterator<Entry<DN,String>> iterator = entrySet.iterator(); |
| | | Map<DN,String> tempMap = new HashMap<DN,String>(); |
| | | Map<DN,String> tempMap = new HashMap<>(); |
| | | while (iterator.hasNext()) |
| | | { |
| | | Entry<DN,String> entry = iterator.next(); |
| | |
| | | |
| | | putAllAndVerify(); |
| | | |
| | | Set<String> removeSet = new HashSet<String>(); |
| | | assertTrue(ditMap.removeSubtree(DN.valueOf( |
| | | "dc=example,dc=com"), |
| | | removeSet)); |
| | | Set<String> removeSet = new HashSet<>(); |
| | | assertTrue(ditMap.removeSubtree(DN.valueOf("dc=example,dc=com"), removeSet)); |
| | | assertFalse(removeSet.isEmpty()); |
| | | assertEquals(removeSet.size(), 10); |
| | | assertTrue(removeSet.contains(dn0String)); |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("newPassword")); |
| | | LDAPAttribute attr = new LDAPAttribute("userPassword", values); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, attr)); |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("newPassword")); |
| | | LDAPAttribute attr = new LDAPAttribute("userPassword", values); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, attr)); |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("password")); |
| | | LDAPAttribute attr = new LDAPAttribute("userPassword", values); |
| | | mods.add(new LDAPModification(ModificationType.DELETE, attr)); |
| | | |
| | | values = new ArrayList<ByteString>(); |
| | | values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("newPassword")); |
| | | attr = new LDAPAttribute("userPassword", values); |
| | | mods.add(new LDAPModification(ModificationType.ADD, attr)); |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("newPassword")); |
| | | LDAPAttribute attr = new LDAPAttribute("userPassword", values); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, attr)); |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("password")); |
| | | LDAPAttribute attr = new LDAPAttribute("userPassword", values); |
| | | mods.add(new LDAPModification(ModificationType.DELETE, attr)); |
| | | |
| | | values = new ArrayList<ByteString>(); |
| | | values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("newPassword")); |
| | | attr = new LDAPAttribute("userPassword", values); |
| | | mods.add(new LDAPModification(ModificationType.ADD, attr)); |
| | |
| | | public void testAbstractMethods() |
| | | throws Exception |
| | | { |
| | | LinkedList<LinkedList<String>> expectedAbstractMethods = |
| | | new LinkedList<LinkedList<String>>(); |
| | | LinkedList<LinkedList<String>> expectedAbstractMethods = new LinkedList<>(); |
| | | |
| | | LinkedList<String> sigList = new LinkedList<String>(); |
| | | LinkedList<String> sigList = new LinkedList<>(); |
| | | sigList.add("initializePlugin"); |
| | | sigList.add("void"); |
| | | sigList.add("java.util.Set"); |
| | |
| | | expectedAbstractMethods.add(sigList); |
| | | |
| | | |
| | | LinkedList<LinkedList<String>> newAbstractMethods = |
| | | new LinkedList<LinkedList<String>>(); |
| | | LinkedList<LinkedList<String>> newAbstractMethods = new LinkedList<>(); |
| | | Class pluginClass = DirectoryServerPlugin.class; |
| | | for (Method m : pluginClass.getMethods()) |
| | | { |
| | | if (Modifier.isAbstract(m.getModifiers())) |
| | | { |
| | | LinkedList<String> foundList = new LinkedList<String>(); |
| | | LinkedList<String> foundList = new LinkedList<>(); |
| | | foundList.add(m.getName()); |
| | | foundList.add(m.getReturnType().getName()); |
| | | for (Class c : m.getParameterTypes()) |
| | |
| | | public void testNonAbstractPublicAPIMethods() |
| | | throws Exception |
| | | { |
| | | LinkedList<LinkedList<String>> expectedPublicMethods = |
| | | new LinkedList<LinkedList<String>>(); |
| | | LinkedList<LinkedList<String>> expectedPublicMethods = new LinkedList<>(); |
| | | |
| | | LinkedList<String> sigList = new LinkedList<String>(); |
| | | LinkedList<String> sigList = new LinkedList<>(); |
| | | sigList.add("finalizePlugin"); |
| | | sigList.add("void"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doStartup"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$Startup"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doShutdown"); |
| | | sigList.add("void"); |
| | | sigList.add("org.forgerock.i18n.LocalizableMessage"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostConnect"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostConnect"); |
| | | sigList.add("org.opends.server.api.ClientConnection"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostDisconnect"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostDisconnect"); |
| | | sigList.add("org.opends.server.api.ClientConnection"); |
| | |
| | | sigList.add("org.forgerock.i18n.LocalizableMessage"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doLDIFImport"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$ImportLDIF"); |
| | | sigList.add("org.opends.server.types.LDIFImportConfig"); |
| | | sigList.add("org.opends.server.types.Entry"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doLDIFImportEnd"); |
| | | sigList.add("void"); |
| | | sigList.add("org.opends.server.types.LDIFImportConfig"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doLDIFImportBegin"); |
| | | sigList.add("void"); |
| | | sigList.add("org.opends.server.types.LDIFImportConfig"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doLDIFExport"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$ImportLDIF"); |
| | | sigList.add("org.opends.server.types.LDIFExportConfig"); |
| | | sigList.add("org.opends.server.types.Entry"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseAbandonOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseModifyOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseAddOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseBindOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseCompareOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseDeleteOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseExtendedOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseUnbindOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseModifyDNOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreParse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreParse"); |
| | | sigList.add("org.opends.server.types.operation.PreParseSearchOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation.PreOperationBindOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation.PreOperationAddOperation"); |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation."+ |
| | |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPreOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PreOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | |
| | | sigList.add("org.opends.server.types.CanceledOperationException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationCompareOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationModifyDNOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationExtendedOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationBindOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationAbandonOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationUnbindOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationModifyOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation.PostOperationAddOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationDeleteOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostOperation"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostOperation"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostOperationSearchOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostResponseCompareOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostResponseDeleteOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostResponseSearchOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostResponseExtendedOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostResponseModifyOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostResponseModifyDNOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation.PostResponseAddOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostResponse"); |
| | | sigList.add("org.opends.server.api.plugin.PluginResult$PostResponse"); |
| | | sigList.add("org.opends.server.types.operation.PostResponseBindOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostSynchronization"); |
| | | sigList.add("void"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostSynchronizationAddOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostSynchronization"); |
| | | sigList.add("void"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostSynchronizationDeleteOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostSynchronization"); |
| | | sigList.add("void"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostSynchronizationModifyOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("doPostSynchronization"); |
| | | sigList.add("void"); |
| | | sigList.add("org.opends.server.types.operation." + |
| | | "PostSynchronizationModifyDNOperation"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("processSearchEntry"); |
| | | sigList.add("org.opends.server.api.plugin." + |
| | | "PluginResult$IntermediateResponse"); |
| | |
| | | sigList.add("org.opends.server.types.SearchResultEntry"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("processSearchReference"); |
| | | sigList.add("org.opends.server.api.plugin." + |
| | | "PluginResult$IntermediateResponse"); |
| | |
| | | sigList.add("org.opends.server.types.SearchResultReference"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("processSubordinateModifyDN"); |
| | | sigList.add("org.opends.server.api.plugin." + |
| | | "PluginResult$SubordinateModifyDN"); |
| | |
| | | sigList.add("java.util.List"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("processSubordinateDelete"); |
| | | sigList.add("org.opends.server.api.plugin." + |
| | | "PluginResult$SubordinateDelete"); |
| | |
| | | sigList.add("org.opends.server.types.Entry"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("processIntermediateResponse"); |
| | | sigList.add("org.opends.server.api.plugin." + |
| | | "PluginResult$IntermediateResponse"); |
| | | sigList.add("org.opends.server.types.IntermediateResponse"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("initializeInternal"); |
| | | sigList.add("void"); |
| | | sigList.add("org.opends.server.types.DN"); |
| | |
| | | sigList.add("boolean"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("getPluginEntryDN"); |
| | | sigList.add("org.opends.server.types.DN"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("getPluginTypes"); |
| | | sigList.add("java.util.Set"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("invokeForInternalOperations"); |
| | | sigList.add("boolean"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("setInvokeForInternalOperations"); |
| | | sigList.add("void"); |
| | | sigList.add("boolean"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("getClass"); |
| | | sigList.add("java.lang.Class"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("equals"); |
| | | sigList.add("boolean"); |
| | | sigList.add("java.lang.Object"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("hashCode"); |
| | | sigList.add("int"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("toString"); |
| | | sigList.add("java.lang.String"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("wait"); |
| | | sigList.add("void"); |
| | | sigList.add("java.lang.InterruptedException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("wait"); |
| | | sigList.add("void"); |
| | | sigList.add("long"); |
| | | sigList.add("java.lang.InterruptedException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("wait"); |
| | | sigList.add("void"); |
| | | sigList.add("long"); |
| | |
| | | sigList.add("java.lang.InterruptedException"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("notify"); |
| | | sigList.add("void"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("notifyAll"); |
| | | sigList.add("void"); |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | sigList = new LinkedList<String>(); |
| | | sigList = new LinkedList<>(); |
| | | sigList.add("isConfigurationAcceptable"); |
| | | sigList.add("boolean"); |
| | | sigList.add("org.opends.server.admin.std.server.PluginCfg"); |
| | |
| | | expectedPublicMethods.add(sigList); |
| | | |
| | | |
| | | LinkedList<LinkedList<String>> newPublicMethods = |
| | | new LinkedList<LinkedList<String>>(); |
| | | LinkedList<LinkedList<String>> newPublicMethods = new LinkedList<>(); |
| | | Class pluginClass = DirectoryServerPlugin.class; |
| | | for (Method m : pluginClass.getMethods()) |
| | | { |
| | |
| | | if (Modifier.isPublic(m.getModifiers()) && |
| | | (! Modifier.isAbstract(m.getModifiers()))) |
| | | { |
| | | LinkedList<String> foundList = new LinkedList<String>(); |
| | | LinkedList<String> foundList = new LinkedList<>(); |
| | | foundList.add(m.getName()); |
| | | foundList.add(m.getReturnType().getName()); |
| | | for (Class c : m.getParameterTypes()) |
| | |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | DN pluginEntryDN = DN.valueOf("cn=Null Plugin,cn=Plugins,cn=config"); |
| | | |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(); |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | for (PluginType t : PluginType.values()) |
| | | { |
| | | pluginTypes.add(t); |
| | |
| | | |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | |
| | | HashSet<PluginType> pluginTypes = new HashSet<PluginType>(); |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | for (PluginType t : PluginType.values()) |
| | | { |
| | | pluginTypes.add(t); |
| | |
| | | { |
| | | Reporter.log("Restoring global ACI attribute: " + globalACIAttribute); |
| | | |
| | | List<Modification> modifications = new ArrayList<Modification>(1); |
| | | List<Modification> modifications = new ArrayList<>(1); |
| | | modifications.add(new Modification(ModificationType.REPLACE, |
| | | globalACIAttribute)); |
| | | InternalClientConnection conn = |
| | |
| | | "allow (read) userdn=\"ldap:///anyone\";)"; |
| | | |
| | | private static final ByteArrayOutputStream oStream = new ByteArrayOutputStream(); |
| | | private static final ThreadLocal<Map<String,File>> tempLdifFile = |
| | | new ThreadLocal<Map<String,File>>(); |
| | | private static final ThreadLocal<Map<String, File>> tempLdifFile = new ThreadLocal<>(); |
| | | |
| | | |
| | | protected String pwdModify(String bindDn, String bindPassword, |
| | | String newPassword, String noOpControl, |
| | | String pwdPolicyControl, int expectedRc) { |
| | | |
| | | ArrayList<String> argList=new ArrayList<String>(20); |
| | | ArrayList<String> argList=new ArrayList<>(20); |
| | | argList.add("-h"); |
| | | argList.add("127.0.0.1"); |
| | | argList.add("-p"); |
| | |
| | | protected String LDAPSearchCtrl(String bindDn, String bindPassword, |
| | | String proxyDN, String controlStr, |
| | | String base, String filter, String attr) { |
| | | ArrayList<String> argList=new ArrayList<String>(20); |
| | | ArrayList<String> argList=new ArrayList<>(20); |
| | | argList.add("-h"); |
| | | argList.add("127.0.0.1"); |
| | | argList.add("-p"); |
| | |
| | | String base, String filter ,String attr, |
| | | boolean pwdPolicy, boolean reportAuthzID, |
| | | int expectedRc) { |
| | | List<String> argList = new ArrayList<String>(20); |
| | | List<String> argList = new ArrayList<>(20); |
| | | argList.add("-h"); |
| | | argList.add("127.0.0.1"); |
| | | argList.add("-p"); |
| | |
| | | private void _LDIFDelete(String dn, String bindDn, String bindPassword, |
| | | String controlStr, int expectedRc) |
| | | { |
| | | List<String> argList = new ArrayList<String>(20); |
| | | List<String> argList = new ArrayList<>(20); |
| | | argList.add("-h"); |
| | | argList.add("127.0.0.1"); |
| | | argList.add("-p"); |
| | |
| | | { |
| | | File tempFile = getTemporaryLdifFile(); |
| | | TestCaseUtils.writeFile(tempFile, ldif); |
| | | ArrayList<String> argList=new ArrayList<String>(20); |
| | | ArrayList<String> argList=new ArrayList<>(20); |
| | | argList.add("-h"); |
| | | argList.add("127.0.0.1"); |
| | | argList.add("-p"); |
| | |
| | | private File getTemporaryLdifFile() throws IOException { |
| | | Map<String,File> tempFilesForThisThread = tempLdifFile.get(); |
| | | if (tempFilesForThisThread == null) { |
| | | tempFilesForThisThread = new HashMap<String,File>(); |
| | | tempFilesForThisThread = new HashMap<>(); |
| | | tempLdifFile.set(tempFilesForThisThread); |
| | | } |
| | | File tempFile = tempFilesForThisThread.get("effectiverights-tests"); |
| | |
| | | { |
| | | StringReader r=new StringReader(resultString); |
| | | BufferedReader br=new BufferedReader(r); |
| | | Map<String, String> attrMap = new HashMap<String, String>(); |
| | | Map<String, String> attrMap = new HashMap<>(); |
| | | try { |
| | | while(true) { |
| | | String s = br.readLine(); |
| | |
| | | |
| | | private static final Map<String,String> DN_TO_PW; |
| | | static { |
| | | Map<String,String> dnToPw = new HashMap<String,String>(); |
| | | Map<String,String> dnToPw = new HashMap<>(); |
| | | dnToPw.put(DIR_MGR_DN, DIR_MGR_PW); |
| | | dnToPw.put(ADMIN_DN, ADMIN_PW); |
| | | dnToPw.put(ANNONYMOUS_DN, ANNONYMOUS_PW); |
| | |
| | | public Object[][] validBasisOfValidityTests() throws Exception { |
| | | TestCaseUtils.startServer(); // This appears to be necessary since the DataProviders can be called before @BeforeClass. |
| | | |
| | | List<String> acis = new ArrayList<String>(); |
| | | List<String> acis = new ArrayList<>(); |
| | | for (String[] aciAndMask: INVALID_ACIS_IF_ANY_CHAR_REMOVED) { |
| | | acis.add("aci: " + aciAndMask[0]); |
| | | } |
| | |
| | | public Object[][] invalidAcis() throws Exception { |
| | | TestCaseUtils.startServer(); // This appears to be necessary since the DataProviders can be called before @BeforeClass. |
| | | |
| | | List<String> invalid = new ArrayList<String>(Arrays.asList(INVALID_ACIS)); |
| | | List<String> invalid = new ArrayList<>(Arrays.asList(INVALID_ACIS)); |
| | | for (String[] aciAndMask: INVALID_ACIS_IF_ANY_CHAR_REMOVED) { |
| | | invalid.addAll(getAciMissingCharCombos(aciAndMask[0], aciAndMask[1])); |
| | | } |
| | |
| | | * is only removed if the corresponding mask character is a - or \" |
| | | */ |
| | | protected List<String> getAciMissingCharCombos(String aci, String mask) { |
| | | List <String> acisMissingOneChar = new ArrayList<String>(); |
| | | List <String> acisMissingOneChar = new ArrayList<>(); |
| | | for (int i = 0; i < aci.length(); i++) { |
| | | // Add this test only if the mask tells us we haven't seen it before. |
| | | // Also guard against ArrayIndexOutOfBoundsExceptions in case the |
| | |
| | | |
| | | /** Common between validAcis and invalidAcis. */ |
| | | private Object[][] buildAciValidationParams(List<String> acis, boolean testMultipleCombos) { |
| | | List<String[]> paramsList = new ArrayList<String[]>(); |
| | | List<String[]> paramsList = new ArrayList<>(); |
| | | |
| | | for (String aci: acis) { |
| | | List<String> aciLdifs = new ArrayList<String>(); |
| | | List<String> aciLdifs = new ArrayList<>(); |
| | | |
| | | // aci set in Add |
| | | aciLdifs.add(TestCaseUtils.makeLdif( |
| | |
| | | public Object[][] invalidAcisMultiCombos() throws Exception { |
| | | TestCaseUtils.startServer(); // This appears to be necessary since the DataProviders can be called before @BeforeClass. |
| | | |
| | | List<String> invalid = new ArrayList<String>(); |
| | | List<String> invalid = new ArrayList<>(); |
| | | invalid.add(INVALID_ACIS[0]); |
| | | invalid.add(INVALID_ACIS[1]); |
| | | |
| | |
| | | // * Who sets the ACIs to start with |
| | | // * Whether the entries were created with the ACIs or they were added later. LDIFModify would work here. |
| | | |
| | | private static List<SearchTestParams> SEARCH_TEST_PARAMS = new ArrayList<SearchTestParams>(); |
| | | private static List<SearchTestParams> SEARCH_TEST_PARAMS = new ArrayList<>(); |
| | | private static SearchTestParams registerNewTestParams(String initialDitLdif, String... aciLdif) { |
| | | SearchTestParams testParams = new SearchTestParams(initialDitLdif, aciLdif); |
| | | SEARCH_TEST_PARAMS.add(testParams); |
| | |
| | | |
| | | public String[] getLdapSearchArgs() |
| | | { |
| | | final List<String> args = new ArrayList<String>(); |
| | | final List<String> args = new ArrayList<>(); |
| | | |
| | | if (_bindDn.equals(ANNONYMOUS_DN)) |
| | | { |
| | |
| | | /** ACIs that will produce the same search results for the above DIT. */ |
| | | private final List<String> _equivalentAciLdifs; |
| | | |
| | | private final List<SingleSearchParams> _searchTests = new ArrayList<SingleSearchParams>(); |
| | | private final List<SingleSearchParams> _searchTests = new ArrayList<>(); |
| | | |
| | | public SearchTestParams(String initialDitLdif, String... equivalentAciLdifs) { |
| | | _initialDitLdif = initialDitLdif; |
| | |
| | | ByteArrayOutputStream updatedEntriesStream = new ByteArrayOutputStream(); |
| | | LDIFWriter ldifWriter = new LDIFWriter(new LDIFExportConfig(updatedEntriesStream)); |
| | | |
| | | List<LocalizableMessage> errors = new ArrayList<LocalizableMessage>(); |
| | | List<LocalizableMessage> errors = new ArrayList<>(); |
| | | LDIFModify.modifyLDIF(baseReader, changesReader, ldifWriter, errors); |
| | | Assert.assertTrue(errors.isEmpty(), "Unexpected errors applying LDIF changes: " + errors); |
| | | ldifWriter.flush(); |
| | |
| | | TestCaseUtils.startServer(); // This appears to be necessary since the DataProviders can be called before @BeforeClass. |
| | | |
| | | try { |
| | | List<Object[]> allTestParams = new ArrayList<Object[]>(); |
| | | List<Object[]> allTestParams = new ArrayList<>(); |
| | | |
| | | for (SearchTestParams testParams: SEARCH_TEST_PARAMS) { |
| | | for (SingleSearchParams singleTest: testParams._searchTests) { |
| | |
| | | throws Exception { |
| | | File tempFile = getTemporaryLdifFile(); |
| | | TestCaseUtils.writeFile(tempFile, ldif); |
| | | ArrayList<String> argList=new ArrayList<String>(20); |
| | | ArrayList<String> argList=new ArrayList<>(20); |
| | | argList.add("-h"); |
| | | argList.add("127.0.0.1"); |
| | | argList.add("-p"); |
| | |
| | | return COMMENTS_REGEX.matcher(ldif).replaceAll(""); |
| | | } |
| | | |
| | | private static ThreadLocal<Map<String,File>> _tempLdifFilesByName = new ThreadLocal<Map<String,File>>(); |
| | | private static ThreadLocal<Map<String,File>> _tempLdifFilesByName = new ThreadLocal<>(); |
| | | |
| | | /** |
| | | * To avoid a proliferation of temporary files, use the same ones over and over. |
| | |
| | | private File getTemporaryLdifFile(String name) throws IOException { |
| | | Map<String,File> tempFilesForThisThread = _tempLdifFilesByName.get(); |
| | | if (tempFilesForThisThread == null) { |
| | | tempFilesForThisThread = new HashMap<String,File>(); |
| | | tempFilesForThisThread = new HashMap<>(); |
| | | _tempLdifFilesByName.set(tempFilesForThisThread); |
| | | } |
| | | File tempFile = tempFilesForThisThread.get(name); |
| | |
| | | } |
| | | |
| | | private static String getNotThisDayOfWeek() { |
| | | Set<String> otherDays = new HashSet<String>(Arrays.asList(DAYS_OF_WEEK)); |
| | | Set<String> otherDays = new HashSet<>(Arrays.asList(DAYS_OF_WEEK)); |
| | | otherDays.remove(getThisDayOfWeek()); |
| | | String dayList = ""; |
| | | for (String otherDay: otherDays) { |
| | |
| | | */ |
| | | @Test |
| | | public void testAci() throws Exception { |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | int port = TestCaseUtils.getServerLdapPort(); |
| | | String url = "ldap://localhost:" + Integer.valueOf(port); |
| | |
| | | */ |
| | | @Test |
| | | public void testBypass() throws Exception { |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | int port = TestCaseUtils.getServerLdapPort(); |
| | | String url = "ldap://localhost:" + Integer.valueOf(port); |
| | |
| | | "--set", "quality-of-protection:" + "integrity"); |
| | | |
| | | //Configure JNDI props. |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | int port = TestCaseUtils.getServerLdapPort(); |
| | | String url = "ldap://localhost:" + Integer.valueOf(port); |
| | |
| | | "set-sasl-mechanism-handler-prop", |
| | | "--handler-name", "DIGEST-MD5", |
| | | "--set", "quality-of-protection:" + "confidentiality"); |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | int port = TestCaseUtils.getServerLdapPort(); |
| | | String url = "ldap://localhost:" + Integer.valueOf(port); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | */ |
| | | @Test(groups = { "precommit", "jeb" }, sequential = true) |
| | | public abstract class JebTestCase extends DirectoryServerTestCase { |
| | | private TreeMap<DN,Entry> entryTreeMap = new TreeMap<DN,Entry>(); |
| | | private TreeMap<DN,Entry> entryTreeMap = new TreeMap<>(); |
| | | private int numEntries; |
| | | |
| | | /** |
| | |
| | | File.separator + "resource"+File.separator+"MakeLDIF"; |
| | | TemplateFile templateFile = |
| | | new TemplateFile(makeLDIFPath, new Random()); |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<LocalizableMessage> warnings = new ArrayList<>(); |
| | | templateFile.parse(template, warnings); |
| | | MakeLDIFInputStream ldifEntryStream = |
| | | new MakeLDIFInputStream(templateFile); |
| | |
| | | public void testImportAll() throws Exception |
| | | { |
| | | TestCaseUtils.clearJEBackend(backendID); |
| | | ArrayList<String> fileList = new ArrayList<String>(); |
| | | ArrayList<String> fileList = new ArrayList<>(); |
| | | fileList.add(homeDirName + File.separator + "top.ldif"); |
| | | fileList.add(homeDirName + File.separator + "entries1.ldif"); |
| | | |
| | |
| | | @Test(dependsOnMethods = "testImportAll") |
| | | public void testImportPartial() throws Exception |
| | | { |
| | | ArrayList<String> fileList = new ArrayList<String>(); |
| | | ArrayList<String> fileList = new ArrayList<>(); |
| | | fileList.add(homeDirName + File.separator + "top.ldif"); |
| | | fileList.add(homeDirName + File.separator + "entries1.ldif"); |
| | | |
| | |
| | | zorroDN = DN.valueOf("uid=zorro,dc=vlvtest,dc=com"); |
| | | suffixDN = DN.valueOf("dc=vlvtest,dc=com"); |
| | | |
| | | expectedSortedValues = new TreeSet<SortValues>(); |
| | | expectedSortedValues = new TreeSet<>(); |
| | | |
| | | entries = TestCaseUtils.makeEntries( |
| | | "dn: dc=vlvtest,dc=com", |
| | |
| | | |
| | | private ArrayList<DN> getDNs(InternalSearchOperation internalSearch) |
| | | { |
| | | ArrayList<DN> results = new ArrayList<DN>(); |
| | | ArrayList<DN> results = new ArrayList<>(); |
| | | for (Entry e : internalSearch.getSearchEntries()) |
| | | { |
| | | results.add(e.getName()); |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, bigger |
| | | expectedDNOrder.add(albertSmithDN); // Albert, smaller sn |
| | | expectedDNOrder.add(lowercaseMcGeeDN); // lowercase |
| | |
| | | |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(samZweckDN); // Sam |
| | | expectedDNOrder.add(zorroDN); // No first name |
| | | expectedDNOrder.add(suffixDN); // No sort attributes |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(maryJonesDN); // Mary |
| | | expectedDNOrder.add(samZweckDN); // Sam |
| | | expectedDNOrder.add(zorroDN); // No first name |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | | expectedDNOrder.add(albertSmithDN); // Albert, higher entry ID |
| | | expectedDNOrder.add(lowercaseMcGeeDN); // lowercase |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | | expectedDNOrder.add(albertSmithDN); // Albert, higher entry ID |
| | |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | // Null values for given name are still bigger then zz |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(zorroDN); // No first name |
| | | expectedDNOrder.add(suffixDN); // No sort attributes |
| | | |
| | |
| | | */ |
| | | private Entry buildEntry(String dn) throws DirectoryException { |
| | | DN entryDN = DN.valueOf(dn); |
| | | HashMap<ObjectClass, String> ocs = new HashMap<ObjectClass, String>(2); |
| | | HashMap<ObjectClass, String> ocs = new HashMap<>(2); |
| | | ObjectClass topOC = DirectoryServer.getObjectClass(OC_TOP); |
| | | if (topOC == null) { |
| | | topOC = DirectoryServer.getDefaultObjectClass(OC_TOP); |
| | |
| | | @DataProvider(name = "substringsFilterData") |
| | | public Object[][] createSubstringsFilterData() |
| | | { |
| | | ArrayList<String> l = new ArrayList<String>(3) ; |
| | | ArrayList<String> l = new ArrayList<>(3) ; |
| | | l.add("subAny") ; |
| | | l.add("o") ; |
| | | l.add("fakesubAny"); |
| | |
| | | String rawAttTypeTest = type; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeType(type); |
| | | ByteString subInitialTest = ByteString.valueOf(subInitial); |
| | | List<ByteString> subAnyTest = |
| | | new ArrayList<ByteString>(subAny.size()); |
| | | List<ByteString> subAnyTest = new ArrayList<>(subAny.size()); |
| | | for (String s : subAny) |
| | | { |
| | | subAnyTest.add(ByteString.valueOf(s)); |
| | |
| | | @DataProvider(name = "passwordPolicyErrorTypeData") |
| | | public Object[][] createPasswordPolicyErrorTypeData() |
| | | { |
| | | HashMap<Integer, String> values = new HashMap<Integer, String>(); |
| | | HashMap<Integer, String> values = new HashMap<>(); |
| | | values.put(0, "passwordExpired"); |
| | | values.put(1, "accountLocked"); |
| | | values.put(2, "changeAfterReset"); |
| | |
| | | @DataProvider(name = "passwordPolicyWarningTypeData") |
| | | public Object[][] createPasswordPolicyWarningTypeData() |
| | | { |
| | | HashMap<Byte, String> values = new HashMap<Byte, String>(); |
| | | HashMap<Byte, String> values = new HashMap<>(); |
| | | values.put((byte)0x80, "timeBeforeExpiration"); |
| | | values.put((byte)0x81, "graceAuthNsRemaining"); |
| | | return new Object[][] { { values } }; |
| | |
| | | |
| | | try |
| | | { |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | BindRequestProtocolOp bindRequest = new BindRequestProtocolOp( |
| | |
| | | assertTrue(passwordPolicyControlExists(controls, PasswordPolicyErrorType.CHANGE_AFTER_RESET)); |
| | | |
| | | |
| | | ArrayList<RawAttribute> rawAttrs = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> rawAttrs = new ArrayList<>(); |
| | | rawAttrs.add(RawAttribute.create("objectClass", "organizationalUnit")); |
| | | rawAttrs.add(RawAttribute.create("ou", "People")); |
| | | |
| | | AddRequestProtocolOp addRequest = new AddRequestProtocolOp( |
| | | ByteString.valueOf("ou=People,o=test"), rawAttrs); |
| | | |
| | | controls = new ArrayList<Control>(); |
| | | controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, addRequest, controls); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawAttribute> rawAttrs = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> rawAttrs = new ArrayList<>(); |
| | | rawAttrs.add(RawAttribute.create("objectClass", "inetOrgPerson")); |
| | | rawAttrs.add(RawAttribute.create("uid", "test.user")); |
| | | rawAttrs.add(RawAttribute.create("givenName", "Test")); |
| | |
| | | AddRequestProtocolOp addRequest = new AddRequestProtocolOp( |
| | | ByteString.valueOf("ou=uid=test.user,o=test"), rawAttrs); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, addRequest, controls); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawAttribute> rawAttrs = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> rawAttrs = new ArrayList<>(); |
| | | rawAttrs.add(RawAttribute.create("objectClass", "inetOrgPerson")); |
| | | rawAttrs.add(RawAttribute.create("uid", "test.user")); |
| | | rawAttrs.add(RawAttribute.create("givenName", "Test")); |
| | |
| | | AddRequestProtocolOp addRequest = new AddRequestProtocolOp( |
| | | ByteString.valueOf("ou=uid=test.user,o=test"), rawAttrs); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, addRequest, controls); |
| | |
| | | ByteString.valueOf("uid=test.user,o=test"), 3, |
| | | ByteString.valueOf("password")); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | LDAPMessage message = new LDAPMessage(4, bindRequest, controls); |
| | |
| | | new CompareRequestProtocolOp(ByteString.valueOf("o=test"), "o", |
| | | ByteString.valueOf("test")); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, compareRequest, controls); |
| | |
| | | DeleteRequestProtocolOp deleteRequest = |
| | | new DeleteRequestProtocolOp(ByteString.valueOf("ou=People,o=test")); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, deleteRequest, controls); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "description", |
| | | "foo")); |
| | | |
| | | ModifyRequestProtocolOp modifyRequest = |
| | | new ModifyRequestProtocolOp(ByteString.valueOf(entryDN), mods); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, modifyRequest, controls); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "description", |
| | | "foo")); |
| | | |
| | | ModifyRequestProtocolOp modifyRequest = |
| | | new ModifyRequestProtocolOp(ByteString.valueOf(entryDN), mods); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | controls.add(new LDAPControl(OID_PROXIED_AUTH_V2, true, |
| | | ByteString.valueOf("dn:" + authzDN))); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "userPassword", |
| | | "newpassword")); |
| | | |
| | |
| | | new ModifyRequestProtocolOp( |
| | | ByteString.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, modifyRequest, controls); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "userPassword", |
| | | "password")); |
| | | |
| | |
| | | new ModifyRequestProtocolOp( |
| | | ByteString.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, modifyRequest, controls); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "userPassword", |
| | | "newpassword")); |
| | | |
| | |
| | | new ModifyRequestProtocolOp( |
| | | ByteString.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, modifyRequest, controls); |
| | |
| | | assertEquals(bindResponse.getResultCode(), LDAPResultCode.SUCCESS); |
| | | |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "userPassword", |
| | | "newpassword")); |
| | | |
| | |
| | | new ModifyRequestProtocolOp( |
| | | ByteString.valueOf("uid=test.user,o=test"), mods); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, modifyRequest, controls); |
| | |
| | | ByteString.valueOf("ou=People,o=test"), |
| | | ByteString.valueOf("ou=Users"), true); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, modifyDNRequest, controls); |
| | |
| | | LDAPFilter.objectClassPresent(), |
| | | new LinkedHashSet<String>()); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(new LDAPControl(OID_PASSWORD_POLICY_CONTROL, true)); |
| | | |
| | | message = new LDAPMessage(2, searchRequest, controls); |
| | |
| | | @DataProvider(name = "persistentSearchChangeTypeData") |
| | | public Object[][] createPersistentSearchChangeTypeData() |
| | | { |
| | | Map<Integer, String> values = new HashMap<Integer, String>(); |
| | | Map<Integer, String> values = new HashMap<>(); |
| | | values.put(1, "add"); |
| | | values.put(2, "delete"); |
| | | values.put(4, "modify"); |
| | |
| | | { |
| | | Set<Integer> keys = exceptedValues.keySet() ; |
| | | |
| | | Set<PersistentSearchChangeType> expectedTypes = |
| | | new HashSet<PersistentSearchChangeType>(4); |
| | | Set<PersistentSearchChangeType> expectedTypes = new HashSet<>(4); |
| | | |
| | | for (int i = 1; i <= 15; i++) |
| | | { |
| | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("1")); |
| | | LDAPAttribute attr = new LDAPAttribute("ds-cfg-max-psearches", values); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, attr)); |
| | | |
| | | ModifyOperation modifyOperation = |
| | |
| | | InternalSearchOperation internalSearch = conn.processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaronZimmermanDN); // Zeke |
| | | expectedDNOrder.add(samZweckDN); // Sam |
| | | expectedDNOrder.add(maryJonesDN); // Mary |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(lowercaseMcGeeDN); // lowercase |
| | | expectedDNOrder.add(aaronZimmermanDN); // Zeke |
| | | expectedDNOrder.add(samZweckDN); // Sam |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertSmithDN); // Albert, lower sn |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, higher sn |
| | |
| | | |
| | | private ArrayList<DN> getDNs(LinkedList<SearchResultEntry> searchEntries) |
| | | { |
| | | ArrayList<DN> results = new ArrayList<DN>(); |
| | | ArrayList<DN> results = new ArrayList<>(); |
| | | for (Entry e : searchEntries) |
| | | { |
| | | results.add(e.getName()); |
| | |
| | | return results; |
| | | } |
| | | } |
| | | |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | | expectedDNOrder.add(albertSmithDN); // Albert, higher entry ID |
| | | expectedDNOrder.add(lowercaseMcGeeDN); // lowercase |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(maryJonesDN); // Mary |
| | | expectedDNOrder.add(samZweckDN); // Sam |
| | | expectedDNOrder.add(zorroDN); // No first name |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(maryJonesDN); // Mary |
| | | expectedDNOrder.add(samZweckDN); // Sam |
| | | expectedDNOrder.add(zorroDN); // No first name |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaccfJohnsonDN); // Aaccf |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | | expectedDNOrder.add(albertSmithDN); // Albert, higher entry ID |
| | | expectedDNOrder.add(lowercaseMcGeeDN); // lowercase |
| | |
| | | InternalSearchOperation internalSearch = getRootConnection().processSearch(request); |
| | | assertEquals(internalSearch.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(aaronZimmermanDN); // Aaron |
| | | expectedDNOrder.add(albertZimmermanDN); // Albert, lower entry ID |
| | | expectedDNOrder.add(albertSmithDN); // Albert, higher entry ID |
| | |
| | | |
| | | private ArrayList<DN> getDNs(LinkedList<SearchResultEntry> entries) |
| | | { |
| | | ArrayList<DN> results = new ArrayList<DN>(); |
| | | ArrayList<DN> results = new ArrayList<>(); |
| | | for (Entry e : entries) |
| | | { |
| | | results.add(e.getName()); |
| | |
| | | // Create an add request and send it to the server. Make sure to include |
| | | // the delay request control so it won't complete before we can send the |
| | | // abandon request. |
| | | ArrayList<RawAttribute> attributes = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> attributes = new ArrayList<>(); |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(2); |
| | | ArrayList<ByteString> values = new ArrayList<>(2); |
| | | values.add(ByteString.valueOf("top")); |
| | | values.add(ByteString.valueOf("organizationalUnit")); |
| | | attributes.add(new LDAPAttribute("objectClass", values)); |
| | | |
| | | values = new ArrayList<ByteString>(1); |
| | | values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf("People")); |
| | | attributes.add(new LDAPAttribute("ou", values)); |
| | | |
| | |
| | | // Create a modify request and send it to the server. Make sure to include |
| | | // the delay request control so it won't complete before we can send the |
| | | // abandon request. |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf("foo")); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(1); |
| | | ArrayList<RawModification> mods = new ArrayList<>(1); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("description", values))); |
| | | |
| | |
| | | @DataProvider(name = "addOperations") |
| | | public Object[][] getAddOperations() throws Exception |
| | | { |
| | | ArrayList<Control> noControls = new ArrayList<Control>(); |
| | | ArrayList<Control> noControls = new ArrayList<>(); |
| | | |
| | | ArrayList<RawAttribute> ldapAttrList = newRawAttributes( |
| | | new LDAPAttribute("objectclass", byteStrings("top", "organizationalUnit")), |
| | |
| | | |
| | | private ArrayList<RawAttribute> newRawAttributes(RawAttribute... attributes) |
| | | { |
| | | return new ArrayList<RawAttribute>(Arrays.asList(attributes)); |
| | | return new ArrayList<>(Arrays.asList(attributes)); |
| | | } |
| | | |
| | | private ArrayList<ByteString> byteStrings(final String... v) |
| | | { |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | for (String s : v) |
| | | { |
| | | values.add(ByteString.valueOf(s)); |
| | |
| | | assertNotNull(rawAttrs); |
| | | assertFalse(rawAttrs.isEmpty()); |
| | | |
| | | ArrayList<RawAttribute> copiedAttrs = new ArrayList<RawAttribute>(rawAttrs); |
| | | ArrayList<RawAttribute> copiedAttrs = new ArrayList<>(rawAttrs); |
| | | copiedAttrs.add(new LDAPAttribute("description", byteStrings("foo"))); |
| | | addOperation.setRawAttributes(copiedAttrs); |
| | | |
| | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | // Modify the backend to enable it. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-enabled", "true"))); |
| | | ModifyOperation modifyOperation = |
| | |
| | | |
| | | |
| | | // Modify the backend to disable it. |
| | | mods = new ArrayList<Modification>(); |
| | | mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-enabled", "false"))); |
| | | modifyOperation = conn.processModify(backendEntry.getName(), mods); |
| | |
| | | |
| | | |
| | | // Disable the intermediate (child) backend. This should be allowed. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, Attributes.create("ds-cfg-enabled", "false"))); |
| | | ModifyOperation modifyOperation = |
| | | conn.processModify(childBackendEntry.getName(), mods); |
| | |
| | | |
| | | |
| | | // Re-enable the intermediate backend. |
| | | mods = new ArrayList<Modification>(); |
| | | mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-enabled", "true"))); |
| | | modifyOperation = conn.processModify(childBackendEntry.getName(), mods); |
| | |
| | | assertNotNull(baseDNs); |
| | | assertFalse(baseDNs.length == 0); |
| | | |
| | | ArrayList<String> lines = new ArrayList<String>(); |
| | | ArrayList<String> lines = new ArrayList<>(); |
| | | lines.add("dn: ds-cfg-backend-id=" + backendID + ",cn=Backends,cn=config"); |
| | | lines.add("objectClass: top"); |
| | | lines.add("objectClass: ds-cfg-backend"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ArrayList<Control> noControls = new ArrayList<Control>(0); |
| | | ArrayList<Control> noControls = new ArrayList<>(0); |
| | | ByteString nullOS = null; |
| | | DN nullDN = null; |
| | | |
| | |
| | | { |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | ArrayList<Control> noControls = new ArrayList<Control>(0); |
| | | ArrayList<Control> noControls = new ArrayList<>(0); |
| | | ByteString nullOS = null; |
| | | DN nullDN = null; |
| | | |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(1); |
| | | ArrayList<Control> requestControls = new ArrayList<>(1); |
| | | requestControls.add(new LDAPControl("1.2.3.4", true)); |
| | | |
| | | BindOperationBasis bindOperation = |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(1); |
| | | ArrayList<Control> requestControls = new ArrayList<>(1); |
| | | requestControls.add(new LDAPControl("1.2.3.4", true)); |
| | | |
| | | ByteString saslCreds = |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(1); |
| | | ArrayList<Control> requestControls = new ArrayList<>(1); |
| | | requestControls.add(new LDAPControl("1.2.3.4", false)); |
| | | |
| | | BindOperationBasis bindOperation = |
| | |
| | | InternalClientConnection conn = |
| | | new InternalClientConnection(new AuthenticationInfo()); |
| | | |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(1); |
| | | ArrayList<Control> requestControls = new ArrayList<>(1); |
| | | requestControls.add(new LDAPControl("1.2.3.4", false)); |
| | | |
| | | ByteString saslCreds = |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | |
| | | String attr = "ds-cfg-bind-with-dn-requires-password"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "false"))); |
| | | ModifyOperation modifyOperation = |
| | |
| | | LDAPFilter ldapFilter = LDAPFilter.decode("(preferredlanguage=ja)"); |
| | | LDAPAssertionRequestControl assertControl = |
| | | new LDAPAssertionRequestControl(true, ldapFilter); |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(assertControl); |
| | | |
| | | CompareOperationBasis compareOperation = |
| | |
| | | LDAPFilter ldapFilter = LDAPFilter.decode("(preferredlanguage=en)"); |
| | | LDAPAssertionRequestControl assertControl = |
| | | new LDAPAssertionRequestControl(true, ldapFilter); |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(assertControl); |
| | | |
| | | CompareOperationBasis compareOperation = |
| | |
| | | ProxiedAuthV1Control authV1Control = |
| | | new ProxiedAuthV1Control(ByteString.valueOf( |
| | | "cn=Directory Manager,cn=Root DNs,cn=config")); |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(authV1Control); |
| | | |
| | | CompareOperationBasis compareOperation = |
| | |
| | | |
| | | ProxiedAuthV1Control authV1Control = |
| | | new ProxiedAuthV1Control(ByteString.valueOf("cn=nonexistent,o=test")); |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(authV1Control); |
| | | |
| | | CompareOperationBasis compareOperation = |
| | |
| | | ProxiedAuthV2Control authV2Control = |
| | | new ProxiedAuthV2Control(ByteString.valueOf( |
| | | "dn:cn=Directory Manager,cn=Root DNs,cn=config")); |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(authV2Control); |
| | | |
| | | CompareOperationBasis compareOperation = |
| | |
| | | |
| | | ProxiedAuthV2Control authV2Control = new ProxiedAuthV2Control( |
| | | ByteString.valueOf("dn:cn=nonexistent,o=test")); |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(authV2Control); |
| | | |
| | | CompareOperationBasis compareOperation = |
| | |
| | | new LDAPControl(ServerConstants.OID_PROXIED_AUTH_V2, false, |
| | | ByteString.empty()); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(authV2Control); |
| | | |
| | | CompareOperationBasis compareOperation = |
| | |
| | | LDAPFilter.decode("(preferredlanguage=ja)"); |
| | | LDAPControl assertControl = |
| | | new LDAPControl("1.1.1.1.1.1", true); |
| | | List<Control> controls = new ArrayList<Control>(); |
| | | List<Control> controls = new ArrayList<>(); |
| | | controls.add(assertControl); |
| | | CompareOperationBasis compareOperation = |
| | | new CompareOperationBasis( |
| | |
| | | @Override |
| | | protected Operation[] createTestOperations() throws Exception |
| | | { |
| | | List<Control> noControls = new ArrayList<Control>(); |
| | | List<Control> noControls = new ArrayList<>(); |
| | | return new Operation[] |
| | | { |
| | | newDeleteOperation(noControls, ByteString.empty()), |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | { |
| | | GroupManager groupManager = DirectoryServer.getGroupManager(); |
| | | |
| | | LinkedHashSet<Class> groupClasses = new LinkedHashSet<Class>(); |
| | | LinkedHashSet<Class> groupClasses = new LinkedHashSet<>(); |
| | | groupClasses.add(StaticGroup.class); |
| | | groupClasses.add(DynamicGroup.class); |
| | | groupClasses.add(VirtualStaticGroup.class); |
| | |
| | | group1Instance.addMember(user4Entry); |
| | | //Switch things around, change groups and members to odd numbered nested |
| | | //groups and odd numbered members via ldap modify. |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | Attribute g1 = Attributes.create("member", "cn=group 1,ou=Groups,o=test"); |
| | | Attribute g2 = Attributes.create("member", "cn=group 2,ou=Groups,o=test"); |
| | | Attribute g3 = Attributes.create("member", "cn=group 3,ou=Groups,o=test"); |
| | |
| | | "it didn't"); |
| | | } catch (DirectoryException ex) {} |
| | | //Modify list via ldap modify. |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | Attribute a2 = Attributes.create("member", "cn=group 2,ou=Groups,o=test"); |
| | | Attribute a3 = Attributes.create("member", "cn=group 1,ou=Groups,o=test"); |
| | | mods.add(new Modification(ModificationType.DELETE, a2)); |
| | |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | |
| | | // Modify the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | // Modify the group and make sure the group manager gets updated accordingly |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | Attribute a2 = Attributes.create("member", "uid=user.2,ou=People,o=test"); |
| | | Attribute a3 = Attributes.create("member", "uid=user.3,ou=People,o=test"); |
| | | mods.add(new Modification(ModificationType.DELETE, a2)); |
| | |
| | | assertTrue(groupInstance.isMember(user3DN)); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | DeleteOperation deleteOperation = conn.processDelete(groupDN); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(groupManager.getGroupInstance(groupDN)); |
| | |
| | | assertFalse(groupInstance.getMembers().hasMoreMembers()); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = conn.processDelete(groupDN); |
| | |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | |
| | | // Modify the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | // Modify the group and make sure the group manager gets updated accordingly |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | Attribute a2 = Attributes.create("uniquemember", "uid=user.2,ou=People,o=test"); |
| | | Attribute a3 = Attributes.create("uniquemember", "uid=user.3,ou=People,o=test"); |
| | | mods.add(new Modification(ModificationType.DELETE, a2)); |
| | |
| | | assertTrue(groupInstance.isMember(user3DN)); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | DeleteOperation deleteOperation = conn.processDelete(groupDN); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(groupManager.getGroupInstance(groupDN)); |
| | |
| | | assertFalse(groupInstance.getMembers().hasMoreMembers()); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = conn.processDelete(groupDN); |
| | |
| | | assertFalse(memberList.hasMoreMembers()); |
| | | |
| | | |
| | | // Modify the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | // Modify the group and make sure the group manager gets updated accordingly |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | Attribute a2 = Attributes.create("member", "uid=user.2,ou=People,o=test"); |
| | | Attribute a3 = Attributes.create("member", "uid=user.3,ou=People,o=test"); |
| | | mods.add(new Modification(ModificationType.DELETE, a2)); |
| | |
| | | assertTrue(groupInstance.isMember(user3DN)); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | DeleteOperation deleteOperation = conn.processDelete(groupDN); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(groupManager.getGroupInstance(groupDN)); |
| | |
| | | assertFalse(groupInstance.getMembers().hasMoreMembers()); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = conn.processDelete(groupDN); |
| | |
| | | assertTrue(groupInstance.isMember(user1DN)); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | DeleteOperation deleteOperation = conn.processDelete(newDN); |
| | | assertEquals(deleteOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertNull(groupManager.getGroupInstance(newDN)); |
| | |
| | | assertTrue(groupSet.contains(group3)); |
| | | |
| | | |
| | | // Delete all of the groups and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete all of the groups and make sure the group manager gets updated accordingly |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = conn.processDelete(group1DN); |
| | |
| | | memberList.close(); |
| | | |
| | | |
| | | // Delete the group and make sure the group manager gets updated |
| | | // accordingly. |
| | | // Delete the group and make sure the group manager gets updated accordingly |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | | DeleteOperation deleteOperation = conn.processDelete(groupDN); |
| | |
| | | assertNotNull(groupInstance); |
| | | |
| | | |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<DN>(); |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<>(); |
| | | memberSet.add(user1DN); |
| | | memberSet.add(user2DN); |
| | | |
| | |
| | | assertNotNull(groupInstance); |
| | | |
| | | |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<DN>(); |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<>(); |
| | | memberSet.add(user1DN); |
| | | |
| | | MemberList memberList = groupInstance.getMembers( |
| | |
| | | groupInstance.toString(); |
| | | |
| | | |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<DN>(); |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<>(); |
| | | memberSet.add(user1DN); |
| | | memberSet.add(user2DN); |
| | | |
| | |
| | | groupInstance.toString(); |
| | | |
| | | |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<DN>(); |
| | | LinkedHashSet<DN> memberSet = new LinkedHashSet<>(); |
| | | memberSet.add(user1DN); |
| | | memberSet.add(user2DN); |
| | | |
| | |
| | | @DataProvider(name = "modifyOperations") |
| | | public Object[][] getModifyOperations() throws Exception |
| | | { |
| | | List<ModifyOperation> opList = new ArrayList<ModifyOperation>(); |
| | | List<ModifyOperation> opList = new ArrayList<>(); |
| | | |
| | | List<Control> noControls = new ArrayList<Control>(); |
| | | List<Control> noControls = new ArrayList<>(); |
| | | |
| | | LDAPAttribute ldapAttr = new LDAPAttribute("description", "foo"); |
| | | List<RawModification> ldapMods = newRawModifications(add(ldapAttr)); |
| | |
| | | |
| | | private LDAPAttribute newLDAPAttribute(String attributeType, String... valueStrings) |
| | | { |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | for (String valueStr : valueStrings) |
| | | { |
| | | values.add(ByteString.valueOf(valueStr)); |
| | |
| | | throws Exception |
| | | { |
| | | List<RawModification> rawMods = modifyOperation.getRawModifications(); |
| | | List<RawModification> clonedMods = new ArrayList<RawModification>(rawMods); |
| | | List<RawModification> clonedMods = new ArrayList<>(rawMods); |
| | | modifyOperation.setRawModifications(clonedMods); |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("test", "test"); |
| | |
| | | LDAPAttribute attr = newLDAPAttribute("givenName", "Test"); |
| | | List<RawModification> mods = newRawModifications(add(attr)); |
| | | |
| | | List<Control> requestControls = new ArrayList<Control>(); |
| | | List<Control> requestControls = new ArrayList<>(); |
| | | requestControls.add( |
| | | new LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); |
| | | |
| | |
| | | LDAPAttribute attr = newLDAPAttribute("givenName", "Foo"); |
| | | List<RawModification> mods = newRawModifications(delete(attr)); |
| | | |
| | | List<Control> requestControls = new ArrayList<Control>(); |
| | | List<Control> requestControls = new ArrayList<>(); |
| | | requestControls.add( |
| | | new LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); |
| | | |
| | |
| | | LDAPAttribute attr = new LDAPAttribute("description"); |
| | | List<RawModification> mods = newRawModifications(delete(attr)); |
| | | |
| | | List<Control> requestControls = new ArrayList<Control>(); |
| | | List<Control> requestControls = new ArrayList<>(); |
| | | requestControls.add( |
| | | new LDAPControl(ServerConstants.OID_PERMISSIVE_MODIFY_CONTROL, false)); |
| | | |
| | |
| | | "axuJ8LFNbZtsp1ldW3i84+F5+SYT+xI67ZcoAtwx/VFVI9s5I/Gkmu9f9nxjPpK7" + |
| | | "1AIUXiE3Qcck"; |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.wrap(Base64.decode(certificateValue))); |
| | | LDAPAttribute attr = new LDAPAttribute("usercertificate", values); |
| | | ModifyOperation modifyOperation = processModify("uid=test.user," + baseDN, add(attr)); |
| | |
| | | { |
| | | String pluginBase = ",cn=Plugins,cn=config"; |
| | | |
| | | ArrayList<DN> dnList = new ArrayList<DN>(); |
| | | ArrayList<DN> dnList = new ArrayList<>(); |
| | | 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()); |
| | | ArrayList<DirectoryServerPlugin> pluginList = new ArrayList<>(dnList.size()); |
| | | for (DN dn : dnList) |
| | | { |
| | | DirectoryServerPlugin p = |
| | |
| | | @Test |
| | | public void testSearchExternalAllUserAttributes() throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("*"); |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | @Test |
| | | public void testSearchExternalAllUserAttributesOmitValues() throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("*"); |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | @Test |
| | | public void testSearchExternalObjectClassAttribute() throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("objectclass"); |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | public void testSearchExternalObjectClassAttributeOmitValues() |
| | | throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("objectclass"); |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | @Test |
| | | public void testSearchExternalSelectedAttributes() throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("uid"); |
| | | attributes.add("createtimestamp"); |
| | | SearchRequestProtocolOp searchRequest = |
| | |
| | | @Test |
| | | public void testSearchExternalAttributeWithSubtypes() throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("title"); |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | public void testSearchExternalAttributeWithSubtypesOmitValues() |
| | | throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("title"); |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | @Test |
| | | public void testSearchExternalAttributeWithOptions() throws Exception |
| | | { |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(); |
| | | attributes.add("title;lang-ja;phonetic"); |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | LDAPFilter ldapFilter = LDAPFilter.decode("(title=*director*)"); |
| | | MatchedValuesFilter matchedValuesFilter = |
| | | MatchedValuesFilter.createFromLDAPFilter(ldapFilter); |
| | | ArrayList<MatchedValuesFilter> filters = |
| | | new ArrayList<MatchedValuesFilter>(); |
| | | ArrayList<MatchedValuesFilter> filters = new ArrayList<>(); |
| | | filters.add(matchedValuesFilter); |
| | | MatchedValuesControl mvc = new MatchedValuesControl(true, filters); |
| | | ArrayList<Control> controls = new ArrayList<Control>(); |
| | | ArrayList<Control> controls = new ArrayList<>(); |
| | | controls.add(mvc); |
| | | |
| | | SearchRequestProtocolOp searchRequest = |
| | |
| | | assertEquals(entry.getName(), userDN); |
| | | |
| | | // Check real attributes. |
| | | List<String> messages = new LinkedList<String>(); |
| | | List<String> messages = new LinkedList<>(); |
| | | for (String attrType : realAttrTypes) |
| | | { |
| | | List<Attribute> attrList = entry.getAttribute(attrType); |
| | |
| | | // Check all expected attributes are present and have |
| | | // the user requested name. |
| | | List<Attribute> attrList = entry.getAttributes(); |
| | | Set<String> actualNames = new HashSet<String>(); |
| | | Set<String> actualNames = new HashSet<>(); |
| | | for (Attribute attribute : attrList) |
| | | { |
| | | actualNames.add(attribute.getNameWithOptions()); |
| | |
| | | "cn;lang-fr: Test Usager", |
| | | "userPassword: password"); |
| | | |
| | | LinkedHashSet<String> attributes = |
| | | new LinkedHashSet<String>(requestedAttributes); |
| | | LinkedHashSet<String> attributes = new LinkedHashSet<>(requestedAttributes); |
| | | |
| | | SearchRequestProtocolOp searchRequest = |
| | | new SearchRequestProtocolOp( |
| | |
| | | // Check all expected attributes are present and have |
| | | // the user requested name. |
| | | LinkedList<LDAPAttribute> attrList = entry.getAttributes(); |
| | | Set<String> actualNames = new HashSet<String>(); |
| | | Set<String> actualNames = new HashSet<>(); |
| | | for (LDAPAttribute attribute : attrList) |
| | | { |
| | | actualNames.add(attribute.getAttributeType()); |
| | |
| | | |
| | | private List<Entry> getEntries(List<SubEntry> subentries) |
| | | { |
| | | final List<Entry> results = new ArrayList<Entry>(); |
| | | final List<Entry> results = new ArrayList<>(); |
| | | for (SubEntry subEntry : subentries) |
| | | { |
| | | results.add(subEntry.getEntry()); |
| | |
| | | |
| | | private List<DN> getDns(List<SubEntry> subentries) |
| | | { |
| | | final List<DN> results = new ArrayList<DN>(); |
| | | final List<DN> results = new ArrayList<>(); |
| | | for (SubEntry subEntry : subentries) |
| | | { |
| | | results.add(subEntry.getDN()); |
| | |
| | | */ |
| | | protected final Entry createEntry(DN entryDN, |
| | | Set<ObjectClass> objectClasses) { |
| | | HashMap<ObjectClass, String> map = new HashMap<ObjectClass, String>(); |
| | | HashMap<ObjectClass, String> map = new HashMap<>(); |
| | | |
| | | for (ObjectClass oc : objectClasses) { |
| | | if (oc != null) { |
| | |
| | | */ |
| | | @BeforeClass |
| | | public final void setUp() throws Exception { |
| | | // This test suite depends on having the schema available, so we'll start |
| | | // the server. |
| | | // This test suite depends on having the schema available, so we'll start the server. |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Retrieve required object classes. |
| | | objectClasses = new HashSet<ObjectClass>(); |
| | | objectClasses = new HashSet<>(); |
| | | |
| | | ObjectClass oc = DirectoryServer.getObjectClass("top"); |
| | | if (oc == null) { |
| | |
| | | @Test(expectedExceptions=InvalidNameException.class) |
| | | public void testInvalidModRDN() throws Exception |
| | | { |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | | Hashtable<String,String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); |
| | | String url = "ldap://localhost:" + TestCaseUtils.getServerLdapPort() |
| | | +"/dc=example,dc=com"; |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString pwOS = ByteString.valueOf(password); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", password))); |
| | | |
| | |
| | | // Create an add request and send it to the server. Make sure to include |
| | | // the delay request control so it won't complete before we can send the |
| | | // cancel request. |
| | | ArrayList<RawAttribute> attributes = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> attributes = new ArrayList<>(); |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(2); |
| | | ArrayList<ByteString> values = new ArrayList<>(2); |
| | | values.add(ByteString.valueOf("top")); |
| | | values.add(ByteString.valueOf("organizationalUnit")); |
| | | attributes.add(new LDAPAttribute("objectClass", values)); |
| | | |
| | | values = new ArrayList<ByteString>(1); |
| | | values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf("People")); |
| | | attributes.add(new LDAPAttribute("ou", values)); |
| | | |
| | |
| | | // Create a modify request and send it to the server. Make sure to include |
| | | // the delay request control so it won't complete before we can send the |
| | | // cancel request. |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> values = new ArrayList<>(1); |
| | | values.add(ByteString.valueOf("foo")); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(1); |
| | | ArrayList<RawModification> mods = new ArrayList<>(1); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("description", values))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString pwOS = ByteString.valueOf(password); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", password))); |
| | | |
| | |
| | | public void testNoExtensibleObjects() |
| | | throws Exception |
| | | { |
| | | ArrayList<DN> violatingDNs = new ArrayList<DN>(); |
| | | ArrayList<DN> violatingDNs = new ArrayList<>(); |
| | | recursivelyTestNoExtensibleObjects( |
| | | DirectoryServer.getConfigHandler().getConfigRootEntry(), violatingDNs); |
| | | |
| | |
| | | Entry cacheFIFOConfigEntry; |
| | | |
| | | /** The entry cache order map sorted by the cache level. */ |
| | | private SortedMap<Integer, EntryCache<? extends EntryCacheCfg>> |
| | | cacheOrderMap = new TreeMap<Integer, |
| | | EntryCache<? extends EntryCacheCfg>>(); |
| | | private SortedMap<Integer, EntryCache<? extends EntryCacheCfg>> cacheOrderMap = new TreeMap<>(); |
| | | |
| | | // Dummy test entries for each participating implementation. |
| | | private ArrayList<Entry> testSoftRefEntriesList; |
| | |
| | | } |
| | | |
| | | // Make some dummy test entries. |
| | | super.testEntriesList = new ArrayList<Entry>(super.NUMTESTENTRIES); |
| | | super.testEntriesList = new ArrayList<>(super.NUMTESTENTRIES); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | super.testEntriesList.add(TestCaseUtils.makeEntry( |
| | | "dn: uid=test" + i + ".user" + i + ",ou=test" + i + ",o=test", |
| | |
| | | "uid: test" + i + ".user" + i) |
| | | ); |
| | | } |
| | | testSoftRefEntriesList = new ArrayList<Entry>(super.NUMTESTENTRIES); |
| | | testSoftRefEntriesList = new ArrayList<>(super.NUMTESTENTRIES); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | testSoftRefEntriesList.add(TestCaseUtils.makeEntry( |
| | | "dn: uid=softref" + i + ".user" + i + ",ou=test" + i + ",o=test", |
| | |
| | | "uid: softref" + i + ".user" + i) |
| | | ); |
| | | } |
| | | testFIFOEntriesList = new ArrayList<Entry>(super.NUMTESTENTRIES); |
| | | testFIFOEntriesList = new ArrayList<>(super.NUMTESTENTRIES); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | testFIFOEntriesList.add(TestCaseUtils.makeEntry( |
| | | "dn: uid=fifo" + i + ".user" + i + ",ou=test" + i + ",o=test", |
| | |
| | | throws Exception |
| | | { |
| | | // Unplug all cache implementations from default entry cache. |
| | | SortedMap<Integer, EntryCache<? extends EntryCacheCfg>> |
| | | emptyCacheOrderMap = new TreeMap<Integer, |
| | | EntryCache<? extends EntryCacheCfg>>(); |
| | | SortedMap<Integer, EntryCache<? extends EntryCacheCfg>> emptyCacheOrderMap = new TreeMap<>(); |
| | | final Method[] defaultCacheMethods = |
| | | super.cache.getClass().getDeclaredMethods(); |
| | | for (int i = 0; i < defaultCacheMethods.length; ++i) { |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString pwOS = ByteString.valueOf(password); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", password))); |
| | | |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | * Portions Copyright 2012-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | |
| | | private final EntityTagVirtualAttributeCfg config = new EntityTagVirtualAttributeCfg() |
| | | { |
| | | private final TreeSet<AttributeType> excludedAttributes = new TreeSet<AttributeType>(); |
| | | private final TreeSet<AttributeType> excludedAttributes = new TreeSet<>(); |
| | | |
| | | @Override |
| | | public void addChangeListener( |
| | |
| | | "o: test"); |
| | | entry.processVirtualAttributes(); |
| | | |
| | | LinkedList<ByteString> subAny = new LinkedList<ByteString>(); |
| | | LinkedList<ByteString> subAny = new LinkedList<>(); |
| | | subAny.add(ByteString.valueOf("=")); |
| | | |
| | | assertEquals(provider.matchesSubstring(entry, getRule(provider), null, subAny, null), |
| | |
| | | PasswordPolicy policy = (PasswordPolicy) AuthenticationPolicy.forUser( |
| | | userEntry, false); |
| | | |
| | | HashMap<AccountStatusNotificationProperty,List<String>> |
| | | notificationProperties = |
| | | new HashMap<AccountStatusNotificationProperty,List<String>>(); |
| | | HashMap<AccountStatusNotificationProperty, List<String>> notificationProperties = new HashMap<>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(1); |
| | | ArrayList<String> propList = new ArrayList<>(1); |
| | | propList.add(policy.getDN().toString()); |
| | | notificationProperties.put(PASSWORD_POLICY_DN, propList); |
| | | |
| | | |
| | | if (notificationType == ACCOUNT_TEMPORARILY_LOCKED) |
| | | { |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add("300"); |
| | | notificationProperties.put(SECONDS_UNTIL_UNLOCK, propList); |
| | | |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add("5 minutes"); |
| | | notificationProperties.put(TIME_UNTIL_UNLOCK, propList); |
| | | |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(new Date(System.currentTimeMillis() + 300000L).toString()); |
| | | notificationProperties.put(ACCOUNT_UNLOCK_TIME, propList); |
| | | } |
| | | else if (notificationType == PASSWORD_EXPIRING) |
| | | { |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add("86400"); |
| | | notificationProperties.put(SECONDS_UNTIL_EXPIRATION, propList); |
| | | |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add("1 day"); |
| | | notificationProperties.put(TIME_UNTIL_EXPIRATION, propList); |
| | | |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add(new Date(System.currentTimeMillis() + 86400000L).toString()); |
| | | notificationProperties.put(PASSWORD_EXPIRATION_TIME, propList); |
| | | } |
| | | else if ((notificationType == PASSWORD_CHANGED) || |
| | | (notificationType == PASSWORD_RESET)) |
| | | { |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add("oldpassword"); |
| | | notificationProperties.put(OLD_PASSWORD, propList); |
| | | |
| | | propList = new ArrayList<String>(1); |
| | | propList = new ArrayList<>(1); |
| | | propList.add("newpassword"); |
| | | notificationProperties.put(NEW_PASSWORD, propList); |
| | | } |
| | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | // Create a modification to change the map attribute from uid to cn. |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("cn")); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("ds-cfg-match-attribute", |
| | | values))); |
| | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | // Create a modification to set the map base DN to "dc=example,dc=com". |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("dc=example,dc=com")); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("ds-cfg-match-base-dn", |
| | | values))); |
| | |
| | | throws Exception |
| | | { |
| | | // Create a modification to remove the match attribute. |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("ds-cfg-match-attribute"))); |
| | | InternalClientConnection conn = |
| | |
| | | throws Exception |
| | | { |
| | | // Create a modification to remove the match attribute. |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("undefinedAttribute")); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("ds-cfg-match-attribute", |
| | | values))); |
| | |
| | | throws Exception |
| | | { |
| | | // Create a modification to remove the match attribute. |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("invalidDN")); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("ds-cfg-match-base-dn", |
| | | values))); |
| | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String attrName = "ds-cfg-certificate-validation-policy"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "always"))); |
| | | ModifyOperation modifyOperation = |
| | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String attrName = "ds-cfg-certificate-validation-policy"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "always"))); |
| | | ModifyOperation modifyOperation = |
| | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | String dnStr = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String attrName = "ds-cfg-certificate-validation-policy"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attrName, "always"))); |
| | | ModifyOperation modifyOperation = |
| | |
| | | super.cache.initializeEntryCache(configuration); |
| | | |
| | | // Make some dummy test entries. |
| | | super.testEntriesList = new ArrayList<Entry>(super.NUMTESTENTRIES); |
| | | super.testEntriesList = new ArrayList<>(super.NUMTESTENTRIES); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | super.testEntriesList.add(TestCaseUtils.makeEntry( |
| | | "dn: uid=test" + i + ".user" + i + ",ou=test" + i + ",o=test", |
| | |
| | | Attributes.empty(DirectoryServer.getAttributeType( |
| | | "ds-cfg-fingerprint-attribute")); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, a)); |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | Attributes.empty(DirectoryServer.getAttributeType( |
| | | "ds-cfg-fingerprint-algorithm")); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, a)); |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-certificate-mapper", |
| | | mapperDN))); |
| | |
| | | String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String mapperDN = "cn=Subject Equals DN,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-certificate-mapper", |
| | | mapperDN))); |
| | |
| | | { |
| | | String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-fingerprint-attribute", |
| | | attrName))); |
| | |
| | | { |
| | | String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-fingerprint-algorithm", |
| | | algorithm))); |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | builder.toAttribute())); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | |
| | | VirtualAttributeRule rule = buildRule(provider); |
| | | |
| | | LinkedList<ByteString> subAny = new LinkedList<ByteString>(); |
| | | LinkedList<ByteString> subAny = new LinkedList<>(); |
| | | subAny.add(ByteString.valueOf("=")); |
| | | |
| | | assertEquals(provider.matchesSubstring(entry, rule, null, subAny, null), |
| | |
| | | @DataProvider(name = "jmxAlertHandlers") |
| | | public Object[][] getJMXAlertHandlers() |
| | | { |
| | | ArrayList<AlertHandler> handlers = new ArrayList<AlertHandler>(); |
| | | ArrayList<AlertHandler> handlers = new ArrayList<>(); |
| | | for (AlertHandler handler : DirectoryServer.getAlertHandlers()) |
| | | { |
| | | if (handler instanceof JMXAlertHandler) |
| | |
| | | |
| | | final class MockPolicyCfg implements LDAPPassThroughAuthenticationPolicyCfg |
| | | { |
| | | private final SortedSet<DN> baseDNs = new TreeSet<DN>(); |
| | | private final SortedSet<AttributeType> mappedAttributes = new TreeSet<AttributeType>(); |
| | | private final SortedSet<DN> baseDNs = new TreeSet<>(); |
| | | private final SortedSet<AttributeType> mappedAttributes = new TreeSet<>(); |
| | | private MappingPolicy mappingPolicy = MappingPolicy.UNMAPPED; |
| | | private final SortedSet<String> primaryServers = new TreeSet<String>(); |
| | | private final SortedSet<String> secondaryServers = new TreeSet<String>(); |
| | | private final SortedSet<String> primaryServers = new TreeSet<>(); |
| | | private final SortedSet<String> secondaryServers = new TreeSet<>(); |
| | | /** Unlimited. */ |
| | | private int timeoutMS; |
| | | private DN mappedSearchBindDN = searchBindDN; |
| | |
| | | @Override |
| | | public SortedSet<String> getSSLCipherSuite() |
| | | { |
| | | return new TreeSet<String>(); |
| | | return new TreeSet<>(); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public SortedSet<String> getSSLProtocol() |
| | | { |
| | | return new TreeSet<String>(); |
| | | return new TreeSet<>(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | private final Queue<Event<?>> expectedEvents = new LinkedList<Event<?>>(); |
| | | private final List<MockScheduledFuture> monitorRunnables = new LinkedList<MockScheduledFuture>(); |
| | | private final Queue<Event<?>> expectedEvents = new LinkedList<>(); |
| | | private final List<MockScheduledFuture> monitorRunnables = new LinkedList<>(); |
| | | private String currentTime = TimeThread.getGMTTime(); |
| | | |
| | | /** All methods unused excepted scheduleWithFixedDelay. */ |
| | |
| | | |
| | | |
| | | private final ServerSocket serverSocket; |
| | | private final List<Action> actions = new LinkedList<Action>(); |
| | | private final List<Action> actions = new LinkedList<>(); |
| | | private Socket socket; |
| | | private volatile Exception e; |
| | | private Thread serverThread; |
| | | private final CountDownLatch stopLatch = new CountDownLatch(1); |
| | | private final Queue<BlockAction> blockers = new LinkedList<BlockAction>(); |
| | | private final Queue<BlockAction> blockers = new LinkedList<>(); |
| | | |
| | | |
| | | |
| | |
| | | buffer.append('x'); |
| | | ByteString password = ByteString.valueOf(buffer.toString()); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", |
| | | buffer.toString()))); |
| | | Attributes.create("userpassword", buffer.toString()))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | buffer.append('x'); |
| | | ByteString password = ByteString.valueOf(buffer.toString()); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", |
| | | buffer.toString()))); |
| | | Attributes.create("userpassword", buffer.toString()))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | buffer.append('x'); |
| | | ByteString password = ByteString.valueOf(buffer.toString()); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", |
| | | buffer.toString()))); |
| | | Attributes.create("userpassword", buffer.toString()))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | buffer.append('x'); |
| | | ByteString password = ByteString.valueOf(buffer.toString()); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", |
| | | buffer.toString()))); |
| | | Attributes.create("userpassword", buffer.toString()))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | private void applyPwdPolicyMods(InternalClientConnection conn, String pwPolDN, String attr, String value) |
| | | throws DirectoryException |
| | | { |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | value == null ? Attributes.empty(attr) : Attributes.create(attr, value))); |
| | | ModifyOperation modifyOperation = conn.processModify(DN.valueOf(pwPolDN), mods); |
| | |
| | | } |
| | | |
| | | private void setPasswordChangedTime(InternalClientConnection conn, Entry userEntry) { |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("pwdchangedtime", |
| | | "20050101000000.000Z"))); |
| | | Attributes.create("pwdchangedtime", "20050101000000.000Z"))); |
| | | ModifyOperation modifyOperation = conn.processModify(userEntry.getName(), mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2010-2014 ForgeRock AS. |
| | | * Portions Copyright 2010-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | |
| | | String attr = "ds-cfg-allow-pre-encoded-passwords"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, String.valueOf(allowPreencoded)))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("password"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "password"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("passsword"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "passsword"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("passSword"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "passSword"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("passSword"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "passSword"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("aaaaaaaa"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "aaaaaaaa"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("aaaaaaaa"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "aaaaaaaa"))); |
| | | |
| | |
| | | RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | updatedValidatorEntry); |
| | | |
| | | ArrayList<LocalizableMessage> unacceptableReasons = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<LocalizableMessage> unacceptableReasons = new ArrayList<>(); |
| | | assertTrue(validator.isConfigurationChangeAcceptable(updatedConfiguration, |
| | | unacceptableReasons), |
| | | String.valueOf(unacceptableReasons)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS. |
| | | * Portions copyright 2011-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.extensions; |
| | | |
| | | import java.io.IOException; |
| | |
| | | sslTest(int size, String qop) throws NamingException, IOException { |
| | | LdapContext ctx = null; |
| | | try { |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | String url = "ldaps://localhost:" + TestCaseUtils.getServerLdapsPort(); |
| | | env.put(Context.PROVIDER_URL, url); |
| | |
| | | public void startTLS(int size) throws NamingException, IOException { |
| | | LdapContext ctx = null; |
| | | try { |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | String url = "ldap://localhost:" + TestCaseUtils.getServerLdapPort(); |
| | | env.put(Context.PROVIDER_URL, url); |
| | |
| | | entryAttrs.put(cn); |
| | | entryAttrs.put(sn); |
| | | entryAttrs.put(aPwdPolicy); |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | String url = "ldaps://localhost:" + TestCaseUtils.getServerLdapsPort(); |
| | | env.put(Context.PROVIDER_URL, url); |
| | |
| | | private void deleteTestEntry() throws NamingException { |
| | | DirContext ctx = null; |
| | | try { |
| | | Hashtable<String, String> env = new Hashtable<String, String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, factory); |
| | | String url = "ldaps://localhost:" + TestCaseUtils.getServerLdapsPort(); |
| | | env.put(Context.PROVIDER_URL, url); |
| | |
| | | buffer.append('x'); |
| | | ByteString password = ByteString.valueOf(buffer.toString()); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", |
| | | buffer.toString()))); |
| | | Attributes.create("userpassword", buffer.toString()))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | HashSet<ByteString> currentPassword = new HashSet<ByteString>(3); |
| | | HashSet<ByteString> currentPassword = new HashSet<>(3); |
| | | currentPassword.add(ByteString.valueOf("xxx")); |
| | | for (int i=0; i < 7; i++) |
| | | { |
| | | buffer.append('x'); |
| | | ByteString password = ByteString.valueOf(buffer.toString()); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", |
| | | buffer.toString()))); |
| | | Attributes.create("userpassword", buffer.toString()))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | super.cache.initializeEntryCache(configuration); |
| | | |
| | | // Make some dummy test entries. |
| | | super.testEntriesList = new ArrayList<Entry>(super.NUMTESTENTRIES); |
| | | super.testEntriesList = new ArrayList<>(super.NUMTESTENTRIES); |
| | | for(int i = 0; i < super.NUMTESTENTRIES; i++ ) { |
| | | super.testEntriesList.add(TestCaseUtils.makeEntry( |
| | | "dn: uid=test" + i + ".user" + i + ",ou=test" + i + ",o=test", |
| | |
| | | Attributes.empty(DirectoryServer.getAttributeType( |
| | | "ds-cfg-subject-attribute-mapping")); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, a)); |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | String mapperDN = "cn=Subject Attribute to User Attribute," + |
| | | "cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-certificate-mapper", |
| | | mapperDN))); |
| | | Attributes.create("ds-cfg-certificate-mapper", mapperDN))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String mapperDN = "cn=Subject Equals DN,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-certificate-mapper", |
| | | mapperDN))); |
| | | Attributes.create("ds-cfg-certificate-mapper", mapperDN))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | builder.toAttribute())); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, builder.toAttribute())); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | builder.toAttribute())); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, builder.toAttribute())); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | Attributes.empty(DirectoryServer.getAttributeType( |
| | | "ds-cfg-subject-attribute")); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, a)); |
| | | |
| | | InternalClientConnection conn = |
| | |
| | | String mapperDN = |
| | | "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-certificate-mapper", |
| | | mapperDN))); |
| | | Attributes.create("ds-cfg-certificate-mapper", mapperDN))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | String externalDN = "cn=EXTERNAL,cn=SASL Mechanisms,cn=config"; |
| | | String mapperDN = "cn=Subject Equals DN,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-certificate-mapper", |
| | | mapperDN))); |
| | | Attributes.create("ds-cfg-certificate-mapper", mapperDN))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | String mapperDN = |
| | | "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-subject-attribute", |
| | | attrName))); |
| | | Attributes.create("ds-cfg-subject-attribute", attrName))); |
| | | |
| | | InternalClientConnection conn = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | } |
| | | } |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | builder.toAttribute())); |
| | | |
| | |
| | | { |
| | | NodeList nodes = |
| | | (NodeList) xpath.evaluate(xPathExpr, doc, XPathConstants.NODESET); |
| | | List<String> cipherStrings = new ArrayList<String>(nodes.getLength()); |
| | | List<String> cipherStrings = new ArrayList<>(nodes.getLength()); |
| | | for (int i = 0; i < nodes.getLength(); i++) |
| | | { |
| | | String cipherString = nodes.item(i).getNodeValue(); |
| | |
| | | |
| | | private Set<String> toSet(String[][] data) |
| | | { |
| | | Set<String> set = new HashSet<String>(); |
| | | Set<String> set = new HashSet<>(); |
| | | for (String[] array : data) |
| | | { |
| | | for (String s : array) |
| | |
| | | @Test |
| | | public void checkNoUnknownOverlappingCiphers() |
| | | { |
| | | List<String> ciphers = |
| | | new ArrayList<String>(TLSByteChannel.CIPHER_MAP.keySet()); |
| | | List<String> ciphers = new ArrayList<>(TLSByteChannel.CIPHER_MAP.keySet()); |
| | | for (int i = 0; i < ciphers.size(); i++) |
| | | { |
| | | for (int j = 0; j < i; j++) |
| | |
| | | /** {@inheritDoc} */ |
| | | public LinkedHashMap<String,String> getAlerts() |
| | | { |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>(); |
| | | LinkedHashMap<String,String> alerts = new LinkedHashMap<>(); |
| | | |
| | | alerts.put(alertType, alertDescription); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | { |
| | | DN dn = DN.valueOf("cn=Work Queue,cn=config"); |
| | | String attr = "ds-cfg-num-worker-threads"; |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create(attr, "30"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("password"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "password"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("passw"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "passw"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("pasSw"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "pasSw"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("pasSw"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "pasSw"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("aaaaaaaa"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "aaaaaaaa"))); |
| | | |
| | |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | ByteString password = ByteString.valueOf("aaaaaaaa"); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("userpassword", "aaaaaaaa"))); |
| | | |
| | |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | updatedValidatorEntry); |
| | | |
| | | ArrayList<LocalizableMessage> unacceptableReasons = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<LocalizableMessage> unacceptableReasons = new ArrayList<>(); |
| | | assertTrue(validator.isConfigurationChangeAcceptable(updatedConfiguration, |
| | | unacceptableReasons), |
| | | String.valueOf(unacceptableReasons)); |
| | |
| | | ByteString v = ByteString.valueOf(u4.toString()); |
| | | assertTrue(a.contains(v)); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("memberurl", |
| | | "ldap:///o=test??sub?(objectClass=person)"))); |
| | |
| | | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-allow-retrieving-membership", "false"))); |
| | | DN definitionDN = |
| | |
| | | assertTrue(a.contains(v)); |
| | | |
| | | |
| | | mods = new LinkedList<Modification>(); |
| | | mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-allow-retrieving-membership", "true"))); |
| | | modifyOperation = conn.processModify(definitionDN, mods); |
| | |
| | | new LDAPAuthenticationHandler(reader, writer, "localhost", |
| | | nextMessageID); |
| | | |
| | | HashMap<String,List<String>> saslProperties = |
| | | new HashMap<String,List<String>>(2); |
| | | HashMap<String,List<String>> saslProperties = new HashMap<>(2); |
| | | |
| | | ArrayList<String> authIDList = new ArrayList<String>(1); |
| | | ArrayList<String> authIDList = new ArrayList<>(1); |
| | | authIDList.add("dn:uid=proxy.user,o=test"); |
| | | saslProperties.put("authID", authIDList); |
| | | |
| | | ArrayList<String> authzIDList = new ArrayList<String>(1); |
| | | ArrayList<String> authzIDList = new ArrayList<>(1); |
| | | authzIDList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authzID", authzIDList); |
| | | |
| | |
| | | // Use the "Who Am I?" operation again, this time with the proxy control. |
| | | ExtendedRequestProtocolOp extendedRequest = |
| | | new ExtendedRequestProtocolOp(OID_WHO_AM_I_REQUEST); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(1); |
| | | ArrayList<Control> requestControls = new ArrayList<>(1); |
| | | requestControls.add(new ProxiedAuthV2Control( |
| | | ByteString.valueOf("dn:uid=test.user,o=test"))); |
| | | LDAPMessage message = new LDAPMessage(nextMessageID.getAndIncrement(), |
| | |
| | | // Use the "Who Am I?" operation again, this time with the proxy control. |
| | | ExtendedRequestProtocolOp extendedRequest = |
| | | new ExtendedRequestProtocolOp(OID_WHO_AM_I_REQUEST); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(1); |
| | | ArrayList<Control> requestControls = new ArrayList<>(1); |
| | | requestControls.add(new ProxiedAuthV2Control( |
| | | ByteString.valueOf("dn:uid=test.user,o=test"))); |
| | | LDAPMessage message = new LDAPMessage(nextMessageID.getAndIncrement(), |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013-2014 ForgeRock AS |
| | | * Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | |
| | | private <T> SortedSet<T> setOf(final T... values) |
| | | { |
| | | return new TreeSet<T>(Arrays.asList(values)); |
| | | return new TreeSet<>(Arrays.asList(values)); |
| | | } |
| | | } |
| | |
| | | * cn: Name Surname |
| | | * sn: Surname |
| | | */ |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("top")); |
| | | values.add(ByteString.valueOf("person")); |
| | | values.add(ByteString.valueOf("organizationalperson")); |
| | | values.add(ByteString.valueOf("inetorgperson")); |
| | | |
| | | List<RawAttribute> rawAttributes = new ArrayList<RawAttribute>(); |
| | | List<RawAttribute> rawAttributes = new ArrayList<>(); |
| | | rawAttributes.add(RawAttribute.create("objectClass", values)); |
| | | rawAttributes.add(RawAttribute.create("uid", "test")); |
| | | rawAttributes.add(RawAttribute.create("cn", "Name Surname")); |
| | |
| | | * createTimeStamp: 2011091212400000Z |
| | | */ |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("top")); |
| | | values.add(ByteString.valueOf("person")); |
| | | values.add(ByteString.valueOf("organizationalperson")); |
| | | values.add(ByteString.valueOf("inetorgperson")); |
| | | |
| | | List<RawAttribute> rawAttributes = new ArrayList<RawAttribute>(); |
| | | List<RawAttribute> rawAttributes = new ArrayList<>(); |
| | | |
| | | rawAttributes.add(RawAttribute.create("objectClass", values)); |
| | | rawAttributes.add(RawAttribute.create("uid", "test")); |
| | |
| | | * - |
| | | */ |
| | | |
| | | List<RawModification> rawMods= new ArrayList<RawModification>(); |
| | | List<RawModification> rawMods= new ArrayList<>(); |
| | | |
| | | rawMods.add(RawModification.create(ModificationType.REPLACE, |
| | | "modifyTimeStamp", |
| | |
| | | * - |
| | | */ |
| | | |
| | | List<RawModification> rawMods= new ArrayList<RawModification>(); |
| | | List<RawModification> rawMods= new ArrayList<>(); |
| | | |
| | | rawMods.add(RawModification.create(ModificationType.REPLACE, |
| | | "cn", |
| | |
| | | * replace: modifyTimeStamp |
| | | * modifyTimeStamp: 2011091212400000Z |
| | | */ |
| | | List<RawModification> rawMods= new ArrayList<RawModification>(); |
| | | List<RawModification> rawMods= new ArrayList<>(); |
| | | |
| | | rawMods.add(RawModification.create(ModificationType.REPLACE, |
| | | "cn", |
| | |
| | | */ |
| | | public static List<Control> createDelayControlList(long delay) |
| | | { |
| | | ArrayList<Control> controlList = new ArrayList<Control>(1); |
| | | ArrayList<Control> controlList = new ArrayList<>(1); |
| | | |
| | | controlList.add(new DelayRequestControl(false, delay)); |
| | | |
| | |
| | | */ |
| | | public static List<Control> createDisconnectControlList(String section) |
| | | { |
| | | ArrayList<Control> controlList = new ArrayList<Control>(1); |
| | | ArrayList<Control> controlList = new ArrayList<>(1); |
| | | |
| | | controlList.add(new DisconnectClientControl(false, section)); |
| | | |
| | |
| | | public Object[][] getInvalidConfigs() |
| | | throws Exception |
| | | { |
| | | ArrayList<Entry> entries = new ArrayList<Entry>(); |
| | | ArrayList<Entry> entries = new ArrayList<>(); |
| | | |
| | | for (String s : PluginType.getPluginTypeNames()) |
| | | { |
| | |
| | | @DataProvider(name = "invalidConfigs") |
| | | public Object[][] getInvalidConfigs() throws Exception |
| | | { |
| | | ArrayList<Entry> entries = new ArrayList<Entry>(); |
| | | ArrayList<Entry> entries = new ArrayList<>(); |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | "dn: cn=LDAP Attribute Description List,cn=Plugins,cn=config", |
| | | "objectClass: top", |
| | |
| | | public Object[][] getInvalidConfigs() |
| | | throws Exception |
| | | { |
| | | ArrayList<Entry> entries = new ArrayList<Entry>(); |
| | | ArrayList<Entry> entries = new ArrayList<>(); |
| | | |
| | | for (String s : PluginType.getPluginTypeNames()) |
| | | { |
| | |
| | | { |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | |
| | | public Object[][] getInvalidConfigs() |
| | | throws Exception |
| | | { |
| | | ArrayList<Entry> entries = new ArrayList<Entry>(); |
| | | ArrayList<Entry> entries = new ArrayList<>(); |
| | | for (String s : PluginType.getPluginTypeNames()) |
| | | { |
| | | if (s.equalsIgnoreCase("ldifimport")) |
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 profiq s.r.o. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | */ |
| | | private ModifyOperation |
| | | addAttrEntry(DN dn, String attrTypeString, String... attrValStrings) { |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | AttributeType attrType = getAttrType(attrTypeString); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType, attrTypeString); |
| | | for(String valString : attrValStrings) { |
| | |
| | | */ |
| | | private ModifyOperation |
| | | replaceAttrEntry(DN dn, String attrTypeString, String... attrValStrings) { |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | AttributeType attrType = getAttrType(attrTypeString); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType, attrTypeString); |
| | | for(String valString : attrValStrings) { |
| | |
| | | */ |
| | | private void |
| | | deleteAttrsEntry(DN dn, String... attrTypeStrings) throws Exception { |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | for(String attrTypeString : attrTypeStrings) { |
| | | AttributeType attrType = getAttrType(attrTypeString); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | SubtreeDeleteControl control = new SubtreeDeleteControl(true); |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | List<Control> controls = new ArrayList<>(1); |
| | | controls.add(control); |
| | | |
| | | for (String dn : dns) |
| | |
| | | * |
| | | * |
| | | * Copyright 2011-2012 profiq s.r.o. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | |
| | | * Samba administrative user needs a permission to manipulate user accounts. |
| | | * Hence, we add a very permissive ACI. |
| | | */ |
| | | InternalClientConnection conn = InternalClientConnection |
| | | .getRootConnection(); |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | InternalClientConnection conn = InternalClientConnection.getRootConnection(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create("aci", |
| | | "(target=\"ldap:///uid=*,o=test\")(targetattr=\"*\")" |
| | |
| | | TestCaseUtils.addEntry(testEntry); |
| | | |
| | | // Perform the modify operation |
| | | InternalClientConnection conn = InternalClientConnection |
| | | .getRootConnection(); |
| | | InternalClientConnection conn = InternalClientConnection.getRootConnection(); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | |
| | | mods.add(new Modification(ModificationType.REPLACE, Attributes.create( |
| | | "userPassword", "password"))); |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(authInfo); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | |
| | | mods.add(new Modification(ModificationType.REPLACE, Attributes.create( |
| | | "userPassword", "password"))); |
| | |
| | | |
| | | InternalClientConnection conn = new InternalClientConnection(authInfo); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | |
| | | mods.add(new Modification(ModificationType.REPLACE, Attributes.create( |
| | | "userPassword", "password1"))); |
| | |
| | | InternalClientConnection conn = InternalClientConnection |
| | | .getRootConnection(); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create( |
| | | "userPassword", "password1"))); |
| | |
| | | InternalClientConnection conn = InternalClientConnection |
| | | .getRootConnection(); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | |
| | | mods.add(new Modification(ModificationType.REPLACE, Attributes.create( |
| | | "userPassword", "password"))); |
| | |
| | | public static List<Control> createShortCircuitControlList(int resultCode, |
| | | String section) |
| | | { |
| | | ArrayList<Control> controlList = new ArrayList<Control>(1); |
| | | ArrayList<Control> controlList = new ArrayList<>(1); |
| | | controlList.add(createShortCircuitControl(resultCode, section)); |
| | | return controlList; |
| | | } |
| | | |
| | | /** |
| | | * Registered short circuits for operations regardless of controls. |
| | | */ |
| | | private static Map<String,Integer> shortCircuits = |
| | | new ConcurrentHashMap<String, Integer>(); |
| | | /** Registered short circuits for operations regardless of controls. */ |
| | | private static Map<String, Integer> shortCircuits = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * Register a short circuit for the given operation type and plugin point. |
| | |
| | | @Test |
| | | public void testModOperationNameContexts() throws Exception { |
| | | replaceAttrInEntry(uidConfigDN,dsConfigAttrType,"mail"); |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | addMods(mods,"mail",ModificationType.REPLACE,"userx@test","userxx@test", |
| | | "user1t@test"); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | 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.valueOf("uid=5user.5,ou=People,o=test"), |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | ResultCode.CONSTRAINT_VIOLATION); |
| | | mods.clear(); |
| | | addMods(mods,"pager",ModificationType.ADD,"2-999-1234","1-999-5678"); |
| | | addMods(mods,"mail",ModificationType.REPLACE,"userx@test","userxx@test", |
| | | "user1t@test"); |
| | | addMods(mods,"mail",ModificationType.REPLACE,"userx@test","userxx@test", "user1t@test"); |
| | | //Ok because adding mail value user1t@test to entry that already |
| | | //contains mail value user1t@test. |
| | | doMods(mods, DN.valueOf("uid=1user.1,ou=People,o=test"), |
| | |
| | | */ |
| | | private void |
| | | deleteAttrsFromEntry(DN dn, String... attrTypeStrings) throws Exception { |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | for(String attrTypeString : attrTypeStrings) { |
| | | AttributeType attrType = getAttrType(attrTypeString); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | |
| | | |
| | | private void |
| | | replaceAttrInEntry(DN dn, String attrTypeString, String... attrValStrings) { |
| | | LinkedList<Modification> mods = new LinkedList<Modification>(); |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | AttributeType attrType = getAttrType(attrTypeString); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType, attrTypeString); |
| | | for(String valString : attrValStrings) { |
| | |
| | | // We assume that there is only one of these active at a time. |
| | | instance = this; |
| | | |
| | | setAttributes = new ArrayList<Attribute>(); |
| | | removeAttributes = new ArrayList<AttributeType>(); |
| | | addObjectClasses = new ArrayList<ObjectClass>(); |
| | | removeObjectClasses = new ArrayList<ObjectClass>(); |
| | | modifications = new ArrayList<Modification>(); |
| | | setAttributes = new ArrayList<>(); |
| | | removeAttributes = new ArrayList<>(); |
| | | addObjectClasses = new ArrayList<>(); |
| | | removeObjectClasses = new ArrayList<>(); |
| | | modifications = new ArrayList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | for (Attribute a : setAttributes) |
| | | { |
| | | ArrayList<Attribute> attrList = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> attrList = new ArrayList<>(1); |
| | | attrList.add(a); |
| | | addOperation.setAttribute(a.getAttributeType(), attrList); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | |
| | | ByteString dn = ByteString.valueOf("cn=test,o=test"); |
| | | |
| | | ArrayList<RawAttribute> attrs = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> attrs = new ArrayList<>(); |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("top")); |
| | | values.add(ByteString.valueOf("device")); |
| | | attrs.add(new LDAPAttribute("objectClass", values)); |
| | | |
| | | values = new ArrayList<ByteString>(); |
| | | values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("test")); |
| | | attrs.add(new LDAPAttribute("cn", values)); |
| | | |
| | |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | values.add(ByteString.valueOf("This is a test")); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(new LDAPModification(ModificationType.REPLACE, |
| | | new LDAPAttribute("description", values))); |
| | | |
| | |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "This is a test"))); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | assertEquals(message.getBindResponseProtocolOp().getResultCode(), 0); |
| | | |
| | | |
| | | ArrayList<RawAttribute> attrList = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> attrList = new ArrayList<>(); |
| | | attrList.add(RawAttribute.create("objectClass", "organization")); |
| | | attrList.add(RawAttribute.create("o", "test")); |
| | | |
| | |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | | Hashtable<String,String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, |
| | | "com.sun.jndi.ldap.LdapCtxFactory"); |
| | | env.put("java.naming.ldap.factory.socket", |
| | |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | | Hashtable<String,String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, |
| | | "com.sun.jndi.ldap.LdapCtxFactory"); |
| | | env.put("java.naming.ldap.factory.socket", |
| | |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | | Hashtable<String,String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, |
| | | "com.sun.jndi.ldap.LdapCtxFactory"); |
| | | env.put("java.naming.ldap.factory.socket", |
| | |
| | | assertEquals(message.getBindResponseProtocolOp().getResultCode(), 0); |
| | | |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "description", |
| | | "foo")); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "description", "foo")); |
| | | |
| | | ModifyRequestProtocolOp modifyRequest = |
| | | new ModifyRequestProtocolOp(ByteString.valueOf("o=test"), mods); |
| | |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | | Hashtable<String, String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, |
| | | "com.sun.jndi.ldap.LdapCtxFactory"); |
| | | env.put("java.naming.ldap.factory.socket", |
| | |
| | | |
| | | ModificationItem[] mods = |
| | | { |
| | | new ModificationItem(DirContext.REPLACE_ATTRIBUTE, |
| | | new BasicAttribute("description", "foo")) |
| | | new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", "foo")) |
| | | }; |
| | | |
| | | context.modifyAttributes("o=test", mods); |
| | |
| | | assertFalse(DirectoryServer.entryExists(DN.valueOf("ou=Users,o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | | Hashtable<String,String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, |
| | | "com.sun.jndi.ldap.LdapCtxFactory"); |
| | | env.put("java.naming.ldap.factory.socket", |
| | |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | |
| | | |
| | | Hashtable<String,String> env = new Hashtable<String,String>(); |
| | | Hashtable<String,String> env = new Hashtable<>(); |
| | | env.put(Context.INITIAL_CONTEXT_FACTORY, |
| | | "com.sun.jndi.ldap.LdapCtxFactory"); |
| | | env.put("java.naming.ldap.factory.socket", |
| | |
| | | */ |
| | | public TestInternalSearchListener() |
| | | { |
| | | searchEntries = new ArrayList<SearchResultEntry>(); |
| | | searchReferences = new ArrayList<SearchResultReference>(); |
| | | searchEntries = new ArrayList<>(); |
| | | searchReferences = new ArrayList<>(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | private void configureJmx(Entry entry) throws Exception { |
| | | ArrayList<LocalizableMessage> reasons = new ArrayList<LocalizableMessage>(); |
| | | ArrayList<LocalizableMessage> reasons = new ArrayList<>(); |
| | | |
| | | // Get the Jmx connection handler from the core server |
| | | JmxConnectionHandler jmxConnectionHandler = getJmxConnectionHandler(); |
| | |
| | | */ |
| | | private OpendsJmxConnector connect(String user, String password, int jmxPort) |
| | | throws MalformedURLException, IOException { |
| | | Map<String, Object> env = new HashMap<String, Object>(); |
| | | Map<String, Object> env = new HashMap<>(); |
| | | |
| | | // Provide the credentials required by the server to successfully |
| | | // perform user authentication |
| | |
| | | */ |
| | | private OpendsJmxConnector sslConnect(String user, String password, |
| | | long jmxPort) throws Exception { |
| | | Map<String, Object> env = new HashMap<String, Object>(); |
| | | Map<String, Object> env = new HashMap<>(); |
| | | |
| | | // Provide the credentials required by the server to successfully |
| | | // perform user authentication |
| | |
| | | |
| | | // Build the array of connections we will use to perform the tests. |
| | | JmxConnectionHandler jmxCtx = getJmxConnectionHandler(); |
| | | ArrayList<JmxClientConnection> connList = |
| | | new ArrayList<JmxClientConnection>(); |
| | | ArrayList<Boolean> successList = new ArrayList<Boolean>(); |
| | | ArrayList<JmxClientConnection> connList = new ArrayList<>(); |
| | | ArrayList<Boolean> successList = new ArrayList<>(); |
| | | String userDN ; |
| | | Entry userEntry ; |
| | | AuthenticationInfo authInfo; |
| | |
| | | { |
| | | OpendsJmxConnector opendsConnector; |
| | | int jmxPort = TestCaseUtils.getServerJmxPort() ; |
| | | HashMap<String, Object> env = new HashMap<String, Object>(); |
| | | HashMap<String, Object> env = new HashMap<>(); |
| | | String user = "cn=Unprivileged JMX Root,cn=Root DNs,cn=config"; |
| | | String password = "password"; |
| | | String[] credentials = new String[] { user, password }; |
| | |
| | | |
| | | // Add JMX_READ privilege |
| | | InternalClientConnection rootConnection = getRootConnection(); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create( |
| | | "ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = |
| | |
| | | } |
| | | |
| | | // remove JMX_READ privilege |
| | | mods = new ArrayList<Modification>(); |
| | | mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | modifyOperation = |
| | |
| | | "givenName: ProxyV1", |
| | | "sn: Test"); |
| | | |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV1Control( |
| | | DN.valueOf("cn=PWReset Target,o=test"))); |
| | | |
| | |
| | | |
| | | |
| | | // Try to modify the entry to add a description. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(1); |
| | | ArrayList<Modification> mods = new ArrayList<>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV1Control(targetDN)); |
| | | |
| | | |
| | |
| | | "givenName: ProxyV2", |
| | | "sn: Test"); |
| | | |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV2Control( |
| | | ByteString.valueOf("dn:cn=PWReset Target,o=test"))); |
| | | |
| | |
| | | |
| | | |
| | | // Try to modify the entry to add a description. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(1); |
| | | ArrayList<Modification> mods = new ArrayList<>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV2Control(ByteString.valueOf("dn:" + targetDN))); |
| | | |
| | | |
| | |
| | | |
| | | // Modify the user entry to add the JMX_READ privilege and verify that |
| | | // the client connection reflects that. |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-privilege-name", "jmx-read"))); |
| | | ModifyOperation modifyOperation = rootConnection.processModify(dn, mods); |
| | |
| | | // Update the set of root privileges to include proxied auth. |
| | | InternalClientConnection conn = getRootConnection(); |
| | | |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | */ |
| | | private void enableJmx() throws Exception |
| | | { |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | |
| | | InternalClientConnection conn = InternalClientConnection |
| | | .getRootConnection(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | int postDisconnectBefore = InvocationCounterPlugin.getPostDisconnectCount(); |
| | | |
| | | // Create a new client connection |
| | | HashMap<String, Object> env = new HashMap<String, Object>(); |
| | | String[] credentials = new String[] { "cn=Privileged User,o=test", |
| | | "password" }; |
| | | HashMap<String, Object> env = new HashMap<>(); |
| | | String[] credentials = new String[] { "cn=Privileged User,o=test", "password" }; |
| | | env.put("jmx.remote.credentials", credentials); |
| | | env.put("jmx.remote.x.client.connection.check.period",0); |
| | | OpendsJmxConnector opendsConnector = new OpendsJmxConnector("localhost", |
| | |
| | | message = r.readMessage(); |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | ArrayList<RawAttribute> addAttrs = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> addAttrs = new ArrayList<>(); |
| | | addAttrs.add(RawAttribute.create("objectClass", "inetOrgPerson")); |
| | | addAttrs.add(RawAttribute.create("uid", "user.7")); |
| | | addAttrs.add(RawAttribute.create("cn", "user 7")); |
| | |
| | | assertEquals(addResponse.getResultCode(),0); |
| | | |
| | | //Create a SEARCH request to search for this added entry. |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> attrs = new LinkedHashSet<>(); |
| | | //Request only the interesting attributes. |
| | | attrs.add("sn"); |
| | | attrs.add("userCertificate;binary"); |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | ArrayList<RawAttribute> addAttrs = new ArrayList<RawAttribute>(); |
| | | ArrayList<RawAttribute> addAttrs = new ArrayList<>(); |
| | | addAttrs.add(RawAttribute.create("objectClass", "organizationalUnit")); |
| | | addAttrs.add(RawAttribute.create("ou", "People")); |
| | | |
| | | AddRequestProtocolOp addRequest = |
| | | new AddRequestProtocolOp(ByteString.valueOf("ou=People,o=test"), |
| | | addAttrs); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | new AddRequestProtocolOp(ByteString.valueOf("ou=People,o=test"), addAttrs); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new LDAPControl(OID_MANAGE_DSAIT_CONTROL, true)); |
| | | message = new LDAPMessage(2, addRequest, controls); |
| | | w.writeMessage(message); |
| | |
| | | new BindRequestProtocolOp( |
| | | ByteString.valueOf("cn=Directory Manager"), 2, |
| | | ByteString.valueOf("password")); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new LDAPControl(OID_MANAGE_DSAIT_CONTROL, true)); |
| | | LDAPMessage message = new LDAPMessage(1, bindRequest, controls); |
| | | w.writeMessage(message); |
| | |
| | | CompareRequestProtocolOp compareRequest = |
| | | new CompareRequestProtocolOp(ByteString.valueOf("o=test"), |
| | | "o", ByteString.valueOf("test")); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new LDAPControl(OID_MANAGE_DSAIT_CONTROL, true)); |
| | | message = new LDAPMessage(2, compareRequest, controls); |
| | | w.writeMessage(message); |
| | |
| | | |
| | | DeleteRequestProtocolOp deleteRequest = |
| | | new DeleteRequestProtocolOp(ByteString.valueOf("o=test")); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new LDAPControl(OID_MANAGE_DSAIT_CONTROL, true)); |
| | | message = new LDAPMessage(2, deleteRequest, controls); |
| | | w.writeMessage(message); |
| | |
| | | BindResponseProtocolOp bindResponse = message.getBindResponseProtocolOp(); |
| | | assertEquals(bindResponse.getResultCode(), 0); |
| | | |
| | | ArrayList<RawModification> mods = new ArrayList<RawModification>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, |
| | | "description", "foo")); |
| | | ArrayList<RawModification> mods = new ArrayList<>(); |
| | | mods.add(RawModification.create(ModificationType.REPLACE, "description", "foo")); |
| | | |
| | | ModifyRequestProtocolOp modifyRequest = |
| | | new ModifyRequestProtocolOp(ByteString.valueOf("o=test"), mods); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new LDAPControl(OID_MANAGE_DSAIT_CONTROL, true)); |
| | | message = new LDAPMessage(2, modifyRequest, controls); |
| | | w.writeMessage(message); |
| | |
| | | ModifyDNRequestProtocolOp modifyDNRequest = |
| | | new ModifyDNRequestProtocolOp(ByteString.valueOf("o=test"), |
| | | ByteString.valueOf("cn=test"), false); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new LDAPControl(OID_MANAGE_DSAIT_CONTROL, true)); |
| | | message = new LDAPMessage(2, modifyDNRequest, controls); |
| | | w.writeMessage(message); |
| | |
| | | SearchScope.BASE_OBJECT, |
| | | DereferenceAliasesPolicy.NEVER, 0, 0, false, |
| | | LDAPFilter.objectClassPresent(), null); |
| | | ArrayList<Control> controls = new ArrayList<Control>(1); |
| | | ArrayList<Control> controls = new ArrayList<>(1); |
| | | controls.add(new LDAPControl(OID_MANAGE_DSAIT_CONTROL, true)); |
| | | message = new LDAPMessage(2, searchRequest, controls); |
| | | w.writeMessage(message); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | int numValues, |
| | | String prefix) |
| | | { |
| | | List<RawAttribute> attributes = new ArrayList<RawAttribute>(); |
| | | List<RawAttribute> attributes = new ArrayList<>(); |
| | | |
| | | for (int i = 0; i < numAttributes; i++) |
| | | { |
| | | ArrayList<ByteString> values = new ArrayList<ByteString>(); |
| | | ArrayList<ByteString> values = new ArrayList<>(); |
| | | for (int j = 0; j < numValues; j++) |
| | | { |
| | | values.add(ByteString.valueOf(prefix + "Value" + i + "." + j)); |
| | |
| | | |
| | | //Test to make sure the constructor with result code, message, dn, and |
| | | //referral params works. |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | AddResponseProtocolOp addEncoded; |
| | | AddResponseProtocolOp addDecoded; |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | assertEquals(addDecoded.getMatchedDN(), null); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<String>(); |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | | addEncoded = new AddResponseProtocolOp(resultCode, resultMsg, dn, |
| | | emptyReferralURLs); |
| | | builder.clear(); |
| | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | StringBuilder key = new StringBuilder(); |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | @Test |
| | | public void testBindRequestToString() throws Exception |
| | | { |
| | | List<String> referralURLs=new ArrayList<String>(); |
| | | List<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add(url); |
| | | DN responseDn = DN.valueOf(dn); |
| | | ByteString serverSASLCredentials = |
| | |
| | | |
| | | @Test |
| | | public void testBindResponseEncodeDecode() throws Exception { |
| | | List<String> referralURLs=new ArrayList<String>(); |
| | | List<String> referralURLs=new ArrayList<>(); |
| | | referralURLs.add(url); |
| | | DN responseDn = DN.valueOf(dn); |
| | | ByteString serverSASLCredentials = |
| | |
| | | |
| | | //Test to make sure the constructor with result code, message, dn, and |
| | | //referral params works. |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | CompareResponseProtocolOp deleteEncoded; |
| | | CompareResponseProtocolOp deleteDecoded; |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<String>(); |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | | deleteEncoded = new CompareResponseProtocolOp(resultCode, resultMsg, dn, |
| | | emptyReferralURLs); |
| | | builder.clear(); |
| | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | StringBuilder key = new StringBuilder(); |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | StringBuilder key = new StringBuilder(); |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | |
| | | //Test to make sure the constructor with result code, message, dn, and |
| | | //referral params works. |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | DeleteResponseProtocolOp deleteEncoded; |
| | | DeleteResponseProtocolOp deleteDecoded; |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<String>(); |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | | deleteEncoded = new DeleteResponseProtocolOp(resultCode, resultMsg, dn, |
| | | emptyReferralURLs); |
| | | builder.clear(); |
| | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | StringBuilder key = new StringBuilder(); |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | GoodHandlerEntry.addAttribute(a13, null); |
| | | GoodHandlerEntry.addAttribute(a14, null); |
| | | GoodHandlerEntry.addAttribute(a15, null); |
| | | List<LocalizableMessage> reasons = new LinkedList<LocalizableMessage>(); |
| | | List<LocalizableMessage> reasons = new LinkedList<>(); |
| | | LDAPConnectionHandlerCfg config = LdapTestCase.getConfiguration(GoodHandlerEntry); |
| | | //see if we're ok |
| | | boolean ret=LDAPConnHandler.isConfigurationChangeAcceptable(config, reasons); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | ByteString.valueOf("\\test*(Value)")); |
| | | LDAPFilter presense = LDAPFilter.createPresenceFilter("login"); |
| | | |
| | | ArrayList<ByteString> any = new ArrayList<ByteString>(0); |
| | | ArrayList<ByteString> multiAny = new ArrayList<ByteString>(1); |
| | | ArrayList<ByteString> any = new ArrayList<>(0); |
| | | ArrayList<ByteString> multiAny = new ArrayList<>(1); |
| | | multiAny.add(ByteString.valueOf("\\wid*(get)")); |
| | | multiAny.add(ByteString.valueOf("*")); |
| | | |
| | |
| | | ByteString.valueOf("\\John* (Doe)"), |
| | | false); |
| | | |
| | | ArrayList<RawFilter> list1 = new ArrayList<RawFilter>(); |
| | | ArrayList<RawFilter> list1 = new ArrayList<>(); |
| | | list1.add(equal); |
| | | list1.add(approx); |
| | | |
| | | LDAPFilter and = LDAPFilter.createANDFilter(list1); |
| | | |
| | | ArrayList<RawFilter> list2 = new ArrayList<RawFilter>(); |
| | | ArrayList<RawFilter> list2 = new ArrayList<>(); |
| | | list2.add(substring1); |
| | | list2.add(extensible1); |
| | | list2.add(and); |
| | |
| | | |
| | | //Test to make sure the constructor with result code, message, dn, and |
| | | //referral params works. |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | ModifyDNResponseProtocolOp deleteEncoded; |
| | | ModifyDNResponseProtocolOp deleteDecoded; |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | assertEquals(deleteDecoded.getMatchedDN(), null); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<String>(); |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | | deleteEncoded = new ModifyDNResponseProtocolOp(resultCode, resultMsg, dn, |
| | | emptyReferralURLs); |
| | | builder.clear(); |
| | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | StringBuilder key = new StringBuilder(); |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.ldap; |
| | | |
| | |
| | | private List<RawModification> generateModifications(int numAttributes, |
| | | String prefix) |
| | | { |
| | | List<RawModification> modifies = new ArrayList<RawModification>(); |
| | | List<RawModification> modifies = new ArrayList<>(); |
| | | ModificationType modificationType; |
| | | |
| | | for(int i = 0; i < numAttributes; i++) |
| | |
| | | |
| | | //Test to make sure the constructor with result code, message, dn, and |
| | | //referral params works. |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | ModifyResponseProtocolOp modifyEncoded; |
| | | ModifyResponseProtocolOp modifyDecoded; |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | assertEquals(modifyDecoded.getMatchedDN(), null); |
| | | |
| | | //Test case for a full empty referral url param. |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<String>(); |
| | | ArrayList<String> emptyReferralURLs = new ArrayList<>(); |
| | | modifyEncoded = new ModifyResponseProtocolOp(resultCode, resultMsg, dn, |
| | | emptyReferralURLs); |
| | | builder.clear(); |
| | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | StringBuilder key = new StringBuilder(); |
| | | |
| | | ArrayList<String> referralURLs = new ArrayList<String>(); |
| | | ArrayList<String> referralURLs = new ArrayList<>(); |
| | | referralURLs.add("ds1.example.com"); |
| | | referralURLs.add("ds2.example.com"); |
| | | referralURLs.add("ds3.example.com"); |
| | |
| | | private int timeLimit = Integer.MAX_VALUE; |
| | | private boolean typesOnly = true; |
| | | private LDAPFilter filter = LDAPFilter.objectClassPresent(); |
| | | private LinkedHashSet<String> attributes = new LinkedHashSet<String>( |
| | | private LinkedHashSet<String> attributes = new LinkedHashSet<>( |
| | | Arrays.asList("description", "cn", "cn;optionA")); |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | // configure and start replication of TEST_ROOT_DN_STRING on the server |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | replServers.add("localhost:"+replServerPort); |
| | | DomainFakeCfg domainConf = new DomainFakeCfg(baseDN, serverId, replServers); |
| | | domainConf.setHeartbeatInterval(100000); |
| | |
| | | replServer = new ReplicationServer(conf); |
| | | |
| | | // configure and start replication of TEST_ROOT_DN_STRING on the server |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | replServers.add("localhost:"+replServerPort); |
| | | DomainFakeCfg domainConf = new DomainFakeCfg(baseDN, serverId, replServers); |
| | | domainConf.setHeartbeatInterval(100000); |
| | |
| | | } |
| | | |
| | | // configure and start replication of TEST_ROOT_DN_STRING on the server |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | replServers.add("localhost:"+replServerPort); |
| | | DomainFakeCfg domainConf = new DomainFakeCfg(baseDN, serverId, replServers); |
| | | domain = MultimasterReplication.createNewDomain(domainConf); |
| | |
| | | } |
| | | |
| | | // configure and start replication of TEST_ROOT_DN_STRING on the server |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | replServers.add("localhost:"+replServerPort); |
| | | DomainFakeCfg domainConf = new DomainFakeCfg(baseDN, serverId, replServers); |
| | | domain = MultimasterReplication.createNewDomain(domainConf); |
| | |
| | | private ReplicationServer createReplicationServer(int replServerId, |
| | | boolean all, String testCase) throws Exception |
| | | { |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | if (all) |
| | | { |
| | | if (replServerId != replServerId1) |
| | |
| | | private ReplicationServer createReplicationServer(int replServerId, |
| | | String testCase) throws Exception |
| | | { |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | if (replServerId != replServer1ID) |
| | | servers.add("localhost:" + getReplServerPort(replServer1ID)); |
| | | if (replServerId != replServer2ID) |
| | |
| | | protected InternalClientConnection connection; |
| | | |
| | | /** Created entries that will be deleted on class cleanup. */ |
| | | protected final Set<DN> entriesToCleanup = new HashSet<DN>(); |
| | | protected final Set<DN> entriesToCleanup = new HashSet<>(); |
| | | /** Created config entries that will be deleted on class cleanup. */ |
| | | protected final Set<DN> configEntriesToCleanup = new HashSet<DN>(); |
| | | protected final Set<DN> configEntriesToCleanup = new HashSet<>(); |
| | | |
| | | /** Replicated suffix (replication domain). */ |
| | | protected Entry synchroServerEntry; |
| | |
| | | protected List<Modification> generatemods(String attrName, String attrValue) |
| | | { |
| | | Attribute attr = Attributes.create(attrName, attrValue); |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | Modification mod = new Modification(ModificationType.REPLACE, attr); |
| | | mods.add(mod); |
| | | return mods; |
| | |
| | | |
| | | final int timeOut = 5000; // 5 seconds max to wait for the desired message |
| | | final long startTime = System.currentTimeMillis(); |
| | | final List<ReplicationMsg> msgs = new ArrayList<ReplicationMsg>(); |
| | | final List<ReplicationMsg> msgs = new ArrayList<>(); |
| | | boolean timedOut = false; |
| | | while (!timedOut) |
| | | { |
| | |
| | | // Modify the schema |
| | | Attribute attr = Attributes.create("attributetypes", |
| | | "( 2.5.44.77.33 NAME 'dummy' )"); |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | Modification mod = new Modification(ModificationType.ADD, attr); |
| | | mods.add(mod); |
| | | ModifyOperation modOp = connection.processModify(baseDN, mods); |
| | |
| | | Assertions.assertThat(receivedOp).isInstanceOf(ModifyOperation.class); |
| | | ModifyOperation receivedModifyOperation = (ModifyOperation) receivedOp; |
| | | |
| | | this.rcvdMods = new ArrayList<Modification>(); |
| | | this.rcvdMods = new ArrayList<>(); |
| | | for (RawModification m : receivedModifyOperation.getRawModifications()) |
| | | { |
| | | this.rcvdMods.add(m.toModification()); |
| | |
| | | // create a schema change Notification |
| | | Attribute attr = Attributes.create("attributetypes", |
| | | "( 2.5.44.76.35 NAME 'push' )"); |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | Modification mod = new Modification(ModificationType.ADD, attr); |
| | | mods.add(mod); |
| | | |
| | |
| | | Assertions.assertThat(receivedOp).isInstanceOf(ModifyOperation.class); |
| | | ModifyOperation receivedModifyOperation = (ModifyOperation) receivedOp; |
| | | |
| | | this.rcvdMods = new ArrayList<Modification>(); |
| | | this.rcvdMods = new ArrayList<>(); |
| | | for (RawModification m : receivedModifyOperation.getRawModifications()) |
| | | { |
| | | this.rcvdMods.add(m.toModification()); |
| | |
| | | int count = TOTAL_MESSAGES; |
| | | |
| | | // Create a number of writer thread that will loop modifying the entry |
| | | List<Thread> writerThreadList = new LinkedList<Thread>(); |
| | | List<Thread> writerThreadList = new LinkedList<>(); |
| | | for (int n = 0; n < 1; n++) |
| | | { |
| | | BrokerWriter writer = new BrokerWriter(count); |
| | |
| | | else |
| | | attr = Attributes.create("received-messages", String |
| | | .valueOf(reader.getCurrentCount())); |
| | | List<Attribute> list = new LinkedList<Attribute>(); |
| | | List<Attribute> list = new LinkedList<>(); |
| | | list.add(attr); |
| | | attr = Attributes.create("base-dn", "ou=People," + TEST_ROOT_DN_STRING); |
| | | list.add(attr); |
| | |
| | | // Replay a replace of a value B at time t2 on a second server. |
| | | Attribute attr = Attributes.create(attrType, "B"); |
| | | Modification mod = new Modification(ModificationType.REPLACE, attr); |
| | | List<Modification> mods = new ArrayList<Modification>(1); |
| | | List<Modification> mods = new ArrayList<>(1); |
| | | mods.add(mod); |
| | | ModifyMsg modMsg = new ModifyMsg(t2, dn1, mods, entryuuid); |
| | | broker.publish(modMsg); |
| | |
| | | // Replay an add of a value A at time t1 on a first server. |
| | | attr = Attributes.create(attrType, "A"); |
| | | mod = new Modification(ModificationType.ADD, attr); |
| | | mods = new ArrayList<Modification>(1); |
| | | mods = new ArrayList<>(1); |
| | | mods.add(mod); |
| | | modMsg = new ModifyMsg(t1, dn1, mods, entryuuid); |
| | | broker.publish(modMsg); |
| | |
| | | // Replay an delete of attribute displayname at time t2 on a second server. |
| | | attr = Attributes.empty(attrType); |
| | | mod = new Modification(ModificationType.DELETE, attr); |
| | | mods = new ArrayList<Modification>(1); |
| | | mods = new ArrayList<>(1); |
| | | mods.add(mod); |
| | | modMsg = new ModifyMsg(t2, dn1, mods, entryuuid); |
| | | broker.publish(modMsg); |
| | |
| | | // Replay a replace of a value A at time t1 on a first server. |
| | | attr = Attributes.create(attrType, "A"); |
| | | mod = new Modification(ModificationType.REPLACE, attr); |
| | | mods = new ArrayList<Modification>(1); |
| | | mods = new ArrayList<>(1); |
| | | mods.add(mod); |
| | | modMsg = new ModifyMsg(t1, dn1, mods, entryuuid); |
| | | broker.publish(modMsg); |
| | |
| | | */ |
| | | private void consumeAllMessages(ReplicationBroker broker) |
| | | { |
| | | final List<ReplicationMsg> msgs = new ArrayList<ReplicationMsg>(); |
| | | final List<ReplicationMsg> msgs = new ArrayList<>(); |
| | | try |
| | | { |
| | | while (true) |
| | |
| | | public class MonitorAssertions |
| | | { |
| | | |
| | | private Map<String, Long> attributeValues = new HashMap<String, Long>(); |
| | | private Map<String, Long> attributeValues = new HashMap<>(); |
| | | |
| | | public MonitorAssertions(DN baseDN) throws Exception |
| | | { |
| | |
| | | return Collections.emptyMap(); |
| | | |
| | | // Parse and store values |
| | | Map<Integer,Integer> resultMap = new HashMap<Integer,Integer>(); |
| | | Map<Integer,Integer> resultMap = new HashMap<>(); |
| | | for (ByteString val : attrs.get(0)) |
| | | { |
| | | StringTokenizer strtok = new StringTokenizer(val.toString(), ":"); |
| | |
| | | /** Group id. */ |
| | | private final int groupId; |
| | | /** Referrals urls to be published to other servers of the topology. */ |
| | | private SortedSet<String> refUrls = new TreeSet<String>(); |
| | | private SortedSet<String> refUrls = new TreeSet<>(); |
| | | |
| | | private final SortedSet<String> fractionalExcludes = new TreeSet<String>(); |
| | | private final SortedSet<String> fractionalIncludes = new TreeSet<String>(); |
| | | private final SortedSet<String> fractionalExcludes = new TreeSet<>(); |
| | | private final SortedSet<String> fractionalIncludes = new TreeSet<>(); |
| | | |
| | | private ExternalChangelogDomainCfg eclCfg = |
| | | new ExternalChangelogDomainFakeCfg(true, null, null); |
| | |
| | | */ |
| | | private void createReplicationServer(String testCase) throws Exception |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | String dir = testName + RS_ID + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | |
| | | throws Exception |
| | | { |
| | | // Create modifications on the fractional attributes |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | boolean first = true; |
| | | for (String fracCfgValue : fractionalConf) |
| | | { |
| | |
| | | */ |
| | | private SortedSet<String> createRSListForTestCase(String testCase) |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | if (testCase.equals("testRSWithSameGroupIds")) |
| | | { |
| | |
| | | private ReplicationServer createReplicationServer(int serverId, int groupId, |
| | | String testCase) throws Exception |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | int port = -1; |
| | | if (serverId == RS1_ID) |
| | | { |
| | |
| | | /** |
| | | * Change group id of RS3 to 1 |
| | | */ |
| | | SortedSet<String> otherReplServers = new TreeSet<String>(); |
| | | SortedSet<String> otherReplServers = new TreeSet<>(); |
| | | otherReplServers.add("localhost:" + rs1Port); |
| | | otherReplServers.add("localhost:" + rs2Port); |
| | | String dir = "groupIdHandshakeTest" + RS3_ID + testCase + "Db"; |
| | |
| | | /** |
| | | * Change group id of RS1 to 3: DS1 and DS2 should reconnect to RS3 |
| | | */ |
| | | otherReplServers = new TreeSet<String>(); |
| | | otherReplServers = new TreeSet<>(); |
| | | otherReplServers.add("localhost:" + rs2Port); |
| | | otherReplServers.add("localhost:" + rs3Port); |
| | | dir = "groupIdHandshakeTest" + RS1_ID + testCase + "Db"; |
| | |
| | | |
| | | |
| | | private final int serverId = 123; |
| | | private final SortedSet<String> replServers = new TreeSet<String>(); |
| | | private final SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | private static class TestBroker extends ReplicationBroker |
| | | { |
| | |
| | | logger.error(LocalizableMessage.raw("Second historical value: %s", av)); |
| | | } |
| | | |
| | | LinkedList<ReplicationMsg> opList = new LinkedList<ReplicationMsg>(); |
| | | LinkedList<ReplicationMsg> opList = new LinkedList<>(); |
| | | TestBroker session = new TestBroker(opList); |
| | | |
| | | CSN csn = new CSN(startTime, 0, serverId); |
| | |
| | | logger.error(LocalizableMessage.raw(hv[1])); |
| | | CSN fromCSN = new CSN(hv[1]); |
| | | |
| | | opList = new LinkedList<ReplicationMsg>(); |
| | | opList = new LinkedList<>(); |
| | | session = new TestBroker(opList); |
| | | |
| | | result = rd1.buildAndPublishMissingChanges(fromCSN, session); |
| | |
| | | "description: foo"); |
| | | assertEquals(resultCode, 0); |
| | | |
| | | LinkedList<ReplicationMsg> opList = new LinkedList<ReplicationMsg>(); |
| | | LinkedList<ReplicationMsg> opList = new LinkedList<>(); |
| | | TestBroker session = new TestBroker(opList); |
| | | |
| | | // Call the buildAndPublishMissingChanges and check that this method |
| | |
| | | { |
| | | Attribute attr = Attributes.create(attrType.getNormalizedPrimaryName(), newValue); |
| | | Modification mod = new Modification(ModificationType.ADD, attr); |
| | | List<Modification> mods = new ArrayList<Modification>(1); |
| | | List<Modification> mods = new ArrayList<>(1); |
| | | mods.add(mod); |
| | | broker.publish(new ModifyMsg(changeNum, dn, mods, entryuuid)); |
| | | } |
| | |
| | | // using a replication server that is not started |
| | | |
| | | int replServerPort = TestCaseUtils.findFreePort(); |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | replServers.add("localhost:" + replServerPort); |
| | | DomainFakeCfg domainConf = |
| | | new DomainFakeCfg(baseDn, serverId, replServers); |
| | |
| | | builder.add("value1"); |
| | | builder.add("value2"); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | entry.addAttribute(builder.toAttribute(), duplicateValues); |
| | | |
| | | |
| | |
| | | builder.add("value3"); |
| | | builder.add("value4"); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | entry.addAttribute(builder.toAttribute(), duplicateValues); |
| | | |
| | | |
| | |
| | | |
| | | // Create a single valued attribute with value : "value1" |
| | | // add this attribute to the entry. |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | Attribute attribute = Attributes.create(EMPLOYEENUMBER, "value1"); |
| | | entry.addAttribute(attribute, duplicateValues); |
| | | |
| | |
| | | |
| | | // Create a single valued attribute with value : "value1" |
| | | // add this attribute to the entry. |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | Attribute attribute = Attributes.create(EMPLOYEENUMBER, "value1"); |
| | | entry.addAttribute(attribute, duplicateValues); |
| | | |
| | |
| | | builder.add("value1"); |
| | | builder.add("value2"); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | entry.addAttribute(builder.toAttribute(), duplicateValues); |
| | | |
| | | // load historical from the entry |
| | |
| | | |
| | | // Create a single valued attribute with value : "value1" |
| | | // add this attribute to the entry. |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | Attribute attribute = Attributes.create(DISPLAYNAME, "value1"); |
| | | entry.addAttribute(attribute, duplicateValues); |
| | | Attribute attrDel = buildSyncHist(DISPLAYNAME, |
| | |
| | | builder.add("value3"); |
| | | builder.add("value4"); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | entry.addAttribute(builder.toAttribute(), duplicateValues); |
| | | |
| | | // load historical from the entry |
| | |
| | | builder.add("value3"); |
| | | builder.add("value4"); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | entry.addAttribute(builder.toAttribute(), duplicateValues); |
| | | |
| | | // load historical from the entry |
| | |
| | | |
| | | // Create a single valued attribute with value : "value1" |
| | | // add this attribute to the entry. |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | Attribute attribute = Attributes.create(DISPLAYNAME, "value1"); |
| | | entry.addAttribute(attribute, duplicateValues); |
| | | |
| | |
| | | attr = Attributes.create(DESCRIPTION, "Init Value"); |
| | | Modification mod2 = new Modification(ModificationType.ADD, attr); |
| | | |
| | | List<Modification> mods = new LinkedList<Modification>(); |
| | | List<Modification> mods = new LinkedList<>(); |
| | | mods.add(mod1); |
| | | mods.add(mod2); |
| | | |
| | |
| | | attr = Attributes.empty(DESCRIPTION); |
| | | Modification mod2 = new Modification(ModificationType.REPLACE, attr); |
| | | |
| | | List<Modification> mods = new LinkedList<Modification>(); |
| | | List<Modification> mods = new LinkedList<>(); |
| | | mods.add(mod1); |
| | | mods.add(mod2); |
| | | |
| | | List<Modification> mods2 = new LinkedList<Modification>(mods); |
| | | List<Modification> mods2 = new LinkedList<>(mods); |
| | | replayModifies(entry, hist, mods, 12); |
| | | assertEquals(hist.encodeAndPurge(), attrDel); |
| | | assertEquals(mods.size(), 2, |
| | |
| | | attr = Attributes.create(DESCRIPTION, "Init Value"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr); |
| | | |
| | | List<Modification> mods = new LinkedList<Modification>(); |
| | | List<Modification> mods = new LinkedList<>(); |
| | | mods.add(mod1); |
| | | mods.add(mod2); |
| | | |
| | |
| | | * for all these tests. |
| | | */ |
| | | DN dn = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | Map<ObjectClass, String> objectClasses = new HashMap<ObjectClass, String>(); |
| | | Map<ObjectClass, String> objectClasses = new HashMap<>(); |
| | | ObjectClass org = DirectoryServer.getObjectClass(ORGANIZATION); |
| | | objectClasses.put(org, ORGANIZATION); |
| | | |
| | |
| | | UUID uuid = UUID.randomUUID(); |
| | | |
| | | // Create the att values list |
| | | ArrayList<Attribute> uuidList = new ArrayList<Attribute>(1); |
| | | Attribute uuidAttr = Attributes.create(entryuuidAttrType, uuid |
| | | .toString()); |
| | | ArrayList<Attribute> uuidList = new ArrayList<>(1); |
| | | Attribute uuidAttr = Attributes.create(entryuuidAttrType, uuid.toString()); |
| | | uuidList.add(uuidAttr); |
| | | |
| | | // Add the uuid in the entry |
| | | Map<AttributeType, List<Attribute>> operationalAttributes = entry |
| | | .getOperationalAttributes(); |
| | | |
| | | Map<AttributeType, List<Attribute>> operationalAttributes = entry.getOperationalAttributes(); |
| | | operationalAttributes.put(entryuuidAttrType, uuidList); |
| | | return entry; |
| | | } |
| | |
| | | InternalClientConnection.getRootConnection(); |
| | | CSN t = new CSN(date, 0, 0); |
| | | |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | mods.add(mod); |
| | | |
| | | ModifyOperationBasis modOpBasis = |
| | |
| | | builder.add("value1"); |
| | | builder.add("value2"); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | entry.addAttribute(builder.toAttribute(), duplicateValues); |
| | | |
| | | // load historical from the entry |
| | |
| | | builder.add("value2"); |
| | | builder.add("value3"); |
| | | |
| | | List<ByteString> duplicateValues = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicateValues = new LinkedList<>(); |
| | | entry.addAttribute(builder.toAttribute(), duplicateValues); |
| | | |
| | | // load historical from the entry |
| | |
| | | private ReplicationServer createReplicationServer(int serverId, String suffix) |
| | | throws ConfigException |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | int port = -1; |
| | | if (serverId == RS1_ID) |
| | | { |
| | |
| | | private LDAPReplicationDomain createReplicationDomain(DN baseDn, int serverId) |
| | | throws Exception |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | // Create a domain with two replication servers |
| | | replServers.add("localhost:" + rs1Port); |
| | |
| | | */ |
| | | private SortedSet<String> createRSListForTestCase(String testCase) |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | final int nbRSs = getNbRSs(testCase); |
| | | for (int i = 0; i < nbRSs; i++) |
| | |
| | | private ReplicationServer createReplicationServer(int rsIndex, |
| | | int weight, String testCase) throws Exception |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | int nbRSs = getNbRSs(testCase); |
| | | for (int i = 0; i < nbRSs; i++) |
| | |
| | | private ReplicationServerCfg createReplicationServerConfigWithNewWeight |
| | | (int rsIndex, int weight, String testCase) |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | if ("testFailoversAndWeightChanges".equals(testCase) |
| | | || "testSpreadLoad".equals(testCase)) |
| | |
| | | private ReplicationServer createReplicationServer(String testCase, |
| | | int degradedStatusThreshold) throws Exception |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | String dir = "stateMachineTest" + RS1_ID + testCase + "Db"; |
| | | ReplServerFakeConfiguration conf = |
| | |
| | | @SuppressWarnings("unchecked") |
| | | private LDAPReplicationDomain createReplicationDomain(int dsId) throws Exception |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | replServers.add("localhost:" + rs1Port); |
| | | |
| | | DomainFakeCfg domainConf = new DomainFakeCfg(EXAMPLE_DN_, dsId, replServers); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS. |
| | | * Portions copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | * <p> |
| | | * Not all the methods are implemented. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class TestSynchronousReplayQueue implements BlockingQueue<UpdateToReplay> |
| | | { |
| | | private LinkedList<UpdateToReplay> list = new LinkedList<UpdateToReplay>(); |
| | | private LinkedList<UpdateToReplay> list = new LinkedList<>(); |
| | | |
| | | @Override |
| | | public boolean add(UpdateToReplay e) |
| | |
| | | /** Assured conf definitions. */ |
| | | private static final AssuredType DS1_AT = AssuredType.NOT_ASSURED; |
| | | private static final int DS1_SDL = -1; |
| | | private static SortedSet<String> DS1_RU = new TreeSet<String>(); |
| | | private static SortedSet<String> DS1_RU = new TreeSet<>(); |
| | | |
| | | private static final AssuredType DS2_AT = AssuredType.SAFE_READ; |
| | | private static final int DS2_SDL = -1; |
| | | private static SortedSet<String> DS2_RU = new TreeSet<String>(); |
| | | private static SortedSet<String> DS2_RU = new TreeSet<>(); |
| | | |
| | | private static final AssuredType DS3_AT = AssuredType.SAFE_DATA; |
| | | private static final int DS3_SDL = 1; |
| | | private static SortedSet<String> DS3_RU = new TreeSet<String>(); |
| | | private static SortedSet<String> DS3_RU = new TreeSet<>(); |
| | | |
| | | private static final AssuredType DS4_AT = AssuredType.SAFE_READ; |
| | | private static final int DS4_SDL = -1; |
| | | private static SortedSet<String> DS4_RU = new TreeSet<String>(); |
| | | private static SortedSet<String> DS4_RU = new TreeSet<>(); |
| | | |
| | | private static final AssuredType DS5_AT = AssuredType.SAFE_DATA; |
| | | private static final int DS5_SDL = 2; |
| | | private static SortedSet<String> DS5_RU = new TreeSet<String>(); |
| | | private static SortedSet<String> DS5_RU = new TreeSet<>(); |
| | | |
| | | private static final AssuredType DS6_AT = AssuredType.SAFE_READ; |
| | | private static final int DS6_SDL = -1; |
| | | private static SortedSet<String> DS6_RU = new TreeSet<String>(); |
| | | private static SortedSet<String> DS6_RU = new TreeSet<>(); |
| | | |
| | | private static String LOCAL_HOST_NAME; |
| | | |
| | |
| | | */ |
| | | private SortedSet<String> createRSListExceptOne(int rsIdToExclude) |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | |
| | | if (rsIdToExclude != RS1_ID) |
| | | { |
| | |
| | | private LDAPReplicationDomain createReplicationDomain(int dsId) |
| | | throws Exception |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | int groupId = -1; |
| | | AssuredType assuredType = null; |
| | | int assuredSdLevel = -100; |
| | |
| | | AssuredType assuredType = null; |
| | | int assuredSdLevel = -100; |
| | | SortedSet<String> refUrls = null; |
| | | Set<String> eclIncludes = new HashSet<String>(); |
| | | Set<String> eclIncludes = new HashSet<>(); |
| | | short protocolVersion = ProtocolVersion.getCurrentVersion(); |
| | | |
| | | switch (dsId) |
| | |
| | | */ |
| | | private TopoView createTheoreticalTopoViewForStep(int step) |
| | | { |
| | | List<DSInfo> dsList = new ArrayList<DSInfo>(); |
| | | List<RSInfo> rsList = new ArrayList<RSInfo>(); |
| | | List<DSInfo> dsList = new ArrayList<>(); |
| | | List<RSInfo> rsList = new ArrayList<>(); |
| | | |
| | | switch (step) |
| | | { |
| | |
| | | rd.getGroupId(), rd.getRefUrls(), |
| | | rd.getEclIncludes(), rd.getEclIncludesForDeletes(), |
| | | ProtocolVersion.getCurrentVersion()); |
| | | final List<DSInfo> dsList = |
| | | new ArrayList<DSInfo>(rd.getReplicaInfos().values()); |
| | | final List<DSInfo> dsList = new ArrayList<>(rd.getReplicaInfos().values()); |
| | | dsList.add(dsInfo); |
| | | |
| | | TopoView dsTopoView = new TopoView(dsList, rd.getRsInfos()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | // Create VLAST message |
| | | Attribute objectClass = Attributes.create(DirectoryServer |
| | | .getObjectClassAttributeType(), "organization"); |
| | | HashMap<ObjectClass, String> objectClassList = new HashMap<ObjectClass, String>(); |
| | | HashMap<ObjectClass, String> objectClassList = new HashMap<>(); |
| | | objectClassList.put(DirectoryServer.getObjectClass("organization"), |
| | | "organization"); |
| | | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | List<Attribute> userAttributes = newList(attr); |
| | | HashMap<AttributeType, List<Attribute>> userAttList = new HashMap<AttributeType, List<Attribute>>(); |
| | | HashMap<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), userAttributes); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsName", "dc=creator"); |
| | | List<Attribute> operationalAttributes = newList(attr); |
| | | HashMap<AttributeType,List<Attribute>> opList= |
| | | new HashMap<AttributeType,List<Attribute>>(); |
| | | HashMap<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), operationalAttributes); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<Modification>(); |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<Modification>(); |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<Modification>(); |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<Modification>(); |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | |
| | | |
| | | Attribute objectClass = Attributes.create(DirectoryServer |
| | | .getObjectClassAttributeType(), "organization"); |
| | | Map<ObjectClass, String> objectClassList = |
| | | new HashMap<ObjectClass, String>(); |
| | | objectClassList.put(DirectoryServer.getObjectClass("organization"), |
| | | "organization"); |
| | | Map<ObjectClass, String> objectClassList = new HashMap<>(); |
| | | objectClassList.put(DirectoryServer.getObjectClass("organization"), "organization"); |
| | | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | List<Attribute> userAttributes = newList(attr); |
| | | Map<AttributeType, List<Attribute>> userAttList = |
| | | new HashMap<AttributeType, List<Attribute>>(); |
| | | Map<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), userAttributes); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsname", "dc=creator"); |
| | | List<Attribute> operationalAttributes = newList(attr); |
| | | Map<AttributeType, List<Attribute>> opList = |
| | | new HashMap<AttributeType, List<Attribute>>(); |
| | | Map<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), operationalAttributes); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | |
| | | @DataProvider(name = "createStartSessionData") |
| | | public Object[][] createStartSessionData() |
| | | { |
| | | List<String> urls1 = new ArrayList<String>(); |
| | | List<String> urls1 = new ArrayList<>(); |
| | | urls1.add("ldap://ldap.iplanet.com/" + TEST_ROOT_DN_STRING + "??sub?(sn=Jensen)"); |
| | | urls1.add("ldaps://ldap.iplanet.com:4041/uid=bjensen,ou=People," + |
| | | TEST_ROOT_DN_STRING + "?cn,mail,telephoneNumber"); |
| | | |
| | | List<String> urls2 = new ArrayList<String>(); |
| | | List<String> urls2 = new ArrayList<>(); |
| | | urls2.add("ldap://ldap.example.com/" + TEST_ROOT_DN_STRING + "?objectClass?one"); |
| | | urls2.add("ldap://host.example.com/ou=people," + TEST_ROOT_DN_STRING + "???(sn=a*)"); |
| | | |
| | | List<String> urls3 = new ArrayList<String>(); |
| | | List<String> urls3 = new ArrayList<>(); |
| | | urls3.add("ldaps://host:port/dc=foo??sub?(sn=John Doe)"); |
| | | urls3.add("ldap://jnumail1.state.ak.us/o=state.ak.us?mail,departmentnumber" |
| | | + "?sub?(&(departmentnumber=04*) (l=Juneau))"); |
| | | |
| | | List<String> urls4 = new ArrayList<String>(); |
| | | List<String> urls4 = new ArrayList<>(); |
| | | |
| | | List<String> urls5 = new ArrayList<String>(); |
| | | List<String> urls5 = new ArrayList<>(); |
| | | urls5.add("ldaps://host:port/dc=foo??sub?(sn=One Entry)"); |
| | | |
| | | List<String> urls6 = new ArrayList<String>(); |
| | | List<String> urls6 = new ArrayList<>(); |
| | | urls6.add("ldaps://host:port/dc=foo??sub?(sn=One Entry)"); |
| | | urls6.add("ldaps://host:port/dc=foo??sub?(sn=Second Entry)"); |
| | | urls6.add("ldaps://host:port/dc=foo??sub?(sn=Third Entry)"); |
| | |
| | | public void addMsgPerfs(String rawDN, boolean isAssured, AssuredMode assuredMode, |
| | | byte safeDataLevel, List<Attribute> entryAttrList) throws Exception |
| | | { |
| | | Map<ObjectClass, String> objectClassList = new HashMap<ObjectClass, String>(); |
| | | Map<ObjectClass, String> objectClassList = new HashMap<>(); |
| | | objectClassList.put(DirectoryServer.getObjectClass("organization"), "organization"); |
| | | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | Map<AttributeType, List<Attribute>> userAttList = new HashMap<AttributeType, List<Attribute>>(); |
| | | Map<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), newList(attr)); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsname", "dc=creator"); |
| | | Map<AttributeType, List<Attribute>> opList = new HashMap<AttributeType,List<Attribute>>(); |
| | | Map<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), newList(attr)); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | |
| | | private SortedSet<String> generateOtherReplicationServerUrls( |
| | | int excludedRsPort, int totalNbRS) |
| | | { |
| | | SortedSet<String> replServers = new TreeSet<String>(); |
| | | SortedSet<String> replServers = new TreeSet<>(); |
| | | if (totalNbRS >= 2) |
| | | { |
| | | addIfNotSame(replServers, rsPorts[0], excludedRsPort); |
| | |
| | | private int timeoutUpdates; |
| | | private int wrongStatusUpdates; |
| | | private int replayErrorUpdates; |
| | | private final Map<Integer, Integer> serverNotAcknowledgedUpdates = |
| | | new HashMap<Integer, Integer>(); |
| | | private final Map<Integer, Integer> serverNotAcknowledgedUpdates = new HashMap<>(); |
| | | private int receivedUpdates; |
| | | private int receivedUpdatesAcked; |
| | | private int receivedUpdatesNotAcked; |
| | |
| | | private Object[][] testSafeDataLevelHighProvider() |
| | | { |
| | | // Construct all possible combinations of parameters |
| | | List<List<Object>> objectArrayList = new ArrayList<List<Object>>(); |
| | | List<List<Object>> objectArrayList = new ArrayList<>(); |
| | | |
| | | // Safe Data Level |
| | | objectArrayList = addPossibleParameters(objectArrayList, 2, 3); |
| | |
| | | */ |
| | | private List<List<Object>> addPossibleParameters(List<List<Object>> objectArrayList, Object... possibleParameters) |
| | | { |
| | | List<List<Object>> newObjectArrayList = new ArrayList<List<Object>>(); |
| | | List<List<Object>> newObjectArrayList = new ArrayList<>(); |
| | | |
| | | if (objectArrayList.size() == 0) |
| | | { |
| | |
| | | // Add each possible parameter to the already existing list |
| | | for (Object possibleParameter : possibleParameters) |
| | | { |
| | | final List<Object> newObjectArray = new ArrayList<Object>(objectArray); |
| | | final List<Object> newObjectArray = new ArrayList<>(objectArray); |
| | | newObjectArray.add(possibleParameter); |
| | | newObjectArrayList.add(newObjectArray); |
| | | } |
| | |
| | | */ |
| | | private Set<Integer> computeExpectedServersInError(List<Integer> eligibleServers, List<Integer> expectedServers) |
| | | { |
| | | Set<Integer> expectedServersInError = new HashSet<Integer>(eligibleServers); |
| | | Set<Integer> expectedServersInError = new HashSet<>(eligibleServers); |
| | | expectedServersInError.removeAll(expectedServers); |
| | | return expectedServersInError; |
| | | } |
| | |
| | | */ |
| | | private List<Integer> computeEligibleServersSafeData(int fakeRs1Gid, long fakeRs1GenId, int fakeRs2Gid, long fakeRs2GenId, int fakeRs3Gid, long fakeRs3GenId) |
| | | { |
| | | List<Integer> eligibleServers = new ArrayList<Integer>(3); |
| | | List<Integer> eligibleServers = new ArrayList<>(3); |
| | | if (areGroupAndGenerationIdOk(fakeRs1Gid, fakeRs1GenId)) |
| | | { |
| | | eligibleServers.add(FRS1_ID); |
| | |
| | | int rs2Gid, long rs2GenId, int rs2Scen, |
| | | int rs3Gid, long rs3GenId, int rs3Scen) |
| | | { |
| | | List<Integer> expectedServers = new ArrayList<Integer>(); |
| | | List<Integer> expectedServers = new ArrayList<>(); |
| | | assertRSExpectations(expectedServers, rs1Gid, rs1GenId, rs1Scen, FRS1_ID); |
| | | assertRSExpectations(expectedServers, rs2Gid, rs2GenId, rs2Scen, FRS2_ID); |
| | | assertRSExpectations(expectedServers, rs3Gid, rs3GenId, rs3Scen, FRS3_ID); |
| | |
| | | @DataProvider(name = "testSafeDataFromRSProvider") |
| | | private Object[][] testSafeDataFromRSProvider() |
| | | { |
| | | List<List<Object>> objectArrayList = new ArrayList<List<Object>>(); |
| | | List<List<Object>> objectArrayList = new ArrayList<>(); |
| | | |
| | | // Safe Data Level |
| | | objectArrayList = addPossibleParameters(objectArrayList, 1, 2, 3); |
| | |
| | | @DataProvider(name = "testSafeReadOneRSComplexProvider") |
| | | private Object[][] testSafeReadOneRSComplexProvider() |
| | | { |
| | | List<List<Object>> objectArrayList = new ArrayList<List<Object>>(); |
| | | List<List<Object>> objectArrayList = new ArrayList<>(); |
| | | |
| | | // Other additional DS group id |
| | | objectArrayList = addPossibleParameters(objectArrayList, DEFAULT_GID, OTHER_GID); |
| | |
| | | private ReplicationServer createReplicationServer(int changelogId, |
| | | boolean all, String suffix) throws Exception |
| | | { |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | if (all) |
| | | { |
| | | if (changelogId != changelog1ID) |
| | |
| | | changelogs[i] = null; |
| | | |
| | | // create the 2 connected replicationServer |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | servers.add( |
| | | "localhost:" + ((i == 0) ? changelogPorts[1] : changelogPorts[0])); |
| | | ReplServerFakeConfiguration conf = |
| | |
| | | |
| | | { |
| | | // create the 1rst replicationServer, the second one will be created later |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | servers.add("localhost:" + changelogPorts[1]); |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(changelogPorts[0], "replicationServerTestChangelogChainingDb"+0, replicationDbImplementation, |
| | |
| | | ModifyDNMsg modDNMsg = new ModifyDNMsg(localOp); |
| | | broker1.publish(modDNMsg); |
| | | |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | servers.add("localhost:"+changelogPorts[0]); |
| | | ReplServerFakeConfiguration conf = new ReplServerFakeConfiguration( |
| | | changelogPorts[1], null, replicationDbImplementation, 0, changelogIds[1], 0, 100, null); |
| | |
| | | |
| | | private List<ReplicationMsg> receiveReplicationMsgs(ReplicationBroker broker2, int nbMessagesExpected) |
| | | { |
| | | List<ReplicationMsg> msgs = new ArrayList<ReplicationMsg>(nbMessagesExpected); |
| | | List<ReplicationMsg> msgs = new ArrayList<>(nbMessagesExpected); |
| | | for (int i = 0; i < nbMessagesExpected; i++) |
| | | { |
| | | try |
| | |
| | | changelogs[i] = null; |
| | | // create the 2 replicationServer |
| | | // and connect the first one to the other one |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | |
| | | // Connect only replicationServer[0] to ReplicationServer[1] |
| | | // and not the other way |
| | |
| | | // Then change the config to remove replicationServer[1] from |
| | | // the configuration of replicationServer[0] |
| | | |
| | | SortedSet<String> servers = new TreeSet<String>(); |
| | | SortedSet<String> servers = new TreeSet<>(); |
| | | // Configure replicationServer[0] to be disconnected from ReplicationServer[1] |
| | | ReplServerFakeConfiguration conf = |
| | | new ReplServerFakeConfiguration(changelogPorts[0], "changelogDb0", replicationDbImplementation, |
| | |
| | | private List<Integer> getShuffledKeys(long fileSizeInBytes, int numberOfKeys) |
| | | { |
| | | final int numberOfValues = (int) fileSizeInBytes / INT_RECORD_SIZE; |
| | | final List<Integer> values = new ArrayList<Integer>(numberOfValues); |
| | | final List<Integer> values = new ArrayList<>(numberOfValues); |
| | | for (int i = 0; i < numberOfValues; i++) |
| | | { |
| | | values.add(i+1); |
| | |
| | | /** Helper to build a list of records. */ |
| | | private List<Record<Integer, Integer>> records(int...keys) |
| | | { |
| | | List<Record<Integer, Integer>> records = new ArrayList<Record<Integer, Integer>>(); |
| | | List<Record<Integer, Integer>> records = new ArrayList<>(); |
| | | for (int key : keys) |
| | | { |
| | | records.add(Record.from(key, key)); |
| | |
| | | CursorOptions options = new CursorOptions(LESS_THAN_OR_EQUAL_TO_KEY, ON_MATCHING_KEY, null); |
| | | multiDomainCursor = new MultiDomainDBCursor(domainDB, options); |
| | | initialState = new ChangelogState(); |
| | | replicaDBCursors = new HashMap<ReplicaId, SequentialDBCursor>(); |
| | | domainDBCursors = new HashMap<DN, DomainDBCursor>(); |
| | | domainNewestCSNs = new HashMap<DN, ServerState>(); |
| | | replicaDBCursors = new HashMap<>(); |
| | | domainDBCursors = new HashMap<>(); |
| | | domainNewestCSNs = new HashMap<>(); |
| | | |
| | | when(changelogDB.getChangeNumberIndexDB()).thenReturn(cnIndexDB); |
| | | when(changelogDB.getReplicationDomainDB()).thenReturn(domainDB); |
| | |
| | | private CursorOptions options; |
| | | private MultiDomainDBCursor multiDomainCursor; |
| | | private ECLMultiDomainDBCursor eclCursor; |
| | | private final Set<DN> eclEnabledDomains = new HashSet<DN>(); |
| | | private final Set<DN> eclEnabledDomains = new HashSet<>(); |
| | | private ECLEnabledDomainPredicate predicate = new ECLEnabledDomainPredicate() |
| | | { |
| | | @Override |
| | |
| | | replicaDB = newReplicaDB(replicationServer); |
| | | |
| | | final CSN[] csns = generateCSNs(1, System.currentTimeMillis(), 5); |
| | | final ArrayList<CSN> csns2 = new ArrayList<CSN>(Arrays.asList(csns)); |
| | | final ArrayList<CSN> csns2 = new ArrayList<>(Arrays.asList(csns)); |
| | | csns2.remove(csns[3]); |
| | | |
| | | for (CSN csn : csns2) |
| | |
| | | Log<String, String> writeLog2 = openLog(LogFileTest.RECORD_PARSER)) |
| | | { |
| | | writeLog1.append(Record.from("key020", "starting record")); |
| | | AtomicReference<ChangelogException> exceptionRef = new AtomicReference<ChangelogException>(); |
| | | AtomicReference<ChangelogException> exceptionRef = new AtomicReference<>(); |
| | | Thread write1 = getWriteLogThread(writeLog1, "a", exceptionRef); |
| | | Thread write2 = getWriteLogThread(writeLog2, "b", exceptionRef); |
| | | write1.run(); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014 ForgeRock AS. |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.replication.server.changelog.file; |
| | | |
| | |
| | | public void testReadChangelogStateWithMultipleDN() throws Exception |
| | | { |
| | | Log<Long,ChangeNumberIndexRecord> cnDB = null; |
| | | List<Log<CSN,UpdateMsg>> replicaDBs = new ArrayList<Log<CSN,UpdateMsg>>(); |
| | | List<Log<CSN,UpdateMsg>> replicaDBs = new ArrayList<>(); |
| | | try |
| | | { |
| | | File rootPath = new File(TEST_DIRECTORY_CHANGELOG); |
| | |
| | | */ |
| | | public SequentialDBCursor(UpdateMsg... msgs) |
| | | { |
| | | this.msgs = new ArrayList<UpdateMsg>(Arrays.asList(msgs)); |
| | | this.msgs = new ArrayList<>(Arrays.asList(msgs)); |
| | | } |
| | | |
| | | public void add(UpdateMsg msg) |
| | |
| | | private Map<Integer, ReplicationServerInfo> newRSInfos( |
| | | ReplicationServerInfo... rsInfos) |
| | | { |
| | | Map<Integer, ReplicationServerInfo> results = |
| | | new HashMap<Integer, ReplicationServerInfo>(); |
| | | Map<Integer, ReplicationServerInfo> results = new HashMap<>(); |
| | | for (ReplicationServerInfo rsInfo : rsInfos) |
| | | { |
| | | results.put(rsInfo.getServerId(), rsInfo); |
| | |
| | | private void containsOnly(final Map<Integer, LocalizableMessage> evaluations, |
| | | MapEntry... entries) |
| | | { |
| | | final List<MapEntry> notFound = new ArrayList<MapEntry>(Arrays.asList(entries)); |
| | | final List<MapEntry> notFound = new ArrayList<>(Arrays.asList(entries)); |
| | | for (Iterator<MapEntry> iter = notFound.iterator(); iter.hasNext();) |
| | | { |
| | | final MapEntry entry = iter.next(); |
| | |
| | | /** Contains ordinal for each message. */ |
| | | private Map<Integer, Integer> getOrdinal(Map<Integer, LocalizableMessage> evaluations) |
| | | { |
| | | final Map<Integer, Integer> result = new LinkedHashMap<Integer, Integer>(); |
| | | final Map<Integer, Integer> result = new LinkedHashMap<>(); |
| | | for (Entry<Integer, LocalizableMessage> entry : evaluations.entrySet()) |
| | | { |
| | | result.put(entry.getKey(), entry.getValue().ordinal()); |
| | |
| | | * Expected winner: the RS |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "AwinnerHost:123", 0L, (byte)1, 1), |
| | | EMPTY_SET); |
| | |
| | | * Excepted winner: first in the list |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "BwinnerHost:123", 0L, (byte)1, 1), |
| | | EMPTY_SET); |
| | |
| | | * Excepted winner: R2 (still no connected DS) |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | |
| | | * and have same weight |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "DwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | |
| | | * Excepted winner: RS2 -> 2 DSs on each RS |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * Excepted winner: RS2 -> go to perfect load balance |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | |
| | | * highest weight |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | |
| | | * highest weight |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * highest weight |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | |
| | | * Excepted winner: RS1 -> misses more DSs than RS3 |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "JwinnerHost:123", 0L, (byte)1, 5), |
| | | newSet(1, 2, 3)); |
| | |
| | | * Excepted winner: RS2 (stay connected to it as load correctly spread) |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1)); |
| | |
| | | * Excepted winner: RS2 (one must disconnect from RS1) |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * one with the lowest id so not DS with server id 2) |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "MwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * Excepted winner: RS2 no change as load correctly spread |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4, 5, 6)); |
| | |
| | | * previous test where the loads were ok) |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | |
| | | * is one of the two lowest ids connected to RS4 |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "PwinnerHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | |
| | | * is not one of the two lowest ids connected to RS4 |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | |
| | | * previous test where the loads were ok) |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte) 1, 3), |
| | | newSet(1, 2, 3, 4)); |
| | |
| | | * RS. |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "RwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * Note: Same test as before, but not with the lowest local DS server id |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "SwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * the local server would not stop going and coming back between RSs. |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "TwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * the local server would not stop going and coming back between RSs. |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "UwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2, 3)); |
| | |
| | | * RS3 |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "looserHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * DS server id 1 should disconnect for reconnection to RS3 |
| | | */ |
| | | |
| | | rsInfos = new HashMap<Integer, ReplicationServerInfo>(); |
| | | rsInfos = new HashMap<>(); |
| | | put(rsInfos, |
| | | new RSInfo(11, "WwinnerHost:123", 0L, (byte)1, 1), |
| | | newSet(1, 2)); |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2014 ForgeRock AS |
| | | * Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.service; |
| | | |
| | |
| | | { |
| | | return Collections.emptyMap(); |
| | | } |
| | | final Map<Integer, ReplicationServerInfo> map = |
| | | new HashMap<Integer, ReplicationServerInfo>(); |
| | | final Map<Integer, ReplicationServerInfo> map = new HashMap<>(); |
| | | for (ReplicationServerInfo info : infos) |
| | | { |
| | | map.put(info.getServerId(), info); |
| | |
| | | |
| | | private Map<Integer, DSInfo> newMap(DSInfo... dsInfos) |
| | | { |
| | | final Map<Integer, DSInfo> results = new HashMap<Integer, DSInfo>(); |
| | | final Map<Integer, DSInfo> results = new HashMap<>(); |
| | | for (DSInfo dsInfo : dsInfos) |
| | | { |
| | | results.put(dsInfo.getDsId(), dsInfo); |
| | |
| | | "ReplicationDomainTestDb2", 100, "localhost:" + replServerPort1); |
| | | |
| | | SortedSet<String> servers = newSortedSet("localhost:" + replServerPort1); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<UpdateMsg>(); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<>(); |
| | | domain1 = new FakeReplicationDomain( |
| | | testService, domain1ServerId, servers, 100, 1000, rcvQueue1); |
| | | |
| | | SortedSet<String> servers2 = newSortedSet("localhost:" + replServerPort2); |
| | | BlockingQueue<UpdateMsg> rcvQueue2 = new LinkedBlockingQueue<UpdateMsg>(); |
| | | BlockingQueue<UpdateMsg> rcvQueue2 = new LinkedBlockingQueue<>(); |
| | | domain2 = new FakeReplicationDomain( |
| | | testService, domain2ServerId, servers2, 100, 1000, rcvQueue2); |
| | | |
| | |
| | | "ReplicationDomainTestDb", 100000, "localhost:" + replServerPort); |
| | | |
| | | SortedSet<String> servers = newSortedSet("localhost:" + replServerPort); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<UpdateMsg>(); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<>(); |
| | | domain1 = new FakeReplicationDomain( |
| | | testService, domain1ServerId, servers, 1000, 100000, rcvQueue1); |
| | | |
| | |
| | | replServer = createReplicationServer(replServerID, SENDERPORT, |
| | | "ReplicationDomainTestDb", 100, servers); |
| | | |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<UpdateMsg>(); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<>(); |
| | | domain1 = new FakeStressReplicationDomain( |
| | | testService, 2, servers, 1000, rcvQueue1); |
| | | |
| | |
| | | replServer = createReplicationServer(replServerID, RECEIVERPORT, |
| | | "ReplicationDomainTestDb", 100, servers); |
| | | |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<UpdateMsg>(); |
| | | BlockingQueue<UpdateMsg> rcvQueue1 = new LinkedBlockingQueue<>(); |
| | | domain1 = new FakeStressReplicationDomain( |
| | | testService, 1, servers, 100000, rcvQueue1); |
| | | /* |
| | |
| | | @Test |
| | | public void testSortControlLTERule() throws Exception |
| | | { |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(user4); |
| | | expectedDNOrder.add(user3); |
| | | expectedDNOrder.add(user2); |
| | | expectedDNOrder.add(user1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | requestControls.add(new ServerSideSortRequestControl("displayname:fr")); |
| | | ValidateSortControl("displayname:fr-FR.6:=A*", expectedDNOrder, requestControls); |
| | | } |
| | |
| | | @Test |
| | | public void testSortControlEQRule() throws Exception |
| | | { |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(user4); |
| | | expectedDNOrder.add(user3); |
| | | expectedDNOrder.add(user2); |
| | | expectedDNOrder.add(user1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | requestControls.add(new ServerSideSortRequestControl("displayname:es")); |
| | | ValidateSortControl("displayname:es.6:=A*", expectedDNOrder, requestControls); |
| | | } |
| | |
| | | @Test |
| | | public void testSortControlGTRule() throws Exception |
| | | { |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(user1); |
| | | expectedDNOrder.add(user2); |
| | | expectedDNOrder.add(user3); |
| | | expectedDNOrder.add(user4); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | requestControls.add(new ServerSideSortRequestControl("-displayname:en")); |
| | | ValidateSortControl("displayname:en-US.6:=A*", expectedDNOrder, requestControls); |
| | | } |
| | |
| | | @Test |
| | | public void testVLVSortControl() throws Exception |
| | | { |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<DN>(); |
| | | ArrayList<DN> expectedDNOrder = new ArrayList<>(); |
| | | expectedDNOrder.add(user4); |
| | | expectedDNOrder.add(user3); |
| | | expectedDNOrder.add(user2); |
| | | expectedDNOrder.add(user1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | requestControls.add(new ServerSideSortRequestControl("displayname:fr")); |
| | | requestControls.add(new VLVRequestControl(0, 4, 1, 0)); |
| | | ValidateSortControl("objectclass=inetOrgPerson", expectedDNOrder, requestControls); |
| | |
| | | |
| | | private ArrayList<DN> getDNs(InternalSearchOperation internalSearch) |
| | | { |
| | | ArrayList<DN> results = new ArrayList<DN>(); |
| | | ArrayList<DN> results = new ArrayList<>(); |
| | | for (Entry e : internalSearch.getSearchEntries()) |
| | | { |
| | | results.add(e.getName()); |
| | |
| | | @Test |
| | | public void testEnsureValidSyntaxOIDs() |
| | | { |
| | | TreeSet<String> invalidOIDs = new TreeSet<String>(); |
| | | TreeSet<String> invalidOIDs = new TreeSet<>(); |
| | | |
| | | Schema schema = DirectoryServer.getSchema(); |
| | | for (Syntax as : schema.getSyntaxes().values()) |
| | |
| | | @Test |
| | | public void testEnsureValidMatchingRuleOIDs() |
| | | { |
| | | TreeSet<String> invalidOIDs = new TreeSet<String>(); |
| | | TreeSet<String> invalidOIDs = new TreeSet<>(); |
| | | |
| | | Schema schema = DirectoryServer.getSchema(); |
| | | for (MatchingRule mr : schema.getMatchingRules().values()) |
| | |
| | | public void testEnsureValidAttributeTypeOIDs() |
| | | throws Exception |
| | | { |
| | | TreeSet<String> invalidOIDs = new TreeSet<String>(); |
| | | TreeSet<String> invalidOIDs = new TreeSet<>(); |
| | | |
| | | String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT); |
| | | File schemaDir = new File(new File(buildRoot, "resource"), "schema"); |
| | |
| | | public void testEnsureValidObjectClassOIDs() |
| | | throws Exception |
| | | { |
| | | TreeSet<String> invalidOIDs = new TreeSet<String>(); |
| | | TreeSet<String> invalidOIDs = new TreeSet<>(); |
| | | |
| | | String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT); |
| | | File schemaDir = new File(new File(buildRoot, "resource"), "schema"); |
| | |
| | | public void testEnsureValidNameFormOIDs() |
| | | throws Exception |
| | | { |
| | | TreeSet<String> invalidOIDs = new TreeSet<String>(); |
| | | TreeSet<String> invalidOIDs = new TreeSet<>(); |
| | | |
| | | String buildRoot = System.getProperty(TestCaseUtils.PROPERTY_BUILD_ROOT); |
| | | File schemaDir = new File(new File(buildRoot, "resource"), "schema"); |
| | |
| | | //There are other ways of doing it but we will extract the OID |
| | | //from the attribute values and then check to see if our |
| | | //OID is found in the result set or not. |
| | | List<String> syntaxList = new ArrayList<String>(); |
| | | List<String> syntaxList = new ArrayList<>(); |
| | | while(iter.hasNext()) |
| | | { |
| | | //parse the OIDs. |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | ArrayList<String[]> argLists = new ArrayList<>(); |
| | | ArrayList<String> reasonList = new ArrayList<>(); |
| | | |
| | | String[] args = new String[] {}; |
| | | argLists.add(args); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | requestControls.add(new PasswordPolicyRequestControl()); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | | |
| | | try |
| | | { |
| | | authHandler.doSASLBind(null, null, null, saslProperties, requestControls, |
| | | responseControls); |
| | | authHandler.doSASLBind(null, null, null, saslProperties, requestControls, responseControls); |
| | | } |
| | | finally |
| | | { |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | | |
| | | try |
| | | { |
| | | authHandler.doSASLBind(null, null, "", saslProperties, requestControls, |
| | | responseControls); |
| | | authHandler.doSASLBind(null, null, "", saslProperties, requestControls, responseControls); |
| | | } |
| | | finally |
| | | { |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("testDoSASLBindAnonymousDisabled"); |
| | | saslProperties.put("trace", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("testDoSASLBindAnonymous"); |
| | | saslProperties.put("trace", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("testDoSASLBindAnonymousMultivaluedTrace"); |
| | | propList.add("aSecondTraceStringWhichIsInvalid"); |
| | | saslProperties.put("trace", propList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("testDoSASLBindAnonymousInvalidProperty"); |
| | | saslProperties.put("invalid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | requestControls.add(new PasswordPolicyRequestControl()); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("testDoSASLBindAnonymous"); |
| | | saslProperties.put("trace", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add(""); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = null; |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | propList.add("u:test.user"); |
| | | saslProperties.put("authid", propList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("foo"); |
| | | saslProperties.put("invalid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | requestControls.add(new PasswordPolicyRequestControl()); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, this.hostname, messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, this.hostname, messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = null; |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("foo"); |
| | | saslProperties.put("invalid", propList); |
| | | LDAPAuthenticationHandler authHandler = |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | propList.add("u:test.user"); |
| | | saslProperties.put("authid", propList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add(""); |
| | | saslProperties.put("authid", propList); |
| | | LDAPAuthenticationHandler authHandler = |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | propList.add("dc=example,dc=com"); |
| | | saslProperties.put("realm", propList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("auth"); |
| | | saslProperties.put("qop", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("auth-int"); |
| | | saslProperties.put("qop", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("auth-conf"); |
| | | saslProperties.put("qop", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("invalid"); |
| | | saslProperties.put("qop", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("auth"); |
| | | propList.add("auth-int"); |
| | | propList.add("auth-conf"); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("ldap/value1"); |
| | | propList.add("ldap/value2"); |
| | | saslProperties.put("digest-uri", propList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | propList.add("u:test.user"); |
| | | saslProperties.put("authzid", propList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:invalid"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("u:nosuchuser"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("u:nosuchuser"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("u:nosuchuser"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | propList.add("o=test"); |
| | | saslProperties.put("realm", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | requestControls.add(new PasswordPolicyRequestControl()); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, this.hostname, messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("foo"); |
| | | saslProperties.put("invalid", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | requestControls.add(new PasswordPolicyRequestControl()); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = null; |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add(""); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | valueList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", valueList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | valueList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authzid", valueList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("kdc1"); |
| | | valueList.add("kdc2"); |
| | | saslProperties.put("kdc", valueList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("auth"); |
| | | valueList.add("auth-int"); |
| | | valueList.add("auth-conf"); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("auth-int"); |
| | | saslProperties.put("qop", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("auth-conf"); |
| | | saslProperties.put("qop", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("invalid"); |
| | | saslProperties.put("qop", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("realm1"); |
| | | valueList.add("realm2"); |
| | | saslProperties.put("realm", valueList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("foo"); |
| | | saslProperties.put("invalid", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("auth"); |
| | | saslProperties.put("qop", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = null; |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("dn:uid=test.user,o=test"); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authid", valueList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add(""); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("dn:uid=test.user,o=test"); |
| | | valueList.add("u:test.user"); |
| | | saslProperties.put("authzid", valueList); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", valueList); |
| | | |
| | | valueList = new ArrayList<String>(); |
| | | valueList = new ArrayList<>(); |
| | | valueList.add("foo"); |
| | | saslProperties.put("invalid", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | |
| | | ArrayList<String> valueList = new ArrayList<String>(); |
| | | ArrayList<String> valueList = new ArrayList<>(); |
| | | valueList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authzid", valueList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=does.not.exist,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=does.not.exist,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | requestControls.add(new PasswordPolicyRequestControl()); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("testDoSASLBindAnonymous"); |
| | | saslProperties.put("trace", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | | propList = new ArrayList<String>(); |
| | | propList = new ArrayList<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, this.hostname, messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | |
| | | LDAPAuthenticationHandler authHandler = |
| | | new LDAPAuthenticationHandler(r, w, "localhost", messageID); |
| | |
| | | LDAPWriter w = new LDAPWriter(s); |
| | | |
| | | AtomicInteger messageID = new AtomicInteger(1); |
| | | ArrayList<Control> requestControls = new ArrayList<Control>(); |
| | | ArrayList<Control> responseControls = new ArrayList<Control>(); |
| | | |
| | | LinkedHashMap<String,List<String>> saslProperties = |
| | | new LinkedHashMap<String,List<String>>(); |
| | | ArrayList<String> propList = new ArrayList<String>(); |
| | | ArrayList<Control> requestControls = new ArrayList<>(); |
| | | ArrayList<Control> responseControls = new ArrayList<>(); |
| | | LinkedHashMap<String, List<String>> saslProperties = new LinkedHashMap<>(); |
| | | ArrayList<String> propList = new ArrayList<>(); |
| | | propList.add("dn:uid=test.user,o=test"); |
| | | saslProperties.put("authid", propList); |
| | | |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | ArrayList<String[]> argLists = new ArrayList<>(); |
| | | ArrayList<String> reasonList = new ArrayList<>(); |
| | | |
| | | String[] args = {}; |
| | | argLists.add(args); |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | ArrayList<String[]> argLists = new ArrayList<>(); |
| | | ArrayList<String> reasonList = new ArrayList<>(); |
| | | |
| | | String[] args = new String[] |
| | | { |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | ArrayList<String[]> argLists = new ArrayList<>(); |
| | | ArrayList<String> reasonList = new ArrayList<>(); |
| | | |
| | | String[] args; |
| | | args = new String[] |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | ArrayList<String[]> argLists = new ArrayList<>(); |
| | | ArrayList<String> reasonList = new ArrayList<>(); |
| | | |
| | | String[] args = {}; |
| | | argLists.add(args); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | ArrayList<String[]> argLists = new ArrayList<>(); |
| | | ArrayList<String> reasonList = new ArrayList<>(); |
| | | |
| | | String[] args = {}; |
| | | argLists.add(args); |
| | |
| | | @DataProvider(name = "invalidArgs") |
| | | public Object[][] getInvalidArgumentLists() |
| | | { |
| | | ArrayList<String[]> argLists = new ArrayList<String[]>(); |
| | | ArrayList<String> reasonList = new ArrayList<String>(); |
| | | ArrayList<String[]> argLists = new ArrayList<>(); |
| | | ArrayList<String> reasonList = new ArrayList<>(); |
| | | |
| | | String[] args = new String[] {}; |
| | | argLists.add(args); |
| | |
| | | // Add the airius.com suffix to userRoot |
| | | final InternalClientConnection rootConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | final ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | final ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-cfg-base-dn", baseDN))); |
| | | // Backend should be disabled. |
| | |
| | | // remove the airius.com suffix to userRoot |
| | | final InternalClientConnection rootConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | final ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | final ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("ds-cfg-base-dn", baseDN))); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | |
| | | */ |
| | | private String[] setArgs(String... args) |
| | | { |
| | | final List<String> argsList = new LinkedList<String>(); |
| | | final List<String> argsList = new LinkedList<>(); |
| | | argsList.add("--configFile"); |
| | | argsList.add(configFilePath); |
| | | if (args != null) |
| | |
| | | // Add the airius.com suffix to userRoot |
| | | InternalClientConnection rootConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-cfg-base-dn", "o=airius.com"))); |
| | | String userRootDN = "ds-cfg-backend-id=userRoot,cn=Backends,cn=config"; |
| | |
| | | // remove the airius.com suffix to userRoot |
| | | InternalClientConnection rootConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | ArrayList<Modification> mods = new ArrayList<Modification>(); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.create("ds-cfg-base-dn", "o=airius.com"))); |
| | | String userRootDN = "ds-cfg-backend-id=userRoot,cn=Backends,cn=config"; |
| | |
| | | throws Exception |
| | | { |
| | | // Check containsAll(). |
| | | Set<ByteString> expectedValues = new HashSet<ByteString>(); |
| | | Set<ByteString> expectedValues = new HashSet<>(); |
| | | for (String value : values) |
| | | { |
| | | expectedValues.add(ByteString.valueOf(value)); |
| | |
| | | |
| | | if (values.length > 1) |
| | | { |
| | | Set<ByteString> subSet = new HashSet<ByteString>(expectedValues); |
| | | Set<ByteString> subSet = new HashSet<>(expectedValues); |
| | | subSet.remove(subSet.iterator()); |
| | | Assert.assertTrue(a.containsAll(subSet)); |
| | | } |
| | | |
| | | Set<ByteString> bigSet = new HashSet<ByteString>(expectedValues); |
| | | Set<ByteString> bigSet = new HashSet<>(expectedValues); |
| | | bigSet.add(ByteString.valueOf("xxxx")); |
| | | Assert.assertFalse(a.containsAll(bigSet)); |
| | | |
| | |
| | | options.length))); |
| | | } |
| | | |
| | | List<String> tmp = new ArrayList<String>(Arrays.asList(options)); |
| | | List<String> tmp = new ArrayList<>(Arrays.asList(options)); |
| | | tmp.add("xxxx"); |
| | | Assert.assertFalse(a.hasAllOptions(tmp)); |
| | | |
| | |
| | | Assert.assertFalse(a.optionsEqual(Collections.singleton(options[0]))); |
| | | } |
| | | |
| | | Set<String> stmp = new HashSet<String>(Arrays.asList(options)); |
| | | Set<String> stmp = new HashSet<>(Arrays.asList(options)); |
| | | stmp.add("xxxx"); |
| | | Assert.assertFalse(a.optionsEqual(stmp)); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | public void testMergeWithDuplicates(int testCase, Attribute a1, Attribute a2, |
| | | Attribute e, Attribute d) throws Exception |
| | | { |
| | | List<ByteString> duplicates = new LinkedList<ByteString>(); |
| | | List<ByteString> duplicates = new LinkedList<>(); |
| | | Attribute actual = Attributes.merge(a1, a2, duplicates); |
| | | Assert.assertEquals(actual, e); |
| | | |
| | |
| | | public void testSubtractWithMissingValues(int testCase, Attribute a1, |
| | | Attribute a2, Attribute e, Attribute m) throws Exception |
| | | { |
| | | List<ByteString> missingValues = new LinkedList<ByteString>(); |
| | | List<ByteString> missingValues = new LinkedList<>(); |
| | | Attribute actual = Attributes.subtract(a1, a2, missingValues); |
| | | Assert.assertEquals(actual, e); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | LocalizableMessage msg = LocalizableMessage.raw("Test Constructor 4"); |
| | | 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>(); |
| | | List<String> refs = new ArrayList<>(); |
| | | refs.add("ldap://ldap.example.com/cn=Test Constructor 4,dc=example,dc=com"); |
| | | |
| | | validateException(new DirectoryException(resultCode, msg, dn, refs, e)); |
| | |
| | | final LockManager lockManager = new LockManager(); |
| | | |
| | | // Acquire 100 different locks. The first few locks should be evicted from the cache. |
| | | final LinkedList<DNLock> locks = new LinkedList<DNLock>(); |
| | | final LinkedList<DNLock> locks = new LinkedList<>(); |
| | | for (int i = 0; i < 100; i++) |
| | | { |
| | | locks.add(lockManager.tryWriteLockEntry(dn(i))); |
| | |
| | | * A Map of client connections that should be used when performing operations |
| | | * and whether config read operations should be successful. |
| | | */ |
| | | private Map<InternalClientConnection, Boolean> connections = |
| | | new HashMap<InternalClientConnection, Boolean>(); |
| | | private Map<InternalClientConnection, Boolean> connections = new HashMap<>(); |
| | | |
| | | /** |
| | | * Make sure that the server is running and that an appropriate set of |
| | |
| | | { |
| | | assertEquals(conn.hasPrivilege(Privilege.CONFIG_WRITE, null), hasPrivilege); |
| | | |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("ds-cfg-size-limit", "2000"))); |
| | | |
| | |
| | | assertEquals(conn.hasPrivilege(Privilege.SUBENTRY_WRITE, null), |
| | | hasPrivilege); |
| | | |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("subtreeSpecification", |
| | | "{base \"ou=doesnotexist\"}"))); |
| | |
| | | "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE " + |
| | | "X-ORIGIN 'PrivilegeTestCase' )"; |
| | | |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("attributetypes", attrDefinition))); |
| | | |
| | |
| | | "givenName: ProxyV1", |
| | | "sn: Test"); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | List<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV1Control(DN.valueOf("cn=PWReset Target,o=test"))); |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Try to modify the entry to add a description. |
| | | List<Modification> mods = new ArrayList<Modification>(1); |
| | | List<Modification> mods = new ArrayList<>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | List<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV1Control(targetDN)); |
| | | |
| | | |
| | |
| | | "givenName: ProxyV2", |
| | | "sn: Test"); |
| | | |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | List<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV2Control(ByteString.valueOf("dn:cn=PWReset Target,o=test"))); |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // Try to modify the entry to add a description. |
| | | List<Modification> mods = new ArrayList<Modification>(1); |
| | | List<Modification> mods = new ArrayList<>(1); |
| | | mods.add(new Modification(ModificationType.REPLACE, |
| | | Attributes.create("description", "foo"))); |
| | | |
| | |
| | | boolean hasProxyPrivilege = conn.hasPrivilege(Privilege.PROXIED_AUTH, null); |
| | | |
| | | DN targetDN = DN.valueOf("cn=PWReset Target,o=test"); |
| | | List<Control> controls = new ArrayList<Control>(1); |
| | | List<Control> controls = new ArrayList<>(1); |
| | | controls.add(new ProxiedAuthV2Control(ByteString.valueOf("dn:" + targetDN))); |
| | | |
| | | |
| | |
| | | |
| | | // Modify the user entry to add the CONFIG_READ privilege and verify that |
| | | // the client connection reflects that. |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, Attributes.create( |
| | | "ds-privilege-name", "config-read"))); |
| | | ModifyOperation modifyOperation = rootConnection.processModify( |
| | |
| | | // Update the set of root privileges to include proxied auth. |
| | | InternalClientConnection internalRootConn = getRootConnection(); |
| | | |
| | | List<Modification> mods = new ArrayList<Modification>(); |
| | | List<Modification> mods = new ArrayList<>(); |
| | | mods.add(new Modification(ModificationType.ADD, |
| | | Attributes.create("ds-cfg-default-root-privilege-name", |
| | | "proxied-auth"))); |
| | |
| | | @Test |
| | | public void testConfigurablePrivilegeSets() |
| | | { |
| | | Set<String> serverPrivNames = new HashSet<String>(); |
| | | Set<String> serverPrivNames = new HashSet<>(); |
| | | for (Privilege p : Privilege.values()) |
| | | { |
| | | serverPrivNames.add(p.toString()); |
| | | } |
| | | |
| | | Set<String> defaultRootPrivNames = new HashSet<String>(); |
| | | Set<String> defaultRootPrivNames = new HashSet<>(); |
| | | for (RootDNCfgDefn.DefaultRootPrivilegeName p : |
| | | RootDNCfgDefn.DefaultRootPrivilegeName.values()) |
| | | { |
| | |
| | | "default root privilege " + p); |
| | | } |
| | | |
| | | Set<String> disableablePrivNames = new HashSet<String>(); |
| | | Set<String> disableablePrivNames = new HashSet<>(); |
| | | for (DisabledPrivilege p : DisabledPrivilege.values()) |
| | | { |
| | | disableablePrivNames.add(p.toString()); |
| | |
| | | 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, |
| | | 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; |
| | | |
| | | List<String[]> allParameters = new ArrayList<String[]>(); |
| | | List<String[]> allParameters = new ArrayList<>(); |
| | | for (int i = 0; i < CHAR_NIBBLES.length; i++) { |
| | | char highNibble = CHAR_NIBBLES[i]; |
| | | byte highByteNibble = BYTE_NIBBLES[i]; |
| | |
| | | final char[] INVALID_NIBBBLES = {'g', 'z', 'G', 'Z', '-', '=', '+', '\00', ')', |
| | | 'n', 't', '\\'}; |
| | | |
| | | List<String> invalidEscapeSequences = new ArrayList<String>(); |
| | | List<String> invalidEscapeSequences = new ArrayList<>(); |
| | | |
| | | for (char validNibble : VALID_NIBBLES) |
| | | { |
| | |
| | | invalidEscapeSequences.add("\\" + validNibble); |
| | | } |
| | | |
| | | List<String[]> allParameters = new ArrayList<String[]>(); |
| | | List<String[]> allParameters = new ArrayList<>(); |
| | | for (String invalidEscape : invalidEscapeSequences) { |
| | | // Exact match |
| | | allParameters.add(new String[]{"(sn=" + invalidEscape + ")"}); |
| | |
| | | |
| | | |
| | | private List<String> getEntriesExcluding(List<String> matchedEntries) { |
| | | List<String> unmatched = new ArrayList<String>(ALL_ENTRIES_LDIF); |
| | | List<String> unmatched = new ArrayList<>(ALL_ENTRIES_LDIF); |
| | | unmatched.removeAll(matchedEntries); |
| | | return unmatched; |
| | | } |
| | |
| | | private List<String> unmatchedEntriesLdif; |
| | | |
| | | private FilterType filterType; |
| | | private LinkedHashSet<SearchFilter> filterComponents = new LinkedHashSet<SearchFilter>(); |
| | | private LinkedHashSet<SearchFilter> filterComponents = new LinkedHashSet<>(); |
| | | private SearchFilter notComponent; |
| | | private ByteString assertionValue; |
| | | private AttributeType attributeType; |
| | | private ByteString subInitialElement; |
| | | private List<ByteString> subAnyElements = new ArrayList<ByteString>(); |
| | | private List<ByteString> subAnyElements = new ArrayList<>(); |
| | | private ByteString subFinalElement; |
| | | private String matchingRuleId; |
| | | private boolean dnAttributes; |
| | |
| | | description.attributeType = DirectoryServer.getAttributeType(attributeType); |
| | | |
| | | description.subInitialElement = ByteString.valueOf(subInitial); |
| | | description.subAnyElements = new ArrayList<ByteString>(); |
| | | description.subAnyElements = new ArrayList<>(); |
| | | if (subAny != null) |
| | | { |
| | | for (String s : subAny) |
| | |
| | | |
| | | |
| | | private List<FilterDescription> getNotFilters(List<FilterDescription> filters) { |
| | | List<FilterDescription> notFilters = new ArrayList<FilterDescription>(); |
| | | List<FilterDescription> notFilters = new ArrayList<>(); |
| | | |
| | | for (FilterDescription filter: filters) { |
| | | notFilters.add(filter.negate()); |
| | |
| | | private FilterDescription getAndFilter(List<FilterDescription> filters) { |
| | | FilterDescription andFilter = new FilterDescription(); |
| | | |
| | | List<String> matchedEntries = new ArrayList<String>(ALL_ENTRIES_LDIF); |
| | | List<SearchFilter> filterComponents = new ArrayList<SearchFilter>(); |
| | | List<String> matchedEntries = new ArrayList<>(ALL_ENTRIES_LDIF); |
| | | List<SearchFilter> filterComponents = new ArrayList<>(); |
| | | |
| | | for (FilterDescription filter: filters) { |
| | | matchedEntries.retainAll(filter.matchedEntriesLdif); |
| | |
| | | } |
| | | |
| | | andFilter.searchFilter = SearchFilter.createANDFilter(filterComponents); |
| | | andFilter.filterComponents = new LinkedHashSet<SearchFilter>(filterComponents); |
| | | andFilter.filterComponents = new LinkedHashSet<>(filterComponents); |
| | | |
| | | andFilter.filterType = FilterType.AND; |
| | | |
| | |
| | | |
| | | |
| | | private List<FilterDescription> getAndFilters(List<FilterDescription> filters) { |
| | | List<FilterDescription> andFilters = new ArrayList<FilterDescription>(); |
| | | List<FilterDescription> andFilters = new ArrayList<>(); |
| | | |
| | | for (FilterDescription first: filters) { |
| | | for (FilterDescription second: filters) { |
| | |
| | | private FilterDescription getOrFilter(List<FilterDescription> filters) { |
| | | FilterDescription orFilter = new FilterDescription(); |
| | | |
| | | List<String> unmatchedEntries = new ArrayList<String>(ALL_ENTRIES_LDIF); |
| | | List<SearchFilter> filterComponents = new ArrayList<SearchFilter>(); |
| | | List<String> unmatchedEntries = new ArrayList<>(ALL_ENTRIES_LDIF); |
| | | List<SearchFilter> filterComponents = new ArrayList<>(); |
| | | |
| | | for (FilterDescription filter: filters) { |
| | | unmatchedEntries.retainAll(filter.unmatchedEntriesLdif); |
| | |
| | | } |
| | | |
| | | orFilter.searchFilter = SearchFilter.createORFilter(filterComponents); |
| | | orFilter.filterComponents = new LinkedHashSet<SearchFilter>(filterComponents); |
| | | orFilter.filterComponents = new LinkedHashSet<>(filterComponents); |
| | | |
| | | orFilter.filterType = FilterType.OR; |
| | | |
| | |
| | | |
| | | |
| | | private List<FilterDescription> getOrFilters(List<FilterDescription> filters) { |
| | | List<FilterDescription> orFilters = new ArrayList<FilterDescription>(); |
| | | List<FilterDescription> orFilters = new ArrayList<>(); |
| | | |
| | | for (FilterDescription first: filters) { |
| | | for (FilterDescription second: filters) { |
| | |
| | | * @see #getMinimalFilterDescriptionList |
| | | */ |
| | | private List<FilterDescription> getFilterDescriptionList() throws Exception { |
| | | List<FilterDescription> baseDescriptions = new ArrayList<FilterDescription>(); |
| | | List<FilterDescription> baseDescriptions = new ArrayList<>(); |
| | | |
| | | baseDescriptions.addAll(getEqualityFilters()); |
| | | baseDescriptions.addAll(getInequalityFilters()); |
| | |
| | | baseDescriptions.addAll(getSubstringFilters()); |
| | | baseDescriptions.addAll(getNotFilters(baseDescriptions)); |
| | | |
| | | List<FilterDescription> allDescriptions = new ArrayList<FilterDescription>(); |
| | | List<FilterDescription> allDescriptions = new ArrayList<>(); |
| | | |
| | | allDescriptions.addAll(getAndFilters(baseDescriptions)); |
| | | allDescriptions.addAll(getOrFilters(baseDescriptions)); |
| | |
| | | |
| | | |
| | | protected List<FilterDescription> getMinimalFilterDescriptionList() throws Exception { |
| | | List<FilterDescription> baseDescriptions = new ArrayList<FilterDescription>(); |
| | | List<FilterDescription> allDescriptions = new ArrayList<FilterDescription>(); |
| | | List<FilterDescription> baseDescriptions = new ArrayList<>(); |
| | | List<FilterDescription> allDescriptions = new ArrayList<>(); |
| | | |
| | | baseDescriptions.addAll(getEqualityFilters().subList(0, 1)); |
| | | baseDescriptions.addAll(getInequalityFilters().subList(0, 2)); |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2014 ForgeRock AS |
| | | * Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | @Test |
| | | public void testPutAndSize() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | assertEquals(map.size(), 0); |
| | | assertEquals(map.put(1, "one"), null); |
| | | assertEquals(map.size(), 1); |
| | |
| | | @Test(dependsOnMethods = { "testPutAndSize" }) |
| | | public void testGet() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | assertEquals(map.get(1), null); |
| | | assertEquals(map.get(2), null); |
| | | map.put(1, "one"); |
| | |
| | | @Test(dependsOnMethods = { "testPutAndSize" }) |
| | | public void testPutAll() throws Exception |
| | | { |
| | | final SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | final HashMap<Integer, String> hashMap = new HashMap<Integer, String>(); |
| | | final SmallMap<Integer, String> map = new SmallMap<>(); |
| | | final HashMap<Integer, String> hashMap = new HashMap<>(); |
| | | map.putAll(hashMap); |
| | | assertEquals(map.size(), 0); |
| | | hashMap.put(1, "one"); |
| | |
| | | @Test(dependsOnMethods = { "testPutAndSize" }) |
| | | public void testRemove() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | assertEquals(map.size(), 0); |
| | | assertEquals(map.remove(2), null); |
| | | assertEquals(map.remove(1), null); |
| | |
| | | @Test(dependsOnMethods = { "testPutAndSize" }) |
| | | public void testContains() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | assertDoesNotContain(map, entry(2, "two")); |
| | | |
| | | map.put(1, null); |
| | |
| | | @Test(dependsOnMethods = { "testPutAndSize" }) |
| | | public void testClear() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | map.clear(); |
| | | assertEquals(map.size(), 0); |
| | | |
| | |
| | | @Test(dependsOnMethods = { "testPutAndSize" }) |
| | | public void testEntrySetSize() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | assertEquals(map.entrySet().size(), 0); |
| | | |
| | | map.put(1, "one"); |
| | |
| | | @Test(dependsOnMethods = { "testEntrySetSize" }) |
| | | public void testEntrySetIterator() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | assertThat(map.entrySet().iterator()).isEmpty(); |
| | | |
| | | map.put(1, "one"); |
| | |
| | | @Test(dependsOnMethods = { "testEntrySetIterator" }) |
| | | public void testEntrySetIteratorNextRemove() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | map.put(1, "one"); |
| | | Iterator<Entry<Integer, String>> iter = map.entrySet().iterator(); |
| | | assertTrue(iter.hasNext()); |
| | |
| | | expectedExceptions = { NoSuchElementException.class }) |
| | | public void testEntrySetIteratorNextThrowsNoSuchElementException() throws Exception |
| | | { |
| | | SmallMap<Integer, String> map = new SmallMap<Integer, String>(); |
| | | SmallMap<Integer, String> map = new SmallMap<>(); |
| | | map.put(1, "one"); |
| | | Iterator<Entry<Integer, String>> iter = map.entrySet().iterator(); |
| | | assertTrue(iter.hasNext()); |
| | |
| | | |
| | | private <K, V> Entry<K, V> entry(K key, V value) |
| | | { |
| | | return new AbstractMap.SimpleImmutableEntry<K, V>(key, value); |
| | | return new AbstractMap.SimpleImmutableEntry<>(key, value); |
| | | } |
| | | |
| | | private void assertContains(SmallMap<Integer, String> map, |
| | |
| | | @Test(expectedExceptions = { NullPointerException.class }) |
| | | public void testPutAllRejectsNull() throws Exception |
| | | { |
| | | final HashMap<Integer, String> map = new HashMap<Integer, String>(); |
| | | final HashMap<Integer, String> map = new HashMap<>(); |
| | | map.put(null, null); |
| | | new SmallMap<Integer, String>().putAll(map); |
| | | } |
| | |
| | | definition.append("( "); |
| | | definition.append(oid); |
| | | |
| | | LinkedHashSet<String> nameSet = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> nameSet = new LinkedHashSet<>(); |
| | | if (primaryName != null) |
| | | { |
| | | nameSet.add(primaryName); |
| | |
| | | } |
| | | |
| | | if (extraProperties == null) { |
| | | extraProperties = new HashMap<String, List<String>>(); |
| | | extraProperties = new HashMap<>(); |
| | | } |
| | | |
| | | List<String> l = extraProperties.get(name); |
| | | if (l == null) { |
| | | l = new ArrayList<String>(); |
| | | l = new ArrayList<>(); |
| | | extraProperties.put(name, l); |
| | | } |
| | | l.addAll(Arrays.asList(values)); |
| | |
| | | } |
| | | |
| | | if (this.names == null) { |
| | | this.names = new LinkedList<String>(); |
| | | this.names = new LinkedList<>(); |
| | | } |
| | | |
| | | this.names.addAll(Arrays.asList(names)); |
| | |
| | | */ |
| | | @Test |
| | | public void testCreateWithMultipleRDNs2() throws Exception { |
| | | ArrayList<RDN> rdnList = new ArrayList<RDN>(); |
| | | ArrayList<RDN> rdnList = new ArrayList<>(); |
| | | rdnList.add(RDN.decode("dc=foo")); |
| | | rdnList.add(RDN.decode("dc=opends")); |
| | | rdnList.add(RDN.decode("dc=org")); |
| | |
| | | */ |
| | | @DataProvider(name = "namingContexts") |
| | | public Object[][] getNamingContexts() { |
| | | ArrayList<DN> contextList = new ArrayList<DN>(); |
| | | ArrayList<DN> contextList = new ArrayList<>(); |
| | | contextList.addAll(DirectoryServer.getPublicNamingContexts().keySet()); |
| | | contextList.addAll(DirectoryServer.getPrivateNamingContexts().keySet()); |
| | | |
| | |
| | | "Unable to resolve object class extensibleObject"); |
| | | } |
| | | |
| | | HashMap<ObjectClass, String> objectClasses = |
| | | new HashMap<ObjectClass, String>(); |
| | | HashMap<ObjectClass, String> objectClasses = new HashMap<>(); |
| | | objectClasses.put(top, top.getNameOrOID()); |
| | | objectClasses.put(extensible, extensible.getNameOrOID()); |
| | | |
| | |
| | | for (String value : values) { |
| | | builder.add(value); |
| | | } |
| | | ArrayList<Attribute> attributes = new ArrayList<Attribute>(); |
| | | ArrayList<Attribute> attributes = new ArrayList<>(); |
| | | attributes.add(builder.toAttribute()); |
| | | testEntry.putAttribute(type, attributes); |
| | | |
| | |
| | | .getAttributeType("supportedldapversion"); |
| | | String[] values = new String[] { "-4", "-2", "0", "1", "3" }; |
| | | |
| | | HashSet<Integer> expected = new HashSet<Integer>(); |
| | | HashSet<Integer> expected = new HashSet<>(); |
| | | for (String value : values) { |
| | | expected.add(Integer.valueOf(value)); |
| | | } |
| | |
| | | // Relative to the root DN. |
| | | DN rootDN = DN.rootDN(); |
| | | |
| | | Set<SubtreeSpecification> expected = new HashSet<SubtreeSpecification>(); |
| | | Set<SubtreeSpecification> expected = new HashSet<>(); |
| | | for (String value : values) { |
| | | expected.add(SubtreeSpecification.valueOf(rootDN, value)); |
| | | } |
| | | |
| | | Entry entry = createTestEntry(type, values); |
| | | Set<SubtreeSpecification> result = new HashSet<SubtreeSpecification>(); |
| | | Set<SubtreeSpecification> result = new HashSet<>(); |
| | | List<Attribute> attributes = entry.getAttribute(type, true); |
| | | for (Attribute a : attributes) |
| | | { |
| | |
| | | assertFalse(e.hasAttribute(uidType, options)); |
| | | assertTrue(e.hasAttribute(mnType, options)); |
| | | |
| | | options = new LinkedHashSet<String>(); |
| | | options = new LinkedHashSet<>(); |
| | | assertTrue(e.hasAttribute(ocType, options)); |
| | | assertTrue(e.hasAttribute(cnType, options)); |
| | | assertTrue(e.hasAttribute(nameType, options)); |
| | |
| | | assertEquals(attrs.size(), 1); |
| | | |
| | | |
| | | options = new LinkedHashSet<String>(); |
| | | options = new LinkedHashSet<>(); |
| | | attrs = e.getAttribute(ocType, options); |
| | | assertNotNull(attrs); |
| | | assertEquals(attrs.size(), 1); |
| | |
| | | assertNull(attrs); |
| | | |
| | | |
| | | options = new LinkedHashSet<String>(); |
| | | options = new LinkedHashSet<>(); |
| | | attrs = e.getUserAttribute(ocType, options); |
| | | assertNull(attrs); |
| | | |
| | |
| | | assertEquals(attrs.size(), 1); |
| | | |
| | | |
| | | options = new LinkedHashSet<String>(); |
| | | options = new LinkedHashSet<>(); |
| | | attrs = e.getOperationalAttribute(ocType, options); |
| | | assertNull(attrs); |
| | | |
| | |
| | | definition.append("( "); |
| | | definition.append(oid); |
| | | |
| | | LinkedHashSet<String> nameSet = new LinkedHashSet<String>(); |
| | | LinkedHashSet<String> nameSet = new LinkedHashSet<>(); |
| | | if (primaryName != null) |
| | | { |
| | | nameSet.add(primaryName); |
| | |
| | | } |
| | | |
| | | if (this.requiredAttributeTypes == null) { |
| | | this.requiredAttributeTypes = new LinkedHashSet<AttributeType>(); |
| | | this.requiredAttributeTypes = new LinkedHashSet<>(); |
| | | } |
| | | |
| | | this.requiredAttributeTypes.addAll(Arrays.asList(types)); |
| | |
| | | } |
| | | |
| | | if (this.optionalAttributeTypes == null) { |
| | | this.optionalAttributeTypes = new LinkedHashSet<AttributeType>(); |
| | | this.optionalAttributeTypes = new LinkedHashSet<>(); |
| | | } |
| | | |
| | | this.optionalAttributeTypes.addAll(Arrays.asList(types)); |
| | |
| | | ObjectClassBuilder builder2 = new ObjectClassBuilder("parent2","3.4.5"); |
| | | builder2.addOptionalAttributeTypes(types[3], types[4], types[5]); |
| | | ObjectClass parent2 = builder2.getInstance(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<ObjectClass>(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<>(); |
| | | superiors.add(parent1); |
| | | superiors.add(parent2); |
| | | ObjectClassBuilder builder3 = new ObjectClassBuilder("child", "6.7.8"); |
| | |
| | | ObjectClassBuilder builder2 = new ObjectClassBuilder("parent2","3.4.5"); |
| | | builder2.addOptionalAttributeTypes(types[3], types[4], types[5]); |
| | | ObjectClass parent2 = builder2.getInstance(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<ObjectClass>(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<>(); |
| | | superiors.add(parent1); |
| | | superiors.add(parent2); |
| | | ObjectClassBuilder builder3 = new ObjectClassBuilder("child", "6.7.8"); |
| | |
| | | builder = new ObjectClassBuilder("parent2","3.4.5"); |
| | | builder.addRequiredAttributeTypes(types[3], types[4], types[5]); |
| | | ObjectClass parent2 = builder.getInstance(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<ObjectClass>(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<>(); |
| | | superiors.add(parent1); |
| | | superiors.add(parent2); |
| | | builder = new ObjectClassBuilder("child", "6.7.8"); |
| | |
| | | builder = new ObjectClassBuilder("parent2","3.4.5"); |
| | | builder.addRequiredAttributeTypes(types[3], types[4], types[5]); |
| | | ObjectClass parent2 = builder.getInstance(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<ObjectClass>(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<>(); |
| | | superiors.add(parent1); |
| | | superiors.add(parent2); |
| | | builder = new ObjectClassBuilder("child", "6.7.8"); |
| | |
| | | builder = new ObjectClassBuilder("parent2", |
| | | "2.3.4"); |
| | | ObjectClass parent2 = builder.getInstance(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<ObjectClass>(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<>(); |
| | | superiors.add(parent1); |
| | | superiors.add(parent2); |
| | | builder = new ObjectClassBuilder("child", "1.2.3.4"); |
| | |
| | | |
| | | builder = new ObjectClassBuilder("parent2","2.2.2"); |
| | | ObjectClass parent2 = builder.getInstance(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<ObjectClass>(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<>(); |
| | | superiors.add(parent1); |
| | | superiors.add(parent2); |
| | | builder = new ObjectClassBuilder("child", "1.2.3"); |
| | |
| | | boolean isValid) throws Exception { |
| | | ObjectClassBuilder builder = new ObjectClassBuilder("testType", "1.2.3"); |
| | | builder.setObjectClassType(type); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<ObjectClass>(); |
| | | Set<ObjectClass> superiors = new LinkedHashSet<>(); |
| | | superiors.add(parent1); |
| | | superiors.add(parent2); |
| | | builder.setSuperior(superiors); |
| | |
| | | */ |
| | | @Test |
| | | public void testConstructorMultiAVAList() throws Exception { |
| | | ArrayList<AttributeType> typeList = new ArrayList<AttributeType>(); |
| | | ArrayList<String> nameList = new ArrayList<String>(); |
| | | ArrayList<ByteString> valueList = new ArrayList<ByteString>(); |
| | | ArrayList<AttributeType> typeList = new ArrayList<>(); |
| | | ArrayList<String> nameList = new ArrayList<>(); |
| | | ArrayList<ByteString> valueList = new ArrayList<>(); |
| | | |
| | | typeList.add(AT_DC); |
| | | nameList.add(AT_DC.getNameOrOID()); |
| | |
| | | EntryDNVirtualAttributeProvider provider = |
| | | new EntryDNVirtualAttributeProvider(); |
| | | |
| | | LinkedHashSet<DN> dnSet1 = new LinkedHashSet<DN>(1); |
| | | LinkedHashSet<DN> dnSet1 = new LinkedHashSet<>(1); |
| | | dnSet1.add(DN.valueOf("o=test")); |
| | | |
| | | LinkedHashSet<DN> dnSet2 = new LinkedHashSet<DN>(1); |
| | | LinkedHashSet<DN> dnSet2 = new LinkedHashSet<>(1); |
| | | dnSet2.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | LinkedHashSet<DN> dnSet3 = new LinkedHashSet<DN>(2); |
| | | LinkedHashSet<DN> dnSet3 = new LinkedHashSet<>(2); |
| | | dnSet3.add(DN.valueOf("o=test")); |
| | | dnSet3.add(DN.valueOf("dc=example,dc=com")); |
| | | |
| | | |
| | | LinkedHashSet<DN> groupSet1 = new LinkedHashSet<DN>(1); |
| | | LinkedHashSet<DN> groupSet1 = new LinkedHashSet<>(1); |
| | | groupSet1.add(DN.valueOf("cn=Test Group,o=test")); |
| | | |
| | | LinkedHashSet<DN> groupSet2 = new LinkedHashSet<DN>(1); |
| | | LinkedHashSet<DN> groupSet2 = new LinkedHashSet<>(1); |
| | | groupSet2.add(DN.valueOf("cn=Example Group,o=test")); |
| | | |
| | | LinkedHashSet<DN> groupSet3= new LinkedHashSet<DN>(2); |
| | | LinkedHashSet<DN> groupSet3= new LinkedHashSet<>(2); |
| | | groupSet3.add(DN.valueOf("cn=Test Group,o=test")); |
| | | groupSet3.add(DN.valueOf("cn=Example Group,o=test")); |
| | | |
| | | |
| | | LinkedHashSet<SearchFilter> filterSet1 = new LinkedHashSet<SearchFilter>(1); |
| | | LinkedHashSet<SearchFilter> filterSet1 = new LinkedHashSet<>(1); |
| | | filterSet1.add(SearchFilter.objectClassPresent()); |
| | | |
| | | LinkedHashSet<SearchFilter> filterSet2 = new LinkedHashSet<SearchFilter>(1); |
| | | LinkedHashSet<SearchFilter> filterSet2 = new LinkedHashSet<>(1); |
| | | filterSet2.add(SearchFilter.createFilterFromString("(o=test)")); |
| | | |
| | | LinkedHashSet<SearchFilter> filterSet3 = new LinkedHashSet<SearchFilter>(1); |
| | | LinkedHashSet<SearchFilter> filterSet3 = new LinkedHashSet<>(1); |
| | | filterSet3.add(SearchFilter.createFilterFromString("(foo=bar)")); |
| | | |
| | | LinkedHashSet<SearchFilter> filterSet4 = new LinkedHashSet<SearchFilter>(2); |
| | | LinkedHashSet<SearchFilter> filterSet4 = new LinkedHashSet<>(2); |
| | | filterSet4.add(SearchFilter.createFilterFromString("(o=test)")); |
| | | filterSet4.add(SearchFilter.createFilterFromString("(foo=bar)")); |
| | | |
| | |
| | | assertTrue(virtualAttribute.contains(ByteString.valueOf("o=test"))); |
| | | assertFalse(virtualAttribute.contains(ByteString.valueOf("o=not test"))); |
| | | |
| | | LinkedHashSet<ByteString> testValues = new LinkedHashSet<ByteString>(); |
| | | LinkedHashSet<ByteString> testValues = new LinkedHashSet<>(); |
| | | testValues.add(ByteString.valueOf("o=test")); |
| | | assertTrue(virtualAttribute.containsAll(testValues)); |
| | | |
| | |
| | | public Object[][] getADSSourceDirectories() |
| | | { |
| | | File adsSourceRoot = new File(sourceRoot, "ads"); |
| | | ArrayList<File> sourceDirs = new ArrayList<File>(); |
| | | ArrayList<File> sourceDirs = new ArrayList<>(); |
| | | getSourceDirectories(adsSourceRoot, sourceDirs); |
| | | |
| | | Object[][] returnArray = new Object[sourceDirs.size()][1]; |
| | |
| | | public Object[][] getAdminSourceDirectories() |
| | | { |
| | | File adminSourceRoot = new File(sourceRoot, "admin"); |
| | | ArrayList<File> sourceDirs = new ArrayList<File>(); |
| | | ArrayList<File> sourceDirs = new ArrayList<>(); |
| | | getSourceDirectories(adminSourceRoot, sourceDirs); |
| | | |
| | | Object[][] returnArray = new Object[sourceDirs.size()][1]; |
| | |
| | | public Object[][] getBuildToolsSourceDirectories() |
| | | { |
| | | File buildToolsSourceRoot = new File(sourceRoot, "build-tools"); |
| | | ArrayList<File> sourceDirs = new ArrayList<File>(); |
| | | ArrayList<File> sourceDirs = new ArrayList<>(); |
| | | getSourceDirectories(buildToolsSourceRoot, sourceDirs); |
| | | |
| | | Object[][] returnArray = new Object[sourceDirs.size()][1]; |
| | |
| | | public Object[][] getDSMLSourceDirectories() |
| | | { |
| | | File dsmlSourceRoot = new File(sourceRoot, "dsml"); |
| | | ArrayList<File> sourceDirs = new ArrayList<File>(); |
| | | ArrayList<File> sourceDirs = new ArrayList<>(); |
| | | getSourceDirectories(dsmlSourceRoot, sourceDirs); |
| | | |
| | | Object[][] returnArray = new Object[sourceDirs.size()][1]; |
| | |
| | | public Object[][] getGUIToolsSourceDirectories() |
| | | { |
| | | File guiToolsSourceRoot = new File(sourceRoot, "guitools"); |
| | | ArrayList<File> sourceDirs = new ArrayList<File>(); |
| | | ArrayList<File> sourceDirs = new ArrayList<>(); |
| | | getSourceDirectories(guiToolsSourceRoot, sourceDirs); |
| | | |
| | | Object[][] returnArray = new Object[sourceDirs.size()][1]; |
| | |
| | | public Object[][] getQuickSetupSourceDirectories() |
| | | { |
| | | File quickSetupSourceRoot = new File(sourceRoot, "quicksetup"); |
| | | ArrayList<File> sourceDirs = new ArrayList<File>(); |
| | | ArrayList<File> sourceDirs = new ArrayList<>(); |
| | | getSourceDirectories(quickSetupSourceRoot, sourceDirs); |
| | | |
| | | Object[][] returnArray = new Object[sourceDirs.size()][1]; |
| | |
| | | public Object[][] getServerSourceDirectories() |
| | | { |
| | | File serverSourceRoot = new File(sourceRoot, "server"); |
| | | ArrayList<File> sourceDirs = new ArrayList<File>(); |
| | | ArrayList<File> sourceDirs = new ArrayList<>(); |
| | | getSourceDirectories(serverSourceRoot, sourceDirs); |
| | | |
| | | Object[][] returnArray = new Object[sourceDirs.size()][1]; |
| | |
| | | // start the server. |
| | | TestCaseUtils.startServer(); |
| | | |
| | | attributes = new HashMap<AttributeType, List<Attribute>>(); |
| | | attributes = new HashMap<>(); |
| | | attribute = Attributes.create("cn", "hello world"); |
| | | ArrayList<Attribute> alist = new ArrayList<Attribute>(1); |
| | | ArrayList<Attribute> alist = new ArrayList<>(1); |
| | | alist.add(attribute); |
| | | attributes.put(attribute.getAttributeType(), alist); |
| | | } |
| | |
| | | dn = DN.valueOf("cn=Fiona Jensen, ou=Marketing, dc=airius, dc=com"); |
| | | Assert.assertEquals(add.getDN(), dn); |
| | | |
| | | List<Attribute> attrs = new ArrayList<Attribute>(); |
| | | List<Attribute> attrs = new ArrayList<>(); |
| | | AttributeBuilder builder = new AttributeBuilder(AT_OC, "objectclass"); |
| | | builder.add("top"); |
| | | builder.add("person"); |
| | |
| | | }, |
| | | }; |
| | | |
| | | List<Entry[]> entries = new LinkedList<Entry[]>(); |
| | | List<Entry[]> entries = new LinkedList<>(); |
| | | |
| | | for (String[] s : input) { |
| | | DN dn = DN.valueOf(s[0]); |
| | |
| | | |
| | | LDIFWriter ldifWriter = writer.getLDIFWriter(); |
| | | |
| | | List<Modification> mods = new LinkedList<Modification>(); |
| | | List<Modification> mods = new LinkedList<>(); |
| | | for (RawModification lmod : change.getModifications()) { |
| | | mods.add(lmod.toModification()); |
| | | } |
| | |
| | | */ |
| | | private <T extends ChangeRecordEntry> List<Object[]> createChangeRecords( |
| | | Class<T> theClass, String[] inputLDIF) throws Exception { |
| | | List<Object[]> changes = new LinkedList<Object[]>(); |
| | | List<Object[]> changes = new LinkedList<>(); |
| | | for (String ldifString : inputLDIF) { |
| | | byte[] bytes = StaticUtils.getBytes(ldifString); |
| | | |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Create a simple set of modifications. |
| | | modifications = new ArrayList<RawModification>(); |
| | | modifications = new ArrayList<>(); |
| | | attribute = Attributes.create("cn", "hello world"); |
| | | LDAPAttribute lattribute = new LDAPAttribute(attribute); |
| | | LDAPModification modification = new LDAPModification( |
| | |
| | | */ |
| | | @DataProvider(name = "getBytesTestData") |
| | | public Object[][] createGetBytesTestData() { |
| | | List<String> strings = new LinkedList<String>(); |
| | | List<String> strings = new LinkedList<>(); |
| | | |
| | | // Some simple strings. |
| | | strings.add(""); |
| | |
| | | */ |
| | | @DataProvider(name = "isDigitTestData") |
| | | public Object[][] createIsDigitTestData() { |
| | | List<Object[]> data = new LinkedList<Object[]>(); |
| | | List<Object[]> data = new LinkedList<>(); |
| | | |
| | | for (char c = '0'; c <= '9'; c++) { |
| | | data.add(new Object[] { c, true }); |
| | |
| | | */ |
| | | @DataProvider(name = "isAlphaTestData") |
| | | public Object[][] createIsAlphaTestData() { |
| | | List<Object[]> data = new LinkedList<Object[]>(); |
| | | List<Object[]> data = new LinkedList<>(); |
| | | |
| | | for (char c = 'a'; c <= 'z'; c++) { |
| | | data.add(new Object[] { c, true }); |
| | |
| | | */ |
| | | @DataProvider(name = "isHexDigitTestData") |
| | | public Object[][] createIsHexDigitTestData() { |
| | | List<Object[]> data = new LinkedList<Object[]>(); |
| | | List<Object[]> data = new LinkedList<>(); |
| | | |
| | | for (char c = 'a'; c <= 'f'; c++) { |
| | | data.add(new Object[] { c, true }); |
| | |
| | | */ |
| | | @DataProvider(name = "needsBase64EncodingTestData") |
| | | public Object[][] createNeedsBase64EncodingTestData() { |
| | | List<Object[]> data = new LinkedList<Object[]>(); |
| | | List<Object[]> data = new LinkedList<>(); |
| | | |
| | | // Check SAFE-INIT-CHAR. |
| | | for (char c = '\u0000'; c < '\u0100'; c++) { |
| | |
| | | @Test(dataProvider = "listToArrayTestData") |
| | | public void testListToArray(String[] strings) throws Exception { |
| | | if (strings != null) { |
| | | List<String> list = new ArrayList<String>(strings.length); |
| | | List<String> list = new ArrayList<>(strings.length); |
| | | for (String string : strings) { |
| | | list.add(string); |
| | | } |
| | |
| | | public void testRecursiveDelete() throws Exception { |
| | | File dir0 = TestCaseUtils.createTemporaryDirectory("dst"); |
| | | |
| | | List<File> files = new LinkedList<File>(); |
| | | List<File> files = new LinkedList<>(); |
| | | |
| | | File dir1 = new File(dir0, "one"); |
| | | dir1.mkdir(); |