| | |
| | | return; |
| | | } |
| | | |
| | | AttributeType attrType1 = DirectoryServer.getAttributeType("adminport"); |
| | | AttributeType attrType2 = DirectoryServer.getAttributeType("adminEnabled"); |
| | | AttributeType attrType1 = DirectoryServer.getSchema().getAttributeType("adminport"); |
| | | AttributeType attrType2 = DirectoryServer.getSchema().getAttributeType("adminEnabled"); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrType1, adminPort))); |
| | |
| | | if (!result.isEmpty()) |
| | | { |
| | | SearchResultEntry adminConnectorEntry = result.getFirst(); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> attrs = adminConnectorEntry.getAttribute(attrType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | |
| | | { |
| | | // First check to see if the ds-pwp-password-policy-dn is present. |
| | | String userDNString = userEntry.getName().toString(); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | for (Attribute a : userEntry.getAttribute(type)) |
| | | { |
| | | if (a.isEmpty()) |
| | |
| | | */ |
| | | public boolean isDisabled() |
| | | { |
| | | final AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_ACCOUNT_DISABLED); |
| | | final AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_ACCOUNT_DISABLED); |
| | | try |
| | | { |
| | | isDisabled = getBoolean(userEntry, type); |
| | |
| | | newPrivileges.addAll(DirectoryServer.getRootPrivileges()); |
| | | } |
| | | |
| | | AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeType privType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | for (Attribute a : entry.getAttribute(privType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | private AttributeDescription loadAttributeToMaps(final int id, final String attributeName, |
| | | final Iterable<String> attributeOptions, final Mappings mappings) |
| | | { |
| | | final AttributeType type = DirectoryServer.getAttributeType(attributeName); |
| | | final AttributeType type = DirectoryServer.getSchema().getAttributeType(attributeName); |
| | | final Set<String> options = getOptions(attributeOptions); |
| | | final AttributeDescription ad = AttributeDescription.create(type, options); |
| | | exclusiveLock.lock(); |
| | |
| | | { |
| | | if (aclRights == null) |
| | | { |
| | | aclRights = DirectoryServer.getAttributeType(aclRightsAttrStr); |
| | | aclRights = DirectoryServer.getSchema().getAttributeType(aclRightsAttrStr); |
| | | } |
| | | if (aclRightsInfo == null) |
| | | { |
| | | aclRightsInfo = DirectoryServer.getAttributeType(aclRightsInfoAttrStr); |
| | | aclRightsInfo = DirectoryServer.getSchema().getAttributeType(aclRightsInfoAttrStr); |
| | | } |
| | | if (dnAttributeType == null) |
| | | { |
| | | dnAttributeType = DirectoryServer.getAttributeType(dnAttrStr); |
| | | dnAttributeType = DirectoryServer.getSchema().getAttributeType(dnAttrStr); |
| | | } |
| | | |
| | | // Check if the attributes aclRights and aclRightsInfo were requested and |
| | |
| | | } |
| | | else |
| | | { |
| | | nonRightsAttrs.add(DirectoryServer.getAttributeType(a)); |
| | | nonRightsAttrs.add(DirectoryServer.getSchema().getAttributeType(a)); |
| | | } |
| | | } |
| | | } |
| | |
| | | // Only add the aclRights information if the aclRights attribute type was seen. |
| | | if(hasAttrMask(mask, ACL_RIGHTS)) { |
| | | String typeStr = aclRightsAttributeLevelStr + ";" + a.getNameOrOID(); |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(typeStr); |
| | | AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(typeStr); |
| | | Attribute attr = Attributes.create(attributeType, evalInfo.toString()); |
| | | //It is possible that the user might have specified the same attributes |
| | | //in both the search and the specific attribute part of the control. |
| | |
| | | if(hasAttrMask(mask,ACL_RIGHTS_INFO)) { |
| | | //Build the attribute type. |
| | | String typeStr = aclRightsInfoAttrLogsStr + ";" + rightStr + ";" + aType.getNameOrOID(); |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(typeStr); |
| | | AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(typeStr); |
| | | Attribute attr = Attributes.create(attributeType, container.getEvalSummary()); |
| | | // The attribute type might have already been added, probably |
| | | // not but it is possible. |
| | |
| | | */ |
| | | private static void initStatics() |
| | | { |
| | | aciType = getAttributeType("aci"); |
| | | globalAciType = getAttributeType(ATTR_AUTHZ_GLOBAL_ACI); |
| | | debugSearchIndex = getAttributeType(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX); |
| | | refAttrType = getAttributeType(ATTR_REFERRAL_URL); |
| | | aciType = getSchema().getAttributeType("aci"); |
| | | globalAciType = getSchema().getAttributeType(ATTR_AUTHZ_GLOBAL_ACI); |
| | | debugSearchIndex = getSchema().getAttributeType(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX); |
| | | refAttrType = getSchema().getAttributeType(ATTR_REFERRAL_URL); |
| | | |
| | | try |
| | | { |
| | |
| | | baseName = toLowerCase(rawAttributeType); |
| | | } |
| | | |
| | | container.setCurrentAttributeType(getAttributeType(baseName)); |
| | | container.setCurrentAttributeType(getSchema().getAttributeType(baseName)); |
| | | container.setCurrentAttributeValue(operation.getAssertionValue()); |
| | | return isAllowed(container, operation); |
| | | } |
| | |
| | | // Check to make sure that the backend has a presence index defined |
| | | // for the ACI attribute. If it does not, then log a warning message |
| | | // because this processing could be very expensive. |
| | | AttributeType aciType = DirectoryServer.getAttributeType("aci"); |
| | | AttributeType aciType = DirectoryServer.getSchema().getAttributeType("aci"); |
| | | if (backend.getEntryCount() > 0 |
| | | && !backend.isIndexed(aciType, IndexType.PRESENCE)) |
| | | { |
| | |
| | | * @return The attribute type. |
| | | */ |
| | | public AttributeType getAttributeType() { |
| | | return DirectoryServer.getAttributeType(attrTypeStr); |
| | | return DirectoryServer.getSchema().getAttributeType(attrTypeStr); |
| | | } |
| | | |
| | | /** |
| | |
| | | AVA ava = rdn.getFirstAVA(); |
| | | if (!typePatterns[0].equals("*")) |
| | | { |
| | | AttributeType thisType = DirectoryServer.getAttributeType(typePatterns[0]); |
| | | AttributeType thisType = DirectoryServer.getSchema().getAttributeType(typePatterns[0]); |
| | | if (thisType.isPlaceHolder() || !thisType.equals(ava.getAttributeType())) |
| | | { |
| | | return false; |
| | |
| | | TreeMap<String, List<ByteString>> patternMap = new TreeMap<>(); |
| | | for (int i = 0; i < typePatterns.length; i++) |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeType(typePatterns[i]); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(typePatterns[i]); |
| | | if (type.isPlaceHolder()) |
| | | { |
| | | return false; |
| | |
| | | attributeName=attributeName.substring(0, semicolon); |
| | | } |
| | | String filterString=matcher.group(filterPos); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attributeName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attributeName); |
| | | SearchFilter filter; |
| | | //Check if it is a valid filter and add it to the list map if ok. |
| | | try { |
| | |
| | | throw new AciException(message); |
| | | } |
| | | } else { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attribute); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attribute); |
| | | if(attrType.isOperational()) |
| | | { |
| | | opAttributes.add(attrType); |
| | |
| | | private EnumEvalResult evalVAL(AciEvalContext evalCtx) { |
| | | EnumEvalResult matched= EnumEvalResult.FALSE; |
| | | boolean undefined=false; |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrStr); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrStr); |
| | | final SearchRequest request = newSearchRequest(evalCtx.getClientDN(), SearchScope.BASE_OBJECT); |
| | | InternalSearchOperation op = getRootConnection().processSearch(request); |
| | | LinkedList<SearchResultEntry> result = op.getSearchEntries(); |
| | |
| | | */ |
| | | private EnumEvalResult evalURL(AciEvalContext evalCtx) { |
| | | EnumEvalResult matched= EnumEvalResult.FALSE; |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrStr); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrStr); |
| | | List<Attribute> attrs=evalCtx.getResourceEntry().getAttribute(attrType); |
| | | for(Attribute a : attrs) { |
| | | for(ByteString v : a) { |
| | |
| | | import static org.forgerock.util.Reject.*; |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.schema.BooleanSyntax.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | // Construct the backup base entry. |
| | | LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(2); |
| | | objectClasses.put(CoreSchema.getTopObjectClass(), OC_TOP); |
| | | objectClasses.put(DirectoryServer.getSchema().getObjectClass(OC_UNTYPED_OBJECT_LC), OC_UNTYPED_OBJECT); |
| | | objectClasses.put(getSchema().getObjectClass(OC_UNTYPED_OBJECT_LC), OC_UNTYPED_OBJECT); |
| | | |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(1); |
| | |
| | | { |
| | | int numEntries = 1; |
| | | |
| | | AttributeType backupPathType = |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType backupPathType = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | |
| | | for (File dir : backupDirectories.keySet()) |
| | | { |
| | |
| | | long count = 0; |
| | | Entry backupDirEntry = getBackupDirectoryEntry(entryDN); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | List<Attribute> attrList = backupDirEntry.getAttribute(t); |
| | | for (ByteString v : attrList.get(0)) |
| | | { |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Make sure that the DN specifies a backup directory. |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | // Construct the backup directory entry to return. |
| | | LinkedHashMap<ObjectClass,String> ocMap = new LinkedHashMap<>(2); |
| | | ocMap.put(CoreSchema.getTopObjectClass(), OC_TOP); |
| | | ocMap.put(DirectoryServer.getSchema().getObjectClass(OC_BACKUP_DIRECTORY), OC_BACKUP_DIRECTORY); |
| | | ocMap.put(getSchema().getObjectClass(OC_BACKUP_DIRECTORY), OC_BACKUP_DIRECTORY); |
| | | |
| | | LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0); |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(3); |
| | | userAttrs.put(t, asList(t, v)); |
| | | |
| | | t = DirectoryServer.getAttributeType(ATTR_BACKUP_BACKEND_DN); |
| | | t = getSchema().getAttributeType(ATTR_BACKUP_BACKEND_DN); |
| | | userAttrs.put(t, asList(t, ByteString.valueOfUtf8(backupDirectory.getConfigEntryDN().toString()))); |
| | | |
| | | Entry e = new Entry(entryDN, ocMap, userAttrs, opAttrs); |
| | |
| | | throws DirectoryException |
| | | { |
| | | // First, get the backup ID from the entry DN. |
| | | AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType idType = getSchema().getAttributeType(ATTR_BACKUP_ID); |
| | | ByteString idValue = entryDN.rdn().getAttributeValue(idType); |
| | | if (idValue == null) { |
| | | throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_ID_IN_DN.get(entryDN)); |
| | |
| | | throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_PARENT_DN.get(entryDN)); |
| | | } |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | ByteString v = parentDN.rdn().getAttributeValue(t); |
| | | if (v == null) { |
| | | throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_DIR_IN_DN.get(entryDN)); |
| | |
| | | // Construct the backup entry to return. |
| | | LinkedHashMap<ObjectClass, String> ocMap = new LinkedHashMap<>(3); |
| | | ocMap.put(CoreSchema.getTopObjectClass(), OC_TOP); |
| | | ocMap.put(DirectoryServer.getSchema().getObjectClass(OC_BACKUP_INFO), OC_BACKUP_INFO); |
| | | ocMap.put(getSchema().getObjectClass(OC_BACKUP_INFO), OC_BACKUP_INFO); |
| | | ocMap.put(CoreSchema.getExtensibleObjectObjectClass(), OC_EXTENSIBLE_OBJECT); |
| | | |
| | | LinkedHashMap<AttributeType, List<Attribute>> opAttrs = new LinkedHashMap<>(0); |
| | |
| | | |
| | | Date backupDate = backupInfo.getBackupDate(); |
| | | if (backupDate != null) { |
| | | t = DirectoryServer.getAttributeType(ATTR_BACKUP_DATE); |
| | | t = getSchema().getAttributeType(ATTR_BACKUP_DATE); |
| | | userAttrs.put(t, |
| | | asList(t, ByteString.valueOfUtf8(GeneralizedTimeSyntax.format(backupDate)))); |
| | | } |
| | |
| | | |
| | | Set<String> dependencies = backupInfo.getDependencies(); |
| | | if (dependencies != null && !dependencies.isEmpty()) { |
| | | t = DirectoryServer.getAttributeType(ATTR_BACKUP_DEPENDENCY); |
| | | t = getSchema().getAttributeType(ATTR_BACKUP_DEPENDENCY); |
| | | AttributeBuilder builder = new AttributeBuilder(t); |
| | | builder.addAllStrings(dependencies); |
| | | userAttrs.put(t, builder.toAttributeList()); |
| | |
| | | Map<String, String> properties = backupInfo.getBackupProperties(); |
| | | if (properties != null && !properties.isEmpty()) { |
| | | for (Map.Entry<String, String> e : properties.entrySet()) { |
| | | t = DirectoryServer.getAttributeType(toLowerCase(e.getKey())); |
| | | t = getSchema().getAttributeType(toLowerCase(e.getKey())); |
| | | userAttrs.put(t, asList(t, ByteString.valueOfUtf8(e.getValue()))); |
| | | } |
| | | } |
| | |
| | | |
| | | private void putByteString(LinkedHashMap<AttributeType, List<Attribute>> userAttrs, String attrName, byte[] value) |
| | | { |
| | | AttributeType t = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType t = getSchema().getAttributeType(attrName); |
| | | userAttrs.put(t, asList(t, ByteString.wrap(value))); |
| | | } |
| | | |
| | | private void putBoolean(LinkedHashMap<AttributeType, List<Attribute>> attrsMap, String attrName, boolean value) |
| | | { |
| | | AttributeType t = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType t = getSchema().getAttributeType(attrName); |
| | | attrsMap.put(t, asList(t, createBooleanValue(value))); |
| | | } |
| | | |
| | |
| | | |
| | | if (scope != SearchScope.BASE_OBJECT && !backupDirectories.isEmpty()) |
| | | { |
| | | AttributeType backupPathType = |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType backupPathType = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | for (File dir : backupDirectories.keySet()) |
| | | { |
| | | // Check to see if the descriptor file exists. If not, then skip this |
| | |
| | | |
| | | if (scope != SearchScope.BASE_OBJECT) |
| | | { |
| | | AttributeType t = |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | List<Attribute> attrList = backupDirEntry.getAttribute(t); |
| | | returnEntries(searchOperation, baseDN, filter, attrList); |
| | | } |
| | |
| | | { |
| | | File dir = new File(v.toString()); |
| | | BackupDirectory backupDirectory = backupDirectories.get(dir).getBackupDirectory(); |
| | | AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType idType = getSchema().getAttributeType(ATTR_BACKUP_ID); |
| | | |
| | | for (String backupID : backupDirectory.getBackups().keySet()) |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.backends; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.controls.EntryChangelogNotificationControl; |
| | | import org.opends.server.controls.ExternalChangelogRequestControl; |
| | | import org.opends.server.core.AddOperation; |
| | |
| | | CHANGELOG_ENTRY_OBJECT_CLASSES.put(getSchema().getObjectClass(OC_CHANGELOG_ENTRY), OC_CHANGELOG_ENTRY); |
| | | } |
| | | |
| | | /** The attribute type for the "creatorsName" attribute. */ |
| | | private static final AttributeType CREATORS_NAME_TYPE = getAttributeType(OP_ATTR_CREATORS_NAME); |
| | | /** The attribute type for the "modifiersName" attribute. */ |
| | | private static final AttributeType MODIFIERS_NAME_TYPE = getAttributeType(OP_ATTR_MODIFIERS_NAME); |
| | | |
| | | /** The base DN for the external change log. */ |
| | | public static final DN CHANGELOG_BASE_DN = DN.valueOf(DN_EXTERNAL_CHANGELOG_ROOT); |
| | | |
| | |
| | | private SearchFilter buildSearchFilterFrom(final DN baseDN, final String attrName) |
| | | { |
| | | final RDN rdn = baseDN.rdn(); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | final ByteString attrValue = rdn.getAttributeValue(attrType); |
| | | if (attrValue != null) |
| | | { |
| | |
| | | final StringBuilder builder = new StringBuilder(256); |
| | | for (Attribute attr : addMsg.getAttributes()) |
| | | { |
| | | if (attr.getAttributeDescription().getAttributeType().equals(CREATORS_NAME_TYPE) && !attr.isEmpty()) |
| | | if (!attr.isEmpty() |
| | | && attr.getAttributeDescription().getAttributeType().equals(getCreatorsNameAttributeType())) |
| | | { |
| | | // This attribute is not multi-valued. |
| | | changeInitiatorsName = attr.iterator().next().toString(); |
| | |
| | | { |
| | | final Attribute attr = mod.getAttribute(); |
| | | if (mod.getModificationType() == ModificationType.REPLACE |
| | | && attr.getAttributeDescription().getAttributeType().equals(MODIFIERS_NAME_TYPE) |
| | | && !attr.isEmpty()) |
| | | && !attr.isEmpty() |
| | | && attr.getAttributeDescription().getAttributeType().equals(getModifiersNameAttributeType())) |
| | | { |
| | | // This attribute is not multi-valued. |
| | | changeInitiatorsName = attr.iterator().next().toString(); |
| | |
| | | final Map<AttributeType, List<Attribute>> opAttrs = new LinkedHashMap<>(); |
| | | |
| | | // Operational standard attributes |
| | | addAttributeByType(ATTR_SUBSCHEMA_SUBENTRY_LC, ATTR_SUBSCHEMA_SUBENTRY_LC, |
| | | ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, userAttrs, opAttrs); |
| | | addAttributeByType("numsubordinates", "numSubordinates", "0", userAttrs, opAttrs); |
| | | addAttributeByType("hassubordinates", "hasSubordinates", "false", userAttrs, opAttrs); |
| | | addAttributeByType("entrydn", "entryDN", dnString, userAttrs, opAttrs); |
| | | addAttributeByType(ATTR_SUBSCHEMA_SUBENTRY_LC, DN_DEFAULT_SCHEMA_ROOT, userAttrs, opAttrs); |
| | | addAttributeByType("numSubordinates", "0", userAttrs, opAttrs); |
| | | addAttributeByType("hasSubordinates", "false", userAttrs, opAttrs); |
| | | addAttributeByType("entryDN", dnString, userAttrs, opAttrs); |
| | | |
| | | // REQUIRED attributes |
| | | if (changeNumber > 0) |
| | | { |
| | | addAttributeByType("changenumber", "changeNumber", String.valueOf(changeNumber), userAttrs, opAttrs); |
| | | addAttributeByType("changeNumber", String.valueOf(changeNumber), userAttrs, opAttrs); |
| | | } |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME); |
| | | dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); // ?? |
| | | final String format = dateFormat.format(new Date(csn.getTime())); |
| | | addAttributeByType("changetime", "changeTime", format, userAttrs, opAttrs); |
| | | addAttributeByType("changetype", "changeType", changeType, userAttrs, opAttrs); |
| | | addAttributeByType("targetdn", "targetDN", msg.getDN().toString(), userAttrs, opAttrs); |
| | | addAttributeByType("changeTime", format, userAttrs, opAttrs); |
| | | addAttributeByType("changeType", changeType, userAttrs, opAttrs); |
| | | addAttributeByType("targetDN", msg.getDN().toString(), userAttrs, opAttrs); |
| | | |
| | | // NON REQUESTED attributes |
| | | addAttributeByType("replicationcsn", "replicationCSN", csn.toString(), userAttrs, opAttrs); |
| | | addAttributeByType("replicaidentifier", "replicaIdentifier", Integer.toString(csn.getServerId()), |
| | | userAttrs, opAttrs); |
| | | addAttributeByType("replicationCSN", csn.toString(), userAttrs, opAttrs); |
| | | addAttributeByType("replicaIdentifier", Integer.toString(csn.getServerId()), userAttrs, opAttrs); |
| | | |
| | | if (ldifChanges != null) |
| | | { |
| | | addAttributeByType("changes", "changes", ldifChanges, userAttrs, opAttrs); |
| | | addAttributeByType("changes", ldifChanges, userAttrs, opAttrs); |
| | | } |
| | | if (changeInitiatorsName != null) |
| | | { |
| | | addAttributeByType("changeinitiatorsname", "changeInitiatorsName", changeInitiatorsName, userAttrs, opAttrs); |
| | | addAttributeByType("changeInitiatorsName", changeInitiatorsName, userAttrs, opAttrs); |
| | | } |
| | | |
| | | final String targetUUID = msg.getEntryUUID(); |
| | | if (targetUUID != null) |
| | | { |
| | | addAttributeByType("targetentryuuid", "targetEntryUUID", targetUUID, userAttrs, opAttrs); |
| | | addAttributeByType("targetEntryUUID", targetUUID, userAttrs, opAttrs); |
| | | } |
| | | final String cookie2 = cookie != null ? cookie : ""; |
| | | addAttributeByType("changelogcookie", "changeLogCookie", cookie2, userAttrs, opAttrs); |
| | | addAttributeByType("changeLogCookie", cookie2, userAttrs, opAttrs); |
| | | |
| | | final List<RawAttribute> includedAttributes = msg.getEclIncludes(); |
| | | if (includedAttributes != null && !includedAttributes.isEmpty()) |
| | |
| | | } |
| | | } |
| | | final String includedAttributesLDIF = builder.toString(); |
| | | addAttributeByType("includedattributes", "includedAttributes", includedAttributesLDIF, userAttrs, opAttrs); |
| | | addAttributeByType("includedAttributes", includedAttributesLDIF, userAttrs, opAttrs); |
| | | } |
| | | |
| | | return new Entry(DN.valueOf(dnString), CHANGELOG_ENTRY_OBJECT_CLASSES, userAttrs, opAttrs); |
| | |
| | | // -- or we risk returning less entries if purge kicks in after we computed numSubordinates |
| | | // - Or we accumulate all the entries that must be returned before sending them => OutOfMemoryError |
| | | |
| | | addAttributeByUppercaseName(ATTR_COMMON_NAME, ATTR_COMMON_NAME, BACKEND_ID, userAttrs, operationalAttrs); |
| | | addAttributeByUppercaseName(ATTR_SUBSCHEMA_SUBENTRY_LC, ATTR_SUBSCHEMA_SUBENTRY, |
| | | ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, userAttrs, operationalAttrs); |
| | | addAttributeByUppercaseName("hassubordinates", "hasSubordinates", hasSubordinatesStr, userAttrs, operationalAttrs); |
| | | addAttributeByUppercaseName("entrydn", "entryDN", DN_EXTERNAL_CHANGELOG_ROOT, userAttrs, operationalAttrs); |
| | | addAttributeByName(ATTR_COMMON_NAME, BACKEND_ID, userAttrs, operationalAttrs); |
| | | addAttributeByName(ATTR_SUBSCHEMA_SUBENTRY, DN_DEFAULT_SCHEMA_ROOT, userAttrs, operationalAttrs); |
| | | addAttributeByName("hasSubordinates", hasSubordinatesStr, userAttrs, operationalAttrs); |
| | | addAttributeByName("entryDN", DN_EXTERNAL_CHANGELOG_ROOT, userAttrs, operationalAttrs); |
| | | return new Entry(CHANGELOG_BASE_DN, CHANGELOG_ROOT_OBJECT_CLASSES, userAttrs, operationalAttrs); |
| | | } |
| | | |
| | |
| | | e.addAttribute(Attributes.create(attrType, attrValue), null); |
| | | } |
| | | |
| | | private static void addAttributeByType(String attrNameLowercase, |
| | | String attrNameUppercase, String attrValue, |
| | | private static void addAttributeByType(String attrName, String attrValue, |
| | | Map<AttributeType, List<Attribute>> userAttrs, |
| | | Map<AttributeType, List<Attribute>> operationalAttrs) |
| | | { |
| | | addAttribute(attrNameLowercase, attrNameUppercase, attrValue, userAttrs, operationalAttrs, true); |
| | | addAttribute(attrName, attrValue, userAttrs, operationalAttrs, true); |
| | | } |
| | | |
| | | private static void addAttributeByUppercaseName(String attrNameLowercase, |
| | | String attrNameUppercase, String attrValue, |
| | | private static void addAttributeByName(String attrName, String attrValue, |
| | | Map<AttributeType, List<Attribute>> userAttrs, |
| | | Map<AttributeType, List<Attribute>> operationalAttrs) |
| | | { |
| | | addAttribute(attrNameLowercase, attrNameUppercase, attrValue, userAttrs, operationalAttrs, false); |
| | | addAttribute(attrName, attrValue, userAttrs, operationalAttrs, false); |
| | | } |
| | | |
| | | private static void addAttribute(final String attrNameLowercase, |
| | | final String attrNameUppercase, final String attrValue, |
| | | private static void addAttribute(final String attrName, final String attrValue, |
| | | final Map<AttributeType, List<Attribute>> userAttrs, |
| | | final Map<AttributeType, List<Attribute>> operationalAttrs, final boolean addByType) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrNameUppercase); |
| | | final Attribute a = addByType |
| | | ? Attributes.create(attrType, attrValue) |
| | | : Attributes.create(attrNameUppercase, attrValue); |
| | | ? Attributes.create(getSchema().getAttributeType(attrName), attrValue) |
| | | : Attributes.create(attrName, attrValue); |
| | | final AttributeType attrType = a.getAttributeDescription().getAttributeType(); |
| | | final List<Attribute> attrList = Collections.singletonList(a); |
| | | if (attrType.isOperational()) |
| | | { |
| | |
| | | import static org.opends.messages.ConfigMessages.*; |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.types.CommonSchemaElements.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | private static final String CONFIG_SCHEMA_ELEMENTS_FILE = "02-config.ldif"; |
| | | private static final String CORE_SCHEMA_ELEMENTS_FILE = "00-core.ldif"; |
| | | |
| | | private static final AttributeType attributeTypesType = getAttributeTypesAttributeType(); |
| | | private static final AttributeType ditStructureRulesType = getDITStructureRulesAttributeType(); |
| | | private static final AttributeType ditContentRulesType = getDITContentRulesAttributeType(); |
| | | private static final AttributeType ldapSyntaxesType = getLDAPSyntaxesAttributeType(); |
| | | private static final AttributeType matchingRulesType = getMatchingRulesAttributeType(); |
| | | private static final AttributeType matchingRuleUsesType = getMatchingRuleUseAttributeType(); |
| | | private static final AttributeType nameFormsType = getNameFormsAttributeType(); |
| | | private static final AttributeType objectClassesType = getObjectClassesAttributeType(); |
| | | |
| | | /** The set of user-defined attributes that will be included in the schema entry. */ |
| | | private ArrayList<Attribute> userDefinedAttributes; |
| | | |
| | | /** The attribute type that will be used to include the defined attribute types. */ |
| | | private AttributeType attributeTypesType; |
| | | /** The attribute type that will be used to hold the schema creation timestamp. */ |
| | | private AttributeType createTimestampType; |
| | | /** The attribute type that will be used to hold the schema creator's name. */ |
| | | private AttributeType creatorsNameType; |
| | | /** The attribute type that will be used to include the defined DIT content rules. */ |
| | | private AttributeType ditContentRulesType; |
| | | /** The attribute type that will be used to include the defined DIT structure rules. */ |
| | | private AttributeType ditStructureRulesType; |
| | | /** The attribute type that will be used to include the defined attribute syntaxes. */ |
| | | private AttributeType ldapSyntaxesType; |
| | | /** The attribute type that will be used to include the defined matching rules. */ |
| | | private AttributeType matchingRulesType; |
| | | /** The attribute type that will be used to include the defined matching rule uses. */ |
| | | private AttributeType matchingRuleUsesType; |
| | | /** The attribute that will be used to hold the schema modifier's name. */ |
| | | private AttributeType modifiersNameType; |
| | | /** The attribute type that will be used to hold the schema modification timestamp. */ |
| | | private AttributeType modifyTimestampType; |
| | | /** The attribute type that will be used to include the defined object classes. */ |
| | | private AttributeType objectClassesType; |
| | | /** The attribute type that will be used to include the defined name forms. */ |
| | | private AttributeType nameFormsType; |
| | | |
| | | /** The value containing DN of the user we'll say created the configuration. */ |
| | | private ByteString creatorsName; |
| | | /** The value containing the DN of the last user to modify the configuration. */ |
| | |
| | | |
| | | configEntryDN = configEntry.getName(); |
| | | |
| | | // Get all of the attribute types that we will use for schema elements. |
| | | attributeTypesType = getAttributeType(ATTR_ATTRIBUTE_TYPES_LC); |
| | | objectClassesType = getAttributeType(ATTR_OBJECTCLASSES_LC); |
| | | matchingRulesType = getAttributeType(ATTR_MATCHING_RULES_LC); |
| | | ldapSyntaxesType = getAttributeType(ATTR_LDAP_SYNTAXES_LC); |
| | | ditContentRulesType = getAttributeType(ATTR_DIT_CONTENT_RULES_LC); |
| | | ditStructureRulesType = getAttributeType(ATTR_DIT_STRUCTURE_RULES_LC); |
| | | matchingRuleUsesType = getAttributeType(ATTR_MATCHING_RULE_USE_LC); |
| | | nameFormsType = getAttributeType(ATTR_NAME_FORMS_LC); |
| | | |
| | | // Initialize the lastmod attributes. |
| | | creatorsNameType = getAttributeType(OP_ATTR_CREATORS_NAME_LC); |
| | | createTimestampType = getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC); |
| | | modifiersNameType = getAttributeType(OP_ATTR_MODIFIERS_NAME_LC); |
| | | modifyTimestampType = getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC); |
| | | |
| | | // Construct the set of objectclasses to include in the schema entry. |
| | | schemaObjectClasses = new LinkedHashMap<>(3); |
| | | schemaObjectClasses.put(CoreSchema.getTopObjectClass(), OC_TOP); |
| | |
| | | } |
| | | } |
| | | addAttributeToSchemaEntry( |
| | | Attributes.create(creatorsNameType, creatorsName), userAttrs, operationalAttrs); |
| | | Attributes.create(getCreatorsNameAttributeType(), creatorsName), userAttrs, operationalAttrs); |
| | | addAttributeToSchemaEntry( |
| | | Attributes.create(createTimestampType, createTimestamp), userAttrs, operationalAttrs); |
| | | Attributes.create(getCreateTimestampAttributeType(), createTimestamp), userAttrs, operationalAttrs); |
| | | addAttributeToSchemaEntry( |
| | | Attributes.create(modifiersNameType, modifiersName), userAttrs, operationalAttrs); |
| | | Attributes.create(getModifiersNameAttributeType(), modifiersName), userAttrs, operationalAttrs); |
| | | addAttributeToSchemaEntry( |
| | | Attributes.create(modifyTimestampType, modifyTimestamp), userAttrs, operationalAttrs); |
| | | Attributes.create(getModifyTimestampAttributeType(), modifyTimestamp), userAttrs, operationalAttrs); |
| | | |
| | | // Add the extra attributes. |
| | | for (Attribute attribute : DirectoryServer.getSchema().getExtraAttributes().values()) |
| | |
| | | // Add all of the appropriate matching rule uses to the schema entry. Since |
| | | // there is no hierarchical relationship between matching rule uses, we |
| | | // don't need to worry about ordering. |
| | | addAttribute(schemaEntry, matchingRuleUsesType, getValuesForSchemaFile(schema.getMatchingRuleUses(), schemaFile)); |
| | | values = getValuesForSchemaFile(schema.getMatchingRuleUses(), schemaFile); |
| | | addAttribute(schemaEntry, matchingRuleUsesType, values); |
| | | |
| | | if (FILE_USER_SCHEMA_ELEMENTS.equals(schemaFile)) |
| | | { |
| | |
| | | // loop on the attribute types in the entry just received |
| | | // and add them in the existing schema. |
| | | Set<String> oidList = new HashSet<>(1000); |
| | | for (Attribute a : newSchemaEntry.getAttribute(getAttributeTypesAttributeType())) |
| | | for (Attribute a : newSchemaEntry.getAttribute(attributeTypesType)) |
| | | { |
| | | // Look for attribute types that could have been added to the schema |
| | | // or modified in the schema |
| | |
| | | // loop on the objectClasses from the entry, search if they are |
| | | // already in the current schema, add them if not. |
| | | oidList.clear(); |
| | | for (Attribute a : newSchemaEntry.getAttribute(getObjectClassesAttributeType())) |
| | | for (Attribute a : newSchemaEntry.getAttribute(objectClassesType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | |
| | | userAttrs.put(t, Attributes.createAsList(t, v)); |
| | | |
| | | t = DirectoryServer.getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | AttributeBuilder builder = new AttributeBuilder(t); |
| | | builder.setOption("binary"); |
| | | builder.add(certValue); |
| | |
| | | |
| | | if (scope != SearchScope.BASE_OBJECT && aliases.length != 0) |
| | | { |
| | | AttributeType certAliasType = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType certAliasType = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | for (String alias : aliases) |
| | | { |
| | | DN certDN = makeChildDN(getBaseDN(), certAliasType, alias); |
| | |
| | | DN entryDN = entry.getName(); |
| | | |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | * The standard attribute type that is used to specify the set of referral |
| | | * URLs in a referral entry. |
| | | */ |
| | | private final AttributeType referralType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); |
| | | private final AttributeType referralType = DirectoryServer.getSchema().getAttributeType(ATTR_REFERRAL_URL); |
| | | |
| | | /** |
| | | * A flag that indicates whether there are any referrals contained in this |
| | |
| | | } |
| | | else |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(lowerName); |
| | | if (attrType.isPlaceHolder()) |
| | | { |
| | | throw new StorageRuntimeException(ERR_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index).toString()); |
| | |
| | | private Attribute getSingleAttribute(Entry taskEntry, String attrName, Arg1<Object> noEntryErrorMsg, |
| | | Arg1<Object> multipleEntriesErrorMsg, Arg1<Object> noAttrValueErrorMsg) throws DirectoryException |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | |
| | | String nextTaskIDName = NAME_PREFIX_TASK + "id"; |
| | | nextTaskEntry.replaceAttribute(Attributes.create(nextTaskIDName, nextTaskID)); |
| | | |
| | | RDN nextTaskRDN = new RDN(DirectoryServer.getAttributeType(nextTaskIDName), nextTaskID); |
| | | RDN nextTaskRDN = new RDN(DirectoryServer.getSchema().getAttributeType(nextTaskIDName), nextTaskID); |
| | | DN nextTaskDN = taskScheduler.getTaskBackend().getScheduledTasksParentDN().child(nextTaskRDN); |
| | | nextTaskEntry.setDN(nextTaskDN); |
| | | |
| | |
| | | String messageString = buildLogMessage(severity, message, exception); |
| | | logMessages.add(messageString); |
| | | |
| | | final AttributeType type = DirectoryServer.getAttributeType(ATTR_TASK_LOG_MESSAGES); |
| | | final AttributeType type = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_LOG_MESSAGES); |
| | | final Attribute attr = taskEntry.getExactAttribute(AttributeDescription.create(type)); |
| | | final AttributeBuilder builder = attr != null ? new AttributeBuilder(attr) : new AttributeBuilder(type); |
| | | builder.add(messageString); |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Get the name of the class that implements the task logic. |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_CLASS); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_CLASS); |
| | | List<Attribute> attrList = entry.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | |
| | | { |
| | | // It's possible that this is a monitor attribute rather than a configurable |
| | | // one. Check all of those. |
| | | AttributeType attrType = DirectoryServer.getAttributeType(name); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(name); |
| | | for (MonitorProvider<? extends MonitorProviderCfg> monitor : monitorProviders) |
| | | { |
| | | for (org.opends.server.types.Attribute a : monitor.getMonitorData()) |
| | |
| | | reader.readStartSequence(); |
| | | while(reader.hasNextElement()) { |
| | | String attrStr = reader.readOctetStringAsString(); |
| | | attrs.add(DirectoryServer.getAttributeType(attrStr)); |
| | | attrs.add(DirectoryServer.getSchema().getAttributeType(attrStr)); |
| | | } |
| | | reader.readEndSequence(); |
| | | } |
| | |
| | | { |
| | | if (attributeType == null && rawAttributeType != null) |
| | | { |
| | | attributeType = DirectoryServer.getAttributeType(rawAttributeType); |
| | | attributeType = DirectoryServer.getSchema().getAttributeType(rawAttributeType); |
| | | } |
| | | return attributeType; |
| | | } |
| | |
| | | { |
| | | reader.readStartSequence(); |
| | | String attrName = reader.readOctetStringAsString(); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | if (attrType.isPlaceHolder()) |
| | | { |
| | | //This attribute is not defined in the schema. There is no point |
| | |
| | | List<SortKey> sortKeys = new ArrayList<>(); |
| | | for(String[] decodedKey : decodedKeyList) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(decodedKey[0]); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(decodedKey[0]); |
| | | if (attrType.isPlaceHolder()) |
| | | { |
| | | //This attribute is not defined in the schema. There is no point |
| | |
| | | baseName = toLowerCase(rawAttributeType); |
| | | attributeOptions = null; |
| | | } |
| | | return AttributeDescription.create(DirectoryServer.getAttributeType(baseName), attributeOptions); |
| | | return AttributeDescription.create(DirectoryServer.getSchema().getAttributeType(baseName), attributeOptions); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.server.AlertHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.ConnectionHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.CryptoManagerCfg; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the attribute type for the provided name or OID. It can optionally return a generated |
| | | * placeholder version if the requested attribute type is not defined in the schema. |
| | | * |
| | | * @param nameOrOid |
| | | * The name or OID for the attribute type to retrieve. |
| | | * @return The requested attribute type, or a generated placeholder version if there is no |
| | | * attribute with the specified nameOrOid defined in the server schema |
| | | */ |
| | | public static AttributeType getAttributeType(String nameOrOid) |
| | | { |
| | | return getSchema().getAttributeType(nameOrOid, getSchema().getDefaultSyntax()); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the set of virtual attribute rules registered with the Directory |
| | | * Server. |
| | | * |
| | |
| | | |
| | | private long getGeneralizedTime0(Entry userEntry, String attrName) throws DirectoryException |
| | | { |
| | | return getGeneralizedTime(userEntry, DirectoryServer.getAttributeType(attrName)); |
| | | return getGeneralizedTime(userEntry, DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | |
| | | /** |
| | |
| | | return authFailureTimes; |
| | | } |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | try |
| | | { |
| | | authFailureTimes = getGeneralizedTimes(type); |
| | |
| | | failureTimes.add(highestFailureTime); |
| | | |
| | | // And the attribute in the user entry |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestFailureTime)); |
| | | modifications.add(new Modification(ModificationType.ADD, addAttr, true)); |
| | | |
| | |
| | | return failureLockedTime; |
| | | } |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | try |
| | | { |
| | | failureLockedTime = getGeneralizedTime(userEntry, type); |
| | |
| | | return false; |
| | | } |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED); |
| | | try |
| | | { |
| | | mustChangePassword = getBoolean(userEntry, type); |
| | |
| | | |
| | | private void clearAttribute(String attrName) |
| | | { |
| | | clearAttribute(DirectoryServer.getAttributeType(attrName)); |
| | | clearAttribute(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | |
| | | private void clearAttribute(AttributeType type) |
| | |
| | | } |
| | | |
| | | this.warnedTime = warnedTime; |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME); |
| | | replaceAttribute(Attributes.create(type, GeneralizedTimeSyntax.createGeneralizedTimeValue(currentTime))); |
| | | |
| | | if (logger.isTraceEnabled()) |
| | |
| | | { |
| | | if (graceLoginTimes == null) |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | try |
| | | { |
| | | graceLoginTimes = getGeneralizedTimes(type); |
| | |
| | | long highestGraceTime = computeHighestTime(graceTimes); |
| | | graceTimes.add(highestGraceTime); // graceTimes == this.graceLoginTimes |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestGraceTime)); |
| | | modifications.add(new Modification(ModificationType.ADD, addAttr, true)); |
| | | } |
| | |
| | | private TreeMap<Long,ByteString> getSortedHistoryValues(List<Attribute> removeAttrs) |
| | | { |
| | | TreeMap<Long, ByteString> historyMap = new TreeMap<>(); |
| | | AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | for (Attribute a : userEntry.getAttribute(historyType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | // If there is a maximum number of values to retain and we would be over the limit with the new value, |
| | | // then get rid of enough values (oldest first) to satisfy the count. |
| | | AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | int historyCount = passwordPolicy.getPasswordHistoryCount(); |
| | | if (historyCount > 0 && historyMap.size() >= historyCount) |
| | | { |
| | |
| | | public String[] getPasswordHistoryValues() |
| | | { |
| | | ArrayList<String> historyValues = new ArrayList<>(); |
| | | AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | for (Attribute a : userEntry.getAttribute(historyType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | String value = getAttrValue(entry, PWD_ATTR_ATTRIBUTE); |
| | | if (value != null && value.length() > 0) |
| | | { |
| | | this.pPasswordAttribute = DirectoryServer.getAttributeType(value); |
| | | this.pPasswordAttribute = DirectoryServer.getSchema().getAttributeType(value); |
| | | if (this.pPasswordAttribute.isPlaceHolder()) |
| | | { |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | |
| | | objectClasses.containsKey(pwdValidatorPolicyOC)) |
| | | { |
| | | AttributeType pwdAttrType = |
| | | DirectoryServer.getAttributeType(PWD_ATTR_VALIDATOR); |
| | | DirectoryServer.getSchema().getAttributeType(PWD_ATTR_VALIDATOR); |
| | | for (Attribute attr : entry.getAttribute(pwdAttrType)) |
| | | { |
| | | for (ByteString val : attr) |
| | |
| | | */ |
| | | private String getAttrValue(Entry entry, String pwdAttrName) |
| | | { |
| | | AttributeType pwdAttrType = DirectoryServer.getAttributeType(pwdAttrName); |
| | | AttributeType pwdAttrType = DirectoryServer.getSchema().getAttributeType(pwdAttrName); |
| | | for (Attribute attr : entry.getAttribute(pwdAttrType)) |
| | | { |
| | | for (ByteString value : attr) |
| | |
| | | this.serverContext = serverContext; |
| | | if (!schemaInitDone) { |
| | | // Initialize various schema references. |
| | | attrKeyID = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | attrPublicKeyCertificate = DirectoryServer.getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrTransformation = DirectoryServer.getAttributeType(ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME); |
| | | attrMacAlgorithm = DirectoryServer.getAttributeType(ATTR_CRYPTO_MAC_ALGORITHM_NAME); |
| | | attrSymmetricKey = DirectoryServer.getAttributeType(ATTR_CRYPTO_SYMMETRIC_KEY); |
| | | attrInitVectorLength = DirectoryServer.getAttributeType(ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS); |
| | | attrKeyLength = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_LENGTH_BITS); |
| | | attrCompromisedTime = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | attrKeyID = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | attrPublicKeyCertificate = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrTransformation = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME); |
| | | attrMacAlgorithm = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_MAC_ALGORITHM_NAME); |
| | | attrSymmetricKey = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_SYMMETRIC_KEY); |
| | | attrInitVectorLength = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS); |
| | | attrKeyLength = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_LENGTH_BITS); |
| | | attrCompromisedTime = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | // TODO: ConfigConstants |
| | | ocCertRequest = DirectoryServer.getSchema().getObjectClass("ds-cfg-self-signed-cert-request"); |
| | | ocInstanceKey = DirectoryServer.getSchema().getObjectClass(OC_CRYPTO_INSTANCE_KEY); |
| | |
| | | ocCipherKey = DirectoryServer.getSchema().getObjectClass(OC_CRYPTO_CIPHER_KEY); |
| | | ocMacKey = DirectoryServer.getSchema().getObjectClass(OC_CRYPTO_MAC_KEY); |
| | | |
| | | attrCert = getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrAlias = getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | attrCompromisedTime = getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | attrCert = getSchema().getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrAlias = getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | attrCompromisedTime = getSchema().getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | |
| | | if (DirectoryServer.getBackendWithBaseDN(adminSuffixDN) != null) |
| | | { |
| | |
| | | // 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<>(); |
| | | AttributeType memberURLType = DirectoryServer.getAttributeType(ATTR_MEMBER_URL_LC); |
| | | AttributeType memberURLType = DirectoryServer.getSchema().getAttributeType(ATTR_MEMBER_URL_LC); |
| | | for (Attribute a : groupEntry.getAttribute(memberURLType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | certificateAttributeType = configuration.getCertificateAttribute(); |
| | | if (certificateAttributeType == null) |
| | | { |
| | | certificateAttributeType = |
| | | DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | certificateAttributeType = DirectoryServer.getSchema().getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | } |
| | | |
| | | |
| | |
| | | AttributeType newCertificateType = configuration.getCertificateAttribute(); |
| | | if (newCertificateType == null) |
| | | { |
| | | newCertificateType = |
| | | DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | newCertificateType = DirectoryServer.getSchema().getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.meta.LDAPPassThroughAuthenticationPolicyCfgDefn.MappingPolicy; |
| | | import org.forgerock.opendj.server.config.server.LDAPPassThroughAuthenticationPolicyCfg; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | |
| | | |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.ldap.LDAPConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | |
| | | { |
| | | super(userEntry); |
| | | |
| | | this.cachedPasswordAttribute = DirectoryServer.getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD); |
| | | this.cachedPasswordTimeAttribute = DirectoryServer.getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME); |
| | | this.cachedPasswordAttribute = getSchema().getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD); |
| | | this.cachedPasswordTimeAttribute = getSchema().getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME); |
| | | } |
| | | |
| | | @Override |
| | |
| | | else if (lowerTokenStr.startsWith("notification-user-attr:")) |
| | | { |
| | | String attrName = lowerTokenStr.substring(23); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | if (attrType.isPlaceHolder()) |
| | | { |
| | | throw new ConfigException( |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.util.Reject; |
| | | import org.forgerock.opendj.server.config.server.GroupImplementationCfg; |
| | | import org.forgerock.opendj.server.config.server.StaticGroupImplementationCfg; |
| | | import org.forgerock.util.Reject; |
| | | import org.opends.server.api.Group; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.SearchFilter; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.messages.ExtensionMessages.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message); |
| | | } |
| | | |
| | | someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_MEMBER); |
| | | someMemberAttributeType = getMemberAttributeType(); |
| | | } |
| | | else if (hasGroupOfNamesClass) |
| | | { |
| | |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message); |
| | | } |
| | | |
| | | someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_MEMBER); |
| | | someMemberAttributeType = getMemberAttributeType(); |
| | | } |
| | | else if (hasGroupOfUniqueNamesClass) |
| | | { |
| | | someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_UNIQUE_MEMBER_LC); |
| | | someMemberAttributeType = getUniqueMemberAttributeType(); |
| | | } |
| | | else |
| | | { |
| | |
| | | return null; |
| | | } |
| | | |
| | | AttributeType userAttrType = DirectoryServer.getAttributeType(userAttrName); |
| | | AttributeType userAttrType = DirectoryServer.getSchema().getAttributeType(userAttrName); |
| | | if (userAttrType.isPlaceHolder()) |
| | | { |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | |
| | | private static String normalizeAttributeName(String attrName) |
| | | { |
| | | return toLowerCase(DirectoryServer.getAttributeType(attrName).getNameOrOID()); |
| | | return toLowerCase(DirectoryServer.getSchema().getAttributeType(attrName).getNameOrOID()); |
| | | } |
| | | } |
| | |
| | | |
| | | // Get the target group DN attribute from the entry, if there is one. |
| | | DN targetDN = null; |
| | | AttributeType targetType = DirectoryServer.getAttributeType(ATTR_TARGET_GROUP_DN); |
| | | AttributeType targetType = DirectoryServer.getSchema().getAttributeType(ATTR_TARGET_GROUP_DN); |
| | | for (Attribute a : groupEntry.getAttribute(targetType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | ? toAttr |
| | | : toAttr.substring(semicolonPos + 1); |
| | | |
| | | if (DirectoryServer.getAttributeType(toAttrType).isPlaceHolder()) |
| | | if (DirectoryServer.getSchema().getAttributeType(toAttrType).isPlaceHolder()) |
| | | { |
| | | messages.add(ERR_PLUGIN_ATTR_CLEANUP_ATTRIBUTE_MISSING.get(toAttr)); |
| | | isValid = false; |
| | |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.messages.PluginMessages.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.UUID; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.PluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.EntryUUIDPluginCfg; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.Entry; |
| | |
| | | extends DirectoryServerPlugin<EntryUUIDPluginCfg> |
| | | implements ConfigurationChangeListener<EntryUUIDPluginCfg> |
| | | { |
| | | /** The name of the entryUUID attribute type. */ |
| | | private static final String ENTRYUUID = "entryuuid"; |
| | | |
| | | /** The attribute type for the "entryUUID" attribute. */ |
| | | private final AttributeType entryUUIDType; |
| | | private static final AttributeType entryUUIDType = getEntryUUIDAttributeType(); |
| | | /** The current configuration for this plugin. */ |
| | | private EntryUUIDPluginCfg currentConfig; |
| | | |
| | | /** Mandatory default constructor of this Directory Server plugin. */ |
| | | public EntryUUIDPlugin() |
| | | { |
| | | entryUUIDType = DirectoryServer.getAttributeType(ENTRYUUID); |
| | | super(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | // Construct a new UUID. In order to make sure that UUIDs are consistent |
| | | // when the same LDIF is generated on multiple servers, we'll base the UUID |
| | | // on the byte representation of the normalized DN. |
| | | UUID uuid = entry.getName().toUUID(); |
| | | uuidList = Attributes.createAsList(entryUUIDType, uuid.toString()); |
| | | entry.putAttribute(entryUUIDType, uuidList); |
| | | entry.putAttribute(entryUUIDType, toAttributeList(entry.getName().toUUID())); |
| | | |
| | | // We shouldn't ever need to return a non-success result. |
| | | return PluginResult.ImportLDIF.continueEntryProcessing(); |
| | |
| | | // See if the entry being added already contains an entryUUID attribute. |
| | | // It shouldn't, since it's NO-USER-MODIFICATION, but if it does then leave |
| | | // it alone. |
| | | Map<AttributeType,List<Attribute>> operationalAttributes = |
| | | addOperation.getOperationalAttributes(); |
| | | List<Attribute> uuidList = operationalAttributes.get(entryUUIDType); |
| | | List<Attribute> uuidList = addOperation.getOperationalAttributes().get(entryUUIDType); |
| | | if (uuidList != null) |
| | | { |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | // Construct a new random UUID. |
| | | UUID uuid = UUID.randomUUID(); |
| | | uuidList = Attributes.createAsList(entryUUIDType, uuid.toString()); |
| | | |
| | | // Add the attribute to the entry and return. |
| | | addOperation.setAttribute(entryUUIDType, uuidList); |
| | | addOperation.setAttribute(entryUUIDType, toAttributeList(UUID.randomUUID())); |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | private List<Attribute> toAttributeList(UUID uuid) |
| | | { |
| | | return Attributes.createAsList(entryUUIDType, uuid.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isConfigurationAcceptable(PluginCfg configuration, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.messages.PluginMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.TimeThread.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.meta.PluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.LastModPluginCfg; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | |
| | | import org.opends.server.types.operation.PreOperationModifyDNOperation; |
| | | import org.opends.server.types.operation.PreOperationModifyOperation; |
| | | |
| | | import static org.opends.messages.PluginMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.util.TimeThread.*; |
| | | |
| | | /** |
| | | * This class implements a Directory Server plugin that will add the |
| | | * creatorsName and createTimestamp attributes to an entry whenever it is added |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The attribute type for the "createTimestamp" attribute. */ |
| | | private final AttributeType createTimestampType; |
| | | /** The attribute type for the "creatorsName" attribute. */ |
| | | private final AttributeType creatorsNameType; |
| | | /** The attribute type for the "modifiersName" attribute. */ |
| | | private final AttributeType modifiersNameType; |
| | | /** The attribute type for the "modifyTimestamp" attribute. */ |
| | | private final AttributeType modifyTimestampType; |
| | | /** The current configuration for this plugin. */ |
| | | private LastModPluginCfg currentConfig; |
| | | |
| | |
| | | public LastModPlugin() |
| | | { |
| | | super(); |
| | | |
| | | |
| | | // Get the attribute types for the attributes that we will use. This needs |
| | | // to be done in the constructor in order to make the associated variables "final". |
| | | createTimestampType = DirectoryServer.getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC); |
| | | creatorsNameType = DirectoryServer.getAttributeType(OP_ATTR_CREATORS_NAME_LC); |
| | | modifiersNameType = DirectoryServer.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC); |
| | | modifyTimestampType = DirectoryServer.getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC); |
| | | } |
| | | |
| | | |
| | |
| | | doPreOperation(PreOperationAddOperation addOperation) |
| | | { |
| | | // Create the attribute list for the creatorsName attribute, if appropriate. |
| | | AttributeBuilder builder = new AttributeBuilder(creatorsNameType); |
| | | AttributeBuilder builder = new AttributeBuilder(getCreatorsNameAttributeType()); |
| | | DN creatorDN = addOperation.getAuthorizationDN(); |
| | | if (creatorDN == null) |
| | | { |
| | |
| | | { |
| | | builder.add(creatorDN.toString()); |
| | | } |
| | | addOperation.setAttribute(creatorsNameType, builder.toAttributeList()); |
| | | addOperation.setAttribute(getCreatorsNameAttributeType(), builder.toAttributeList()); |
| | | |
| | | |
| | | // Create the attribute list for the createTimestamp attribute. |
| | | List<Attribute> timeList = Attributes.createAsList( |
| | | createTimestampType, OP_ATTR_CREATE_TIMESTAMP, getGMTTime()); |
| | | addOperation.setAttribute(createTimestampType, timeList); |
| | | getCreateTimestampAttributeType(), OP_ATTR_CREATE_TIMESTAMP, getGMTTime()); |
| | | addOperation.setAttribute(getCreateTimestampAttributeType(), timeList); |
| | | |
| | | // We shouldn't ever need to return a non-success result. |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | |
| | | doPreOperation(PreOperationModifyOperation modifyOperation) |
| | | { |
| | | // Create the modifiersName attribute. |
| | | AttributeBuilder builder = new AttributeBuilder(modifiersNameType); |
| | | AttributeBuilder builder = new AttributeBuilder(getModifiersNameAttributeType()); |
| | | DN modifierDN = modifyOperation.getAuthorizationDN(); |
| | | if (modifierDN == null) |
| | | { |
| | |
| | | |
| | | |
| | | // Create the modifyTimestamp attribute. |
| | | Attribute timeAttr = Attributes.create(modifyTimestampType, |
| | | Attribute timeAttr = Attributes.create(getModifyTimestampAttributeType(), |
| | | OP_ATTR_MODIFY_TIMESTAMP, getGMTTime()); |
| | | try |
| | | { |
| | |
| | | doPreOperation(PreOperationModifyDNOperation modifyDNOperation) |
| | | { |
| | | // Create the modifiersName attribute. |
| | | AttributeBuilder builder = new AttributeBuilder(modifiersNameType); |
| | | AttributeBuilder builder = new AttributeBuilder(getModifiersNameAttributeType()); |
| | | DN modifierDN = modifyDNOperation.getAuthorizationDN(); |
| | | if (modifierDN == null) |
| | | { |
| | |
| | | |
| | | |
| | | // Create the modifyTimestamp attribute. |
| | | Attribute timeAttr = Attributes.create(modifyTimestampType, |
| | | Attribute timeAttr = Attributes.create(getModifyTimestampAttributeType(), |
| | | OP_ATTR_MODIFY_TIMESTAMP, getGMTTime()); |
| | | modifyDNOperation.addModification(new Modification( |
| | | ModificationType.REPLACE, timeAttr, true)); |
| | |
| | | { |
| | | configuration.addPasswordPolicyImportChangeListener(this); |
| | | |
| | | customPolicyAttribute = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | customPolicyAttribute = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | |
| | | // Make sure that the plugin has been enabled for the appropriate types. |
| | | for (PluginType t : pluginTypes) |
| | |
| | | String attr = attrFilt.substring(0, sepInd); |
| | | String filtStr = attrFilt.substring(sepInd + 1); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attr); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attr); |
| | | try |
| | | { |
| | | newAttrFiltMap.put(attrType, SearchFilter.createFilterFromString(filtStr)); |
| | |
| | | * type has to be present in the attributeType list. |
| | | */ |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attr); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attr); |
| | | if (attrType.isPlaceHolder() || !theAttributeTypes.contains(attrType)) |
| | | { |
| | | isAcceptable = false; |
| | |
| | | put(userAttrs, ATTR_SN, commonName); |
| | | put(userAttrs, ATTR_ROOTDN_ALTERNATE_BIND_DN, shortDNString); |
| | | |
| | | AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeType privType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeBuilder builder = new AttributeBuilder(privType); |
| | | for (Privilege p : Privilege.getDefaultRootPrivileges()) |
| | | { |
| | |
| | | private void put(Map<AttributeType, List<Attribute>> Attrs, String attrName, String value) |
| | | { |
| | | List<Attribute> attrs = newLinkedList(Attributes.create(attrName, value)); |
| | | Attrs.put(DirectoryServer.getAttributeType(attrName), attrs); |
| | | Attrs.put(DirectoryServer.getSchema().getAttributeType(attrName), attrs); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.replication.plugin.HistAttrModificationKey.*; |
| | | |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.operation.PreOperationAddOperation; |
| | |
| | | */ |
| | | public static void setHistoricalAttrToOperation(PreOperationAddOperation addOperation) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | String attrValue = encodeHistorical(OperationContext.getCSN(addOperation), "add"); |
| | | List<Attribute> attrs = Attributes.createAsList(attrType, attrValue); |
| | | addOperation.setAttribute(attrType, attrs); |
| | |
| | | */ |
| | | public static String getEntryUUID(Entry entry) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = entry.getOperationalAttribute(attrType); |
| | | List<Attribute> uuidAttrs = entry.getOperationalAttribute(getEntryUUIDAttributeType()); |
| | | return extractEntryUUID(uuidAttrs, entry.getName()); |
| | | } |
| | | |
| | |
| | | */ |
| | | public static String getEntryUUID(PreOperationAddOperation op) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = op.getOperationalAttributes().get(attrType); |
| | | List<Attribute> uuidAttrs = op.getOperationalAttributes().get(getEntryUUIDAttributeType()); |
| | | return extractEntryUUID(uuidAttrs, op.getEntryDN()); |
| | | } |
| | | |
| | |
| | | |
| | | private Attribute getAttribute(String attributeName, Entry entry) |
| | | { |
| | | List<Attribute> attrs = entry.getAttribute(DirectoryServer.getAttributeType(attributeName)); |
| | | List<Attribute> attrs = entry.getAttribute(DirectoryServer.getSchema().getAttributeType(attributeName)); |
| | | return !attrs.isEmpty() ? attrs.get(0) : null; |
| | | } |
| | | |
| | |
| | | final SearchResultEntry resultEntry = getFirstResult(searchOperation); |
| | | if (resultEntry != null) |
| | | { |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | |
| | | |
| | | private Iterator<ByteString> getAttributeValueIterator(SearchResultEntry resultEntry, String attrName) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> exclAttrs = resultEntry.getAttribute(attrType); |
| | | if (!exclAttrs.isEmpty()) |
| | | { |
| | |
| | | Set<AttributeType> results = new HashSet<>(); |
| | | for (String attrName : fractionalConcernedAttributes) |
| | | { |
| | | results.add(DirectoryServer.getAttributeType(attrName)); |
| | | results.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | return results; |
| | | } |
| | |
| | | SearchResultEntry resultEntry = result.get(0); |
| | | if (resultEntry != null) |
| | | { |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | List<Attribute> attrs = resultEntry.getAttribute(REPLICATION_GENERATION_ID); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | | Attribute attr = attrs.get(0); |
| | |
| | | Set<AttributeType> includeAttributes = new HashSet<>(); |
| | | for (String attrName : includeAttributeStrings) |
| | | { |
| | | includeAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | includeAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | exportConfig.setIncludeAttributes(includeAttributes); |
| | | } |
| | |
| | | */ |
| | | private void updateStateFromEntry(SearchResultEntry resultEntry) |
| | | { |
| | | AttributeType synchronizationStateType = DirectoryServer.getAttributeType(REPLICATION_STATE); |
| | | AttributeType synchronizationStateType = DirectoryServer.getSchema().getAttributeType(REPLICATION_STATE); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationStateType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | |
| | | */ |
| | | private final void checkAndUpdateServerState() |
| | | { |
| | | final AttributeType histType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | final AttributeType histType = DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | // Retrieves the entries that have changed since the |
| | | // maxCsn stored in the serverState |
| | |
| | | // create a rule and register it into the DirectoryServer |
| | | provider.initializeVirtualAttributeProvider(null); |
| | | |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | return new VirtualAttributeRule(attributeType, provider, |
| | | baseDNs, SearchScope.BASE_OBJECT, |
| | | groupDNs, filters, conflictBehavior); |
| | |
| | | |
| | | // Get the attribute that specifies which schema file(s) to add. |
| | | Entry taskEntry = getTaskEntry(); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeBackupAll = getAttributeType(ATTR_TASK_BACKUP_ALL); |
| | | AttributeType typeCompress = getAttributeType(ATTR_TASK_BACKUP_COMPRESS); |
| | | AttributeType typeEncrypt = getAttributeType(ATTR_TASK_BACKUP_ENCRYPT); |
| | | AttributeType typeHash = getAttributeType(ATTR_TASK_BACKUP_HASH); |
| | | AttributeType typeIncremental = getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL); |
| | | AttributeType typeSignHash = getAttributeType(ATTR_TASK_BACKUP_SIGN_HASH); |
| | | AttributeType typeBackendID = getAttributeType(ATTR_TASK_BACKUP_BACKEND_ID); |
| | | AttributeType typeBackupID = getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typeIncrementalBaseID = getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID); |
| | | AttributeType typeBackupAll = getSchema().getAttributeType(ATTR_TASK_BACKUP_ALL); |
| | | AttributeType typeCompress = getSchema().getAttributeType(ATTR_TASK_BACKUP_COMPRESS); |
| | | AttributeType typeEncrypt = getSchema().getAttributeType(ATTR_TASK_BACKUP_ENCRYPT); |
| | | AttributeType typeHash = getSchema().getAttributeType(ATTR_TASK_BACKUP_HASH); |
| | | AttributeType typeIncremental = getSchema().getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL); |
| | | AttributeType typeSignHash = getSchema().getAttributeType(ATTR_TASK_BACKUP_SIGN_HASH); |
| | | AttributeType typeBackendID = getSchema().getAttributeType(ATTR_TASK_BACKUP_BACKEND_ID); |
| | | AttributeType typeBackupID = getSchema().getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType typeBackupDirectory = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typeIncrementalBaseID = getSchema().getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID); |
| | | |
| | | backUpAll = TaskUtils.getBoolean(taskEntry.getAttribute(typeBackupAll), false); |
| | | compress = TaskUtils.getBoolean(taskEntry.getAttribute(typeCompress), false); |
| | |
| | | |
| | | private long getConnectionID(Entry taskEntry) throws DirectoryException |
| | | { |
| | | final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID); |
| | | final AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | private boolean mustNotifyClient(Entry taskEntry) throws DirectoryException |
| | | { |
| | | final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT); |
| | | final AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | private LocalizableMessage getDisconnectMessage(Entry taskEntry) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | } |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | AttributeType typeWrapColumn = getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN); |
| | | AttributeType typeWrapColumn = getSchema().getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN); |
| | | |
| | | ldifFile = toString(taskEntry, ATTR_TASK_EXPORT_LDIF_FILE); |
| | | File f = new File (ldifFile); |
| | |
| | | |
| | | private boolean toBoolean(Entry entry, boolean defaultValue, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | return TaskUtils.getBoolean(attrs, defaultValue); |
| | | } |
| | | |
| | | private ArrayList<String> toListOfString(Entry entry, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | return TaskUtils.getMultiValueString(attrs); |
| | | } |
| | | |
| | | private String toString(Entry entry, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | return TaskUtils.getSingleValueString(attrs); |
| | | } |
| | |
| | | HashSet<AttributeType> attributes = new HashSet<>(); |
| | | for (String attrName : attributeStrings) |
| | | { |
| | | attributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | attributes.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | return attributes; |
| | | } |
| | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeLdifFile = getAttributeType(ATTR_IMPORT_LDIF_FILE); |
| | | AttributeType typeTemplateFile = getAttributeType(ATTR_IMPORT_TEMPLATE_FILE); |
| | | AttributeType typeBackendID = getAttributeType(ATTR_IMPORT_BACKEND_ID); |
| | | AttributeType typeIncludeBranch = getAttributeType(ATTR_IMPORT_INCLUDE_BRANCH); |
| | | AttributeType typeExcludeBranch = getAttributeType(ATTR_IMPORT_EXCLUDE_BRANCH); |
| | | AttributeType typeIncludeAttribute = getAttributeType(ATTR_IMPORT_INCLUDE_ATTRIBUTE); |
| | | AttributeType typeExcludeAttribute = getAttributeType(ATTR_IMPORT_EXCLUDE_ATTRIBUTE); |
| | | AttributeType typeIncludeFilter = getAttributeType(ATTR_IMPORT_INCLUDE_FILTER); |
| | | AttributeType typeExcludeFilter = getAttributeType(ATTR_IMPORT_EXCLUDE_FILTER); |
| | | AttributeType typeRejectFile = getAttributeType(ATTR_IMPORT_REJECT_FILE); |
| | | AttributeType typeSkipFile = getAttributeType(ATTR_IMPORT_SKIP_FILE); |
| | | AttributeType typeOverwrite = getAttributeType(ATTR_IMPORT_OVERWRITE); |
| | | AttributeType typeSkipSchemaValidation = getAttributeType(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION); |
| | | AttributeType typeIsCompressed = getAttributeType(ATTR_IMPORT_IS_COMPRESSED); |
| | | AttributeType typeIsEncrypted = getAttributeType(ATTR_IMPORT_IS_ENCRYPTED); |
| | | AttributeType typeClearBackend = getAttributeType(ATTR_IMPORT_CLEAR_BACKEND); |
| | | AttributeType typeRandomSeed = getAttributeType(ATTR_IMPORT_RANDOM_SEED); |
| | | AttributeType typeThreadCount = getAttributeType(ATTR_IMPORT_THREAD_COUNT); |
| | | AttributeType typeOffHeapSize = getAttributeType(ATTR_IMPORT_OFFHEAP_SIZE); |
| | | AttributeType typeTmpDirectory = getAttributeType(ATTR_IMPORT_TMP_DIRECTORY); |
| | | AttributeType typeDNCheckPhase2 = getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION); |
| | | AttributeType typeLdifFile = getSchema().getAttributeType(ATTR_IMPORT_LDIF_FILE); |
| | | AttributeType typeTemplateFile = getSchema().getAttributeType(ATTR_IMPORT_TEMPLATE_FILE); |
| | | AttributeType typeBackendID = getSchema().getAttributeType(ATTR_IMPORT_BACKEND_ID); |
| | | AttributeType typeIncludeBranch = getSchema().getAttributeType(ATTR_IMPORT_INCLUDE_BRANCH); |
| | | AttributeType typeExcludeBranch = getSchema().getAttributeType(ATTR_IMPORT_EXCLUDE_BRANCH); |
| | | AttributeType typeIncludeAttribute = getSchema().getAttributeType(ATTR_IMPORT_INCLUDE_ATTRIBUTE); |
| | | AttributeType typeExcludeAttribute = getSchema().getAttributeType(ATTR_IMPORT_EXCLUDE_ATTRIBUTE); |
| | | AttributeType typeIncludeFilter = getSchema().getAttributeType(ATTR_IMPORT_INCLUDE_FILTER); |
| | | AttributeType typeExcludeFilter = getSchema().getAttributeType(ATTR_IMPORT_EXCLUDE_FILTER); |
| | | AttributeType typeRejectFile = getSchema().getAttributeType(ATTR_IMPORT_REJECT_FILE); |
| | | AttributeType typeSkipFile = getSchema().getAttributeType(ATTR_IMPORT_SKIP_FILE); |
| | | AttributeType typeOverwrite = getSchema().getAttributeType(ATTR_IMPORT_OVERWRITE); |
| | | AttributeType typeSkipSchemaValidation = getSchema().getAttributeType(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION); |
| | | AttributeType typeIsCompressed = getSchema().getAttributeType(ATTR_IMPORT_IS_COMPRESSED); |
| | | AttributeType typeIsEncrypted = getSchema().getAttributeType(ATTR_IMPORT_IS_ENCRYPTED); |
| | | AttributeType typeClearBackend = getSchema().getAttributeType(ATTR_IMPORT_CLEAR_BACKEND); |
| | | AttributeType typeRandomSeed = getSchema().getAttributeType(ATTR_IMPORT_RANDOM_SEED); |
| | | AttributeType typeThreadCount = getSchema().getAttributeType(ATTR_IMPORT_THREAD_COUNT); |
| | | AttributeType typeOffHeapSize = getSchema().getAttributeType(ATTR_IMPORT_OFFHEAP_SIZE); |
| | | AttributeType typeTmpDirectory = getSchema().getAttributeType(ATTR_IMPORT_TMP_DIRECTORY); |
| | | AttributeType typeDNCheckPhase2 = getSchema().getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION); |
| | | |
| | | ArrayList<String> ldifFilestmp = asListOfStrings(taskEntry, typeLdifFile); |
| | | ldifFiles = new ArrayList<>(ldifFilestmp.size()); |
| | |
| | | final HashSet<AttributeType> attrTypes = new HashSet<>(attrNames.size()); |
| | | for (String attrName : attrNames) |
| | | { |
| | | attrTypes.add(DirectoryServer.getAttributeType(attrName)); |
| | | attrTypes.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | return attrTypes; |
| | | } |
| | |
| | | // FIXME -- Do we need any special authorization here? |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN); |
| | | AttributeType typeScope = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE); |
| | | AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN); |
| | | AttributeType typeScope = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE); |
| | | |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | |
| | | // FIXME -- Do we need any special authorization here? |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_INITIALIZE_DOMAIN_DN); |
| | | AttributeType typeSourceScope = getAttributeType(ATTR_TASK_INITIALIZE_SOURCE); |
| | | AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_DOMAIN_DN); |
| | | AttributeType typeSourceScope = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_SOURCE); |
| | | |
| | | List<Attribute> attrList; |
| | | attrList = taskEntry.getAttribute(typeDomainBase); |
| | |
| | | // FIXME -- Do we need any special authorization here? |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN); |
| | | AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, mb.toMessage()); |
| | | } |
| | | |
| | | AttributeType typeMaxDuration = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION); |
| | | AttributeType typeMaxDuration = getSchema().getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION); |
| | | attrList = taskEntry.getAttribute(typeMaxDuration); |
| | | String maxDurationStringInSec = TaskUtils.getSingleValueString(attrList); |
| | | |
| | |
| | | final String val = asString(taskEntry, ATTR_REBUILD_INDEX_CLEARDEGRADEDSTATE); |
| | | isClearDegradedState = Boolean.parseBoolean(val); |
| | | |
| | | AttributeType typeIndex = getAttributeType(ATTR_REBUILD_INDEX); |
| | | AttributeType typeIndex = getSchema().getAttributeType(ATTR_REBUILD_INDEX); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeIndex); |
| | | indexes = TaskUtils.getMultiValueString(attrList); |
| | | |
| | |
| | | |
| | | private String asString(Entry taskEntry, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | return TaskUtils.getSingleValueString(attrList); |
| | | } |
| | |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_BASE_DN; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_CSN; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_TO; |
| | | import static org.opends.server.core.DirectoryServer.getAttributeType; |
| | | import static org.opends.server.core.DirectoryServer.getSchema; |
| | | import static org.opends.messages.TaskMessages.*; |
| | | |
| | | /** |
| | |
| | | |
| | | private List<Attribute> getTaskParameter(Entry taskEntry, String attrTaskResetChangeNumberTo) |
| | | { |
| | | AttributeType taskAttr = getAttributeType(attrTaskResetChangeNumberTo); |
| | | AttributeType taskAttr = getSchema().getAttributeType(attrTaskResetChangeNumberTo); |
| | | return taskEntry.getAttribute(taskAttr); |
| | | } |
| | | |
| | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typebackupID = getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType typeVerifyOnly = getAttributeType(ATTR_TASK_RESTORE_VERIFY_ONLY); |
| | | AttributeType typeBackupDirectory = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typebackupID = getSchema().getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType typeVerifyOnly = getSchema().getAttributeType(ATTR_TASK_RESTORE_VERIFY_ONLY); |
| | | |
| | | List<Attribute> attrList; |
| | | |
| | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | // Retrieves the eventual generation-ID |
| | | AttributeType typeNewValue = getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE); |
| | | AttributeType typeNewValue = getSchema().getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeNewValue); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | |
| | | } |
| | | |
| | | // Retrieves the replication domain |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN); |
| | | AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN); |
| | | attrList = taskEntry.getAttribute(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | |
| | | restart = false; |
| | | shutdownMessage = INFO_TASK_SHUTDOWN_DEFAULT_MESSAGE.get(taskEntry.getName()); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_SHUTDOWN_MESSAGE); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_SHUTDOWN_MESSAGE); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | attrType = DirectoryServer.getAttributeType(ATTR_RESTART_SERVER); |
| | | attrType = DirectoryServer.getSchema().getAttributeType(ATTR_RESTART_SERVER); |
| | | attrList = taskEntry.getAttribute(attrType); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | |
| | | Set<AttributeType> results = new HashSet<>(); |
| | | for (String attrName : attributeArg.getValues()) |
| | | { |
| | | results.add(DirectoryServer.getAttributeType(attrName)); |
| | | results.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | return results; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | excludeAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | excludeAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | includeAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | includeAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | } |
| | | } |
| | | } |
| | |
| | | LinkedHashSet<AttributeType> operationalAttributeTypes = new LinkedHashSet<>(); |
| | | for (String attributeName : attributeNames) |
| | | { |
| | | AttributeType t = DirectoryServer.getAttributeType(attributeName); |
| | | AttributeType t = DirectoryServer.getSchema().getAttributeType(attributeName); |
| | | if (t.isOperational()) |
| | | { |
| | | operationalAttributeTypes.add(t); |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]); |
| | | if (! branch.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]); |
| | | if (! template.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType(arguments[0]); |
| | | AttributeType t = DirectoryServer.getSchema().getAttributeType(arguments[0]); |
| | | if (! branch.hasAttribute(t)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]); |
| | | if (! template.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType(arguments[0]); |
| | | AttributeType t = DirectoryServer.getSchema().getAttributeType(arguments[0]); |
| | | if (! branch.hasAttribute(t)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]); |
| | | if (! template.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | StringTokenizer tokenizer = new StringTokenizer(rdnAttrNames, "+"); |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | | attrList.add(DirectoryServer.getAttributeType(tokenizer.nextToken())); |
| | | attrList.add(DirectoryServer.getSchema().getAttributeType(tokenizer.nextToken())); |
| | | } |
| | | |
| | | rdnAttributes = new AttributeType[attrList.size()]; |
| | |
| | | } |
| | | } |
| | | |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(lowerLine.substring(0, colonPos)); |
| | | AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(lowerLine.substring(0, colonPos)); |
| | | |
| | | // First, check whether the value is an URL value: <attrName>:< <url> |
| | | int length = line.length(); |
| | |
| | | */ |
| | | public static Attribute create(String attributeName, String valueString) |
| | | { |
| | | return create(getAttributeType(attributeName), attributeName, valueString); |
| | | return create(getSchema().getAttributeType(attributeName), attributeName, valueString); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static Attribute empty(String attributeName) |
| | | { |
| | | return empty(getAttributeType(attributeName), attributeName); |
| | | return empty(getSchema().getAttributeType(attributeName), attributeName); |
| | | } |
| | | |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrTypeName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrTypeName); |
| | | if (attrType.isPlaceHolder()) |
| | | { |
| | | // This should not happen |
| | |
| | | */ |
| | | public Set<String> getReferralURLs() |
| | | { |
| | | AttributeType referralType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); |
| | | AttributeType referralType = DirectoryServer.getSchema().getAttributeType(ATTR_REFERRAL_URL); |
| | | if (referralType.isPlaceHolder()) |
| | | { |
| | | // This should not happen -- The server doesn't have a ref attribute type defined. |
| | |
| | | */ |
| | | public DN getAliasedDN() throws DirectoryException |
| | | { |
| | | AttributeType aliasType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); |
| | | AttributeType aliasType = DirectoryServer.getSchema().getAttributeType(ATTR_REFERRAL_URL); |
| | | if (aliasType.isPlaceHolder()) |
| | | { |
| | | // This should not happen -- The server doesn't have an aliasedObjectName attribute type defined. |
| | |
| | | } |
| | | |
| | | // Get collective attribute exclusions. |
| | | AttributeType exclusionsType = DirectoryServer.getAttributeType(ATTR_COLLECTIVE_EXCLUSIONS_LC); |
| | | AttributeType exclusionsType = DirectoryServer.getSchema().getAttributeType(ATTR_COLLECTIVE_EXCLUSIONS_LC); |
| | | List<Attribute> exclusionsAttrList = operationalAttributes.get(exclusionsType); |
| | | List<String> excludedAttrNames = new ArrayList<>(); |
| | | if (exclusionsAttrList != null && !exclusionsAttrList.isEmpty()) |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.ConflictingSchemaElementException; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.DITContentRule; |
| | | import org.forgerock.opendj.ldap.schema.DITStructureRule; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the default syntax that should be used for attributes that are not defined in the |
| | | * server schema. |
| | | * |
| | | * @return The default syntax that should be used for attributes that are not defined in the |
| | | * server schema. |
| | | */ |
| | | public Syntax getDefaultSyntax() |
| | | { |
| | | return schemaNG.getSyntax(CoreSchema.getDirectoryStringSyntax().getOID()); |
| | | } |
| | | |
| | | /** |
| | | * Registers the provided syntax definition with this schema. |
| | | * |
| | | * @param syntax |
| | |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | | this.inheritFromDNType = DirectoryServer.getAttributeType(value.toString()); |
| | | this.inheritFromDNType = DirectoryServer.getSchema().getAttributeType(value.toString()); |
| | | this.inheritFromDNAttrValue = value; |
| | | break; |
| | | } |
| | |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | | this.inheritFromRDNAttrType = DirectoryServer.getAttributeType(value.toString()); |
| | | this.inheritFromRDNAttrType = DirectoryServer.getSchema().getAttributeType(value.toString()); |
| | | this.inheritFromRDNAttrValue = value; |
| | | break; |
| | | } |
| | |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | | this.inheritFromRDNType = DirectoryServer.getAttributeType(value.toString()); |
| | | this.inheritFromRDNType = DirectoryServer.getSchema().getAttributeType(value.toString()); |
| | | break; |
| | | } |
| | | } |
| | |
| | | { |
| | | String specString = null; |
| | | boolean isValidSpec = true; |
| | | AttributeType specAttrType = DirectoryServer.getAttributeType(ATTR_SUBTREE_SPEC_LC); |
| | | AttributeType specAttrType = DirectoryServer.getSchema().getAttributeType(ATTR_SUBTREE_SPEC_LC); |
| | | for (Attribute attr : entry.getAttribute(specAttrType)) |
| | | { |
| | | for (ByteString value : attr) |
| | |
| | | |
| | | // Check to see if the entry includes a privilege specification. If so, |
| | | // then the requester must have the PRIVILEGE_CHANGE privilege. |
| | | AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeType privType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | if (entry.hasAttribute(privType) |
| | | && !clientConnection.hasPrivilege(Privilege.PRIVILEGE_CHANGE, this)) |
| | | { |
| | |
| | | Arg1<Object> nonUniqueAttributeMessage, |
| | | Arg2<Object, Object> cannotProcessAttributeMessage) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attributeTypeName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attributeTypeName); |
| | | List<Attribute> attrList = userEntry.getAttribute(attrType); |
| | | if (attrList.size() == 1) |
| | | { |
| | |
| | | processModification(m); |
| | | } |
| | | else if (!isInternalOrSynchro(m) |
| | | && t.equals(getAttributeType(OP_ATTR_ACCOUNT_DISABLED))) |
| | | && t.equals(getSchema().getAttributeType(OP_ATTR_ACCOUNT_DISABLED))) |
| | | { |
| | | enabledStateChanged = true; |
| | | isEnabled = !pwPolicyState.isDisabled(); |
| | |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.adapter.server3x.Converters.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.util.ArrayList; |
| | |
| | | import org.forgerock.opendj.ldap.responses.PasswordModifyExtendedResult; |
| | | import org.forgerock.opendj.ldap.responses.Responses; |
| | | import org.forgerock.opendj.ldap.responses.Result; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.Scope; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.Scope; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.CompareOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ExtendedOperation; |
| | | import org.opends.server.core.SearchOperation; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.FilterType; |
| | | import org.opends.server.types.LDAPException; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.opends.server.types.Operation; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.opends.server.types.SearchResultReference; |
| | |
| | | assertThat(result.getName().toString()).isEqualTo(entry.getName().toString()); |
| | | List<ObjectClass> ocs = new ArrayList<>(result.getObjectClasses().keySet()); |
| | | assertThat(ocs).hasSize(2); |
| | | assertThat(ocs.get(0).getOID()).isEqualTo(DirectoryServer.getSchema().getObjectClass("ds-cfg-backend").getOID()); |
| | | assertThat(ocs.get(0).getOID()).isEqualTo(getSchema().getObjectClass("ds-cfg-backend").getOID()); |
| | | assertThat(ocs.get(1).getOID()).as("This should be a placeholder").endsWith("-oid"); |
| | | } |
| | | |
| | |
| | | byte[] data = { 0x00, 0x01, 0x02, (byte) 0xff }; |
| | | |
| | | ByteString attrValue = ByteString.wrap(data); |
| | | Attribute attribute = Attributes.create(DirectoryServer.getAttributeType("cn"), attrValue); |
| | | Attribute attribute = Attributes.create(getCNAttributeType(), attrValue); |
| | | assertThat(from(attribute).firstValue().toByteArray()).isEqualTo(data); |
| | | } |
| | | |
| | |
| | | { |
| | | EnumTargetOperator op = EnumTargetOperator.createOperator(eqOperator); |
| | | TargetAttr targetAttr = TargetAttr.decode(op, targetAttrString); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attribute); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attribute); |
| | | assertEquals(TargetAttr.isApplicable(attrType, targetAttr), expectedResult); |
| | | } |
| | | } |
| | |
| | | package org.opends.server.backends; |
| | | |
| | | import static org.forgerock.opendj.ldap.ResultCode.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeTypesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getObjectClassesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getLDAPSyntaxesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getMatchingRulesAttributeType())); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeTypesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getObjectClassesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getLDAPSyntaxesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getMatchingRulesAttributeType())); |
| | | |
| | | schemaDN = DN.valueOf("cn=subschema"); |
| | | schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false); |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules"))); |
| | | assertTrue(schemaEntry.hasAttribute(getAttributeTypesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getObjectClassesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getLDAPSyntaxesAttributeType())); |
| | | assertTrue(schemaEntry.hasAttribute(getMatchingRulesAttributeType())); |
| | | } |
| | | |
| | | /** |
| | |
| | | throws Exception |
| | | { |
| | | DN schemaDN = DN.valueOf("cn=schema"); |
| | | AttributeType a = DirectoryServer.getAttributeType("attributetypes"); |
| | | AttributeType o = DirectoryServer.getAttributeType("objectclasses"); |
| | | AttributeType m = DirectoryServer.getAttributeType("matchingrules"); |
| | | AttributeType s = DirectoryServer.getAttributeType("ldapsyntaxes"); |
| | | AttributeType a = getAttributeTypesAttributeType(); |
| | | AttributeType o = getObjectClassesAttributeType(); |
| | | AttributeType m = getMatchingRulesAttributeType(); |
| | | AttributeType s = getLDAPSyntaxesAttributeType(); |
| | | |
| | | assertFalse(schemaBackend.showAllAttributes()); |
| | | Entry schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false); |
| | |
| | | Entry schemaEntry = DirectoryServer.getEntry(DN.valueOf("cn=schema")); |
| | | assertNotNull(schemaEntry); |
| | | |
| | | AttributeType cnType = DirectoryServer.getAttributeType("creatorsname"); |
| | | AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp"); |
| | | AttributeType cnType = getCreatorsNameAttributeType(); |
| | | AttributeType ctType = getCreateTimestampAttributeType(); |
| | | AttributeType mnType = getModifiersNameAttributeType(); |
| | | AttributeType mtType = getModifyTimestampAttributeType(); |
| | | |
| | | assertTrue(schemaEntry.hasAttribute(cnType)); |
| | | assertTrue(schemaEntry.hasAttribute(ctType)); |
| | |
| | | package org.opends.server.backends.pluggable; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.forgerock.opendj.config.ConfigurationMock.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.PDBBackendCfg; |
| | | import org.forgerock.util.promise.NeverThrowsException; |
| | | import org.forgerock.util.promise.PromiseImpl; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.PDBBackendCfg; |
| | | import org.opends.server.backends.pdb.PDBStorage; |
| | | import org.opends.server.backends.pluggable.spi.AccessMode; |
| | | import org.opends.server.backends.pluggable.spi.Cursor; |
| | |
| | | import org.opends.server.backends.pluggable.spi.TreeName; |
| | | import org.opends.server.backends.pluggable.spi.WriteOperation; |
| | | import org.opends.server.backends.pluggable.spi.WriteableTransaction; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.MemoryQuota; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.extensions.DiskSpaceMonitor; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | |
| | | BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(CoreSchema.getSNAttributeType()); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | package org.opends.server.backends.pluggable; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.forgerock.opendj.config.ConfigurationMock.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | import java.util.Random; |
| | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.PDBBackendCfg; |
| | | import org.forgerock.util.promise.NeverThrowsException; |
| | | import org.forgerock.util.promise.PromiseImpl; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.PDBBackendCfg; |
| | | import org.opends.server.backends.pdb.PDBStorage; |
| | | import org.opends.server.backends.pluggable.spi.AccessMode; |
| | | import org.opends.server.backends.pluggable.spi.ReadOperation; |
| | |
| | | import org.opends.server.backends.pluggable.spi.TreeName; |
| | | import org.opends.server.backends.pluggable.spi.WriteOperation; |
| | | import org.opends.server.backends.pluggable.spi.WriteableTransaction; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.MemoryQuota; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.extensions.DiskSpaceMonitor; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | |
| | | BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(CoreSchema.getSNAttributeType()); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.util.Reject; |
| | | import org.mockito.invocation.InvocationOnMock; |
| | | import org.mockito.stubbing.Answer; |
| | |
| | | for (Map.Entry<String, IndexType[]> index : backendIndexes.entrySet()) |
| | | { |
| | | final String attributeName = index.getKey(); |
| | | final AttributeType attribute = DirectoryServer.getAttributeType(attributeName); |
| | | final AttributeType attribute = DirectoryServer.getSchema().getAttributeType(attributeName); |
| | | Reject.ifNull(attribute, "Attribute type '" + attributeName + "' doesn't exists."); |
| | | |
| | | BackendIndexCfg indexCfg = mock(BackendIndexCfg.class); |
| | |
| | | { |
| | | for (IndexType type : index.getValue()) |
| | | { |
| | | final AttributeType attributeType = DirectoryServer.getAttributeType(index.getKey()); |
| | | final AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(index.getKey()); |
| | | assertTrue(backend.isIndexed(attributeType, |
| | | org.opends.server.types.IndexType.valueOf(type.toString().toUpperCase()))); |
| | | } |
| | |
| | | Entry oldEntry = workEntries.get(0); |
| | | Entry newEntry = oldEntry.duplicate(false); |
| | | |
| | | modifyAttribute = DirectoryServer.getAttributeType("jpegphoto"); |
| | | modifyAttribute = DirectoryServer.getSchema().getAttributeType("jpegphoto"); |
| | | List<Modification> mods = Arrays.asList( |
| | | // unindexed |
| | | new Modification(ADD, create(modifyAttribute, modifyValue)), |
| | |
| | | Entry actual = new Entry(dbEntry.getName(), dbEntry.getObjectClasses(), dbEntry.getUserAttributes(), null); |
| | | |
| | | // Remove the userPassword because it will have been encoded. |
| | | expected.removeAttribute(DirectoryServer.getAttributeType("userpassword")); |
| | | actual.removeAttribute(DirectoryServer.getAttributeType("userpassword")); |
| | | expected.removeAttribute(CoreSchema.getUserPasswordAttributeType()); |
| | | actual.removeAttribute(CoreSchema.getUserPasswordAttributeType()); |
| | | |
| | | assertThat(actual).isEqualTo(expected); |
| | | } |
| | |
| | | package org.opends.server.backends.pluggable; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.forgerock.opendj.config.ConfigurationMock.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.backends.pluggable.State.IndexFlag.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | |
| | | import java.util.UUID; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType; |
| | | import org.forgerock.opendj.server.config.server.BackendIndexCfg; |
| | | import org.forgerock.opendj.server.config.server.PDBBackendCfg; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.backends.pdb.PDBStorage; |
| | | import org.opends.server.backends.pluggable.State.IndexFlag; |
| | | import org.opends.server.backends.pluggable.spi.AccessMode; |
| | |
| | | import org.opends.server.backends.pluggable.spi.TreeName; |
| | | import org.opends.server.backends.pluggable.spi.WriteOperation; |
| | | import org.opends.server.backends.pluggable.spi.WriteableTransaction; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.MemoryQuota; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.extensions.DiskSpaceMonitor; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.AfterMethod; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | |
| | | BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(CoreSchema.getSNAttributeType()); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | } |
| | | |
| | | |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getSchema().getAttributeType(type); |
| | | ByteString attVal = null; |
| | | if (attType != null) |
| | | { |
| | |
| | | |
| | | // input parameter |
| | | String rawAttTypeTest = type; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeType(type); |
| | | AttributeType attTypeTest = DirectoryServer.getSchema().getAttributeType(type); |
| | | ByteString subInitialTest = ByteString.valueOfUtf8(subInitial); |
| | | List<ByteString> subAnyTest = new ArrayList<>(subAny.size()); |
| | | for (String s : subAny) |
| | |
| | | } |
| | | |
| | | // ( AttributeType attributeType, ByteString assertionValue |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getSchema().getAttributeType(type); |
| | | ByteString attVal = null; |
| | | if (attType != null) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getSchema().getAttributeType(type); |
| | | ByteString attVal = null ; |
| | | if (attType != null) |
| | | { |
| | |
| | | assertEquals(mvf.getMatchType(), MatchedValuesFilter.PRESENT_TYPE); |
| | | |
| | | // ( AttributeType attributeType |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getSchema().getAttributeType(type); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | // ( AttributeType attributeType, ByteString assertionValue |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getSchema().getAttributeType(type); |
| | | ByteString attVal = null ; |
| | | if (attType != null) |
| | | { |
| | |
| | | |
| | | // input value |
| | | String rawAttTypeTest = type ; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeType(type) ; |
| | | AttributeType attTypeTest = DirectoryServer.getSchema().getAttributeType(type) ; |
| | | String matchingRuleIdTest = matchingRule.getOID() ; |
| | | ByteString attValueTest = (attTypeTest == null) ? null : ByteString.valueOfUtf8(value); |
| | | // parameter used for the test. |
| | |
| | | public void testDifferentNormalization(String type, ByteString value, |
| | | String assertion) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType("usercertificate"); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType("usercertificate"); |
| | | MatchedValuesFilter mvf = MatchedValuesFilter.createEqualityFilter(type, ByteString.valueOfUtf8(assertion)); |
| | | assertTrue(mvf.valueMatches(attrType, value)); |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.protocols.ldap.LDAPResultCode; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | |
| | | public class VLVControlTestCase |
| | | extends ControlsTestCase |
| | | { |
| | | /** The givenName attribute type. */ |
| | | private AttributeType givenNameType; |
| | | /** The sn attribute type. */ |
| | | private AttributeType snType; |
| | | |
| | | /** The DN for "Aaccf Johnson". */ |
| | | private DN aaccfJohnsonDN; |
| | | /** The DN for "Aaron Zimmerman". */ |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | givenNameType = DirectoryServer.getAttributeType("givenname"); |
| | | assertNotNull(givenNameType); |
| | | |
| | | snType = DirectoryServer.getAttributeType("sn"); |
| | | assertNotNull(snType); |
| | | |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com"); |
| | | aaronZimmermanDN = DN.valueOf("uid=aaron.zimmerman,dc=example,dc=com"); |
| | | albertSmithDN = DN.valueOf("uid=albert.smith,dc=example,dc=com"); |
| | |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("description"); |
| | | AttributeType attrType = getDescriptionAttributeType(); |
| | | UpdatePreOpPlugin.addAttributeToRemove(attrType); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | |
| | | "objectClass: organization", |
| | | "o: test"); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("description"); |
| | | AttributeType attrType = getDescriptionAttributeType(); |
| | | Map<AttributeType,List<Attribute>> userAttrs = entry.getUserAttributes(); |
| | | userAttrs.put(attrType, newArrayList(Attributes.empty(attrType))); |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.plugins.DisconnectClientPlugin; |
| | |
| | | public void testGetAndAddModifications() throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isEmpty(); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | UpdatePreOpPlugin.addModification( |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isNotEmpty(); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isNotEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | } |
| | |
| | | public void testSuccessAddAttribute() throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isEmpty(); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isEmpty(); |
| | | |
| | | RawModification mod = newRawModification(REPLACE, "description", "foo"); |
| | | ModifyOperation modifyOperation = processModify("o=test", mod); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isNotEmpty(); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | List<Attribute> attrList = e.getAttribute(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 1); |
| | | |
| | | ModifyOperation modifyOperation = processModify("o=test", newRawModification(ADD, "o", "test2")); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | attrList = e.getAttribute(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | | |
| | |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | List<Attribute> attrList = e.getAttribute(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 1); |
| | | |
| | | RawModification mod = newRawModification(ADD, "o;lang-en-us", "test"); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | attrList = e.getAttribute(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | | |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber")); |
| | | List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType()); |
| | | assertIntegerValueExists(attrList, 2); |
| | | } |
| | | |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber")); |
| | | List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType()); |
| | | assertIntegerValueExists(attrList, 11); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the ability to perform a modification that increments a single-valued |
| | | * integer attribute by negative one. |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber")); |
| | | List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType()); |
| | | assertIntegerValueExists(attrList, 0); |
| | | } |
| | | |
| | | private AttributeType getEmployeeNumberAttributeType() |
| | | { |
| | | return DirectoryServer.getSchema().getAttributeType("employeenumber"); |
| | | } |
| | | |
| | | private void assertIntegerValueExists(List<Attribute> attrList, int expectedValue) |
| | | { |
| | | boolean found = false; |
| | |
| | | modifyOperation.run(); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | assertFalse(DirectoryServer.getEntry(DN.valueOf("o=test")).hasAttribute( |
| | | DirectoryServer.getAttributeType("description"))); |
| | | assertFalse(DirectoryServer.getEntry(DN.valueOf("o=test")).hasAttribute(getDescriptionAttributeType())); |
| | | } |
| | | |
| | | |
| | |
| | | "displayName: Test User", |
| | | "userPassword: password"); |
| | | |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeType("userpassword")); |
| | | String passwd = firstValue(attrList); |
| | | String passwd = firstValue(e.getAttribute(getUserPasswordAttributeType())); |
| | | assertNotNull(passwd); |
| | | |
| | | String path = TestCaseUtils.createTempFile( |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("usercertificate")); |
| | | List<Attribute> attrList = e.getAttribute(getUserCertificateAttributeType()); |
| | | assertThat(attrList).hasSize(1); |
| | | Attribute a = attrList.get(0); |
| | | assertTrue(a.getAttributeDescription().hasOption("binary")); |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PasswordPolicyCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PasswordPolicyCfg; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | |
| | | { |
| | | PasswordPolicy p = DirectoryServer.getDefaultPasswordPolicy(); |
| | | AttributeType t = p.getPasswordAttribute(); |
| | | assertEquals(t, DirectoryServer.getAttributeType("userpassword")); |
| | | assertEquals(t, getUserPasswordAttributeType()); |
| | | } |
| | | |
| | | |
| | |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | AttributeType t = p.getPasswordAttribute(); |
| | | assertEquals(t, DirectoryServer.getAttributeType("authpassword")); |
| | | assertEquals(t, getAuthPasswordAttributeType()); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(DN.valueOf(dn)); |
| | | assertNotNull(entry); |
| | | AttributeType pwdHistory = DirectoryServer.getAttributeType("pwdhistory"); |
| | | AttributeType pwdHistory = DirectoryServer.getSchema().getAttributeType("pwdhistory"); |
| | | assertNotNull(pwdHistory); |
| | | Attribute historyAttr = entry.getExactAttribute(AttributeDescription.create(pwdHistory)); |
| | | assertNotNull(historyAttr); |
| | |
| | | private void hasValues(DN dn, String attrName, String... values) throws DirectoryException |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | assertTrue(entry.hasAttribute(attrType)); |
| | | for (String value : values) |
| | | { |
| | |
| | | private void doesNotHaveValues(DN dn, String attrName, String... values) throws DirectoryException |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | assertTrue(entry.hasAttribute(attrType)); |
| | | for (String value : values) |
| | | { |
| | |
| | | private void hasNoAttribute(DN dn, String attrName) throws Exception |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | assertFalse(entry.hasAttribute(attrType)); |
| | | } |
| | | |
| | |
| | | |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertEquals(searchOperation.getEntriesSent(), 1); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("collectiveattributesubentries"); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType("collectiveattributesubentries"); |
| | | Entry e = searchOperation.getSearchEntries().getFirst(); |
| | | assertTrue(e.hasValue(attrType, ByteString.valueOfObject(collectiveSubentry.getName()))); |
| | | } |
| | |
| | | Entry testEntry = DirectoryServer.getEntry(DN.valueOf("uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("pwdpolicysubentry"); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType("pwdpolicysubentry"); |
| | | |
| | | // Make sure that default policy is in effect |
| | | // for the user entry. |
| | |
| | | |
| | | private void assertAttrValue(Entry newEntry, String attrName, String expectedAttrValue) |
| | | { |
| | | AttributeType at = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType at = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | assertThat(attrList).hasSize(1); |
| | | |
| | |
| | | import java.util.TreeSet; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.Filter; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | |
| | | import org.forgerock.opendj.ldap.controls.PreReadRequestControl; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.mockito.ArgumentCaptor; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.server.config.meta.EntityTagVirtualAttributeCfgDefn.ChecksumAlgorithm; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.ConflictBehavior; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.Scope; |
| | | import org.forgerock.opendj.server.config.server.EntityTagVirtualAttributeCfg; |
| | | import org.forgerock.opendj.server.config.server.VirtualAttributeCfg; |
| | | import org.mockito.ArgumentCaptor; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.controls.LDAPPostReadResponseControl; |
| | | import org.opends.server.controls.LDAPPreReadResponseControl; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Control; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | |
| | | |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.forgerock.opendj.ldap.requests.Requests.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.mockito.Mockito.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Initialize the provider. |
| | | config.getExcludedAttribute().add(DirectoryServer.getAttributeType("modifytimestamp")); |
| | | config.getExcludedAttribute().add(getModifyTimestampAttributeType()); |
| | | provider.initializeVirtualAttributeProvider(config); |
| | | } |
| | | |
| | |
| | | final SearchOperation searchOp = mock(SearchOperation.class); |
| | | |
| | | VirtualAttributeRule rule = new VirtualAttributeRule( |
| | | DirectoryServer.getAttributeType(ETAG), provider, |
| | | DirectoryServer.getSchema().getAttributeType(ETAG), provider, |
| | | Collections.<DN> emptySet(), SearchScope.WHOLE_SUBTREE, |
| | | Collections.<DN> emptySet(), Collections.<SearchFilter> emptySet(), |
| | | VirtualAttributeCfgDefn.ConflictBehavior.REAL_OVERRIDES_VIRTUAL); |
| | |
| | | |
| | | private VirtualAttributeRule getRule() |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeType("etag"); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(ETAG); |
| | | return new VirtualAttributeRule(type, provider, |
| | | Collections.<DN>emptySet(), SearchScope.WHOLE_SUBTREE, |
| | | Collections.<DN>emptySet(), |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | |
| | | public class EntryDNVirtualAttributeProviderTestCase |
| | | extends ExtensionsTestCase |
| | | { |
| | | /** The attribute type for the entryDN attribute. */ |
| | | private AttributeType entryDNType; |
| | | |
| | | |
| | | private static final AttributeType entryDNType = getEntryDNAttributeType(); |
| | | |
| | | /** |
| | | * Ensures that the Directory Server is running. |
| | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | |
| | | public class EntryUUIDVirtualAttributeProviderTestCase |
| | | extends ExtensionsTestCase |
| | | { |
| | | /** The attribute type for the entryUUID attribute. */ |
| | | private AttributeType entryUUIDType; |
| | | |
| | | |
| | | private static final AttributeType entryUUIDType = CoreSchema.getEntryUUIDAttributeType(); |
| | | |
| | | /** |
| | | * Ensures that the Directory Server is running. |
| | |
| | | throws Exception |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryUUIDType = DirectoryServer.getAttributeType("entryuuid"); |
| | | assertNotNull(entryUUIDType); |
| | | } |
| | | |
| | | |
| | |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-match-attribute: uid"); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType("ds-cfg-match-base-dn"); |
| | | AttributeType t = DirectoryServer.getSchema().getAttributeType("ds-cfg-match-base-dn"); |
| | | e.addAttribute(Attributes.empty(t), new ArrayList<ByteString>()); |
| | | entries.add(e); |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | governingStructureRuleType = DirectoryServer.getAttributeType("governingstructurerule"); |
| | | assertNotNull(governingStructureRuleType); |
| | | governingStructureRuleType = getGoverningStructureRuleAttributeType(); |
| | | |
| | | int resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | | "changetype: modify", |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | hasSubordinatesType = DirectoryServer.getAttributeType("hassubordinates"); |
| | | assertNotNull(hasSubordinatesType); |
| | | hasSubordinatesType = DirectoryServer.getSchema().getAttributeType("hassubordinates"); |
| | | |
| | | entries = TestCaseUtils.makeEntries( |
| | | "dn: dc=example,dc=com", |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.SearchResultEntry; |
| | |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | |
| | | isMemberOfType = DirectoryServer.getAttributeType("ismemberof"); |
| | | assertNotNull(isMemberOfType); |
| | | isMemberOfType = DirectoryServer.getSchema().getAttributeType("ismemberof"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | MockPolicyCfg withMappedAttribute(final String attrName) |
| | | { |
| | | mappedAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | mappedAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName)); |
| | | return this; |
| | | } |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | |
| | | numSubordinatesType = DirectoryServer.getAttributeType("numsubordinates"); |
| | | assertNotNull(numSubordinatesType); |
| | | numSubordinatesType = DirectoryServer.getSchema().getAttributeType("numsubordinates"); |
| | | |
| | | entries = TestCaseUtils.makeEntries( |
| | | "dn: dc=example,dc=com", |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeType("ds-pwp-last-login-time"); |
| | | AttributeType lastLoginTimeAttr = DirectoryServer.getSchema().getAttributeType("ds-pwp-last-login-time"); |
| | | assertNotNull(lastLoginTimeAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType authFailureTimesAttr = DirectoryServer.getAttributeType("pwdfailuretime"); |
| | | AttributeType authFailureTimesAttr = DirectoryServer.getSchema().getAttributeType("pwdfailuretime"); |
| | | assertNotNull(authFailureTimesAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType pwdHistoryAttr = DirectoryServer.getAttributeType("pwdhistory"); |
| | | AttributeType pwdHistoryAttr = DirectoryServer.getSchema().getAttributeType("pwdhistory"); |
| | | assertNotNull(pwdHistoryAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | |
| | | public class StructuralObjectClassVirtualAttributeProviderTestCase |
| | | extends ExtensionsTestCase |
| | | { |
| | | /** The attribute type for the structuralobjectclass attribute. */ |
| | | private AttributeType structuralObjectClassType; |
| | | |
| | | |
| | | private static final AttributeType structuralObjectClassType = getStructuralObjectClassAttributeType(); |
| | | |
| | | /** |
| | | * Ensures that the Directory Server is running. |
| | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | structuralObjectClassType = DirectoryServer.getAttributeType("structuralobjectclass"); |
| | | assertNotNull(structuralObjectClassType); |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.protocols.ldap.LDAPControl; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | subschemaSubentryType = DirectoryServer.getAttributeType("subschemasubentry"); |
| | | assertNotNull(subschemaSubentryType); |
| | | subschemaSubentryType = CoreSchema.getSubschemaSubentryAttributeType(); |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.types.Attribute; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | descriptionType = DirectoryServer.getAttributeType("description"); |
| | | assertNotNull(descriptionType); |
| | | |
| | | pwPolicyDNType = DirectoryServer.getAttributeType("ds-pwp-password-policy-dn"); |
| | | assertNotNull(pwPolicyDNType); |
| | | |
| | | privNameType = DirectoryServer.getAttributeType("ds-privilege-name"); |
| | | assertNotNull(privNameType); |
| | | descriptionType = CoreSchema.getDescriptionAttributeType(); |
| | | pwPolicyDNType = DirectoryServer.getSchema().getAttributeType("ds-pwp-password-policy-dn"); |
| | | privNameType = DirectoryServer.getSchema().getAttributeType("ds-privilege-name"); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.GroupManager; |
| | |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.MemberList; |
| | | import org.opends.server.types.Modification; |
| | | import org.opends.server.types.SearchFilter; |
| | | import org.opends.server.types.VirtualAttributeRule; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | memberType = DirectoryServer.getAttributeType("member"); |
| | | assertNotNull(memberType); |
| | | |
| | | uniqueMemberType = DirectoryServer.getAttributeType("uniquemember"); |
| | | assertNotNull(uniqueMemberType); |
| | | |
| | | memberType = getMemberAttributeType(); |
| | | uniqueMemberType = getUniqueMemberAttributeType(); |
| | | groupManager = DirectoryServer.getGroupManager(); |
| | | |
| | | u1 = DN.valueOf("uid=test.1,ou=People,o=test"); |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.EntryUUIDPluginCfgDefn; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.plugin.PluginType; |
| | |
| | | public void testInitializeWithValidConfigsWithoutSchema(Entry e) |
| | | throws Exception |
| | | { |
| | | AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid"); |
| | | AttributeType entryUUIDType = CoreSchema.getEntryUUIDAttributeType(); |
| | | DirectoryServer.getSchema().deregisterAttributeType(entryUUIDType); |
| | | |
| | | EntryUUIDPlugin plugin = initializePlugin(e); |
| | |
| | | package org.opends.server.plugins; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | public void testInitializeWithValidConfigsWithoutSchema(Entry e) |
| | | throws Exception |
| | | { |
| | | AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("creatorsname"); |
| | | AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType ctType = getCreateTimestampAttributeType(); |
| | | AttributeType cnType = getCreatorsNameAttributeType(); |
| | | AttributeType mtType = getModifyTimestampAttributeType(); |
| | | AttributeType mnType = getModifiersNameAttributeType(); |
| | | |
| | | DirectoryServer.getSchema().deregisterAttributeType(ctType); |
| | | DirectoryServer.getSchema().deregisterAttributeType(cnType); |
| | |
| | | String attr, |
| | | String... dns) |
| | | throws Exception { |
| | | AttributeType type= getAttributeType(attr); |
| | | AttributeType type = getSchema().getAttributeType(attr); |
| | | final SearchRequest request = newSearchRequest(entryDN, SearchScope.BASE_OBJECT, "(" + attr + "=*)"); |
| | | InternalSearchOperation operation = getRootConnection().processSearch(request); |
| | | for (SearchResultEntry entry : operation.getSearchEntries()) { |
| | |
| | | } |
| | | |
| | | private void delAttribute(Entry entry, String attrTypeString) { |
| | | entry.removeAttribute(getAttributeType(attrTypeString)); |
| | | entry.removeAttribute(getSchema().getAttributeType(attrTypeString)); |
| | | } |
| | | |
| | | private void addAttribute(Entry entry, String attrName, String... attrValues) { |
| | |
| | | "ds-cfg-trust-manager-provider: cn=JKS,cn=Trust Manager Providers,cn=config"); |
| | | LDAPConnectionHandler LDAPConnHandler=getLDAPHandlerInstance(GoodHandlerEntry); |
| | | //Make attrTypes to remove |
| | | AttributeType at0=DirectoryServer.getAttributeType(ATTR_LISTEN_PORT); |
| | | AttributeType at0=DirectoryServer.getSchema().getAttributeType(ATTR_LISTEN_PORT); |
| | | // AttributeType at1=DirectoryServer.getAttributeType(ATTR_LISTEN_ADDRESS, true); |
| | | // Attribute rAttr1=new Attribute(at1); |
| | | // GoodHandlerEntry.removeAttribute(rAttr1, null); |
| | | AttributeType at2=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at3=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at4=DirectoryServer.getAttributeType(ATTR_KEEP_LDAP_STATS); |
| | | AttributeType at5=DirectoryServer.getAttributeType(ATTR_SEND_REJECTION_NOTICE); |
| | | AttributeType at6=DirectoryServer.getAttributeType(ATTR_USE_TCP_KEEPALIVE); |
| | | AttributeType at7=DirectoryServer.getAttributeType(ATTR_USE_TCP_NODELAY); |
| | | AttributeType at8=DirectoryServer.getAttributeType(ATTR_ALLOW_REUSE_ADDRESS); |
| | | AttributeType at9=DirectoryServer.getAttributeType(ATTR_USE_SSL); |
| | | AttributeType at10=DirectoryServer.getAttributeType(ATTR_ALLOW_STARTTLS); |
| | | AttributeType at11=DirectoryServer.getAttributeType(ATTR_MAX_REQUEST_SIZE); |
| | | AttributeType at12=DirectoryServer.getAttributeType(ATTR_ACCEPT_BACKLOG); |
| | | AttributeType at2=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at3=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at4=DirectoryServer.getSchema().getAttributeType(ATTR_KEEP_LDAP_STATS); |
| | | AttributeType at5=DirectoryServer.getSchema().getAttributeType(ATTR_SEND_REJECTION_NOTICE); |
| | | AttributeType at6=DirectoryServer.getSchema().getAttributeType(ATTR_USE_TCP_KEEPALIVE); |
| | | AttributeType at7=DirectoryServer.getSchema().getAttributeType(ATTR_USE_TCP_NODELAY); |
| | | AttributeType at8=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_REUSE_ADDRESS); |
| | | AttributeType at9=DirectoryServer.getSchema().getAttributeType(ATTR_USE_SSL); |
| | | AttributeType at10=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_STARTTLS); |
| | | AttributeType at11=DirectoryServer.getSchema().getAttributeType(ATTR_MAX_REQUEST_SIZE); |
| | | AttributeType at12=DirectoryServer.getSchema().getAttributeType(ATTR_ACCEPT_BACKLOG); |
| | | //Remove them |
| | | Attribute rAttr0=Attributes.empty(at0); |
| | | GoodHandlerEntry.removeAttribute(rAttr0, null); |
| | |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.backends.MemoryBackend; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | import org.opends.server.replication.service.ReplicationBroker; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.Modification; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | |
| | | int sequence; |
| | | for (sequence = 1; sequence<=addSequenceLength; sequence ++) |
| | | { |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.removeAttribute(getEntryUUIDAttributeType()); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<ByteString>()); |
| | | addDN = DN.valueOf("dc=dependency" + sequence + "," + addDN); |
| | |
| | | baseDN, brokerId, 1000, replServer.getReplicationPort(), 1000, CLEAN_DB_GENERATION_ID); |
| | | |
| | | // add an entry to play with. |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.removeAttribute(getEntryUUIDAttributeType()); |
| | | entry.addAttribute(Attributes.create("entryuuid", |
| | | stringUID(renamedEntryUuid)), |
| | | new LinkedList<ByteString>()); |
| | |
| | | for (sequence = 1; sequence<=addSequenceLength; sequence ++) |
| | | { |
| | | // add the entry a first time |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.removeAttribute(getEntryUUIDAttributeType()); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<ByteString>()); |
| | | DN addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | |
| | | broker.publish(delMsg(addDN, sequence + 1, gen)); |
| | | |
| | | // add again the entry with a new entryuuid. |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.removeAttribute(getEntryUUIDAttributeType()); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1025)), |
| | | new LinkedList<ByteString>()); |
| | | broker.publish(addMsg(addDN, entry, sequence + 1025, 1, gen)); |
| | |
| | | for (sequence = 1; sequence<=addSequenceLength; sequence ++) |
| | | { |
| | | // add the entry |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.removeAttribute(getEntryUUIDAttributeType()); |
| | | entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)), |
| | | new LinkedList<ByteString>()); |
| | | addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING); |
| | |
| | | { |
| | | debugInfo("Entry found <" + baseDN + ">"); |
| | | |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID); |
| | | Attribute attr = resultEntry.getExactAttribute(AttributeDescription.create(synchronizationGenIDType)); |
| | | return Long.valueOf(attr.iterator().next().toString()); |
| | | } |
| | |
| | | |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.forgerock.opendj.ldap.requests.Requests.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.replication.plugin.LDAPReplicationDomain.*; |
| | |
| | | { |
| | | testSetUp("modifyConflicts"); |
| | | final DN dn1 = DN.valueOf("cn=test1," + baseDN); |
| | | final AttributeType attrType = DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeType("entryuuid"); |
| | | final AttributeType attrType = DirectoryServer.getSchema().getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = getEntryUUIDAttributeType(); |
| | | String monitorAttr = "resolved-modify-conflicts"; |
| | | |
| | | /* |
| | |
| | | assertEquals(attrInfo4.getValuesHistorical().size(), 1); |
| | | |
| | | // Check |
| | | AttributeType type = DirectoryServer.getAttributeType(ATTRIBUTE_NAME); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(ATTRIBUTE_NAME); |
| | | attrInfo3.delete(Attributes.create(type, att), updateTime) ; |
| | | assertEquals(attrInfo3.getValuesHistorical().size(), 1); |
| | | |
| | |
| | | debugInfo("Entry found <" + rootDn + ">"); |
| | | |
| | | AttributeType synchronizationGenIDType = |
| | | DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | |
| | | { |
| | | if (!first) |
| | | { |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeType(fracAttr))); |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getSchema().getAttributeType(fracAttr))); |
| | | } |
| | | first = false; |
| | | } |
| | |
| | | } |
| | | first = false; |
| | | } |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeType(OPTIONAL_ATTR))); |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer.getSchema().getAttributeType(OPTIONAL_ATTR))); |
| | | break; |
| | | default: |
| | | fail("Unexpected fractional mode."); |
| | |
| | | { |
| | | if (!first) |
| | | { |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getAttributeType(fracAttr))); |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getSchema().getAttributeType(fracAttr))); |
| | | } |
| | | first = false; |
| | | } |
| | |
| | | } |
| | | first = false; |
| | | } |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getAttributeType(OPTIONAL_ATTR))); |
| | | assertFalse(entry.hasAttribute(DirectoryServer.getSchema().getAttributeType(OPTIONAL_ATTR))); |
| | | break; |
| | | default: |
| | | fail("Unexpected fractional mode."); |
| | |
| | | private Entry waitTillEntryHasSynchroAttribute(String entryDN) |
| | | throws Exception |
| | | { |
| | | AttributeType synchroAttrType = DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR); |
| | | AttributeType synchroAttrType = DirectoryServer.getSchema().getAttributeType(SYNCHRO_OPTIONAL_ATTR); |
| | | DN dn = DN.valueOf(entryDN); |
| | | |
| | | Entry entry = null; |
| | |
| | | long startTime = TimeThread.getTime(); |
| | | final DN dn1 = DN.valueOf("cn=test1," + baseDN); |
| | | final AttributeType histType = |
| | | DirectoryServer.getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | DirectoryServer.getSchema().getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | logger.error(LocalizableMessage.raw("Starting replication test : changesCmpTest")); |
| | | |
| | |
| | | |
| | | import static org.forgerock.opendj.ldap.ResultCode.*; |
| | | import static org.forgerock.opendj.ldap.SearchScope.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | final DN dn1 = DN.valueOf("cn=test1," + TEST_ROOT_DN_STRING); |
| | | final DN dn2 = DN.valueOf("cn=test2," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | final AttributeType attrType = DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType attrType = DirectoryServer.getSchema().getAttributeType("displayname"); |
| | | final AttributeDescription attrDesc = AttributeDescription.create(attrType); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeType("entryuuid"); |
| | | final AttributeDescription entryuuidDesc = AttributeDescription.create(entryuuidType); |
| | | final AttributeDescription entryuuidDesc = AttributeDescription.create(getEntryUUIDAttributeType()); |
| | | |
| | | /* |
| | | * Open a session to the replicationServer using the broker API. |
| | |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | |
| | | UUID uuid = UUID.randomUUID(); |
| | | |
| | | // Create the att values list |
| | | AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | AttributeType entryuuidAttrType = getEntryUUIDAttributeType(); |
| | | List<Attribute> uuidList = Attributes.createAsList(entryuuidAttrType, uuid.toString()); |
| | | |
| | | // Add the uuid in the entry |
| | |
| | | */ |
| | | private void assertEntryHistoricalEncodingDecoding(Entry entry, EntryHistorical hist) |
| | | { |
| | | entry.removeAttribute(getAttributeType(HISTORICAL_ATTRIBUTE_NAME)); |
| | | entry.removeAttribute(getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME)); |
| | | entry.addAttribute(hist.encodeAndPurge(), null); |
| | | EntryHistorical hist2 = EntryHistorical.newInstanceFromEntry(entry); |
| | | assertEquals(hist2.encodeAndPurge(), hist.encodeAndPurge()); |
| | |
| | | |
| | | private void assertContainsOnlyValues(Entry entry, String attrName, String... expectedValues) |
| | | { |
| | | Attribute attr = entry.getExactAttribute(AttributeDescription.create(getAttributeType(attrName))); |
| | | Attribute attr = entry.getExactAttribute(AttributeDescription.create(getSchema().getAttributeType(attrName))); |
| | | assertThat(attr).hasSize(expectedValues.length); |
| | | for (String value : expectedValues) |
| | | { |
| | |
| | | |
| | | private String getEntryUUID(Entry entry) |
| | | { |
| | | AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = entry.getOperationalAttributes().get(entryuuidAttrType); |
| | | List<Attribute> uuidAttrs = entry.getAttribute(getEntryUUIDAttributeType()); |
| | | return uuidAttrs.get(0).iterator().next().toString(); |
| | | } |
| | | |
| | |
| | | package org.opends.server.replication.protocol; |
| | | |
| | | import static org.assertj.core.api.Assertions.*; |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.replication.common.AssuredMode.*; |
| | |
| | | import org.assertj.core.api.Assertions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.AddOperationBasis; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | CSN csn1 = new CSN(1, 0, 1); |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value")); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | Modification mod2 = new Modification(DELETE, Attributes.empty("description")); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | AttributeBuilder builder = new AttributeBuilder(getDescriptionAttributeType()); |
| | | builder.add("string"); |
| | | builder.add("value"); |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | List<Modification> mods3 = newArrayList(new Modification(ADD, builder.toAttribute())); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | | mods4.add(new Modification(ModificationType.ADD, attr)); |
| | | mods4.add(new Modification(ADD, attr)); |
| | | } |
| | | |
| | | Attribute attr5 = Attributes.create("namingcontexts", "o=test"); |
| | | Modification mod5 = new Modification(ModificationType.REPLACE, attr5); |
| | | Modification mod5 = new Modification(REPLACE, Attributes.create("namingcontexts", "o=test")); |
| | | List<Modification> mods5 = newArrayList(mod5); |
| | | |
| | | // Entry attributes |
| | |
| | | @DataProvider(name = "createModifyDnData") |
| | | public Object[][] createModifyDnData() { |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value")); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | Modification mod2 = new Modification(DELETE, Attributes.empty("description")); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | builder.add("string"); |
| | | builder.add("value"); |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | Modification mod3 = new Modification(ADD, builder.toAttribute()); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | | mods4.add(new Modification(ModificationType.ADD, attr)); |
| | | mods4.add(new Modification(ADD, Attributes.create("description", "string" + i))); |
| | | } |
| | | |
| | | // Entry attributes |
| | |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.forgerock.opendj.ldap.requests.Requests.*; |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | |
| | | import org.assertj.core.api.Assertions; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.requests.ModifyDNRequest; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | |
| | | import org.opends.server.core.AddOperationBasis; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DeleteOperationBasis; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | CSN csn3 = new CSN(TimeThread.getTime(), 67894123, 45678); |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type = getDescriptionAttributeType(); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value")); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | Modification mod2 = new Modification(DELETE, Attributes.empty("description")); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | builder.add("string"); |
| | | builder.add("value"); |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | Modification mod3 = new Modification(ADD, builder.toAttribute()); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | | mods4.add(new Modification(ModificationType.ADD, attr)); |
| | | mods4.add(new Modification(ADD, Attributes.create("description", "string" + i))); |
| | | } |
| | | |
| | | Attribute attr5 = Attributes.create("namingcontexts", TEST_ROOT_DN_STRING); |
| | | Modification mod5 = new Modification(ModificationType.REPLACE, attr5); |
| | | Modification mod5 = new Modification(REPLACE, Attributes.create("namingcontexts", TEST_ROOT_DN_STRING)); |
| | | List<Modification> mods5 = newArrayList(mod5); |
| | | |
| | | List<Attribute> eclIncludes = getEntryAttributes(); |
| | |
| | | @DataProvider(name = "createModifyDnData") |
| | | public Object[][] createModifyDnData() { |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type = getDescriptionAttributeType(); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | | Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value")); |
| | | List<Modification> mods1 = newArrayList(mod1); |
| | | |
| | | Attribute attr2 = Attributes.empty("description"); |
| | | Modification mod2 = new Modification(ModificationType.DELETE, attr2); |
| | | Modification mod2 = new Modification(DELETE, Attributes.empty("description")); |
| | | List<Modification> mods2 = newArrayList(mod1, mod2); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type); |
| | | builder.add("string"); |
| | | builder.add("value"); |
| | | builder.add("again"); |
| | | Attribute attr3 = builder.toAttribute(); |
| | | Modification mod3 = new Modification(ModificationType.ADD, attr3); |
| | | Modification mod3 = new Modification(ADD, builder.toAttribute()); |
| | | List<Modification> mods3 = newArrayList(mod3); |
| | | |
| | | List<Modification> mods4 = new ArrayList<>(); |
| | | for (int i = 0; i < 10; i++) |
| | | { |
| | | Attribute attr = Attributes.create("description", "string" + i); |
| | | mods4.add(new Modification(ModificationType.ADD, attr)); |
| | | mods4.add(new Modification(ADD, Attributes.create("description", "string" + i))); |
| | | } |
| | | |
| | | List<Attribute> entryAttrList = getEntryAttributes(); |
| | |
| | | |
| | | FakeEntryIndex(String attrName) throws DecodeException |
| | | { |
| | | attrType = DirectoryServer.getAttributeType(attrName); |
| | | attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | if (attrType == null) |
| | | { |
| | | throw new IllegalArgumentException("Cannot find attribute with name \"" + attrName + "\""); |
| | |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.CoreSchema.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | import java.util.StringTokenizer; |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.ldap.schema.NameForm; |
| | | import org.forgerock.opendj.ldap.schema.ObjectClass; |
| | | import org.forgerock.opendj.ldap.schema.Syntax; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** This class defines a set of generic tests that may be used to examine the server schema. */ |
| | | public class GenericSchemaTestCase |
| | | extends SchemaTestCase |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("attributetypes"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | List<Attribute> attrList = e.getAttribute(getAttributeTypesAttributeType()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | // No attribute types in the schema file. This is OK. |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("nameforms"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | List<Attribute> attrList = e.getAttribute(getNameFormsAttributeType()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | // No attribute types in the schema file. This is OK. |
| | |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.ldap.schema.MatchingRule; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.testng.Assert; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Initialize the CN attribute type used in all tests. |
| | | cnType = DirectoryServer.getAttributeType("cn"); |
| | | Assert.assertNotNull(cnType); |
| | | |
| | | cnType = CoreSchema.getCNAttributeType(); |
| | | cnValue = bs("john doe"); |
| | | } |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.tools.LDAPModify; |
| | |
| | | "objectClass: domain", |
| | | "dc: example"); |
| | | |
| | | AttributeType creatorsNameType = DirectoryServer.getAttributeType("creatorsname"); |
| | | AttributeType creatorsNameType = CoreSchema.getCreatorsNameAttributeType(); |
| | | assertTrue(creatorsNameType.isOperational()); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(creatorsNameType); |
| | |
| | | FilterDescription description = new FilterDescription(); |
| | | |
| | | description.filterType = filterType; |
| | | description.attributeType = DirectoryServer.getAttributeType(attributeType); |
| | | description.attributeType = DirectoryServer.getSchema().getAttributeType(attributeType); |
| | | description.assertionValue = ByteString.valueOfUtf8(attributeValue); |
| | | |
| | | if (filterType == FilterType.EQUALITY) { |
| | |
| | | FilterDescription description = new FilterDescription(); |
| | | |
| | | description.filterType = FilterType.SUBSTRING; |
| | | description.attributeType = DirectoryServer.getAttributeType(attributeType); |
| | | description.attributeType = DirectoryServer.getSchema().getAttributeType(attributeType); |
| | | |
| | | description.subInitialElement = ByteString.valueOfUtf8(subInitial); |
| | | description.subAnyElements = new ArrayList<>(); |
| | |
| | | @Test |
| | | public void testParseAttributeNotFound() throws Exception { |
| | | AttributeType type1 = getDescriptionAttributeType(); |
| | | AttributeType type2 = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type2 = DirectoryServer.getSchema().getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type1, "hello world"); |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testParseAttributeBooleanTrue() throws Exception { |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "true"); |
| | | |
| | |
| | | @Test |
| | | public void testParseAttributeBooleanFalse() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "false"); |
| | | |
| | |
| | | @Test(expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testParseAttributeBooleanBad() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "bad-value"); |
| | | entry.parseAttribute(type.getNameOrOID()).asBoolean(); |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.ConflictBehavior; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.extensions.EntryDNVirtualAttributeProvider; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | entryDNType = CoreSchema.getEntryDNAttributeType(); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.ConflictBehavior; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.extensions.EntryDNVirtualAttributeProvider; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.Test; |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | entryDNType = CoreSchema.getEntryDNAttributeType(); |
| | | |
| | | EntryDNVirtualAttributeProvider provider = |
| | | new EntryDNVirtualAttributeProvider(); |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.forgerock.opendj.ldap.schema.CoreSchema; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeBuilder; |
| | | import org.opends.server.types.Attributes; |
| | |
| | | try (LDIFReader reader = createLDIFReader(ldifString)) { |
| | | Entry entry = reader.readEntry(); |
| | | Assert.assertNotNull(entry); |
| | | Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(), ByteString.valueOfUtf8("once upon a time in the west"))); |
| | | Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(), |
| | | ByteString.valueOfUtf8("once upon a time in the west"))); |
| | | } |
| | | } |
| | | |
| | |
| | | try (LDIFReader reader = createLDIFReader(ldifString)) { |
| | | Entry entry = reader.readEntry(); |
| | | Assert.assertNotNull(entry); |
| | | Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(), ByteString.valueOfUtf8("once upon a time in the west"))); |
| | | Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(), |
| | | ByteString.valueOfUtf8("once upon a time in the west"))); |
| | | } |
| | | } |
| | | |
| | |
| | | Assert.assertTrue(i.hasNext()); |
| | | mod = i.next().toModification(); |
| | | Assert.assertEquals(mod.getModificationType(), ModificationType.REPLACE); |
| | | attr = Attributes.empty(DirectoryServer.getAttributeType("postaladdress")); |
| | | attr = Attributes.empty(CoreSchema.getPostalAddressAttributeType()); |
| | | Assert.assertEquals(mod.getAttribute(), attr); |
| | | |
| | | // Change record #7. |