Renamed DirectoryServer.getAttributeType() to DirectoryServer.getAttributeTypeOrNull().
| | |
| | | |
| | | String name = value.trim().toLowerCase(); |
| | | AttributeType type = isCheckSchema |
| | | ? DirectoryServer.getAttributeType(name) |
| | | ? DirectoryServer.getAttributeTypeOrNull(name) |
| | | : DirectoryServer.getAttributeTypeOrDefault(name); |
| | | if (type == null) { |
| | | throw PropertyException.illegalPropertyValueException(this, value); |
| | |
| | | newPrivileges.addAll(DirectoryServer.getRootPrivileges()); |
| | | } |
| | | |
| | | AttributeType privType = |
| | | DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeType privType = DirectoryServer.getAttributeTypeOrNull(OP_ATTR_PRIVILEGE_NAME); |
| | | List<Attribute> attrList = entry.getAttribute(privType); |
| | | if (attrList != null) |
| | | { |
| | |
| | | { |
| | | if (aclRights == null) |
| | | { |
| | | aclRights = DirectoryServer.getAttributeType(aclRightsAttrStr |
| | | .toLowerCase()); |
| | | aclRights = DirectoryServer.getAttributeTypeOrNull(aclRightsAttrStr.toLowerCase()); |
| | | } |
| | | |
| | | if (aclRightsInfo == null) |
| | | { |
| | | aclRightsInfo = DirectoryServer.getAttributeType(aclRightsInfoAttrStr |
| | | .toLowerCase()); |
| | | aclRightsInfo = DirectoryServer.getAttributeTypeOrNull(aclRightsInfoAttrStr.toLowerCase()); |
| | | } |
| | | |
| | | if (dnAttributeType == null) |
| | | { |
| | | dnAttributeType = DirectoryServer.getAttributeType(dnAttrStr); |
| | | dnAttributeType = DirectoryServer.getAttributeTypeOrNull(dnAttrStr); |
| | | } |
| | | |
| | | // Check if the attributes aclRights and aclRightsInfo were requested and |
| | |
| | | AttributeType thatType = rdn.getAttributeType(0); |
| | | if (!typePatterns[0].equals("*")) |
| | | { |
| | | AttributeType thisType = |
| | | DirectoryServer.getAttributeType(typePatterns[0].toLowerCase()); |
| | | AttributeType thisType = DirectoryServer.getAttributeTypeOrNull(typePatterns[0].toLowerCase()); |
| | | if (thisType == null || !thisType.equals(thatType)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return matchValuePattern(valuePatterns.get(0), thatType, |
| | | rdn.getAttributeValue(0)); |
| | | return matchValuePattern(valuePatterns.get(0), thatType, rdn.getAttributeValue(0)); |
| | | } |
| | | |
| | | if (hasTypeWildcard) |
| | |
| | | for (int i = 0; i < numValues; i++) |
| | | { |
| | | String lowerName = typePatterns[i].toLowerCase(); |
| | | AttributeType type = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (type == null) |
| | | { |
| | | return false; |
| | |
| | | return false; |
| | | } |
| | | |
| | | if (!matchValuePattern(patternMap.get(rdnKey), |
| | | DirectoryServer.getAttributeType(rdnKey), |
| | | rdnMap.get(rdnKey))) |
| | | AttributeType rdnAttrType = DirectoryServer.getAttributeTypeOrNull(rdnKey); |
| | | if (!matchValuePattern(patternMap.get(rdnKey), rdnAttrType, rdnMap.get(rdnKey))) |
| | | { |
| | | return false; |
| | | } |
| | |
| | | * 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.getAttributeTypeOrNull(ATTR_REFERRAL_URL); |
| | | |
| | | /** |
| | | * A flag that indicates whether there are any referrals contained in this |
| | | * database. It should only be set to {@code false} when it is known that |
| | | * there are no referrals. |
| | | * A flag that indicates whether there are any referrals contained in this database. |
| | | * It should only be set to {@code false} when it is known that there are no referrals. |
| | | */ |
| | | private volatile ConditionResult containsReferrals = |
| | | ConditionResult.UNDEFINED; |
| | | private volatile ConditionResult containsReferrals = ConditionResult.UNDEFINED; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase()); |
| | | DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase()); |
| | | if(attrType == null) |
| | | { |
| | | unacceptableReasons.add(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], cfg.getName())); |
| | |
| | | { |
| | | throw attributeIndexNotConfigured(index); |
| | | } |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrIndexParts[0]); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrIndexParts[0]); |
| | | if (attrType == null) |
| | | { |
| | | throw attributeIndexNotConfigured(index); |
| | |
| | | } |
| | | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase()); |
| | | DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase()); |
| | | if(attrType == null) |
| | | { |
| | | throw new ConfigException(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], name)); |
| | |
| | | return false; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase()); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase()); |
| | | if(attrType == null) |
| | | { |
| | | unacceptableReasons.add(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], name)); |
| | |
| | | } |
| | | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase()); |
| | | DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase()); |
| | | if(attrType == null) |
| | | { |
| | | ccr.addMessage(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], name)); |
| | |
| | | } |
| | | else |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | throw new JebException(ERR_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index)); |
| | |
| | | * 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.getAttributeTypeOrNull(ATTR_REFERRAL_URL); |
| | | |
| | | /** |
| | | * A flag that indicates whether there are any referrals contained in this |
| | |
| | | return false; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase()); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase()); |
| | | if(attrType == null) |
| | | { |
| | | unacceptableReasons.add(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], cfg.getName())); |
| | |
| | | throw new ConfigException(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], getName())); |
| | | } |
| | | |
| | | final AttributeType attrType = DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase()); |
| | | final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase()); |
| | | if (attrType == null) |
| | | { |
| | | throw new ConfigException(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], getName())); |
| | |
| | | } |
| | | else |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | throw new StorageRuntimeException(ERR_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index).toString()); |
| | |
| | | |
| | | |
| | | // Get the schedule for this task. |
| | | attrType = DirectoryServer.getAttributeType(ATTR_RECURRING_TASK_SCHEDULE.toLowerCase()); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(ATTR_RECURRING_TASK_SCHEDULE.toLowerCase()); |
| | | if (attrType == null) |
| | | { |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_RECURRING_TASK_SCHEDULE); |
| | |
| | | weekdayArray = taskArrays[WEEKDAY_INDEX]; |
| | | |
| | | // Get the class name from the entry. If there isn't one, then fail. |
| | | attrType = DirectoryServer.getAttributeType(ATTR_TASK_CLASS.toLowerCase()); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(ATTR_TASK_CLASS.toLowerCase()); |
| | | if (attrType == null) |
| | | { |
| | | attrType = DirectoryServer.getDefaultAttributeType(ATTR_TASK_CLASS); |
| | |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String nextTaskID = task.getTaskID() + "-" + df.format(nextTaskDate); |
| | | String nextTaskIDName = NAME_PREFIX_TASK + "id"; |
| | | AttributeType taskIDAttrType = DirectoryServer.getAttributeType(nextTaskIDName); |
| | | AttributeType taskIDAttrType = DirectoryServer.getAttributeTypeOrNull(nextTaskIDName); |
| | | Attribute nextTaskIDAttr = Attributes.create(taskIDAttrType, nextTaskID); |
| | | nextTaskEntry.replaceAttribute(nextTaskIDAttr); |
| | | RDN nextTaskRDN = RDN.decode(nextTaskIDName + "=" + nextTaskID); |
| | |
| | | taskScheduler.getTaskBackend().getScheduledTasksParentDN()); |
| | | nextTaskEntry.setDN(nextTaskDN); |
| | | |
| | | String nextTaskStartTimeName = NAME_PREFIX_TASK + |
| | | "scheduled-start-time"; |
| | | AttributeType taskStartTimeAttrType = |
| | | DirectoryServer.getAttributeType(nextTaskStartTimeName); |
| | | Attribute nextTaskStartTimeAttr = Attributes.create( |
| | | taskStartTimeAttrType, nextTaskStartTime); |
| | | String nextTaskStartTimeName = NAME_PREFIX_TASK + "scheduled-start-time"; |
| | | AttributeType taskStartTimeAttrType = DirectoryServer.getAttributeTypeOrNull(nextTaskStartTimeName); |
| | | Attribute nextTaskStartTimeAttr = Attributes.create(taskStartTimeAttrType, nextTaskStartTime); |
| | | nextTaskEntry.replaceAttribute(nextTaskStartTimeAttr); |
| | | |
| | | nextTask.initializeTaskInternal(serverContext, taskScheduler, nextTaskEntry); |
| | |
| | | public void putConfigAttribute(ConfigAttribute attribute) |
| | | { |
| | | String name = attribute.getName(); |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(name.toLowerCase()); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(name.toLowerCase()); |
| | | if (attrType == null) |
| | | { |
| | | attrType = |
| | | DirectoryServer.getDefaultAttributeType(name, attribute.getSyntax()); |
| | | attrType = DirectoryServer.getDefaultAttributeType(name, attribute.getSyntax()); |
| | | } |
| | | |
| | | List<Attribute> attrs = new ArrayList<>(2); |
| | |
| | | { |
| | | reader.readStartSequence(); |
| | | String attrName = toLowerCase(reader.readOctetStringAsString()); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | if (attrType == null) |
| | | { |
| | | //This attribute is not defined in the schema. There is no point |
| | |
| | | ArrayList<SortKey> sortKeys = new ArrayList<>(); |
| | | for(String[] decodedKey : decodedKeyList) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(decodedKey[0].toLowerCase()); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(decodedKey[0].toLowerCase()); |
| | | if (attrType == null) |
| | | { |
| | | //This attribute is not defined in the schema. There is no point |
| | |
| | | * @return The requested attribute type, or <CODE>null</CODE> if there is no |
| | | * attribute with the specified type defined in the server schema. |
| | | */ |
| | | public static AttributeType getAttributeType(String lowerName) |
| | | public static AttributeType getAttributeTypeOrNull(String lowerName) |
| | | { |
| | | return directoryServer.schema.getAttributeType(lowerName); |
| | | } |
| | |
| | | String value = getAttrValue(entry, PWD_ATTR_ATTRIBUTE); |
| | | if (value != null && value.length() > 0) |
| | | { |
| | | this.pPasswordAttribute = DirectoryServer.getAttributeType(value.toLowerCase()); |
| | | this.pPasswordAttribute = DirectoryServer.getAttributeTypeOrNull(value.toLowerCase()); |
| | | if (this.pPasswordAttribute == null) |
| | | { |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | |
| | | import org.opends.server.admin.std.server.CryptoManagerCfg; |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.backends.TrustStoreBackend; |
| | | import org.opends.server.config.ConfigConstants; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | |
| | | this.serverContext = serverContext; |
| | | if (!schemaInitDone) { |
| | | // Initialize various schema references. |
| | | attrKeyID = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_KEY_ID); |
| | | attrPublicKeyCertificate = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrTransformation = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME); |
| | | attrMacAlgorithm = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_MAC_ALGORITHM_NAME); |
| | | attrSymmetricKey = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY); |
| | | attrInitVectorLength = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS); |
| | | attrKeyLength = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_KEY_LENGTH_BITS); |
| | | attrCompromisedTime = DirectoryServer.getAttributeType( |
| | | ConfigConstants.ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | ocCertRequest = DirectoryServer.getObjectClass( |
| | | "ds-cfg-self-signed-cert-request"); // TODO: ConfigConstants |
| | | ocInstanceKey = DirectoryServer.getObjectClass( |
| | | ConfigConstants.OC_CRYPTO_INSTANCE_KEY); |
| | | ocCipherKey = DirectoryServer.getObjectClass( |
| | | ConfigConstants.OC_CRYPTO_CIPHER_KEY); |
| | | ocMacKey = DirectoryServer.getObjectClass( |
| | | ConfigConstants.OC_CRYPTO_MAC_KEY); |
| | | attrKeyID = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_KEY_ID); |
| | | attrPublicKeyCertificate = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrTransformation = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME); |
| | | attrMacAlgorithm = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_MAC_ALGORITHM_NAME); |
| | | attrSymmetricKey = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_SYMMETRIC_KEY); |
| | | attrInitVectorLength = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS); |
| | | attrKeyLength = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_KEY_LENGTH_BITS); |
| | | attrCompromisedTime = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | ocCertRequest = DirectoryServer.getObjectClass("ds-cfg-self-signed-cert-request"); // TODO: ConfigConstants |
| | | ocInstanceKey = DirectoryServer.getObjectClass(OC_CRYPTO_INSTANCE_KEY); |
| | | ocCipherKey = DirectoryServer.getObjectClass(OC_CRYPTO_CIPHER_KEY); |
| | | ocMacKey = DirectoryServer.getObjectClass(OC_CRYPTO_MAC_KEY); |
| | | |
| | | try { |
| | | localTruststoreDN |
| | | = DN.valueOf(ConfigConstants.DN_TRUST_STORE_ROOT); |
| | | DN adminSuffixDN = DN.valueOf( |
| | | ADSContext.getAdministrationSuffixDN()); |
| | | instanceKeysDN = adminSuffixDN.child( |
| | | DN.valueOf("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.child( |
| | | DN.valueOf("cn=secret keys")); |
| | | serversDN = adminSuffixDN.child( |
| | | DN.valueOf("cn=Servers")); |
| | | localTruststoreDN = DN.valueOf(DN_TRUST_STORE_ROOT); |
| | | DN adminSuffixDN = DN.valueOf(ADSContext.getAdministrationSuffixDN()); |
| | | instanceKeysDN = adminSuffixDN.child(DN.valueOf("cn=instance keys")); |
| | | secretKeysDN = adminSuffixDN.child(DN.valueOf("cn=secret keys")); |
| | | serversDN = adminSuffixDN.child(DN.valueOf("cn=Servers")); |
| | | } |
| | | catch (DirectoryException ex) { |
| | | logger.traceException(ex); |
| | |
| | | private TrustStoreBackend getTrustStoreBackend() |
| | | throws ConfigException |
| | | { |
| | | Backend<?> b = DirectoryServer.getBackend(ConfigConstants.ID_ADS_TRUST_STORE_BACKEND); |
| | | Backend<?> b = DirectoryServer.getBackend(ID_ADS_TRUST_STORE_BACKEND); |
| | | if (b == null) |
| | | { |
| | | throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_NOT_ENABLED.get( |
| | | ConfigConstants.ID_ADS_TRUST_STORE_BACKEND)); |
| | | throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_NOT_ENABLED.get(ID_ADS_TRUST_STORE_BACKEND)); |
| | | } |
| | | if (!(b instanceof TrustStoreBackend)) |
| | | { |
| | | throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_WRONG_CLASS.get( |
| | | ConfigConstants.ID_ADS_TRUST_STORE_BACKEND)); |
| | | throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_WRONG_CLASS.get(ID_ADS_TRUST_STORE_BACKEND)); |
| | | } |
| | | return (TrustStoreBackend)b; |
| | | } |
| | |
| | | static byte[] getInstanceKeyCertificateFromLocalTruststore() |
| | | throws CryptoManagerException { |
| | | // Construct the key entry DN. |
| | | final ByteString distinguishedValue = ByteString.valueOf(ConfigConstants.ADS_CERTIFICATE_ALIAS); |
| | | final DN entryDN = localTruststoreDN.child( |
| | | RDN.create(attrKeyID, distinguishedValue)); |
| | | final ByteString distinguishedValue = ByteString.valueOf(ADS_CERTIFICATE_ALIAS); |
| | | final DN entryDN = localTruststoreDN.child(RDN.create(attrKeyID, distinguishedValue)); |
| | | // Construct the search filter. |
| | | final String FILTER_OC_INSTANCE_KEY = "(objectclass=" + ocInstanceKey.getNameOrOID() + ")"; |
| | | // Construct the attribute list. |
| | |
| | | // Retrieve instance-key-pair private key part. |
| | | PrivateKey privateKey; |
| | | try { |
| | | privateKey = (PrivateKey) getTrustStoreBackend() |
| | | .getKey(ConfigConstants.ADS_CERTIFICATE_ALIAS); |
| | | privateKey = (PrivateKey) getTrustStoreBackend().getKey(ADS_CERTIFICATE_ALIAS); |
| | | } |
| | | catch(ConfigException ce) |
| | | { |
| | |
| | | secretKey, keyLengthBits, ivLengthBits, isCompromised); |
| | | |
| | | // Write the value to the entry. |
| | | InternalClientConnection internalConnection = |
| | | InternalClientConnection.getRootConnection(); |
| | | Attribute attribute = Attributes.create( |
| | | ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey); |
| | | List<Modification> modifications = newArrayList( |
| | | new Modification(ModificationType.ADD, attribute, false)); |
| | | InternalClientConnection internalConnection = getRootConnection(); |
| | | Attribute attribute = Attributes.create(ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey); |
| | | List<Modification> modifications = newArrayList(new Modification(ModificationType.ADD, attribute, false)); |
| | | ModifyOperation internalModify = internalConnection.processModify(entry.getName(), modifications); |
| | | if (internalModify.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | |
| | | // Create the entry. |
| | | Entry entry = new Entry(entryDN, ocMap, userAttrs, opAttrs); |
| | | |
| | | InternalClientConnection connection = |
| | | InternalClientConnection.getRootConnection(); |
| | | AddOperation addOperation = connection.processAdd(entry); |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | | if (addOperation.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | | throw new CryptoManagerException( |
| | |
| | | else if (lowerTokenStr.startsWith("notification-user-attr:")) |
| | | { |
| | | String attrName = lowerTokenStr.substring(23); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | if (attrType == null) |
| | | { |
| | | throw new ConfigException( |
| | |
| | | return null; |
| | | } |
| | | |
| | | AttributeType userAttrType = DirectoryServer.getAttributeType(userAttrName); |
| | | AttributeType userAttrType = DirectoryServer.getAttributeTypeOrNull(userAttrName); |
| | | if (userAttrType == null) |
| | | { |
| | | ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION); |
| | |
| | | */ |
| | | private static String normalizeAttributeName(String attrName) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | if (attrType != null) |
| | | { |
| | | String attrNameNormalized = attrType.getNormalizedPrimaryNameOrOID(); |
| | |
| | | ? toAttr |
| | | : toAttr.substring(semicolonPos + 1); |
| | | |
| | | if (DirectoryServer.getAttributeType(toLowerCase(toAttrType)) == null) |
| | | if (DirectoryServer.getAttributeTypeOrNull(toLowerCase(toAttrType)) == null) |
| | | { |
| | | messages.add(ERR_PLUGIN_ATTR_CLEANUP_ATTRIBUTE_MISSING.get(toAttr)); |
| | | isValid = false; |
| | |
| | | |
| | | // Get the entryUUID attribute type. This needs to be done in the |
| | | // constructor in order to make the associated variables "final". |
| | | AttributeType at = DirectoryServer.getAttributeType(ENTRYUUID); |
| | | AttributeType at = DirectoryServer.getAttributeTypeOrNull(ENTRYUUID); |
| | | if (at == null) |
| | | { |
| | | String definition = |
| | |
| | | String attr = attrFilt.substring(0, sepInd); |
| | | String filtStr = attrFilt.substring(sepInd + 1); |
| | | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(attr.toLowerCase()); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr.toLowerCase()); |
| | | try |
| | | { |
| | | SearchFilter filter = |
| | | SearchFilter.createFilterFromString(filtStr); |
| | | SearchFilter filter = SearchFilter.createFilterFromString(filtStr); |
| | | newAttrFiltMap.put(attrType, filter); |
| | | } |
| | | catch (DirectoryException de) |
| | |
| | | * type has to be present in the attributeType list. |
| | | */ |
| | | |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(attr.toLowerCase()); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr.toLowerCase()); |
| | | if (attrType == null || !theAttributeTypes.contains(attrType)) |
| | | { |
| | | isAcceptable = false; |
| | |
| | | import java.util.concurrent.atomic.AtomicLong; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.admin.std.server.MonitorProviderCfg; |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.types.ObjectClass; |
| | | import org.opends.server.types.OperationType; |
| | | |
| | | /** |
| | | * This class defines a data structure that will be used to keep track |
| | |
| | | * and associated with their objectclass |
| | | * OC_MONITOR_CONNHANDLERSTATS |
| | | */ |
| | | attrs.add(createAttribute("connectionsEstablished", String |
| | | .valueOf(tmpConnectionsEstablished))); |
| | | attrs.add(createAttribute("connectionsClosed", String |
| | | .valueOf(tmpConnectionsClosed))); |
| | | attrs.add(createAttribute("bytesRead", String |
| | | .valueOf(tmpBytesRead))); |
| | | attrs.add(createAttribute("bytesWritten", String |
| | | .valueOf(tmpBytesWritten))); |
| | | attrs.add(createAttribute("ldapMessagesRead", String |
| | | .valueOf(tmpMessagesRead))); |
| | | attrs.add(createAttribute("ldapMessagesWritten", String |
| | | .valueOf(tmpMessagesWritten))); |
| | | attrs.add(createAttribute("operationsAbandoned", String |
| | | .valueOf(tmpOperationsAbandoned))); |
| | | attrs.add(createAttribute("operationsInitiated", String |
| | | .valueOf(tmpOperationsInitiated))); |
| | | attrs.add(createAttribute("operationsCompleted", String |
| | | .valueOf(tmpOperationsCompleted))); |
| | | attrs.add(createAttribute("abandonRequests", String |
| | | .valueOf(tmpAbandonRequests))); |
| | | attrs.add(createAttribute("addRequests", String |
| | | .valueOf(tmpAddRequests))); |
| | | attrs.add(createAttribute("addResponses", String |
| | | .valueOf(tmpAddResponses))); |
| | | attrs.add(createAttribute("bindRequests", String |
| | | .valueOf(tmpBindRequests))); |
| | | attrs.add(createAttribute("bindResponses", String |
| | | .valueOf(tmpBindResponses))); |
| | | attrs.add(createAttribute("compareRequests", String |
| | | .valueOf(tmpCompareRequests))); |
| | | attrs.add(createAttribute("compareResponses", String |
| | | .valueOf(tmpCompareResponses))); |
| | | attrs.add(createAttribute("deleteRequests", String |
| | | .valueOf(tmpDeleteRequests))); |
| | | attrs.add(createAttribute("deleteResponses", String |
| | | .valueOf(tmpDeleteResponses))); |
| | | attrs.add(createAttribute("extendedRequests", String |
| | | .valueOf(tmpExtendedRequests))); |
| | | attrs.add(createAttribute("extendedResponses", String |
| | | .valueOf(tmpExtendedResponses))); |
| | | attrs.add(createAttribute("modifyRequests", String |
| | | .valueOf(tmpModifyRequests))); |
| | | attrs.add(createAttribute("modifyResponses", String |
| | | .valueOf(tmpModifyResponses))); |
| | | attrs.add(createAttribute("modifyDNRequests", String |
| | | .valueOf(tmpModifyDNRequests))); |
| | | attrs.add(createAttribute("modifyDNResponses", String |
| | | .valueOf(tmpModifyDNResponses))); |
| | | attrs.add(createAttribute("searchRequests", String |
| | | .valueOf(tmpSearchRequests))); |
| | | attrs.add(createAttribute("searchOneRequests", String |
| | | .valueOf(tmpSearchOneRequests))); |
| | | attrs.add(createAttribute("searchSubRequests", String |
| | | .valueOf(tmpSearchSubRequests))); |
| | | attrs.add(createAttribute("searchResultEntries", String |
| | | .valueOf(tmpSearchEntries))); |
| | | attrs.add(createAttribute("searchResultReferences", String |
| | | .valueOf(tmpSearchReferences))); |
| | | attrs.add(createAttribute("searchResultsDone", String |
| | | .valueOf(tmpSearchResultsDone))); |
| | | attrs.add(createAttribute("unbindRequests", String |
| | | .valueOf(tmpUnbindRequests))); |
| | | attrs.add(createAttribute("connectionsEstablished", tmpConnectionsEstablished)); |
| | | attrs.add(createAttribute("connectionsClosed", tmpConnectionsClosed)); |
| | | attrs.add(createAttribute("bytesRead", tmpBytesRead)); |
| | | attrs.add(createAttribute("bytesWritten", tmpBytesWritten)); |
| | | attrs.add(createAttribute("ldapMessagesRead", tmpMessagesRead)); |
| | | attrs.add(createAttribute("ldapMessagesWritten", tmpMessagesWritten)); |
| | | attrs.add(createAttribute("operationsAbandoned", tmpOperationsAbandoned)); |
| | | attrs.add(createAttribute("operationsInitiated", tmpOperationsInitiated)); |
| | | attrs.add(createAttribute("operationsCompleted", tmpOperationsCompleted)); |
| | | attrs.add(createAttribute("abandonRequests", tmpAbandonRequests)); |
| | | attrs.add(createAttribute("addRequests", tmpAddRequests)); |
| | | attrs.add(createAttribute("addResponses", tmpAddResponses)); |
| | | attrs.add(createAttribute("bindRequests", tmpBindRequests)); |
| | | attrs.add(createAttribute("bindResponses", tmpBindResponses)); |
| | | attrs.add(createAttribute("compareRequests", tmpCompareRequests)); |
| | | attrs.add(createAttribute("compareResponses", tmpCompareResponses)); |
| | | attrs.add(createAttribute("deleteRequests", tmpDeleteRequests)); |
| | | attrs.add(createAttribute("deleteResponses", tmpDeleteResponses)); |
| | | attrs.add(createAttribute("extendedRequests", tmpExtendedRequests)); |
| | | attrs.add(createAttribute("extendedResponses", tmpExtendedResponses)); |
| | | attrs.add(createAttribute("modifyRequests", tmpModifyRequests)); |
| | | attrs.add(createAttribute("modifyResponses", tmpModifyResponses)); |
| | | attrs.add(createAttribute("modifyDNRequests", tmpModifyDNRequests)); |
| | | attrs.add(createAttribute("modifyDNResponses", tmpModifyDNResponses)); |
| | | attrs.add(createAttribute("searchRequests", tmpSearchRequests)); |
| | | attrs.add(createAttribute("searchOneRequests", tmpSearchOneRequests)); |
| | | attrs.add(createAttribute("searchSubRequests", tmpSearchSubRequests)); |
| | | attrs.add(createAttribute("searchResultEntries", tmpSearchEntries)); |
| | | attrs.add(createAttribute("searchResultReferences", tmpSearchReferences)); |
| | | attrs.add(createAttribute("searchResultsDone", tmpSearchResultsDone)); |
| | | attrs.add(createAttribute("unbindRequests", tmpUnbindRequests)); |
| | | |
| | | // adds |
| | | attrs.add(createAttribute("ds-mon-add-operations-total-count", |
| | | String.valueOf(tmpAddOperationCount))); |
| | | |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-add-operations-total-time", String |
| | | .valueOf(tmpAddOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-add-operations-total-count", tmpAddOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-add-operations-total-time", tmpAddOperationTime)); |
| | | |
| | | // search |
| | | attrs.add(createAttribute("ds-mon-search-operations-total-count", |
| | | String.valueOf(tmpSearchOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-search-operations-total-time", String |
| | | .valueOf(tmpSearchOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-search-operations-total-count", tmpSearchOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-search-operations-total-time", tmpSearchOperationTime)); |
| | | |
| | | // bind |
| | | attrs.add(createAttribute("ds-mon-bind-operations-total-count", |
| | | String.valueOf(tmpBindOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-bind-operations-total-time", String |
| | | .valueOf(tmpBindOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-bind-operations-total-count", tmpBindOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-bind-operations-total-time", tmpBindOperationTime)); |
| | | |
| | | // unbind |
| | | attrs.add(createAttribute("ds-mon-unbind-operations-total-count", |
| | | String.valueOf(tmpUnbindOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-unbind-operations-total-time", String |
| | | .valueOf(tmpUnbindOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-unbind-operations-total-count", tmpUnbindOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-unbind-operations-total-time", tmpUnbindOperationTime)); |
| | | |
| | | // compare |
| | | attrs |
| | | .add(createAttribute("ds-mon-compare-operations-total-count", |
| | | String.valueOf(tmpCompOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-compare-operations-total-time", String |
| | | .valueOf(tmpCompOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-compare-operations-total-count", tmpCompOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-compare-operations-total-time", tmpCompOperationTime)); |
| | | |
| | | // del |
| | | attrs.add(createAttribute("ds-mon-delete-operations-total-count", |
| | | String.valueOf(tmpDelOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-delete-operations-total-time", String |
| | | .valueOf(tmpDelOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-delete-operations-total-count", tmpDelOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-delete-operations-total-time", tmpDelOperationTime)); |
| | | |
| | | // mod |
| | | attrs.add(createAttribute("ds-mon-mod-operations-total-count", |
| | | String.valueOf(tmpModOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-mod-operations-total-time", String |
| | | .valueOf(tmpModOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-mod-operations-total-count", tmpModOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-mod-operations-total-time", tmpModOperationTime)); |
| | | |
| | | // moddn |
| | | attrs.add(createAttribute("ds-mon-moddn-operations-total-count", |
| | | String.valueOf(tmpModdnOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-moddn-operations-total-time", String |
| | | .valueOf(tmpModdnOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-moddn-operations-total-count", tmpModdnOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-moddn-operations-total-time", tmpModdnOperationTime)); |
| | | |
| | | // abandon |
| | | attrs |
| | | .add(createAttribute("ds-mon-abandon-operations-total-count", |
| | | String.valueOf(tmpAbandonOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-abandon-operations-total-time", String |
| | | .valueOf(tmpAbandonOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-abandon-operations-total-count", tmpAbandonOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-abandon-operations-total-time", tmpAbandonOperationTime)); |
| | | |
| | | // extended |
| | | attrs |
| | | .add(createAttribute("ds-mon-extended-operations-total-count", |
| | | String.valueOf(tmpExtOperationCount))); |
| | | attrs.add(createAttribute( |
| | | "ds-mon-resident-time-extended-operations-total-time", String |
| | | .valueOf(tmpExtOperationTime))); |
| | | attrs.add(createAttribute("ds-mon-extended-operations-total-count", tmpExtOperationCount)); |
| | | attrs.add(createAttribute("ds-mon-resident-time-extended-operations-total-time", tmpExtOperationTime)); |
| | | |
| | | return attrs; |
| | | } |
| | |
| | | * The value to use for the attribute. |
| | | * @return the constructed attribute. |
| | | */ |
| | | protected Attribute createAttribute(String name, String value) |
| | | protected Attribute createAttribute(String name, Object value) |
| | | { |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(name.toLowerCase()); |
| | | return Attributes.create(attrType, value); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(name.toLowerCase()); |
| | | return Attributes.create(attrType, String.valueOf(value)); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public long getConnectionsEstablished() |
| | | { |
| | | return connectionsEstablished.get(); |
| | | return connectionsEstablished.get(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public long getConnectionsClosed() |
| | | { |
| | | return connectionsClosed.get(); |
| | | |
| | | return connectionsClosed.get(); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public static void setHistoricalAttrToOperation(PreOperationAddOperation addOperation) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(HISTORICAL_ATTRIBUTE_NAME); |
| | | String attrValue = encodeHistorical(OperationContext.getCSN(addOperation), "add"); |
| | | List<Attribute> attrs = Attributes.createAsList(attrType, attrValue); |
| | | addOperation.setAttribute(attrType, attrs); |
| | |
| | | purgeDate = TimeThread.getTime() - purgeDelayInMillisec; |
| | | } |
| | | |
| | | AttributeType historicalAttrType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME); |
| | | AttributeType historicalAttrType = DirectoryServer.getAttributeTypeOrNull(HISTORICAL_ATTRIBUTE_NAME); |
| | | AttributeBuilder builder = new AttributeBuilder(historicalAttrType); |
| | | |
| | | for (Map.Entry<AttributeDescription, AttrHistorical> mapEntry : attributesHistorical.entrySet()) |
| | |
| | | */ |
| | | public static String getEntryUUID(Entry entry) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = entry.getOperationalAttribute(attrType); |
| | | return extractEntryUUID(uuidAttrs, entry.getName()); |
| | | } |
| | |
| | | */ |
| | | public static String getEntryUUID(PreOperationAddOperation op) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = op.getOperationalAttributes().get(attrType); |
| | | return extractEntryUUID(uuidAttrs, op.getEntryDN()); |
| | | } |
| | |
| | | |
| | | private Attribute getAttribute(String attributeName, Entry entry) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attributeName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attributeName); |
| | | List<Attribute> inclAttrs = entry.getAttribute(attrType); |
| | | if (inclAttrs != null) |
| | | { |
| | |
| | | final SearchResultEntry resultEntry = getFirstResult(searchOperation); |
| | | if (resultEntry != null) |
| | | { |
| | | AttributeType synchronizationGenIDType = |
| | | DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = |
| | | resultEntry.getAttribute(synchronizationGenIDType); |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | if (attrs != null) |
| | | { |
| | | Attribute attr = attrs.get(0); |
| | |
| | | return null; |
| | | } |
| | | |
| | | private Iterator<String> getAttributeValueIterator( |
| | | SearchResultEntry resultEntry, String attrName) |
| | | private Iterator<String> getAttributeValueIterator(SearchResultEntry resultEntry, String attrName) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName); |
| | | List<Attribute> exclAttrs = resultEntry.getAttribute(attrType); |
| | | if (exclAttrs != null) |
| | | { |
| | |
| | | { |
| | | for (String attrName : attrNames) |
| | | { |
| | | if (DirectoryServer.getAttributeType(attrName).equals(attrTypeToFind)) |
| | | if (DirectoryServer.getAttributeTypeOrNull(attrName).equals(attrTypeToFind)) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | SearchResultEntry resultEntry = result.get(0); |
| | | if (resultEntry != null) |
| | | { |
| | | AttributeType synchronizationGenIDType = |
| | | DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = |
| | | resultEntry.getAttribute(synchronizationGenIDType); |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | if (attrs != null) |
| | | { |
| | | Attribute attr = attrs.get(0); |
| | |
| | | */ |
| | | private void updateStateFromEntry(SearchResultEntry resultEntry) |
| | | { |
| | | AttributeType synchronizationStateType = |
| | | DirectoryServer.getAttributeType(REPLICATION_STATE); |
| | | AttributeType synchronizationStateType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_STATE); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationStateType); |
| | | if (attrs != null) |
| | | { |
| | |
| | | */ |
| | | private final void checkAndUpdateServerState() |
| | | { |
| | | final AttributeType histType = DirectoryServer.getAttributeType( |
| | | EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | final AttributeType histType = DirectoryServer.getAttributeTypeOrNull(EntryHistorical.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.getAttributeTypeOrNull(attrName); |
| | | return new VirtualAttributeRule(attributeType, provider, |
| | | baseDNs, SearchScope.BASE_OBJECT, |
| | | groupDNs, filters, conflictBehavior); |
| | |
| | | toLowerCase(attributeName, lowerName, true); |
| | | String attributeNameString = attributeName.toString(); |
| | | AttributeType attrType = getAttributeType(lowerName.toString(), attributeNameString); |
| | | rdnComponents.add( |
| | | new RDN(attrType, attributeNameString, ByteString.empty())); |
| | | rdnComponents.add(new RDN(attrType, attributeNameString, ByteString.empty())); |
| | | return new DN(rdnComponents); |
| | | } |
| | | |
| | |
| | | // Create the new RDN with the provided information. |
| | | StringBuilder lowerName = new StringBuilder(); |
| | | toLowerCase(attributeName, lowerName, true); |
| | | AttributeType attrType = |
| | | DirectoryServer.getAttributeType(lowerName.toString()); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName.toString()); |
| | | String attributeNameString = attributeName.toString(); |
| | | if (attrType == null) |
| | | { |
| | |
| | | { |
| | | lowerName = new StringBuilder(); |
| | | toLowerCase(attributeName, lowerName, true); |
| | | attrType = |
| | | DirectoryServer.getAttributeType(lowerName.toString()); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(lowerName.toString()); |
| | | attributeNameString = attributeName.toString(); |
| | | |
| | | if (attrType == null) |
| | |
| | | |
| | | lowerName = new StringBuilder(); |
| | | toLowerCase(attributeName, lowerName, true); |
| | | attrType = |
| | | DirectoryServer.getAttributeType(lowerName.toString()); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(lowerName.toString()); |
| | | attributeNameString = attributeName.toString(); |
| | | if (attrType == null) |
| | | { |
| | |
| | | { |
| | | name = attributeName.toString(); |
| | | lowerName = toLowerCase(name); |
| | | attrType = DirectoryServer.getAttributeType(lowerName); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | |
| | | if (attrType == null) |
| | | { |
| | |
| | | // Create the new RDN with the provided information. |
| | | name = attributeName.toString(); |
| | | lowerName = toLowerCase(name); |
| | | attrType = DirectoryServer.getAttributeType(lowerName); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | // This must be an attribute type that we don't know about. |
| | |
| | | |
| | | private static AttributeType getAttributeType(String lowerName, String name) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | // This must be an attribute type that we don't know about. |
| | |
| | | } |
| | | |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrTypeName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeName); |
| | | if (attrType == null) |
| | | { |
| | | // This should not happen |
| | | // The server doesn't have this attribute type defined. |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace( |
| | | "No %s attribute type is defined in the server schema.", |
| | | attrTypeName); |
| | | logger.trace("No %s attribute type is defined in the server schema.", attrTypeName); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | public Set<String> getReferralURLs() |
| | | { |
| | | AttributeType referralType = |
| | | DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); |
| | | AttributeType referralType = DirectoryServer.getAttributeTypeOrNull(ATTR_REFERRAL_URL); |
| | | if (referralType == null) |
| | | { |
| | | // This should not happen -- The server doesn't have a ref |
| | | // attribute type defined. |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace( |
| | | "No %s attribute type is defined in the server schema.", |
| | | ATTR_REFERRAL_URL); |
| | | } |
| | | // This should not happen -- The server doesn't have a ref attribute type defined. |
| | | logger.trace("No %s attribute type is defined in the server schema.", ATTR_REFERRAL_URL); |
| | | return null; |
| | | } |
| | | |
| | |
| | | */ |
| | | public DN getAliasedDN() throws DirectoryException |
| | | { |
| | | AttributeType aliasType = |
| | | DirectoryServer.getAttributeType(ATTR_REFERRAL_URL); |
| | | AttributeType aliasType = DirectoryServer.getAttributeTypeOrNull(ATTR_REFERRAL_URL); |
| | | if (aliasType == null) |
| | | { |
| | | // This should not happen -- The server doesn't have an |
| | | // aliasedObjectName attribute type defined. |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace( |
| | | "No %s attribute type is defined in the server schema.", |
| | | ATTR_ALIAS_DN); |
| | | } |
| | | // This should not happen -- The server doesn't have an aliasedObjectName attribute type defined. |
| | | logger.trace("No %s attribute type is defined in the server schema.", ATTR_ALIAS_DN); |
| | | return null; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // Get collective attribute exclusions. |
| | | AttributeType exclusionsType = DirectoryServer.getAttributeType( |
| | | ATTR_COLLECTIVE_EXCLUSIONS_LC); |
| | | List<Attribute> exclusionsAttrList = |
| | | operationalAttributes.get(exclusionsType); |
| | | AttributeType exclusionsType = DirectoryServer.getAttributeTypeOrNull(ATTR_COLLECTIVE_EXCLUSIONS_LC); |
| | | List<Attribute> exclusionsAttrList = operationalAttributes.get(exclusionsType); |
| | | Set<String> exclusionsNameSet = new HashSet<>(); |
| | | if (exclusionsAttrList != null && !exclusionsAttrList.isEmpty()) |
| | | { |
| | |
| | | options = null; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | // Unrecognized attribute type - do best effort search. |
| | |
| | | // don't return it yet because this could be a multi-valued RDN. |
| | | String name = attributeName.toString(); |
| | | String lowerName = toLowerCase(name); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | // This must be an attribute type that we don't know about. |
| | |
| | | { |
| | | name = attributeName.toString(); |
| | | lowerName = toLowerCase(name); |
| | | attrType = DirectoryServer.getAttributeType(lowerName); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | |
| | | if (attrType == null) |
| | | { |
| | |
| | | // Update the RDN to include the new attribute/value. |
| | | name = attributeName.toString(); |
| | | lowerName = toLowerCase(name); |
| | | attrType = DirectoryServer.getAttributeType(lowerName); |
| | | attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | if (attrType == null) |
| | | { |
| | | // This must be an attribute type that we don't know about. |
| | |
| | | |
| | | private static AttributeType getAttributeType(String attrType, StringBuilder lowerType) |
| | | { |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(lowerType.toString()); |
| | | AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(lowerType.toString()); |
| | | if (attributeType == null) |
| | | { |
| | | String typeStr = attrType.substring(0, lowerType.length()); |
| | |
| | | byte[] data = { 0x00, 0x01, 0x02, (byte) 0xff }; |
| | | |
| | | ByteString attrValue = ByteString.wrap(data); |
| | | Attribute attribute = Attributes.create(DirectoryServer.getAttributeType("cn"), attrValue); |
| | | Attribute attribute = Attributes.create(DirectoryServer.getAttributeTypeOrNull("cn"), attrValue); |
| | | assertThat(from(attribute).firstValue().toByteArray()).isEqualTo(data); |
| | | } |
| | | |
| | |
| | | public void testValidateValue() { |
| | | AttributeTypePropertyDefinition.setCheckSchema(true); |
| | | AttributeTypePropertyDefinition d = createPropertyDefinition(); |
| | | d.validateValue(DirectoryServer.getAttributeType("cn")); |
| | | d.validateValue(DirectoryServer.getAttributeTypeOrNull("cn")); |
| | | } |
| | | |
| | | |
| | |
| | | public void testDecodeValue(String value) { |
| | | AttributeTypePropertyDefinition.setCheckSchema(true); |
| | | AttributeTypePropertyDefinition d = createPropertyDefinition(); |
| | | AttributeType expected = DirectoryServer.getAttributeType(value); |
| | | AttributeType expected = DirectoryServer.getAttributeTypeOrNull(value); |
| | | assertEquals(d.decodeValue(value), expected); |
| | | } |
| | | |
| | |
| | | |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn |
| | | .getInstance(), "test child new", null); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | child.setAggregationProperty(Collections |
| | | .singleton("LDAP Connection Handler")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.setAggregationProperty(Collections.singleton("LDAP Connection Handler")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn |
| | | .getInstance(), "test child new", null); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | public void testCreateManagedObjectException(final NamingException cause, |
| | | Class<? extends Exception> expected) { |
| | | MockLDAPConnection c = new MockLDAPConnection() { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void createEntry(LdapName dn, Attributes attributes) |
| | | throws NamingException { |
| | | public void createEntry(LdapName dn, Attributes attributes) throws NamingException { |
| | | throw cause; |
| | | } |
| | | |
| | | }; |
| | | c.importLDIF(TEST_LDIF); |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | try { |
| | | TestParentCfgClient parent = createTestParent(ctx, "test parent new"); |
| | | parent.setMandatoryBooleanProperty(true); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | parent.commit(); |
| | | } catch (Exception e) { |
| | | Assert.assertEquals(e.getClass(), expected); |
| | |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = createTestParent(ctx, "test parent new"); |
| | | parent.setMandatoryBooleanProperty(true); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | parent.commit(); |
| | | c.assertEntryIsCreated(); |
| | | } |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value c3v1,dc=com", "dc=default value c3v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com"); |
| | | } |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | } |
| | |
| | | |
| | | // Check that the default values are not committed. |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | |
| | | // Check that the default values are not committed. |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn |
| | | .getInstance(), "test child new", null); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.commit(); |
| | | |
| | | c.assertEntryIsCreated(); |
| | |
| | | |
| | | ManagementContext ctx = LDAPManagementContext.createFromContext(c); |
| | | TestParentCfgClient parent = getTestParent(ctx, "test parent 1"); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn |
| | | .getInstance(), "test child new", null); |
| | | TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null); |
| | | child.setMandatoryBooleanProperty(true); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer |
| | | .getAttributeType("description")); |
| | | child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description")); |
| | | child.commit(); |
| | | Assert.fail("The add constraint failed to prevent creation of the managed object"); |
| | | } finally { |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertSetEquals(child.getAggregationProperty(), new String[0]); |
| | | } |
| | | |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | |
| | | // Test normalization. |
| | | assertSetEquals(child.getAggregationProperty(), "LDAP Connection Handler"); |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertSetEquals(child.getAggregationProperty(), "LDAPS Connection Handler", |
| | | "LDAP Connection Handler"); |
| | | } |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=new value 1,dc=com", "dc=new value 2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=new value 1,dc=com", "dc=new value 2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=new value 1,dc=com", "dc=new value 2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | } |
| | |
| | | Assert.assertEquals(parent.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(), |
| | | "dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com"); |
| | | } |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value c2v1,dc=com", "dc=default value c2v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value c3v1,dc=com", "dc=default value c3v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | Assert.assertEquals(child.getMandatoryClassProperty(), |
| | | "org.opends.server.extensions.UserDefinedVirtualAttributeProvider"); |
| | | Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(), |
| | | DirectoryServer.getAttributeType("description")); |
| | | DirectoryServer.getAttributeTypeOrNull("description")); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(), |
| | | "dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com"); |
| | | assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(), |
| | |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType("attributetypes"); |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("objectclasses"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("ldapsyntaxes"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("matchingrules"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | } |
| | | |
| | |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType("attributetypes"); |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("objectclasses"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("ldapsyntaxes"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("matchingrules"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | |
| | |
| | | assertNotNull(schemaEntry); |
| | | assertEquals(schemaEntry.getName(), schemaDN); |
| | | |
| | | t = DirectoryServer.getAttributeType("attributetypes"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("objectclasses"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("ldapsyntaxes"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | |
| | | t = DirectoryServer.getAttributeType("matchingrules"); |
| | | t = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | assertTrue(schemaEntry.hasAttribute(t)); |
| | | } |
| | | |
| | |
| | | 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 = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | AttributeType o = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | AttributeType m = DirectoryServer.getAttributeTypeOrNull("matchingrules"); |
| | | AttributeType s = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes"); |
| | | |
| | | assertFalse(schemaBackend.showAllAttributes()); |
| | | Entry schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false); |
| | |
| | | "ou: People" |
| | | ); |
| | | |
| | | givenName = DirectoryServer.getAttributeType("givenname"); |
| | | title = DirectoryServer.getAttributeType("title"); |
| | | name = DirectoryServer.getAttributeType("name"); |
| | | givenName = DirectoryServer.getAttributeTypeOrNull("givenname"); |
| | | title = DirectoryServer.getAttributeTypeOrNull("title"); |
| | | name = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | } |
| | | |
| | | @AfterClass |
| | |
| | | |
| | | assertEquals(resultCode, 0); |
| | | |
| | | AttributeType givennameAttr = DirectoryServer.getAttributeType("givenname"); |
| | | AttributeType givennameAttr = DirectoryServer.getAttributeTypeOrNull("givenname"); |
| | | assertNull(ec.getAttributeIndex(givennameAttr)); |
| | | |
| | | List<DatabaseContainer> databases = new ArrayList<>(); |
| | |
| | | Entry entry = entryContainer.getEntry(DN.valueOf("uid=user.446,dc=importtest1,dc=com")); |
| | | assertNotNull(entry); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | assertTrue(entry.hasValue(attrType, null, ByteString.valueOf("Annalee Bogard"))); |
| | | |
| | | assertEquals(verifyBackend(importtest1DN), 0); |
| | |
| | | TestCaseUtils.startServer(); |
| | | TestCaseUtils.enableBackend(beID); |
| | | |
| | | SortKey[] sortKeys = new SortKey[3]; |
| | | sortKeys[0] = new SortKey(DirectoryServer.getAttributeType("givenname"), true); |
| | | sortKeys[1] = new SortKey(DirectoryServer.getAttributeType("sn"), |
| | | false); |
| | | sortKeys[2] = new SortKey( |
| | | DirectoryServer.getAttributeType("uid"), true); |
| | | SortKey[] sortKeys = new SortKey[] { |
| | | new SortKey(DirectoryServer.getAttributeTypeOrNull("givenname"), true), |
| | | new SortKey(DirectoryServer.getAttributeTypeOrNull("sn"), false), |
| | | new SortKey(DirectoryServer.getAttributeTypeOrNull("uid"), true), |
| | | }; |
| | | sortOrder = new SortOrder(sortKeys); |
| | | |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=vlvtest,dc=com"); |
| | |
| | | eContainer.sharedLock.lock(); |
| | | try |
| | | { |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(phoneType); |
| | | AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(phoneType); |
| | | Index index = eContainer.getAttributeIndex(attributeType).getIndex(EQUALITY_TELEPHONE); |
| | | //Add entry with bad JEB format Version |
| | | addID2EntryReturnKey(junkDN, 4, true); |
| | |
| | | eContainer.sharedLock.lock(); |
| | | try |
| | | { |
| | | AttributeType attributeType = |
| | | DirectoryServer.getAttributeType(mailType); |
| | | AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(mailType); |
| | | //Get db handles to each index. |
| | | AttributeIndex attributeIndex = eContainer.getAttributeIndex(attributeType); |
| | | Index eqIndex = attributeIndex.getIndex(EQUALITY_CASE_IGNORE); |
| | |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | for (Map.Entry<String, IndexType[]> index : backendIndexes.entrySet()) |
| | | { |
| | | final String attributeName = index.getKey().toLowerCase(); |
| | | final AttributeType attribute = DirectoryServer.getAttributeType(attributeName); |
| | | final AttributeType attribute = DirectoryServer.getAttributeTypeOrNull(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().toLowerCase()); |
| | | final AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(index.getKey().toLowerCase()); |
| | | 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.getAttributeTypeOrNull("jpegphoto"); |
| | | newEntry.applyModifications(Arrays.asList(new Modification(ADD, create(modifyAttribute, modifyValue)))); |
| | | |
| | | backend.replaceEntry(oldEntry, newEntry, null); |
| | |
| | | |
| | | BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class); |
| | | when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY)); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn")); |
| | | when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn")); |
| | | when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg); |
| | | |
| | | return backendCfg; |
| | |
| | | } |
| | | |
| | | |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | ByteString attVal = null; |
| | | if (attType != null) |
| | | { |
| | |
| | | |
| | | // input parameter |
| | | String rawAttTypeTest = type; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeType(type); |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeTypeOrNull(type); |
| | | ByteString subInitialTest = ByteString.valueOf(subInitial); |
| | | List<ByteString> subAnyTest = new ArrayList<>(subAny.size()); |
| | | for (String s : subAny) |
| | |
| | | } |
| | | |
| | | // ( AttributeType attributeType, ByteString assertionValue |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | ByteString attVal = null; |
| | | if (attType != null) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | ByteString attVal = null ; |
| | | if (attType != null) |
| | | { |
| | |
| | | assertEquals(mvf.getMatchType(), MatchedValuesFilter.PRESENT_TYPE); |
| | | |
| | | // ( AttributeType attributeType |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | // ( AttributeType attributeType, ByteString assertionValue |
| | | AttributeType attType = DirectoryServer.getAttributeType(type); |
| | | AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type); |
| | | ByteString attVal = null ; |
| | | if (attType != null) |
| | | { |
| | |
| | | |
| | | // input value |
| | | String rawAttTypeTest = type ; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeType(type) ; |
| | | AttributeType attTypeTest = DirectoryServer.getAttributeTypeOrNull(type) ; |
| | | String matchingRuleIdTest = matchingRule.getOID() ; |
| | | ByteString attValueTest = (attTypeTest == null) ? null : ByteString.valueOf(value); |
| | | // parameter used for the test. |
| | |
| | | public void testDifferentNormalization(String type, ByteString value, |
| | | String assertion) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeType("usercertificate"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("usercertificate"); |
| | | MatchedValuesFilter mvf = MatchedValuesFilter.createEqualityFilter(type, ByteString.valueOf(assertion)); |
| | | assertTrue(mvf.valueMatches(attrType, value)); |
| | | } |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | givenNameType = DirectoryServer.getAttributeType("givenname"); |
| | | givenNameType = DirectoryServer.getAttributeTypeOrNull("givenname"); |
| | | assertNotNull(givenNameType); |
| | | |
| | | snType = DirectoryServer.getAttributeType("sn"); |
| | | snType = DirectoryServer.getAttributeTypeOrNull("sn"); |
| | | assertNotNull(snType); |
| | | |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com"); |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | givenNameType = DirectoryServer.getAttributeType("givenname"); |
| | | givenNameType = DirectoryServer.getAttributeTypeOrNull("givenname"); |
| | | assertNotNull(givenNameType); |
| | | |
| | | snType = DirectoryServer.getAttributeType("sn"); |
| | | snType = DirectoryServer.getAttributeTypeOrNull("sn"); |
| | | assertNotNull(snType); |
| | | |
| | | aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com"); |
| | |
| | | "objectClass: organization", |
| | | "o: test"); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("description"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | Map<AttributeType,List<Attribute>> userAttrs = entry.getUserAttributes(); |
| | | userAttrs.put(attrType, newArrayList(Attributes.empty(attrType))); |
| | | |
| | |
| | | { |
| | | PasswordPolicy p = DirectoryServer.getDefaultPasswordPolicy(); |
| | | AttributeType t = p.getPasswordAttribute(); |
| | | assertEquals(t, DirectoryServer.getAttributeType("userpassword")); |
| | | assertEquals(t, DirectoryServer.getAttributeTypeOrNull("userpassword")); |
| | | } |
| | | |
| | | |
| | |
| | | "cn=config"); |
| | | PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn); |
| | | AttributeType t = p.getPasswordAttribute(); |
| | | assertEquals(t, DirectoryServer.getAttributeType("authpassword")); |
| | | assertEquals(t, DirectoryServer.getAttributeTypeOrNull("authpassword")); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(DN.valueOf(dn)); |
| | | assertNotNull(entry); |
| | | AttributeType pwdHistory = DirectoryServer.getAttributeType("pwdhistory"); |
| | | AttributeType pwdHistory = DirectoryServer.getAttributeTypeOrNull("pwdhistory"); |
| | | assertNotNull(pwdHistory); |
| | | Attribute historyAttr = entry.getExactAttribute(pwdHistory, null); |
| | | assertNotNull(historyAttr); |
| | |
| | | private void hasValues(DN dn, String attrTypeLower, String... values) throws DirectoryException |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrTypeLower); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeLower); |
| | | assertTrue(entry.hasAttribute(attrType)); |
| | | for (String value : values) |
| | | { |
| | |
| | | private void doesNotHaveValues(DN dn, String attrTypeLower, String... values) throws DirectoryException |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrTypeLower); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeLower); |
| | | assertTrue(entry.hasAttribute(attrType)); |
| | | for (String value : values) |
| | | { |
| | |
| | | private void hasNoAttribute(DN dn, String lowerName) throws Exception |
| | | { |
| | | Entry entry = DirectoryServer.getEntry(dn); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(lowerName); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName); |
| | | assertFalse(entry.hasAttribute(attrType)); |
| | | } |
| | | |
| | |
| | | |
| | | assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertEquals(searchOperation.getEntriesSent(), 1); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("collectiveattributesubentries"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("collectiveattributesubentries"); |
| | | Entry e = searchOperation.getSearchEntries().getFirst(); |
| | | assertTrue(e.hasValue(attrType, null, ByteString.valueOf(collectiveSubentry.getName()))); |
| | | } |
| | |
| | | public void testPasswordPolicySubentryAttribute() |
| | | throws Exception |
| | | { |
| | | PasswordPolicy defaultPolicy = |
| | | DirectoryServer.getDefaultPasswordPolicy(); |
| | | PasswordPolicy defaultPolicy = DirectoryServer.getDefaultPasswordPolicy(); |
| | | assertNotNull(defaultPolicy); |
| | | |
| | | Entry testEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + BASE)); |
| | | Entry testEntry = DirectoryServer.getEntry(DN.valueOf("uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType( |
| | | "pwdpolicysubentry"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("pwdpolicysubentry"); |
| | | |
| | | // Make sure that default policy is in effect |
| | | // for the user entry. |
| | |
| | | ); |
| | | |
| | | // Make sure just added policy is in effect. |
| | | testEntry = DirectoryServer.getEntry(DN.valueOf( |
| | | "uid=rogasawara," + BASE)); |
| | | testEntry = DirectoryServer.getEntry(DN.valueOf("uid=rogasawara," + BASE)); |
| | | assertNotNull(testEntry); |
| | | |
| | | assertTrue(testEntry.hasAttribute(attrType)); |
| | | assertTrue(testEntry.hasValue(attrType, null, |
| | | ByteString.valueOf("cn=Temp Policy," + SUFFIX))); |
| | | assertTrue(testEntry.hasValue(attrType, null, ByteString.valueOf("cn=Temp Policy," + SUFFIX))); |
| | | |
| | | // Remove subentry policy and make sure |
| | | // default policy is in effect again. |
| | |
| | | assertEquals(newEntry.getName().toString(), |
| | | "uid=USER.0,ou=People,dc=example,dc=com"); |
| | | |
| | | AttributeType at = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType at = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | |
| | | // There should be only one value for "uid" |
| | |
| | | assertEquals(newEntry.getName().toString(), |
| | | "uid=UserID.0+cn=Test,ou=People,dc=example,dc=com"); |
| | | |
| | | AttributeType at = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType at = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | |
| | | // There should be only one value for "uid" |
| | |
| | | assertEquals(newEntry.getName().toString(), |
| | | "uid=userid.0+sn=JENSEN,ou=People,dc=example,dc=com"); |
| | | |
| | | AttributeType at = DirectoryServer.getAttributeType("sn"); |
| | | AttributeType at = DirectoryServer.getAttributeTypeOrNull("sn"); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | |
| | | // There should be only one value for "sn" |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Initialize the provider. |
| | | config.getExcludedAttribute().add(DirectoryServer.getAttributeType("modifytimestamp")); |
| | | config.getExcludedAttribute().add(DirectoryServer.getAttributeTypeOrNull("modifytimestamp")); |
| | | provider.initializeVirtualAttributeProvider(config); |
| | | } |
| | | |
| | |
| | | final SearchOperation searchOp = mock(SearchOperation.class); |
| | | |
| | | VirtualAttributeRule rule = new VirtualAttributeRule( |
| | | DirectoryServer.getAttributeType(ETAG), provider, |
| | | DirectoryServer.getAttributeTypeOrNull(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.getAttributeTypeOrNull("etag"); |
| | | return new VirtualAttributeRule(type, provider, |
| | | Collections.<DN>emptySet(), SearchScope.WHOLE_SUBTREE, |
| | | Collections.<DN>emptySet(), |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryUUIDType = DirectoryServer.getAttributeType("entryuuid"); |
| | | entryUUIDType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | assertNotNull(entryUUIDType); |
| | | } |
| | | |
| | |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-match-attribute: uid"); |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeType("ds-cfg-match-base-dn"); |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrNull("ds-cfg-match-base-dn"); |
| | | e.addAttribute(Attributes.empty(t), new ArrayList<ByteString>()); |
| | | entries.add(e); |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Tests to ensure that an attmept to remove the fingerprint attribute will |
| | | * fail. |
| | | * Tests to ensure that an attmept to remove the fingerprint attribute will fail. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test |
| | | public void testRemoveFingerprintAttribute() |
| | | throws Exception |
| | | public void testRemoveFingerprintAttribute() throws Exception |
| | | { |
| | | String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config"; |
| | | |
| | | Attribute a = |
| | | Attributes.empty(DirectoryServer.getAttributeType( |
| | | "ds-cfg-fingerprint-attribute")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-fingerprint-attribute")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a)); |
| | | ModifyOperation modifyOperation = |
| | |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test |
| | | public void testRemoveFingerprintAlgorithm() |
| | | throws Exception |
| | | public void testRemoveFingerprintAlgorithm() throws Exception |
| | | { |
| | | String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config"; |
| | | |
| | | Attribute a = |
| | | Attributes.empty(DirectoryServer.getAttributeType( |
| | | "ds-cfg-fingerprint-algorithm")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-fingerprint-algorithm")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a)); |
| | | ModifyOperation modifyOperation = |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | governingStructureRuleType = DirectoryServer.getAttributeType("governingstructurerule"); |
| | | governingStructureRuleType = DirectoryServer.getAttributeTypeOrNull("governingstructurerule"); |
| | | assertNotNull(governingStructureRuleType); |
| | | int resultCode = TestCaseUtils.applyModifications(true, |
| | | "dn: cn=schema", |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | hasSubordinatesType = DirectoryServer.getAttributeType("hassubordinates"); |
| | | hasSubordinatesType = DirectoryServer.getAttributeTypeOrNull("hassubordinates"); |
| | | assertNotNull(hasSubordinatesType); |
| | | |
| | | entries = TestCaseUtils.makeEntries( |
| | |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | |
| | | isMemberOfType = DirectoryServer.getAttributeType("ismemberof"); |
| | | isMemberOfType = DirectoryServer.getAttributeTypeOrNull("ismemberof"); |
| | | assertNotNull(isMemberOfType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.restartServer(); |
| | | |
| | | numSubordinatesType = DirectoryServer.getAttributeType("numsubordinates"); |
| | | numSubordinatesType = DirectoryServer.getAttributeTypeOrNull("numsubordinates"); |
| | | assertNotNull(numSubordinatesType); |
| | | |
| | | entries = TestCaseUtils.makeEntries( |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeType("ds-pwp-last-login-time"); |
| | | AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeTypeOrNull("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.getAttributeTypeOrNull("pwdfailuretime"); |
| | | assertNotNull(authFailureTimesAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | |
| | | try |
| | | { |
| | | AttributeType pwdHistoryAttr = DirectoryServer.getAttributeType("pwdhistory"); |
| | | AttributeType pwdHistoryAttr = DirectoryServer.getAttributeTypeOrNull("pwdhistory"); |
| | | assertNotNull(pwdHistoryAttr); |
| | | |
| | | DN userDN = DN.valueOf("uid=test.user,o=test"); |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | structuralObjectClassType = DirectoryServer.getAttributeType("structuralobjectclass"); |
| | | structuralObjectClassType = DirectoryServer.getAttributeTypeOrNull("structuralobjectclass"); |
| | | assertNotNull(structuralObjectClassType); |
| | | } |
| | | |
| | |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @DataProvider(name = "invalidConfigs") |
| | | public Object[][] getInvalidConfigurations() |
| | | throws Exception |
| | | public Object[][] getInvalidConfigurations() throws Exception |
| | | { |
| | | List<Entry> entries = TestCaseUtils.makeEntries( |
| | | "dn: cn=No Map Attr,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: No Map Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "", |
| | | "dn: cn=No Map Colon,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: No Map Colon", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute-mapping: nomapcolon", |
| | | "", |
| | | "dn: cn=No Map Cert Attr,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: No Map Cert Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute-mapping: :cn", |
| | | "", |
| | | "dn: cn=No Map User Attr,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: No Map User Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute-mapping: cn:", |
| | | "", |
| | | "dn: cn=Undefined User Attr,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: Undefined User Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute-mapping: cn:undefined", |
| | | "", |
| | | "dn: cn=Duplicate Cert Attr,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: Duplicate Cert Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute-mapping: cn:cn", |
| | | "ds-cfg-subject-attribute-mapping: cn:sn", |
| | |
| | | "dn: cn=Duplicate User Attr,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: Duplicate User Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute-mapping: cn:cn", |
| | | "ds-cfg-subject-attribute-mapping: e:cn", |
| | |
| | | "dn: cn=Duplicate Cert Attr OID and Name,cn=Certificate Mappers,cn=config", |
| | | "objectClass: top", |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: " + |
| | | "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper", |
| | | "cn: Duplicate Cert Attr OID and Name", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute-mapping: cn:cn", |
| | | "ds-cfg-subject-attribute-mapping: 2.5.4.3:displayName"); |
| | |
| | | public void testRemoveMapAttribute() |
| | | throws Exception |
| | | { |
| | | String mapperDN = "cn=Subject Attribute to User Attribute," + |
| | | "cn=Certificate Mappers,cn=config"; |
| | | String mapperDN = "cn=Subject Attribute to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | Attribute a = |
| | | Attributes.empty(DirectoryServer.getAttributeType( |
| | | "ds-cfg-subject-attribute-mapping")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-subject-attribute-mapping")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList( |
| | | new Modification(ModificationType.DELETE, a)); |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | private void setBaseDNs(String[] baseDNs) |
| | | throws Exception |
| | | private void setBaseDNs(String[] baseDNs) throws Exception |
| | | { |
| | | String mapperDN = "cn=Subject Attribute to User Attribute," + |
| | | "cn=Certificate Mappers,cn=config"; |
| | | String mapperDN = "cn=Subject Attribute to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("ds-cfg-user-base-dn"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("ds-cfg-user-base-dn"); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType); |
| | | if (baseDNs != null) |
| | | { |
| | |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @DataProvider(name = "invalidConfigs") |
| | | public Object[][] getInvalidConfigurations() |
| | | throws Exception |
| | | public Object[][] getInvalidConfigurations() throws Exception |
| | | { |
| | | List<Entry> entries = TestCaseUtils.makeEntries( |
| | | "dn: cn=No Subject Attr,cn=Certificate Mappers,cn=config", |
| | |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-dn-to-user-attribute-certificate-mapper", |
| | | "cn: No Subject Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectDNToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectDNToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "", |
| | | "dn: cn=Undefined Subject Attr,cn=Certificate Mappers,cn=config", |
| | |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-dn-to-user-attribute-certificate-mapper", |
| | | "cn: Undefined Subject Attr", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectDNToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectDNToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute: undefined", |
| | | "", |
| | |
| | | "objectClass: ds-cfg-certificate-mapper", |
| | | "objectClass: ds-cfg-subject-dn-to-user-attribute-certificate-mapper", |
| | | "cn: Invalid Base DN", |
| | | "ds-cfg-java-class: org.opends.server.extensions." + |
| | | "SubjectDNToUserAttributeCertificateMapper", |
| | | "ds-cfg-java-class: org.opends.server.extensions.SubjectDNToUserAttributeCertificateMapper", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-subject-attribute: ds-certificate-subject-dn", |
| | | "ds-cfg-user-base-dn: invalid"); |
| | |
| | | throws Exception |
| | | { |
| | | String mapperDN = "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeType("ds-cfg-subject-attribute")); |
| | | Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-subject-attribute")); |
| | | |
| | | ArrayList<Modification> mods = newArrayList(new Modification(ModificationType.DELETE, a)); |
| | | ModifyOperation modifyOperation = |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | private void setBaseDNs(String[] baseDNs) |
| | | throws Exception |
| | | private void setBaseDNs(String[] baseDNs) throws Exception |
| | | { |
| | | String mapperDN = |
| | | "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | String mapperDN = "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config"; |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("ds-cfg-user-base-dn"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("ds-cfg-user-base-dn"); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType); |
| | | if (baseDNs != null) |
| | | { |
| | |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Test |
| | | public void testPrivilegeWithSuccessfulMappingDefaultConfig() |
| | | throws Exception |
| | | public void testPrivilegeWithSuccessfulMappingDefaultConfig() throws Exception |
| | | { |
| | | enableMapper(); |
| | | |
| | |
| | | TestCaseUtils.initializeTestBackend(true); |
| | | TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com"); |
| | | |
| | | subschemaSubentryType = DirectoryServer.getAttributeType("subschemasubentry"); |
| | | subschemaSubentryType = DirectoryServer.getAttributeTypeOrNull("subschemasubentry"); |
| | | assertNotNull(subschemaSubentryType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | descriptionType = DirectoryServer.getAttributeType("description"); |
| | | descriptionType = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | assertNotNull(descriptionType); |
| | | |
| | | pwPolicyDNType = DirectoryServer.getAttributeType("ds-pwp-password-policy-dn"); |
| | | pwPolicyDNType = DirectoryServer.getAttributeTypeOrNull("ds-pwp-password-policy-dn"); |
| | | assertNotNull(pwPolicyDNType); |
| | | |
| | | privNameType = DirectoryServer.getAttributeType("ds-privilege-name"); |
| | | privNameType = DirectoryServer.getAttributeTypeOrNull("ds-privilege-name"); |
| | | assertNotNull(privNameType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | memberType = DirectoryServer.getAttributeType("member"); |
| | | memberType = DirectoryServer.getAttributeTypeOrNull("member"); |
| | | assertNotNull(memberType); |
| | | |
| | | uniqueMemberType = DirectoryServer.getAttributeType("uniquemember"); |
| | | uniqueMemberType = DirectoryServer.getAttributeTypeOrNull("uniquemember"); |
| | | assertNotNull(uniqueMemberType); |
| | | |
| | | groupManager = DirectoryServer.getGroupManager(); |
| | |
| | | public void testInitializeWithValidConfigsWithoutSchema(Entry e) |
| | | throws Exception |
| | | { |
| | | AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid"); |
| | | AttributeType entryUUIDType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | DirectoryServer.deregisterAttributeType(entryUUIDType); |
| | | |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | |
| | | 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 = DirectoryServer.getAttributeTypeOrNull("createtimestamp"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("creatorsname"); |
| | | AttributeType mtType = DirectoryServer.getAttributeTypeOrNull("modifytimestamp"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | |
| | | DirectoryServer.deregisterAttributeType(ctType); |
| | | DirectoryServer.deregisterAttributeType(cnType); |
| | |
| | | int sequence; |
| | | for (sequence = 1; sequence<=addSequenceLength; sequence ++) |
| | | { |
| | | entry.removeAttribute(getAttributeType("entryuuid")); |
| | | entry.removeAttribute(getAttributeTypeOrNull("entryuuid")); |
| | | 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(getAttributeTypeOrNull("entryuuid")); |
| | | 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(getAttributeTypeOrNull("entryuuid")); |
| | | 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(getAttributeTypeOrNull("entryuuid")); |
| | | 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(getAttributeTypeOrNull("entryuuid")); |
| | | 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.getAttributeTypeOrNull(REPLICATION_GENERATION_ID); |
| | | Attribute attr = resultEntry.getExactAttribute(synchronizationGenIDType, new HashSet<String>()); |
| | | return Long.valueOf(attr.iterator().next().toString()); |
| | | } |
| | |
| | | { |
| | | 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.getAttributeTypeOrNull("displayname"); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | String monitorAttr = "resolved-modify-conflicts"; |
| | | |
| | | /* |
| | |
| | | assertEquals(attrInfo4.getValuesHistorical().size(), 1); |
| | | |
| | | // Check |
| | | AttributeType type = DirectoryServer.getAttributeType(ATTRIBUTE_NAME); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull(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.getAttributeTypeOrNull(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = |
| | | resultEntry.getAttribute(synchronizationGenIDType); |
| | | if (attrs != null) |
| | |
| | | if (!first) |
| | | { |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer. |
| | | getAttributeType(fracAttr.toLowerCase()))); |
| | | getAttributeTypeOrNull(fracAttr.toLowerCase()))); |
| | | } |
| | | first = false; |
| | | } |
| | |
| | | first = false; |
| | | } |
| | | assertFalse(newEntry.hasAttribute(DirectoryServer. |
| | | getAttributeType(OPTIONAL_ATTR.toLowerCase()))); |
| | | getAttributeTypeOrNull(OPTIONAL_ATTR.toLowerCase()))); |
| | | break; |
| | | default: |
| | | fail("Unexpected fractional mode."); |
| | |
| | | if (!first) |
| | | { |
| | | assertFalse(entry.hasAttribute(DirectoryServer. |
| | | getAttributeType(fracAttr.toLowerCase()))); |
| | | getAttributeTypeOrNull(fracAttr.toLowerCase()))); |
| | | } |
| | | first = false; |
| | | } |
| | |
| | | first = false; |
| | | } |
| | | assertFalse(entry.hasAttribute(DirectoryServer. |
| | | getAttributeType(OPTIONAL_ATTR.toLowerCase()))); |
| | | getAttributeTypeOrNull(OPTIONAL_ATTR.toLowerCase()))); |
| | | break; |
| | | default: |
| | | fail("Unexpected fractional mode."); |
| | |
| | | private Entry waitTillEntryHasSynchroAttribute(String entryDN) |
| | | throws Exception |
| | | { |
| | | AttributeType synchroAttrType = DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR.toLowerCase()); |
| | | AttributeType synchroAttrType = DirectoryServer.getAttributeTypeOrNull(SYNCHRO_OPTIONAL_ATTR.toLowerCase()); |
| | | 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.getAttributeTypeOrNull(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME); |
| | | |
| | | logger.error(LocalizableMessage.raw("Starting replication test : changesCmpTest")); |
| | | |
| | |
| | | final DN dn1 = DN.valueOf("cn=test1," + TEST_ROOT_DN_STRING); |
| | | final DN dn2 = DN.valueOf("cn=test2," + TEST_ROOT_DN_STRING); |
| | | final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING); |
| | | final AttributeType attrType = |
| | | DirectoryServer.getAttributeType("displayname"); |
| | | final AttributeType entryuuidType = |
| | | DirectoryServer.getAttributeType("entryuuid"); |
| | | final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("displayname"); |
| | | final AttributeType entryuuidType = DirectoryServer.getAttributeTypeOrNull("entryuuid"); |
| | | |
| | | /* |
| | | * Open a session to the replicationServer using the broker API. |
| | |
| | | UUID uuid = UUID.randomUUID(); |
| | | |
| | | // Create the att values list |
| | | AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | AttributeType entryuuidAttrType = getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME); |
| | | 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(getAttributeTypeOrNull(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(getAttributeType(toLowerCase(attrName)), Collections.<String> emptySet()); |
| | | Attribute attr = entry.getExactAttribute(getAttributeTypeOrNull(toLowerCase(attrName)), Collections.<String> emptySet()); |
| | | assertThat(attr).hasSize(expectedValues.length); |
| | | for (String value : expectedValues) |
| | | { |
| | |
| | | |
| | | private String getEntryUUID(Entry entry) |
| | | { |
| | | AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME); |
| | | AttributeType entryuuidAttrType = getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME); |
| | | List<Attribute> uuidAttrs = entry.getOperationalAttributes().get(entryuuidAttrType); |
| | | return uuidAttrs.get(0).iterator().next().toString(); |
| | | } |
| | |
| | | CSN csn1 = new CSN(1, 0, 1); |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | @DataProvider(name = "createModifyDnData") |
| | | public Object[][] createModifyDnData() { |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | CSN csn2 = new CSN(TimeThread.getTime(), 123, 45); |
| | | CSN csn3 = new CSN(TimeThread.getTime(), 67894123, 45678); |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | @DataProvider(name = "createModifyDnData") |
| | | public Object[][] createModifyDnData() { |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | |
| | | Attribute attr1 = Attributes.create("description", "new value"); |
| | | Modification mod1 = new Modification(ModificationType.REPLACE, attr1); |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("attributetypes"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("attributetypes"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | if (attrList == null) |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("objectclasses"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("objectclasses"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | if (attrList == null) |
| | |
| | | continue; |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeType("nameforms"); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("nameforms"); |
| | | assertNotNull(attrType); |
| | | List<Attribute> attrList = e.getAttribute(attrType); |
| | | if (attrList == null) |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | // Initialize the CN attribute type used in all tests. |
| | | cnType = DirectoryServer.getAttributeType("cn"); |
| | | cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | Assert.assertNotNull(cnType); |
| | | |
| | | cnValue = ByteString.valueOf("john doe"); |
| | |
| | | public void testMultipleValuesForSingleValuedOperationalAttribute() |
| | | throws Exception |
| | | { |
| | | // The LDIF reader won't let us do this directly, so we have to hack around |
| | | // it. |
| | | // The LDIF reader won't let us do this directly, so we have to hack around it. |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | "dn: dc=example,dc=com", |
| | | "objectClass: top", |
| | | "objectClass: domain", |
| | | "dc: example"); |
| | | |
| | | AttributeType creatorsNameType = |
| | | DirectoryServer.getAttributeType("creatorsname"); |
| | | AttributeType creatorsNameType = DirectoryServer.getAttributeTypeOrNull("creatorsname"); |
| | | assertTrue(creatorsNameType.isOperational()); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(creatorsNameType, |
| | |
| | | { |
| | | assertEquals(conn.hasPrivilege(Privilege.CONFIG_READ, null), hasPrivilege); |
| | | |
| | | CompareOperation compareOperation = |
| | | conn.processCompare(DN.valueOf("cn=config"), |
| | | DirectoryServer.getAttributeType("cn"), |
| | | ByteString.valueOf("config")); |
| | | AttributeType cnAttrType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | CompareOperation compareOperation = conn.processCompare( |
| | | DN.valueOf("cn=config"), cnAttrType, ByteString.valueOf("config")); |
| | | if (hasPrivilege) |
| | | { |
| | | assertEquals(compareOperation.getResultCode(), COMPARE_TRUE); |
| | |
| | | FilterDescription description = new FilterDescription(); |
| | | |
| | | description.filterType = filterType; |
| | | description.attributeType = DirectoryServer.getAttributeType(attributeType); |
| | | description.attributeType = DirectoryServer.getAttributeTypeOrNull(attributeType); |
| | | description.assertionValue = ByteString.valueOf(attributeValue); |
| | | |
| | | if (filterType == FilterType.EQUALITY) { |
| | |
| | | FilterDescription description = new FilterDescription(); |
| | | |
| | | description.filterType = FilterType.SUBSTRING; |
| | | description.attributeType = DirectoryServer.getAttributeType(attributeType); |
| | | description.attributeType = DirectoryServer.getAttributeTypeOrNull(attributeType); |
| | | |
| | | description.subInitialElement = ByteString.valueOf(subInitial); |
| | | description.subAnyElements = new ArrayList<>(); |
| | |
| | | */ |
| | | @Test |
| | | public void testParseAttributeNotFound() throws Exception { |
| | | AttributeType type1 = DirectoryServer.getAttributeType("description"); |
| | | AttributeType type2 = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type1 = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AttributeType type2 = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type1, "hello world"); |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testParseAttributeBooleanTrue() throws Exception { |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "true"); |
| | | |
| | | assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(), |
| | | Boolean.TRUE); |
| | | assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(), Boolean.TRUE); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Test |
| | | public void testParseAttributeBooleanFalse() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "false"); |
| | | |
| | | assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(), |
| | | Boolean.FALSE); |
| | | assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(), Boolean.FALSE); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Test(expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testParseAttributeBooleanBad() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeType("inheritable"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable"); |
| | | |
| | | Entry entry = createTestEntry(type, "bad-value"); |
| | | entry.parseAttribute(type.getNameOrOID()).asBoolean(); |
| | |
| | | @Test |
| | | public void testParseAttributesInteger() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer |
| | | .getAttributeType("supportedldapversion"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("supportedldapversion"); |
| | | String[] values = new String[] { "-4", "-2", "0", "1", "3" }; |
| | | |
| | | HashSet<Integer> expected = new HashSet<>(); |
| | |
| | | @Test(expectedExceptions = LocalizedIllegalArgumentException.class) |
| | | public void testParseAttributeIntegerBad() throws Exception |
| | | { |
| | | AttributeType type = DirectoryServer |
| | | .getAttributeType("supportedldapversion"); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrNull("supportedldapversion"); |
| | | String[] values = new String[] { "-4", "-2", "xxx", "1", "3" }; |
| | | |
| | | Entry entry = createTestEntry(type, values); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | |
| | | assertTrue(e.hasAttribute(ocType)); |
| | | assertTrue(e.hasAttribute(cnType)); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | |
| | | assertFalse(e.hasUserAttribute(ocType)); |
| | | assertTrue(e.hasUserAttribute(cnType)); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | |
| | | assertFalse(e.hasOperationalAttribute(ocType)); |
| | | assertFalse(e.hasOperationalAttribute(cnType)); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | |
| | | List<Attribute> attrs = e.getAttribute(ocType); |
| | | assertNotNull(attrs); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | |
| | | List<Attribute> attrs = e.getUserAttribute(ocType); |
| | | assertNull(attrs); |
| | |
| | | assertTrue(e.conformsToSchema(null, false, false, false, |
| | | new LocalizableMessageBuilder())); |
| | | |
| | | AttributeType ocType = DirectoryServer.getAttributeType("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeType("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeType("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass"); |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name"); |
| | | AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname"); |
| | | |
| | | List<Attribute> attrs = e.getOperationalAttribute(ocType); |
| | | assertNull(attrs); |
| | |
| | | // we'll start the server. |
| | | TestCaseUtils.startServer(); |
| | | |
| | | AT_DC = DirectoryServer.getAttributeType("dc"); |
| | | AT_CN = DirectoryServer.getAttributeType("cn"); |
| | | AT_DC = DirectoryServer.getAttributeTypeOrNull("dc"); |
| | | AT_CN = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | |
| | | AttributeType dummy = DirectoryServer.getDefaultAttributeType( |
| | | "x-test-integer-type", DirectoryServer |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | } |
| | | |
| | |
| | | { |
| | | TestCaseUtils.startServer(); |
| | | |
| | | entryDNType = DirectoryServer.getAttributeType("entrydn"); |
| | | entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn"); |
| | | assertNotNull(entryDNType); |
| | | |
| | | EntryDNVirtualAttributeProvider provider = |
| | |
| | | OC_PERSON = DirectoryServer.getObjectClass("person"); |
| | | |
| | | AT_OC = DirectoryServer.getObjectClassAttributeType(); |
| | | AT_CN = DirectoryServer.getAttributeType("cn"); |
| | | AT_SN = DirectoryServer.getAttributeType("sn"); |
| | | AT_DESCR = DirectoryServer.getAttributeType("description"); |
| | | AT_TELN = DirectoryServer.getAttributeType("telephonenumber"); |
| | | AT_CN = DirectoryServer.getAttributeTypeOrNull("cn"); |
| | | AT_SN = DirectoryServer.getAttributeTypeOrNull("sn"); |
| | | AT_DESCR = DirectoryServer.getAttributeTypeOrNull("description"); |
| | | AT_TELN = DirectoryServer.getAttributeTypeOrNull("telephonenumber"); |
| | | |
| | | // Create a temporary file containing an attribute value. |
| | | TEMP_FILE = File.createTempFile("tmp", "txt"); |
| | |
| | | Assert.assertTrue(change instanceof ModifyChangeRecordEntry); |
| | | modify = (ModifyChangeRecordEntry) change; |
| | | |
| | | dn = DN |
| | | .valueOf("cn=Ingrid Jensen, ou=Product Support, dc=airius, dc=com"); |
| | | dn = DN.valueOf("cn=Ingrid Jensen, ou=Product Support, dc=airius, dc=com"); |
| | | Assert.assertEquals(modify.getDN(), dn); |
| | | |
| | | i = modify.getModifications().iterator(); |
| | | |
| | | Assert.assertTrue(i.hasNext()); |
| | | mod = i.next().toModification(); |
| | | Assert.assertEquals(mod.getModificationType(), |
| | | ModificationType.REPLACE); |
| | | attr = Attributes.empty(DirectoryServer |
| | | .getAttributeType("postaladdress")); |
| | | Assert.assertEquals(mod.getModificationType(), ModificationType.REPLACE); |
| | | attr = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("postaladdress")); |
| | | Assert.assertEquals(mod.getAttribute(), attr); |
| | | |
| | | // Change record #7. |