| | |
| | | suffixes = new TreeSet<>(); |
| | | } |
| | | DN newDN = DN.valueOf(ADSContext.getAdministrationSuffixDN()); |
| | | if (!suffixes.contains(newDN)) |
| | | if (suffixes.add(newDN)) |
| | | { |
| | | suffixes.add(newDN); |
| | | backend.setBaseDN(suffixes); |
| | | backend.commit(); |
| | | } |
| | |
| | | import java.awt.event.ActionListener; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashSet; |
| | |
| | | Set<Object> selected = new HashSet<>(); |
| | | if (s != null) |
| | | { |
| | | for (Object o : s) |
| | | { |
| | | selected.add(o); |
| | | } |
| | | Collections.addAll(selected, s); |
| | | } |
| | | final DefaultListModel model = (DefaultListModel)list.getModel(); |
| | | model.clear(); |
| | |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Comparator; |
| | | import java.util.HashSet; |
| | |
| | | |
| | | private Set<JavaArgumentsDescriptor> readJavaArguments = new HashSet<>(); |
| | | private Set<JavaArgumentsDescriptor> currentJavaArguments = new HashSet<>(); |
| | | private Set<String> allScriptNames = new HashSet<>(); |
| | | { |
| | | String[] names = |
| | | { |
| | | private Set<String> allScriptNames = new HashSet<>(Arrays.asList( |
| | | "start-ds", "import-ldif.offline", "backup.online", "base64", |
| | | "create-rc-script", "dsconfig", "dsreplication", |
| | | "export-ldif.online", "import-ldif.online", "ldapcompare", |
| | |
| | | "ldif-diff", "ldifmodify", "ldifsearch", "make-ldif", |
| | | "rebuild-index", "restore.offline", "upgrade", |
| | | "verify-index", "dbtest" |
| | | }; |
| | | for (String name : names) |
| | | { |
| | | allScriptNames.add(name); |
| | | } |
| | | } |
| | | )); |
| | | |
| | | private Set<String> relevantScriptNames = new HashSet<>(); |
| | | { |
| | | String[] relevantNames = |
| | | { |
| | | private Set<String> relevantScriptNames = new HashSet<>(Arrays.asList( |
| | | "start-ds", "import-ldif.offline", "backup.offline", |
| | | "export-ldif.offline", |
| | | "ldif-diff", "make-ldif", "rebuild-index", "restore.offline", |
| | | "verify-index", "dbtest" |
| | | }; |
| | | for (String name : relevantNames) |
| | | { |
| | | relevantScriptNames.add(name); |
| | | } |
| | | } |
| | | )); |
| | | |
| | | private String readJavaHome; |
| | | private boolean readUseOpenDSJavaHome; |
| | |
| | | errors.add(new OfflineUpdateException(ERR_READING_CONFIG_LDAP.get(t.getMessage()), t)); |
| | | } |
| | | |
| | | if (errors.size() > 0 && environmentSettingException != null) |
| | | if (!errors.isEmpty() && environmentSettingException != null) |
| | | { |
| | | errors.add(0, environmentSettingException); |
| | | } |
| | |
| | | if (sr != null) |
| | | { |
| | | List<Object> values = sr.getAttributeValues(attrName); |
| | | if (values != null && values.size() > 0) |
| | | if (values != null && !values.isEmpty()) |
| | | { |
| | | Object o = values.iterator().next(); |
| | | try |
| | |
| | | { |
| | | for (int i=0; i<msgs.length; i++) |
| | | { |
| | | boolean ignore = (i == 6 && outsideDbs.size() == 0) || |
| | | (i == 7 && outsideLogs.size() == 0); |
| | | boolean ignore = (i == 6 && outsideDbs.isEmpty()) |
| | | || (i == 7 && outsideLogs.isEmpty()); |
| | | if (!ignore) |
| | | { |
| | | answers[i] = askConfirmation(msgs[i], true, logger); |
| | |
| | | break; |
| | | } |
| | | } |
| | | if (userData.getExternalDbsToRemove().size() == 0 && |
| | | userData.getExternalLogsToRemove().size() == 0 && |
| | | if (userData.getExternalDbsToRemove().isEmpty() && |
| | | userData.getExternalLogsToRemove().isEmpty() && |
| | | !userData.getRemoveLibrariesAndTools() && |
| | | !userData.getRemoveDatabases() && |
| | | !userData.getRemoveConfigurationAndSchema() && |
| | |
| | | } |
| | | if (isInteractive()) |
| | | { |
| | | if (!stopProcessing && exceptionMsgs.size() > 0) |
| | | if (!stopProcessing && !exceptionMsgs.isEmpty()) |
| | | { |
| | | println(); |
| | | try |
| | |
| | | else |
| | | { |
| | | logger.info(LocalizableMessage.raw("exceptionMsgs: "+exceptionMsgs)); |
| | | if (exceptionMsgs.size() > 0) |
| | | if (!exceptionMsgs.isEmpty()) |
| | | { |
| | | if (parser.isForceOnError()) |
| | | { |
| | |
| | | uud.setExternalDbsToRemove(dbs); |
| | | uud.setExternalLogsToRemove(logs); |
| | | |
| | | if (dbs.size() == 0 && |
| | | logs.size() == 0 && |
| | | if (dbs.isEmpty() && |
| | | logs.isEmpty() && |
| | | !uud.getRemoveLibrariesAndTools() && |
| | | !uud.getRemoveDatabases() && |
| | | !uud.getRemoveConfigurationAndSchema() && |
| | |
| | | } |
| | | |
| | | Set<String> dbsToDelete = getUninstallUserData().getExternalDbsToRemove(); |
| | | if (dbsToDelete.size() > 0) { |
| | | if (!dbsToDelete.isEmpty()) { |
| | | status = UninstallProgressStep.DELETING_EXTERNAL_DATABASE_FILES; |
| | | if (displaySeparator && isVerbose()) { |
| | | notifyListeners(getTaskSeparator()); |
| | |
| | | } |
| | | } |
| | | |
| | | Set<String> logsToDelete = |
| | | getUninstallUserData().getExternalLogsToRemove(); |
| | | if (logsToDelete.size() > 0) { |
| | | Set<String> logsToDelete = getUninstallUserData().getExternalLogsToRemove(); |
| | | if (!logsToDelete.isEmpty()) { |
| | | status = UninstallProgressStep.DELETING_EXTERNAL_LOG_FILES; |
| | | |
| | | if (displaySeparator && isVerbose()) { |
| | |
| | | } |
| | | exceptionMsgs.add(getMessage(e)); |
| | | } |
| | | if (!stopProcessing && exceptionMsgs.size() > 0) |
| | | if (!stopProcessing && !exceptionMsgs.isEmpty()) |
| | | { |
| | | LocalizableMessage confirmationMsg = |
| | | ERR_UNINSTALL_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE.get( |
| | |
| | | logger.info(LocalizableMessage.raw("Updating references in replication server on "+ |
| | | serverDisplay+".")); |
| | | replServers.remove(replServer); |
| | | if (replServers.size() > 0) |
| | | if (!replServers.isEmpty()) |
| | | { |
| | | replicationServer.setReplicationServer(replServers); |
| | | replicationServer.commit(); |
| | |
| | | logger.info(LocalizableMessage.raw("Updating references in domain " + |
| | | domain.getBaseDN()+" on " + serverDisplay + ".")); |
| | | replServers.remove(replServer); |
| | | if (replServers.size() > 0) |
| | | if (!replServers.isEmpty()) |
| | | { |
| | | domain.setReplicationServer(replServers); |
| | | domain.commit(); |
| | |
| | | cancelButton.setEnabled(true); |
| | | okButton.setEnabled(true); |
| | | |
| | | if (returnValue.size() > 0) |
| | | if (!returnValue.isEmpty()) |
| | | { |
| | | displayError(Utils.getMessageFromCollection(returnValue, "\n"), |
| | | INFO_ERROR_TITLE.get()); |
| | |
| | | cancelButton.setEnabled(true); |
| | | okButton.setEnabled(true); |
| | | |
| | | if (returnValue.size() > 0) |
| | | if (!returnValue.isEmpty()) |
| | | { |
| | | displayError(Utils.getMessageFromCollection(returnValue, "\n"), |
| | | INFO_ERROR_TITLE.get()); |
| | |
| | | Installer.MIN_PORT_VALUE, Installer.MAX_PORT_VALUE)); |
| | | } |
| | | } |
| | | setValidLater(cbEnableSSL, errorMsgs.size() == 0); |
| | | setValidLater(cbEnableSSL, errorMsgs.isEmpty()); |
| | | return errorMsgs; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | pathValid = errorMsgs.size() == 0; |
| | | pathValid = errorMsgs.isEmpty(); |
| | | } |
| | | |
| | | String pwd = String.valueOf(tfKeystorePwd.getPassword()); |
| | |
| | | if (r instanceof InstantiableRelationDefinition) { |
| | | InstantiableRelationDefinition<? super C, ? super S> ir = |
| | | (InstantiableRelationDefinition<? super C, ? super S>) r; |
| | | if (elements.size() == 0) { |
| | | if (elements.isEmpty()) { |
| | | return parent().child(ir, nd, "null"); |
| | | } else { |
| | | return parent().child(ir, nd, |
| | |
| | | * path element does not comprise of an instantiable |
| | | * relation. |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public ManagedObjectPath<C, S> rename(String newName) |
| | | throws IllegalStateException { |
| | | if (elements.size() == 0) { |
| | | if (elements.isEmpty()) { |
| | | throw new IllegalStateException("Cannot rename an empty path"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | baseDNSet = new HashSet<>(); |
| | | for (DN dn : baseDNs) |
| | | { |
| | | baseDNSet.add(dn); |
| | | } |
| | | Collections.addAll(baseDNSet, baseDNs); |
| | | |
| | | entryMap = new LinkedHashMap<>(); |
| | | childDNs = new HashMap<>(); |
| | |
| | | public synchronized void openBackend() throws ConfigException, InitializationException |
| | | { |
| | | baseDNSet = new HashSet<>(); |
| | | for (DN dn : baseDNs) |
| | | { |
| | | baseDNSet.add(dn); |
| | | } |
| | | Collections.addAll(baseDNSet, baseDNs); |
| | | |
| | | // Register base DNs. |
| | | for (DN dn : baseDNs) |
| | |
| | | { |
| | | iterateID2Subtree(); |
| | | } |
| | | else if (attrIndexList.size() > 0) |
| | | else if (!attrIndexList.isEmpty()) |
| | | { |
| | | for (Index index : attrIndexList.get(0).getAllIndexes()) |
| | | { |
| | | iterateAttrIndex(index); |
| | | } |
| | | } |
| | | else if (vlvIndexList.size() > 0) |
| | | else if (!vlvIndexList.isEmpty()) |
| | | { |
| | | iterateVLVIndex(vlvIndexList.get(0), true); |
| | | } |
| | |
| | | { |
| | | totalCount = id2s.getRecordCount(); |
| | | } |
| | | else if(attrIndexList.size() > 0) |
| | | else if(!attrIndexList.isEmpty()) |
| | | { |
| | | AttributeIndex attrIndex = attrIndexList.get(0); |
| | | totalCount = 0; |
| | |
| | | totalCount += getRecordCount(index); |
| | | } |
| | | } |
| | | else if (vlvIndexList.size() > 0) |
| | | else if (!vlvIndexList.isEmpty()) |
| | | { |
| | | totalCount = vlvIndexList.get(0).getRecordCount(); |
| | | } |
| | |
| | | if (!isMultiValued) |
| | | { |
| | | if (numValues > 1 |
| | | || (hasPendingValues && pendingValues.size() > 0) |
| | | || (!hasPendingValues && activeValues.size() > 0)) |
| | | || (hasPendingValues && !pendingValues.isEmpty()) |
| | | || (!hasPendingValues && !activeValues.isEmpty())) |
| | | { |
| | | throw new ConfigException(ERR_CONFIG_ATTR_ADD_VALUES_IS_SINGLE_VALUED.get(name)); |
| | | } |
| | |
| | | */ |
| | | public void toJMXAttribute(AttributeList attributeList) |
| | | { |
| | | if (activeValues.size() > 0) |
| | | if (!activeValues.isEmpty()) |
| | | { |
| | | if (isMultiValued()) |
| | | { |
| | |
| | | */ |
| | | public void toJMXAttribute(AttributeList attributeList) |
| | | { |
| | | if (activeValues.size() > 0) |
| | | if (!activeValues.isEmpty()) |
| | | { |
| | | if (isMultiValued()) |
| | | { |
| | |
| | | */ |
| | | public void toJMXAttribute(AttributeList attributeList) |
| | | { |
| | | if (activeValues.size() > 0) |
| | | if (!activeValues.isEmpty()) |
| | | { |
| | | if (isMultiValued()) |
| | | { |
| | |
| | | */ |
| | | public void toJMXAttribute(AttributeList attributeList) |
| | | { |
| | | if (activeValues.size() > 0) |
| | | if (!activeValues.isEmpty()) |
| | | { |
| | | if (isMultiValued()) |
| | | { |
| | |
| | | { |
| | | buffer.append("SortOrder("); |
| | | |
| | | if (decodedKeyList.size() > 0) |
| | | if (!decodedKeyList.isEmpty()) |
| | | { |
| | | decodedKeyToString(decodedKeyList.get(0), buffer); |
| | | |
| | |
| | | Map<String, List<ConfigDeleteListener>> deleteListeners, |
| | | Map<String, List<ConfigChangeListener>> changeListeners) |
| | | { |
| | | List<ConfigAddListener> cfgAddListeners = configEntry.getAddListeners(); |
| | | if (cfgAddListeners != null && cfgAddListeners.size() > 0) |
| | | { |
| | | addListeners.put(configEntry.getDN().toString(), cfgAddListeners); |
| | | } |
| | | |
| | | List<ConfigDeleteListener> cfgDeleteListeners = |
| | | configEntry.getDeleteListeners(); |
| | | if (cfgDeleteListeners != null && cfgDeleteListeners.size() > 0) |
| | | { |
| | | deleteListeners.put(configEntry.getDN().toString(), cfgDeleteListeners); |
| | | } |
| | | |
| | | List<ConfigChangeListener> cfgChangeListeners = |
| | | configEntry.getChangeListeners(); |
| | | if (cfgChangeListeners != null && cfgChangeListeners.size() > 0) |
| | | { |
| | | changeListeners.put(configEntry.getDN().toString(), cfgChangeListeners); |
| | | } |
| | | put(addListeners, configEntry, configEntry.getAddListeners()); |
| | | put(deleteListeners, configEntry, configEntry.getDeleteListeners()); |
| | | put(changeListeners, configEntry, configEntry.getChangeListeners()); |
| | | |
| | | for (ConfigEntry child : configEntry.getChildren().values()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private <T> void put(Map<String, List<T>> listeners, ConfigEntry configEntry, List<T> cfgListeners) |
| | | { |
| | | if (cfgListeners != null && !cfgListeners.isEmpty()) |
| | | { |
| | | listeners.put(configEntry.getDN().toString(), cfgListeners); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of backend initialization listeners that have been |
| | |
| | | { |
| | | for (HostPort listener : c.getListeners()) |
| | | { |
| | | if (usedListeners.contains(listener)) |
| | | if (!usedListeners.add(listener)) |
| | | { |
| | | // The port was already specified: this is a configuration error, |
| | | // log a message. |
| | |
| | | logger.error(message); |
| | | errorMessages.add(message); |
| | | } |
| | | else |
| | | { |
| | | usedListeners.add(listener); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (errorMessages.size() > 0) |
| | | if (!errorMessages.isEmpty()) |
| | | { |
| | | throw new ConfigException(ERR_ERROR_STARTING_CONNECTION_HANDLERS.get()); |
| | | } |
| | |
| | | final SearchRequest request = |
| | | newSearchRequest(entryDN, SearchScope.BASE_OBJECT, FILTER_OC_INSTANCE_KEY).addAttribute("dn"); |
| | | final InternalSearchOperation searchOp = icc.processSearch(request); |
| | | if (0 == searchOp.getSearchEntries().size()) { |
| | | if (searchOp.getSearchEntries().isEmpty()) { |
| | | final Entry entry = new Entry(entryDN, null, null, null); |
| | | entry.addObjectClass(DirectoryServer.getTopObjectClass()); |
| | | entry.addObjectClass(ocInstanceKey); |
| | |
| | | |
| | | private boolean isEmpty() |
| | | { |
| | | return allHandlers.size() == 0; |
| | | return allHandlers.isEmpty(); |
| | | } |
| | | |
| | | private void addHandler(MonitoredDirectory handler) |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | |
| | | for (JMXMBean mBean : mBeans.values()) |
| | | { |
| | | MBeanInfo mBeanInfo = mBean.getMBeanInfo(); |
| | | for (MBeanNotificationInfo notification: mBeanInfo.getNotifications()) |
| | | { |
| | | notifications.add(notification); |
| | | } |
| | | Collections.addAll(notifications, mBeanInfo.getNotifications()); |
| | | } |
| | | |
| | | MBeanNotificationInfo[] notificationArray = |
| | | new MBeanNotificationInfo[notifications.size()]; |
| | | notifications.toArray(notificationArray); |
| | | return notificationArray; |
| | | return notifications.toArray(new MBeanNotificationInfo[notifications.size()]); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public boolean isIdle() |
| | | { |
| | | if (opQueue.size() > 0) { |
| | | if (!opQueue.isEmpty()) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | writer.writeStartSequence(); |
| | | writer.writeEnumerated(opType); |
| | | |
| | | if (values != null && values.size() > 0) |
| | | if (values != null && !values.isEmpty()) |
| | | { |
| | | writer.writeStartSequence(); |
| | | for (long l : values) |
| | |
| | | { |
| | | encodedCharacterSets = configuration.getPasswordCharacterSet(); |
| | | |
| | | if (encodedCharacterSets.size() == 0) |
| | | if (encodedCharacterSets.isEmpty()) |
| | | { |
| | | LocalizableMessage message = ERR_RANDOMPWGEN_NO_CHARSETS.get(configEntryDN); |
| | | throw new ConfigException(message); |
| | |
| | | try |
| | | { |
| | | SortedSet<String> currentPasSet = configuration.getPasswordCharacterSet(); |
| | | if (currentPasSet.size() == 0) |
| | | if (currentPasSet.isEmpty()) |
| | | { |
| | | throw new ConfigException(ERR_RANDOMPWGEN_NO_CHARSETS.get(cfgEntryDN)); |
| | | } |
| | |
| | | try |
| | | { |
| | | newEncodedCharacterSets = configuration.getPasswordCharacterSet(); |
| | | if (newEncodedCharacterSets.size() == 0) |
| | | if (newEncodedCharacterSets.isEmpty()) |
| | | { |
| | | ccr.addMessage(ERR_RANDOMPWGEN_NO_CHARSETS.get(configEntryDN)); |
| | | ccr.setResultCodeIfSuccess(ResultCode.OBJECTCLASS_VIOLATION); |
| | |
| | | ? ByteString.empty() |
| | | : newPassword; |
| | | |
| | | if (currentPasswords == null || currentPasswords.size() == 0) { |
| | | if (currentPasswords == null || currentPasswords.isEmpty()) { |
| | | // This validator requires access to at least one current password. |
| | | // If we don't have a current password, then we can't validate it, so |
| | | // we'll have to assume it is OK. Ideally, the password policy should be |
| | | // configured to always require the current password, but even then the |
| | | // current password probably won't be availble during an administrative |
| | | // current password probably won't be available during an administrative |
| | | // password reset. |
| | | return true; |
| | | } |
| | |
| | | ERR_STATICGROUP_ADD_MEMBER_UPDATE_FAILED.get(userDN, groupEntryDN, modifyOperation.getErrorMessage())); |
| | | } |
| | | |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<>(memberDNs.size()+1); |
| | | newMemberDNs.addAll(memberDNs); |
| | | LinkedHashSet<CompactDn> newMemberDNs = new LinkedHashSet<CompactDn>(memberDNs); |
| | | newMemberDNs.add(compactUserDN); |
| | | memberDNs = newMemberDNs; |
| | | } |
| | |
| | | queueReadLock.lock(); |
| | | try |
| | | { |
| | | if (opQueue.size() > 0) |
| | | if (!opQueue.isEmpty()) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | isValid = false; |
| | | } |
| | | |
| | | /* |
| | | * Check for duplicates. |
| | | */ |
| | | // Check for duplicates. |
| | | final String nfromAttr = toLowerCase(fromAttr); |
| | | if (fromAttrs.contains(nfromAttr)) |
| | | if (!fromAttrs.add(nfromAttr)) |
| | | { |
| | | messages.add(ERR_PLUGIN_ATTR_CLEANUP_DUPLICATE_VALUE.get(fromAttr)); |
| | | isValid = false; |
| | | } |
| | | else |
| | | { |
| | | fromAttrs.add(nfromAttr); |
| | | } |
| | | |
| | | /* |
| | | * Check that attribute does not map to itself. |
| | | */ |
| | | // Check that attribute does not map to itself. |
| | | if (nfromAttr.equals(toLowerCase(toAttr))) |
| | | { |
| | | messages |
| | | .add(ERR_PLUGIN_ATTR_CLEANUP_EQUAL_VALUES.get(fromAttr, toAttr)); |
| | | messages.add(ERR_PLUGIN_ATTR_CLEANUP_EQUAL_VALUES.get(fromAttr, toAttr)); |
| | | isValid = false; |
| | | } |
| | | |
| | | } |
| | | |
| | | return isValid; |
| | |
| | | private static boolean add(AttributeBuilder attrBuilder, String className, |
| | | Set<String> values) |
| | | { |
| | | if (values.size() > 0) |
| | | if (!values.isEmpty()) |
| | | { |
| | | attrBuilder.add(className + ":" + Utils.joinAsString(",", values)); |
| | | return true; |
| | |
| | | */ |
| | | protected byte[] encodeMods(List<Modification> mods) |
| | | { |
| | | if ((mods == null) || (mods.size() == 0)) |
| | | if (mods == null || mods.isEmpty()) |
| | | { |
| | | return new byte[0]; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | final SortedSet<String> sslCipherSuites, |
| | | final boolean sslEncryption) throws ConfigException |
| | | { |
| | | if (sslProtocols == null || sslProtocols.size() == 0) |
| | | if (sslProtocols == null || sslProtocols.isEmpty()) |
| | | { |
| | | this.sslProtocols = null; |
| | | } |
| | |
| | | sslProtocols.toArray(this.sslProtocols); |
| | | } |
| | | |
| | | if (sslCipherSuites == null || sslCipherSuites.size() == 0) |
| | | if (sslCipherSuites == null || sslCipherSuites.isEmpty()) |
| | | { |
| | | this.sslCipherSuites = null; |
| | | } |
| | |
| | | |
| | | // Return computed structures |
| | | PreparedAssuredInfo preparedAssuredInfo = new PreparedAssuredInfo(); |
| | | if (expectedServers.size() > 0) |
| | | if (!expectedServers.isEmpty()) |
| | | { |
| | | // Some other acks to wait for |
| | | preparedAssuredInfo.expectedAcksInfo = new SafeReadExpectedAcksInfo(csn, |
| | |
| | | expectedServers); |
| | | |
| | | // Keep track of potential servers detected in wrong status |
| | | if (wrongStatusServers.size() > 0) |
| | | if (!wrongStatusServers.isEmpty()) |
| | | { |
| | | hasWrongStatus = true; |
| | | failedServers = wrongStatusServers; |
| | |
| | | nextChangeForInsertDBCursor.next(); |
| | | } |
| | | catch (AbortedChangelogCursorException e) { |
| | | if (domainsToClear.size() == 0) |
| | | if (domainsToClear.isEmpty()) |
| | | { |
| | | // There is no domain to clear, thus it is |
| | | // not expected that a cursor is aborted |
| | |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | ArrayList<DN> defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs().length); |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | | defaultIncludeBranches.add(dn); |
| | | } |
| | | Collections.addAll(defaultIncludeBranches, backend.getBaseDNs()); |
| | | |
| | | ArrayList<DN> excludeBranches = new ArrayList<>(); |
| | | if (excludeBranchStrings != null) |
| | |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | |
| | | |
| | | // Make sure the selected backend will handle all the include branches |
| | | defaultIncludeBranches = new ArrayList<>(backend.getBaseDNs().length); |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | | defaultIncludeBranches.add(dn); |
| | | } |
| | | Collections.addAll(defaultIncludeBranches, backend.getBaseDNs()); |
| | | |
| | | for(DN includeBranch : includeBranches) |
| | | { |
| | |
| | | |
| | | // 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); |
| | | } |
| | | Collections.addAll(defaultIncludeBranches, backend.getBaseDNs()); |
| | | |
| | | if (backend.getSubordinateBackends() != null) |
| | | { |
| | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(ATTR_SHUTDOWN_MESSAGE, true); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | if ((attrList != null) && (attrList.size() > 0)) |
| | | if (attrList != null && !attrList.isEmpty()) |
| | | { |
| | | Attribute attr = attrList.get(0); |
| | | if (!attr.isEmpty()) |
| | |
| | | |
| | | attrType = DirectoryServer.getAttributeType(ATTR_RESTART_SERVER, true); |
| | | attrList = taskEntry.getAttribute(attrType); |
| | | if ((attrList != null) && (attrList.size() > 0)) |
| | | if (attrList != null && !attrList.isEmpty()) |
| | | { |
| | | Attribute attr = attrList.get(0); |
| | | if (!attr.isEmpty()) |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.util.Utils; |
| | | import org.opends.server.admin.std.server.BackendCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.Backend.BackendOperation; |
| | |
| | | // Check that the backendID has not been expressed twice. |
| | | HashSet<String> backendIDLowerCase = new HashSet<>(); |
| | | HashSet<String> repeatedBackendIds = new HashSet<>(); |
| | | StringBuilder repeatedBackends = new StringBuilder(); |
| | | for (String id : backendID.getValues()) |
| | | { |
| | | String lId = id.toLowerCase(); |
| | | if (backendIDLowerCase.contains(lId)) |
| | | if (!backendIDLowerCase.add(lId)) |
| | | { |
| | | if (!repeatedBackendIds.contains(lId)) |
| | | { |
| | | repeatedBackendIds.add(lId); |
| | | if (repeatedBackends.length() > 0) |
| | | { |
| | | repeatedBackends.append(", "); |
| | | } |
| | | repeatedBackends.append(id); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | backendIDLowerCase.add(lId); |
| | | repeatedBackendIds.add(lId); |
| | | } |
| | | } |
| | | if (repeatedBackends.length() > 0) |
| | | if (!repeatedBackendIds.isEmpty()) |
| | | { |
| | | String repeatedBackends = Utils.joinAsString(", ", repeatedBackendIds); |
| | | LocalizableMessage message = ERR_BACKUPDB_REPEATED_BACKEND_ID.get(repeatedBackends); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | err.println(argParser.getUsage()); |
| | |
| | | addIfHasValue(attributes, ATTR_TASK_BACKUP_SIGN_HASH, signHash); |
| | | |
| | | List<String> backendIDs = backendID.getValues(); |
| | | if (backendIDs != null && backendIDs.size() > 0) { |
| | | if (backendIDs != null && !backendIDs.isEmpty()) { |
| | | ArrayList<ByteString> values = new ArrayList<>(backendIDs.size()); |
| | | for (String s : backendIDs) { |
| | | values.add(ByteString.valueOf(s)); |
| | |
| | | checkImportDataArguments(errorMessages); |
| | | checkSecurityArguments(errorMessages); |
| | | |
| | | if (errorMessages.size() > 0) |
| | | if (!errorMessages.isEmpty()) |
| | | { |
| | | throw new ArgumentException(ERR_CANNOT_INITIALIZE_ARGS.get( |
| | | Utils.getMessageFromCollection(errorMessages, Constants.LINE_SEPARATOR))); |
| | |
| | | ERR_JAVAPROPERTIES_WITH_DESTINATION_FILE.get(value)); |
| | | } |
| | | } |
| | | if (errorMessages.size() > 0) |
| | | if (!errorMessages.isEmpty()) |
| | | { |
| | | LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get( |
| | | Utils.getMessageFromCollection(errorMessages, |
| | |
| | | |
| | | ArrayList<String> filterAndAttributeStrings = |
| | | argParser.getTrailingArguments(); |
| | | if(filterAndAttributeStrings.size() > 0) |
| | | if(!filterAndAttributeStrings.isEmpty()) |
| | | { |
| | | // the list of trailing arguments should be structured as follow: |
| | | // - If a filter file is present, trailing arguments are considered |
| | |
| | | private void printSummaryTable() |
| | | throws LDAPException, IOException, DecodeException { |
| | | List<TaskEntry> entries = taskClient.getTaskEntries(); |
| | | if (entries.size() > 0) { |
| | | if (!entries.isEmpty()) { |
| | | TableBuilder table = new TableBuilder(); |
| | | Map<String, TaskEntry> mapIdToEntry = new TreeMap<>(); |
| | | for (TaskEntry entry : entries) { |
| | |
| | | List<Integer> cancelableIndices = new ArrayList<>(); |
| | | List<TaskEntry> entries = taskClient.getTaskEntries(); |
| | | MenuBuilder<Void> menuBuilder = new MenuBuilder<>(this); |
| | | if (entries.size() > 0) { |
| | | if (!entries.isEmpty()) { |
| | | Map<String, TaskEntry> mapIdToEntry = new TreeMap<>(); |
| | | for (TaskEntry entry : entries) { |
| | | String taskId = entry.getId(); |
| | |
| | | INFO_TASKINFO_CMD_REFRESH.get(), |
| | | new PrintSummaryTop()); |
| | | |
| | | if (cancelableIndices.size() > 0) { |
| | | if (!cancelableIndices.isEmpty()) { |
| | | menuBuilder.addCharOption( |
| | | INFO_TASKINFO_CMD_CANCEL_CHAR.get(), |
| | | INFO_TASKINFO_CMD_CANCEL.get(), |
| | |
| | | INFO_TASKINFO_CMD_REFRESH.get(), |
| | | new PrintTaskInfo(taskId)); |
| | | List<LocalizableMessage> logs = taskEntry.getLogMessages(); |
| | | if (logs != null && logs.size() > 0) { |
| | | if (logs != null && !logs.isEmpty()) { |
| | | menuBuilder.addCharOption( |
| | | INFO_TASKINFO_CMD_VIEW_LOGS_CHAR.get(), |
| | | INFO_TASKINFO_CMD_VIEW_LOGS.get(), |
| | |
| | | table.startRow(); |
| | | table.appendCell(attrName); |
| | | List<String> values = taskSpecificAttrs.get(attrName); |
| | | if (values.size() > 0) { |
| | | if (!values.isEmpty()) { |
| | | table.appendCell(values.get(0)); |
| | | } |
| | | if (values.size() > 1) { |
| | |
| | | |
| | | // Print the last log message if any |
| | | List<LocalizableMessage> logs = taskEntry.getLogMessages(); |
| | | if (logs != null && logs.size() > 0) { |
| | | |
| | | if (logs != null && !logs.isEmpty()) { |
| | | // Create a table for the last log entry |
| | | table = new TableBuilder(); |
| | | table.appendHeading(INFO_TASKINFO_FIELD_LAST_LOG.get()); |
| | |
| | | |
| | | app.getOutputStream().println(); |
| | | } catch (Exception e) { |
| | | app.println(ERR_TASKINFO_RETRIEVING_TASK_ENTRY.get( |
| | | taskId, e.getMessage())); |
| | | app.println(ERR_TASKINFO_RETRIEVING_TASK_ENTRY.get(taskId, e.getMessage())); |
| | | return MenuResult.again(); |
| | | } |
| | | return MenuResult.success(taskEntry); |
| | |
| | | // Create a table for the last log entry |
| | | TableBuilder table = new TableBuilder(); |
| | | table.appendHeading(INFO_TASKINFO_FIELD_LOG.get()); |
| | | if (logs != null && logs.size() > 0) { |
| | | if (logs != null && !logs.isEmpty()) { |
| | | for (LocalizableMessage log : logs) { |
| | | table.startRow(); |
| | | table.appendCell(log); |
| | |
| | | public MenuResult<Void> invoke(ManageTasks app) |
| | | throws ClientException |
| | | { |
| | | if (taskIds != null && taskIds.size() > 0) { |
| | | if (cancelableIndices != null && cancelableIndices.size() > 0) { |
| | | if (taskIds != null && !taskIds.isEmpty()) { |
| | | if (cancelableIndices != null && !cancelableIndices.isEmpty()) { |
| | | |
| | | // Prompt for the task number |
| | | Integer index = null; |
| | |
| | | return 1; |
| | | } |
| | | |
| | | if (indexList.getValues().size() <= 0 && !rebuildAll.isPresent() |
| | | if (indexList.getValues().isEmpty() |
| | | && !rebuildAll.isPresent() |
| | | && !rebuildDegraded.isPresent()) |
| | | { |
| | | final LocalizableMessage message = |
| | |
| | | } |
| | | } |
| | | } |
| | | if (errors.size() > 0) |
| | | if (!errors.isEmpty()) |
| | | { |
| | | for (LocalizableMessage error : errors) |
| | | { |
| | |
| | | private void writeAdministrativeUserContents(ServerDescriptor desc, int maxLabelWidth) |
| | | { |
| | | Set<DN> administrators = desc.getAdministrativeUsers(); |
| | | if (administrators.size() > 0) |
| | | if (!administrators.isEmpty()) |
| | | { |
| | | TreeSet<DN> ordered = new TreeSet<>(administrators); |
| | | for (DN dn : ordered) |
| | |
| | | } |
| | | |
| | | Set<ConnectionHandlerDescriptor> allHandlers = desc.getConnectionHandlers(); |
| | | if (allHandlers.size() == 0) |
| | | if (allHandlers.isEmpty()) |
| | | { |
| | | if (desc.getStatus() == ServerDescriptor.ServerStatus.STARTED) |
| | | { |
| | |
| | | replicas.addAll(backend.getBaseDns()); |
| | | } |
| | | } |
| | | if (replicas.size() == 0) |
| | | if (replicas.isEmpty()) |
| | | { |
| | | if (desc.getStatus() == ServerDescriptor.ServerStatus.STARTED) |
| | | { |
| | |
| | | |
| | | // add dependency IDs |
| | | List<String> dependencyIds = information.getDependencyIds(); |
| | | if (dependencyIds != null && dependencyIds.size() > 0) { |
| | | if (dependencyIds != null && !dependencyIds.isEmpty()) { |
| | | ArrayList<ByteString> dependencyIdValues = new ArrayList<>(dependencyIds.size()); |
| | | for (String dependencyId : dependencyIds) { |
| | | dependencyIdValues.add(ByteString.valueOf(dependencyId)); |
| | |
| | | // add completion notification email addresses |
| | | List<String> compNotifEmailAddresss = |
| | | information.getNotifyUponCompletionEmailAddresses(); |
| | | if (compNotifEmailAddresss != null && compNotifEmailAddresss.size() > 0) { |
| | | if (compNotifEmailAddresss != null && !compNotifEmailAddresss.isEmpty()) { |
| | | ArrayList<ByteString> compNotifEmailAddrValues = new ArrayList<>(compNotifEmailAddresss.size()); |
| | | for (String emailAddr : compNotifEmailAddresss) { |
| | | compNotifEmailAddrValues.add(ByteString.valueOf(emailAddr)); |
| | |
| | | // add error notification email addresses |
| | | List<String> errNotifEmailAddresss = |
| | | information.getNotifyUponErrorEmailAddresses(); |
| | | if (errNotifEmailAddresss != null && errNotifEmailAddresss.size() > 0) { |
| | | if (errNotifEmailAddresss != null && !errNotifEmailAddresss.isEmpty()) { |
| | | ArrayList<ByteString> errNotifEmailAddrValues = new ArrayList<>(errNotifEmailAddresss.size()); |
| | | for (String emailAddr : errNotifEmailAddresss) { |
| | | errNotifEmailAddrValues.add(ByteString.valueOf(emailAddr)); |
| | |
| | | taskEntry = tc.getTaskEntry(taskId); |
| | | List<LocalizableMessage> logs = taskEntry.getLogMessages(); |
| | | for (LocalizableMessage log : logs) { |
| | | if (!printedLogMessages.contains(log)) { |
| | | printedLogMessages.add(log); |
| | | if (printedLogMessages.add(log)) { |
| | | out.println(log); |
| | | } |
| | | } |
| | |
| | | |
| | | ArrayList<String> commandAndArgs = new ArrayList<>(); |
| | | commandAndArgs.add(command); |
| | | if ((args != null) && (args.length > 0)) |
| | | if (args != null && args.length > 0) |
| | | { |
| | | for (String arg : args) |
| | | { |
| | | commandAndArgs.add(arg); |
| | | } |
| | | Collections.addAll(commandAndArgs, args); |
| | | } |
| | | |
| | | ProcessBuilder processBuilder = new ProcessBuilder(commandAndArgs); |
| | |
| | | } |
| | | |
| | | ArrayList<String> stringList = new ArrayList<>(stringArray.length); |
| | | for (String s : stringArray) |
| | | { |
| | | stringList.add(s); |
| | | } |
| | | Collections.addAll(stringList, stringArray); |
| | | return stringList; |
| | | } |
| | | |
| | |
| | | this.upgradeMsg = upgradeMessage; |
| | | this.reversionMsg = reversionMessage; |
| | | if (effects != null) { |
| | | for (Effect c : effects) { |
| | | this.effects.add(c); |
| | | } |
| | | Collections.addAll(this.effects, effects); |
| | | } |
| | | } |
| | | |
| | |
| | | HashSet<ByteString> clearPasswords = new HashSet<>(pwPolicyState.getClearPasswords()); |
| | | if (currentPasswords != null) |
| | | { |
| | | if (clearPasswords.isEmpty()) |
| | | { |
| | | clearPasswords.addAll(currentPasswords); |
| | | } |
| | | else |
| | | { |
| | | // NOTE: We can't rely on the fact that Set doesn't allow |
| | | // duplicates because technically it's possible that the values |
| | | // aren't duplicates if they are ASN.1 elements with different types |
| | | // (like 0x04 for a standard universal octet string type versus 0x80 |
| | | // for a simple password in a bind operation). So we have to |
| | | // manually check for duplicates. |
| | | for (ByteString pw : currentPasswords) |
| | | { |
| | | if (!clearPasswords.contains(pw)) |
| | | { |
| | | clearPasswords.add(pw); |
| | | } |
| | | } |
| | | } |
| | | clearPasswords.addAll(currentPasswords); |
| | | } |
| | | |
| | | for (ByteString v : newPasswords) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | |
| | | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import org.opends.server.DirectoryServerTestCase; |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | |
| | | |
| | | /** |
| | | * TopCfgDefn test cases. |
| | | */ |
| | | /** TopCfgDefn test cases. */ |
| | | @Test(sequential = true) |
| | | public class TestTopCfgDefnTest extends DirectoryServerTestCase { |
| | | |
| | |
| | | TestCaseUtils.startServer(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests getInstance() does not return null. |
| | | */ |
| | | /** Tests getInstance() does not return null. */ |
| | | @Test |
| | | public void testGetInstance() { |
| | | assertNotNull(TopCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests getName() returns "top". |
| | | */ |
| | | /** Tests getName() returns "top". */ |
| | | @Test |
| | | public void testGetName() { |
| | | assertEquals(TopCfgDefn.getInstance().getName(), "top"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that there are no property definitions. |
| | | */ |
| | | /** Tests that there are no property definitions. */ |
| | | @Test |
| | | public void testGetAllPropertyDefinitions() { |
| | | assertTrue(TopCfgDefn.getInstance().getAllPropertyDefinitions().isEmpty()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that there are no relation definitions. |
| | | */ |
| | | /** Tests that there are no relation definitions. */ |
| | | @Test |
| | | public void testGetAllRelationDefinitions() { |
| | | assertTrue(TopCfgDefn.getInstance().getAllRelationDefinitions().isEmpty()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that there are no constraints. |
| | | */ |
| | | /** Tests that there are no constraints. */ |
| | | @Test |
| | | public void testGetAllConstraints() { |
| | | assertTrue(TopCfgDefn.getInstance().getAllConstraints().isEmpty()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that there are no tags. |
| | | */ |
| | | /** Tests that there are no tags. */ |
| | | @Test |
| | | public void testGetAllTags() { |
| | | assertTrue(TopCfgDefn.getInstance().getAllTags().isEmpty()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that there is no parent. |
| | | */ |
| | | /** Tests that there is no parent. */ |
| | | @Test |
| | | public void testGetParent() { |
| | | assertNull(TopCfgDefn.getInstance().getParent()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that isTop returns true. |
| | | */ |
| | | /** Tests that isTop returns true. */ |
| | | @Test |
| | | public void testIsTop() { |
| | | assertTrue(TopCfgDefn.getInstance().isTop()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that getSynopsis throws an exception. |
| | | */ |
| | | /** Tests that getSynopsis throws an exception. */ |
| | | @Test(expectedExceptions = UnsupportedOperationException.class) |
| | | public void testGetSynopsis() { |
| | | assertNotNull(TopCfgDefn.getInstance().getSynopsis()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that getDescription throws an exception. |
| | | */ |
| | | /** Tests that getDescription throws an exception. */ |
| | | @Test(expectedExceptions = UnsupportedOperationException.class) |
| | | public void testGetDescription() { |
| | | assertNotNull(TopCfgDefn.getInstance().getDescription()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that getUserFriendlyName throws an exception. |
| | | */ |
| | | /** Tests that getUserFriendlyName throws an exception. */ |
| | | @Test(expectedExceptions = UnsupportedOperationException.class) |
| | | public void testGetUserFriendlyName() { |
| | | assertNotNull(TopCfgDefn.getInstance().getUserFriendlyName()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that getUserFriendlyPluralName throws an exception. |
| | | */ |
| | | /** Tests that getUserFriendlyPluralName throws an exception. */ |
| | | @Test(expectedExceptions = UnsupportedOperationException.class) |
| | | public void testGetUserFriendlyPluralName() { |
| | | assertNotNull(TopCfgDefn.getInstance().getUserFriendlyPluralName()); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests that there are children. |
| | | */ |
| | | /** Tests that there are children. */ |
| | | @Test |
| | | public void testGetAllChildren() { |
| | | assertTrue(TopCfgDefn.getInstance().getAllChildren().size() > 0); |
| | | assertFalse(TopCfgDefn.getInstance().getAllChildren().isEmpty()); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | | |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.admin.AdminTestCase; |
| | | import org.opends.server.admin.DefinitionDecodingException; |
| | | import org.opends.server.admin.PropertyException; |
| | | import org.opends.server.admin.ManagedObjectNotFoundException; |
| | | import org.opends.server.admin.TestCfg; |
| | | import org.opends.server.admin.TestChildCfgClient; |
| | | import org.opends.server.admin.TestChildCfgDefn; |
| | | import org.opends.server.admin.TestParentCfgClient; |
| | | import org.opends.server.admin.client.AuthorizationException; |
| | | import org.opends.server.admin.client.CommunicationException; |
| | | import org.opends.server.admin.client.ConcurrentModificationException; |
| | | import org.opends.server.admin.client.ManagedObject; |
| | | import org.opends.server.admin.client.ManagedObjectDecodingException; |
| | | import org.opends.server.admin.client.ManagementContext; |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | |
| | | |
| | | /** |
| | | * Test cases for aggregations on the client-side. |
| | | */ |
| | |
| | | |
| | | |
| | | /** Retrieve the named test parent managed object. */ |
| | | private TestParentCfgClient getTestParent(ManagementContext context, |
| | | String name) throws DefinitionDecodingException, |
| | | ManagedObjectDecodingException, AuthorizationException, |
| | | ManagedObjectNotFoundException, ConcurrentModificationException, |
| | | CommunicationException { |
| | | ManagedObject<RootCfgClient> root = context |
| | | .getRootConfigurationManagedObject(); |
| | | private TestParentCfgClient getTestParent(ManagementContext context, String name) throws Exception { |
| | | ManagedObject<RootCfgClient> root = context.getRootConfigurationManagedObject(); |
| | | return root.getChild(TestCfg.getTestOneToManyParentRelationDefinition(), |
| | | name).getConfiguration(); |
| | | } |
| | |
| | | SortedSet<String> values = new TreeSet<>(TestChildCfgDefn |
| | | .getInstance().getAggregationPropertyPropertyDefinition()); |
| | | if (expected != null) { |
| | | for (String value : expected) { |
| | | values.add(value); |
| | | } |
| | | Collections.addAll(values, expected); |
| | | } |
| | | Assert.assertEquals((Object) actual, (Object) values); |
| | | } |
| | | |
| | | } |
| | |
| | | package org.opends.server.admin.server; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.SortedSet; |
| | | import java.util.TreeSet; |
| | |
| | | SortedSet<String> values = new TreeSet<>(TestChildCfgDefn |
| | | .getInstance().getAggregationPropertyPropertyDefinition()); |
| | | if (expected != null) { |
| | | for (String value : expected) { |
| | | values.add(value); |
| | | } |
| | | Collections.addAll(values, expected); |
| | | } |
| | | Assert.assertEquals((Object) actual, (Object) values); |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.api.plugin; |
| | | |
| | | |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.lang.reflect.Modifier; |
| | | import java.util.Collections; |
| | | import java.util.LinkedList; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of generic test cases for the Directory Server plugin API. |
| | | */ |
| | | public class DirectoryServerPluginTestCase |
| | | /** A set of generic test cases for the Directory Server plugin API. */ |
| | | public class DirectoryServerPluginTestCase |
| | | extends PluginAPITestCase |
| | | { |
| | | @BeforeClass |
| | |
| | | "ds-cfg-plugin-type: intermediateResponse"); |
| | | |
| | | PluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), |
| | | pluginEntry); |
| | | |
| | | AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry); |
| | | |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | DN pluginEntryDN = DN.valueOf("cn=Null Plugin,cn=Plugins,cn=config"); |
| | | |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | for (PluginType t : PluginType.values()) |
| | | { |
| | | pluginTypes.add(t); |
| | | } |
| | | Collections.addAll(pluginTypes, PluginType.values()); |
| | | |
| | | nullPlugin.initializeInternal(configuration.dn(), pluginTypes, |
| | | configuration.isInvokeForInternalOperations()); |
| | |
| | | "ds-cfg-plugin-type: intermediateResponse"); |
| | | |
| | | PluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), |
| | | pluginEntry); |
| | | |
| | | AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry); |
| | | |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | for (PluginType t : PluginType.values()) |
| | | { |
| | | pluginTypes.add(t); |
| | | } |
| | | Collections.addAll(pluginTypes, PluginType.values()); |
| | | |
| | | nullPlugin.initializeInternal(configuration.dn(), pluginTypes, |
| | | configuration.isInvokeForInternalOperations()); |
| | |
| | | argList.add("-s"); |
| | | argList.add("sub"); |
| | | argList.add(filter); |
| | | String[] attrs=attr.split("\\s+"); |
| | | for(String a : attrs) |
| | | { |
| | | argList.add(a); |
| | | } |
| | | Collections.addAll(argList, attr.split("\\s+")); |
| | | String[] args = new String[argList.size()]; |
| | | oStream.reset(); |
| | | int retVal = |
| | |
| | | _searchFilter)); |
| | | } |
| | | |
| | | for (String attribute : _attributes) |
| | | { |
| | | args.add(attribute); |
| | | } |
| | | Collections.addAll(args, _attributes); |
| | | |
| | | return args.toArray(new String[args.size()]); |
| | | } |
| | |
| | | .append(")").toString(); |
| | | final SearchRequest request = newSearchRequest(baseDN, SearchScope.SINGLE_LEVEL, searchFilter).addAttribute("dn"); |
| | | InternalSearchOperation searchOp = getRootConnection().processSearch(request); |
| | | assertTrue(0 < searchOp.getSearchEntries().size()); |
| | | assertFalse(searchOp.getSearchEntries().isEmpty()); |
| | | |
| | | String compromisedTime = TimeThread.getGeneralizedTime(); |
| | | for (Entry e : searchOp.getSearchEntries()) { |
| | |
| | | final SearchRequest request = newSearchRequest(baseDN, SearchScope.SINGLE_LEVEL, searchFilter) |
| | | .addAttribute(ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY); |
| | | InternalSearchOperation searchOp = getRootConnection().processSearch(request); |
| | | assertTrue(0 < searchOp.getSearchEntries().size()); |
| | | assertFalse(searchOp.getSearchEntries().isEmpty()); |
| | | |
| | | final InternalClientConnection internalConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.ListIterator; |
| | |
| | | Set<String> set = new HashSet<>(); |
| | | for (String[] array : data) |
| | | { |
| | | for (String s : array) |
| | | { |
| | | set.add(s); |
| | | } |
| | | Collections.addAll(set, array); |
| | | } |
| | | return set; |
| | | } |
| | |
| | | { |
| | | assertEquals(decoded.getNOTComponent().toString(), filter.getNOTComponent().toString()); |
| | | } |
| | | if(decoded.getSubAnyElements() != null && decoded.getSubAnyElements().size() > 0 || |
| | | filter.getSubAnyElements() != null && filter.getSubAnyElements().size() > 0) |
| | | if(isNotEmpty(decoded.getSubAnyElements()) || isNotEmpty(filter.getSubAnyElements())) |
| | | { |
| | | assertEquals(decoded.getSubAnyElements(), filter.getSubAnyElements()); |
| | | } |
| | | if(decoded.getSubFinalElement() != null && !decoded.getSubFinalElement().toString().equals("") || |
| | | filter.getSubFinalElement() != null && !filter.getSubFinalElement().toString().equals("")) |
| | | if(isNotEmpty(decoded.getSubFinalElement()) || isNotEmpty(filter.getSubFinalElement())) |
| | | { |
| | | assertEquals(decoded.getSubFinalElement(), filter.getSubFinalElement()); |
| | | } |
| | | if(decoded.getSubInitialElement() != null && !decoded.getSubInitialElement().toString().equals("") || |
| | | filter.getSubInitialElement() != null && !filter.getSubInitialElement().toString().equals("")) |
| | | if(isNotEmpty(decoded.getSubInitialElement()) || isNotEmpty(filter.getSubInitialElement())) |
| | | { |
| | | assertEquals(decoded.getSubInitialElement(), filter.getSubInitialElement()); |
| | | } |
| | | } |
| | | |
| | | private boolean isNotEmpty(ByteString bs) |
| | | { |
| | | return bs != null && !bs.toString().equals(""); |
| | | } |
| | | |
| | | private boolean isNotEmpty(ArrayList<ByteString> col) |
| | | { |
| | | return col != null && !col.isEmpty(); |
| | | } |
| | | |
| | | @Test(dataProvider = "badfilterstrings", expectedExceptions = LDAPException.class) |
| | | public void testDecodeException (String filterStr, LDAPFilter filter) throws Exception |
| | | { |
| | |
| | | { |
| | | List<List<Object>> newObjectArrayList = new ArrayList<>(); |
| | | |
| | | if (objectArrayList.size() == 0) |
| | | if (objectArrayList.isEmpty()) |
| | | { |
| | | // First time we add some parameters, create first object arrays |
| | | // Add each possible parameter as initial parameter lists |
| | |
| | | } |
| | | else |
| | | { // Not enough eligible servers |
| | | if (eligibleServers.size() > 0) // Some eligible servers anyway |
| | | if (!eligibleServers.isEmpty()) // Some eligible servers anyway |
| | | { |
| | | if (expectedServers.size() == eligibleServers.size()) // All eligible servers should respond in time |
| | | { |
| | |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.File; |
| | | import java.io.PrintStream; |
| | | import java.util.Collections; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | |
| | |
| | | argsList.add(configFilePath); |
| | | if (args != null) |
| | | { |
| | | for (final String argument : args) |
| | | { |
| | | argsList.add(argument); |
| | | } |
| | | Collections.addAll(argsList, args); |
| | | } |
| | | final String[] mainArgs = new String[argsList.size()]; |
| | | argsList.toArray(mainArgs); |
| | | return mainArgs; |
| | | return argsList.toArray(new String[argsList.size()]); |
| | | } |
| | | |
| | | /** |
| | |
| | | public void testListToArray(String[] strings) throws Exception { |
| | | if (strings != null) { |
| | | List<String> list = new ArrayList<>(strings.length); |
| | | for (String string : strings) { |
| | | list.add(string); |
| | | } |
| | | Collections.addAll(list, strings); |
| | | Assert.assertEquals(StaticUtils.listToArray(list), strings); |
| | | } else { |
| | | Assert.assertNull(StaticUtils.listToArray(null)); |